@canonical/react-ds-global-form 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +40 -0
  2. package/dist/esm/density.css +320 -302
  3. package/dist/esm/docs/examples/density-examples.css +19 -14
  4. package/dist/esm/index.css +361 -335
  5. package/dist/esm/lib/_work_in_progress/DensityTestbed/baseline-system.css +71 -64
  6. package/dist/esm/lib/_work_in_progress/DensityTestbed/density.testbed.css +127 -123
  7. package/dist/esm/lib/common/Wrapper/ToggleWrapper.css +73 -54
  8. package/dist/esm/lib/common/Wrapper/styles.css +35 -31
  9. package/dist/esm/lib/component/ChoicesField/common/Option/Option.js +4 -1
  10. package/dist/esm/lib/component/ChoicesField/common/Option/Option.js.map +1 -1
  11. package/dist/esm/lib/component/ChoicesField/styles.css +195 -163
  12. package/dist/esm/lib/component/RangeField/common/RangeControl/styles.css +39 -35
  13. package/dist/esm/lib/component/RichChoicesField/styles.css +93 -89
  14. package/dist/esm/lib/subcomponent/CheckboxInput/styles.css +115 -111
  15. package/dist/esm/lib/subcomponent/ColorInput/styles.css +177 -173
  16. package/dist/esm/lib/subcomponent/ComboboxInput/SingleCombobox.js.map +1 -1
  17. package/dist/esm/lib/subcomponent/ComboboxInput/common/List/styles.css +33 -29
  18. package/dist/esm/lib/subcomponent/ComboboxInput/common/ResetButton/styles.css +21 -17
  19. package/dist/esm/lib/subcomponent/ComboboxInput/styles.css +59 -55
  20. package/dist/esm/lib/subcomponent/DateInput/styles.css +23 -19
  21. package/dist/esm/lib/subcomponent/DateTimeInput/styles.css +24 -20
  22. package/dist/esm/lib/subcomponent/Field/Description/styles.css +9 -5
  23. package/dist/esm/lib/subcomponent/Field/Error/styles.css +9 -5
  24. package/dist/esm/lib/subcomponent/Field/Label/Label.js +2 -2
  25. package/dist/esm/lib/subcomponent/Field/Label/Label.js.map +1 -1
  26. package/dist/esm/lib/subcomponent/Field/Label/styles.css +25 -21
  27. package/dist/esm/lib/subcomponent/FileUploadInput/styles.css +125 -119
  28. package/dist/esm/lib/subcomponent/NumberInput/styles.css +32 -28
  29. package/dist/esm/lib/subcomponent/PasswordInput/styles.css +58 -54
  30. package/dist/esm/lib/subcomponent/PhoneInput/styles.css +53 -49
  31. package/dist/esm/lib/subcomponent/RadioInput/styles.css +70 -66
  32. package/dist/esm/lib/subcomponent/RangeInput/styles.css +74 -70
  33. package/dist/esm/lib/subcomponent/RatingInput/styles.css +132 -128
  34. package/dist/esm/lib/subcomponent/SelectInput/styles.css +44 -40
  35. package/dist/esm/lib/subcomponent/SwitchInput/styles.css +90 -86
  36. package/dist/esm/lib/subcomponent/TextInput/styles.css +30 -26
  37. package/dist/esm/lib/subcomponent/TextareaInput/styles.css +14 -10
  38. package/dist/esm/lib/subcomponent/TimeInput/styles.css +19 -15
  39. package/dist/esm/lib/utils/middleware/addRESTValidation.js +1 -1
  40. package/dist/esm/lib/utils/middleware/addRESTValidation.js.map +1 -1
  41. package/dist/types/lib/component/ChoicesField/common/Option/Option.d.ts.map +1 -1
  42. package/dist/types/lib/subcomponent/ComboboxInput/SingleCombobox.d.ts.map +1 -1
  43. package/package.json +17 -16
@@ -22,336 +22,354 @@
22
22
  * @canonical/styles (--control-seat-line/-basis): no fixed heights; border +
23
23
  * seat pads + line-height add up to the density cell. Zero-JS (cap-unit
24
24
  * approximation); holds to the cap tolerance.
25
+ *
26
+ * Layer: ds.components.global (@canonical/styles README, "Cascade layers").
25
27
  */
26
28
 
27
- /* ── TRANSITIONAL: the fixed-height box (direct date/time chromes only) ──────
28
- * The ORIGINAL density box: a FIXED grid-multiple height with border-box so the
29
- * border is absorbed into the height. The composite text family, the select and
30
- * the textarea have all moved OFF this rule onto the intrinsic seat (their
31
- * equal-specificity rules further down override it); it still governs the
32
- * remaining direct chromes — date, time, datetime — whose multi-part UA
33
- * internals need their own measured pass before they join.
34
- *
35
- * Controls no longer carry `.p` — the density system supplies the body font tier
36
- * (font-size / weight / family) here. */
37
- /* NB `.ds.input.textarea` is EXCLUDED: the textarea seats intrinsically (its own
38
- * rule below) and must keep its multi-row min-height. */
39
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input:not(.textarea) {
40
- box-sizing: border-box;
41
- /* Same effective line-height the target-baseline uses (single source of the
42
- fallback chain), so a bare context class keeps a valid box height too. */
43
- --density-box-height: var(--density-line-height-effective);
44
- block-size: var(--density-box-height);
45
- min-block-size: var(--density-box-height);
46
- align-items: flex-start;
47
- justify-content: flex-start;
48
- /* Kill the UA BOTTOM padding only. Do NOT zero padding-block-start here: this
49
- selector is more specific (0,4,0) than the placement rule below (0,2,0), so a
50
- `padding-block: 0` shorthand would out-specify and WIPE the placement's
51
- `padding-block-start: var(--space-before)` — leaving the label pinned to the
52
- box top (off the baseline). The placement rule owns the start. */
53
- padding-block-end: 0;
29
+ @layer ds.components.global {
30
+ /* ── TRANSITIONAL: the fixed-height box (direct date/time chromes only) ──────
31
+ * The ORIGINAL density box: a FIXED grid-multiple height with border-box so the
32
+ * border is absorbed into the height. The composite text family, the select and
33
+ * the textarea have all moved OFF this rule onto the intrinsic seat (their
34
+ * equal-specificity rules further down override it); it still governs the
35
+ * remaining direct chromes — date, time, datetime — whose multi-part UA
36
+ * internals need their own measured pass before they join.
37
+ *
38
+ * Controls no longer carry `.p` — the density system supplies the body font tier
39
+ * (font-size / weight / family) here. */
40
+ /* NB `.ds.input.textarea` is EXCLUDED: the textarea seats intrinsically (its own
41
+ * rule below) and must keep its multi-row min-height. */
42
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input:not(.textarea) {
43
+ box-sizing: border-box;
44
+ /* Same effective line-height the target-baseline uses (single source of the
45
+ fallback chain), so a bare context class keeps a valid box height too. */
46
+ --density-box-height: var(--density-line-height-effective);
47
+ block-size: var(--density-box-height);
48
+ min-block-size: var(--density-box-height);
49
+ align-items: flex-start;
50
+ justify-content: flex-start;
51
+ /* Kill the UA BOTTOM padding only. Do NOT zero padding-block-start here: this
52
+ selector is more specific (0,4,0) than the placement rule below (0,2,0), so a
53
+ `padding-block: 0` shorthand would out-specify and WIPE the placement's
54
+ `padding-block-start: var(--space-before)` — leaving the label pinned to the
55
+ box top (off the baseline). The placement rule owns the start. */
56
+ padding-block-end: 0;
54
57
 
55
- /* Body font tier — what `.p` used to supply. */
56
- font-size: var(--typography-text-primary-font-size);
57
- font-family: var(--typography-text-primary-font-family);
58
- }
58
+ /* Body font tier — what `.p` used to supply. */
59
+ font-size: var(--typography-text-primary-font-size);
60
+ font-family: var(--typography-text-primary-font-family);
61
+ }
59
62
 
60
- /* The input WRAPPER is the box (like the button element): don't stretch its
61
- * child, top-reference it so the input's own space-before governs. Needs to beat
62
- * the TextInput's `.ds.input.text { align-items: stretch }` (0,3,0). */
63
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input.text,
64
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input {
65
- align-items: flex-start;
66
- }
63
+ /* The input WRAPPER is the box (like the button element): don't stretch its
64
+ * child, top-reference it so the input's own space-before governs. Needs to beat
65
+ * the TextInput's `.ds.input.text { align-items: stretch }` (0,3,0). */
66
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input.text,
67
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input {
68
+ align-items: flex-start;
69
+ }
67
70
 
68
- /* The <input> is the text carrier — treat it exactly like the button label:
69
- * same body font tier, and normalised so only the space-before (below) positions
70
- * its text. (It's content-box with an intrinsic height, so reset that.) */
71
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input > input {
72
- box-sizing: border-box;
73
- min-block-size: 0;
74
- block-size: auto;
75
- margin-block: 0;
76
- font-size: var(--typography-text-primary-font-size);
77
- font-family: var(--typography-text-primary-font-family);
78
- }
71
+ /* The <input> is the text carrier — treat it exactly like the button label:
72
+ * same body font tier, and normalised so only the space-before (below) positions
73
+ * its text. (It's content-box with an intrinsic height, so reset that.) */
74
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input > input {
75
+ box-sizing: border-box;
76
+ min-block-size: 0;
77
+ block-size: auto;
78
+ margin-block: 0;
79
+ font-size: var(--typography-text-primary-font-size);
80
+ font-family: var(--typography-text-primary-font-family);
81
+ }
79
82
 
80
- /* ── Baseline placement: `.baseline` nudge + `--space-before` ───────────────
81
- * Two parts, the combination that put controls ON the grid:
82
- *
83
- * 1. NUDGE (the DS.01 `.baseline` mechanism): --bl-start-nudge snaps the text's
84
- * first baseline onto the NEAREST grid line, computed from the element's own
85
- * font (1cap + line-height) — font-relative, so it's exact at any size and
86
- * needs no per-element fudge. This is what lands text exactly on a line.
87
- *
88
- * 2. --space-before: whole baselines added to move that snapped baseline DOWN to
89
- * the density TARGET line (round-up of the remaining distance), less the box's
90
- * own top border.
91
- *
92
- * padding-block-start = bl-start-nudge + space-before − border-top
93
- * space-before = round(up, target − bl-start-nudge − border-top, baseline)
94
- *
95
- * Applies to the button, the input, and the field label/description/error — i.e.
96
- * CONTROL-like text only. Bare prose (p / .p / h1–h6) is DELIBERATELY NOT here:
97
- * running text belongs to the typography engine, which already seats it on the
98
- * grid (snapped --computed-line-height + --start/--end-nudge) and lets `.editorial`
99
- * add its inter-block margins. Density crushing prose to line-height:1 fought that
100
- * engine (and only ever put the FIRST line on-grid — wrapped lines drifted). By
101
- * partitioning prose OUT, density and the engine write to disjoint element sets,
102
- * so `.editorial` composes with density with no specificity war. `:is()` (not
103
- * `:where()`) still gives the control seat the specificity to beat a control's own
104
- * centring (e.g. the Button's `align-items: center`). */
105
- /* Body font tier for the field label/description/error, which lost `.p`. Scoped
106
- to just these (NOT the headings, which keep their own tier). */
107
- :is(.comfortable, .dense, .app, .site, .docs)
108
- :is(.ds.field-label, .ds.field-description, .ds.field-error) {
109
- font-size: var(--typography-text-primary-font-size);
110
- font-family: var(--typography-text-primary-font-family);
111
- }
83
+ /* ── Baseline placement: `.baseline` nudge + `--space-before` ───────────────
84
+ * Two parts, the combination that put controls ON the grid:
85
+ *
86
+ * 1. NUDGE (the DS.01 `.baseline` mechanism): --bl-start-nudge snaps the text's
87
+ * first baseline onto the NEAREST grid line, computed from the element's own
88
+ * font (1cap + line-height) — font-relative, so it's exact at any size and
89
+ * needs no per-element fudge. This is what lands text exactly on a line.
90
+ *
91
+ * 2. --space-before: whole baselines added to move that snapped baseline DOWN to
92
+ * the density TARGET line (round-up of the remaining distance), less the box's
93
+ * own top border.
94
+ *
95
+ * padding-block-start = bl-start-nudge + space-before − border-top
96
+ * space-before = round(up, target − bl-start-nudge − border-top, baseline)
97
+ *
98
+ * Applies to the button, the input, and the field label/description/error — i.e.
99
+ * CONTROL-like text only. Bare prose (p / .p / h1–h6) is DELIBERATELY NOT here:
100
+ * running text belongs to the typography engine, which already seats it on the
101
+ * grid (snapped --computed-line-height + --start/--end-nudge) and lets `.editorial`
102
+ * add its inter-block margins. Density crushing prose to line-height:1 fought that
103
+ * engine (and only ever put the FIRST line on-grid — wrapped lines drifted). By
104
+ * partitioning prose OUT, density and the engine write to disjoint element sets,
105
+ * so `.editorial` composes with density with no specificity war. `:is()` (not
106
+ * `:where()`) still gives the control seat the specificity to beat a control's own
107
+ * centring (e.g. the Button's `align-items: center`). */
108
+ /* Body font tier for the field label/description/error plus the toggle control
109
+ row (its own line metrics must match the label's so the control row centres
110
+ exactly), which lost `.p`. Scoped to just these (NOT the headings, which
111
+ keep their own tier). */
112
+ :is(.comfortable, .dense, .app, .site, .docs)
113
+ :is(
114
+ .ds.field-label,
115
+ .ds.field-description,
116
+ .ds.field-error,
117
+ .ds.field-toggle,
118
+ .ds.option
119
+ ) {
120
+ font-size: var(--typography-text-primary-font-size);
121
+ font-family: var(--typography-text-primary-font-family);
122
+ }
112
123
 
113
- :is(.comfortable, .dense, .app, .site, .docs)
114
- :is(.ds.field-label, .ds.field-description, .ds.field-error) {
115
- line-height: 1;
116
- /* Baseline within a line-height:1 box (font-relative cap approximation). */
117
- --natural-baseline: calc((1em + 1cap) / 2);
118
- /* Pad the top so the baseline lands at the density target, less the box's own
119
- top border. */
120
- --space-before: max(
121
- 0px,
122
- calc(
123
- var(--density-target-baseline-px, 0px) -
124
- var(--natural-baseline) -
125
- var(--border-top-width, 0px)
126
- )
127
- );
128
- padding-block-start: var(--space-before);
129
- padding-block-end: 0;
130
- }
124
+ :is(.comfortable, .dense, .app, .site, .docs)
125
+ :is(
126
+ .ds.field-label,
127
+ .ds.field-description,
128
+ .ds.field-error,
129
+ .ds.field-toggle,
130
+ .ds.option
131
+ ) {
132
+ line-height: 1;
133
+ /* Baseline within a line-height:1 box (font-relative cap approximation). */
134
+ --natural-baseline: calc((1em + 1cap) / 2);
135
+ /* Pad the top so the baseline lands at the density target, less the box's own
136
+ top border. */
137
+ --space-before: max(
138
+ 0px,
139
+ calc(
140
+ var(--density-target-baseline-px, 0px) -
141
+ var(--natural-baseline) -
142
+ var(--border-top-width, 0px)
143
+ )
144
+ );
145
+ padding-block-start: var(--space-before);
146
+ padding-block-end: 0;
147
+ }
131
148
 
132
- /* ── Intrinsic control seat: the composite text-input family ─────────────────
133
- * The single-line <input> no longer uses the line-height:1 crush + space-before
134
- * padding above (that rule is now labels-only). Instead it consumes the SHARED
135
- * control seat from @canonical/styles (modifiers.density.css): the input's own
136
- * line box (cell − 2 baselines) is the control interior, `--control-seat-before`
137
- * seats its baseline on the density target, and the CHROME closes the box with
138
- * `--control-seat-after` — so the chrome's height is INTRINSIC (no fixed
139
- * block-size) yet lands exactly on the density cell, both edges on the grid.
140
- *
141
- * Placed AFTER the fixed-height box rule above so this (equal-specificity)
142
- * rule wins for the text family. Direct chromes (select/date/time) and the
143
- * textarea keep the previous model until their own cutover pass. */
144
- :is(.comfortable, .dense, .app, .site, .docs)
149
+ /* ── Intrinsic control seat: the composite text-input family ─────────────────
150
+ * The single-line <input> no longer uses the line-height:1 crush + space-before
151
+ * padding above (that rule is now labels-only). Instead it consumes the SHARED
152
+ * control seat from @canonical/styles (modifiers.density.css): the input's own
153
+ * line box (cell − 2 baselines) is the control interior, `--control-seat-before`
154
+ * seats its baseline on the density target, and the CHROME closes the box with
155
+ * `--control-seat-after` — so the chrome's height is INTRINSIC (no fixed
156
+ * block-size) yet lands exactly on the density cell, both edges on the grid.
157
+ *
158
+ * Placed AFTER the fixed-height box rule above so this (equal-specificity)
159
+ * rule wins for the text family. Direct chromes (select/date/time) and the
160
+ * textarea keep the previous model until their own cutover pass. */
161
+ :is(.comfortable, .dense, .app, .site, .docs)
145
162
  .ds.input:is(.text, .number, .password, .phone) {
146
- /* The COMPOSITE chrome family — every wrapper with an inner <input> leaf
147
- (text, number, password, phone). One selector, one seat: the wrapper is
148
- the box, the leaf carries the line. */
163
+ /* The COMPOSITE chrome family — every wrapper with an inner <input> leaf
164
+ (text, number, password, phone). One selector, one seat: the wrapper is
165
+ the box, the leaf carries the line. */
149
166
 
150
- /* NO drift term here — deliberately. The old ~2px "native input renders low"
151
- compensation was an artifact of the line-height:1 crush structure: give the
152
- <input> a real line box (--control-seat-line below) and it renders its text
153
- exactly like a <span> (measured; see the drift note at the end of this
154
- file). Subtracting the stale 2px lifted the text 2px too high. */
167
+ /* NO drift term here — deliberately. The old ~2px "native input renders low"
168
+ compensation was an artifact of the line-height:1 crush structure: give the
169
+ <input> a real line box (--control-seat-line below) and it renders its text
170
+ exactly like a <span> (measured; see the drift note at the end of this
171
+ file). Subtracting the stale 2px lifted the text 2px too high. */
155
172
 
156
- /* The UA enforces a line-height FLOOR of `normal` (1.2em for Ubuntu) on a
157
- single-line <input> — a specified line-height below it is silently clamped
158
- (measured: dense's 16px line rendered 16.8px tall, pushing the chrome to
159
- 24.8). So the seat computes with the FLOORED line the UA will actually
160
- use; the box then closes to the cell exactly in every density cell. */
161
- --seat-line-floored: max(var(--control-seat-line), 1.2em);
173
+ /* The UA enforces a line-height FLOOR of `normal` (1.2em for Ubuntu) on a
174
+ single-line <input> — a specified line-height below it is silently clamped
175
+ (measured: dense's 16px line rendered 16.8px tall, pushing the chrome to
176
+ 24.8). So the seat computes with the FLOORED line the UA will actually
177
+ use; the box then closes to the cell exactly in every density cell. */
178
+ --seat-line-floored: max(var(--control-seat-line), 1.2em);
162
179
 
163
- /* The chrome's border folds in HERE (a var() inside a custom property
164
- substitutes at its declaring element, so the shared layer cannot read it).
165
- Derived from the target directly — not --control-seat-basis — because the
166
- basis assumes the unfloored line. Both the leaf's top pad and the chrome's
167
- closing pad read this SAME `--seat-before`, keeping the complement
168
- consistent. Rounded to ¼px so the pad is exactly representable in 1/64px
169
- layout units (the fractional 1cap term otherwise leaves ~1/60px residues
170
- on the box height). */
171
- --seat-before: round(
172
- nearest,
173
- max(
180
+ /* The chrome's border folds in HERE (a var() inside a custom property
181
+ substitutes at its declaring element, so the shared layer cannot read it).
182
+ Derived from the target directly — not --control-seat-basis — because the
183
+ basis assumes the unfloored line. Both the leaf's top pad and the chrome's
184
+ closing pad read this SAME `--seat-before`, keeping the complement
185
+ consistent. Rounded to ¼px so the pad is exactly representable in 1/64px
186
+ layout units (the fractional 1cap term otherwise leaves ~1/60px residues
187
+ on the box height). */
188
+ --seat-before: round(
189
+ nearest,
190
+ max(
191
+ 0px,
192
+ calc(
193
+ var(--density-target-baseline-px, 0px) -
194
+ (var(--seat-line-floored) + 1cap) /
195
+ 2 -
196
+ var(--form-input-border-width, 0px)
197
+ )
198
+ ),
199
+ 0.25px
200
+ );
201
+ --seat-after: max(
174
202
  0px,
175
203
  calc(
176
- var(--density-target-baseline-px, 0px) -
177
- (var(--seat-line-floored) + 1cap) /
178
- 2 -
204
+ var(--density-line-height-effective) -
205
+ var(--seat-line-floored) -
206
+ var(--seat-before) -
207
+ 2 *
179
208
  var(--form-input-border-width, 0px)
180
209
  )
181
- ),
182
- 0.25px
183
- );
184
- --seat-after: max(
185
- 0px,
186
- calc(
187
- var(--density-line-height-effective) -
188
- var(--seat-line-floored) -
189
- var(--seat-before) -
190
- 2 *
191
- var(--form-input-border-width, 0px)
192
- )
193
- );
210
+ );
194
211
 
195
- block-size: auto;
196
- min-block-size: 0;
197
- padding-block-end: var(--seat-after);
198
- /* Stretch (not the box rule's flex-start): a prefix/suffix — the password's
199
- reveal-toggle, the number's unit affix — spans the leaf's column and its
200
- own `align-items: center` centres its icon on the TEXT, which is the
201
- optical pairing (centring on the box would float it into the asymmetric
202
- closing pad). The old fixed-height model needed flex-start to top-pin the
203
- crushed leaf; the intrinsic leaf seats itself, so stretch is safe again. */
204
- align-items: stretch;
205
- }
206
- :is(.comfortable, .dense, .app, .site, .docs)
207
- .ds.input:is(.text, .number, .password, .phone)
208
- > input {
209
- line-height: var(--seat-line-floored);
210
- padding-block-start: var(--seat-before);
211
- padding-block-end: 0;
212
- }
212
+ block-size: auto;
213
+ min-block-size: 0;
214
+ padding-block-end: var(--seat-after);
215
+ /* Stretch (not the box rule's flex-start): a prefix/suffix — the password's
216
+ reveal-toggle, the number's unit affix — spans the leaf's column and its
217
+ own `align-items: center` centres its icon on the TEXT, which is the
218
+ optical pairing (centring on the box would float it into the asymmetric
219
+ closing pad). The old fixed-height model needed flex-start to top-pin the
220
+ crushed leaf; the intrinsic leaf seats itself, so stretch is safe again. */
221
+ align-items: stretch;
222
+ }
223
+ :is(.comfortable, .dense, .app, .site, .docs)
224
+ .ds.input:is(.text, .number, .password, .phone)
225
+ > input {
226
+ line-height: var(--seat-line-floored);
227
+ padding-block-start: var(--seat-before);
228
+ padding-block-end: 0;
229
+ }
213
230
 
214
- /* ── Textarea: many rows of the SAME intrinsic seat ──────────────────────────
215
- * The textarea is a single element (it carries the chrome itself), so it seats
216
- * like the button: the interior line box is `--control-seat-line` — which is a
217
- * WHOLE baseline multiple in every cell (cell − 2 bU) — so EVERY row advances
218
- * one grid interval, not just the first. The complement pad closes the box so
219
- * border + seat-before + N·line + seat-after + border ends on a grid line for
220
- * ANY row count N: the N-independent part equals (cell − line) ≡ 0 (mod 1 bU).
221
- * One seat, no multi-line special case.
222
- *
223
- * Two deliberate differences from the single-line input:
224
- * · NO line-height floor — the UA's `normal` clamp is specific to single-line
225
- * <input>; a textarea honours its specified line-height, and a floored
226
- * 16.8px line would knock every dense row off the grid.
227
- * · NO drift term — like the single-line input, the old ~2px knob was an
228
- * artifact of the crush-era structure (see the drift note below).
229
- *
230
- * The previous revision seated the first row via --td-space-before ON TOP of
231
- * the chrome's 8px block padding, targeting the OLD round(up) table; under the
232
- * round(nearest) targets that formula clamps to zero in every cell (the full
233
- * cell line-height puts the natural baseline below the target), which left the
234
- * textarea unseated entirely. The interior line box makes the target reachable
235
- * again. */
236
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input.textarea {
237
- line-height: var(--control-seat-line);
238
- font-size: var(--typography-text-primary-font-size);
239
- font-family: var(--typography-text-primary-font-family);
231
+ /* ── Textarea: many rows of the SAME intrinsic seat ──────────────────────────
232
+ * The textarea is a single element (it carries the chrome itself), so it seats
233
+ * like the button: the interior line box is `--control-seat-line` — which is a
234
+ * WHOLE baseline multiple in every cell (cell − 2 bU) — so EVERY row advances
235
+ * one grid interval, not just the first. The complement pad closes the box so
236
+ * border + seat-before + N·line + seat-after + border ends on a grid line for
237
+ * ANY row count N: the N-independent part equals (cell − line) ≡ 0 (mod 1 bU).
238
+ * One seat, no multi-line special case.
239
+ *
240
+ * Two deliberate differences from the single-line input:
241
+ * · NO line-height floor — the UA's `normal` clamp is specific to single-line
242
+ * <input>; a textarea honours its specified line-height, and a floored
243
+ * 16.8px line would knock every dense row off the grid.
244
+ * · NO drift term — like the single-line input, the old ~2px knob was an
245
+ * artifact of the crush-era structure (see the drift note below).
246
+ *
247
+ * The previous revision seated the first row via --td-space-before ON TOP of
248
+ * the chrome's 8px block padding, targeting the OLD round(up) table; under the
249
+ * round(nearest) targets that formula clamps to zero in every cell (the full
250
+ * cell line-height puts the natural baseline below the target), which left the
251
+ * textarea unseated entirely. The interior line box makes the target reachable
252
+ * again. */
253
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input.textarea {
254
+ line-height: var(--control-seat-line);
255
+ font-size: var(--typography-text-primary-font-size);
256
+ font-family: var(--typography-text-primary-font-family);
240
257
 
241
- --seat-before: round(
242
- nearest,
243
- max(
258
+ --seat-before: round(
259
+ nearest,
260
+ max(
261
+ 0px,
262
+ calc(var(--control-seat-basis) - var(--form-input-border-width, 0px))
263
+ ),
264
+ 0.25px
265
+ );
266
+ --seat-after: max(
244
267
  0px,
245
- calc(var(--control-seat-basis) - var(--form-input-border-width, 0px))
246
- ),
247
- 0.25px
248
- );
249
- --seat-after: max(
250
- 0px,
251
- calc(
252
- var(--density-line-height-effective) -
253
- var(--control-seat-line) -
254
- var(--seat-before) -
255
- 2 *
256
- var(--form-input-border-width, 0px)
257
- )
258
- );
268
+ calc(
269
+ var(--density-line-height-effective) -
270
+ var(--control-seat-line) -
271
+ var(--seat-before) -
272
+ 2 *
273
+ var(--form-input-border-width, 0px)
274
+ )
275
+ );
259
276
 
260
- block-size: auto;
261
- padding-block: var(--seat-before) var(--seat-after);
262
- /* Five whole rows + the closing geometry (border-box), so the default box
263
- ends on-grid with the last row fully visible: 4·line + cell. */
264
- min-block-size: calc(
265
- 4 *
266
- var(--control-seat-line) +
267
- var(--density-line-height-effective)
268
- );
269
- }
277
+ block-size: auto;
278
+ padding-block: var(--seat-before) var(--seat-after);
279
+ /* Five whole rows + the closing geometry (border-box), so the default box
280
+ ends on-grid with the last row fully visible: 4·line + cell. */
281
+ min-block-size: calc(
282
+ 4 *
283
+ var(--control-seat-line) +
284
+ var(--density-line-height-effective)
285
+ );
286
+ }
270
287
 
271
- /* ── Select: a single-element direct chrome on the intrinsic seat ────────────
272
- * The <select> IS the chrome (border and text on one element), so it seats
273
- * like the button: interior line box + seat pads, height emerging as exactly
274
- * the density cell. Replaces the old fixed-height + 8px-block-padding path,
275
- * which never seated the option text at all and CLIPPED it in apps/dense
276
- * (24px fixed box − 8px pad left too little room for the line).
277
- * The line is floored like the single-line input's: a <select> shows one line,
278
- * so if the UA imposes a `normal` floor the formula already matches it, and if
279
- * it does not the specified floor is simply what renders — correct either way
280
- * (unlike the textarea, where flooring would break the multi-row rhythm).
281
- * Remaining direct chromes (date/time/datetime) stay on the previous model
282
- * until their own pass — their multi-part UA internals need their own
283
- * measurement. */
284
- :is(.comfortable, .dense, .app, .site, .docs) .ds.input.select {
285
- --seat-line-floored: max(var(--control-seat-line), 1.2em);
286
- line-height: var(--seat-line-floored);
288
+ /* ── Select: a single-element direct chrome on the intrinsic seat ────────────
289
+ * The <select> IS the chrome (border and text on one element), so it seats
290
+ * like the button: interior line box + seat pads, height emerging as exactly
291
+ * the density cell. Replaces the old fixed-height + 8px-block-padding path,
292
+ * which never seated the option text at all and CLIPPED it in apps/dense
293
+ * (24px fixed box − 8px pad left too little room for the line).
294
+ * The line is floored like the single-line input's: a <select> shows one line,
295
+ * so if the UA imposes a `normal` floor the formula already matches it, and if
296
+ * it does not the specified floor is simply what renders — correct either way
297
+ * (unlike the textarea, where flooring would break the multi-row rhythm).
298
+ * Remaining direct chromes (date/time/datetime) stay on the previous model
299
+ * until their own pass — their multi-part UA internals need their own
300
+ * measurement. */
301
+ :is(.comfortable, .dense, .app, .site, .docs) .ds.input.select {
302
+ --seat-line-floored: max(var(--control-seat-line), 1.2em);
303
+ line-height: var(--seat-line-floored);
287
304
 
288
- --seat-before: round(
289
- nearest,
290
- max(
305
+ --seat-before: round(
306
+ nearest,
307
+ max(
308
+ 0px,
309
+ calc(
310
+ var(--density-target-baseline-px, 0px) -
311
+ (var(--seat-line-floored) + 1cap) /
312
+ 2 -
313
+ var(--form-input-border-width, 0px)
314
+ )
315
+ ),
316
+ 0.25px
317
+ );
318
+ --seat-after: max(
291
319
  0px,
292
320
  calc(
293
- var(--density-target-baseline-px, 0px) -
294
- (var(--seat-line-floored) + 1cap) /
295
- 2 -
321
+ var(--density-line-height-effective) -
322
+ var(--seat-line-floored) -
323
+ var(--seat-before) -
324
+ 2 *
296
325
  var(--form-input-border-width, 0px)
297
326
  )
298
- ),
299
- 0.25px
300
- );
301
- --seat-after: max(
302
- 0px,
303
- calc(
304
- var(--density-line-height-effective) -
305
- var(--seat-line-floored) -
306
- var(--seat-before) -
307
- 2 *
308
- var(--form-input-border-width, 0px)
309
- )
310
- );
327
+ );
311
328
 
312
- block-size: auto;
313
- min-block-size: 0;
314
- padding-block: var(--seat-before) var(--seat-after);
315
- }
329
+ block-size: auto;
330
+ min-block-size: 0;
331
+ padding-block: var(--seat-before) var(--seat-after);
332
+ }
316
333
 
317
- /* ── Bottom rhythm: density-seated flow text only (NOT prose) ─────────────────
318
- * A BORDERED control (button, input wrapper) has a fixed `block-size` that is
319
- * already a whole baseline multiple, so its bottom rhythm is the box height —
320
- * no bottom padding needed (and it would be inert against the fixed height).
321
- *
322
- * The field label/description/error are density-seated with line-height:1, so
323
- * their box ends at the text descender; with `padding-block-end: 0` a following
324
- * grid/flow sibling (e.g. the textarea below a field label) resumes off-grid.
325
- * Fill the box out to a whole density line-height so its bottom lands on a grid
326
- * line. The `- 1em` term is correct precisely because these are line-height:1.
327
- *
328
- * Bare prose (p / .p / h1–h6) is NOT here: it is no longer density-seated (see the
329
- * partition above), so its box is its OWN snapped line-height and the engine's
330
- * --end-nudge already lands its bottom on the grid. Adding a density fill on top
331
- * would double-pad. Prose bottom rhythm belongs to the engine / `.editorial`. */
332
- :is(.comfortable, .dense, .app, .site, .docs)
334
+ /* ── Bottom rhythm: density-seated flow text only (NOT prose) ─────────────────
335
+ * A BORDERED control (button, input wrapper) has a fixed `block-size` that is
336
+ * already a whole baseline multiple, so its bottom rhythm is the box height —
337
+ * no bottom padding needed (and it would be inert against the fixed height).
338
+ *
339
+ * The field label/description/error are density-seated with line-height:1, so
340
+ * their box ends at the text descender; with `padding-block-end: 0` a following
341
+ * grid/flow sibling (e.g. the textarea below a field label) resumes off-grid.
342
+ * Fill the box out to a whole density line-height so its bottom lands on a grid
343
+ * line. The `- 1em` term is correct precisely because these are line-height:1.
344
+ *
345
+ * Bare prose (p / .p / h1–h6) is NOT here: it is no longer density-seated (see the
346
+ * partition above), so its box is its OWN snapped line-height and the engine's
347
+ * --end-nudge already lands its bottom on the grid. Adding a density fill on top
348
+ * would double-pad. Prose bottom rhythm belongs to the engine / `.editorial`. */
349
+ :is(.comfortable, .dense, .app, .site, .docs)
333
350
  :is(.ds.field-label, .ds.field-description, .ds.field-error) {
334
- padding-block-end: max(
335
- 0px,
336
- calc(
337
- var(
338
- --density-line-height,
339
- var(--density-lh-comfy, calc(var(--baseline-height) * 8))
340
- ) -
341
- var(--space-before) -
342
- 1em
343
- )
344
- );
345
- }
351
+ padding-block-end: max(
352
+ 0px,
353
+ calc(
354
+ var(
355
+ --density-line-height,
356
+ var(--density-lh-comfy, calc(var(--baseline-height) * 8))
357
+ ) -
358
+ var(--space-before) -
359
+ 1em
360
+ )
361
+ );
362
+ }
346
363
 
347
- /* ── The native-control text drift — RESOLVED for single-line inputs ──────────
348
- * The old ~2px "native <input> renders its text lower than a <span> at
349
- * byte-identical CSS" compensation (--control-text-drift-AVOID-USAGE) turned
350
- * out to be an artifact of the line-height:1 crush structure, NOT an inherent
351
- * UA quirk: with a real line box (line-height: --control-seat-line, the
352
- * intrinsic seat above) the <input> positions its text exactly like a <span>
353
- * (measured: input baseline == label baseline to 0.01px with no drift term).
354
- * That answers TODO(#15)'s "find the structural cause and delete it": the
355
- * intrinsic seat carries NO drift anywhere — the textarea's local copy went
356
- * with its old parallel seat when it joined the intrinsic model. The knob no
357
- * longer exists in this file. */
364
+ /* ── The native-control text drift — RESOLVED for single-line inputs ──────────
365
+ * The old ~2px "native <input> renders its text lower than a <span> at
366
+ * byte-identical CSS" compensation (--control-text-drift-AVOID-USAGE) turned
367
+ * out to be an artifact of the line-height:1 crush structure, NOT an inherent
368
+ * UA quirk: with a real line box (line-height: --control-seat-line, the
369
+ * intrinsic seat above) the <input> positions its text exactly like a <span>
370
+ * (measured: input baseline == label baseline to 0.01px with no drift term).
371
+ * That answers TODO(#15)'s "find the structural cause and delete it": the
372
+ * intrinsic seat carries NO drift anywhere — the textarea's local copy went
373
+ * with its old parallel seat when it joined the intrinsic model. The knob no
374
+ * longer exists in this file. */
375
+ }