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