@uni-design-system/uni-angular 10.0.0 → 10.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,259 @@
1
1
  # @uni-design-system/uni-angular
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`f28c951`](https://github.com/uni-design-system/uni/commit/f28c95117f2844b58a265b59c2ea8b9715156670) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-drawer` gains the API an editor panel needs, and a close it can refuse.
8
+
9
+ **Closing can now be vetoed.** Escape, the backdrop, the header's close button
10
+ and the footer's cancel all funnel through one decision that emits
11
+ `closeRequest` with a `reason` — `'escape' | 'backdrop' | 'close-button'`. Set
12
+ `disableAutoClose` and the drawer stops acting on its own: it asks, and waits
13
+ for you to set `open`.
14
+
15
+ That split exists because the confirmation it has to accommodate is
16
+ _asynchronous_. A synchronous veto — a preventable event — cannot express
17
+ "ask the user, then decide", so every consumer would prevent unconditionally
18
+ and close manually anyway. Leave `disableAutoClose` off and behaviour is
19
+ unchanged, so adding a listener alone breaks nothing.
20
+
21
+ ```html
22
+ <uni-drawer [(open)]="open" [disableAutoClose]="form.dirty()" (closeRequest)="confirmDiscard()" />
23
+ ```
24
+
25
+ New inputs: `width` (per-instance override of the theme's width — a nav drawer
26
+ is 280 and an editor panel 480, and both live in one app), `headline` and
27
+ `defaultCloseButton` for the header row, and `initialFocus`, a selector resolved
28
+ inside the panel when it opens.
29
+
30
+ **`ariaLabel` no longer defaults to `'Navigation'`.** A drawer with a header is
31
+ labelled by that header via `aria-labelledby`; without one, `ariaLabel` is used;
32
+ with neither, the drawer is unnamed. The old default meant every drawer that
33
+ wasn't a nav drawer announced itself as one, and a wrong accessible name is
34
+ worse than a missing one — the missing one is at least caught by an audit. If
35
+ you relied on it, set `ariaLabel="Navigation"` explicitly.
36
+
37
+ **`scrim` turns the dimming off** without changing the modality. As a `scrim`
38
+ input or a `drawer.behavior.scrim` theme option, false leaves `::backdrop`
39
+ transparent so the page behind stays legible — an editor panel beside a board
40
+ the user is still reading. Focus is still trapped and the page behind is still
41
+ inert: it is a visibility choice, not a modality one. `background` joins it,
42
+ selecting `solid`, `glass` or `gradient` as a token choice rather than per-app
43
+ CSS.
44
+
45
+ **Fixed: a closed overlay drawer rendered in normal flow behind the page.** The
46
+ panel's `display: flex` outranks the UA stylesheet's
47
+ `dialog:not([open]) { display: none }`, so the drawer was visible on first
48
+ paint and reappeared behind the content after every close. An explicit
49
+ `&:not([open])` rule restores it. The closing animation is unaffected — `open`
50
+ is only removed once it ends.
51
+
52
+ - [`f28c951`](https://github.com/uni-design-system/uni/commit/f28c95117f2844b58a265b59c2ea8b9715156670) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-drawer` is a three-row panel, and is no longer its own scroll container.
53
+
54
+ **The `<dialog>` used to be the scroller.** `over` mode set `overflowY: 'auto'`
55
+ on the panel and put the theme's padding there too, which made a pinned header
56
+ or footer impossible: padding on a scrolling box scrolls away with its content,
57
+ and any row you pinned against it could not sit flush to the panel edge. It also
58
+ set only the one axis — and a single explicit overflow axis computes the other
59
+ to `auto`, which is exactly how a container becomes an accidental scroller.
60
+ `side` had it right already, setting both.
61
+
62
+ The panel is now a flex column of three rows — an optional
63
+ `[uni-drawer-header]`, the projected body, an optional `[uni-drawer-buttons]`
64
+ (alias `[drawer-buttons]`) — and **only the body scrolls**. The panel itself is
65
+ `overflow: clip` on both axes, explicitly, never the shorthand. The body carries
66
+ `overscroll-behavior: contain`, so scrolling to its end does not start scrolling
67
+ the page behind it, and `position: relative`, so a stray absolutely positioned
68
+ descendant is contained rather than re-homed into an ancestor.
69
+
70
+ Those two must travel together: a positioned body _without_ a clipped shell is
71
+ worse than the status quo, because it pulls phantom overflow into the scroller
72
+ instead of out of the panel.
73
+
74
+ **`drawer.behavior.padding` is now the body's padding, not the panel's.** A
75
+ drawer with no header or footer looks the same as before. One that gains either
76
+ gets rows flush to the panel edge, which is the point.
77
+
78
+ Two new theme entries, `drawerHeader` and `drawerButtons`, mirror the dialog
79
+ pair knob for knob but default to a panel's posture rather than a dialog's: the
80
+ header's title is left-aligned rather than centered, and the footer trails its
81
+ actions rather than centering them.
82
+
83
+ Note one deliberate divergence from `[dialog-buttons]`: the drawer footer's
84
+ **confirm button does not close the drawer**. A panel's save is usually async
85
+ and can fail, so closing is left to the consumer via `(confirmed)`.
86
+
87
+ - [`67e17ea`](https://github.com/uni-design-system/uni/commit/67e17ea927e3ca24b7abecdcccf134d53ac3656b) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-toggle` honours `size`, and the checked colour has a theme home.
88
+
89
+ **`size` did nothing.** `uni-toggle` inherits a bindable `size` input from
90
+ `BaseComponent`, but its geometry came from a single `toggle.behavior.size`
91
+ number, so `<uni-toggle size="sm">` compiled, read as deliberate, and rendered
92
+ identically to every other switch. The theme now carries a `sizes` block and the
93
+ input selects from it.
94
+
95
+ **Geometry is stated per size, not derived from ratios.** Each size token is a
96
+ `width` / `height` / `padding` triple — `padding` being the knob's inset — and
97
+ the rest falls out: knob is `height - 2 * padding`, travel is `width - height`,
98
+ radius is `height / 2`. Real switch designs do not hold a constant proportion
99
+ across sizes (a consumer's 32x18 and 28x16 pair differs in both track and knob
100
+ ratio), so a single ratio token could match one size or the other but never
101
+ both.
102
+
103
+ `lg` is `BaseComponent`'s default and reproduces the previous geometry exactly —
104
+ 40x20, knob 16 — so **no existing toggle moves**. A theme still setting the
105
+ legacy `toggle.behavior.size` number keeps the old derived-ratio behaviour; that
106
+ option is now deprecated in favour of the `sizes` block.
107
+
108
+ **Fixed: the knob would have overhung the track at any other proportion.** The
109
+ checked transform was hardcoded to translate by one track height, which is only
110
+ correct while the track is `2x` wide and the knob `0.8x`. It is now derived, so
111
+ the knob lands the same distance from each edge at every size.
112
+
113
+ **New `checkedColor`, as an input and a theme option.** The on-state used to be
114
+ the instance's `variant`, which meant an app wanting one switch colour repeated
115
+ an attribute on every call site. `toggle.behavior.checkedColor` sets it once;
116
+ the input overrides per instance; `variant` remains the fallback when neither is
117
+ set. The focus ring follows the resolved colour rather than staying on `variant`.
118
+ An input as well as an option is necessary because `variant` defaults to
119
+ `'primary'` and so cannot be distinguished from unset — without one, a themed
120
+ `checkedColor` would have silently made `variant` inert with no way back.
121
+
122
+ **Toggle transitions are a motion token.** It hardcoded `0.3s ease` while
123
+ `uni-radio` already read `theme.motion(options.motion ?? 'control')`, so a theme
124
+ setting a motion scale moved the radio and not the switch.
125
+
126
+ ### Patch Changes
127
+
128
+ - [`f28c951`](https://github.com/uni-design-system/uni/commit/f28c95117f2844b58a265b59c2ea8b9715156670) Thanks [@gaenglish](https://github.com/gaenglish)! - Document the drawer as an editor panel, and assert the layout that makes it one.
129
+
130
+ Both existing Drawer stories were navigation shells, so the shape that actually
131
+ stresses the component — a pinned header, a long scrolling form, a pinned save
132
+ bar — had no worked example. `EditorPanel` is that example, with a
133
+ `uni-number-input` and a `uni-quantity-stepper` near the bottom of the scroll,
134
+ where the sr-only overflow bug used to surface.
135
+
136
+ It carries a play function that asserts the scroll geometry: the panel's
137
+ `scrollHeight` equals its `clientHeight`, setting `scrollTop` on it does
138
+ nothing, the footer has no scrollable content of its own, the body scrolls to
139
+ its last element and stops, and no descendant has escaped its scroll container
140
+ to land on the panel. Those assertions live in the story rather than the unit
141
+ spec on purpose — jsdom has no layout engine, so every one of them would pass
142
+ vacuously there.
143
+
144
+ The MDX gains the three-row layout, the close-request contract, an input table,
145
+ and theme-option blocks for the two new component entries.
146
+
147
+ - [`8f85b48`](https://github.com/uni-design-system/uni/commit/8f85b48b06f67e7f44ce29149dd32aae856e2f19) Thanks [@gaenglish](https://github.com/gaenglish)! - New **Experiments → Forms layout pressure** docs page: every form control in an
148
+ `auto 1fr` grid, with a bar showing what it left for its sibling.
149
+
150
+ It exists to make one class of bug visible, because nothing else can see it. A
151
+ `1fr` track is `minmax(auto, 1fr)`, and that `auto` floor is the control's own
152
+ min-content size — so a control reporting a larger intrinsic width than it needs
153
+ quietly steals track width from whatever sits beside it, while still looking
154
+ correct in isolation. That shipped once: `uni-quantity-stepper`'s value cell is a
155
+ native `<input>` defaulting to `size="20"`, so it measured ~230px instead of
156
+ ~92px and collapsed a consumer's grid column.
157
+
158
+ Neither the specs nor `build-storybook` catch it — the specs assert computed
159
+ styles and ARIA, and jsdom does not do layout — so it took a consumer report.
160
+ The page is deliberately width-constrained, since on a wide canvas nothing
161
+ competes for the track and the defect cannot appear. The measurements are live
162
+ and update as the viewport changes.
163
+
164
+ - [`67e17ea`](https://github.com/uni-design-system/uni/commit/67e17ea927e3ca24b7abecdcccf134d53ac3656b) Thanks [@gaenglish](https://github.com/gaenglish)! - Signal Forms docs said `[field]`; the directive is `[formField]`.
165
+
166
+ `[field]` was the selector in the Angular 21.0 Signal Forms preview and was
167
+ renamed before release. In 21.2 the directive is `FormField`, selector
168
+ `[formField]`, with its required input aliased to `formField` — `[field]` does
169
+ not exist at all. Every form control in this library was documented with the
170
+ name that had been removed, across seven component doc comments and five MDX
171
+ files, and all of it flowed into the MCP index and the generated API reference.
172
+ A consuming app found this, not us.
173
+
174
+ Nothing about the components changed: they already satisfy `FormValueControl` /
175
+ `FormCheckboxControl` and always bound correctly.
176
+
177
+ **The reason it rotted is that nothing compiled a binding.** No spec or story in
178
+ the library imported `@angular/forms/signals` — the toggle's "Form Signals" story
179
+ hand-bound `[checked]` and `[touched]` as plain props, which demonstrates
180
+ nothing about Signal Forms and would keep passing through any rename. There is
181
+ now a spec that binds a real `form()` to `uni-toggle` through `[formField]` and
182
+ asserts the round trip in both directions, plus `touched` and `required`
183
+ propagation, so the next rename fails CI instead of the docs. The story binds a
184
+ real form too.
185
+
186
+ - [`f28c951`](https://github.com/uni-design-system/uni/commit/f28c95117f2844b58a265b59c2ea8b9715156670) Thanks [@gaenglish](https://github.com/gaenglish)! - Visually hidden text no longer inflates a consuming app's scroll containers.
187
+
188
+ **Eighteen controls quietly added scrollable distance to whatever box happened
189
+ to be above them.** `visuallyHidden` was `position: absolute`, and the controls
190
+ that emit it — `uni-number-input`, `uni-quantity-stepper`, the toggle's hidden
191
+ `<input>`, and fifteen others — are `position: static`. An absolutely positioned
192
+ box resolves its containing block to the nearest _positioned_ ancestor, so each
193
+ 1x1 span skipped every `overflow: auto` between it and that ancestor and landed
194
+ in the distant ancestor's scrollable overflow. A consumer reported a fixed side
195
+ panel measuring `scrollHeight: 1891` against `clientHeight: 793` — the whole
196
+ 1098px difference came from seven invisible spans that had escaped the panel's
197
+ body scroller.
198
+
199
+ The helper is now `position: fixed`, whose containing block is the viewport, so
200
+ it joins no ancestor's scrollable overflow at all. The element stays 1x1 and
201
+ clipped to nothing, so screen reader behaviour is unchanged. Inside a
202
+ `transform`ed ancestor a fixed box re-anchors to that ancestor, which is
203
+ harmless here: where the box lands never mattered, only what it overflowed.
204
+
205
+ This class of bug is invisible in isolation — it needs a consumer to nest the
206
+ control inside a scrolling shell before it appears — so it is now covered by a
207
+ test that renders the emitting controls and asserts what actually reaches the
208
+ DOM, not just the recipe.
209
+
210
+ - [`7545ff3`](https://github.com/uni-design-system/uni/commit/7545ff3e6dd85d29157963488f75f9e3681947c7) Thanks [@gaenglish](https://github.com/gaenglish)! - Stepper buttons now leave focus in their field, and `uni-quantity-stepper`
211
+ follows the theme's field chrome.
212
+
213
+ **Clicking `+` or `−` focused nothing.** Taking pointer capture means calling
214
+ `preventDefault()` on `pointerdown`, which also suppresses the browser's default
215
+ focus handling — and the buttons carry `tabindex="-1"`, so focus landed on
216
+ `<body>`. The arrow keys then did nothing, exactly when a user reaching for `+`
217
+ is most likely to try them. `createPressRepeat` gained a `focus` callback,
218
+ invoked on press and handed the pressed button; `uni-number-input` and
219
+ `uni-quantity-stepper` point it at their text field, the way a native spinner
220
+ does. Where there is no field — a read-only quantity stepper, whose buttons are
221
+ themselves the tab stops — focus goes to the button instead. **This affected
222
+ `uni-number-input` as well**, not just the stepper.
223
+
224
+ **`uni-quantity-stepper` ignored a theme's field styling.** It carried its own
225
+ `color` / `border` / `borderRadius` tokens, so a theme that restyles `input` —
226
+ Wellsourced fills its fields `#F3F2EF` — left the stepper stark white beside
227
+ them. Those three now default to the shared `input` chrome and are unset in the
228
+ base theme, so the stepper tracks whatever a theme does to its fields; they
229
+ remain available as per-component overrides for parting them deliberately. With
230
+ the focus indicator and the dividers already sourced this way, the container is
231
+ now consistently the field chrome unless a theme says otherwise.
232
+
233
+ - [`8f85b48`](https://github.com/uni-design-system/uni/commit/8f85b48b06f67e7f44ce29149dd32aae856e2f19) Thanks [@gaenglish](https://github.com/gaenglish)! - `uni-quantity-stepper` no longer claims ~230px of width it does not need.
234
+
235
+ The value cell is a native `<input>`, which defaults to `size="20"`. Its
236
+ `flex: 1 1 auto` meant `flex-basis` resolved to that intrinsic ~20-character
237
+ width rather than to `valueWidth`, so the control measured ~230px instead of the
238
+ ~92px its buttons and a 3ch value actually need. Worse, that inflated width is
239
+ the control's `auto` size, and a `1fr` grid track is `minmax(auto, 1fr)` — so a
240
+ stepper stole track width from whatever sat beside it in a grid. Reported by
241
+ Wellsourced, who worked around it with `uni-quantity-stepper input { width: 0 }`.
242
+
243
+ The input is now sized from its content (`size` bound to the rendered value's
244
+ length), so the intrinsic width tells the truth. `valueWidth` stays the floor via
245
+ `min-width`, which is what keeps stepping 9 → 10 from reflowing the row, and the
246
+ cell still grows past it with the digits — measured at 92px for one to three
247
+ digits, 116px at `12,000`, 140px at `1,234,567`.
248
+
249
+ This is deliberately not the `width`-instead-of-`min-width` fix that was also
250
+ suggested: a fixed cell would have pinned the value at `valueWidth` and clipped
251
+ longer numbers, losing the growth the option documents.
252
+
253
+ **For consumers carrying the workaround:** it is safe to leave in place — the
254
+ control measures the same 92px either way — but remove it to get the growth
255
+ back, since `width: 0` forces `flex-basis: 0` and pins the cell at the floor.
256
+
3
257
  ## 10.0.0
4
258
 
5
259
  ### Major Changes