@dloizides/ui-layout 1.11.0 → 1.12.1

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,228 +1,266 @@
1
- # Changelog
2
-
3
- ## 1.11.0
4
-
5
- - **Fix (HIGH — 1.10.0's out-of-view close never fired in the real runtime).** 1.10.0 added
6
- "close the menu once the trigger leaves the viewport". Repositioning worked, but the close was
7
- measured **against the viewport**, and **RN-web apps never scroll the document** — every screen
8
- renders inside a `ScrollView`, so scrolling happens in an inner `<div>` and `window.scrollY`
9
- stays 0 forever. A trigger scrolled out of that inner scroller is invisible to the user while its
10
- rect sits comfortably inside the viewport, so the check could not fire on any screen of any
11
- portal. Measured in Chrome: trigger at `top: -37` (fully above the scroller), menu still rendered.
12
- Visibility is now measured against the **clip window** — the viewport intersected with every
13
- clipping ancestor — which is what makes it work inside an inner scroll container.
14
- - **Fix: "entirely out of view" was also the wrong threshold.** When a scroll container reaches the
15
- end of its range the trigger stops with a few pixels still showing (4px in the reported case), so
16
- "fully out" was *unreachable* and the menu never closed however far the user scrolled. There is
17
- now a minimum-visible-pixel floor (`MIN_VISIBLE_PX`).
18
- - **Guard: the menu never closes on its FIRST measurement**, so opening a dropdown whose trigger is
19
- already partly clipped still works; only movement after opening can close it.
20
- - **The zero-area "not laid out yet" guard is unchanged in intent but now provably size-only** — it
21
- asks about the element's own box, never its position, so it cannot swallow a genuine hidden case.
22
- - **New: `LAYOUT_I18N`** — the manifest of every translation key this package resolves, mirroring
23
- `TABLE_I18N` / `FILTERS_I18N` from `@dloizides/ui-tables` so hosts can bind an existing
24
- missing-key guard to it with no new pattern. The kit is fallback-free, so a key a host forgets
25
- reaches users as a raw dotted name; hand-maintained key lists rot (one portal was found missing
26
- 26 kit keys, another had `common.accordionToggleHint` undefined while `Accordion` was mounted).
27
- Every `t(...)` call in the package now references the map, and the suite fails on a raw key
28
- literal or a stale entry — so the manifest cannot drift from the code.
29
- - **Fix: the 1.10.0 CHANGELOG entry was written in cp1252**, leaving the published file invalid
30
- UTF-8. Re-encoded.
31
- - **No breaking change.** `LAYOUT_I18N` is additive and the key strings are unchanged, so existing
32
- translation files keep working untouched.
33
-
34
- ## 1.10.0
35
-
36
- Two defects found by browser visual QA of the inline dropdown menu against a live app.
37
-
38
- - **Fix (HIGH, affects every consumer): the open inline menu detached from its trigger.** On web the
39
- menu is portalled to `document.body` with `position: fixed` at the trigger's measured rect.
40
- `fixed` is viewport-relative, so that coordinate is only valid until something moves the trigger.
41
- A `scroll`/`resize` listener on `window` was already in place (since 1.7.0) and does handle plain
42
- scrolling — but it left three real gaps:
43
- - **Layout changes that fire no scroll event at all** — an accordion above the trigger expanding,
44
- a sticky header resizing, a banner appearing, an async list rendering. The trigger moved, nothing
45
- scrolled, no listener fired, and the menu stayed behind. Now covered by a `ResizeObserver` on the
46
- anchor and on `document.body`.
47
- - **The trigger leaving the viewport.** Repositioning cannot help here — the menu just follows its
48
- trigger off-screen and hangs over unrelated content with nothing on screen explaining it. The
49
- menu now **closes** once the trigger is fully out of view.
50
- - **Layout thrash.** The handler ran a synchronous `getBoundingClientRect()` (a forced reflow) plus
51
- a React state update on *every* scroll event. Work is now coalesced into one
52
- `requestAnimationFrame` per frame.
53
- Scroll is now observed in the **capture** phase on `document` rather than `window`, so a scroll in
54
- any ancestor scroll container counts. Tracking moved into a dedicated `useAnchorTracking` hook.
55
- Native is unaffected (the popover is in-tree and moves with its anchor).
56
- - **Fix (a11y): `accessibilityHint` never reached a screen reader.** The prop is part of the public
57
- API and every caller passes one, but react-native-web does not map it — the trigger carried
58
- `aria-label` and `aria-expanded` and **no hint of any kind**, so the text was silently thrown away
59
- (older react-native-web versions additionally leaked it to the DOM, logging
60
- `React does not recognize the accessibilityHint prop on a DOM element`). On web the hint is now
61
- rendered into a visually-hidden node referenced by `aria-describedby` — the same wiring
62
- `@dloizides/ui-forms`' `Field` uses for its error line — and the RN-only prop is no longer passed
63
- on web at all. Native still receives `accessibilityHint` unchanged.
64
- - **No API change.** Both fixes are internal; every existing caller benefits without edits.
65
-
66
- ## 1.9.1
67
-
68
- - **Fix (keyboard a11y, affects every consumer): Enter CLOSED the inline menu instead of SELECTING
69
- the highlighted option.** The trigger keeps DOM focus while the menu is open, and react-native-web
70
- maps Enter on a focused Touchable to `onPress`. React dispatches that from its ROOT container
71
- listener — an ancestor of the trigger, but a *descendant* of `document` — so the menu's BUBBLING
72
- `document` keydown listener ran second: the trigger toggled the menu shut, React unmounted the
73
- popover, the effect cleanup removed the very listener the event was still travelling toward, and
74
- `document` never saw the Enter. Keyboard users could open a dropdown and arrow through it but
75
- could never CHOOSE with the keyboard (mouse selection was unaffected, which is why it went
76
- unnoticed).
77
- - **Fix:** the menu's key handler now runs in the **capture** phase and `stopPropagation`s the keys
78
- an open menu owns (↑/↓/Home/End/Enter/Escape), so it runs ahead of React's listener and the
79
- trigger cannot re-toggle behind it. Found while browser-verifying the AML v2 topbar dropdowns.
80
-
81
- ## 1.9.0
82
-
83
- - **`ModalDropdown`: `menuMinWidth` — a width FLOOR for the open inline menu (additive, optional).**
84
- The menu matches the TRIGGER's width, which is right for a full-width field but leaves a compact
85
- anchor (the 1.8.0 `renderTrigger` case: a locale pill, an avatar chip, an icon button) with a menu
86
- too narrow to read its own option labels — a 52px "EN ▾" pill produced a 52px menu whose rows were
87
- clipped to a dark strip. `menuMinWidth` floors it; a wider trigger still wins.
88
- - **Backward-compatible:** omitted, the width is the trigger's, exactly as before.
89
-
90
- ## 1.8.0
91
-
92
- - **`ModalDropdown`: `renderTrigger` — a custom ANCHOR slot (additive, optional).** The dropdown's
93
- default trigger is a bordered field box, which is wrong for a *menu* anchored to a compact chip
94
- (a locale pill, an avatar/user chip, an icon button). Callers can now supply
95
- `renderTrigger={({ label, isOpen }) => …}` and own the anchor's visuals entirely; the default box
96
- is then not rendered. The a11y wrapper stays with the dropdown — `role=button`, `aria-expanded`,
97
- the accessible label + hint, and the `testID` are still applied — so a custom trigger *cannot*
98
- drop the accessible contract, and the portalled, keyboard-navigable (↑/↓/Home/End/Enter/Escape),
99
- never-clipped menu comes along for free.
100
- - **`ModalDropdown`: `optionTestID` — custom per-option testIDs (additive, optional).** Options
101
- still default to `` `${testID}-option-${value}` ``; a caller turning an existing flat control into
102
- a dropdown can now keep its established selectors stable
103
- (`optionTestID={(code) => `lang-${code}`}`).
104
- - **Backward-compatible:** both props are optional and, when omitted, the render tree is unchanged —
105
- erevna / katalogos / kefi / agora are unaffected and need no markup changes.
106
-
107
- ## 1.7.1
108
-
109
- Fix: the modal-variant dismiss backdrop was a pressable WRAPPING the option buttons,
110
- producing invalid DOM on web ("<button> cannot contain a nested <button>") + a React
111
- console.error. The backdrop is now an absolute-fill SIBLING behind the dialog — same
112
- tap-to-dismiss behaviour, no nesting. No API change.
113
-
114
-
115
- ## 1.7.0
116
-
117
- - **`ModalDropdown` inline-menu (`variant={DropdownVariant.Menu}`) z-index / clipping fix.** On
118
- wide/desktop web the open inline menu painted UNDERNEATH later content (adjacent filter fields,
119
- the results table, cards) so options were hidden/clipped. Root cause: react-native-web renders
120
- **every `View`** with `position: relative; z-index: 0`, making each View its own stacking context —
121
- so the popover's `zIndex: 1000` was trapped inside its anchor / the app's field wrapper and could
122
- never rise above later-painting siblings.
123
- - **Fix:** on web the menu is now rendered in a **portal to `document.body`** with `position: fixed`
124
- at the trigger's measured viewport rect (recomputed on scroll/resize) and a high `zIndex`. A portal
125
- escapes every ancestor stacking context AND every ancestor `overflow: hidden`, so the menu always
126
- paints on top and is never clipped — the same "menu above the table" outcome as
127
- `@dloizides/ui-tables` `SizeDropdown`. The anchor wrapper is also lifted to a raised `zIndex` while
128
- open (defence-in-depth; the primary lift on native).
129
- - **Native-safe:** the portal + `document`/`window` listeners are all behind `Platform.OS === 'web'`;
130
- native keeps the in-tree `position:absolute` popover + `elevation`. `react-dom` is added as an
131
- **optional** peer (already present in every react-native-web consumer).
132
- - Outside-click dismissal now consults the portalled popover's own node too, so clicking an option
133
- still selects (a portalled option is no longer a DOM descendant of the anchor). Keyboard nav
134
- (↑/↓, Home/End, Enter, Escape), `role="menu"`/`menuitem`, `aria-expanded`/`aria-selected`, and the
135
- modal variant on narrow/native are all unchanged.
136
- - **Additive / backward-compatible:** the `ModalDropdown` API is unchanged; erevna / katalogos / kefi
137
- are unaffected.
138
-
139
- ## 1.6.0
140
-
141
- - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
142
- - `AccordionItem`: the rotating chevron (plain) and leading ▸ marker (boxed) are purely
143
- decorative — the open/closed state is already on the header via `aria-expanded` — so they are
144
- now `aria-hidden` / `accessibilityElementsHidden` to keep them out of the screen-reader tree.
145
- - `Accordion`: the expand/collapse `LayoutAnimation` and the chevron rotation now honour
146
- `prefers-reduced-motion: reduce`, snapping instantly for users who request reduced motion
147
- (WCAG 2.3.3, web only).
148
- - `ModalDropdown`: the trigger now also emits `accessibilityState.expanded` (native parity for
149
- the existing web `aria-expanded`).
150
-
151
- ## 1.5.0
152
-
153
- - `Accordion` / `AccordionItem` gain a `variant` prop (`'plain' | 'boxed'`, default `'plain'`).
154
- `plain` is the original borderless look (hairline dividers, right-hand chevron flipping 180° on
155
- open) — existing consumers render **identically**, no change. `boxed` is the AML v1 console
156
- `<details>` look: each item is its own bordered, rounded box (spaced by a gap) with a **leading
157
- ▸ marker** that rotates 90° on open and a muted, 600-weight summary. The full API is preserved
158
- (controlled/uncontrolled, `allowMultiple`, `defaultOpen`, a11y `aria-expanded`/region, the
159
- open/close LayoutAnimation + chevron rotation). Additive + backward-compatible.
160
-
161
- ## 1.4.0
162
-
163
- - Add **`SegmentedControl`** — a single rounded pill *track* holding N mutually-exclusive
164
- segments (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised
165
- surface (`colors.surface`) with a subtle shadow; the rest stay transparent over the soft
166
- track (`colors.background`). Promoted from the v1 AML console's `.lf-mode` mode switch so
167
- erevna/katalogos/kefi share ONE toggle instead of hand-rolling two primary/ghost buttons.
168
- - **Generic over the value union** (`SegmentedControl<'peps' | 'leaders'>`) for a typed
169
- `onChange`; each segment carries its own `label` / `value` / optional `testID` +
170
- `accessibilityLabel` / `accessibilityHint`.
171
- - **a11y**: the group renders as a `tablist`, each segment as a `tab` with
172
- `accessibilityState={{ selected }}` (react-native-web forwards `role` + `aria-selected`).
173
- - **Themed** entirely from the `@dloizides/ui-feedback` theme (surface / background / border /
174
- text colours); no colour literal except the selected-segment drop shadow.
175
- - **Additive / backward-compatible**: purely new exports (`SegmentedControl`,
176
- `SegmentedControlProps`, `SegmentedOption`). Existing consumers are unaffected.
177
-
178
- ## 1.3.0
179
-
180
- - Add **`Accordion`** + **`AccordionItem`** — a themed expand/collapse disclosure group that
181
- replaces per-app hand-rolled `<details>` / expanders (AML "More options" + expandable
182
- matched-candidate rows, Erevna survey groups, Katalogos menu sections…).
183
- - Compound API: an `Accordion` container owns the open state and shares it with `AccordionItem`
184
- children via context. Each item = a pressable header (title left, optional `right`
185
- adornment/badge slot, a rotating chevron) over a collapsible body `region`.
186
- - **Controlled** (`openIds` + `onOpenChange`) **and uncontrolled** (`defaultOpenIds`, plus
187
- per-item `defaultOpen`). `allowMultiple` (default `true`) vs single-open. Per-item `disabled`.
188
- - **a11y**: header is an accessible `button` (`accessibilityRole="button"`,
189
- `accessibilityState={{ expanded }}`, web `aria-expanded` + `aria-controls`); body is a
190
- `role="region"`. Renders as a native `<button>`, so **Enter / Space toggle** it.
191
- - **Themed** entirely from the `@dloizides/ui-feedback` theme (border / surface / text colours),
192
- no hardcoded palette; renders borderless so it nests inside a `Section` / `Card`.
193
- - **Animated** open/close via a guarded `LayoutAnimation` (web- and native-safe no-op fallback,
194
- never throws) + an `Animated` chevron rotation. Hook-safe (lazy `useState`, no ref reads in render).
195
- - **Additive / backward-compatible**: purely new exports (`Accordion`, `AccordionItem`,
196
- `AccordionProps`, `AccordionItemProps`). Existing consumers (erevna / katalogos / aml-v2) are
197
- unaffected.
198
-
199
- ## 1.2.0
200
-
201
- - `ModalDropdown` can now render as an **inline anchored menu** (native `<select>` feel), not only a
202
- modal. New `variant?: DropdownVariant` prop (`Menu` | `Modal`) selects the presentation per screen.
203
- - **Responsive default** (when `variant` is omitted): inline `Menu` on wide/desktop web
204
- (viewport ≥ 768px), `Modal` on narrow/mobile and on any native platform. An explicit `variant`
205
- overrides the auto choice.
206
- - The inline menu anchors under the trigger, is dismissible via click-outside / `Esc`, is
207
- keyboard-navigable (↑/↓, `Home`/`End`, `Enter`), scrolls when long, and does not push layout.
208
- The modal path is unchanged. Both variants share the same option-rendering/selection logic
209
- (`OptionRow`), so nothing is duplicated.
210
- - **Additive / backward-compatible**: existing `ModalDropdown` callers (erevna / katalogos / aml-v2)
211
- keep their exact API and now get the inline-on-desktop menu automatically. New export:
212
- `DropdownVariant` (a runtime enum — deliberately not `const enum`, which cannot cross a published
213
- package boundary under `isolatedModules`).
214
-
215
- ## 1.1.0
216
-
217
- - Add `ModalShell` — slide-up full-screen modal with a themed header (title + close) and scrollable body.
218
- Composes `Heading` (this package) + `SvgIcon` (`@dloizides/ui-icons`). This was the batch-1 deferred
219
- ModalShell, now landed (ui-icons + Heading both shared). Adds `@dloizides/ui-icons` + `react-native-svg`
220
- as peers.
221
-
222
- ## 1.0.0
223
-
224
- Initial release (Capability Wave C1, batch 5 — the ui-layout pivot after full settings-hub proved
225
- not cleanly extractable). Extracted the proven (erevna+katalogos identical) presentational primitives
226
- that the settings screens (and others) reuse: `Section`, `Heading`, `StatusBadge`, `UpgradePrompt`,
227
- `ModalDropdown` + `useFocusTrap`. Share the `@dloizides/ui-feedback` context (`useUi`). `Heading`
228
- unblocks the deferred ModalShell. `Breadcrumb` deferred (couples to the app's router + breadcrumb map).
1
+ # Changelog
2
+
3
+ ## 1.12.1
4
+
5
+ - **Fix (`TruncatedText` did not actually middle-truncate).** 1.12.0 measured its available
6
+ width with `onLayout` **on the `<Text>` itself, which never fires under RN-web**. The width
7
+ stayed 0, the character budget stayed 0, and the component silently fell back to rendering
8
+ the full string — i.e. to exactly the tail-only CSS ellipsis it exists to replace. It
9
+ compiled, typechecked and passed all its unit tests throughout, because the truncation
10
+ helpers are pure and were never the broken part; only a browser could see it. Measured in
11
+ Chrome at a 120px container: text rendered `timesofindia.indiatimes.com/city/delhi/delhi-…`
12
+ with **no `…` character present** — CSS clipping, not middle truncation.
13
+
14
+ The width is now measured on a wrapping `<View>`, which does fire `onLayout`. The overflow
15
+ guarantee was never affected (the element stayed inside its parent in both versions); what
16
+ was lost was the informative half of the behaviour.
17
+
18
+ ## 1.12.0
19
+
20
+ - **New: `TruncatedText`** — a single-line text/link that middle-truncates to fit its container
21
+ and cannot overflow at any width. Promoted out of the AML console, where a full adverse-media
22
+ article URL rendered as raw `<Text>` and blew out its table row.
23
+
24
+ Three things that look like they would solve this and do not, all verified against
25
+ react-native-web 0.21 rather than assumed:
26
+
27
+ 1. `numberOfLines={1}` alone truncates at the **tail** (RN-web compiles it to
28
+ `text-overflow: ellipsis`). Every URL from one publisher then collapses to the same
29
+ `timesofindia.indiatimes.com/city/de…` prefix and the reader cannot tell the articles
30
+ apart. There is no CSS for middle truncation, so it is computed in JS.
31
+ 2. `title={full}` is **silently dropped** — RN-web's `<Text>` forwards only `href`, `lang`
32
+ and `pointerEvents` beyond the shared whitelist. The tooltip is set on the host node
33
+ through a ref instead.
34
+ 3. JS truncation alone can mis-estimate an unusual glyph mix, so `numberOfLines={1}` is ALSO
35
+ applied as a hard backstop. Overflow is impossible by construction, not by tuning.
36
+
37
+ The full value always stays reachable — as the accessible name and, on web, the native
38
+ tooltip. Also exported: the pure `truncateMiddle` / `formatUrlForDisplay` helpers and
39
+ `ELLIPSIS`.
40
+
41
+ ## 1.11.0
42
+
43
+ - **Fix (HIGH — 1.10.0's out-of-view close never fired in the real runtime).** 1.10.0 added
44
+ "close the menu once the trigger leaves the viewport". Repositioning worked, but the close was
45
+ measured **against the viewport**, and **RN-web apps never scroll the document** — every screen
46
+ renders inside a `ScrollView`, so scrolling happens in an inner `<div>` and `window.scrollY`
47
+ stays 0 forever. A trigger scrolled out of that inner scroller is invisible to the user while its
48
+ rect sits comfortably inside the viewport, so the check could not fire on any screen of any
49
+ portal. Measured in Chrome: trigger at `top: -37` (fully above the scroller), menu still rendered.
50
+ Visibility is now measured against the **clip window** — the viewport intersected with every
51
+ clipping ancestor — which is what makes it work inside an inner scroll container.
52
+ - **Fix: "entirely out of view" was also the wrong threshold.** When a scroll container reaches the
53
+ end of its range the trigger stops with a few pixels still showing (4px in the reported case), so
54
+ "fully out" was *unreachable* and the menu never closed however far the user scrolled. There is
55
+ now a minimum-visible-pixel floor (`MIN_VISIBLE_PX`).
56
+ - **Guard: the menu never closes on its FIRST measurement**, so opening a dropdown whose trigger is
57
+ already partly clipped still works; only movement after opening can close it.
58
+ - **The zero-area "not laid out yet" guard is unchanged in intent but now provably size-only** — it
59
+ asks about the element's own box, never its position, so it cannot swallow a genuine hidden case.
60
+ - **New: `LAYOUT_I18N`** — the manifest of every translation key this package resolves, mirroring
61
+ `TABLE_I18N` / `FILTERS_I18N` from `@dloizides/ui-tables` so hosts can bind an existing
62
+ missing-key guard to it with no new pattern. The kit is fallback-free, so a key a host forgets
63
+ reaches users as a raw dotted name; hand-maintained key lists rot (one portal was found missing
64
+ 26 kit keys, another had `common.accordionToggleHint` undefined while `Accordion` was mounted).
65
+ Every `t(...)` call in the package now references the map, and the suite fails on a raw key
66
+ literal or a stale entry — so the manifest cannot drift from the code.
67
+ - **Fix: the 1.10.0 CHANGELOG entry was written in cp1252**, leaving the published file invalid
68
+ UTF-8. Re-encoded.
69
+ - **No breaking change.** `LAYOUT_I18N` is additive and the key strings are unchanged, so existing
70
+ translation files keep working untouched.
71
+
72
+ ## 1.10.0
73
+
74
+ Two defects found by browser visual QA of the inline dropdown menu against a live app.
75
+
76
+ - **Fix (HIGH, affects every consumer): the open inline menu detached from its trigger.** On web the
77
+ menu is portalled to `document.body` with `position: fixed` at the trigger's measured rect.
78
+ `fixed` is viewport-relative, so that coordinate is only valid until something moves the trigger.
79
+ A `scroll`/`resize` listener on `window` was already in place (since 1.7.0) and does handle plain
80
+ scrolling — but it left three real gaps:
81
+ - **Layout changes that fire no scroll event at all** — an accordion above the trigger expanding,
82
+ a sticky header resizing, a banner appearing, an async list rendering. The trigger moved, nothing
83
+ scrolled, no listener fired, and the menu stayed behind. Now covered by a `ResizeObserver` on the
84
+ anchor and on `document.body`.
85
+ - **The trigger leaving the viewport.** Repositioning cannot help here — the menu just follows its
86
+ trigger off-screen and hangs over unrelated content with nothing on screen explaining it. The
87
+ menu now **closes** once the trigger is fully out of view.
88
+ - **Layout thrash.** The handler ran a synchronous `getBoundingClientRect()` (a forced reflow) plus
89
+ a React state update on *every* scroll event. Work is now coalesced into one
90
+ `requestAnimationFrame` per frame.
91
+ Scroll is now observed in the **capture** phase on `document` rather than `window`, so a scroll in
92
+ any ancestor scroll container counts. Tracking moved into a dedicated `useAnchorTracking` hook.
93
+ Native is unaffected (the popover is in-tree and moves with its anchor).
94
+ - **Fix (a11y): `accessibilityHint` never reached a screen reader.** The prop is part of the public
95
+ API and every caller passes one, but react-native-web does not map it — the trigger carried
96
+ `aria-label` and `aria-expanded` and **no hint of any kind**, so the text was silently thrown away
97
+ (older react-native-web versions additionally leaked it to the DOM, logging
98
+ `React does not recognize the accessibilityHint prop on a DOM element`). On web the hint is now
99
+ rendered into a visually-hidden node referenced by `aria-describedby` — the same wiring
100
+ `@dloizides/ui-forms`' `Field` uses for its error line — and the RN-only prop is no longer passed
101
+ on web at all. Native still receives `accessibilityHint` unchanged.
102
+ - **No API change.** Both fixes are internal; every existing caller benefits without edits.
103
+
104
+ ## 1.9.1
105
+
106
+ - **Fix (keyboard a11y, affects every consumer): Enter CLOSED the inline menu instead of SELECTING
107
+ the highlighted option.** The trigger keeps DOM focus while the menu is open, and react-native-web
108
+ maps Enter on a focused Touchable to `onPress`. React dispatches that from its ROOT container
109
+ listener — an ancestor of the trigger, but a *descendant* of `document` — so the menu's BUBBLING
110
+ `document` keydown listener ran second: the trigger toggled the menu shut, React unmounted the
111
+ popover, the effect cleanup removed the very listener the event was still travelling toward, and
112
+ `document` never saw the Enter. Keyboard users could open a dropdown and arrow through it but
113
+ could never CHOOSE with the keyboard (mouse selection was unaffected, which is why it went
114
+ unnoticed).
115
+ - **Fix:** the menu's key handler now runs in the **capture** phase and `stopPropagation`s the keys
116
+ an open menu owns (↑/↓/Home/End/Enter/Escape), so it runs ahead of React's listener and the
117
+ trigger cannot re-toggle behind it. Found while browser-verifying the AML v2 topbar dropdowns.
118
+
119
+ ## 1.9.0
120
+
121
+ - **`ModalDropdown`: `menuMinWidth` — a width FLOOR for the open inline menu (additive, optional).**
122
+ The menu matches the TRIGGER's width, which is right for a full-width field but leaves a compact
123
+ anchor (the 1.8.0 `renderTrigger` case: a locale pill, an avatar chip, an icon button) with a menu
124
+ too narrow to read its own option labels — a 52px "EN ▾" pill produced a 52px menu whose rows were
125
+ clipped to a dark strip. `menuMinWidth` floors it; a wider trigger still wins.
126
+ - **Backward-compatible:** omitted, the width is the trigger's, exactly as before.
127
+
128
+ ## 1.8.0
129
+
130
+ - **`ModalDropdown`: `renderTrigger` — a custom ANCHOR slot (additive, optional).** The dropdown's
131
+ default trigger is a bordered field box, which is wrong for a *menu* anchored to a compact chip
132
+ (a locale pill, an avatar/user chip, an icon button). Callers can now supply
133
+ `renderTrigger={({ label, isOpen }) => …}` and own the anchor's visuals entirely; the default box
134
+ is then not rendered. The a11y wrapper stays with the dropdown — `role=button`, `aria-expanded`,
135
+ the accessible label + hint, and the `testID` are still applied — so a custom trigger *cannot*
136
+ drop the accessible contract, and the portalled, keyboard-navigable (↑/↓/Home/End/Enter/Escape),
137
+ never-clipped menu comes along for free.
138
+ - **`ModalDropdown`: `optionTestID` — custom per-option testIDs (additive, optional).** Options
139
+ still default to `` `${testID}-option-${value}` ``; a caller turning an existing flat control into
140
+ a dropdown can now keep its established selectors stable
141
+ (`optionTestID={(code) => `lang-${code}`}`).
142
+ - **Backward-compatible:** both props are optional and, when omitted, the render tree is unchanged —
143
+ erevna / katalogos / kefi / agora are unaffected and need no markup changes.
144
+
145
+ ## 1.7.1
146
+
147
+ Fix: the modal-variant dismiss backdrop was a pressable WRAPPING the option buttons,
148
+ producing invalid DOM on web ("<button> cannot contain a nested <button>") + a React
149
+ console.error. The backdrop is now an absolute-fill SIBLING behind the dialog — same
150
+ tap-to-dismiss behaviour, no nesting. No API change.
151
+
152
+
153
+ ## 1.7.0
154
+
155
+ - **`ModalDropdown` inline-menu (`variant={DropdownVariant.Menu}`) z-index / clipping fix.** On
156
+ wide/desktop web the open inline menu painted UNDERNEATH later content (adjacent filter fields,
157
+ the results table, cards) so options were hidden/clipped. Root cause: react-native-web renders
158
+ **every `View`** with `position: relative; z-index: 0`, making each View its own stacking context —
159
+ so the popover's `zIndex: 1000` was trapped inside its anchor / the app's field wrapper and could
160
+ never rise above later-painting siblings.
161
+ - **Fix:** on web the menu is now rendered in a **portal to `document.body`** with `position: fixed`
162
+ at the trigger's measured viewport rect (recomputed on scroll/resize) and a high `zIndex`. A portal
163
+ escapes every ancestor stacking context AND every ancestor `overflow: hidden`, so the menu always
164
+ paints on top and is never clipped — the same "menu above the table" outcome as
165
+ `@dloizides/ui-tables` `SizeDropdown`. The anchor wrapper is also lifted to a raised `zIndex` while
166
+ open (defence-in-depth; the primary lift on native).
167
+ - **Native-safe:** the portal + `document`/`window` listeners are all behind `Platform.OS === 'web'`;
168
+ native keeps the in-tree `position:absolute` popover + `elevation`. `react-dom` is added as an
169
+ **optional** peer (already present in every react-native-web consumer).
170
+ - Outside-click dismissal now consults the portalled popover's own node too, so clicking an option
171
+ still selects (a portalled option is no longer a DOM descendant of the anchor). Keyboard nav
172
+ (↑/↓, Home/End, Enter, Escape), `role="menu"`/`menuitem`, `aria-expanded`/`aria-selected`, and the
173
+ modal variant on narrow/native are all unchanged.
174
+ - **Additive / backward-compatible:** the `ModalDropdown` API is unchanged; erevna / katalogos / kefi
175
+ are unaffected.
176
+
177
+ ## 1.6.0
178
+
179
+ - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
180
+ - `AccordionItem`: the rotating chevron (plain) and leading ▸ marker (boxed) are purely
181
+ decorative — the open/closed state is already on the header via `aria-expanded` — so they are
182
+ now `aria-hidden` / `accessibilityElementsHidden` to keep them out of the screen-reader tree.
183
+ - `Accordion`: the expand/collapse `LayoutAnimation` and the chevron rotation now honour
184
+ `prefers-reduced-motion: reduce`, snapping instantly for users who request reduced motion
185
+ (WCAG 2.3.3, web only).
186
+ - `ModalDropdown`: the trigger now also emits `accessibilityState.expanded` (native parity for
187
+ the existing web `aria-expanded`).
188
+
189
+ ## 1.5.0
190
+
191
+ - `Accordion` / `AccordionItem` gain a `variant` prop (`'plain' | 'boxed'`, default `'plain'`).
192
+ `plain` is the original borderless look (hairline dividers, right-hand chevron flipping 180° on
193
+ open) — existing consumers render **identically**, no change. `boxed` is the AML v1 console
194
+ `<details>` look: each item is its own bordered, rounded box (spaced by a gap) with a **leading
195
+ ▸ marker** that rotates 90° on open and a muted, 600-weight summary. The full API is preserved
196
+ (controlled/uncontrolled, `allowMultiple`, `defaultOpen`, a11y `aria-expanded`/region, the
197
+ open/close LayoutAnimation + chevron rotation). Additive + backward-compatible.
198
+
199
+ ## 1.4.0
200
+
201
+ - Add **`SegmentedControl`** — a single rounded pill *track* holding N mutually-exclusive
202
+ segments (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised
203
+ surface (`colors.surface`) with a subtle shadow; the rest stay transparent over the soft
204
+ track (`colors.background`). Promoted from the v1 AML console's `.lf-mode` mode switch so
205
+ erevna/katalogos/kefi share ONE toggle instead of hand-rolling two primary/ghost buttons.
206
+ - **Generic over the value union** (`SegmentedControl<'peps' | 'leaders'>`) for a typed
207
+ `onChange`; each segment carries its own `label` / `value` / optional `testID` +
208
+ `accessibilityLabel` / `accessibilityHint`.
209
+ - **a11y**: the group renders as a `tablist`, each segment as a `tab` with
210
+ `accessibilityState={{ selected }}` (react-native-web forwards `role` + `aria-selected`).
211
+ - **Themed** entirely from the `@dloizides/ui-feedback` theme (surface / background / border /
212
+ text colours); no colour literal except the selected-segment drop shadow.
213
+ - **Additive / backward-compatible**: purely new exports (`SegmentedControl`,
214
+ `SegmentedControlProps`, `SegmentedOption`). Existing consumers are unaffected.
215
+
216
+ ## 1.3.0
217
+
218
+ - Add **`Accordion`** + **`AccordionItem`** — a themed expand/collapse disclosure group that
219
+ replaces per-app hand-rolled `<details>` / expanders (AML "More options" + expandable
220
+ matched-candidate rows, Erevna survey groups, Katalogos menu sections…).
221
+ - Compound API: an `Accordion` container owns the open state and shares it with `AccordionItem`
222
+ children via context. Each item = a pressable header (title left, optional `right`
223
+ adornment/badge slot, a rotating chevron) over a collapsible body `region`.
224
+ - **Controlled** (`openIds` + `onOpenChange`) **and uncontrolled** (`defaultOpenIds`, plus
225
+ per-item `defaultOpen`). `allowMultiple` (default `true`) vs single-open. Per-item `disabled`.
226
+ - **a11y**: header is an accessible `button` (`accessibilityRole="button"`,
227
+ `accessibilityState={{ expanded }}`, web `aria-expanded` + `aria-controls`); body is a
228
+ `role="region"`. Renders as a native `<button>`, so **Enter / Space toggle** it.
229
+ - **Themed** entirely from the `@dloizides/ui-feedback` theme (border / surface / text colours),
230
+ no hardcoded palette; renders borderless so it nests inside a `Section` / `Card`.
231
+ - **Animated** open/close via a guarded `LayoutAnimation` (web- and native-safe no-op fallback,
232
+ never throws) + an `Animated` chevron rotation. Hook-safe (lazy `useState`, no ref reads in render).
233
+ - **Additive / backward-compatible**: purely new exports (`Accordion`, `AccordionItem`,
234
+ `AccordionProps`, `AccordionItemProps`). Existing consumers (erevna / katalogos / aml-v2) are
235
+ unaffected.
236
+
237
+ ## 1.2.0
238
+
239
+ - `ModalDropdown` can now render as an **inline anchored menu** (native `<select>` feel), not only a
240
+ modal. New `variant?: DropdownVariant` prop (`Menu` | `Modal`) selects the presentation per screen.
241
+ - **Responsive default** (when `variant` is omitted): inline `Menu` on wide/desktop web
242
+ (viewport ≥ 768px), `Modal` on narrow/mobile and on any native platform. An explicit `variant`
243
+ overrides the auto choice.
244
+ - The inline menu anchors under the trigger, is dismissible via click-outside / `Esc`, is
245
+ keyboard-navigable (↑/↓, `Home`/`End`, `Enter`), scrolls when long, and does not push layout.
246
+ The modal path is unchanged. Both variants share the same option-rendering/selection logic
247
+ (`OptionRow`), so nothing is duplicated.
248
+ - **Additive / backward-compatible**: existing `ModalDropdown` callers (erevna / katalogos / aml-v2)
249
+ keep their exact API and now get the inline-on-desktop menu automatically. New export:
250
+ `DropdownVariant` (a runtime enum — deliberately not `const enum`, which cannot cross a published
251
+ package boundary under `isolatedModules`).
252
+
253
+ ## 1.1.0
254
+
255
+ - Add `ModalShell` — slide-up full-screen modal with a themed header (title + close) and scrollable body.
256
+ Composes `Heading` (this package) + `SvgIcon` (`@dloizides/ui-icons`). This was the batch-1 deferred
257
+ ModalShell, now landed (ui-icons + Heading both shared). Adds `@dloizides/ui-icons` + `react-native-svg`
258
+ as peers.
259
+
260
+ ## 1.0.0
261
+
262
+ Initial release (Capability Wave C1, batch 5 — the ui-layout pivot after full settings-hub proved
263
+ not cleanly extractable). Extracted the proven (erevna+katalogos identical) presentational primitives
264
+ that the settings screens (and others) reuse: `Section`, `Heading`, `StatusBadge`, `UpgradePrompt`,
265
+ `ModalDropdown` + `useFocusTrap`. Share the `@dloizides/ui-feedback` context (`useUi`). `Heading`
266
+ unblocks the deferred ModalShell. `Breadcrumb` deferred (couples to the app's router + breadcrumb map).