@dloizides/ui-layout 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,197 +1,228 @@
1
- # Changelog
2
-
3
- ## 1.10.0
4
-
5
- Two defects found by browser visual QA of the inline dropdown menu against a live app.
6
-
7
- - **Fix (HIGH, affects every consumer): the open inline menu detached from its trigger.** On web the
8
- menu is portalled to `document.body` with `position: fixed` at the trigger's measured rect.
9
- `fixed` is viewport-relative, so that coordinate is only valid until something moves the trigger.
10
- A `scroll`/`resize` listener on `window` was already in place (since 1.7.0) and does handle plain
11
- scrolling � but it left three real gaps:
12
- - **Layout changes that fire no scroll event at all** � an accordion above the trigger expanding,
13
- a sticky header resizing, a banner appearing, an async list rendering. The trigger moved, nothing
14
- scrolled, no listener fired, and the menu stayed behind. Now covered by a `ResizeObserver` on the
15
- anchor and on `document.body`.
16
- - **The trigger leaving the viewport.** Repositioning cannot help here � the menu just follows its
17
- trigger off-screen and hangs over unrelated content with nothing on screen explaining it. The
18
- menu now **closes** once the trigger is fully out of view.
19
- - **Layout thrash.** The handler ran a synchronous `getBoundingClientRect()` (a forced reflow) plus
20
- a React state update on *every* scroll event. Work is now coalesced into one
21
- `requestAnimationFrame` per frame.
22
- Scroll is now observed in the **capture** phase on `document` rather than `window`, so a scroll in
23
- any ancestor scroll container counts. Tracking moved into a dedicated `useAnchorTracking` hook.
24
- Native is unaffected (the popover is in-tree and moves with its anchor).
25
- - **Fix (a11y): `accessibilityHint` never reached a screen reader.** The prop is part of the public
26
- API and every caller passes one, but react-native-web does not map it � the trigger carried
27
- `aria-label` and `aria-expanded` and **no hint of any kind**, so the text was silently thrown away
28
- (older react-native-web versions additionally leaked it to the DOM, logging
29
- `React does not recognize the accessibilityHint prop on a DOM element`). On web the hint is now
30
- rendered into a visually-hidden node referenced by `aria-describedby` � the same wiring
31
- `@dloizides/ui-forms`' `Field` uses for its error line � and the RN-only prop is no longer passed
32
- on web at all. Native still receives `accessibilityHint` unchanged.
33
- - **No API change.** Both fixes are internal; every existing caller benefits without edits.
34
-
35
- ## 1.9.1
36
-
37
- - **Fix (keyboard a11y, affects every consumer): Enter CLOSED the inline menu instead of SELECTING
38
- the highlighted option.** The trigger keeps DOM focus while the menu is open, and react-native-web
39
- maps Enter on a focused Touchable to `onPress`. React dispatches that from its ROOT container
40
- listener — an ancestor of the trigger, but a *descendant* of `document` — so the menu's BUBBLING
41
- `document` keydown listener ran second: the trigger toggled the menu shut, React unmounted the
42
- popover, the effect cleanup removed the very listener the event was still travelling toward, and
43
- `document` never saw the Enter. Keyboard users could open a dropdown and arrow through it but
44
- could never CHOOSE with the keyboard (mouse selection was unaffected, which is why it went
45
- unnoticed).
46
- - **Fix:** the menu's key handler now runs in the **capture** phase and `stopPropagation`s the keys
47
- an open menu owns (↑/↓/Home/End/Enter/Escape), so it runs ahead of React's listener and the
48
- trigger cannot re-toggle behind it. Found while browser-verifying the AML v2 topbar dropdowns.
49
-
50
- ## 1.9.0
51
-
52
- - **`ModalDropdown`: `menuMinWidth` — a width FLOOR for the open inline menu (additive, optional).**
53
- The menu matches the TRIGGER's width, which is right for a full-width field but leaves a compact
54
- anchor (the 1.8.0 `renderTrigger` case: a locale pill, an avatar chip, an icon button) with a menu
55
- too narrow to read its own option labels — a 52px "EN ▾" pill produced a 52px menu whose rows were
56
- clipped to a dark strip. `menuMinWidth` floors it; a wider trigger still wins.
57
- - **Backward-compatible:** omitted, the width is the trigger's, exactly as before.
58
-
59
- ## 1.8.0
60
-
61
- - **`ModalDropdown`: `renderTrigger` — a custom ANCHOR slot (additive, optional).** The dropdown's
62
- default trigger is a bordered field box, which is wrong for a *menu* anchored to a compact chip
63
- (a locale pill, an avatar/user chip, an icon button). Callers can now supply
64
- `renderTrigger={({ label, isOpen }) => …}` and own the anchor's visuals entirely; the default box
65
- is then not rendered. The a11y wrapper stays with the dropdown — `role=button`, `aria-expanded`,
66
- the accessible label + hint, and the `testID` are still applied — so a custom trigger *cannot*
67
- drop the accessible contract, and the portalled, keyboard-navigable (↑/↓/Home/End/Enter/Escape),
68
- never-clipped menu comes along for free.
69
- - **`ModalDropdown`: `optionTestID` — custom per-option testIDs (additive, optional).** Options
70
- still default to `` `${testID}-option-${value}` ``; a caller turning an existing flat control into
71
- a dropdown can now keep its established selectors stable
72
- (`optionTestID={(code) => `lang-${code}`}`).
73
- - **Backward-compatible:** both props are optional and, when omitted, the render tree is unchanged —
74
- erevna / katalogos / kefi / agora are unaffected and need no markup changes.
75
-
76
- ## 1.7.1
77
-
78
- Fix: the modal-variant dismiss backdrop was a pressable WRAPPING the option buttons,
79
- producing invalid DOM on web ("<button> cannot contain a nested <button>") + a React
80
- console.error. The backdrop is now an absolute-fill SIBLING behind the dialog — same
81
- tap-to-dismiss behaviour, no nesting. No API change.
82
-
83
-
84
- ## 1.7.0
85
-
86
- - **`ModalDropdown` inline-menu (`variant={DropdownVariant.Menu}`) z-index / clipping fix.** On
87
- wide/desktop web the open inline menu painted UNDERNEATH later content (adjacent filter fields,
88
- the results table, cards) so options were hidden/clipped. Root cause: react-native-web renders
89
- **every `View`** with `position: relative; z-index: 0`, making each View its own stacking context —
90
- so the popover's `zIndex: 1000` was trapped inside its anchor / the app's field wrapper and could
91
- never rise above later-painting siblings.
92
- - **Fix:** on web the menu is now rendered in a **portal to `document.body`** with `position: fixed`
93
- at the trigger's measured viewport rect (recomputed on scroll/resize) and a high `zIndex`. A portal
94
- escapes every ancestor stacking context AND every ancestor `overflow: hidden`, so the menu always
95
- paints on top and is never clipped — the same "menu above the table" outcome as
96
- `@dloizides/ui-tables` `SizeDropdown`. The anchor wrapper is also lifted to a raised `zIndex` while
97
- open (defence-in-depth; the primary lift on native).
98
- - **Native-safe:** the portal + `document`/`window` listeners are all behind `Platform.OS === 'web'`;
99
- native keeps the in-tree `position:absolute` popover + `elevation`. `react-dom` is added as an
100
- **optional** peer (already present in every react-native-web consumer).
101
- - Outside-click dismissal now consults the portalled popover's own node too, so clicking an option
102
- still selects (a portalled option is no longer a DOM descendant of the anchor). Keyboard nav
103
- (↑/↓, Home/End, Enter, Escape), `role="menu"`/`menuitem`, `aria-expanded`/`aria-selected`, and the
104
- modal variant on narrow/native are all unchanged.
105
- - **Additive / backward-compatible:** the `ModalDropdown` API is unchanged; erevna / katalogos / kefi
106
- are unaffected.
107
-
108
- ## 1.6.0
109
-
110
- - **Accessibility (WCAG 2.1 AA) hardening — additive + backward-compatible.**
111
- - `AccordionItem`: the rotating chevron (plain) and leading ▸ marker (boxed) are purely
112
- decorative — the open/closed state is already on the header via `aria-expanded` — so they are
113
- now `aria-hidden` / `accessibilityElementsHidden` to keep them out of the screen-reader tree.
114
- - `Accordion`: the expand/collapse `LayoutAnimation` and the chevron rotation now honour
115
- `prefers-reduced-motion: reduce`, snapping instantly for users who request reduced motion
116
- (WCAG 2.3.3, web only).
117
- - `ModalDropdown`: the trigger now also emits `accessibilityState.expanded` (native parity for
118
- the existing web `aria-expanded`).
119
-
120
- ## 1.5.0
121
-
122
- - `Accordion` / `AccordionItem` gain a `variant` prop (`'plain' | 'boxed'`, default `'plain'`).
123
- `plain` is the original borderless look (hairline dividers, right-hand chevron flipping 180° on
124
- open) — existing consumers render **identically**, no change. `boxed` is the AML v1 console
125
- `<details>` look: each item is its own bordered, rounded box (spaced by a gap) with a **leading
126
- ▸ marker** that rotates 90° on open and a muted, 600-weight summary. The full API is preserved
127
- (controlled/uncontrolled, `allowMultiple`, `defaultOpen`, a11y `aria-expanded`/region, the
128
- open/close LayoutAnimation + chevron rotation). Additive + backward-compatible.
129
-
130
- ## 1.4.0
131
-
132
- - Add **`SegmentedControl`** — a single rounded pill *track* holding N mutually-exclusive
133
- segments (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised
134
- surface (`colors.surface`) with a subtle shadow; the rest stay transparent over the soft
135
- track (`colors.background`). Promoted from the v1 AML console's `.lf-mode` mode switch so
136
- erevna/katalogos/kefi share ONE toggle instead of hand-rolling two primary/ghost buttons.
137
- - **Generic over the value union** (`SegmentedControl<'peps' | 'leaders'>`) for a typed
138
- `onChange`; each segment carries its own `label` / `value` / optional `testID` +
139
- `accessibilityLabel` / `accessibilityHint`.
140
- - **a11y**: the group renders as a `tablist`, each segment as a `tab` with
141
- `accessibilityState={{ selected }}` (react-native-web forwards `role` + `aria-selected`).
142
- - **Themed** entirely from the `@dloizides/ui-feedback` theme (surface / background / border /
143
- text colours); no colour literal except the selected-segment drop shadow.
144
- - **Additive / backward-compatible**: purely new exports (`SegmentedControl`,
145
- `SegmentedControlProps`, `SegmentedOption`). Existing consumers are unaffected.
146
-
147
- ## 1.3.0
148
-
149
- - Add **`Accordion`** + **`AccordionItem`** — a themed expand/collapse disclosure group that
150
- replaces per-app hand-rolled `<details>` / expanders (AML "More options" + expandable
151
- matched-candidate rows, Erevna survey groups, Katalogos menu sections…).
152
- - Compound API: an `Accordion` container owns the open state and shares it with `AccordionItem`
153
- children via context. Each item = a pressable header (title left, optional `right`
154
- adornment/badge slot, a rotating chevron) over a collapsible body `region`.
155
- - **Controlled** (`openIds` + `onOpenChange`) **and uncontrolled** (`defaultOpenIds`, plus
156
- per-item `defaultOpen`). `allowMultiple` (default `true`) vs single-open. Per-item `disabled`.
157
- - **a11y**: header is an accessible `button` (`accessibilityRole="button"`,
158
- `accessibilityState={{ expanded }}`, web `aria-expanded` + `aria-controls`); body is a
159
- `role="region"`. Renders as a native `<button>`, so **Enter / Space toggle** it.
160
- - **Themed** entirely from the `@dloizides/ui-feedback` theme (border / surface / text colours),
161
- no hardcoded palette; renders borderless so it nests inside a `Section` / `Card`.
162
- - **Animated** open/close via a guarded `LayoutAnimation` (web- and native-safe no-op fallback,
163
- never throws) + an `Animated` chevron rotation. Hook-safe (lazy `useState`, no ref reads in render).
164
- - **Additive / backward-compatible**: purely new exports (`Accordion`, `AccordionItem`,
165
- `AccordionProps`, `AccordionItemProps`). Existing consumers (erevna / katalogos / aml-v2) are
166
- unaffected.
167
-
168
- ## 1.2.0
169
-
170
- - `ModalDropdown` can now render as an **inline anchored menu** (native `<select>` feel), not only a
171
- modal. New `variant?: DropdownVariant` prop (`Menu` | `Modal`) selects the presentation per screen.
172
- - **Responsive default** (when `variant` is omitted): inline `Menu` on wide/desktop web
173
- (viewport ≥ 768px), `Modal` on narrow/mobile and on any native platform. An explicit `variant`
174
- overrides the auto choice.
175
- - The inline menu anchors under the trigger, is dismissible via click-outside / `Esc`, is
176
- keyboard-navigable (↑/↓, `Home`/`End`, `Enter`), scrolls when long, and does not push layout.
177
- The modal path is unchanged. Both variants share the same option-rendering/selection logic
178
- (`OptionRow`), so nothing is duplicated.
179
- - **Additive / backward-compatible**: existing `ModalDropdown` callers (erevna / katalogos / aml-v2)
180
- keep their exact API and now get the inline-on-desktop menu automatically. New export:
181
- `DropdownVariant` (a runtime enum — deliberately not `const enum`, which cannot cross a published
182
- package boundary under `isolatedModules`).
183
-
184
- ## 1.1.0
185
-
186
- - Add `ModalShell` — slide-up full-screen modal with a themed header (title + close) and scrollable body.
187
- Composes `Heading` (this package) + `SvgIcon` (`@dloizides/ui-icons`). This was the batch-1 deferred
188
- ModalShell, now landed (ui-icons + Heading both shared). Adds `@dloizides/ui-icons` + `react-native-svg`
189
- as peers.
190
-
191
- ## 1.0.0
192
-
193
- Initial release (Capability Wave C1, batch 5 — the ui-layout pivot after full settings-hub proved
194
- not cleanly extractable). Extracted the proven (erevna+katalogos identical) presentational primitives
195
- that the settings screens (and others) reuse: `Section`, `Heading`, `StatusBadge`, `UpgradePrompt`,
196
- `ModalDropdown` + `useFocusTrap`. Share the `@dloizides/ui-feedback` context (`useUi`). `Heading`
197
- unblocks the deferred ModalShell. `Breadcrumb` deferred (couples to the app's router + breadcrumb map).
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).
package/README.md CHANGED
@@ -79,7 +79,9 @@ The apps supply the header hint string via the shared translate: key `common.acc
79
79
  It is portalled to `document.body` so no ancestor stacking context or `overflow` can trap or
80
80
  clip it, and it **stays glued to its trigger**: it re-anchors on scroll (in any ancestor scroll
81
81
  container), on resize, and on layout changes that fire no scroll event at all, then **closes**
82
- once the trigger scrolls out of the viewport rather than floating over unrelated content.
82
+ once the trigger is no longer meaningfully visible. Visibility is measured against the viewport
83
+ intersected with every clipping ancestor — RN-web apps scroll an inner `ScrollView`, never the
84
+ document, so a viewport-only test would never fire.
83
85
  - **Narrow / mobile, or any native platform** → the original **modal** / bottom-sheet.
84
86
 
85
87
  Pass `variant` to force either behaviour regardless of viewport — the prop overrides the auto choice:
@@ -119,3 +121,22 @@ translations, and navigation.
119
121
  ## License
120
122
 
121
123
  MIT
124
+
125
+ ## i18n contract (required)
126
+
127
+ The kit is **fallback-free**: the neutral default `t` returns the key itself, so a host that forgets
128
+ a key does not silently show English — it renders the raw dotted name to users, or announces it to
129
+ screen readers. `LAYOUT_I18N` is the machine-readable manifest of every key this package resolves;
130
+ bind your missing-key guard to it exactly as you already do for `TABLE_I18N` / `FILTERS_I18N` from
131
+ `@dloizides/ui-tables`, and an upgrade can never add a key your app silently fails to define.
132
+
133
+ ```ts
134
+ import { LAYOUT_I18N } from '@dloizides/ui-layout';
135
+ import { TABLE_I18N } from '@dloizides/ui-tables';
136
+
137
+ // Every value is a translation key this package will call `t(...)` with.
138
+ const REQUIRED_KIT_KEYS = [...Object.values(LAYOUT_I18N), ...Object.values(TABLE_I18N)];
139
+ ```
140
+
141
+ The manifest cannot drift: every `t(...)` call in the package references `LAYOUT_I18N`, and the test
142
+ suite fails on a raw key literal in a component or a stale entry in the map.
package/dist/index.d.mts CHANGED
@@ -281,5 +281,47 @@ declare const LAYOUT_TEST_IDS: {
281
281
  };
282
282
  /** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */
283
283
  declare const DEFAULT_BILLING_ROUTE = "/settings/billing";
284
+ /**
285
+ * Every translation key this package resolves through `t(...)` — the host app's i18n contract.
286
+ *
287
+ * WHY THIS EXISTS: the kit is deliberately fallback-free. The neutral default `t` returns the key
288
+ * itself, so a host that forgets a key does not silently show English — it shows the raw dotted
289
+ * name to users, or announces it to screen readers. Without a machine-readable manifest each
290
+ * portal had to hand-maintain its ui-layout key list, and hand-maintained lists rot: one app was
291
+ * found missing 26 kit keys (rendering raw names to users), another had `accordionToggleHint`
292
+ * undefined while `Accordion` was mounted, announcing the raw key to assistive tech.
293
+ *
294
+ * Bind a missing-key guard to this map (the same way apps already bind `TABLE_I18N` /
295
+ * `FILTERS_I18N` from `@dloizides/ui-tables`) and an upgrade can never drift unnoticed. Every
296
+ * `t(...)` call in this package references this map, so it cannot fall out of date.
297
+ */
298
+ declare const LAYOUT_I18N: {
299
+ /** Placeholder shown by `ModalDropdown` when no option matches the current value. */
300
+ readonly selectPlaceholder: "common.selectPlaceholder";
301
+ /** Accessible name + hint of the modal-variant dropdown's dismiss backdrop. */
302
+ readonly dismissDropdown: "common.dismissDropdown";
303
+ readonly dismissDropdownHint: "common.dismissDropdownHint";
304
+ /** Accessible hint on a single dropdown option row. */
305
+ readonly selectOptionHint: "common.selectOptionHint";
306
+ /** Default accessible hint on an `AccordionItem` header when the caller supplies none. */
307
+ readonly accordionToggleHint: "common.accordionToggleHint";
308
+ /** Default accessible hint on a `StatusBadge` when the caller supplies none. */
309
+ readonly statusBadgeHint: "common.statusBadgeHint";
310
+ /** `ModalShell`: accessible name of the dialog when its title is not a plain string. */
311
+ readonly dialog: "common.dialog";
312
+ /** `ModalShell`: accessible hint on the close button. */
313
+ readonly closeDialogHint: "common.closeDialogHint";
314
+ /** `ModalShell`: accessible name of the close button. */
315
+ readonly close: "quizTemplates.cancel";
316
+ /** `ModalShell`: heading fallback when no title is supplied. */
317
+ readonly closeHeading: "close";
318
+ readonly upgradePromptTitle: "settings.billing.upgradePrompt.title";
319
+ /** Body copy, parameterised: "…requires {{p1}}, you are on {{p2}}." */
320
+ readonly upgradePromptMessage: "settings.billing.upgradePrompt.message";
321
+ readonly upgradePromptCta: "settings.billing.upgradePrompt.cta";
322
+ readonly upgradePromptCtaHint: "settings.billing.upgradePrompt.ctaHint";
323
+ readonly upgradePromptDismiss: "settings.billing.upgradePrompt.dismiss";
324
+ readonly upgradePromptDismissHint: "settings.billing.upgradePrompt.dismissHint";
325
+ };
284
326
 
285
- export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, Heading, type HeadingProps, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, UpgradePrompt, type UpgradePromptProps, useFocusTrap };
327
+ export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, type AccordionVariant, DEFAULT_BILLING_ROUTE, type DropdownOption, type DropdownTriggerState, DropdownVariant, Heading, type HeadingProps, LAYOUT_I18N, LAYOUT_TEST_IDS, ModalDropdown, type ModalDropdownProps, ModalShell, type ModalShellProps, Section, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, StatusBadge, type StatusBadgeProps, UpgradePrompt, type UpgradePromptProps, useFocusTrap };