@dloizides/ui-layout 1.28.5 → 1.29.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,631 +1,644 @@
1
- # Changelog
2
-
3
-
4
- ## 1.26.3
5
-
6
- ### Fixed
7
-
8
- - `ModalDropdown` / `InlineMenu`: a closed-but-still-fading popover was INTERACTIVE for the whole
9
- 120ms exit animation — no `pointerEvents`, no `aria-hidden` — so a fast second click could select
10
- an option from a menu the user had already dismissed, and screen readers still saw the options.
11
- The popover now goes inert the instant `isOpen` goes false (`aria-hidden` on the menu node,
12
- `pointerEvents: 'none'` on the animated wrapper, and the select handler refuses a closed menu).
13
- The fade is unchanged. Covered by `ModalDropdown.openState.test.tsx` — the fade is held open
14
- deliberately, since the reduced-motion test harness collapses it to 0ms.
15
-
16
- ## 1.26.2
17
-
18
- ### Fixed
19
- - **`useAnchorTracking` no longer re-renders an open menu whose anchor has not moved.** `readAnchorRect`
20
- returns a fresh object on every measurement, and the hook wrote it to state unconditionally, so
21
- `Object.is` never matched and React re-rendered on every scheduled measurement. Because the hook's
22
- own `ResizeObserver` watches `document.body` — which the menu is portalled into — the re-render
23
- could re-arm the observer that caused it, giving a self-sustaining loop (`Maximum update depth
24
- exceeded` under test). In a browser the menu's box never settled, which Playwright reports as
25
- "element is not stable" and then "element was detached from the DOM"; it broke every click on a
26
- `navbar-overflow-menu` option. The rect is now compared BY VALUE, so an unmoved anchor writes no
27
- state. Pinned by `src/ModalDropdown/useAnchorTracking.stability.test.tsx`.
28
-
29
- ## 1.26.1
30
-
31
- ### Fixed
32
-
33
- - **`ModalDropdown` (popover variant) — a CLOSING menu no longer swallows the next keystroke.**
34
- `InlineMenu` hard-coded `enabled: true` for `useMenuKeyboard`, so its DOCUMENT-CAPTURE keydown
35
- listener lived as long as the component was MOUNTED — and `ModalDropdown` deliberately keeps it
36
- mounted past logical close so the exit fade can play. For that whole window the trigger already
37
- reported `aria-expanded="false"` while a live handler `preventDefault()`ed and
38
- `stopPropagation()`ed the user's Enter, so react-native-web's `<button>` never received the
39
- browser-synthesised click and the menu could not be reopened from the keyboard.
40
-
41
- The menu's keyboard now follows the owner's LOGICAL open state, threaded down as a new required
42
- `isOpen` prop on `InlineMenu`, rather than its mount. MOUNTED IS NOT OPEN.
43
-
44
- Note for anyone extending this: passing `menuAnim.mounted` as `isOpen` reproduces the same bug
45
- one level up, and there is a test that fails if you do.
46
-
47
-
48
- ## 1.26.0
49
-
50
- **New `BuildInfoFooter` — a small, themable "which build am I running?" caption for the portals.**
51
-
52
- The FE half of the "know what's deployed" work: every RN-web portal can now show a compact,
53
- unobtrusive footer like `v<buildVersion>` (optionally `· api <sha7>`). `@dloizides/pwa-sw` already
54
- stamps a per-build `BUILD_VERSION` into the generated service worker, but that value lives only
55
- inside `service-worker.js` and is not exposed to page runtime — so the component stays dumb and
56
- takes the build id as a prop (each app inlines it at build time, e.g. `EXPO_PUBLIC_BUILD_VERSION`).
57
-
58
- - **`BuildInfoFooter`** — props `buildVersion` (required), optional `apiBaseUrl` (best-effort GET
59
- `${base}/version` → `.commit`, appended as `· api <sha7>`; any failure silently shows the version
60
- alone), optional `apiCommit` (skip the fetch), `fetchImpl` (test seam), plus the usual `testID` /
61
- `accessibilityLabel` / `accessibilityHint` / `style`. Muted caption via the theme's
62
- `textSecondary` — no raw colours.
63
- - New exports: `formatBuildInfo`, `shortenCommit`, `trimTrailingSlash`, `useApiCommit`,
64
- `BUILD_INFO_PREFIX`, `API_COMMIT_SEPARATOR`, `VersionResponse`.
65
- - New kit i18n key `LAYOUT_I18N.buildInfoHint` (`common.buildInfoHint`) and testID
66
- `LAYOUT_TEST_IDS.buildInfoFooter` (`build-info-footer`).
67
-
68
- ## 1.24.0
69
-
70
- **The inline dropdown popover now stays inside the viewport — a floored menu can no longer spill off the right edge.**
71
-
72
- `buildPortalPopoverStyle` positioned the fixed popover at `left: rect.left` with no horizontal
73
- clamp. That was fine while the menu matched its trigger's width, but a COMPACT trigger with a
74
- `menuMinWidth` floor (e.g. the `@dloizides/ui-nav` "More ▾" overflow menu, whose trigger sits near
75
- the right of the bar) opens a menu WIDER than its trigger — which then extended past the right edge
76
- of the viewport and clipped its lower/right content ("some items get hidden").
77
-
78
- - **`buildPortalPopoverStyle(rect, minWidth, viewportWidth?)`** takes an optional `viewportWidth`.
79
- When given, the popover's `left` is clamped so its right edge clears `MENU_VIEWPORT_MARGIN` (8px) —
80
- sliding it left, right-aligning it to the trigger in the limit — while never crossing the left
81
- margin. `viewportWidth = 0` (the default, and the native/pure path) keeps the exact prior
82
- trigger-anchored behaviour, so every existing caller is unchanged.
83
- - **`InlineMenu`** passes `window.innerWidth` on web (re-read whenever the tracked trigger rect
84
- re-measures on scroll/resize); native is untouched.
85
- - New export `MENU_VIEWPORT_MARGIN`.
86
-
87
- ## 1.23.0
88
-
89
- **Modals, the dropdown popover and the accordion body now ANIMATE on web — adopts `@dloizides/ui-motion`.**
90
-
91
- On react-native-web, RN's `Modal animationType` and `LayoutAnimation` are effectively no-ops, so
92
- `Modal`, `ModalShell`, the `ModalDropdown` popover and the `Accordion` body all SNAPPED open/closed
93
- on the web build (all 7 portals). This wires those surfaces to `@dloizides/ui-motion`, which drives
94
- enter/exit with RN `Animated` (works on web AND native) and collapses every animation to instant
95
- under the OS "reduce motion" preference. **No public APIs changed** — every prop, testID and a11y
96
- attribute is identical; this is a purely visual upgrade.
97
-
98
- - **`Modal`** — the backdrop now **fades** (opacity) and the panel **fades + scales in** (0.96→1) on
99
- open, reversing on close, via `useEnterExit`. The RN `Modal` host is kept **mounted through the
100
- exit** (driven by `useEnterExit`'s `mounted` flag, not `visible`) so the close animation can play
101
- instead of the host unmounting instantly — the trick that made `animationType` a no-op on web. The
102
- scrim moved to its own animated layer behind the tap-catcher; close-on-backdrop, Escape, focus
103
- trap, scroll-lock and every testID are unchanged.
104
- - **`ModalShell`** — the full-screen sheet **fades + scales in** on open (replacing the native-only
105
- `animationType="slide"`), mounted through the exit the same way.
106
- - **`ModalDropdown`** — the popover (the inline anchored menu on web-desktop, the centered modal on
107
- mobile/native) **fades + scales in** from the anchor on open (`transformOrigin: top`), with a snappy
108
- ~120ms curve so the close reads as near-instant. `useAnchorTracking`, the web portal, keyboard nav
109
- and outside-click detection are untouched (the fade/scale rides an INNER wrapper so the popover's
110
- own DOM node — which the outside-click/portal logic depends on — is unchanged).
111
- - **`Accordion`** — the item body now renders inside ui-motion's **`<Collapse>`** (measured, animated
112
- height) instead of RN `LayoutAnimation`, so the body animates on web too. The chevron rotation is
113
- unchanged. Behaviour note: `<Collapse>` keeps the body **mounted at all times** (clipped to height 0
114
- when closed) so `aria-controls` always resolves and screen readers reach the content — the open
115
- state is conveyed by the header's `aria-expanded` (the value handed to `<Collapse open>`). The
116
- internal `accordionAnimation.ts` (`LayoutAnimation` helper) was removed.
117
- - **New dependency `@dloizides/ui-motion` (`^1.0.1`)** — the shared RN/RN-web motion kit
118
- (`useEnterExit`, `Collapse`, reduced-motion-aware).
119
-
120
- Additive and back-compatible for consumers. Covered by the existing `Modal`, `ModalShell`,
121
- `ModalDropdown` (web + native) and `Accordion` suites; the accordion tests now assert open state via
122
- `aria-expanded`/the `Collapse` container rather than body-text presence (the body is always mounted).
123
- The Jest env is pinned to reduced-motion so enter/exit resolve synchronously in tests.
124
-
125
- ## 1.22.0
126
-
127
- **Two shared modal primitives: a themed centered `Modal` dialog and a `ConfirmDialog` popup.**
128
-
129
- Until now the kit had no shared centered dialog — only `ModalShell` (a full-screen slide-up sheet)
130
- and `ModalDropdown` (a selector). Each portal hand-rolled its own edit dialog (e.g. kefi-web's
131
- `PromoterActionModal`) and confirmed destructive actions with an ugly inline table row. These two
132
- primitives replace both, so all 7 portals share one accessible, themed implementation.
133
-
134
- - **New component `Modal`** — a centered dialog overlay for RN + RN-web: a scrim, a rounded themed
135
- surface, an optional header (`title` + a top-right **✕ close** — a 44dp `IconButton` with a web
136
- `tooltip`/aria-label "Close"), a scrollable body (`children`), and an optional `footer`. Dismissal
137
- funnels to `onClose` from four routes: the ✕, a **backdrop** press, **Escape** on web
138
- (`useEscapeKey`), and the hardware back button on native (RN `Modal`'s `onRequestClose`). It is
139
- `role="dialog"` + `aria-modal` (`accessibilityViewIsModal`), **focus-trapped** on web
140
- (`useFocusTrap`, restoring focus to the opener on close) and **scroll-locked** (`useScrollLock`).
141
- Props: `visible`, `onClose`, `title?`, `children?`, `footer?`, `size?` (`sm`/`md`/`lg`, default
142
- `md`), `showClose?` (default `true`), `testID?` (default `modal`), `accessibilityLabel?`. testIDs:
143
- `${testID}-close`, `${testID}-backdrop`. All colours read from `useUi()` — no raw literals.
144
- - **New component `ConfirmDialog`** — built ON `Modal`, for confirmations. Renders the `message`
145
- plus a Cancel + Confirm button row (from `@dloizides/ui-buttons`). `destructive` paints the
146
- Confirm with the `danger` (red) variant for irreversible actions. **Cancel is first in the DOM so
147
- the focus trap lands on the SAFE action**; the ✕ is hidden (Cancel is the explicit dismiss). While
148
- `busy`, Confirm shows a spinner and Cancel is disabled. Cancel / backdrop / Escape → `onCancel`.
149
- Props: `visible`, `title`, `message`, `confirmLabel?`, `cancelLabel?`, `destructive?`, `onConfirm`,
150
- `onCancel`, `busy?`, `testID?` (default `confirm-dialog`). testIDs: `${testID}-confirm`,
151
- `${testID}-cancel`, `${testID}-message`.
152
- - **New exported type `ModalSize`** (`'sm' | 'md' | 'lg'`) — a plain string union (matching the
153
- kit's `ButtonSize` convention; no `const enum` crosses the package boundary).
154
- - **New i18n keys** the host must provide: `common.close` (✕ label), plus for `ConfirmDialog`
155
- defaults `common.confirm` / `common.confirmHint` / `common.cancel` / `common.cancelHint`. Reuses the
156
- existing `common.closeDialogHint`, `common.dialog`, `common.dismissDropdown(Hint)` keys.
157
- - **New peer dependency `@dloizides/ui-buttons` (`>=1.8.0`)** — `ConfirmDialog` reuses its `Button`,
158
- `Modal` reuses its `IconButton` for the ✕, rather than reinventing button chrome.
159
-
160
- Additive: `ModalShell`, `ModalDropdown` and every existing export/selector are untouched. Covered by
161
- `Modal.test.tsx`, `ConfirmDialog.test.tsx`, `useEscapeKey.test.ts`, `useScrollLock.test.ts`.
162
-
163
- > Note: `@dloizides/ui-feedback` also exports a lighter `ConfirmDialog` (no ✕ / Escape / focus-trap,
164
- > own buttons). This ui-layout one is the richer, `Modal`-based dialog the portals should adopt.
165
-
166
- ## 1.21.0
167
-
168
- **The collapsed `Tabs` menu can now present as a HAMBURGER (☰) — the universal mobile-nav affordance.**
169
-
170
- The collapsed organizer nav reads better on a phone as a ☰ hamburger than as a caret field.
171
- This adds an opt-in so a consumer can choose either presentation; the default is unchanged.
172
-
173
- - **New opt-in prop `ModalDropdown.showHamburger?: boolean` (default `false`).** When set, the
174
- DEFAULT trigger renders a ☰ glyph LEADING the active option's label, with the same bordered
175
- field box, theme tokens and ≥44dp (`MIN_TOUCH_TARGET`) hit target as the caret variant. It
176
- **takes precedence over `showCaret`** (a hamburger already IS the "this is a menu" cue, so the
177
- trailing caret would be redundant) and, like `showCaret`, is ignored when a custom `renderTrigger`
178
- is supplied. The glyph is a font character (U+2630) — no icon package enters this contract-pure
179
- kit — and its colour comes from `colors.textSecondary` (no raw literals). It is decorative: the
180
- trigger's `aria-label` still names the control, so screen readers do not announce the glyph.
181
- - **New exported enum `TabsCollapsedTrigger { Caret, Hamburger }`** + new optional prop
182
- **`Tabs.collapsedTrigger` / `TabsMenu.collapsedTrigger` (default `Caret`).** Selects how the
183
- COLLAPSED (mobile) tab menu trigger presents; only affects the collapsed form, the wide pill
184
- strip is identical either way. Exported as a regular (runtime) enum for the same reason as
185
- `DropdownVariant` — a `const enum` cannot cross the published-package boundary under
186
- `isolatedModules`.
187
-
188
- Backward-compatible: two new optional props + one new enum, all defaulting to the prior behaviour;
189
- no testID/selector changes. Per-tab E2E selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}`
190
- / descriptor option testIDs) are untouched. No new i18n keys (the existing `common.tabsMenuHint`
191
- serves both presentations). Covered by component tests (`ModalDropdown.test.tsx`,
192
- `Tabs.collapsed.test.tsx`).
193
-
194
- ## 1.20.0
195
-
196
- **The collapsed `Tabs` menu now READS as a menu — a caret affordance + guaranteed focus.**
197
-
198
- On the live phone-width organizer nav (`app.kefi.dloizides.com/organizer/passes`) the
199
- collapsed trigger showed only the active label ("Passes") with no menu cue — styled like a
200
- static chip/pill — so users could not tell it was a section switcher. This adds a clear
201
- menu affordance and locks in keyboard focusability.
202
-
203
- - **New opt-in prop `ModalDropdown.showCaret?: boolean` (default `false`).** When set, the
204
- DEFAULT trigger renders a ▾ caret pinned to its trailing edge that rotates to point up
205
- while the menu is open, with a ≥44dp (`MIN_TOUCH_TARGET`) hit target and the existing
206
- bordered field box + theme tokens. **Every existing field-style dropdown in the kit is
207
- unchanged** because the caret is off by default, and it is ignored when a custom
208
- `renderTrigger` is supplied (that caller owns its own visuals). The caret is a font glyph
209
- (U+25BE), so no icon package enters this contract-pure kit, and its colour comes from
210
- `colors.textSecondary` (no raw literals). It is decorative — the trigger's `aria-label`
211
- still names the control, so screen readers do not announce the glyph.
212
- - **`TabsMenu` opts into `showCaret`**, so the collapsed `Tabs` section switcher now looks
213
- like a proper control instead of a chip. No change to the public `Tabs` / `TabsMenu` API.
214
- - **Focusability:** under react-native-web the trigger renders as a native `<button>`
215
- (role=button, no `tabindex="-1"`), so it is keyboard-reachable and Enter/Space activate
216
- it. A regression test asserts the collapsed trigger is not `tabindex="-1"`. (The
217
- `tabindex="-1"` seen on the live DOM came from the older deployed version; it does not
218
- reproduce on this source — proven by the rendered-DOM assertion, not assumed.)
219
-
220
- Backward-compatible: one new optional prop, no testID/selector changes. Per-tab E2E
221
- selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}` / descriptor option testIDs)
222
- are untouched. No new i18n keys.
223
-
224
- `ui-showcase` does not yet import `Tabs`/`ModalDropdown` (only `SegmentedControl`,
225
- `CopyableId`, `TruncatedText`), so this is covered by component tests
226
- (`ModalDropdown.test.tsx`, `Tabs.collapsed.test.tsx`); a showcase specimen is a follow-up.
227
-
228
- ## 1.19.0
229
-
230
- **`Tabs` collapses to a real mobile menu below a breakpoint.**
231
-
232
- On a phone the horizontal pill strip "is not a real menu and not mobile friendly" — a
233
- scrolling chip row is hard to use with 7–8 tabs (the kefi organizer dashboard:
234
- Overview / Passes / Attendees / Promoters / Door / Ledger / Messaging / Settings). `Tabs`
235
- now renders responsively:
236
-
237
- - **Wide (>= `collapseBelow`, default 768, web only):** the existing horizontal
238
- `role=tablist` / `role=tab` strip — unchanged, fully backward-compatible.
239
- - **Narrow (< breakpoint) or native:** a genuine menu — a trigger button showing the
240
- active section that opens a vertical list of all sections. Delegates to the kit's
241
- existing `ModalDropdown` (menu/listbox semantics, focus trap, dismiss backdrop, dual-
242
- platform a11y) rather than reimplementing a dropdown.
243
-
244
- Backward-compatible: the public API is unchanged except one new optional prop,
245
- `collapseBelow?: number` (default = the shared kit breakpoint, 768; pass `0` to keep the
246
- row on any web width, or a large number to force the menu). The collapse threshold reuses
247
- the SAME viewport rule (`MENU_BREAKPOINT`) that `ModalDropdown` uses for its menu-vs-modal
248
- split, so the whole layout kit changes shape at one consistent breakpoint.
249
-
250
- **E2E survival:** per-tab selectors keep working in BOTH modes. Each collapsed menu row's
251
- `testID` is the tab descriptor's own `testID` when supplied, otherwise the same
252
- `{idPrefix}-tab-{key}` pattern the wide strip uses for its tab element ids (the menu must
253
- be opened first, as with any select). Requires one new host i18n key,
254
- `common.tabsMenuHint` (the accessible hint on the collapsed trigger).
255
-
256
- ## 1.17.0
257
-
258
- **New `Tabs` primitive — a controlled tabbed section shell.**
259
-
260
- Adds `Tabs`: a wrapping/scrolling pill tab strip plus the active tab's panel, wired
261
- as a proper `tablist` / `tab` / `tabpanel` (aria-selected, aria-controls,
262
- aria-labelledby). Controlled (`activeKey` + `onChange`), so the selected tab can be
263
- driven from a route param or storage. Labels are pre-localized strings; colours read
264
- from the `@dloizides/ui-feedback` theme (no FM/router/store imports), consistent with
265
- the rest of the kit.
266
-
267
- Extracted so the seven portals share ONE tab shell instead of hand-rolling a bar per
268
- app — first consumer is the kefi-web organizer dashboard, split from one enormous page
269
- into menu tabs.
270
-
271
- ## 1.16.1
272
-
273
- **`Heading` supports levels 1-6 instead of `<h1>` only.**
274
-
275
- `Heading` rendered `<h1>` unconditionally, so any screen needing sub-structure either
276
- shipped multiple `<h1>`s or avoided the component. The Digital Kin guide editor did the
277
- latter — styled `<Text>` instead — and shipped **zero headings**: measured on the live
278
- CMS, `document.querySelectorAll('h1,h2,h3,h4,h5,h6').length === 0` for the entire page.
279
-
280
- So there was no `<h1>` naming the guide being edited and nothing marking the steps
281
- section. Screen-reader users could not navigate by heading, and styling was standing in
282
- for structure.
283
-
284
- After: `h1` names the guide, `h2` marks the steps section, `h3` per step.
285
-
286
-
287
- ## 1.15.1
288
-
289
- - **Fix (`CopyableId` truncated the value with room to spare).** 1.15.0 gave the value wrapper
290
- `flexShrink: 1`, which makes it SHRINK-WRAP its content — so the width the component measures to
291
- decide how much to show was derived from the very string it was computing: truncate → wrapper
292
- narrows → re-measure smaller → truncate harder. Verified in Chrome via `apps/ui-showcase`: a
293
- 506px-wide container and a 306px one rendered the SAME 196px string, i.e. a 36-character GUID was
294
- cut to 26 characters with ~300px going unused.
295
-
296
- The wrapper is now `flex: 1`, so it fills the row's leftover width and its size is independent of
297
- its content. Re-verified at four widths: 520px and 320px now render the full 36-character GUID
298
- untruncated; 200px and 120px middle-truncate with both ends intact, and nothing overflows.
299
-
300
- This is the SAME failure mode `useAvailableWidth` documents for `TruncatedText` (measure the
301
- parent, never the element, or the output feeds back into the input) — reintroduced one level up
302
- by the new wrapper. Unit tests cannot catch it: the truncation helpers are pure and passed
303
- throughout, and jsdom reports zero widths, so only a real browser shows it.
304
-
305
- - **New: `CopyableId` accepts `style`** for its outer container. Hosts need this to give the
306
- control a width that does not derive from its own content (a `flexBasis`, a `width`, or
307
- `flex: 1`) — without one, a shrink-to-fit parent reintroduces the feedback loop above at the
308
- host level. Documented on the prop.
309
-
310
- ## 1.15.0
311
-
312
- - **New: `CopyableId`** — show a long machine identifier (a GUID, a reference, a correlation id)
313
- so a human can both READ enough of it to tell two apart and TAKE it in one action. Composes the
314
- existing `TruncatedText`, so the middle-truncation work is reused rather than re-derived.
315
-
316
- Driven by the AML console needing to surface a screening ID an analyst can copy and re-screen
317
- with, but it is deliberately domain-free: every portal has identifiers it currently either hides
318
- or dumps raw into a table cell.
319
-
320
- Three things this gets right that a naive copy button does not:
321
-
322
- 1. **It copies the FULL value, never the display string.** A truncated GUID that a user
323
- hand-selects yields `3f2a9c81…d4e7`, ellipsis and all, which silently fails wherever it is
324
- pasted. Showing a truncated identifier with no copy affordance is strictly WORSE than not
325
- showing it. The full value is always the accessible name and the web tooltip.
326
- 2. **Middle truncation, not tail.** Two GUIDs from one table share a prefix far more often than
327
- intuition suggests, and `numberOfLines={1}` renders them IDENTICALLY. The tail is what tells
328
- them apart, so both ends survive.
329
- 3. **A failed copy is SHOWN, not swallowed.** `navigator.clipboard` is not merely unreliable —
330
- it is `undefined` outside a secure context, which is how every staging box and LAN preview in
331
- this fleet is served, i.e. exactly where people hand-test. `copyText` therefore falls back to
332
- `document.execCommand` over an off-screen textarea, and returns a boolean rather than
333
- assuming. On total failure the control renders a distinct `common.copyFailed` state; a silent
334
- failure would leave the user believing they hold an identifier they do not.
335
-
336
- The status is carried in the control's accessible **NAME**, not its hint, because
337
- `accessibilityHint` is dropped by react-native-web and never reaches the DOM — a screen-reader
338
- user would otherwise get no confirmation at all.
339
-
340
- No native clipboard dependency is taken. Hosts on React Native inject a `writer`
341
- (`Clipboard.setString`); an injected writer that throws falls through to the DOM paths.
342
-
343
- New `LAYOUT_I18N` keys — hosts binding a missing-key guard to that map (as aml-v2 does) will
344
- fail their catalog test until these are defined: `common.copy`, `common.copyHint`,
345
- `common.copied`, `common.copyFailed`, `common.copyableIdHint`.
346
-
347
- ## 1.12.2
348
-
349
- - **Fix (`TruncatedText` STILL did not middle-truncate; 1.12.1's fix was the wrong mechanism).**
350
- 1.12.1 moved the `onLayout` measurement from the `<Text>` to a wrapping `<View>`. Verified in
351
- Chrome: that did not fire either, and neither did a `ResizeObserver` on the same node — zero
352
- callbacks from all three mechanisms under react-native-web 0.21.
353
-
354
- Width now comes from `useAvailableWidth`, which on web reads the **parent's** inner width
355
- straight off the DOM in a ref callback, plus a `resize` listener. The parent is measured
356
- rather than the element because the element shrink-wraps its own text, so measuring it would
357
- feed the output back into the input and oscillate. Native keeps `onLayout`, where it works.
358
-
359
- Confirmed in Chrome at four container widths — the same URL renders as
360
- `timesofindia.indiatimes.com/cit…ties/articleshow/114237788.cms` (520px) down to
361
- `timeso…88.cms` (120px), with no element exceeding its container at either a 1400px or a
362
- 420px viewport.
363
-
364
- Note for anyone extending this: unit tests cannot catch this class of bug here. The
365
- truncation helpers are pure and passed throughout all three versions; what was broken was
366
- whether the measurement ever ran in a real browser.
367
-
368
- ## 1.12.1
369
-
370
- - **Fix (`TruncatedText` did not actually middle-truncate).** 1.12.0 measured its available
371
- width with `onLayout` **on the `<Text>` itself, which never fires under RN-web**. The width
372
- stayed 0, the character budget stayed 0, and the component silently fell back to rendering
373
- the full string — i.e. to exactly the tail-only CSS ellipsis it exists to replace. It
374
- compiled, typechecked and passed all its unit tests throughout, because the truncation
375
- helpers are pure and were never the broken part; only a browser could see it. Measured in
376
- Chrome at a 120px container: text rendered `timesofindia.indiatimes.com/city/delhi/delhi-…`
377
- with **no `…` character present** — CSS clipping, not middle truncation.
378
-
379
- The width is now measured on a wrapping `<View>`, which does fire `onLayout`. The overflow
380
- guarantee was never affected (the element stayed inside its parent in both versions); what
381
- was lost was the informative half of the behaviour.
382
-
383
- ## 1.12.0
384
-
385
- - **New: `TruncatedText`** — a single-line text/link that middle-truncates to fit its container
386
- and cannot overflow at any width. Promoted out of the AML console, where a full adverse-media
387
- article URL rendered as raw `<Text>` and blew out its table row.
388
-
389
- Three things that look like they would solve this and do not, all verified against
390
- react-native-web 0.21 rather than assumed:
391
-
392
- 1. `numberOfLines={1}` alone truncates at the **tail** (RN-web compiles it to
393
- `text-overflow: ellipsis`). Every URL from one publisher then collapses to the same
394
- `timesofindia.indiatimes.com/city/de…` prefix and the reader cannot tell the articles
395
- apart. There is no CSS for middle truncation, so it is computed in JS.
396
- 2. `title={full}` is **silently dropped** — RN-web's `<Text>` forwards only `href`, `lang`
397
- and `pointerEvents` beyond the shared whitelist. The tooltip is set on the host node
398
- through a ref instead.
399
- 3. JS truncation alone can mis-estimate an unusual glyph mix, so `numberOfLines={1}` is ALSO
400
- applied as a hard backstop. Overflow is impossible by construction, not by tuning.
401
-
402
- The full value always stays reachable — as the accessible name and, on web, the native
403
- tooltip. Also exported: the pure `truncateMiddle` / `formatUrlForDisplay` helpers and
404
- `ELLIPSIS`.
405
-
406
- ## 1.11.0
407
-
408
- - **Fix (HIGH — 1.10.0's out-of-view close never fired in the real runtime).** 1.10.0 added
409
- "close the menu once the trigger leaves the viewport". Repositioning worked, but the close was
410
- measured **against the viewport**, and **RN-web apps never scroll the document** — every screen
411
- renders inside a `ScrollView`, so scrolling happens in an inner `<div>` and `window.scrollY`
412
- stays 0 forever. A trigger scrolled out of that inner scroller is invisible to the user while its
413
- rect sits comfortably inside the viewport, so the check could not fire on any screen of any
414
- portal. Measured in Chrome: trigger at `top: -37` (fully above the scroller), menu still rendered.
415
- Visibility is now measured against the **clip window** — the viewport intersected with every
416
- clipping ancestor — which is what makes it work inside an inner scroll container.
417
- - **Fix: "entirely out of view" was also the wrong threshold.** When a scroll container reaches the
418
- end of its range the trigger stops with a few pixels still showing (4px in the reported case), so
419
- "fully out" was *unreachable* and the menu never closed however far the user scrolled. There is
420
- now a minimum-visible-pixel floor (`MIN_VISIBLE_PX`).
421
- - **Guard: the menu never closes on its FIRST measurement**, so opening a dropdown whose trigger is
422
- already partly clipped still works; only movement after opening can close it.
423
- - **The zero-area "not laid out yet" guard is unchanged in intent but now provably size-only** — it
424
- asks about the element's own box, never its position, so it cannot swallow a genuine hidden case.
425
- - **New: `LAYOUT_I18N`** — the manifest of every translation key this package resolves, mirroring
426
- `TABLE_I18N` / `FILTERS_I18N` from `@dloizides/ui-tables` so hosts can bind an existing
427
- missing-key guard to it with no new pattern. The kit is fallback-free, so a key a host forgets
428
- reaches users as a raw dotted name; hand-maintained key lists rot (one portal was found missing
429
- 26 kit keys, another had `common.accordionToggleHint` undefined while `Accordion` was mounted).
430
- Every `t(...)` call in the package now references the map, and the suite fails on a raw key
431
- literal or a stale entry — so the manifest cannot drift from the code.
432
- - **Fix: the 1.10.0 CHANGELOG entry was written in cp1252**, leaving the published file invalid
433
- UTF-8. Re-encoded.
434
- - **No breaking change.** `LAYOUT_I18N` is additive and the key strings are unchanged, so existing
435
- translation files keep working untouched.
436
-
437
- ## 1.10.0
438
-
439
- Two defects found by browser visual QA of the inline dropdown menu against a live app.
440
-
441
- - **Fix (HIGH, affects every consumer): the open inline menu detached from its trigger.** On web the
442
- menu is portalled to `document.body` with `position: fixed` at the trigger's measured rect.
443
- `fixed` is viewport-relative, so that coordinate is only valid until something moves the trigger.
444
- A `scroll`/`resize` listener on `window` was already in place (since 1.7.0) and does handle plain
445
- scrolling — but it left three real gaps:
446
- - **Layout changes that fire no scroll event at all** — an accordion above the trigger expanding,
447
- a sticky header resizing, a banner appearing, an async list rendering. The trigger moved, nothing
448
- scrolled, no listener fired, and the menu stayed behind. Now covered by a `ResizeObserver` on the
449
- anchor and on `document.body`.
450
- - **The trigger leaving the viewport.** Repositioning cannot help here — the menu just follows its
451
- trigger off-screen and hangs over unrelated content with nothing on screen explaining it. The
452
- menu now **closes** once the trigger is fully out of view.
453
- - **Layout thrash.** The handler ran a synchronous `getBoundingClientRect()` (a forced reflow) plus
454
- a React state update on *every* scroll event. Work is now coalesced into one
455
- `requestAnimationFrame` per frame.
456
- Scroll is now observed in the **capture** phase on `document` rather than `window`, so a scroll in
457
- any ancestor scroll container counts. Tracking moved into a dedicated `useAnchorTracking` hook.
458
- Native is unaffected (the popover is in-tree and moves with its anchor).
459
- - **Fix (a11y): `accessibilityHint` never reached a screen reader.** The prop is part of the public
460
- API and every caller passes one, but react-native-web does not map it — the trigger carried
461
- `aria-label` and `aria-expanded` and **no hint of any kind**, so the text was silently thrown away
462
- (older react-native-web versions additionally leaked it to the DOM, logging
463
- `React does not recognize the accessibilityHint prop on a DOM element`). On web the hint is now
464
- rendered into a visually-hidden node referenced by `aria-describedby` — the same wiring
465
- `@dloizides/ui-forms`' `Field` uses for its error line — and the RN-only prop is no longer passed
466
- on web at all. Native still receives `accessibilityHint` unchanged.
467
- - **No API change.** Both fixes are internal; every existing caller benefits without edits.
468
-
469
- ## 1.9.1
470
-
471
- - **Fix (keyboard a11y, affects every consumer): Enter CLOSED the inline menu instead of SELECTING
472
- the highlighted option.** The trigger keeps DOM focus while the menu is open, and react-native-web
473
- maps Enter on a focused Touchable to `onPress`. React dispatches that from its ROOT container
474
- listener — an ancestor of the trigger, but a *descendant* of `document` — so the menu's BUBBLING
475
- `document` keydown listener ran second: the trigger toggled the menu shut, React unmounted the
476
- popover, the effect cleanup removed the very listener the event was still travelling toward, and
477
- `document` never saw the Enter. Keyboard users could open a dropdown and arrow through it but
478
- could never CHOOSE with the keyboard (mouse selection was unaffected, which is why it went
479
- unnoticed).
480
- - **Fix:** the menu's key handler now runs in the **capture** phase and `stopPropagation`s the keys
481
- an open menu owns (↑/↓/Home/End/Enter/Escape), so it runs ahead of React's listener and the
482
- trigger cannot re-toggle behind it. Found while browser-verifying the AML v2 topbar dropdowns.
483
-
484
- ## 1.9.0
485
-
486
- - **`ModalDropdown`: `menuMinWidth` — a width FLOOR for the open inline menu (additive, optional).**
487
- The menu matches the TRIGGER's width, which is right for a full-width field but leaves a compact
488
- anchor (the 1.8.0 `renderTrigger` case: a locale pill, an avatar chip, an icon button) with a menu
489
- too narrow to read its own option labels — a 52px "EN ▾" pill produced a 52px menu whose rows were
490
- clipped to a dark strip. `menuMinWidth` floors it; a wider trigger still wins.
491
- - **Backward-compatible:** omitted, the width is the trigger's, exactly as before.
492
-
493
- ## 1.8.0
494
-
495
- - **`ModalDropdown`: `renderTrigger` — a custom ANCHOR slot (additive, optional).** The dropdown's
496
- default trigger is a bordered field box, which is wrong for a *menu* anchored to a compact chip
497
- (a locale pill, an avatar/user chip, an icon button). Callers can now supply
498
- `renderTrigger={({ label, isOpen }) => …}` and own the anchor's visuals entirely; the default box
499
- is then not rendered. The a11y wrapper stays with the dropdown — `role=button`, `aria-expanded`,
500
- the accessible label + hint, and the `testID` are still applied — so a custom trigger *cannot*
501
- drop the accessible contract, and the portalled, keyboard-navigable (↑/↓/Home/End/Enter/Escape),
502
- never-clipped menu comes along for free.
503
- - **`ModalDropdown`: `optionTestID` — custom per-option testIDs (additive, optional).** Options
504
- still default to `` `${testID}-option-${value}` ``; a caller turning an existing flat control into
505
- a dropdown can now keep its established selectors stable
506
- (`optionTestID={(code) => `lang-${code}`}`).
507
- - **Backward-compatible:** both props are optional and, when omitted, the render tree is unchanged —
508
- erevna / katalogos / kefi / agora are unaffected and need no markup changes.
509
-
510
- ## 1.7.1
511
-
512
- Fix: the modal-variant dismiss backdrop was a pressable WRAPPING the option buttons,
513
- producing invalid DOM on web ("<button> cannot contain a nested <button>") + a React
514
- console.error. The backdrop is now an absolute-fill SIBLING behind the dialog — same
515
- tap-to-dismiss behaviour, no nesting. No API change.
516
-
517
-
518
- ## 1.7.0
519
-
520
- - **`ModalDropdown` inline-menu (`variant={DropdownVariant.Menu}`) z-index / clipping fix.** On
521
- wide/desktop web the open inline menu painted UNDERNEATH later content (adjacent filter fields,
522
- the results table, cards) so options were hidden/clipped. Root cause: react-native-web renders
523
- **every `View`** with `position: relative; z-index: 0`, making each View its own stacking context —
524
- so the popover's `zIndex: 1000` was trapped inside its anchor / the app's field wrapper and could
525
- never rise above later-painting siblings.
526
- - **Fix:** on web the menu is now rendered in a **portal to `document.body`** with `position: fixed`
527
- at the trigger's measured viewport rect (recomputed on scroll/resize) and a high `zIndex`. A portal
528
- escapes every ancestor stacking context AND every ancestor `overflow: hidden`, so the menu always
529
- paints on top and is never clipped — the same "menu above the table" outcome as
530
- `@dloizides/ui-tables` `SizeDropdown`. The anchor wrapper is also lifted to a raised `zIndex` while
531
- open (defence-in-depth; the primary lift on native).
532
- - **Native-safe:** the portal + `document`/`window` listeners are all behind `Platform.OS === 'web'`;
533
- native keeps the in-tree `position:absolute` popover + `elevation`. `react-dom` is added as an
534
- **optional** peer (already present in every react-native-web consumer).
535
- - Outside-click dismissal now consults the portalled popover's own node too, so clicking an option
536
- still selects (a portalled option is no longer a DOM descendant of the anchor). Keyboard nav
537
- (↑/↓, Home/End, Enter, Escape), `role="menu"`/`menuitem`, `aria-expanded`/`aria-selected`, and the
538
- modal variant on narrow/native are all unchanged.
539
- - **Additive / backward-compatible:** the `ModalDropdown` API is unchanged; erevna / katalogos / kefi
540
- are unaffected.
541
-
542
- ## 1.6.0
543
-
544
- - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
545
- - `AccordionItem`: the rotating chevron (plain) and leading ▸ marker (boxed) are purely
546
- decorative — the open/closed state is already on the header via `aria-expanded` — so they are
547
- now `aria-hidden` / `accessibilityElementsHidden` to keep them out of the screen-reader tree.
548
- - `Accordion`: the expand/collapse `LayoutAnimation` and the chevron rotation now honour
549
- `prefers-reduced-motion: reduce`, snapping instantly for users who request reduced motion
550
- (WCAG 2.3.3, web only).
551
- - `ModalDropdown`: the trigger now also emits `accessibilityState.expanded` (native parity for
552
- the existing web `aria-expanded`).
553
-
554
- ## 1.5.0
555
-
556
- - `Accordion` / `AccordionItem` gain a `variant` prop (`'plain' | 'boxed'`, default `'plain'`).
557
- `plain` is the original borderless look (hairline dividers, right-hand chevron flipping 180° on
558
- open) — existing consumers render **identically**, no change. `boxed` is the AML v1 console
559
- `<details>` look: each item is its own bordered, rounded box (spaced by a gap) with a **leading
560
- ▸ marker** that rotates 90° on open and a muted, 600-weight summary. The full API is preserved
561
- (controlled/uncontrolled, `allowMultiple`, `defaultOpen`, a11y `aria-expanded`/region, the
562
- open/close LayoutAnimation + chevron rotation). Additive + backward-compatible.
563
-
564
- ## 1.4.0
565
-
566
- - Add **`SegmentedControl`** — a single rounded pill *track* holding N mutually-exclusive
567
- segments (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised
568
- surface (`colors.surface`) with a subtle shadow; the rest stay transparent over the soft
569
- track (`colors.background`). Promoted from the v1 AML console's `.lf-mode` mode switch so
570
- erevna/katalogos/kefi share ONE toggle instead of hand-rolling two primary/ghost buttons.
571
- - **Generic over the value union** (`SegmentedControl<'peps' | 'leaders'>`) for a typed
572
- `onChange`; each segment carries its own `label` / `value` / optional `testID` +
573
- `accessibilityLabel` / `accessibilityHint`.
574
- - **a11y**: the group renders as a `tablist`, each segment as a `tab` with
575
- `accessibilityState={{ selected }}` (react-native-web forwards `role` + `aria-selected`).
576
- - **Themed** entirely from the `@dloizides/ui-feedback` theme (surface / background / border /
577
- text colours); no colour literal except the selected-segment drop shadow.
578
- - **Additive / backward-compatible**: purely new exports (`SegmentedControl`,
579
- `SegmentedControlProps`, `SegmentedOption`). Existing consumers are unaffected.
580
-
581
- ## 1.3.0
582
-
583
- - Add **`Accordion`** + **`AccordionItem`** — a themed expand/collapse disclosure group that
584
- replaces per-app hand-rolled `<details>` / expanders (AML "More options" + expandable
585
- matched-candidate rows, Erevna survey groups, Katalogos menu sections…).
586
- - Compound API: an `Accordion` container owns the open state and shares it with `AccordionItem`
587
- children via context. Each item = a pressable header (title left, optional `right`
588
- adornment/badge slot, a rotating chevron) over a collapsible body `region`.
589
- - **Controlled** (`openIds` + `onOpenChange`) **and uncontrolled** (`defaultOpenIds`, plus
590
- per-item `defaultOpen`). `allowMultiple` (default `true`) vs single-open. Per-item `disabled`.
591
- - **a11y**: header is an accessible `button` (`accessibilityRole="button"`,
592
- `accessibilityState={{ expanded }}`, web `aria-expanded` + `aria-controls`); body is a
593
- `role="region"`. Renders as a native `<button>`, so **Enter / Space toggle** it.
594
- - **Themed** entirely from the `@dloizides/ui-feedback` theme (border / surface / text colours),
595
- no hardcoded palette; renders borderless so it nests inside a `Section` / `Card`.
596
- - **Animated** open/close via a guarded `LayoutAnimation` (web- and native-safe no-op fallback,
597
- never throws) + an `Animated` chevron rotation. Hook-safe (lazy `useState`, no ref reads in render).
598
- - **Additive / backward-compatible**: purely new exports (`Accordion`, `AccordionItem`,
599
- `AccordionProps`, `AccordionItemProps`). Existing consumers (erevna / katalogos / aml-v2) are
600
- unaffected.
601
-
602
- ## 1.2.0
603
-
604
- - `ModalDropdown` can now render as an **inline anchored menu** (native `<select>` feel), not only a
605
- modal. New `variant?: DropdownVariant` prop (`Menu` | `Modal`) selects the presentation per screen.
606
- - **Responsive default** (when `variant` is omitted): inline `Menu` on wide/desktop web
607
- (viewport ≥ 768px), `Modal` on narrow/mobile and on any native platform. An explicit `variant`
608
- overrides the auto choice.
609
- - The inline menu anchors under the trigger, is dismissible via click-outside / `Esc`, is
610
- keyboard-navigable (↑/↓, `Home`/`End`, `Enter`), scrolls when long, and does not push layout.
611
- The modal path is unchanged. Both variants share the same option-rendering/selection logic
612
- (`OptionRow`), so nothing is duplicated.
613
- - **Additive / backward-compatible**: existing `ModalDropdown` callers (erevna / katalogos / aml-v2)
614
- keep their exact API and now get the inline-on-desktop menu automatically. New export:
615
- `DropdownVariant` (a runtime enum — deliberately not `const enum`, which cannot cross a published
616
- package boundary under `isolatedModules`).
617
-
618
- ## 1.1.0
619
-
620
- - Add `ModalShell` — slide-up full-screen modal with a themed header (title + close) and scrollable body.
621
- Composes `Heading` (this package) + `SvgIcon` (`@dloizides/ui-icons`). This was the batch-1 deferred
622
- ModalShell, now landed (ui-icons + Heading both shared). Adds `@dloizides/ui-icons` + `react-native-svg`
623
- as peers.
624
-
625
- ## 1.0.0
626
-
627
- Initial release (Capability Wave C1, batch 5 — the ui-layout pivot after full settings-hub proved
628
- not cleanly extractable). Extracted the proven (erevna+katalogos identical) presentational primitives
629
- that the settings screens (and others) reuse: `Section`, `Heading`, `StatusBadge`, `UpgradePrompt`,
630
- `ModalDropdown` + `useFocusTrap`. Share the `@dloizides/ui-feedback` context (`useUi`). `Heading`
631
- unblocks the deferred ModalShell. `Breadcrumb` deferred (couples to the app's router + breadcrumb map).
1
+ # Changelog
2
+
3
+
4
+ ## 1.29.0
5
+
6
+ ### Added
7
+
8
+ - `Modal` `initialFocusTestID`: the testID of the control focused when the dialog opens (web), for
9
+ FOCUS-1 "Every screen names its initial focus". `useFocusTrap` takes it as an optional 3rd argument.
10
+
11
+ ### Fixed
12
+
13
+ - `useFocusTrap` no longer steals focus from a child that set `autoFocus`: the first-focusable
14
+ fallback runs only when focus is not already inside the dialog (kefi-web create-attendee modal
15
+ opened on its close button). Focus restore on close skips an element that lives inside the dialog.
16
+
17
+ ## 1.26.3
18
+
19
+ ### Fixed
20
+
21
+ - `ModalDropdown` / `InlineMenu`: a closed-but-still-fading popover was INTERACTIVE for the whole
22
+ 120ms exit animation — no `pointerEvents`, no `aria-hidden` — so a fast second click could select
23
+ an option from a menu the user had already dismissed, and screen readers still saw the options.
24
+ The popover now goes inert the instant `isOpen` goes false (`aria-hidden` on the menu node,
25
+ `pointerEvents: 'none'` on the animated wrapper, and the select handler refuses a closed menu).
26
+ The fade is unchanged. Covered by `ModalDropdown.openState.test.tsx` — the fade is held open
27
+ deliberately, since the reduced-motion test harness collapses it to 0ms.
28
+
29
+ ## 1.26.2
30
+
31
+ ### Fixed
32
+ - **`useAnchorTracking` no longer re-renders an open menu whose anchor has not moved.** `readAnchorRect`
33
+ returns a fresh object on every measurement, and the hook wrote it to state unconditionally, so
34
+ `Object.is` never matched and React re-rendered on every scheduled measurement. Because the hook's
35
+ own `ResizeObserver` watches `document.body` — which the menu is portalled into — the re-render
36
+ could re-arm the observer that caused it, giving a self-sustaining loop (`Maximum update depth
37
+ exceeded` under test). In a browser the menu's box never settled, which Playwright reports as
38
+ "element is not stable" and then "element was detached from the DOM"; it broke every click on a
39
+ `navbar-overflow-menu` option. The rect is now compared BY VALUE, so an unmoved anchor writes no
40
+ state. Pinned by `src/ModalDropdown/useAnchorTracking.stability.test.tsx`.
41
+
42
+ ## 1.26.1
43
+
44
+ ### Fixed
45
+
46
+ - **`ModalDropdown` (popover variant) — a CLOSING menu no longer swallows the next keystroke.**
47
+ `InlineMenu` hard-coded `enabled: true` for `useMenuKeyboard`, so its DOCUMENT-CAPTURE keydown
48
+ listener lived as long as the component was MOUNTED — and `ModalDropdown` deliberately keeps it
49
+ mounted past logical close so the exit fade can play. For that whole window the trigger already
50
+ reported `aria-expanded="false"` while a live handler `preventDefault()`ed and
51
+ `stopPropagation()`ed the user's Enter, so react-native-web's `<button>` never received the
52
+ browser-synthesised click and the menu could not be reopened from the keyboard.
53
+
54
+ The menu's keyboard now follows the owner's LOGICAL open state, threaded down as a new required
55
+ `isOpen` prop on `InlineMenu`, rather than its mount. MOUNTED IS NOT OPEN.
56
+
57
+ Note for anyone extending this: passing `menuAnim.mounted` as `isOpen` reproduces the same bug
58
+ one level up, and there is a test that fails if you do.
59
+
60
+
61
+ ## 1.26.0
62
+
63
+ **New `BuildInfoFooter` — a small, themable "which build am I running?" caption for the portals.**
64
+
65
+ The FE half of the "know what's deployed" work: every RN-web portal can now show a compact,
66
+ unobtrusive footer like `v<buildVersion>` (optionally `· api <sha7>`). `@dloizides/pwa-sw` already
67
+ stamps a per-build `BUILD_VERSION` into the generated service worker, but that value lives only
68
+ inside `service-worker.js` and is not exposed to page runtime — so the component stays dumb and
69
+ takes the build id as a prop (each app inlines it at build time, e.g. `EXPO_PUBLIC_BUILD_VERSION`).
70
+
71
+ - **`BuildInfoFooter`** — props `buildVersion` (required), optional `apiBaseUrl` (best-effort GET
72
+ `${base}/version` → `.commit`, appended as `· api <sha7>`; any failure silently shows the version
73
+ alone), optional `apiCommit` (skip the fetch), `fetchImpl` (test seam), plus the usual `testID` /
74
+ `accessibilityLabel` / `accessibilityHint` / `style`. Muted caption via the theme's
75
+ `textSecondary` — no raw colours.
76
+ - New exports: `formatBuildInfo`, `shortenCommit`, `trimTrailingSlash`, `useApiCommit`,
77
+ `BUILD_INFO_PREFIX`, `API_COMMIT_SEPARATOR`, `VersionResponse`.
78
+ - New kit i18n key `LAYOUT_I18N.buildInfoHint` (`common.buildInfoHint`) and testID
79
+ `LAYOUT_TEST_IDS.buildInfoFooter` (`build-info-footer`).
80
+
81
+ ## 1.24.0
82
+
83
+ **The inline dropdown popover now stays inside the viewport — a floored menu can no longer spill off the right edge.**
84
+
85
+ `buildPortalPopoverStyle` positioned the fixed popover at `left: rect.left` with no horizontal
86
+ clamp. That was fine while the menu matched its trigger's width, but a COMPACT trigger with a
87
+ `menuMinWidth` floor (e.g. the `@dloizides/ui-nav` "More ▾" overflow menu, whose trigger sits near
88
+ the right of the bar) opens a menu WIDER than its trigger — which then extended past the right edge
89
+ of the viewport and clipped its lower/right content ("some items get hidden").
90
+
91
+ - **`buildPortalPopoverStyle(rect, minWidth, viewportWidth?)`** takes an optional `viewportWidth`.
92
+ When given, the popover's `left` is clamped so its right edge clears `MENU_VIEWPORT_MARGIN` (8px) —
93
+ sliding it left, right-aligning it to the trigger in the limit — while never crossing the left
94
+ margin. `viewportWidth = 0` (the default, and the native/pure path) keeps the exact prior
95
+ trigger-anchored behaviour, so every existing caller is unchanged.
96
+ - **`InlineMenu`** passes `window.innerWidth` on web (re-read whenever the tracked trigger rect
97
+ re-measures on scroll/resize); native is untouched.
98
+ - New export `MENU_VIEWPORT_MARGIN`.
99
+
100
+ ## 1.23.0
101
+
102
+ **Modals, the dropdown popover and the accordion body now ANIMATE on web — adopts `@dloizides/ui-motion`.**
103
+
104
+ On react-native-web, RN's `Modal animationType` and `LayoutAnimation` are effectively no-ops, so
105
+ `Modal`, `ModalShell`, the `ModalDropdown` popover and the `Accordion` body all SNAPPED open/closed
106
+ on the web build (all 7 portals). This wires those surfaces to `@dloizides/ui-motion`, which drives
107
+ enter/exit with RN `Animated` (works on web AND native) and collapses every animation to instant
108
+ under the OS "reduce motion" preference. **No public APIs changed** — every prop, testID and a11y
109
+ attribute is identical; this is a purely visual upgrade.
110
+
111
+ - **`Modal`** — the backdrop now **fades** (opacity) and the panel **fades + scales in** (0.96→1) on
112
+ open, reversing on close, via `useEnterExit`. The RN `Modal` host is kept **mounted through the
113
+ exit** (driven by `useEnterExit`'s `mounted` flag, not `visible`) so the close animation can play
114
+ instead of the host unmounting instantly — the trick that made `animationType` a no-op on web. The
115
+ scrim moved to its own animated layer behind the tap-catcher; close-on-backdrop, Escape, focus
116
+ trap, scroll-lock and every testID are unchanged.
117
+ - **`ModalShell`** — the full-screen sheet **fades + scales in** on open (replacing the native-only
118
+ `animationType="slide"`), mounted through the exit the same way.
119
+ - **`ModalDropdown`** — the popover (the inline anchored menu on web-desktop, the centered modal on
120
+ mobile/native) **fades + scales in** from the anchor on open (`transformOrigin: top`), with a snappy
121
+ ~120ms curve so the close reads as near-instant. `useAnchorTracking`, the web portal, keyboard nav
122
+ and outside-click detection are untouched (the fade/scale rides an INNER wrapper so the popover's
123
+ own DOM node — which the outside-click/portal logic depends on — is unchanged).
124
+ - **`Accordion`** — the item body now renders inside ui-motion's **`<Collapse>`** (measured, animated
125
+ height) instead of RN `LayoutAnimation`, so the body animates on web too. The chevron rotation is
126
+ unchanged. Behaviour note: `<Collapse>` keeps the body **mounted at all times** (clipped to height 0
127
+ when closed) so `aria-controls` always resolves and screen readers reach the content — the open
128
+ state is conveyed by the header's `aria-expanded` (the value handed to `<Collapse open>`). The
129
+ internal `accordionAnimation.ts` (`LayoutAnimation` helper) was removed.
130
+ - **New dependency `@dloizides/ui-motion` (`^1.0.1`)** — the shared RN/RN-web motion kit
131
+ (`useEnterExit`, `Collapse`, reduced-motion-aware).
132
+
133
+ Additive and back-compatible for consumers. Covered by the existing `Modal`, `ModalShell`,
134
+ `ModalDropdown` (web + native) and `Accordion` suites; the accordion tests now assert open state via
135
+ `aria-expanded`/the `Collapse` container rather than body-text presence (the body is always mounted).
136
+ The Jest env is pinned to reduced-motion so enter/exit resolve synchronously in tests.
137
+
138
+ ## 1.22.0
139
+
140
+ **Two shared modal primitives: a themed centered `Modal` dialog and a `ConfirmDialog` popup.**
141
+
142
+ Until now the kit had no shared centered dialog — only `ModalShell` (a full-screen slide-up sheet)
143
+ and `ModalDropdown` (a selector). Each portal hand-rolled its own edit dialog (e.g. kefi-web's
144
+ `PromoterActionModal`) and confirmed destructive actions with an ugly inline table row. These two
145
+ primitives replace both, so all 7 portals share one accessible, themed implementation.
146
+
147
+ - **New component `Modal`** — a centered dialog overlay for RN + RN-web: a scrim, a rounded themed
148
+ surface, an optional header (`title` + a top-right **✕ close** — a 44dp `IconButton` with a web
149
+ `tooltip`/aria-label "Close"), a scrollable body (`children`), and an optional `footer`. Dismissal
150
+ funnels to `onClose` from four routes: the ✕, a **backdrop** press, **Escape** on web
151
+ (`useEscapeKey`), and the hardware back button on native (RN `Modal`'s `onRequestClose`). It is
152
+ `role="dialog"` + `aria-modal` (`accessibilityViewIsModal`), **focus-trapped** on web
153
+ (`useFocusTrap`, restoring focus to the opener on close) and **scroll-locked** (`useScrollLock`).
154
+ Props: `visible`, `onClose`, `title?`, `children?`, `footer?`, `size?` (`sm`/`md`/`lg`, default
155
+ `md`), `showClose?` (default `true`), `testID?` (default `modal`), `accessibilityLabel?`. testIDs:
156
+ `${testID}-close`, `${testID}-backdrop`. All colours read from `useUi()` — no raw literals.
157
+ - **New component `ConfirmDialog`** — built ON `Modal`, for confirmations. Renders the `message`
158
+ plus a Cancel + Confirm button row (from `@dloizides/ui-buttons`). `destructive` paints the
159
+ Confirm with the `danger` (red) variant for irreversible actions. **Cancel is first in the DOM so
160
+ the focus trap lands on the SAFE action**; the ✕ is hidden (Cancel is the explicit dismiss). While
161
+ `busy`, Confirm shows a spinner and Cancel is disabled. Cancel / backdrop / Escape → `onCancel`.
162
+ Props: `visible`, `title`, `message`, `confirmLabel?`, `cancelLabel?`, `destructive?`, `onConfirm`,
163
+ `onCancel`, `busy?`, `testID?` (default `confirm-dialog`). testIDs: `${testID}-confirm`,
164
+ `${testID}-cancel`, `${testID}-message`.
165
+ - **New exported type `ModalSize`** (`'sm' | 'md' | 'lg'`) — a plain string union (matching the
166
+ kit's `ButtonSize` convention; no `const enum` crosses the package boundary).
167
+ - **New i18n keys** the host must provide: `common.close` (✕ label), plus for `ConfirmDialog`
168
+ defaults `common.confirm` / `common.confirmHint` / `common.cancel` / `common.cancelHint`. Reuses the
169
+ existing `common.closeDialogHint`, `common.dialog`, `common.dismissDropdown(Hint)` keys.
170
+ - **New peer dependency `@dloizides/ui-buttons` (`>=1.8.0`)** — `ConfirmDialog` reuses its `Button`,
171
+ `Modal` reuses its `IconButton` for the ✕, rather than reinventing button chrome.
172
+
173
+ Additive: `ModalShell`, `ModalDropdown` and every existing export/selector are untouched. Covered by
174
+ `Modal.test.tsx`, `ConfirmDialog.test.tsx`, `useEscapeKey.test.ts`, `useScrollLock.test.ts`.
175
+
176
+ > Note: `@dloizides/ui-feedback` also exports a lighter `ConfirmDialog` (no ✕ / Escape / focus-trap,
177
+ > own buttons). This ui-layout one is the richer, `Modal`-based dialog the portals should adopt.
178
+
179
+ ## 1.21.0
180
+
181
+ **The collapsed `Tabs` menu can now present as a HAMBURGER (☰) — the universal mobile-nav affordance.**
182
+
183
+ The collapsed organizer nav reads better on a phone as a ☰ hamburger than as a caret field.
184
+ This adds an opt-in so a consumer can choose either presentation; the default is unchanged.
185
+
186
+ - **New opt-in prop `ModalDropdown.showHamburger?: boolean` (default `false`).** When set, the
187
+ DEFAULT trigger renders a ☰ glyph LEADING the active option's label, with the same bordered
188
+ field box, theme tokens and ≥44dp (`MIN_TOUCH_TARGET`) hit target as the caret variant. It
189
+ **takes precedence over `showCaret`** (a hamburger already IS the "this is a menu" cue, so the
190
+ trailing caret would be redundant) and, like `showCaret`, is ignored when a custom `renderTrigger`
191
+ is supplied. The glyph is a font character (U+2630) — no icon package enters this contract-pure
192
+ kit — and its colour comes from `colors.textSecondary` (no raw literals). It is decorative: the
193
+ trigger's `aria-label` still names the control, so screen readers do not announce the glyph.
194
+ - **New exported enum `TabsCollapsedTrigger { Caret, Hamburger }`** + new optional prop
195
+ **`Tabs.collapsedTrigger` / `TabsMenu.collapsedTrigger` (default `Caret`).** Selects how the
196
+ COLLAPSED (mobile) tab menu trigger presents; only affects the collapsed form, the wide pill
197
+ strip is identical either way. Exported as a regular (runtime) enum for the same reason as
198
+ `DropdownVariant` — a `const enum` cannot cross the published-package boundary under
199
+ `isolatedModules`.
200
+
201
+ Backward-compatible: two new optional props + one new enum, all defaulting to the prior behaviour;
202
+ no testID/selector changes. Per-tab E2E selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}`
203
+ / descriptor option testIDs) are untouched. No new i18n keys (the existing `common.tabsMenuHint`
204
+ serves both presentations). Covered by component tests (`ModalDropdown.test.tsx`,
205
+ `Tabs.collapsed.test.tsx`).
206
+
207
+ ## 1.20.0
208
+
209
+ **The collapsed `Tabs` menu now READS as a menu — a caret affordance + guaranteed focus.**
210
+
211
+ On the live phone-width organizer nav (`app.kefi.dloizides.com/organizer/passes`) the
212
+ collapsed trigger showed only the active label ("Passes") with no menu cue — styled like a
213
+ static chip/pill — so users could not tell it was a section switcher. This adds a clear
214
+ menu affordance and locks in keyboard focusability.
215
+
216
+ - **New opt-in prop `ModalDropdown.showCaret?: boolean` (default `false`).** When set, the
217
+ DEFAULT trigger renders a ▾ caret pinned to its trailing edge that rotates to point up
218
+ while the menu is open, with a ≥44dp (`MIN_TOUCH_TARGET`) hit target and the existing
219
+ bordered field box + theme tokens. **Every existing field-style dropdown in the kit is
220
+ unchanged** because the caret is off by default, and it is ignored when a custom
221
+ `renderTrigger` is supplied (that caller owns its own visuals). The caret is a font glyph
222
+ (U+25BE), so no icon package enters this contract-pure kit, and its colour comes from
223
+ `colors.textSecondary` (no raw literals). It is decorative — the trigger's `aria-label`
224
+ still names the control, so screen readers do not announce the glyph.
225
+ - **`TabsMenu` opts into `showCaret`**, so the collapsed `Tabs` section switcher now looks
226
+ like a proper control instead of a chip. No change to the public `Tabs` / `TabsMenu` API.
227
+ - **Focusability:** under react-native-web the trigger renders as a native `<button>`
228
+ (role=button, no `tabindex="-1"`), so it is keyboard-reachable and Enter/Space activate
229
+ it. A regression test asserts the collapsed trigger is not `tabindex="-1"`. (The
230
+ `tabindex="-1"` seen on the live DOM came from the older deployed version; it does not
231
+ reproduce on this source — proven by the rendered-DOM assertion, not assumed.)
232
+
233
+ Backward-compatible: one new optional prop, no testID/selector changes. Per-tab E2E
234
+ selectors (`{idPrefix}-menu` trigger, `{idPrefix}-tab-{key}` / descriptor option testIDs)
235
+ are untouched. No new i18n keys.
236
+
237
+ `ui-showcase` does not yet import `Tabs`/`ModalDropdown` (only `SegmentedControl`,
238
+ `CopyableId`, `TruncatedText`), so this is covered by component tests
239
+ (`ModalDropdown.test.tsx`, `Tabs.collapsed.test.tsx`); a showcase specimen is a follow-up.
240
+
241
+ ## 1.19.0
242
+
243
+ **`Tabs` collapses to a real mobile menu below a breakpoint.**
244
+
245
+ On a phone the horizontal pill strip "is not a real menu and not mobile friendly" — a
246
+ scrolling chip row is hard to use with 7–8 tabs (the kefi organizer dashboard:
247
+ Overview / Passes / Attendees / Promoters / Door / Ledger / Messaging / Settings). `Tabs`
248
+ now renders responsively:
249
+
250
+ - **Wide (>= `collapseBelow`, default 768, web only):** the existing horizontal
251
+ `role=tablist` / `role=tab` strip — unchanged, fully backward-compatible.
252
+ - **Narrow (< breakpoint) or native:** a genuine menu — a trigger button showing the
253
+ active section that opens a vertical list of all sections. Delegates to the kit's
254
+ existing `ModalDropdown` (menu/listbox semantics, focus trap, dismiss backdrop, dual-
255
+ platform a11y) rather than reimplementing a dropdown.
256
+
257
+ Backward-compatible: the public API is unchanged except one new optional prop,
258
+ `collapseBelow?: number` (default = the shared kit breakpoint, 768; pass `0` to keep the
259
+ row on any web width, or a large number to force the menu). The collapse threshold reuses
260
+ the SAME viewport rule (`MENU_BREAKPOINT`) that `ModalDropdown` uses for its menu-vs-modal
261
+ split, so the whole layout kit changes shape at one consistent breakpoint.
262
+
263
+ **E2E survival:** per-tab selectors keep working in BOTH modes. Each collapsed menu row's
264
+ `testID` is the tab descriptor's own `testID` when supplied, otherwise the same
265
+ `{idPrefix}-tab-{key}` pattern the wide strip uses for its tab element ids (the menu must
266
+ be opened first, as with any select). Requires one new host i18n key,
267
+ `common.tabsMenuHint` (the accessible hint on the collapsed trigger).
268
+
269
+ ## 1.17.0
270
+
271
+ **New `Tabs` primitive — a controlled tabbed section shell.**
272
+
273
+ Adds `Tabs`: a wrapping/scrolling pill tab strip plus the active tab's panel, wired
274
+ as a proper `tablist` / `tab` / `tabpanel` (aria-selected, aria-controls,
275
+ aria-labelledby). Controlled (`activeKey` + `onChange`), so the selected tab can be
276
+ driven from a route param or storage. Labels are pre-localized strings; colours read
277
+ from the `@dloizides/ui-feedback` theme (no FM/router/store imports), consistent with
278
+ the rest of the kit.
279
+
280
+ Extracted so the seven portals share ONE tab shell instead of hand-rolling a bar per
281
+ app — first consumer is the kefi-web organizer dashboard, split from one enormous page
282
+ into menu tabs.
283
+
284
+ ## 1.16.1
285
+
286
+ **`Heading` supports levels 1-6 instead of `<h1>` only.**
287
+
288
+ `Heading` rendered `<h1>` unconditionally, so any screen needing sub-structure either
289
+ shipped multiple `<h1>`s or avoided the component. The Digital Kin guide editor did the
290
+ latter — styled `<Text>` instead — and shipped **zero headings**: measured on the live
291
+ CMS, `document.querySelectorAll('h1,h2,h3,h4,h5,h6').length === 0` for the entire page.
292
+
293
+ So there was no `<h1>` naming the guide being edited and nothing marking the steps
294
+ section. Screen-reader users could not navigate by heading, and styling was standing in
295
+ for structure.
296
+
297
+ After: `h1` names the guide, `h2` marks the steps section, `h3` per step.
298
+
299
+
300
+ ## 1.15.1
301
+
302
+ - **Fix (`CopyableId` truncated the value with room to spare).** 1.15.0 gave the value wrapper
303
+ `flexShrink: 1`, which makes it SHRINK-WRAP its content — so the width the component measures to
304
+ decide how much to show was derived from the very string it was computing: truncate → wrapper
305
+ narrows → re-measure smaller → truncate harder. Verified in Chrome via `apps/ui-showcase`: a
306
+ 506px-wide container and a 306px one rendered the SAME 196px string, i.e. a 36-character GUID was
307
+ cut to 26 characters with ~300px going unused.
308
+
309
+ The wrapper is now `flex: 1`, so it fills the row's leftover width and its size is independent of
310
+ its content. Re-verified at four widths: 520px and 320px now render the full 36-character GUID
311
+ untruncated; 200px and 120px middle-truncate with both ends intact, and nothing overflows.
312
+
313
+ This is the SAME failure mode `useAvailableWidth` documents for `TruncatedText` (measure the
314
+ parent, never the element, or the output feeds back into the input) — reintroduced one level up
315
+ by the new wrapper. Unit tests cannot catch it: the truncation helpers are pure and passed
316
+ throughout, and jsdom reports zero widths, so only a real browser shows it.
317
+
318
+ - **New: `CopyableId` accepts `style`** for its outer container. Hosts need this to give the
319
+ control a width that does not derive from its own content (a `flexBasis`, a `width`, or
320
+ `flex: 1`) — without one, a shrink-to-fit parent reintroduces the feedback loop above at the
321
+ host level. Documented on the prop.
322
+
323
+ ## 1.15.0
324
+
325
+ - **New: `CopyableId`** — show a long machine identifier (a GUID, a reference, a correlation id)
326
+ so a human can both READ enough of it to tell two apart and TAKE it in one action. Composes the
327
+ existing `TruncatedText`, so the middle-truncation work is reused rather than re-derived.
328
+
329
+ Driven by the AML console needing to surface a screening ID an analyst can copy and re-screen
330
+ with, but it is deliberately domain-free: every portal has identifiers it currently either hides
331
+ or dumps raw into a table cell.
332
+
333
+ Three things this gets right that a naive copy button does not:
334
+
335
+ 1. **It copies the FULL value, never the display string.** A truncated GUID that a user
336
+ hand-selects yields `3f2a9c81…d4e7`, ellipsis and all, which silently fails wherever it is
337
+ pasted. Showing a truncated identifier with no copy affordance is strictly WORSE than not
338
+ showing it. The full value is always the accessible name and the web tooltip.
339
+ 2. **Middle truncation, not tail.** Two GUIDs from one table share a prefix far more often than
340
+ intuition suggests, and `numberOfLines={1}` renders them IDENTICALLY. The tail is what tells
341
+ them apart, so both ends survive.
342
+ 3. **A failed copy is SHOWN, not swallowed.** `navigator.clipboard` is not merely unreliable —
343
+ it is `undefined` outside a secure context, which is how every staging box and LAN preview in
344
+ this fleet is served, i.e. exactly where people hand-test. `copyText` therefore falls back to
345
+ `document.execCommand` over an off-screen textarea, and returns a boolean rather than
346
+ assuming. On total failure the control renders a distinct `common.copyFailed` state; a silent
347
+ failure would leave the user believing they hold an identifier they do not.
348
+
349
+ The status is carried in the control's accessible **NAME**, not its hint, because
350
+ `accessibilityHint` is dropped by react-native-web and never reaches the DOM — a screen-reader
351
+ user would otherwise get no confirmation at all.
352
+
353
+ No native clipboard dependency is taken. Hosts on React Native inject a `writer`
354
+ (`Clipboard.setString`); an injected writer that throws falls through to the DOM paths.
355
+
356
+ New `LAYOUT_I18N` keys — hosts binding a missing-key guard to that map (as aml-v2 does) will
357
+ fail their catalog test until these are defined: `common.copy`, `common.copyHint`,
358
+ `common.copied`, `common.copyFailed`, `common.copyableIdHint`.
359
+
360
+ ## 1.12.2
361
+
362
+ - **Fix (`TruncatedText` STILL did not middle-truncate; 1.12.1's fix was the wrong mechanism).**
363
+ 1.12.1 moved the `onLayout` measurement from the `<Text>` to a wrapping `<View>`. Verified in
364
+ Chrome: that did not fire either, and neither did a `ResizeObserver` on the same node — zero
365
+ callbacks from all three mechanisms under react-native-web 0.21.
366
+
367
+ Width now comes from `useAvailableWidth`, which on web reads the **parent's** inner width
368
+ straight off the DOM in a ref callback, plus a `resize` listener. The parent is measured
369
+ rather than the element because the element shrink-wraps its own text, so measuring it would
370
+ feed the output back into the input and oscillate. Native keeps `onLayout`, where it works.
371
+
372
+ Confirmed in Chrome at four container widths — the same URL renders as
373
+ `timesofindia.indiatimes.com/cit…ties/articleshow/114237788.cms` (520px) down to
374
+ `timeso…88.cms` (120px), with no element exceeding its container at either a 1400px or a
375
+ 420px viewport.
376
+
377
+ Note for anyone extending this: unit tests cannot catch this class of bug here. The
378
+ truncation helpers are pure and passed throughout all three versions; what was broken was
379
+ whether the measurement ever ran in a real browser.
380
+
381
+ ## 1.12.1
382
+
383
+ - **Fix (`TruncatedText` did not actually middle-truncate).** 1.12.0 measured its available
384
+ width with `onLayout` **on the `<Text>` itself, which never fires under RN-web**. The width
385
+ stayed 0, the character budget stayed 0, and the component silently fell back to rendering
386
+ the full string — i.e. to exactly the tail-only CSS ellipsis it exists to replace. It
387
+ compiled, typechecked and passed all its unit tests throughout, because the truncation
388
+ helpers are pure and were never the broken part; only a browser could see it. Measured in
389
+ Chrome at a 120px container: text rendered `timesofindia.indiatimes.com/city/delhi/delhi-…`
390
+ with **no `…` character present** — CSS clipping, not middle truncation.
391
+
392
+ The width is now measured on a wrapping `<View>`, which does fire `onLayout`. The overflow
393
+ guarantee was never affected (the element stayed inside its parent in both versions); what
394
+ was lost was the informative half of the behaviour.
395
+
396
+ ## 1.12.0
397
+
398
+ - **New: `TruncatedText`** — a single-line text/link that middle-truncates to fit its container
399
+ and cannot overflow at any width. Promoted out of the AML console, where a full adverse-media
400
+ article URL rendered as raw `<Text>` and blew out its table row.
401
+
402
+ Three things that look like they would solve this and do not, all verified against
403
+ react-native-web 0.21 rather than assumed:
404
+
405
+ 1. `numberOfLines={1}` alone truncates at the **tail** (RN-web compiles it to
406
+ `text-overflow: ellipsis`). Every URL from one publisher then collapses to the same
407
+ `timesofindia.indiatimes.com/city/de…` prefix and the reader cannot tell the articles
408
+ apart. There is no CSS for middle truncation, so it is computed in JS.
409
+ 2. `title={full}` is **silently dropped** — RN-web's `<Text>` forwards only `href`, `lang`
410
+ and `pointerEvents` beyond the shared whitelist. The tooltip is set on the host node
411
+ through a ref instead.
412
+ 3. JS truncation alone can mis-estimate an unusual glyph mix, so `numberOfLines={1}` is ALSO
413
+ applied as a hard backstop. Overflow is impossible by construction, not by tuning.
414
+
415
+ The full value always stays reachable — as the accessible name and, on web, the native
416
+ tooltip. Also exported: the pure `truncateMiddle` / `formatUrlForDisplay` helpers and
417
+ `ELLIPSIS`.
418
+
419
+ ## 1.11.0
420
+
421
+ - **Fix (HIGH — 1.10.0's out-of-view close never fired in the real runtime).** 1.10.0 added
422
+ "close the menu once the trigger leaves the viewport". Repositioning worked, but the close was
423
+ measured **against the viewport**, and **RN-web apps never scroll the document** — every screen
424
+ renders inside a `ScrollView`, so scrolling happens in an inner `<div>` and `window.scrollY`
425
+ stays 0 forever. A trigger scrolled out of that inner scroller is invisible to the user while its
426
+ rect sits comfortably inside the viewport, so the check could not fire on any screen of any
427
+ portal. Measured in Chrome: trigger at `top: -37` (fully above the scroller), menu still rendered.
428
+ Visibility is now measured against the **clip window** — the viewport intersected with every
429
+ clipping ancestor — which is what makes it work inside an inner scroll container.
430
+ - **Fix: "entirely out of view" was also the wrong threshold.** When a scroll container reaches the
431
+ end of its range the trigger stops with a few pixels still showing (4px in the reported case), so
432
+ "fully out" was *unreachable* and the menu never closed however far the user scrolled. There is
433
+ now a minimum-visible-pixel floor (`MIN_VISIBLE_PX`).
434
+ - **Guard: the menu never closes on its FIRST measurement**, so opening a dropdown whose trigger is
435
+ already partly clipped still works; only movement after opening can close it.
436
+ - **The zero-area "not laid out yet" guard is unchanged in intent but now provably size-only** — it
437
+ asks about the element's own box, never its position, so it cannot swallow a genuine hidden case.
438
+ - **New: `LAYOUT_I18N`** — the manifest of every translation key this package resolves, mirroring
439
+ `TABLE_I18N` / `FILTERS_I18N` from `@dloizides/ui-tables` so hosts can bind an existing
440
+ missing-key guard to it with no new pattern. The kit is fallback-free, so a key a host forgets
441
+ reaches users as a raw dotted name; hand-maintained key lists rot (one portal was found missing
442
+ 26 kit keys, another had `common.accordionToggleHint` undefined while `Accordion` was mounted).
443
+ Every `t(...)` call in the package now references the map, and the suite fails on a raw key
444
+ literal or a stale entry — so the manifest cannot drift from the code.
445
+ - **Fix: the 1.10.0 CHANGELOG entry was written in cp1252**, leaving the published file invalid
446
+ UTF-8. Re-encoded.
447
+ - **No breaking change.** `LAYOUT_I18N` is additive and the key strings are unchanged, so existing
448
+ translation files keep working untouched.
449
+
450
+ ## 1.10.0
451
+
452
+ Two defects found by browser visual QA of the inline dropdown menu against a live app.
453
+
454
+ - **Fix (HIGH, affects every consumer): the open inline menu detached from its trigger.** On web the
455
+ menu is portalled to `document.body` with `position: fixed` at the trigger's measured rect.
456
+ `fixed` is viewport-relative, so that coordinate is only valid until something moves the trigger.
457
+ A `scroll`/`resize` listener on `window` was already in place (since 1.7.0) and does handle plain
458
+ scrolling — but it left three real gaps:
459
+ - **Layout changes that fire no scroll event at all** — an accordion above the trigger expanding,
460
+ a sticky header resizing, a banner appearing, an async list rendering. The trigger moved, nothing
461
+ scrolled, no listener fired, and the menu stayed behind. Now covered by a `ResizeObserver` on the
462
+ anchor and on `document.body`.
463
+ - **The trigger leaving the viewport.** Repositioning cannot help here — the menu just follows its
464
+ trigger off-screen and hangs over unrelated content with nothing on screen explaining it. The
465
+ menu now **closes** once the trigger is fully out of view.
466
+ - **Layout thrash.** The handler ran a synchronous `getBoundingClientRect()` (a forced reflow) plus
467
+ a React state update on *every* scroll event. Work is now coalesced into one
468
+ `requestAnimationFrame` per frame.
469
+ Scroll is now observed in the **capture** phase on `document` rather than `window`, so a scroll in
470
+ any ancestor scroll container counts. Tracking moved into a dedicated `useAnchorTracking` hook.
471
+ Native is unaffected (the popover is in-tree and moves with its anchor).
472
+ - **Fix (a11y): `accessibilityHint` never reached a screen reader.** The prop is part of the public
473
+ API and every caller passes one, but react-native-web does not map it — the trigger carried
474
+ `aria-label` and `aria-expanded` and **no hint of any kind**, so the text was silently thrown away
475
+ (older react-native-web versions additionally leaked it to the DOM, logging
476
+ `React does not recognize the accessibilityHint prop on a DOM element`). On web the hint is now
477
+ rendered into a visually-hidden node referenced by `aria-describedby` — the same wiring
478
+ `@dloizides/ui-forms`' `Field` uses for its error line — and the RN-only prop is no longer passed
479
+ on web at all. Native still receives `accessibilityHint` unchanged.
480
+ - **No API change.** Both fixes are internal; every existing caller benefits without edits.
481
+
482
+ ## 1.9.1
483
+
484
+ - **Fix (keyboard a11y, affects every consumer): Enter CLOSED the inline menu instead of SELECTING
485
+ the highlighted option.** The trigger keeps DOM focus while the menu is open, and react-native-web
486
+ maps Enter on a focused Touchable to `onPress`. React dispatches that from its ROOT container
487
+ listener — an ancestor of the trigger, but a *descendant* of `document` — so the menu's BUBBLING
488
+ `document` keydown listener ran second: the trigger toggled the menu shut, React unmounted the
489
+ popover, the effect cleanup removed the very listener the event was still travelling toward, and
490
+ `document` never saw the Enter. Keyboard users could open a dropdown and arrow through it but
491
+ could never CHOOSE with the keyboard (mouse selection was unaffected, which is why it went
492
+ unnoticed).
493
+ - **Fix:** the menu's key handler now runs in the **capture** phase and `stopPropagation`s the keys
494
+ an open menu owns (↑/↓/Home/End/Enter/Escape), so it runs ahead of React's listener and the
495
+ trigger cannot re-toggle behind it. Found while browser-verifying the AML v2 topbar dropdowns.
496
+
497
+ ## 1.9.0
498
+
499
+ - **`ModalDropdown`: `menuMinWidth` — a width FLOOR for the open inline menu (additive, optional).**
500
+ The menu matches the TRIGGER's width, which is right for a full-width field but leaves a compact
501
+ anchor (the 1.8.0 `renderTrigger` case: a locale pill, an avatar chip, an icon button) with a menu
502
+ too narrow to read its own option labels — a 52px "EN ▾" pill produced a 52px menu whose rows were
503
+ clipped to a dark strip. `menuMinWidth` floors it; a wider trigger still wins.
504
+ - **Backward-compatible:** omitted, the width is the trigger's, exactly as before.
505
+
506
+ ## 1.8.0
507
+
508
+ - **`ModalDropdown`: `renderTrigger` — a custom ANCHOR slot (additive, optional).** The dropdown's
509
+ default trigger is a bordered field box, which is wrong for a *menu* anchored to a compact chip
510
+ (a locale pill, an avatar/user chip, an icon button). Callers can now supply
511
+ `renderTrigger={({ label, isOpen }) => …}` and own the anchor's visuals entirely; the default box
512
+ is then not rendered. The a11y wrapper stays with the dropdown — `role=button`, `aria-expanded`,
513
+ the accessible label + hint, and the `testID` are still applied — so a custom trigger *cannot*
514
+ drop the accessible contract, and the portalled, keyboard-navigable (↑/↓/Home/End/Enter/Escape),
515
+ never-clipped menu comes along for free.
516
+ - **`ModalDropdown`: `optionTestID` — custom per-option testIDs (additive, optional).** Options
517
+ still default to `` `${testID}-option-${value}` ``; a caller turning an existing flat control into
518
+ a dropdown can now keep its established selectors stable
519
+ (`optionTestID={(code) => `lang-${code}`}`).
520
+ - **Backward-compatible:** both props are optional and, when omitted, the render tree is unchanged —
521
+ erevna / katalogos / kefi / agora are unaffected and need no markup changes.
522
+
523
+ ## 1.7.1
524
+
525
+ Fix: the modal-variant dismiss backdrop was a pressable WRAPPING the option buttons,
526
+ producing invalid DOM on web ("<button> cannot contain a nested <button>") + a React
527
+ console.error. The backdrop is now an absolute-fill SIBLING behind the dialog — same
528
+ tap-to-dismiss behaviour, no nesting. No API change.
529
+
530
+
531
+ ## 1.7.0
532
+
533
+ - **`ModalDropdown` inline-menu (`variant={DropdownVariant.Menu}`) z-index / clipping fix.** On
534
+ wide/desktop web the open inline menu painted UNDERNEATH later content (adjacent filter fields,
535
+ the results table, cards) so options were hidden/clipped. Root cause: react-native-web renders
536
+ **every `View`** with `position: relative; z-index: 0`, making each View its own stacking context —
537
+ so the popover's `zIndex: 1000` was trapped inside its anchor / the app's field wrapper and could
538
+ never rise above later-painting siblings.
539
+ - **Fix:** on web the menu is now rendered in a **portal to `document.body`** with `position: fixed`
540
+ at the trigger's measured viewport rect (recomputed on scroll/resize) and a high `zIndex`. A portal
541
+ escapes every ancestor stacking context AND every ancestor `overflow: hidden`, so the menu always
542
+ paints on top and is never clipped — the same "menu above the table" outcome as
543
+ `@dloizides/ui-tables` `SizeDropdown`. The anchor wrapper is also lifted to a raised `zIndex` while
544
+ open (defence-in-depth; the primary lift on native).
545
+ - **Native-safe:** the portal + `document`/`window` listeners are all behind `Platform.OS === 'web'`;
546
+ native keeps the in-tree `position:absolute` popover + `elevation`. `react-dom` is added as an
547
+ **optional** peer (already present in every react-native-web consumer).
548
+ - Outside-click dismissal now consults the portalled popover's own node too, so clicking an option
549
+ still selects (a portalled option is no longer a DOM descendant of the anchor). Keyboard nav
550
+ (↑/↓, Home/End, Enter, Escape), `role="menu"`/`menuitem`, `aria-expanded`/`aria-selected`, and the
551
+ modal variant on narrow/native are all unchanged.
552
+ - **Additive / backward-compatible:** the `ModalDropdown` API is unchanged; erevna / katalogos / kefi
553
+ are unaffected.
554
+
555
+ ## 1.6.0
556
+
557
+ - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
558
+ - `AccordionItem`: the rotating chevron (plain) and leading ▸ marker (boxed) are purely
559
+ decorative — the open/closed state is already on the header via `aria-expanded` — so they are
560
+ now `aria-hidden` / `accessibilityElementsHidden` to keep them out of the screen-reader tree.
561
+ - `Accordion`: the expand/collapse `LayoutAnimation` and the chevron rotation now honour
562
+ `prefers-reduced-motion: reduce`, snapping instantly for users who request reduced motion
563
+ (WCAG 2.3.3, web only).
564
+ - `ModalDropdown`: the trigger now also emits `accessibilityState.expanded` (native parity for
565
+ the existing web `aria-expanded`).
566
+
567
+ ## 1.5.0
568
+
569
+ - `Accordion` / `AccordionItem` gain a `variant` prop (`'plain' | 'boxed'`, default `'plain'`).
570
+ `plain` is the original borderless look (hairline dividers, right-hand chevron flipping 180° on
571
+ open) — existing consumers render **identically**, no change. `boxed` is the AML v1 console
572
+ `<details>` look: each item is its own bordered, rounded box (spaced by a gap) with a **leading
573
+ ▸ marker** that rotates 90° on open and a muted, 600-weight summary. The full API is preserved
574
+ (controlled/uncontrolled, `allowMultiple`, `defaultOpen`, a11y `aria-expanded`/region, the
575
+ open/close LayoutAnimation + chevron rotation). Additive + backward-compatible.
576
+
577
+ ## 1.4.0
578
+
579
+ - Add **`SegmentedControl`** — a single rounded pill *track* holding N mutually-exclusive
580
+ segments (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised
581
+ surface (`colors.surface`) with a subtle shadow; the rest stay transparent over the soft
582
+ track (`colors.background`). Promoted from the v1 AML console's `.lf-mode` mode switch so
583
+ erevna/katalogos/kefi share ONE toggle instead of hand-rolling two primary/ghost buttons.
584
+ - **Generic over the value union** (`SegmentedControl<'peps' | 'leaders'>`) for a typed
585
+ `onChange`; each segment carries its own `label` / `value` / optional `testID` +
586
+ `accessibilityLabel` / `accessibilityHint`.
587
+ - **a11y**: the group renders as a `tablist`, each segment as a `tab` with
588
+ `accessibilityState={{ selected }}` (react-native-web forwards `role` + `aria-selected`).
589
+ - **Themed** entirely from the `@dloizides/ui-feedback` theme (surface / background / border /
590
+ text colours); no colour literal except the selected-segment drop shadow.
591
+ - **Additive / backward-compatible**: purely new exports (`SegmentedControl`,
592
+ `SegmentedControlProps`, `SegmentedOption`). Existing consumers are unaffected.
593
+
594
+ ## 1.3.0
595
+
596
+ - Add **`Accordion`** + **`AccordionItem`** — a themed expand/collapse disclosure group that
597
+ replaces per-app hand-rolled `<details>` / expanders (AML "More options" + expandable
598
+ matched-candidate rows, Erevna survey groups, Katalogos menu sections…).
599
+ - Compound API: an `Accordion` container owns the open state and shares it with `AccordionItem`
600
+ children via context. Each item = a pressable header (title left, optional `right`
601
+ adornment/badge slot, a rotating chevron) over a collapsible body `region`.
602
+ - **Controlled** (`openIds` + `onOpenChange`) **and uncontrolled** (`defaultOpenIds`, plus
603
+ per-item `defaultOpen`). `allowMultiple` (default `true`) vs single-open. Per-item `disabled`.
604
+ - **a11y**: header is an accessible `button` (`accessibilityRole="button"`,
605
+ `accessibilityState={{ expanded }}`, web `aria-expanded` + `aria-controls`); body is a
606
+ `role="region"`. Renders as a native `<button>`, so **Enter / Space toggle** it.
607
+ - **Themed** entirely from the `@dloizides/ui-feedback` theme (border / surface / text colours),
608
+ no hardcoded palette; renders borderless so it nests inside a `Section` / `Card`.
609
+ - **Animated** open/close via a guarded `LayoutAnimation` (web- and native-safe no-op fallback,
610
+ never throws) + an `Animated` chevron rotation. Hook-safe (lazy `useState`, no ref reads in render).
611
+ - **Additive / backward-compatible**: purely new exports (`Accordion`, `AccordionItem`,
612
+ `AccordionProps`, `AccordionItemProps`). Existing consumers (erevna / katalogos / aml-v2) are
613
+ unaffected.
614
+
615
+ ## 1.2.0
616
+
617
+ - `ModalDropdown` can now render as an **inline anchored menu** (native `<select>` feel), not only a
618
+ modal. New `variant?: DropdownVariant` prop (`Menu` | `Modal`) selects the presentation per screen.
619
+ - **Responsive default** (when `variant` is omitted): inline `Menu` on wide/desktop web
620
+ (viewport ≥ 768px), `Modal` on narrow/mobile and on any native platform. An explicit `variant`
621
+ overrides the auto choice.
622
+ - The inline menu anchors under the trigger, is dismissible via click-outside / `Esc`, is
623
+ keyboard-navigable (↑/↓, `Home`/`End`, `Enter`), scrolls when long, and does not push layout.
624
+ The modal path is unchanged. Both variants share the same option-rendering/selection logic
625
+ (`OptionRow`), so nothing is duplicated.
626
+ - **Additive / backward-compatible**: existing `ModalDropdown` callers (erevna / katalogos / aml-v2)
627
+ keep their exact API and now get the inline-on-desktop menu automatically. New export:
628
+ `DropdownVariant` (a runtime enum — deliberately not `const enum`, which cannot cross a published
629
+ package boundary under `isolatedModules`).
630
+
631
+ ## 1.1.0
632
+
633
+ - Add `ModalShell` — slide-up full-screen modal with a themed header (title + close) and scrollable body.
634
+ Composes `Heading` (this package) + `SvgIcon` (`@dloizides/ui-icons`). This was the batch-1 deferred
635
+ ModalShell, now landed (ui-icons + Heading both shared). Adds `@dloizides/ui-icons` + `react-native-svg`
636
+ as peers.
637
+
638
+ ## 1.0.0
639
+
640
+ Initial release (Capability Wave C1, batch 5 — the ui-layout pivot after full settings-hub proved
641
+ not cleanly extractable). Extracted the proven (erevna+katalogos identical) presentational primitives
642
+ that the settings screens (and others) reuse: `Section`, `Heading`, `StatusBadge`, `UpgradePrompt`,
643
+ `ModalDropdown` + `useFocusTrap`. Share the `@dloizides/ui-feedback` context (`useUi`). `Heading`
644
+ unblocks the deferred ModalShell. `Breadcrumb` deferred (couples to the app's router + breadcrumb map).