@dloizides/ui-forms 1.28.2 → 1.30.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,501 +1,514 @@
1
- # Changelog
2
-
3
- ## 1.28.2
4
-
5
- INVOICE-FU-22 "To and Cc dropdown of saved people".
6
-
7
- - A `SelectControl` without `menuAnchor` sets `aria-haspopup="menu"`, matching its `role=menu` popup; with `menuAnchor` it stays `"listbox"`.
8
-
9
- ## 1.28.1
10
-
11
- INVOICE-FU-22 "To and Cc dropdown of saved people".
12
-
13
- - Every `SelectControl` trigger sets `aria-haspopup="listbox"`, which `useEscapeKey` in `ui-layout` reads to give Escape to the open menu.
14
-
15
- ## 1.28.0
16
-
17
- INVOICE-FU-22 "To and Cc dropdown of saved people", D-FU22-5 "Review findings are fixed in the packages".
18
-
19
- - `SelectControl` gains `menuAnchor` (`listboxLabel`, `anchorRef`): the menu stays on screen, focus stays on the trigger, arrows, Enter and Space work from it, and the trigger is a combobox with `aria-activedescendant`. Callers without it are unchanged.
20
- - `AnchoredMenu` gains `placement`; `AnchoredMenuListbox.highlightedValue` is optional.
21
- - `nextHighlight` is exported.
22
-
23
- ## 1.27.0
24
-
25
- DATE-INPUT-1 "Every date or date-time field uses the shared input".
26
-
27
- - New `DateField` (`YYYY-MM-DD`) and `DateTimeField` (`YYYY-MM-DDTHH:mm`), rendered through `Field`; a real `<input type>` on web.
28
-
29
- ## 1.26.0
30
-
31
- INVOICE-3 "Invoice interface over a user-chosen folder": owner picks.
32
-
33
- - `SelectControl` trigger fills with `surfaceElevated`, like an editable field, so it differs from read-only.
34
- - Read-only `useThemedInput` draws the rest border, so the box shows on a form of the same fill.
35
- - Placeholder is solid `textSecondary`: 0.6 alpha measured 2.38 against the 4.5 AA floor.
36
- - `FormField` gains `inputRef`.
37
-
38
- ## 1.25.0
39
-
40
- INVOICE-3 "Invoice interface over a user-chosen folder": extracted from invoice-web.
41
-
42
- - New `SelectField`: `Field` + `SelectControl`, its accessible name carries the selection.
43
-
44
- ## 1.24.0
45
-
46
- BEAD-3 "Report form: searchable pattern field": review fix.
47
-
48
- - New `useKeepInView(trigger)`, moved from Jinx: scrolls the returned view into sight each time `trigger` takes a new value, as far as needed and no further. Web only; a no-op on native.
49
-
50
- ## 1.23.0
51
-
52
- BEAD-3 "Report form: searchable pattern field and shared form feedback".
53
-
54
- - `TypeaheadControl` takes `search` instead of `options` for async results: `load(query, signal)`, `onPick(option | null)`, loading, empty and error text, 250 ms debounce, stale responses ignored, editing after a pick clears it.
55
- - `TypeaheadControl` is a WAI-ARIA combobox in both modes: Down, Up, Enter, Esc, `aria-activedescendant`, a ref to its input. Its rows change role from `menuitem` to `option`; testIDs are unchanged.
56
- - `ControlOption` gains an optional `detail`, shown under the title on a phone and beside it from 768 px.
57
- - `AnchoredMenu` fits its height above the on-screen keyboard through `visualViewport`; new `listbox` prop for listbox roles and a status line.
58
- - New `FormStatusLine` and `useFocusFirstInvalid`.
59
-
60
- ## 1.22.0
61
-
62
- KEFI-EDITOR-UI-2 "Extract stepper and upload-with-link field to @dloizides/ui-forms", extracted from kefi-web.
63
-
64
- - New `StepperTabs`, `StepperNav` and pure `resolveStepNeighbours`: step tabs sharing the row width, back and next under the step. Generic over the step key; every string is a prop.
65
- - New `UploadWithLinkField`: preview, an upload control slot and a link input revealed on request. The slot keeps ui-forms free of ui-media; pass `ImagePickerButton`.
66
-
67
- ## 1.20.0
68
-
69
- **Horizontal form fields line up (D-ALL-22 "Horizontal form fields are aligned").**
70
-
71
- - `FormGrid` rows set `alignItems: flex-start`: every cell starts on one top edge and a tall cell (hint, error) no longer stretches its neighbours.
72
- - New `AlignToControl`: an aria-hidden label line with the same font and spacing model as `Field`, so a button beside labelled fields sits on the input line, not the label line. `FormCell alignToControl` applies it to a cell.
73
- - New `InlineFieldRow` (extracted from kefi-web): a field and its action stacked below `inlineMinWidth` (default 1024) and on one row above it, the action placed by `AlignToControl` instead of a hand-measured offset.
74
-
75
- ## 1.18.7
76
-
77
- - Focused inputs draw the fleet focus ring (`@dloizides/design-tokens` 1.14 `FOCUS_RING`: 2 px solid outline, 2 px offset, contrast-checked colour; error colour when errored) instead of the 3 px 16% box-shadow halo (FOCUS-RING-1 "One focus ring across the shared kit").
78
-
79
- ## 1.18.6
80
-
81
- **ChipSelector: a short chip (e.g. "All") is at least 44 px wide, not only 44 px tall (KEFI-FIT-1 "kefi-web fit and hit-box fixes").**
82
-
83
- `chip` and `chipOutline` get `minWidth: 44` next to the existing `minHeight: 44`; measured 42x44 on kefi-web approvals at 360.
84
-
85
- ## 1.18.3
86
-
87
- **FormCheckbox: the hint/description is now announced by screen readers.**
88
-
89
- The hint Text gets a stable per-instance id (`useFieldIds().hintId`, as `Field` does) and the role=checkbox
90
- Pressable sets `aria-describedby` to it when a hint is present; with no hint the attribute is omitted.
91
-
92
- ## 1.18.2
93
-
94
- **FormSwitch: the switch now sits in a 44x44 (MIN_TOUCH_TARGET_PX) pressable slot on web.**
95
-
96
- Visual QA on kefi-web Site settings (360 and 1280) measured the switch at 40x20: react-native-web sizes the
97
- native input to the Switch root, and `hitSlop` is inert on web. The switch is now centred in a slot with
98
- `minWidth`/`minHeight` MIN_TOUCH_TARGET_PX inside the pressable row, so the row stays at least 44 tall even when a
99
- `containerStyle` overrides `minHeight`. The track and thumb are unchanged; the switch gains a few px of horizontal gutter.
100
- New testID: `<testID>-hitbox`.
101
-
102
- ## 1.17.0
103
-
104
- **Chips now have a 44px minimum touch target on web. `hitSlop` never did that — it is native-only.**
105
-
106
- `CHIP_HIT_SLOP` was documented as expanding the chip's touch area toward the WCAG ≥44px floor
107
- "without changing the rendered pill size". Measured in headless Chromium at 360x640 on 2026-09-21:
108
- a chip's box is 33px tall (`paddingVertical: 6`), and `document.elementFromPoint(68, 35)` — 5px
109
- above a top edge at y=40, inside `CHIP_HIT_SLOP.top: 10` — returns the PARENT element, not the
110
- chip. react-native-web 0.21.2 references `hitSlop` only inside the legacy `Touchable` mixin's
111
- press-RETENTION path (after the responder is already granted) and not at all in `Pressable`, so on
112
- web the rendered box is the entire tappable area. The chips were a 33px target in all seven portals.
113
-
114
- - `chipStyles.chip` and `chipStyles.chipOutline` gain `minHeight: 44` + `justifyContent: 'center'`.
115
- Chip width is unchanged (56.7px and 68px before and after for the same labels), so wrapping and
116
- `CHIP_GUTTER` spacing are untouched; a chip row grows 33px → 44px tall.
117
- - `CHIP_HIT_SLOP` is kept and still helps iOS/Android. Its doc comment now states the web result
118
- instead of claiming one.
119
- - Consumers with a dense chip strip should re-check row spacing: the pill itself is taller now.
120
-
121
- ## 1.15.0
122
-
123
- **`FormSwitch` now emits `aria-checked` / `aria-disabled` on web; `ChipSelector` gained an option icon slot and opt-in radio semantics.**
124
-
125
- `FormSwitch` (A11Y-ARIA-CHECKED-1): react-native-web 0.21 emits nothing from `accessibilityState` on web, so the
126
- switch wrapper rendered `role="switch"` with no `aria-checked` - an invalid switch that announced no state. The
127
- state is now passed as literal `aria-checked` (always) and `aria-disabled` (only when disabled) web props;
128
- `accessibilityState` also carries `disabled` for native.
129
-
130
- `ChipSelector`:
131
- - `ChipOption.icon?: React.ReactNode` - rendered before the label inside the chip, wrapped `aria-hidden`. Options
132
- without an icon render the exact same tree as before.
133
- - `singleSelectRole?: 'button' | 'radio'` (type `ChipSingleSelectRole`). Default `button` = unchanged. With
134
- `radio` and `multiple` unset, the group is `role="radiogroup"` and each chip `role="radio"` + `aria-checked`.
135
- Ignored for multi-select. Trade-off: RN-web renders a radio chip as a `<div>`, which activates on Enter but not
136
- Space and has no arrow-key roving focus.
137
-
138
- **Additive and backward-compatible.** No prop set = identical DOM for every existing consumer.
139
-
140
- ## 1.14.0
141
-
142
- **`FormField` gained an opt-in `recentKey` — remember the last N submitted values and offer them on focus.**
143
-
144
- A search / filter / lookup box that the user retypes the same handful of values into now gets a
145
- "recent values" dropdown for free. Set `recentKey="<namespace>"` on a `FormField` and the values it
146
- submits are remembered (per key) and surfaced in a menu on focus; picking one fills the input. A
147
- value is recorded on submit (Enter) **and** on blur-with-content, so both "hit enter" and "typed then
148
- moved on" are captured. The dropdown reuses the kit's `AnchoredMenu` (portalled to `document.body`, so
149
- it is never painted behind a table / card / the next field) with full a11y (menu name, per-row label +
150
- hint + role).
151
-
152
- Persistence is `localStorage` under `@dloizides/ui-forms:recent:<recentKey>`; the list de-dupes
153
- case-insensitively, promotes a repeat to the front, and caps at `recentMax` (default 10). On native /
154
- SSR / when storage is disabled it is a silent no-op (recents are always `[]`), and every storage
155
- access is wrapped so a quota or privacy-mode failure can never throw into render.
156
-
157
- **Additive and backward-compatible.** Leave `recentKey` unset — the default — and the field behaves
158
- exactly as before: nothing rendered, no state/refs/effects, no storage touched. NEVER set it on a
159
- password / secure field. The engine is also exported standalone as `useRecentValues(key, max?)` for
160
- bespoke recents surfaces, and `AnchoredMenu` gained an optional `accessibilityLabel` for naming the menu.
161
-
162
- ## 1.13.3
163
-
164
- **Placeholder text was too dark — it read like an already-filled value.**
165
-
166
- `useThemedInput` painted the placeholder with the theme's `textSecondary` — a deliberately
167
- dark, accessible grey (design-tokens UX-11) that also renders readable secondary *copy*. At
168
- full strength a placeholder (e.g. `follower` in a "Dance role" box) was hard to tell apart
169
- from entered text. It is now `textSecondary` composited toward the field background at 0.6
170
- alpha, so a hint reads clearly lighter than the solid entered text (`colors.text`) while
171
- keeping the theme hue — and it works in dark mode too (it composites toward whatever the
172
- field background is). The field's visible label still carries the accessible name, so this
173
- is a usability win, not an a11y regression. Affects every `@dloizides/ui-forms`-driven input
174
- (`FormField`, `Field`, `ThemedTextInput`, the `ui-tables` `Filters` search box) across all
175
- seven portals.
176
-
177
- ## 1.12.0
178
-
179
- **`FormField` gained `labelHidden` — hide the visible label, keep the accessible name.**
180
-
181
- A field whose placeholder already names it (a toolbar search box, an inline filter) does
182
- not want a stacked visible label: the label wastes a row and, worse, pushes the input a
183
- label-row lower than a bare button beside it, so the two misalign. Until now the only way
184
- to drop the visible label was to blank `label` — which ALSO blanked the input's
185
- `accessibilityLabel`, silently stripping the accessible name.
186
-
187
- `labelHidden` removes ONLY the visible `<label>` row: `label` stays required and the input
188
- keeps `accessibilityLabel={label}`, so a screen reader reads the same name and the field
189
- still resolves by role + name. Additive and backward-compatible — default `false`, every
190
- existing call renders unchanged.
191
-
192
- ## 1.11.1
193
-
194
- **`ThemedTextInput` shipped no metrics, so every direct caller got a raw 19px input.**
195
-
196
- It documented itself as "the ONE source of truth for the input look" while shipping
197
- only **colours** — no border, radius, padding or height. `FormField` quietly passed its
198
- own private duplicate of those metrics, so anything reached *through* `FormField` looked
199
- correct and the gap was invisible. Every **direct** caller — the documented, blessed
200
- usage — got a raw browser input.
201
-
202
- Measured live in the Digital Kin CMS before: **10/10 inputs below the 48px floor**, text
203
- inputs 19px, textareas 38px. After: **0/10**, at 48/96px.
204
-
205
- **Label association was absent entirely** (0 `label[for]`, 0 ids). Two defects only a
206
- real browser could find, both fixed here:
207
-
208
- - **`htmlFor` is silently dropped by react-native-web** — it is not on the prop
209
- allowlist, the same family as the dropped `accessibilityHint`. A prop-level assertion
210
- passes against the broken build; only a DOM-level test catches it, so that is what the
211
- new tests assert.
212
- - **Dangling `for`.** `Field` assumed render-function children place the id they are
213
- handed, but `SelectControl` uses `aria-labelledby` instead — so the difficulty label
214
- shipped `for="field-control-3"` pointing at **nothing**, passing every structural check
215
- while focusing no field. `useHtmlFor` now sets `for` only when the target is genuinely
216
- in the document.
217
-
218
- > ⚠️ **Cross-fleet visual change.** `controlStyles.input` gaining `minHeight: 48` lifts
219
- > dense filter inputs and select triggers in `aml-v2`/`agora-web` from ~38-41px to 48px.
220
- > This cannot be avoided: the input floor is what fixes the 19px defect, and nothing
221
- > fixes that without also lifting inputs that already had padding. Owner-approved.
222
-
223
-
224
- ## 1.9.0
225
-
226
- **Campaign F3 — `Field`'s spacing model, and the layout primitives.** `Field` hard-coded a 16px
227
- bottom margin on its container. That is the pre-flexbox model — the CHILD owns the space after
228
- itself — and in a `gap`-laid-out parent, which is how every modern form row in this fleet is
229
- written, the margin STACKS on the parent's gap. So consumers cancelled it by hand: **16
230
- `containerStyle={{ marginBottom: 0 }}` sites across the fleet**, 13 of them in aml-v2, each with an
231
- apologetic comment. AML v1 got this right in CSS years ago (`.ui-field { display: flex;
232
- flex-direction: column; gap: 6px; }`) and wrote the contract down in `shared/FORMS.md`.
233
-
234
- **This release moves NO pixels for any existing consumer.** The fix is opt-in, not a 2.0.0 — see
235
- "Why not a major bump" below.
236
-
237
- - **Add `FormGrid` + `FormCell`** — the wrapping form row, extracted from the copy the fleet
238
- re-declares verbatim (`{ flexDirection: 'row', flexWrap: 'wrap', gap: 12 }` +
239
- `{ minWidth: 220, flexGrow: 1, flexBasis: 260 }`), with the min-width/basis parameterised. Cell
240
- metrics live on the GRID, so the common call site is a bare `<FormCell>` and only the genuine
241
- one-offs (`<FormCell basis={160} grow={false} minWidth={140}>`) carry props.
242
- - **Add `FormSection`** — the fieldset/legend grouping only v1 had. react-native-web has no
243
- `fieldset` mapping, so this is the ARIA equivalent: `role="group"` + `aria-labelledby` pointing
244
- at the legend. The legend reuses `resolveLabelVariantStyle` — the SAME function `Field` uses — so
245
- a section heading cannot drift into a third label voice.
246
- - **Add `Field.spacing` (`'stack' | 'gap'`)** — the two spacing models. `stack` is the historical
247
- 16px margin + 4px child margins, byte-identical to 1.8.0, and remains the default. `gap` is the
248
- FORMS.md contract: no bottom margin, one uniform 6px internal gap, parent owns the rhythm.
249
- - **`Field` inside a `FormGrid` or `FormSection` resolves to `gap` automatically.** Adopting the
250
- shared grid IS the opt-in: a consumer deletes its hand-rolled `grid`/`field` styles AND its
251
- `marginBottom: 0` cancel in the same edit. An explicit `spacing` prop beats the context in both
252
- directions.
253
- - **`ChipSelector`**: the chip row now spaces with `gap: 8` instead of per-chip margins plus a
254
- compensating `marginBottom: -8`. Rendered box is byte-identical. Also gains a `spacing`
255
- passthrough, and `containerStyle` widens to `StyleProp<ViewStyle>` to match `Field`'s.
256
-
257
- ### Why not a major bump
258
-
259
- The brief for this work allowed a breaking 2.0.0. It was rejected. Switching every `Field` to the
260
- gap model in one publish moves pixels on every form in seven portals simultaneously — which is
261
- precisely the change you cannot visually QA, because no app remains on the old behaviour to compare
262
- against, and a regression surfaces as "some form somewhere looks slightly wrong" with seven
263
- suspects. The context-aware opt-in gives the identical end state via a per-app rollout, each step
264
- behind visual QA, with `git revert` scoped to one app. The cost is that both models live in the
265
- code until the fleet has migrated; that is a smaller price than an un-QA-able fleet-wide pixel
266
- change.
267
-
268
- ### Correction to the campaign premise
269
-
270
- `ChipSelector`'s `marginBottom: -CHIP_GUTTER` was documented — and briefed — as compensation for
271
- `Field`'s 16px margin, load-bearing enough that changing one without the other would break chip
272
- spacing in 7+ sites. **That was wrong.** The -8 cancelled the chips' OWN bottom gutter hanging off
273
- the last wrapped row; it behaved identically whatever `Field` contributed. It has been replaced with
274
- `gap` regardless, because a margin/negative-margin pair is fragile and leaks a negative margin onto
275
- the block's box. `fieldSpacing.test.tsx` now pins `Field` and `ChipSelector` to the same box in both
276
- models, so the relationship is checkable rather than folkloric.
277
-
278
-
279
- ## 1.8.0
280
-
281
- **Campaign F2 — the dense CONTROLS arrive.** `@dloizides/ui-tables` shipped a complete, themed,
282
- a11y-wired set of form controls inside its `Filters` bar and exported NONE of them: its
283
- `src/index.ts` exposed only `Filters`, `useFilterDraft`, `suggestOptions`, `isUnmatched` and
284
- types. Six portals could SEE those controls working and none could import them, so the fleet
285
- reimplemented them — **6 independent select implementations, 5 date fields, 2 typeaheads**. Same
286
- shape as `MultiTenancy.EntityFrameworkCore` shipping no EF Core. This release makes them public.
287
-
288
- Nothing here moves a pixel for an existing consumer: the metrics are the promoted originals,
289
- unchanged. `CONTAINER_MARGIN_BOTTOM` and `ChipSelector`'s compensating `marginBottom:
290
- -CHIP_GUTTER` remain deliberately untouched.
291
-
292
- - **Add `SelectControl`** — single-select enum/status dropdown. Bordered trigger + chevron opening
293
- the shared `AnchoredMenu`.
294
- - **Add `TypeaheadControl`** — search-as-you-type combobox (aml-v2's CountryPicker, generalized).
295
- Free typing is preserved (the value is raw text the caller normalises at query time); picking a
296
- suggestion fills the canonical LABEL, not the value.
297
- - **Add `DateRangeControl`** — inclusive from/to pair. Editing one side patches ONLY that side.
298
- - **Add `AnchoredMenu`** — the floating option list both of the above compose. Kept in-tree with
299
- NO `ui-layout` dependency; that was a considered choice in `ui-tables` and it still holds, since
300
- depending on the higher-level `ModalDropdown` would invert the graph for every consumer.
301
- - **Add `controlStyles`** — the tuned metrics, promoted verbatim. `ui-tables`' `Filters/styles.ts`
302
- said the quiet part out loud in its own header: it "reconcile[d] the per-field styles that were
303
- copy-pasted across aml-v2's filter files into one shared source" — and then locked the
304
- reconciliation inside one bar where no other surface could reach it.
305
- - **Add `suggestOptions` / `isUnmatched`** — the ranked substring matcher behind the typeahead.
306
- - **Add `ControlOption` / `DateRangeValue`** types. `ui-tables` now ALIASES its long-standing
307
- public `FilterOption` / `DateRangeValue` onto these, so there is one definition rather than two
308
- structurally-compatible twins free to drift.
309
-
310
- ### The controls are LABEL-FREE, on purpose
311
-
312
- They render the control only. Compose them inside `Field` — with `labelVariant="control"` on a
313
- dense surface — to get the label, hint and error slots. That is what retires `ui-tables`' private
314
- `FieldShell` fork (see `@dloizides/ui-tables` 1.14.0) and leaves ONE label implementation for
315
- every control instead of one per control.
316
-
317
- ### i18n: this package still never calls `t`
318
-
319
- Every string — `accessibilityLabel`, `placeholder`, `optionHint`, `error`, `fromLabel`/`toLabel`
320
- — is a PRE-LOCALIZED prop. This is load-bearing, not stylistic: aml-v2 localizes through
321
- `@dloizides/i18n` with positional `{0}` while the other six portals use i18next `{{p1}}`, so a
322
- component that localized internally could not serve both. `SelectControl`'s `accessibilityLabel`
323
- is therefore composed BY THE CALLER — it must carry the selection ("Status: Active", not
324
- "Status"), and building that string needs a `t` call this package must not make.
325
-
326
- ### Fixed — a WCAG defect carried in by the promoted code
327
-
328
- `AnchoredMenu` marked the current option with `accessibilityState={{ selected }}` alone.
329
- **react-native-web does not read `accessibilityState` at all** (verified against
330
- `react-native-web@0.21`'s `createDOMProps`, which enumerates `aria-selected` /
331
- `accessibilitySelected` and never `accessibilityState`), so on web the selected option was
332
- distinguished by colour and font-weight ONLY — no screen reader could tell which option was
333
- current (WCAG 1.4.1, use of colour). `aria-selected` is now passed alongside, so each platform
334
- gets the channel it honours. The trigger already paired `aria-expanded` with `accessibilityState`;
335
- the option row was simply missed when that was done. A test asserts it, and that test FAILED
336
- before the fix.
337
-
338
- ## 1.7.0
339
-
340
- Additive wave implementing the shared cross-stack forms contract now written down at
341
- `PROOViD/AMLService/AMLService/wwwroot/shared/FORMS.md`. **Nothing in this release moves a pixel
342
- for an existing consumer**: every addition is opt-in and every default is the previous behaviour.
343
- `CONTAINER_MARGIN_BOTTOM` and `ChipSelector`'s compensating `marginBottom: -CHIP_GUTTER` are
344
- deliberately untouched — they are load-bearing and move together in a later, visual-QA-gated wave.
345
-
346
- - **Add `FormActions` — the submit/cancel row.** Promoted from the BYTE-IDENTICAL
347
- `erevna-web/src/components/Forms/FormActions.tsx` and `katalogos-web/.../FormActions.tsx`
348
- (68 lines each; `diff` returns nothing). All seven portals hand-roll this row; aml-v2, agora,
349
- kefi, ichnos and zygos each inline their own variant. The primary action is LAST in DOM order so
350
- tab reaches Cancel before Save, and `saving` drives the primary button's spinner rather than
351
- disabling-and-relabelling it. `saveDisabled` blocks Save WITHOUT blocking Cancel — an invalid
352
- form stays escapable. testIDs default to the twins' `save-button` / `cancel-button`, so existing
353
- Playwright selectors keep matching.
354
- - **`Field` gains `hint`.** ~21 hand-rolled copies of `{fontSize:12, marginTop:4, color:
355
- textSecondary}` exist across the fleet; aml-v2 alone declares a local `hint` style in 8 files.
356
- Because `Field` had no hint slot, consumers rendered the hint as a SIBLING, where it lands past
357
- the container's 16px bottom margin and detaches from the control it explains (see the apologetic
358
- comment in `aml-v2/src/screens/screening/CoverageSelector.tsx`). The hint renders UNDER the
359
- control and ABOVE the error, and hint and error COEXIST — both are reachable from the control via
360
- a composed `aria-describedby` (hint id then error id, in reading order). Only the error is a
361
- `role="alert"` live region; a hint that announced itself would interrupt on every focus.
362
- - **`Field` gains `optional` + `optionalLabel`.** Mutually exclusive with `required`; when a caller
363
- sets both, `required` WINS — the safe direction, since an under-marked required field sends the
364
- user into a failed submit. Enforced at runtime in `resolveFieldMarker` rather than in the type
365
- system, so a caller spreading a computed props object still gets a defined single-marker result
366
- instead of a compile error it cannot act on. Like the asterisk, the optional text is decorative
367
- (`aria-hidden`) — "optional" is the ABSENCE of `aria-required`, which assistive tech already
368
- conveys.
369
- - **`Field` gains `labelVariant` (+ `labelStyle` as the escape hatch).** `Field` hard-coded
370
- 13/600/sentence-case, which is exactly why kefi-web refused it and why `@dloizides/ui-tables`'
371
- private `FieldShell` forked to 11/700/uppercase. `labelVariant` makes the contract's TWO
372
- legitimate voices first-class and named: `field` (13/600 sentence case — a label that is READ)
373
- and `control` (11/700 UPPERCASE + letter-spacing — a label that is SCANNED, for dense filter bars
374
- and toolbars). An absent variant resolves to `field`, so every existing consumer renders
375
- byte-identically. `labelStyle` applies AFTER the variant for the genuine one-off.
376
- - **`Field`'s `containerStyle` widens `ViewStyle` -> `StyleProp<ViewStyle>`.** The narrow type was a
377
- documented pain: `aml-v2/src/screens/leaders/CountryPicker.tsx` has to build a COMPLETE style per
378
- variant because it cannot compose an array.
379
- - **`useThemedInput`: a focused errored field now keeps a RED focus ring.** It previously computed
380
- `isFocused && !hasError`, so an errored field got NO focus ring at all — removing the focus
381
- indicator (WCAG 2.4.7) from precisely the field the user was sent back to fix, at the moment they
382
- are most likely navigating by keyboard. It now always rings on focus and only changes the ring's
383
- COLOUR, matching v1's `input.invalid:focus { box-shadow: 0 0 0 3px var(--danger-tint) }`.
384
- One pre-existing test necessarily changed: it asserted `boxShadow === 'none'` for this state,
385
- i.e. it encoded the defect as intended behaviour.
386
- - **New peer dependency `@dloizides/ui-buttons >= 1.4.0`**, required by `FormActions` so the estate
387
- keeps exactly one button implementation rather than forking one here.
388
- - No i18n runtime is introduced: all user-visible copy (`saveLabel`, `cancelLabel`, `optionalLabel`,
389
- `hint`, `error`) arrives pre-localized. aml-v2 localizes via `@dloizides/i18n` with positional
390
- `{0}` params while the other six apps use i18next `{{p1}}`, and nothing bridges them, so a
391
- component that localized internally could not serve both.
392
- - Also shipping in this tarball, from a CONCURRENT workstream (commit `13bd281`, not part of this
393
- wave): `ChipSelector` gains `chipTestIDPrefix`, `optionAccessibilityHint` and `multiple`
394
- toggle semantics, and reads its on-primary ink from the theme's `onBrand` scale instead of a
395
- hardcoded `#fff`. All opt-in; the `chip-selector-chip-<value>` testID default is frozen.
396
-
397
- ## 1.6.0
398
-
399
- - **`ChipSelector` now composes `Field` internally — its label was drifting.** It rendered its OWN
400
- `<Text>` label whose metrics differed from `Field`'s on three of four axes: `marginBottom: 8`
401
- (vs 4), NO `fontSize` at all so it fell back to RN's ~14 (vs 13), and `colors.text`
402
- (vs `textSecondary`). A `ChipSelector` next to a `FormField` in a row/grid therefore started a
403
- different distance down the column and read as a different weight of text. Found at 4 sites in
404
- aml-v2 (`TenantWatchlistsEditor`, `CoverageSelector`, `CustomCoverageFields`,
405
- `AdvancedMatching`); fixing it in the package fixes every consumer with zero app churn.
406
- The local label styles are deleted — there is now exactly one label implementation in the kit.
407
- - **`ChipSelectorProps` is unchanged and fully backward-compatible** — every existing prop keeps
408
- its name, type and default, and `label` stays OPTIONAL. With no label (or an empty one) NO label
409
- row is rendered, so composing `Field` cannot introduce a phantom gap above the chips.
410
- - **`ChipSelector` gains `required`, `error` and `testID`** (all optional, all additive) now that
411
- `Field` provides them for free. `error` renders the same `role="alert"` line as `FormField` and
412
- is tied to the chip group via `aria-describedby` + `aria-invalid` (web only; no-op on native).
413
- - **Spacing:** a `ChipSelector` now carries `Field`'s `marginBottom: 16` like every other field
414
- (it previously had none). The chips' own 8px trailing gutter is cancelled on the group so the
415
- block's total bottom spacing is exactly 16 — the same as a `FormField`, not 24. Pass
416
- `containerStyle` to override, as before.
417
- - **`Field`'s `label` is now optional** (widened from `label: string`, so existing callers are
418
- unaffected). An absent or empty label renders no label row, letting a control whose label lives
419
- elsewhere still use the shared shell for its error line and spacing.
420
- - `FormSwitch` / `FormCheckbox` are deliberately NOT changed — see `src/labelRoles.test.tsx`.
421
- Their labels are INLINE control labels (beside the control in a row, the row's primary text),
422
- not field headers stacked above a control, so they have no alignment defect to fix and `Field`'s
423
- smaller/dimmer header treatment would be a regression. They were already identical to each
424
- other; a new test now enforces that they stay so.
425
-
426
- ## 1.5.0
427
-
428
- - **Add `Field` — the generic label-over-control wrapper.** `FormField` is hard-wired to a text
429
- input (`FormFieldProps extends Omit<TextInputProps,'style'>`), so any NON-text control (a
430
- dropdown, a date picker, a chip selector) had no shared way to get a label — and ended up
431
- visually misaligned next to its `FormField` siblings: the control's box started ~21px higher
432
- (no label row) and it missed `FormField`'s `marginBottom: 16`, so wrapped rows lost their
433
- vertical rhythm. This was hand-rolled in 5 places across zygos-web and aml-v2.
434
- `Field` takes `{ label, required?, error?, children, containerStyle?, testID? }` and renders the
435
- same label row / required mark / error line / spacing.
436
- - **`FormField` now composes `Field` internally**, so the two can never drift apart — the metrics
437
- live in exactly one place. `FormFieldProps` and every rendered attribute (`form-field-input`
438
- testID, `aria-invalid` / `aria-describedby` / `aria-required`, the `role="alert"` error line)
439
- are unchanged: fully backward-compatible.
440
- - `Field`'s `children` may be a plain node (the common case) or a render function receiving
441
- `{ describedById, hasError }`, so a custom control can wire the error line into its own
442
- `aria-describedby` / invalid state exactly the way `FormField` does.
443
-
444
- ## 1.4.0
445
-
446
- - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
447
- - `FormField`: the error message is now programmatically tied to the input — the input gets
448
- `aria-invalid` when errored and `aria-describedby` pointing at the error line (which is a
449
- `role="alert"` live region), and `aria-required` when `required`. The required `*` is marked
450
- decorative (`aria-hidden` / `accessibilityElementsHidden`) so a screen reader hears "required"
451
- (via `aria-required`) instead of "star".
452
- - `ThemedTextInput`: new optional `describedById` + `requiredField` props forward
453
- `aria-describedby` / `aria-required`, and it emits `aria-invalid` from `hasError` (web only;
454
- no-ops on native). Existing callers are unaffected.
455
- - `FormCheckbox`: now keyboard-operable — the `role="checkbox"` Pressable renders a `<div>`
456
- (no free Enter/Space), so an explicit web-only Enter/Space handler toggles it (WCAG 2.1.1).
457
- - `ChipSelector`: chips gain a `hitSlop` so the touch target reaches ~44px WITHOUT changing the
458
- rendered pill size, and expose `accessibilityState.disabled` when the selector is disabled.
459
- - `useThemedInput`: the focus/hover CSS transition now collapses to instant when the user
460
- requests `prefers-reduced-motion: reduce` (WCAG 2.3.3, web only).
461
-
462
- ## 1.3.0
463
-
464
- - `ChipSelector` gains a `variant` prop (`'solid' | 'outline'`, default `'solid'`). `solid` is the
465
- original filled-pill look (selected = solid brand fill, white ink) — existing consumers
466
- (erevna / katalogos / kefi) render **identically**, no change. `outline` is the AML v1 console
467
- look: an outlined pill on a muted fill where the **selected** state is a subtle tinted-outline
468
- (brand border + brand ink + a low-alpha brand wash), NOT a solid fill; on web, hover lifts the
469
- border + ink to the brand colour. Fully theme-driven (brand colour + alpha, border/text from the
470
- theme), so it re-themes per tenant. Additive + backward-compatible.
471
-
472
- ## 1.2.0
473
-
474
- - Add `ThemedTextInput` + `useThemedInput` — the shared "readable + lively" text-input treatment,
475
- driven entirely by the active theme (re-themes per tenant, no hard-coded hex). At rest: dark
476
- readable text on a subtle off-white surface with a soft border. On hover (web): the border
477
- strengthens a touch. On focus: the border becomes the brand primary, the background brightens to
478
- the plain surface (white), and a soft 3px brand-tinted focus ring fades in. The animation is a
479
- pure GPU-cheap CSS transition on `border-color`/`background-color`/`box-shadow` (the ring is a
480
- `box-shadow`, so no layout/reflow) — NO `Animated`/`LayoutAnimation`/JS timers. Web-only style
481
- keys and the mouse-hover handlers are guarded behind `Platform.OS === 'web'`, so it stays
482
- native-safe (native applies the state-driven colours instantly).
483
- - `FormField` now renders `ThemedTextInput`, so every field gets the treatment for free; its label
484
- uses `textSecondary` at 13px/600 for readability. Props/behaviour (label, hint, error, testID,
485
- a11y, `onFocus`/`onBlur` pass-through) are backward-compatible.
486
-
487
- ## 1.1.0
488
-
489
- - Add `FormCheckbox` — a native-safe (`Pressable`-based, RN-web + native) themed checkbox: a rounded
490
- square that fills with the brand colour and shows a check glyph when on, with a label and optional
491
- hint. Mirrors `FormSwitch`'s prop shape (`value`, `onValueChange`/`onChange`, `label`, `hint`,
492
- `disabled`, `testID`, a11y) so it is a drop-in for boolean toggles that should read as checkboxes.
493
- Exposes `role="checkbox"` + `aria-checked` / `accessibilityState={{ checked }}`.
494
-
495
- ## 1.0.0
496
-
497
- Initial release. Extracted the proven duplicated form components from erevna-web ↔ katalogos-web
498
- (Capability Wave C1, batch 2).
499
-
500
- - `FormField`, `ChipSelector`, `FormSwitch` — share the `@dloizides/ui-feedback` UI context (`useUi`).
501
- - `FormActions` deferred (depends on a not-yet-shared `core/Button`).
1
+ # Changelog
2
+
3
+ ## 1.30.0
4
+
5
+ FINREG-DATE-2 "Every FinReg date field uses the shared input".
6
+
7
+ - `DateRangeControl` renders the shared `DateField` for From and To (DATE-INPUT-1): on web each side is a real `type="date"` input. Props and testIDs unchanged.
8
+ - `DateField` / `DateTimeField` accept an optional `placeholder` (native text input only).
9
+ - New `FormStack`: a vertical form column whose `gap` owns the rhythm, so nested `Field`s drop their bottom margin.
10
+ - New `ResponsiveFormLayout` (`narrow` / `wide` / `breakpoint`, default 768) and `isWideFormLayout`.
11
+
12
+ ## 1.29.0
13
+
14
+ FINREG-BRAND-1 "Logo without its background and one palette from the logo": error and status TEXT reads `semanticText` when the theme provides it, readable in dark mode. Unchanged without it.
15
+
16
+ ## 1.28.2
17
+
18
+ INVOICE-FU-22 "To and Cc dropdown of saved people".
19
+
20
+ - A `SelectControl` without `menuAnchor` sets `aria-haspopup="menu"`, matching its `role=menu` popup; with `menuAnchor` it stays `"listbox"`.
21
+
22
+ ## 1.28.1
23
+
24
+ INVOICE-FU-22 "To and Cc dropdown of saved people".
25
+
26
+ - Every `SelectControl` trigger sets `aria-haspopup="listbox"`, which `useEscapeKey` in `ui-layout` reads to give Escape to the open menu.
27
+
28
+ ## 1.28.0
29
+
30
+ INVOICE-FU-22 "To and Cc dropdown of saved people", D-FU22-5 "Review findings are fixed in the packages".
31
+
32
+ - `SelectControl` gains `menuAnchor` (`listboxLabel`, `anchorRef`): the menu stays on screen, focus stays on the trigger, arrows, Enter and Space work from it, and the trigger is a combobox with `aria-activedescendant`. Callers without it are unchanged.
33
+ - `AnchoredMenu` gains `placement`; `AnchoredMenuListbox.highlightedValue` is optional.
34
+ - `nextHighlight` is exported.
35
+
36
+ ## 1.27.0
37
+
38
+ DATE-INPUT-1 "Every date or date-time field uses the shared input".
39
+
40
+ - New `DateField` (`YYYY-MM-DD`) and `DateTimeField` (`YYYY-MM-DDTHH:mm`), rendered through `Field`; a real `<input type>` on web.
41
+
42
+ ## 1.26.0
43
+
44
+ INVOICE-3 "Invoice interface over a user-chosen folder": owner picks.
45
+
46
+ - `SelectControl` trigger fills with `surfaceElevated`, like an editable field, so it differs from read-only.
47
+ - Read-only `useThemedInput` draws the rest border, so the box shows on a form of the same fill.
48
+ - Placeholder is solid `textSecondary`: 0.6 alpha measured 2.38 against the 4.5 AA floor.
49
+ - `FormField` gains `inputRef`.
50
+
51
+ ## 1.25.0
52
+
53
+ INVOICE-3 "Invoice interface over a user-chosen folder": extracted from invoice-web.
54
+
55
+ - New `SelectField`: `Field` + `SelectControl`, its accessible name carries the selection.
56
+
57
+ ## 1.24.0
58
+
59
+ BEAD-3 "Report form: searchable pattern field": review fix.
60
+
61
+ - New `useKeepInView(trigger)`, moved from Jinx: scrolls the returned view into sight each time `trigger` takes a new value, as far as needed and no further. Web only; a no-op on native.
62
+
63
+ ## 1.23.0
64
+
65
+ BEAD-3 "Report form: searchable pattern field and shared form feedback".
66
+
67
+ - `TypeaheadControl` takes `search` instead of `options` for async results: `load(query, signal)`, `onPick(option | null)`, loading, empty and error text, 250 ms debounce, stale responses ignored, editing after a pick clears it.
68
+ - `TypeaheadControl` is a WAI-ARIA combobox in both modes: Down, Up, Enter, Esc, `aria-activedescendant`, a ref to its input. Its rows change role from `menuitem` to `option`; testIDs are unchanged.
69
+ - `ControlOption` gains an optional `detail`, shown under the title on a phone and beside it from 768 px.
70
+ - `AnchoredMenu` fits its height above the on-screen keyboard through `visualViewport`; new `listbox` prop for listbox roles and a status line.
71
+ - New `FormStatusLine` and `useFocusFirstInvalid`.
72
+
73
+ ## 1.22.0
74
+
75
+ KEFI-EDITOR-UI-2 "Extract stepper and upload-with-link field to @dloizides/ui-forms", extracted from kefi-web.
76
+
77
+ - New `StepperTabs`, `StepperNav` and pure `resolveStepNeighbours`: step tabs sharing the row width, back and next under the step. Generic over the step key; every string is a prop.
78
+ - New `UploadWithLinkField`: preview, an upload control slot and a link input revealed on request. The slot keeps ui-forms free of ui-media; pass `ImagePickerButton`.
79
+
80
+ ## 1.20.0
81
+
82
+ **Horizontal form fields line up (D-ALL-22 "Horizontal form fields are aligned").**
83
+
84
+ - `FormGrid` rows set `alignItems: flex-start`: every cell starts on one top edge and a tall cell (hint, error) no longer stretches its neighbours.
85
+ - New `AlignToControl`: an aria-hidden label line with the same font and spacing model as `Field`, so a button beside labelled fields sits on the input line, not the label line. `FormCell alignToControl` applies it to a cell.
86
+ - New `InlineFieldRow` (extracted from kefi-web): a field and its action stacked below `inlineMinWidth` (default 1024) and on one row above it, the action placed by `AlignToControl` instead of a hand-measured offset.
87
+
88
+ ## 1.18.7
89
+
90
+ - Focused inputs draw the fleet focus ring (`@dloizides/design-tokens` 1.14 `FOCUS_RING`: 2 px solid outline, 2 px offset, contrast-checked colour; error colour when errored) instead of the 3 px 16% box-shadow halo (FOCUS-RING-1 "One focus ring across the shared kit").
91
+
92
+ ## 1.18.6
93
+
94
+ **ChipSelector: a short chip (e.g. "All") is at least 44 px wide, not only 44 px tall (KEFI-FIT-1 "kefi-web fit and hit-box fixes").**
95
+
96
+ `chip` and `chipOutline` get `minWidth: 44` next to the existing `minHeight: 44`; measured 42x44 on kefi-web approvals at 360.
97
+
98
+ ## 1.18.3
99
+
100
+ **FormCheckbox: the hint/description is now announced by screen readers.**
101
+
102
+ The hint Text gets a stable per-instance id (`useFieldIds().hintId`, as `Field` does) and the role=checkbox
103
+ Pressable sets `aria-describedby` to it when a hint is present; with no hint the attribute is omitted.
104
+
105
+ ## 1.18.2
106
+
107
+ **FormSwitch: the switch now sits in a 44x44 (MIN_TOUCH_TARGET_PX) pressable slot on web.**
108
+
109
+ Visual QA on kefi-web Site settings (360 and 1280) measured the switch at 40x20: react-native-web sizes the
110
+ native input to the Switch root, and `hitSlop` is inert on web. The switch is now centred in a slot with
111
+ `minWidth`/`minHeight` MIN_TOUCH_TARGET_PX inside the pressable row, so the row stays at least 44 tall even when a
112
+ `containerStyle` overrides `minHeight`. The track and thumb are unchanged; the switch gains a few px of horizontal gutter.
113
+ New testID: `<testID>-hitbox`.
114
+
115
+ ## 1.17.0
116
+
117
+ **Chips now have a 44px minimum touch target on web. `hitSlop` never did that — it is native-only.**
118
+
119
+ `CHIP_HIT_SLOP` was documented as expanding the chip's touch area toward the WCAG ≥44px floor
120
+ "without changing the rendered pill size". Measured in headless Chromium at 360x640 on 2026-09-21:
121
+ a chip's box is 33px tall (`paddingVertical: 6`), and `document.elementFromPoint(68, 35)` — 5px
122
+ above a top edge at y=40, inside `CHIP_HIT_SLOP.top: 10` — returns the PARENT element, not the
123
+ chip. react-native-web 0.21.2 references `hitSlop` only inside the legacy `Touchable` mixin's
124
+ press-RETENTION path (after the responder is already granted) and not at all in `Pressable`, so on
125
+ web the rendered box is the entire tappable area. The chips were a 33px target in all seven portals.
126
+
127
+ - `chipStyles.chip` and `chipStyles.chipOutline` gain `minHeight: 44` + `justifyContent: 'center'`.
128
+ Chip width is unchanged (56.7px and 68px before and after for the same labels), so wrapping and
129
+ `CHIP_GUTTER` spacing are untouched; a chip row grows 33px → 44px tall.
130
+ - `CHIP_HIT_SLOP` is kept and still helps iOS/Android. Its doc comment now states the web result
131
+ instead of claiming one.
132
+ - Consumers with a dense chip strip should re-check row spacing: the pill itself is taller now.
133
+
134
+ ## 1.15.0
135
+
136
+ **`FormSwitch` now emits `aria-checked` / `aria-disabled` on web; `ChipSelector` gained an option icon slot and opt-in radio semantics.**
137
+
138
+ `FormSwitch` (A11Y-ARIA-CHECKED-1): react-native-web 0.21 emits nothing from `accessibilityState` on web, so the
139
+ switch wrapper rendered `role="switch"` with no `aria-checked` - an invalid switch that announced no state. The
140
+ state is now passed as literal `aria-checked` (always) and `aria-disabled` (only when disabled) web props;
141
+ `accessibilityState` also carries `disabled` for native.
142
+
143
+ `ChipSelector`:
144
+ - `ChipOption.icon?: React.ReactNode` - rendered before the label inside the chip, wrapped `aria-hidden`. Options
145
+ without an icon render the exact same tree as before.
146
+ - `singleSelectRole?: 'button' | 'radio'` (type `ChipSingleSelectRole`). Default `button` = unchanged. With
147
+ `radio` and `multiple` unset, the group is `role="radiogroup"` and each chip `role="radio"` + `aria-checked`.
148
+ Ignored for multi-select. Trade-off: RN-web renders a radio chip as a `<div>`, which activates on Enter but not
149
+ Space and has no arrow-key roving focus.
150
+
151
+ **Additive and backward-compatible.** No prop set = identical DOM for every existing consumer.
152
+
153
+ ## 1.14.0
154
+
155
+ **`FormField` gained an opt-in `recentKey` — remember the last N submitted values and offer them on focus.**
156
+
157
+ A search / filter / lookup box that the user retypes the same handful of values into now gets a
158
+ "recent values" dropdown for free. Set `recentKey="<namespace>"` on a `FormField` and the values it
159
+ submits are remembered (per key) and surfaced in a menu on focus; picking one fills the input. A
160
+ value is recorded on submit (Enter) **and** on blur-with-content, so both "hit enter" and "typed then
161
+ moved on" are captured. The dropdown reuses the kit's `AnchoredMenu` (portalled to `document.body`, so
162
+ it is never painted behind a table / card / the next field) with full a11y (menu name, per-row label +
163
+ hint + role).
164
+
165
+ Persistence is `localStorage` under `@dloizides/ui-forms:recent:<recentKey>`; the list de-dupes
166
+ case-insensitively, promotes a repeat to the front, and caps at `recentMax` (default 10). On native /
167
+ SSR / when storage is disabled it is a silent no-op (recents are always `[]`), and every storage
168
+ access is wrapped so a quota or privacy-mode failure can never throw into render.
169
+
170
+ **Additive and backward-compatible.** Leave `recentKey` unset — the default — and the field behaves
171
+ exactly as before: nothing rendered, no state/refs/effects, no storage touched. NEVER set it on a
172
+ password / secure field. The engine is also exported standalone as `useRecentValues(key, max?)` for
173
+ bespoke recents surfaces, and `AnchoredMenu` gained an optional `accessibilityLabel` for naming the menu.
174
+
175
+ ## 1.13.3
176
+
177
+ **Placeholder text was too dark — it read like an already-filled value.**
178
+
179
+ `useThemedInput` painted the placeholder with the theme's `textSecondary` — a deliberately
180
+ dark, accessible grey (design-tokens UX-11) that also renders readable secondary *copy*. At
181
+ full strength a placeholder (e.g. `follower` in a "Dance role" box) was hard to tell apart
182
+ from entered text. It is now `textSecondary` composited toward the field background at 0.6
183
+ alpha, so a hint reads clearly lighter than the solid entered text (`colors.text`) while
184
+ keeping the theme hue — and it works in dark mode too (it composites toward whatever the
185
+ field background is). The field's visible label still carries the accessible name, so this
186
+ is a usability win, not an a11y regression. Affects every `@dloizides/ui-forms`-driven input
187
+ (`FormField`, `Field`, `ThemedTextInput`, the `ui-tables` `Filters` search box) across all
188
+ seven portals.
189
+
190
+ ## 1.12.0
191
+
192
+ **`FormField` gained `labelHidden` — hide the visible label, keep the accessible name.**
193
+
194
+ A field whose placeholder already names it (a toolbar search box, an inline filter) does
195
+ not want a stacked visible label: the label wastes a row and, worse, pushes the input a
196
+ label-row lower than a bare button beside it, so the two misalign. Until now the only way
197
+ to drop the visible label was to blank `label` — which ALSO blanked the input's
198
+ `accessibilityLabel`, silently stripping the accessible name.
199
+
200
+ `labelHidden` removes ONLY the visible `<label>` row: `label` stays required and the input
201
+ keeps `accessibilityLabel={label}`, so a screen reader reads the same name and the field
202
+ still resolves by role + name. Additive and backward-compatible — default `false`, every
203
+ existing call renders unchanged.
204
+
205
+ ## 1.11.1
206
+
207
+ **`ThemedTextInput` shipped no metrics, so every direct caller got a raw 19px input.**
208
+
209
+ It documented itself as "the ONE source of truth for the input look" while shipping
210
+ only **colours** — no border, radius, padding or height. `FormField` quietly passed its
211
+ own private duplicate of those metrics, so anything reached *through* `FormField` looked
212
+ correct and the gap was invisible. Every **direct** caller — the documented, blessed
213
+ usage — got a raw browser input.
214
+
215
+ Measured live in the Digital Kin CMS before: **10/10 inputs below the 48px floor**, text
216
+ inputs 19px, textareas 38px. After: **0/10**, at 48/96px.
217
+
218
+ **Label association was absent entirely** (0 `label[for]`, 0 ids). Two defects only a
219
+ real browser could find, both fixed here:
220
+
221
+ - **`htmlFor` is silently dropped by react-native-web** — it is not on the prop
222
+ allowlist, the same family as the dropped `accessibilityHint`. A prop-level assertion
223
+ passes against the broken build; only a DOM-level test catches it, so that is what the
224
+ new tests assert.
225
+ - **Dangling `for`.** `Field` assumed render-function children place the id they are
226
+ handed, but `SelectControl` uses `aria-labelledby` instead — so the difficulty label
227
+ shipped `for="field-control-3"` pointing at **nothing**, passing every structural check
228
+ while focusing no field. `useHtmlFor` now sets `for` only when the target is genuinely
229
+ in the document.
230
+
231
+ > ⚠️ **Cross-fleet visual change.** `controlStyles.input` gaining `minHeight: 48` lifts
232
+ > dense filter inputs and select triggers in `aml-v2`/`agora-web` from ~38-41px to 48px.
233
+ > This cannot be avoided: the input floor is what fixes the 19px defect, and nothing
234
+ > fixes that without also lifting inputs that already had padding. Owner-approved.
235
+
236
+
237
+ ## 1.9.0
238
+
239
+ **Campaign F3 — `Field`'s spacing model, and the layout primitives.** `Field` hard-coded a 16px
240
+ bottom margin on its container. That is the pre-flexbox model — the CHILD owns the space after
241
+ itself — and in a `gap`-laid-out parent, which is how every modern form row in this fleet is
242
+ written, the margin STACKS on the parent's gap. So consumers cancelled it by hand: **16
243
+ `containerStyle={{ marginBottom: 0 }}` sites across the fleet**, 13 of them in aml-v2, each with an
244
+ apologetic comment. AML v1 got this right in CSS years ago (`.ui-field { display: flex;
245
+ flex-direction: column; gap: 6px; }`) and wrote the contract down in `shared/FORMS.md`.
246
+
247
+ **This release moves NO pixels for any existing consumer.** The fix is opt-in, not a 2.0.0 — see
248
+ "Why not a major bump" below.
249
+
250
+ - **Add `FormGrid` + `FormCell`** — the wrapping form row, extracted from the copy the fleet
251
+ re-declares verbatim (`{ flexDirection: 'row', flexWrap: 'wrap', gap: 12 }` +
252
+ `{ minWidth: 220, flexGrow: 1, flexBasis: 260 }`), with the min-width/basis parameterised. Cell
253
+ metrics live on the GRID, so the common call site is a bare `<FormCell>` and only the genuine
254
+ one-offs (`<FormCell basis={160} grow={false} minWidth={140}>`) carry props.
255
+ - **Add `FormSection`** — the fieldset/legend grouping only v1 had. react-native-web has no
256
+ `fieldset` mapping, so this is the ARIA equivalent: `role="group"` + `aria-labelledby` pointing
257
+ at the legend. The legend reuses `resolveLabelVariantStyle` — the SAME function `Field` uses — so
258
+ a section heading cannot drift into a third label voice.
259
+ - **Add `Field.spacing` (`'stack' | 'gap'`)** — the two spacing models. `stack` is the historical
260
+ 16px margin + 4px child margins, byte-identical to 1.8.0, and remains the default. `gap` is the
261
+ FORMS.md contract: no bottom margin, one uniform 6px internal gap, parent owns the rhythm.
262
+ - **`Field` inside a `FormGrid` or `FormSection` resolves to `gap` automatically.** Adopting the
263
+ shared grid IS the opt-in: a consumer deletes its hand-rolled `grid`/`field` styles AND its
264
+ `marginBottom: 0` cancel in the same edit. An explicit `spacing` prop beats the context in both
265
+ directions.
266
+ - **`ChipSelector`**: the chip row now spaces with `gap: 8` instead of per-chip margins plus a
267
+ compensating `marginBottom: -8`. Rendered box is byte-identical. Also gains a `spacing`
268
+ passthrough, and `containerStyle` widens to `StyleProp<ViewStyle>` to match `Field`'s.
269
+
270
+ ### Why not a major bump
271
+
272
+ The brief for this work allowed a breaking 2.0.0. It was rejected. Switching every `Field` to the
273
+ gap model in one publish moves pixels on every form in seven portals simultaneously — which is
274
+ precisely the change you cannot visually QA, because no app remains on the old behaviour to compare
275
+ against, and a regression surfaces as "some form somewhere looks slightly wrong" with seven
276
+ suspects. The context-aware opt-in gives the identical end state via a per-app rollout, each step
277
+ behind visual QA, with `git revert` scoped to one app. The cost is that both models live in the
278
+ code until the fleet has migrated; that is a smaller price than an un-QA-able fleet-wide pixel
279
+ change.
280
+
281
+ ### Correction to the campaign premise
282
+
283
+ `ChipSelector`'s `marginBottom: -CHIP_GUTTER` was documented — and briefed — as compensation for
284
+ `Field`'s 16px margin, load-bearing enough that changing one without the other would break chip
285
+ spacing in 7+ sites. **That was wrong.** The -8 cancelled the chips' OWN bottom gutter hanging off
286
+ the last wrapped row; it behaved identically whatever `Field` contributed. It has been replaced with
287
+ `gap` regardless, because a margin/negative-margin pair is fragile and leaks a negative margin onto
288
+ the block's box. `fieldSpacing.test.tsx` now pins `Field` and `ChipSelector` to the same box in both
289
+ models, so the relationship is checkable rather than folkloric.
290
+
291
+
292
+ ## 1.8.0
293
+
294
+ **Campaign F2 — the dense CONTROLS arrive.** `@dloizides/ui-tables` shipped a complete, themed,
295
+ a11y-wired set of form controls inside its `Filters` bar and exported NONE of them: its
296
+ `src/index.ts` exposed only `Filters`, `useFilterDraft`, `suggestOptions`, `isUnmatched` and
297
+ types. Six portals could SEE those controls working and none could import them, so the fleet
298
+ reimplemented them — **6 independent select implementations, 5 date fields, 2 typeaheads**. Same
299
+ shape as `MultiTenancy.EntityFrameworkCore` shipping no EF Core. This release makes them public.
300
+
301
+ Nothing here moves a pixel for an existing consumer: the metrics are the promoted originals,
302
+ unchanged. `CONTAINER_MARGIN_BOTTOM` and `ChipSelector`'s compensating `marginBottom:
303
+ -CHIP_GUTTER` remain deliberately untouched.
304
+
305
+ - **Add `SelectControl`** — single-select enum/status dropdown. Bordered trigger + chevron opening
306
+ the shared `AnchoredMenu`.
307
+ - **Add `TypeaheadControl`** — search-as-you-type combobox (aml-v2's CountryPicker, generalized).
308
+ Free typing is preserved (the value is raw text the caller normalises at query time); picking a
309
+ suggestion fills the canonical LABEL, not the value.
310
+ - **Add `DateRangeControl`** — inclusive from/to pair. Editing one side patches ONLY that side.
311
+ - **Add `AnchoredMenu`** — the floating option list both of the above compose. Kept in-tree with
312
+ NO `ui-layout` dependency; that was a considered choice in `ui-tables` and it still holds, since
313
+ depending on the higher-level `ModalDropdown` would invert the graph for every consumer.
314
+ - **Add `controlStyles`** — the tuned metrics, promoted verbatim. `ui-tables`' `Filters/styles.ts`
315
+ said the quiet part out loud in its own header: it "reconcile[d] the per-field styles that were
316
+ copy-pasted across aml-v2's filter files into one shared source" — and then locked the
317
+ reconciliation inside one bar where no other surface could reach it.
318
+ - **Add `suggestOptions` / `isUnmatched`** — the ranked substring matcher behind the typeahead.
319
+ - **Add `ControlOption` / `DateRangeValue`** types. `ui-tables` now ALIASES its long-standing
320
+ public `FilterOption` / `DateRangeValue` onto these, so there is one definition rather than two
321
+ structurally-compatible twins free to drift.
322
+
323
+ ### The controls are LABEL-FREE, on purpose
324
+
325
+ They render the control only. Compose them inside `Field` — with `labelVariant="control"` on a
326
+ dense surface — to get the label, hint and error slots. That is what retires `ui-tables`' private
327
+ `FieldShell` fork (see `@dloizides/ui-tables` 1.14.0) and leaves ONE label implementation for
328
+ every control instead of one per control.
329
+
330
+ ### i18n: this package still never calls `t`
331
+
332
+ Every string — `accessibilityLabel`, `placeholder`, `optionHint`, `error`, `fromLabel`/`toLabel`
333
+ — is a PRE-LOCALIZED prop. This is load-bearing, not stylistic: aml-v2 localizes through
334
+ `@dloizides/i18n` with positional `{0}` while the other six portals use i18next `{{p1}}`, so a
335
+ component that localized internally could not serve both. `SelectControl`'s `accessibilityLabel`
336
+ is therefore composed BY THE CALLER — it must carry the selection ("Status: Active", not
337
+ "Status"), and building that string needs a `t` call this package must not make.
338
+
339
+ ### Fixed — a WCAG defect carried in by the promoted code
340
+
341
+ `AnchoredMenu` marked the current option with `accessibilityState={{ selected }}` alone.
342
+ **react-native-web does not read `accessibilityState` at all** (verified against
343
+ `react-native-web@0.21`'s `createDOMProps`, which enumerates `aria-selected` /
344
+ `accessibilitySelected` and never `accessibilityState`), so on web the selected option was
345
+ distinguished by colour and font-weight ONLY — no screen reader could tell which option was
346
+ current (WCAG 1.4.1, use of colour). `aria-selected` is now passed alongside, so each platform
347
+ gets the channel it honours. The trigger already paired `aria-expanded` with `accessibilityState`;
348
+ the option row was simply missed when that was done. A test asserts it, and that test FAILED
349
+ before the fix.
350
+
351
+ ## 1.7.0
352
+
353
+ Additive wave implementing the shared cross-stack forms contract now written down at
354
+ `PROOViD/AMLService/AMLService/wwwroot/shared/FORMS.md`. **Nothing in this release moves a pixel
355
+ for an existing consumer**: every addition is opt-in and every default is the previous behaviour.
356
+ `CONTAINER_MARGIN_BOTTOM` and `ChipSelector`'s compensating `marginBottom: -CHIP_GUTTER` are
357
+ deliberately untouched — they are load-bearing and move together in a later, visual-QA-gated wave.
358
+
359
+ - **Add `FormActions` — the submit/cancel row.** Promoted from the BYTE-IDENTICAL
360
+ `erevna-web/src/components/Forms/FormActions.tsx` and `katalogos-web/.../FormActions.tsx`
361
+ (68 lines each; `diff` returns nothing). All seven portals hand-roll this row; aml-v2, agora,
362
+ kefi, ichnos and zygos each inline their own variant. The primary action is LAST in DOM order so
363
+ tab reaches Cancel before Save, and `saving` drives the primary button's spinner rather than
364
+ disabling-and-relabelling it. `saveDisabled` blocks Save WITHOUT blocking Cancel — an invalid
365
+ form stays escapable. testIDs default to the twins' `save-button` / `cancel-button`, so existing
366
+ Playwright selectors keep matching.
367
+ - **`Field` gains `hint`.** ~21 hand-rolled copies of `{fontSize:12, marginTop:4, color:
368
+ textSecondary}` exist across the fleet; aml-v2 alone declares a local `hint` style in 8 files.
369
+ Because `Field` had no hint slot, consumers rendered the hint as a SIBLING, where it lands past
370
+ the container's 16px bottom margin and detaches from the control it explains (see the apologetic
371
+ comment in `aml-v2/src/screens/screening/CoverageSelector.tsx`). The hint renders UNDER the
372
+ control and ABOVE the error, and hint and error COEXIST — both are reachable from the control via
373
+ a composed `aria-describedby` (hint id then error id, in reading order). Only the error is a
374
+ `role="alert"` live region; a hint that announced itself would interrupt on every focus.
375
+ - **`Field` gains `optional` + `optionalLabel`.** Mutually exclusive with `required`; when a caller
376
+ sets both, `required` WINS — the safe direction, since an under-marked required field sends the
377
+ user into a failed submit. Enforced at runtime in `resolveFieldMarker` rather than in the type
378
+ system, so a caller spreading a computed props object still gets a defined single-marker result
379
+ instead of a compile error it cannot act on. Like the asterisk, the optional text is decorative
380
+ (`aria-hidden`) — "optional" is the ABSENCE of `aria-required`, which assistive tech already
381
+ conveys.
382
+ - **`Field` gains `labelVariant` (+ `labelStyle` as the escape hatch).** `Field` hard-coded
383
+ 13/600/sentence-case, which is exactly why kefi-web refused it and why `@dloizides/ui-tables`'
384
+ private `FieldShell` forked to 11/700/uppercase. `labelVariant` makes the contract's TWO
385
+ legitimate voices first-class and named: `field` (13/600 sentence case — a label that is READ)
386
+ and `control` (11/700 UPPERCASE + letter-spacing — a label that is SCANNED, for dense filter bars
387
+ and toolbars). An absent variant resolves to `field`, so every existing consumer renders
388
+ byte-identically. `labelStyle` applies AFTER the variant for the genuine one-off.
389
+ - **`Field`'s `containerStyle` widens `ViewStyle` -> `StyleProp<ViewStyle>`.** The narrow type was a
390
+ documented pain: `aml-v2/src/screens/leaders/CountryPicker.tsx` has to build a COMPLETE style per
391
+ variant because it cannot compose an array.
392
+ - **`useThemedInput`: a focused errored field now keeps a RED focus ring.** It previously computed
393
+ `isFocused && !hasError`, so an errored field got NO focus ring at all — removing the focus
394
+ indicator (WCAG 2.4.7) from precisely the field the user was sent back to fix, at the moment they
395
+ are most likely navigating by keyboard. It now always rings on focus and only changes the ring's
396
+ COLOUR, matching v1's `input.invalid:focus { box-shadow: 0 0 0 3px var(--danger-tint) }`.
397
+ One pre-existing test necessarily changed: it asserted `boxShadow === 'none'` for this state,
398
+ i.e. it encoded the defect as intended behaviour.
399
+ - **New peer dependency `@dloizides/ui-buttons >= 1.4.0`**, required by `FormActions` so the estate
400
+ keeps exactly one button implementation rather than forking one here.
401
+ - No i18n runtime is introduced: all user-visible copy (`saveLabel`, `cancelLabel`, `optionalLabel`,
402
+ `hint`, `error`) arrives pre-localized. aml-v2 localizes via `@dloizides/i18n` with positional
403
+ `{0}` params while the other six apps use i18next `{{p1}}`, and nothing bridges them, so a
404
+ component that localized internally could not serve both.
405
+ - Also shipping in this tarball, from a CONCURRENT workstream (commit `13bd281`, not part of this
406
+ wave): `ChipSelector` gains `chipTestIDPrefix`, `optionAccessibilityHint` and `multiple`
407
+ toggle semantics, and reads its on-primary ink from the theme's `onBrand` scale instead of a
408
+ hardcoded `#fff`. All opt-in; the `chip-selector-chip-<value>` testID default is frozen.
409
+
410
+ ## 1.6.0
411
+
412
+ - **`ChipSelector` now composes `Field` internally — its label was drifting.** It rendered its OWN
413
+ `<Text>` label whose metrics differed from `Field`'s on three of four axes: `marginBottom: 8`
414
+ (vs 4), NO `fontSize` at all so it fell back to RN's ~14 (vs 13), and `colors.text`
415
+ (vs `textSecondary`). A `ChipSelector` next to a `FormField` in a row/grid therefore started a
416
+ different distance down the column and read as a different weight of text. Found at 4 sites in
417
+ aml-v2 (`TenantWatchlistsEditor`, `CoverageSelector`, `CustomCoverageFields`,
418
+ `AdvancedMatching`); fixing it in the package fixes every consumer with zero app churn.
419
+ The local label styles are deleted — there is now exactly one label implementation in the kit.
420
+ - **`ChipSelectorProps` is unchanged and fully backward-compatible** — every existing prop keeps
421
+ its name, type and default, and `label` stays OPTIONAL. With no label (or an empty one) NO label
422
+ row is rendered, so composing `Field` cannot introduce a phantom gap above the chips.
423
+ - **`ChipSelector` gains `required`, `error` and `testID`** (all optional, all additive) now that
424
+ `Field` provides them for free. `error` renders the same `role="alert"` line as `FormField` and
425
+ is tied to the chip group via `aria-describedby` + `aria-invalid` (web only; no-op on native).
426
+ - **Spacing:** a `ChipSelector` now carries `Field`'s `marginBottom: 16` like every other field
427
+ (it previously had none). The chips' own 8px trailing gutter is cancelled on the group so the
428
+ block's total bottom spacing is exactly 16 — the same as a `FormField`, not 24. Pass
429
+ `containerStyle` to override, as before.
430
+ - **`Field`'s `label` is now optional** (widened from `label: string`, so existing callers are
431
+ unaffected). An absent or empty label renders no label row, letting a control whose label lives
432
+ elsewhere still use the shared shell for its error line and spacing.
433
+ - `FormSwitch` / `FormCheckbox` are deliberately NOT changed — see `src/labelRoles.test.tsx`.
434
+ Their labels are INLINE control labels (beside the control in a row, the row's primary text),
435
+ not field headers stacked above a control, so they have no alignment defect to fix and `Field`'s
436
+ smaller/dimmer header treatment would be a regression. They were already identical to each
437
+ other; a new test now enforces that they stay so.
438
+
439
+ ## 1.5.0
440
+
441
+ - **Add `Field` — the generic label-over-control wrapper.** `FormField` is hard-wired to a text
442
+ input (`FormFieldProps extends Omit<TextInputProps,'style'>`), so any NON-text control (a
443
+ dropdown, a date picker, a chip selector) had no shared way to get a label — and ended up
444
+ visually misaligned next to its `FormField` siblings: the control's box started ~21px higher
445
+ (no label row) and it missed `FormField`'s `marginBottom: 16`, so wrapped rows lost their
446
+ vertical rhythm. This was hand-rolled in 5 places across zygos-web and aml-v2.
447
+ `Field` takes `{ label, required?, error?, children, containerStyle?, testID? }` and renders the
448
+ same label row / required mark / error line / spacing.
449
+ - **`FormField` now composes `Field` internally**, so the two can never drift apart — the metrics
450
+ live in exactly one place. `FormFieldProps` and every rendered attribute (`form-field-input`
451
+ testID, `aria-invalid` / `aria-describedby` / `aria-required`, the `role="alert"` error line)
452
+ are unchanged: fully backward-compatible.
453
+ - `Field`'s `children` may be a plain node (the common case) or a render function receiving
454
+ `{ describedById, hasError }`, so a custom control can wire the error line into its own
455
+ `aria-describedby` / invalid state exactly the way `FormField` does.
456
+
457
+ ## 1.4.0
458
+
459
+ - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
460
+ - `FormField`: the error message is now programmatically tied to the input — the input gets
461
+ `aria-invalid` when errored and `aria-describedby` pointing at the error line (which is a
462
+ `role="alert"` live region), and `aria-required` when `required`. The required `*` is marked
463
+ decorative (`aria-hidden` / `accessibilityElementsHidden`) so a screen reader hears "required"
464
+ (via `aria-required`) instead of "star".
465
+ - `ThemedTextInput`: new optional `describedById` + `requiredField` props forward
466
+ `aria-describedby` / `aria-required`, and it emits `aria-invalid` from `hasError` (web only;
467
+ no-ops on native). Existing callers are unaffected.
468
+ - `FormCheckbox`: now keyboard-operable — the `role="checkbox"` Pressable renders a `<div>`
469
+ (no free Enter/Space), so an explicit web-only Enter/Space handler toggles it (WCAG 2.1.1).
470
+ - `ChipSelector`: chips gain a `hitSlop` so the touch target reaches ~44px WITHOUT changing the
471
+ rendered pill size, and expose `accessibilityState.disabled` when the selector is disabled.
472
+ - `useThemedInput`: the focus/hover CSS transition now collapses to instant when the user
473
+ requests `prefers-reduced-motion: reduce` (WCAG 2.3.3, web only).
474
+
475
+ ## 1.3.0
476
+
477
+ - `ChipSelector` gains a `variant` prop (`'solid' | 'outline'`, default `'solid'`). `solid` is the
478
+ original filled-pill look (selected = solid brand fill, white ink) — existing consumers
479
+ (erevna / katalogos / kefi) render **identically**, no change. `outline` is the AML v1 console
480
+ look: an outlined pill on a muted fill where the **selected** state is a subtle tinted-outline
481
+ (brand border + brand ink + a low-alpha brand wash), NOT a solid fill; on web, hover lifts the
482
+ border + ink to the brand colour. Fully theme-driven (brand colour + alpha, border/text from the
483
+ theme), so it re-themes per tenant. Additive + backward-compatible.
484
+
485
+ ## 1.2.0
486
+
487
+ - Add `ThemedTextInput` + `useThemedInput` — the shared "readable + lively" text-input treatment,
488
+ driven entirely by the active theme (re-themes per tenant, no hard-coded hex). At rest: dark
489
+ readable text on a subtle off-white surface with a soft border. On hover (web): the border
490
+ strengthens a touch. On focus: the border becomes the brand primary, the background brightens to
491
+ the plain surface (white), and a soft 3px brand-tinted focus ring fades in. The animation is a
492
+ pure GPU-cheap CSS transition on `border-color`/`background-color`/`box-shadow` (the ring is a
493
+ `box-shadow`, so no layout/reflow) — NO `Animated`/`LayoutAnimation`/JS timers. Web-only style
494
+ keys and the mouse-hover handlers are guarded behind `Platform.OS === 'web'`, so it stays
495
+ native-safe (native applies the state-driven colours instantly).
496
+ - `FormField` now renders `ThemedTextInput`, so every field gets the treatment for free; its label
497
+ uses `textSecondary` at 13px/600 for readability. Props/behaviour (label, hint, error, testID,
498
+ a11y, `onFocus`/`onBlur` pass-through) are backward-compatible.
499
+
500
+ ## 1.1.0
501
+
502
+ - Add `FormCheckbox` — a native-safe (`Pressable`-based, RN-web + native) themed checkbox: a rounded
503
+ square that fills with the brand colour and shows a check glyph when on, with a label and optional
504
+ hint. Mirrors `FormSwitch`'s prop shape (`value`, `onValueChange`/`onChange`, `label`, `hint`,
505
+ `disabled`, `testID`, a11y) so it is a drop-in for boolean toggles that should read as checkboxes.
506
+ Exposes `role="checkbox"` + `aria-checked` / `accessibilityState={{ checked }}`.
507
+
508
+ ## 1.0.0
509
+
510
+ Initial release. Extracted the proven duplicated form components from erevna-web ↔ katalogos-web
511
+ (Capability Wave C1, batch 2).
512
+
513
+ - `FormField`, `ChipSelector`, `FormSwitch` — share the `@dloizides/ui-feedback` UI context (`useUi`).
514
+ - `FormActions` deferred (depends on a not-yet-shared `core/Button`).