@dloizides/ui-layout 1.26.0 → 1.26.2

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