@dloizides/ui-layout 1.12.2 → 1.13.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/dist/index.js +21 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -45
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -2
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Section/Section.tsx","../src/constants.ts","../src/Heading/Heading.tsx","../src/StatusBadge/StatusBadge.tsx","../src/SegmentedControl/SegmentedControl.tsx","../src/UpgradePrompt/UpgradePrompt.tsx","../src/hooks/useFocusTrap.ts","../src/ModalDropdown/DropdownVariant.ts","../src/ModalDropdown/menuStacking.ts","../src/ModalDropdown/OptionRow.tsx","../src/ModalDropdown/useAnchorTracking.ts","../src/ModalDropdown/useMenuKeyboard.ts","../src/ModalDropdown/InlineMenu.tsx","../src/ModalDropdown/resolveDropdownVariant.ts","../src/ModalDropdown/ModalDropdown.tsx","../src/ModalShell/ModalShell.tsx","../src/Accordion/AccordionContext.ts","../src/Accordion/accordionAnimation.ts","../src/Accordion/Accordion.tsx","../src/Accordion/AccordionItem.tsx","../src/TruncatedText/truncate.ts","../src/TruncatedText/useAvailableWidth.ts","../src/TruncatedText/TruncatedText.tsx"],"names":["React","styles","StyleSheet","useUi","jsx","View","Text","DropdownVariant","BORDER_WIDTH","TouchableOpacity","Platform","useEffect","IS_WEB","BORDER_RADIUS","MENU_PADDING","useRef","useMemo","useState","useCallback","BODY_FONT_SIZE","jsxs","Modal","ScrollView","TITLE_FONT_SIZE","prefersReducedMotion","handleKeyDown","Pressable","SvgIcon","DEFAULT_FONT_SIZE","UNMEASURED"],"mappings":";;;;;;;;AASA,IAAM,MAAA,GAAS,WAAW,MAAA,CAAO;AAAA,EAC/B,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,EAAA;AAAA,IACT,WAAA,EAAa,CAAA;AAAA,IACb,YAA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ACA,aAAA,EAAe,CAAA;AAAA,MACf,OAAO,CAACL,QAAAA,CAAO,IAAA,EAAMA,QAAAA,CAAO,MAAM,KAAK,CAAA;AAAA,MACvC,MAAA;AAAA,MACA,iBAAA,EACE,OAAA,KAAY,MAAA,IAAa,IAAA,KAAS,SAAY,MAAA,GAAS,MAAA;AAAA,MAEzD,kBAAA;AAAA,MACA,iBAAA;AAAA,MACA,OAAA;AAAA,MACC,GAAIS,SAAS,EAAA,KAAO,KAAA,IAAS,SAAS,MAAA,GAAY,EAAE,IAAA,EAAK,GAAI,EAAC;AAAA,MAE9D,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"index.mjs","sourcesContent":["/**\n * Section — a bordered card container that themes its border + surface.\n */\nimport React from 'react';\n\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nconst styles = StyleSheet.create({\n card: {\n padding: 16,\n borderWidth: 1,\n borderRadius: 6,\n },\n});\n\nexport interface SectionProps {\n children?: React.ReactNode;\n style?: ViewStyle | ViewStyle[];\n}\n\nexport const Section = ({ children, style }: SectionProps): React.ReactElement => {\n const { theme } = useUi();\n\n const containerStyle = React.useMemo(\n () => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],\n [theme.colors.border, theme.colors.surface, style],\n );\n\n return <View style={containerStyle}>{children}</View>;\n};\n\nexport default Section;\n","/** Default testIDs — match the apps' existing values so Playwright selectors keep working. */\nexport const LAYOUT_TEST_IDS = {\n headingText: 'heading-text',\n statusLabel: 'status-label',\n upgradePrompt: 'upgrade-prompt',\n upgradePromptCta: 'upgrade-prompt-cta',\n upgradePromptDismiss: 'upgrade-prompt-dismiss',\n modalShell: 'template-modal',\n modalShellClose: 'cancel-button',\n accordion: 'accordion',\n} as const;\n\n/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */\nexport const DEFAULT_BILLING_ROUTE = '/settings/billing';\n\n/**\n * Every translation key this package resolves through `t(...)` — the host app's i18n contract.\n *\n * WHY THIS EXISTS: the kit is deliberately fallback-free. The neutral default `t` returns the key\n * itself, so a host that forgets a key does not silently show English — it shows the raw dotted\n * name to users, or announces it to screen readers. Without a machine-readable manifest each\n * portal had to hand-maintain its ui-layout key list, and hand-maintained lists rot: one app was\n * found missing 26 kit keys (rendering raw names to users), another had `accordionToggleHint`\n * undefined while `Accordion` was mounted, announcing the raw key to assistive tech.\n *\n * Bind a missing-key guard to this map (the same way apps already bind `TABLE_I18N` /\n * `FILTERS_I18N` from `@dloizides/ui-tables`) and an upgrade can never drift unnoticed. Every\n * `t(...)` call in this package references this map, so it cannot fall out of date.\n */\nexport const LAYOUT_I18N = {\n /** Placeholder shown by `ModalDropdown` when no option matches the current value. */\n selectPlaceholder: 'common.selectPlaceholder',\n /** Accessible name + hint of the modal-variant dropdown's dismiss backdrop. */\n dismissDropdown: 'common.dismissDropdown',\n dismissDropdownHint: 'common.dismissDropdownHint',\n /** Accessible hint on a single dropdown option row. */\n selectOptionHint: 'common.selectOptionHint',\n /** Default accessible hint on an `AccordionItem` header when the caller supplies none. */\n accordionToggleHint: 'common.accordionToggleHint',\n /** Default accessible hint on a `StatusBadge` when the caller supplies none. */\n statusBadgeHint: 'common.statusBadgeHint',\n /** `ModalShell`: accessible name of the dialog when its title is not a plain string. */\n dialog: 'common.dialog',\n /** `ModalShell`: accessible hint on the close button. */\n closeDialogHint: 'common.closeDialogHint',\n /** `ModalShell`: accessible name of the close button. */\n close: 'quizTemplates.cancel',\n /** `ModalShell`: heading fallback when no title is supplied. */\n closeHeading: 'close',\n upgradePromptTitle: 'settings.billing.upgradePrompt.title',\n /** Body copy, parameterised: \"…requires {{p1}}, you are on {{p2}}.\" */\n upgradePromptMessage: 'settings.billing.upgradePrompt.message',\n upgradePromptCta: 'settings.billing.upgradePrompt.cta',\n upgradePromptCtaHint: 'settings.billing.upgradePrompt.ctaHint',\n upgradePromptDismiss: 'settings.billing.upgradePrompt.dismiss',\n upgradePromptDismissHint: 'settings.billing.upgradePrompt.dismissHint',\n} as const;\n","/**\n * Heading — themed section heading text.\n */\nimport React from 'react';\n\nimport { StyleSheet, Text } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_TEST_IDS } from '../constants';\n\nconst styles = StyleSheet.create({\n heading: {\n fontWeight: '700',\n fontSize: 16,\n },\n});\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n}\n\nexport const Heading = ({ text, children }: HeadingProps): React.ReactElement => {\n const { theme } = useUi();\n\n const headingStyle = React.useMemo(\n () => [styles.heading, { color: theme.colors.text }],\n [theme.colors.text],\n );\n\n return (\n <Text accessibilityRole=\"header\" style={headingStyle} testID={LAYOUT_TEST_IDS.headingText}>\n {text ?? children}\n </Text>\n );\n};\n\nexport default Heading;\n","/**\n * StatusBadge — unified status pill. Colours are passed in; domain adapters map their\n * enums to label/color/backgroundColor.\n */\nimport React, { useMemo } from 'react';\n\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst DEFAULT_PADDING_H = 10;\nconst DEFAULT_PADDING_V = 4;\nconst DEFAULT_BORDER_RADIUS = 12;\nconst DEFAULT_FONT_SIZE = 12;\n\nconst styles = StyleSheet.create({\n badge: {\n paddingHorizontal: DEFAULT_PADDING_H,\n paddingVertical: DEFAULT_PADDING_V,\n borderRadius: DEFAULT_BORDER_RADIUS,\n alignSelf: 'flex-start',\n },\n text: {\n fontSize: DEFAULT_FONT_SIZE,\n fontWeight: '600',\n },\n});\n\nexport interface StatusBadgeProps {\n label: string;\n color: string;\n backgroundColor: string;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n}\n\nexport const StatusBadge = ({\n label,\n color,\n backgroundColor,\n testID = LAYOUT_TEST_IDS.statusLabel,\n accessibilityLabel,\n accessibilityHint,\n}: StatusBadgeProps): React.ReactElement => {\n const { t } = useUi();\n\n const dynamicBadge = useMemo(() => ({ backgroundColor }), [backgroundColor]);\n const dynamicText = useMemo(() => ({ color }), [color]);\n\n return (\n <View\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint)}\n accessibilityLabel={accessibilityLabel ?? label}\n style={[styles.badge, dynamicBadge]}\n testID={testID}\n >\n <Text style={[styles.text, dynamicText]}>{label}</Text>\n </View>\n );\n};\n\nexport default StatusBadge;\n","/**\n * SegmentedControl — a single rounded pill *track* holding N mutually-exclusive segments\n * (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised surface\n * with a subtle shadow; the rest stay transparent. Promoted from the v1 AML console's\n * `.lf-mode` mode switch so erevna/katalogos/kefi can share ONE toggle instead of\n * hand-rolling two primary/ghost buttons.\n *\n * Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM/router/store/icon\n * imports. Labels are pre-localized strings; every colour is read from the\n * `@dloizides/ui-feedback` UiProvider theme, so it re-skins on tenant swap. Renders as a\n * `tablist` of `tab`s (`accessibilityRole` + `accessibilityState.selected`, which\n * react-native-web forwards to `role`/`aria-selected` on the DOM).\n */\nimport React from 'react';\n\nimport {\n Pressable,\n StyleSheet,\n Text,\n View,\n type PressableProps,\n type StyleProp,\n type ViewStyle,\n} from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nconst TRACK_PADDING = 3;\nconst TRACK_RADIUS = 999;\nconst SEGMENT_RADIUS = 999;\nconst SEGMENT_PAD_H = 15;\nconst SEGMENT_PAD_V = 7;\nconst SEGMENT_FONT = 14;\nconst SEGMENT_WEIGHT = '600';\nconst BORDER_WIDTH = 1;\n\n/**\n * Shadow under the SELECTED segment — matches v1 `.lf-mode__btn[aria-selected] box-shadow`.\n * Expressed as `boxShadow`: the `shadow*` family is deprecated in React Native and logged a\n * deprecation warning on every import of this module.\n */\nconst SEGMENT_BOX_SHADOW = '0px 1px 3px rgba(20, 30, 50, 0.1)';\n/** Android draws `elevation`, not `boxShadow`. */\nconst SHADOW_ELEVATION = 2;\nconst TRANSPARENT = 'transparent';\n\nconst styles = StyleSheet.create({\n track: {\n flexDirection: 'row',\n alignSelf: 'flex-start',\n alignItems: 'center',\n gap: TRACK_PADDING + 1,\n padding: TRACK_PADDING,\n borderRadius: TRACK_RADIUS,\n borderWidth: BORDER_WIDTH,\n },\n segment: {\n paddingHorizontal: SEGMENT_PAD_H,\n paddingVertical: SEGMENT_PAD_V,\n borderRadius: SEGMENT_RADIUS,\n },\n segmentSelected: {\n boxShadow: SEGMENT_BOX_SHADOW,\n elevation: SHADOW_ELEVATION,\n },\n label: {\n fontSize: SEGMENT_FONT,\n fontWeight: SEGMENT_WEIGHT,\n textAlign: 'center',\n },\n});\n\n/**\n * `aria-selected` marks the active tab for assistive tech. react-native's prop types omit\n * `aria-selected`, but react-native-web forwards `aria-*` to the DOM — so we attach it (no\n * `any`) rather than rely on `accessibilityState` (which this RNW build does not map to it).\n */\nfunction ariaSelectedProps(selected: boolean): PressableProps & { 'aria-selected': boolean } {\n return { 'aria-selected': selected };\n}\n\n/** One selectable segment. `value` is what `onChange` emits when it's pressed. */\nexport interface SegmentedOption<V extends string = string> {\n label: string;\n value: V;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n}\n\nexport interface SegmentedControlProps<V extends string = string> {\n /** The segments, left → right. */\n options: ReadonlyArray<SegmentedOption<V>>;\n /** The currently-selected value. */\n value: V;\n /** Fired with a segment's `value` when it is pressed. */\n onChange: (value: V) => void;\n /** Accessible name for the whole group (the `tablist`). */\n accessibilityLabel: string;\n /** Optional style override merged LAST onto the track. */\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * A segmented toggle. Generic over the value union so callers get a typed `onChange`\n * (e.g. `SegmentedControl<'peps' | 'leaders'>`).\n */\nexport function SegmentedControl<V extends string = string>({\n options,\n value,\n onChange,\n accessibilityLabel,\n style,\n testID,\n}: SegmentedControlProps<V>): React.ReactElement {\n const { theme } = useUi();\n const { colors } = theme;\n\n return (\n <View\n accessibilityRole=\"tablist\"\n aria-label={accessibilityLabel}\n style={[styles.track, { backgroundColor: colors.background, borderColor: colors.border }, style]}\n testID={testID}\n >\n {options.map((opt) => {\n const selected = opt.value === value;\n return (\n <Pressable\n key={opt.value}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected }}\n accessibilityLabel={opt.accessibilityLabel ?? opt.label}\n accessibilityHint={opt.accessibilityHint}\n onPress={() => onChange(opt.value)}\n style={[\n styles.segment,\n selected ? styles.segmentSelected : null,\n { backgroundColor: selected ? colors.surface : TRANSPARENT },\n ]}\n testID={opt.testID}\n {...ariaSelectedProps(selected)}\n >\n <Text style={[styles.label, { color: selected ? colors.text : colors.textSecondary }]}>{opt.label}</Text>\n </Pressable>\n );\n })}\n </View>\n );\n}\n\nexport default SegmentedControl;\n","/**\n * UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the\n * billing route via the injected navigate (default route overridable).\n */\nimport React from 'react';\n\nimport { StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS, DEFAULT_BILLING_ROUTE } from '../constants';\n\nconst PROMPT_PADDING = 20;\nconst PROMPT_BORDER_RADIUS = 12;\nconst PROMPT_BORDER_WIDTH = 1;\nconst TITLE_FONT_SIZE = 16;\nconst MESSAGE_FONT_SIZE = 14;\nconst BUTTON_PADDING_V = 12;\nconst BUTTON_BORDER_RADIUS = 8;\nconst BUTTON_FONT_SIZE = 14;\nconst DISMISS_FONT_SIZE = 13;\nconst TITLE_MARGIN_BOTTOM = 8;\nconst MESSAGE_MARGIN_BOTTOM = 16;\nconst CTA_MARGIN_BOTTOM = 8;\n\nconst styles = StyleSheet.create({\n container: {\n padding: PROMPT_PADDING,\n borderRadius: PROMPT_BORDER_RADIUS,\n borderWidth: PROMPT_BORDER_WIDTH,\n },\n title: { fontSize: TITLE_FONT_SIZE, fontWeight: '700', marginBottom: TITLE_MARGIN_BOTTOM },\n message: { fontSize: MESSAGE_FONT_SIZE, marginBottom: MESSAGE_MARGIN_BOTTOM },\n cta: { paddingVertical: BUTTON_PADDING_V, borderRadius: BUTTON_BORDER_RADIUS, alignItems: 'center', marginBottom: CTA_MARGIN_BOTTOM },\n ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: '700' },\n dismiss: { alignItems: 'center', paddingVertical: BUTTON_PADDING_V },\n dismissText: { fontSize: DISMISS_FONT_SIZE },\n});\n\nexport interface UpgradePromptProps {\n /** Human-readable name of the required tier (e.g. \"Pro\"). */\n requiredTier: string;\n /** Current tier name (e.g. \"Free\"). */\n currentTier: string;\n /** Called when the user dismisses the prompt. */\n onDismiss?: () => void;\n /** Route the CTA navigates to (defaults to the billing settings path). */\n billingRoute?: string;\n}\n\nexport const UpgradePrompt = ({\n requiredTier,\n currentTier,\n onDismiss,\n billingRoute = DEFAULT_BILLING_ROUTE,\n}: UpgradePromptProps): React.ReactElement => {\n const { theme, t, navigate } = useUi();\n const colors = theme.colors;\n const primary = theme.palette.primary['500'];\n\n function handleUpgradePress(): void {\n if (typeof navigate === 'function') navigate(billingRoute);\n }\n\n return (\n <View\n style={[styles.container, { borderColor: primary, backgroundColor: colors.surface }]}\n testID={LAYOUT_TEST_IDS.upgradePrompt}\n >\n <Text style={[styles.title, { color: colors.text }]}>\n {t(LAYOUT_I18N.upgradePromptTitle)}\n </Text>\n\n <Text style={[styles.message, { color: colors.textSecondary }]}>\n {t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier)}\n </Text>\n\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.upgradePromptCtaHint)}\n accessibilityLabel={t(LAYOUT_I18N.upgradePromptCta)}\n accessibilityRole=\"button\"\n style={[styles.cta, { backgroundColor: primary }]}\n testID={LAYOUT_TEST_IDS.upgradePromptCta}\n onPress={handleUpgradePress}\n >\n <Text style={[styles.ctaText, { color: colors.surface }]}>\n {t(LAYOUT_I18N.upgradePromptCta)}\n </Text>\n </TouchableOpacity>\n\n {onDismiss ? (\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.upgradePromptDismissHint)}\n accessibilityLabel={t(LAYOUT_I18N.upgradePromptDismiss)}\n accessibilityRole=\"button\"\n style={styles.dismiss}\n testID={LAYOUT_TEST_IDS.upgradePromptDismiss}\n onPress={onDismiss}\n >\n <Text style={[styles.dismissText, { color: colors.textSecondary }]}>\n {t(LAYOUT_I18N.upgradePromptDismiss)}\n </Text>\n </TouchableOpacity>\n ) : null}\n </View>\n );\n};\n\nexport default UpgradePrompt;\n","/**\n * Traps keyboard focus within a container element on web.\n * No-op on native platforms where `<Modal>` handles focus containment.\n *\n * On enable: saves the previously focused element and focuses the first focusable child.\n * Tab wraps from last to first; Shift+Tab wraps from first to last. On disable/unmount:\n * restores focus to the saved element.\n */\nimport { useEffect, useRef } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View } from 'react-native';\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(', ');\n\nfunction getFocusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n}\n\nfunction savePreviousFocus(): HTMLElement | null {\n return document.activeElement instanceof HTMLElement ? document.activeElement : null;\n}\n\nfunction handleKeyDown(domNode: HTMLElement, event: KeyboardEvent): void {\n if (event.key !== 'Tab') return;\n\n const focusable = getFocusableElements(domNode);\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (!first || !last) {\n event.preventDefault();\n return;\n }\n const active = document.activeElement;\n\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n}\n\nexport function useFocusTrap(containerRef: RefObject<View | null>, enabled: boolean): void {\n const previousFocusRef = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\n const domNode = containerRef.current as unknown as HTMLElement | null;\n if (!domNode) return;\n\n previousFocusRef.current = savePreviousFocus();\n queueMicrotask(() => getFocusableElements(domNode)[0]?.focus());\n\n const listener = (e: KeyboardEvent): void => handleKeyDown(domNode, e);\n domNode.addEventListener('keydown', listener);\n\n return () => {\n domNode.removeEventListener('keydown', listener);\n previousFocusRef.current?.focus();\n previousFocusRef.current = null;\n };\n }, [containerRef, enabled]);\n}\n","/**\n * How a {@link ModalDropdown} renders its list of options.\n *\n * Exported as a regular (non-`const`) enum on purpose: `const enum` values are\n * inlined at compile time and cannot cross a published-package boundary when the\n * consumer bundles with `isolatedModules` (esbuild / vite / babel — i.e. every\n * app that consumes this package). A regular enum emits a runtime object that is\n * safe to import and compare in any consumer.\n */\nexport enum DropdownVariant {\n /** Inline popover anchored directly under the trigger — the native `<select>` feel. */\n Menu = 'menu',\n /** Full modal / bottom-sheet overlay with a scrim (the original behaviour). */\n Modal = 'modal',\n}\n","/**\n * menuStacking — the stacking/positioning geometry for the inline dropdown menu.\n *\n * WHY THIS EXISTS (the bug it fixes): react-native-web renders **every** `View` with\n * `position: relative; z-index: 0`, so every View is its OWN stacking context. An inline\n * popover rendered `position:absolute` under its anchor therefore has its `zIndex` trapped\n * inside the anchor's (and the app's field wrapper's) `z-index: 0` context — it can never\n * rise above later-painting sibling Views (adjacent filter fields, the results table, cards).\n * That is why the open menu painted UNDERNEATH following content on wide/desktop web.\n *\n * THE FIX: on web the menu is rendered in a PORTAL to `document.body` with `position: fixed`\n * at the trigger's measured viewport rect and a high `zIndex`. A portal escapes every ancestor\n * stacking context AND every ancestor `overflow: hidden`, so the menu always paints on top and\n * is never clipped — the same \"menu above the table\" outcome the `@dloizides/ui-tables`\n * `SizeDropdown` achieves. On native the menu stays in-tree (`position:absolute` + `elevation`),\n * and the anchor gets a raised `zIndex` while open as defence-in-depth for direct siblings.\n *\n * These builders are pure so the stacking behaviour is unit-testable without RN-web's\n * class-name-based styling (which does not surface as inline DOM styles).\n */\nimport type { ViewStyle } from 'react-native';\n\n/** z-index for the open menu popover — high enough to clear app chrome (tables, cards, fields). */\nexport const MENU_Z_INDEX = 1000;\n/** z-index lifted onto the anchor WRAPPER while the menu is open (native/defence-in-depth). */\nexport const ANCHOR_OPEN_Z_INDEX = 1000;\n/** Native drop shadow depth so the popover reads as floating above the page. */\nexport const MENU_ELEVATION = 8;\n/** Gap between the trigger's bottom edge and the popover's top edge. */\nexport const MENU_TOP_GAP = 4;\n/** The popover scrolls past this height rather than growing unbounded. */\nexport const MENU_MAX_HEIGHT = 300;\n\nconst BORDER_RADIUS = 8;\nconst BORDER_WIDTH = 1;\nconst MENU_PADDING = 4;\n/** Soft drop shadow so the popover reads as floating above the page (web). */\nexport const MENU_BOX_SHADOW = '0px 2px 8px rgba(0, 0, 0, 0.15)';\n\n/** The trigger's viewport-space rect (from `getBoundingClientRect`) needed to place a fixed menu. */\nexport interface AnchorRect {\n top: number;\n left: number;\n width: number;\n bottom: number;\n}\n\n/**\n * Web portal popover style: `position: fixed` at the trigger rect with a high `zIndex`. Because\n * it is portalled to `document.body`, `fixed` positions it against the viewport, so it tracks the\n * trigger via the measured rect (recomputed on scroll/resize) and is clipped by nothing.\n *\n * The popover matches the trigger's width — right for a full-width field, but a COMPACT anchor (a\n * locale pill, an avatar chip, an icon button) would then get a menu too narrow to read its own\n * option labels. `minWidth` sets a floor for exactly that case; it never shrinks a menu.\n */\nexport function buildPortalPopoverStyle(rect: AnchorRect, minWidth = 0): ViewStyle {\n return {\n // RN's ViewStyle union omits 'fixed', but react-native-web honours it at runtime.\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- web-only position value\n position: 'fixed' as unknown as ViewStyle['position'],\n top: rect.bottom + MENU_TOP_GAP,\n left: rect.left,\n width: Math.max(rect.width, minWidth),\n zIndex: MENU_Z_INDEX,\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n padding: MENU_PADDING,\n maxHeight: MENU_MAX_HEIGHT,\n boxShadow: MENU_BOX_SHADOW,\n elevation: MENU_ELEVATION,\n };\n}\n\n/**\n * Anchor-wrapper stacking style: while the inline menu is open the wrapper is lifted to a raised\n * `zIndex` so it wins over immediate sibling views (defence-in-depth on top of the web portal;\n * the primary stacking behaviour on native). Returns `null` when closed so nothing changes.\n */\nexport function buildAnchorStackStyle(isMenuOpen: boolean): ViewStyle | null {\n return isMenuOpen ? { zIndex: ANCHOR_OPEN_Z_INDEX, elevation: MENU_ELEVATION } : null;\n}\n\n/**\n * The window the trigger is actually visible through: the viewport intersected with every\n * ancestor that clips (a scroll container, an `overflow: hidden` panel).\n */\nexport interface ClipBounds {\n top: number;\n left: number;\n bottom: number;\n right: number;\n}\n\n/**\n * Below this many pixels visible in either axis the trigger is, to a user, gone — so the menu\n * must not keep hanging off it. A few pixels rather than zero, because a trigger pinned at the\n * very edge of a scroll container that has bottomed out never reaches zero (see below).\n */\nexport const MIN_VISIBLE_PX = 8;\n\n/**\n * True when the trigger is no longer meaningfully visible, so an anchored menu would be pointing\n * at nothing and must close. Repositioning cannot solve this case — the menu simply follows its\n * trigger out of sight and hangs over unrelated content.\n *\n * TWO THINGS THIS DELIBERATELY IS NOT (both were shipped as bugs in 1.10.0):\n *\n * 1. **Not \"outside the viewport\".** RN-web apps scroll an inner `ScrollView`, not the document.\n * A trigger scrolled out of that inner scroller is invisible to the user while its rect is\n * still comfortably inside the viewport — a viewport-only test can never fire. Visibility is\n * therefore measured against `clip`, the intersection of the viewport with every clipping\n * ancestor. (The RECT stays viewport-relative, which is why repositioning worked throughout.)\n * 2. **Not \"entirely hidden\".** When a scroll container reaches the end of its range the trigger\n * stops with a sliver still inside the clip window — the real-world case was 4px — so \"fully\n * out\" is unreachable and the menu never closed. A small visible-pixel floor fixes that.\n */\nexport function isAnchorHidden(rect: AnchorRect, clip: ClipBounds, minVisiblePx: number): boolean {\n // A zero-AREA rect means \"not laid out yet\" — NOT \"off-screen\". Note this asks only about the\n // element's OWN box, never about where it sits: a trigger scrolled far out of view still has\n // its full width and height, so this can never swallow a genuine hidden case.\n const hasLayout = rect.width > 0 && rect.bottom > rect.top;\n const hasClip = clip.bottom > clip.top && clip.right > clip.left;\n if (!hasLayout || !hasClip) return false;\n\n const visibleHeight = Math.min(rect.bottom, clip.bottom) - Math.max(rect.top, clip.top);\n const visibleWidth = Math.min(rect.left + rect.width, clip.right) - Math.max(rect.left, clip.left);\n return visibleHeight < minVisiblePx || visibleWidth < minVisiblePx;\n}\n","/**\n * OptionRow — a single selectable option, shared by both the modal and the inline\n * menu variants of ModalDropdown so selection/rendering logic is never duplicated.\n */\nimport React, { useCallback } from 'react';\n\nimport { StyleSheet, Text, TouchableOpacity } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N } from '../constants';\n\nconst OPTION_BORDER_RADIUS = 4;\nconst BODY_FONT_SIZE = 14;\nconst SELECTED_FONT_WEIGHT = '600' as const;\nconst OPTION_PADDING_H = 16;\nconst OPTION_PADDING_V = 12;\n\nconst styles = StyleSheet.create({\n option: {\n paddingHorizontal: OPTION_PADDING_H,\n paddingVertical: OPTION_PADDING_V,\n borderRadius: OPTION_BORDER_RADIUS,\n },\n optionText: { fontSize: BODY_FONT_SIZE },\n selectedText: { fontWeight: SELECTED_FONT_WEIGHT },\n});\n\nexport interface OptionRowProps {\n testID: string;\n label: string;\n isSelected: boolean;\n /** Keyboard-highlighted row (arrow-key navigation) in the inline menu. */\n isHighlighted?: boolean;\n onSelect: () => void;\n}\n\nexport const OptionRow = ({\n testID,\n label,\n isSelected,\n isHighlighted = false,\n onSelect,\n}: OptionRowProps): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n\n const handlePress = useCallback(() => { onSelect(); }, [onSelect]);\n\n const isActive = isSelected || isHighlighted;\n const rowStyle = [styles.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];\n const textStyle = [styles.optionText, { color: colors.text }, isSelected ? styles.selectedText : null];\n\n return (\n <TouchableOpacity\n accessible\n accessibilityHint={t(LAYOUT_I18N.selectOptionHint)}\n accessibilityLabel={label}\n accessibilityRole=\"button\"\n aria-selected={isSelected}\n style={rowStyle}\n testID={testID}\n onPress={handlePress}\n >\n <Text style={textStyle}>{label}</Text>\n </TouchableOpacity>\n );\n};\n\nexport default OptionRow;\n","/**\n * useAnchorTracking — keeps the fixed-positioned web popover glued to its trigger.\n *\n * WHY THIS IS HARDER THAN IT LOOKS: on web the menu is portalled to `document.body` with\n * `position: fixed` at the trigger's rect measured AT OPEN TIME. `fixed` is viewport-relative, so\n * the coordinate is only valid until something moves the trigger — after that the menu floats,\n * detached, over unrelated content.\n *\n * The original implementation listened for `scroll` (capture) + `resize` on `window`. That covers\n * scrolling, but leaves three real gaps this hook closes:\n *\n * 1. **Layout changes that fire no scroll event at all** — an accordion above the trigger\n * expanding, a sticky header changing height, a banner appearing, an async list rendering,\n * a font swapping. The trigger moves; nothing scrolls; no listener fires. A `ResizeObserver`\n * on the anchor and on `document.body` catches these.\n * 2. **The trigger leaving the viewport.** Repositioning alone cannot help here — the menu just\n * follows its trigger off-screen and hangs over unrelated content. We close instead\n * (see {@link isAnchorOutOfView}).\n * 3. **Layout thrash.** The old handler ran a synchronous `getBoundingClientRect()` (a forced\n * reflow) plus a React state update on EVERY scroll event — potentially hundreds per second\n * during a momentum scroll. Work is now coalesced into one `requestAnimationFrame` per frame.\n *\n * Scroll is observed in the CAPTURE phase on `document` so a scroll inside ANY ancestor scroll\n * container counts — element `scroll` events do not bubble, so a bubble-phase listener would only\n * ever see the document scroller.\n *\n * No-op on native, where the popover is an in-tree absolutely-positioned child that moves with its\n * anchor automatically.\n */\nimport { useLayoutEffect, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { MIN_VISIBLE_PX, isAnchorHidden, type AnchorRect, type ClipBounds } from './menuStacking';\n\nconst IS_WEB = Platform.OS === 'web';\n\n/** The RN-web `View` ref is an `HTMLElement` at runtime; native refs are not. */\nfunction toDomNode(containerRef: RefObject<RNView | null>): HTMLElement | null {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\n const node = containerRef.current as unknown as HTMLElement | null;\n if (node === null || typeof node.getBoundingClientRect !== 'function') return null;\n return node;\n}\n\n/** Read the anchor's viewport rect (web only). Returns null when unavailable (native / no node). */\nexport function readAnchorRect(containerRef: RefObject<RNView | null>): AnchorRect | null {\n if (!IS_WEB) return null;\n const node = toDomNode(containerRef);\n if (node === null) return null;\n const r = node.getBoundingClientRect();\n return { top: r.top, left: r.left, width: r.width, bottom: r.bottom };\n}\n\n/** Does this element clip its children on the given axis (a scroll container, an overflow panel)? */\nfunction clipsAxis(overflow: string): boolean {\n return overflow !== '' && overflow !== 'visible';\n}\n\n/** Narrow `bounds` to `el`'s box on whichever axes `el` clips. */\nfunction clipToAncestor(bounds: ClipBounds, el: HTMLElement): void {\n const style = window.getComputedStyle(el);\n // The per-axis longhands are authoritative, but fall back to the `overflow` shorthand: not every\n // environment expands it (jsdom does not), and a missed clipping ancestor silently disables the\n // out-of-view close — the exact class of failure this whole hook exists to prevent.\n const clipsY = clipsAxis(style.overflowY) || clipsAxis(style.overflow);\n const clipsX = clipsAxis(style.overflowX) || clipsAxis(style.overflow);\n if (!clipsY && !clipsX) return;\n const r = el.getBoundingClientRect();\n if (clipsY) {\n bounds.top = Math.max(bounds.top, r.top);\n bounds.bottom = Math.min(bounds.bottom, r.bottom);\n }\n if (clipsX) {\n bounds.left = Math.max(bounds.left, r.left);\n bounds.right = Math.min(bounds.right, r.right);\n }\n}\n\n/**\n * The window the anchor is actually visible through: the viewport narrowed by every clipping\n * ancestor. THIS is what makes the out-of-view check work in an RN-web app, where the document\n * never scrolls and every screen lives inside an inner `ScrollView` — a trigger scrolled out of\n * that scroller is invisible while its rect is still inside the viewport.\n */\nexport function readClipBounds(node: HTMLElement | null): ClipBounds {\n const bounds: ClipBounds = { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };\n let el = node?.parentElement ?? null;\n while (el !== null && el !== document.body && el !== document.documentElement) {\n clipToAncestor(bounds, el);\n el = el.parentElement;\n }\n return bounds;\n}\n\n/**\n * Watch the anchor (and the page) for size/layout changes that move the trigger WITHOUT scrolling.\n * Returns null where `ResizeObserver` is unavailable (older browsers, jsdom) — the scroll/resize\n * listeners still apply, so tracking degrades rather than breaking.\n */\nfunction observeLayout(node: HTMLElement | null, onChange: () => void): ResizeObserver | null {\n if (typeof ResizeObserver !== 'function') return null;\n const observer = new ResizeObserver(onChange);\n if (node !== null) observer.observe(node);\n observer.observe(document.body);\n return observer;\n}\n\n/**\n * Track `containerRef`'s viewport rect while the menu is open.\n *\n * @param containerRef the anchor wrapper holding the trigger.\n * @param onOutOfView called once the anchor has left the viewport — the caller closes the menu.\n * Must be referentially stable (a `useCallback` with no deps), or the listeners re-subscribe.\n */\nexport function useAnchorTracking(\n containerRef: RefObject<RNView | null>,\n onOutOfView: () => void,\n): AnchorRect | null {\n const [rect, setRect] = useState<AnchorRect | null>(() => readAnchorRect(containerRef));\n\n useLayoutEffect(() => {\n if (!IS_WEB) return undefined;\n let frame: number | null = null;\n let isDisposed = false;\n let hasMeasured = false;\n\n const apply = (): void => {\n frame = null;\n if (isDisposed) return;\n const next = readAnchorRect(containerRef);\n setRect(next);\n // Never close on the FIRST measurement. Opening a dropdown whose trigger is already partly\n // clipped must still work; only movement AFTER the menu is open may close it.\n const isHidden =\n next !== null && isAnchorHidden(next, readClipBounds(toDomNode(containerRef)), MIN_VISIBLE_PX);\n if (hasMeasured && isHidden) onOutOfView();\n hasMeasured = true;\n };\n\n // Coalesce a burst of scroll/resize/layout events into a single measurement per frame.\n const schedule = (): void => {\n if (frame !== null) return;\n frame = window.requestAnimationFrame(apply);\n };\n\n apply();\n document.addEventListener('scroll', schedule, true);\n window.addEventListener('resize', schedule);\n const observer = observeLayout(toDomNode(containerRef), schedule);\n\n return () => {\n isDisposed = true;\n if (frame !== null) window.cancelAnimationFrame(frame);\n document.removeEventListener('scroll', schedule, true);\n window.removeEventListener('resize', schedule);\n if (observer !== null) observer.disconnect();\n };\n }, [containerRef, onOutOfView]);\n\n return rect;\n}\n","/**\n * useMenuKeyboard — web-only keyboard navigation + click-outside dismissal for the\n * inline dropdown menu. No-op on native platforms (the modal variant is used there).\n *\n * While enabled it wires, on `document`:\n * - ArrowDown / ArrowUp — move the highlight (clamped to the option range)\n * - Home / End — jump to first / last option\n * - Enter — select the highlighted option\n * - Escape — close the menu\n * - mousedown outside the container AND the menu — close the menu\n *\n * On web the menu popover is portalled to `document.body` (to escape ancestor stacking contexts),\n * so it is NOT a DOM descendant of `containerRef`. The outside-click check therefore consults the\n * optional `menuRef` too, otherwise a mousedown on an option would count as \"outside\" and close the\n * menu before the option's click could select it.\n *\n * WHY THE KEY LISTENER IS ON THE **CAPTURE** PHASE (a real bug this fixes): the trigger keeps DOM\n * focus while the menu is open, and react-native-web maps Enter on a focused Touchable to `onPress`.\n * React dispatches that from its ROOT container listener — an ancestor of the trigger but a\n * DESCENDANT of `document` — so on a BUBBLING listener React's handler ran FIRST: it toggled the\n * menu shut, React unmounted the popover, this effect's cleanup removed the very listener the event\n * was still travelling toward, and `document` never saw the Enter. Net effect: **Enter closed the\n * menu instead of selecting the highlighted option** — keyboard users could open and navigate a\n * dropdown but never choose with the keyboard. Listening in the CAPTURE phase puts this handler\n * ahead of React's, and `stopPropagation` on the keys the open menu owns keeps the trigger from\n * re-toggling behind our back.\n */\nimport { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View } from 'react-native';\n\nexport interface MenuKeyboardParams {\n containerRef: RefObject<View | null>;\n /** The popover node (portalled on web); clicks inside it are NOT \"outside\". */\n menuRef?: RefObject<View | null>;\n enabled: boolean;\n itemCount: number;\n onHighlightChange: (next: (prev: number) => number) => void;\n onSelectHighlighted: () => void;\n onClose: () => void;\n}\n\n/** True when `target` is inside the DOM node held by `ref` (RN-web refs are HTMLElements at runtime). */\nfunction refContains(ref: RefObject<View | null> | undefined, target: Node | null): boolean {\n if (ref === undefined) return false;\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\n const node = ref.current as unknown as HTMLElement | null;\n return node !== null && target !== null && node.contains(target);\n}\n\nconst clampIndex = (index: number, itemCount: number): number => {\n if (index < 0) return 0;\n const lastIndex = itemCount - 1;\n return index > lastIndex ? lastIndex : index;\n};\n\n/**\n * An OPEN menu owns these keys: swallow them so the still-focused trigger (whose Enter\n * react-native-web maps to `onPress`) cannot toggle the menu shut behind the handler's back.\n */\nfunction claimKey(event: KeyboardEvent): void {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction buildKeyHandler(params: MenuKeyboardParams): (event: KeyboardEvent) => void {\n const { itemCount, onHighlightChange, onSelectHighlighted, onClose } = params;\n\n return (event: KeyboardEvent): void => {\n switch (event.key) {\n case 'ArrowDown':\n claimKey(event);\n onHighlightChange((prev) => clampIndex(prev + 1, itemCount));\n return;\n case 'ArrowUp':\n claimKey(event);\n onHighlightChange((prev) => clampIndex(prev - 1, itemCount));\n return;\n case 'Home':\n claimKey(event);\n onHighlightChange(() => 0);\n return;\n case 'End':\n claimKey(event);\n onHighlightChange(() => clampIndex(itemCount - 1, itemCount));\n return;\n case 'Enter':\n claimKey(event);\n onSelectHighlighted();\n return;\n case 'Escape':\n claimKey(event);\n onClose();\n return;\n default:\n }\n };\n}\n\nexport function useMenuKeyboard(params: MenuKeyboardParams): void {\n const { containerRef, menuRef, enabled, onClose } = params;\n\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n const onKeyDown = buildKeyHandler(params);\n\n const onMouseDown = (event: MouseEvent): void => {\n const target = event.target instanceof Node ? event.target : null;\n const insideAnchor = refContains(containerRef, target);\n const insideMenu = refContains(menuRef, target);\n if (!insideAnchor && !insideMenu) onClose();\n };\n\n // CAPTURE phase — see the file header: on the bubble phase React's root listener (the trigger's\n // Enter → onPress) ran first, closed the menu, and unmounted this listener mid-flight, so Enter\n // never selected. Capture puts the open menu's keys ahead of it.\n document.addEventListener('keydown', onKeyDown, true);\n document.addEventListener('mousedown', onMouseDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown, true);\n document.removeEventListener('mousedown', onMouseDown);\n };\n // `params` is rebuilt each render; the primitive/callback members it carries are the real deps.\n }, [containerRef, menuRef, enabled, onClose, params]);\n}\n","/**\n * InlineMenu — the anchored inline dropdown popover (web-native `<select>` feel).\n *\n * Dismissible via click-outside / Escape and navigable with the arrow keys + Enter (see\n * {@link useMenuKeyboard}). It reuses {@link OptionRow} for rendering/selection so no option\n * logic is duplicated.\n *\n * STACKING (the bug this file fixes): react-native-web gives every `View`\n * `position: relative; z-index: 0`, making each View its own stacking context. An absolutely\n * positioned popover therefore has its `zIndex` trapped inside its anchor/field wrapper and paints\n * UNDER later siblings (adjacent filter fields, the results table, cards). To escape that, on WEB\n * the popover is rendered in a PORTAL to `document.body` with `position: fixed` at the trigger's\n * measured viewport rect and a high `zIndex` — clipped by nothing, above everything. On native it\n * stays in-tree (`position:absolute` + `elevation`). See {@link menuStacking}.\n *\n * The `containerRef` is the relatively-positioned wrapper owned by ModalDropdown that holds the\n * trigger; on native the popover renders inside it. On web the popover lives in the portal, so\n * outside-click detection also consults this popover's own node (`menuRef`).\n *\n * `position: fixed` is viewport-relative, so the measured rect goes stale the moment anything moves\n * the trigger. {@link useAnchorTracking} owns keeping the two together — and closes the menu once\n * the trigger has left the viewport, rather than leaving it orphaned over unrelated content.\n */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { Platform, ScrollView, StyleSheet, View } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport type { DropdownOption } from './dropdownTypes';\nimport {\n MENU_BOX_SHADOW,\n MENU_ELEVATION,\n MENU_MAX_HEIGHT,\n MENU_TOP_GAP,\n MENU_Z_INDEX,\n buildPortalPopoverStyle,\n} from './menuStacking';\nimport { OptionRow } from './OptionRow';\nimport { useAnchorTracking } from './useAnchorTracking';\nimport { useMenuKeyboard } from './useMenuKeyboard';\n\nconst IS_WEB = Platform.OS === 'web';\n\nconst BORDER_RADIUS = 8;\nconst BORDER_WIDTH = 1;\nconst MENU_PADDING = 4;\n\nconst styles = StyleSheet.create({\n /** Native (in-tree) popover — anchored absolutely just under the trigger. */\n popover: {\n position: 'absolute',\n top: '100%',\n left: 0,\n right: 0,\n marginTop: MENU_TOP_GAP,\n zIndex: MENU_Z_INDEX,\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n padding: MENU_PADDING,\n maxHeight: MENU_MAX_HEIGHT,\n boxShadow: MENU_BOX_SHADOW,\n elevation: MENU_ELEVATION,\n },\n});\n\nexport interface InlineMenuProps<T> {\n testID: string;\n accessibilityLabel: string;\n value: T;\n options: ReadonlyArray<DropdownOption<T>>;\n containerRef: RefObject<RNView | null>;\n /** Custom testID per option row. Defaults to `` `${testID}-option-${value}` ``. */\n optionTestID?: (value: T) => string;\n /** Minimum popover width — a floor for COMPACT anchors, whose width cannot fit an option label. */\n menuMinWidth?: number;\n onSelect: (value: T) => void;\n onClose: () => void;\n}\n\nexport const InlineMenu = <T extends string | number>({\n testID,\n accessibilityLabel,\n value,\n options,\n containerRef,\n optionTestID,\n menuMinWidth = 0,\n onSelect,\n onClose,\n}: InlineMenuProps<T>): React.ReactElement | null => {\n const { theme } = useUi();\n const { colors } = theme;\n\n const menuRef = useRef<RNView>(null);\n // Tracks the trigger while open, and closes rather than orphaning the menu once the trigger\n // has scrolled out of the viewport entirely.\n const rect = useAnchorTracking(containerRef, onClose);\n\n const selectedIndex = useMemo(\n () => Math.max(0, options.findIndex((opt) => opt.value === value)),\n [options, value],\n );\n // Lazy init: start the keyboard highlight on the currently-selected option.\n const [highlightedIndex, setHighlightedIndex] = useState<number>(() => selectedIndex);\n\n const selectAt = useCallback(\n (index: number) => {\n const option = options[index];\n if (option !== undefined) onSelect(option.value);\n },\n [options, onSelect],\n );\n\n const selectHighlighted = useCallback(\n () => { selectAt(highlightedIndex); },\n [selectAt, highlightedIndex],\n );\n\n useMenuKeyboard({\n containerRef,\n menuRef,\n enabled: true,\n itemCount: options.length,\n onHighlightChange: setHighlightedIndex,\n onSelectHighlighted: selectHighlighted,\n onClose,\n });\n\n const popoverStyle = useMemo(() => {\n const themed = { borderColor: colors.border, backgroundColor: colors.surface };\n // Web: fixed-positioned in a portal at the measured trigger rect (escapes stacking + clipping).\n if (IS_WEB)\n return [\n buildPortalPopoverStyle(rect ?? { top: 0, left: 0, width: 0, bottom: 0 }, menuMinWidth),\n themed,\n ];\n // Native: in-tree absolute popover under the trigger (stretched to the anchor, floored the same).\n return [styles.popover, { minWidth: menuMinWidth }, themed];\n }, [colors.border, colors.surface, menuMinWidth, rect]);\n\n const menu = (\n <View\n ref={menuRef}\n accessibilityRole=\"menu\"\n aria-label={accessibilityLabel}\n style={popoverStyle}\n testID={`${testID}-menu`}\n >\n <ScrollView keyboardShouldPersistTaps=\"handled\">\n {options.map((option, index) => (\n <OptionRow\n key={String(option.value)}\n isHighlighted={index === highlightedIndex}\n isSelected={option.value === value}\n label={option.label}\n testID={\n optionTestID !== undefined ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`\n }\n onSelect={() => onSelect(option.value)}\n />\n ))}\n </ScrollView>\n </View>\n );\n\n // Portal to document.body on web so no ancestor stacking context / overflow can trap or clip it.\n if (IS_WEB) return createPortal(menu, document.body);\n return menu;\n};\n\nexport default InlineMenu;\n","/**\n * Responsive resolution of the effective {@link DropdownVariant}.\n *\n * `resolveDropdownVariant` is a pure function (easy to unit-test with a mocked\n * width); `useResolvedDropdownVariant` is the thin hook that feeds it the live\n * viewport width + platform.\n */\nimport { Platform, useWindowDimensions } from 'react-native';\n\nimport { DropdownVariant } from './DropdownVariant';\n\n/**\n * At or above this viewport width (web only) the dropdown defaults to the inline\n * anchored menu; below it — or on any native platform — it defaults to the modal.\n */\nexport const MENU_BREAKPOINT = 768;\n\n/** The web platform key that {@link Platform.OS} reports under react-native-web. */\nconst WEB_PLATFORM = 'web';\n\n/**\n * Pure resolver. An explicit `variant` always wins; otherwise the inline\n * {@link DropdownVariant.Menu} is chosen on wide web viewports and\n * {@link DropdownVariant.Modal} on narrow web or any native platform.\n */\nexport function resolveDropdownVariant(\n explicit: DropdownVariant | undefined,\n width: number,\n platformOS: string,\n): DropdownVariant {\n if (explicit !== undefined) return explicit;\n\n const isWideWeb = platformOS === WEB_PLATFORM && width >= MENU_BREAKPOINT;\n return isWideWeb ? DropdownVariant.Menu : DropdownVariant.Modal;\n}\n\n/** Hook wrapper that reads the live viewport width + platform and resolves the variant. */\nexport function useResolvedDropdownVariant(\n explicit: DropdownVariant | undefined,\n): DropdownVariant {\n const { width } = useWindowDimensions();\n return resolveDropdownVariant(explicit, width, Platform.OS);\n}\n","/**\n * ModalDropdown — generic dropdown selector (any value type via generics).\n *\n * Renders as either an inline anchored menu (web-native `<select>` feel) or a\n * modal / bottom-sheet, selectable per screen via the `variant` prop. When\n * `variant` is omitted the choice is **responsive**: inline menu on wide/desktop\n * web, modal on narrow/mobile (and always modal on native). Existing callers that\n * never passed `variant` therefore get the inline-on-desktop behaviour for free.\n *\n * Both variants share {@link OptionRow} for option rendering + selection.\n */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { FlatList, Modal, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useUi, MODAL_OVERLAY_COLOR } from '@dloizides/ui-feedback';\n\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { DropdownVariant } from './DropdownVariant';\nimport type { DropdownOption } from './dropdownTypes';\nimport { InlineMenu } from './InlineMenu';\nimport { buildAnchorStackStyle } from './menuStacking';\nimport { OptionRow } from './OptionRow';\nimport { useResolvedDropdownVariant } from './resolveDropdownVariant';\n\nimport { LAYOUT_I18N } from '../constants';\n\n/** State handed to a custom trigger renderer. */\nexport interface DropdownTriggerState {\n /** The selected option's label (or the select placeholder when nothing matches). */\n label: string;\n /** Whether the menu is currently open. */\n isOpen: boolean;\n}\n\nexport interface ModalDropdownProps<T> {\n testID: string;\n accessibilityLabel: string;\n accessibilityHint: string;\n value: T;\n options: ReadonlyArray<DropdownOption<T>>;\n onChange: (value: T) => void;\n /**\n * Force a rendering variant. When omitted the dropdown is **responsive**:\n * an inline anchored menu on wide/desktop web, a modal on narrow/mobile\n * (and always a modal on native). An explicit value overrides the auto choice.\n */\n variant?: DropdownVariant;\n /**\n * Custom ANCHOR content. When supplied, the caller owns the trigger's visuals\n * entirely (the default bordered field box is not rendered) — use it for compact\n * chips / avatars / icon triggers. The a11y wrapper (role=button, `aria-expanded`,\n * the label + hint, the testID) is still supplied by the dropdown, so a custom\n * trigger cannot drop the accessible contract. Omit for the default field look.\n */\n renderTrigger?: (state: DropdownTriggerState) => React.ReactNode;\n /**\n * Custom testID per option row. Defaults to `` `${testID}-option-${value}` ``.\n * Lets a caller keep a pre-existing selector stable when a flat control becomes\n * a dropdown.\n */\n optionTestID?: (value: T) => string;\n /**\n * Minimum width of the open inline menu. The menu otherwise matches the TRIGGER's width, which\n * is right for a full-width field but leaves a COMPACT anchor (a locale pill, an avatar chip, an\n * icon button — see `renderTrigger`) with a menu too narrow to read its own option labels. It is\n * a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.\n */\n menuMinWidth?: number;\n}\n\nconst IS_WEB = Platform.OS === 'web';\n\nconst BORDER_RADIUS = 8;\nconst BORDER_WIDTH = 1;\nconst BODY_FONT_SIZE = 14;\nconst MODAL_PADDING = 8;\nconst MODAL_MIN_WIDTH = 200;\nconst MODAL_MAX_HEIGHT = 300;\nconst CONTAINER_PADDING_H = 12;\nconst CONTAINER_PADDING_V = 10;\n/** 1x1 clipped box: off-screen visually, still in the a11y tree (unlike display/visibility:none). */\nconst SR_ONLY_SIZE = 1;\nconst SR_ONLY_OFFSET = -1;\n\n/**\n * Deliver the accessible hint on the platform's own terms.\n *\n * React Native consumes `accessibilityHint` natively. **react-native-web does not** — it silently\n * drops the prop (and older versions leaked it to the DOM as an unknown attribute, producing\n * `React does not recognize the accessibilityHint prop on a DOM element`). Either way the hint\n * never reached a screen reader, so every caller's carefully-written hint was thrown away. On web\n * we therefore point `aria-describedby` at a visually-hidden node carrying the text — the same\n * wiring `@dloizides/ui-forms`' `Field` uses for its error line — and do not pass the RN prop at\n * all, so nothing invalid can reach the DOM.\n */\nfunction buildHintProps(\n hint: string,\n hintId: string,\n): { accessibilityHint?: string; 'aria-describedby'?: string } {\n return IS_WEB ? { 'aria-describedby': hintId } : { accessibilityHint: hint };\n}\n\nconst styles = StyleSheet.create({\n anchor: { position: 'relative' },\n srOnly: {\n position: 'absolute',\n width: SR_ONLY_SIZE,\n height: SR_ONLY_SIZE,\n margin: SR_ONLY_OFFSET,\n padding: 0,\n overflow: 'hidden',\n },\n container: {\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n paddingHorizontal: CONTAINER_PADDING_H,\n paddingVertical: CONTAINER_PADDING_V,\n },\n selectedText: { fontSize: BODY_FONT_SIZE },\n modalOverlay: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: MODAL_OVERLAY_COLOR,\n },\n modalContent: {\n borderRadius: BORDER_RADIUS,\n padding: MODAL_PADDING,\n minWidth: MODAL_MIN_WIDTH,\n maxHeight: MODAL_MAX_HEIGHT,\n },\n});\n\nexport const ModalDropdown = <T extends string | number>({\n testID,\n accessibilityLabel,\n accessibilityHint,\n value,\n options,\n onChange,\n variant,\n renderTrigger,\n optionTestID,\n menuMinWidth,\n}: ModalDropdownProps<T>): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n const resolvedVariant = useResolvedDropdownVariant(variant);\n const isMenu = resolvedVariant === DropdownVariant.Menu;\n\n const [isOpen, setIsOpen] = useState(false);\n // Derived from the (required, caller-unique) testID, so the id is stable across renders and\n // readable in the DOM — no render-order-dependent counter needed.\n const hintId = `${testID}-hint`;\n const anchorRef = useRef<View>(null);\n const dialogRef = useRef<View>(null);\n useFocusTrap(dialogRef, isOpen && !isMenu);\n\n const selectedLabel = useMemo(() => {\n const found = options.find((opt) => opt.value === value);\n return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);\n }, [options, value, t]);\n\n const handleToggle = useCallback(() => { setIsOpen((prev) => !prev); }, []);\n const handleClose = useCallback(() => { setIsOpen(false); }, []);\n\n const handleSelect = useCallback(\n (optionValue: T) => {\n onChange(optionValue);\n setIsOpen(false);\n },\n [onChange],\n );\n\n // A custom trigger owns its own visuals, so the default bordered field box stands down.\n const containerStyle = useMemo(\n () =>\n renderTrigger !== undefined\n ? undefined\n : [styles.container, { borderColor: colors.border, backgroundColor: colors.surface }],\n [colors.border, colors.surface, renderTrigger],\n );\n\n const optionTestIDFor = useCallback(\n (optionValue: T): string =>\n optionTestID !== undefined ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,\n [optionTestID, testID],\n );\n // While the inline menu is open, lift the anchor wrapper's stacking so it wins over immediate\n // sibling views (defence-in-depth behind the web portal; the primary lift on native).\n const anchorStyle = useMemo(\n () => [styles.anchor, buildAnchorStackStyle(isMenu && isOpen)],\n [isMenu, isOpen],\n );\n const modalContentStyle = useMemo(\n () => [styles.modalContent, { backgroundColor: colors.surface }],\n [colors.surface],\n );\n\n const renderModalOption = useCallback(\n ({ item }: { item: DropdownOption<T> }) => (\n <OptionRow\n isSelected={item.value === value}\n label={item.label}\n testID={optionTestIDFor(item.value)}\n onSelect={() => handleSelect(item.value)}\n />\n ),\n [handleSelect, optionTestIDFor, value],\n );\n const keyExtractor = useCallback((item: DropdownOption<T>) => String(item.value), []);\n\n return (\n <View ref={anchorRef} style={anchorStyle}>\n <TouchableOpacity\n accessible\n {...buildHintProps(accessibilityHint, hintId)}\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityState={{ expanded: isOpen }}\n aria-expanded={isOpen}\n style={containerStyle}\n testID={testID}\n onPress={handleToggle}\n >\n {renderTrigger !== undefined ? (\n renderTrigger({ label: selectedLabel, isOpen })\n ) : (\n <Text style={[styles.selectedText, { color: colors.text }]}>{selectedLabel}</Text>\n )}\n </TouchableOpacity>\n\n {/* The hint text itself — referenced by the trigger's `aria-describedby`, announced after the\n label, and never painted. Web only: native reads `accessibilityHint` off the trigger. */}\n {IS_WEB ? (\n <Text nativeID={hintId} style={styles.srOnly} testID={`${testID}-hint`}>\n {accessibilityHint}\n </Text>\n ) : null}\n\n {isMenu && isOpen ? (\n <InlineMenu\n accessibilityLabel={accessibilityLabel}\n containerRef={anchorRef}\n menuMinWidth={menuMinWidth}\n optionTestID={optionTestIDFor}\n options={options}\n testID={testID}\n value={value}\n onClose={handleClose}\n onSelect={handleSelect}\n />\n ) : null}\n\n {!isMenu ? (\n <Modal transparent animationType=\"fade\" visible={isOpen} onRequestClose={handleClose}>\n {/* The dismiss backdrop is a SIBLING behind the dialog, not its parent — a wrapping\n pressable would nest the option buttons inside a button (invalid DOM: \"<button>\n cannot contain a nested <button>\"). Absolute-fill catches taps outside the dialog. */}\n <View style={styles.modalOverlay}>\n <TouchableOpacity\n accessible\n accessibilityHint={t(LAYOUT_I18N.dismissDropdownHint)}\n accessibilityLabel={t(LAYOUT_I18N.dismissDropdown)}\n accessibilityRole=\"button\"\n activeOpacity={1}\n style={StyleSheet.absoluteFill}\n testID={`${testID}-backdrop`}\n onPress={handleClose}\n />\n <View\n ref={dialogRef}\n accessibilityViewIsModal\n aria-label={accessibilityLabel}\n role=\"dialog\"\n style={modalContentStyle}\n >\n <FlatList data={[...options]} keyExtractor={keyExtractor} renderItem={renderModalOption} />\n </View>\n </View>\n </Modal>\n ) : null}\n </View>\n );\n};\n\nexport default ModalDropdown;\n","/**\n * ModalShell — a slide-up full-screen modal with a themed header (title + close button)\n * and a scrollable body. Composes Heading (this package) + SvgIcon (@dloizides/ui-icons).\n */\nimport React from 'react';\n\nimport { Modal, ScrollView, StyleSheet, TouchableOpacity, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\n\nimport { Heading } from '../Heading/Heading';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst CLOSE_ICON_SIZE = 18;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n padding: 16,\n },\n headerRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n closeButton: {\n padding: 6,\n borderRadius: 6,\n },\n});\n\nexport interface ModalShellProps {\n visible: boolean;\n onCancel: () => void;\n title?: string | React.ReactNode;\n children?: React.ReactNode;\n contentStyle?: StyleProp<ViewStyle>;\n showClose?: boolean;\n}\n\nexport const ModalShell = ({\n visible,\n onCancel,\n title,\n children,\n contentStyle,\n showClose = true,\n}: ModalShellProps): React.ReactElement => {\n const { theme, t } = useUi();\n\n const containerStyle = React.useMemo(\n () => [styles.container, { backgroundColor: theme.colors.background }, contentStyle],\n [theme.colors.background, contentStyle],\n );\n const closeA11yLabel = t(LAYOUT_I18N.close);\n const accessibleTitle = typeof title === 'string' ? title : t(LAYOUT_I18N.dialog);\n\n return (\n <Modal\n animationType=\"slide\"\n testID={LAYOUT_TEST_IDS.modalShell}\n visible={visible}\n onRequestClose={onCancel}\n >\n <ScrollView\n accessibilityViewIsModal\n aria-label={accessibleTitle}\n role=\"dialog\"\n style={containerStyle}\n >\n <View style={styles.headerRow}>\n <Heading>{title ?? t(LAYOUT_I18N.closeHeading)}</Heading>\n {showClose ? (\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={closeA11yLabel}\n accessibilityRole=\"button\"\n style={styles.closeButton}\n testID={LAYOUT_TEST_IDS.modalShellClose}\n onPress={onCancel}\n >\n <SvgIcon color={theme.colors.textSecondary} name=\"close\" size={CLOSE_ICON_SIZE} />\n </TouchableOpacity>\n ) : null}\n </View>\n\n {children}\n </ScrollView>\n </Modal>\n );\n};\n\nexport default ModalShell;\n","/**\n * AccordionContext — shares the open-item set + toggle between the `Accordion`\n * container (which owns the state) and its `AccordionItem` children.\n */\nimport { createContext, useContext } from 'react';\n\nimport type { AccordionVariant } from './AccordionVariant';\n\nexport interface AccordionContextValue {\n /** Ids of the currently-open items. */\n openIds: ReadonlySet<string>;\n /** Toggle an item open/closed by id (respects `allowMultiple`). */\n toggle: (id: string) => void;\n /** When false, opening an item closes the others. */\n allowMultiple: boolean;\n /** Visual treatment shared with every item (`plain` default, or `boxed`). */\n variant: AccordionVariant;\n}\n\nexport const AccordionContext = createContext<AccordionContextValue | null>(null);\n\n/** Reads the accordion context; throws if an item is rendered outside an `<Accordion>`. */\nexport function useAccordionContext(): AccordionContextValue {\n const value = useContext(AccordionContext);\n if (value === null) {\n throw new Error('AccordionItem must be rendered inside an <Accordion>.');\n }\n return value;\n}\n","/**\n * accordionAnimation — a lightweight, cross-platform-safe open/close animation.\n *\n * `animateNextLayout()` asks the next layout pass to animate (RN `LayoutAnimation`).\n * It is a guarded no-op wherever `LayoutAnimation` is unavailable (e.g. react-native-web\n * stubs it), so it never throws on web OR native.\n */\nimport { LayoutAnimation, Platform, UIManager } from 'react-native';\n\nlet androidEnabled = false;\n\n/** Old-architecture Android requires opting in to LayoutAnimation once, at runtime. */\nfunction enableAndroidLayoutAnimationOnce(): void {\n if (androidEnabled) return;\n androidEnabled = true;\n const isAndroid = Platform.OS === 'android';\n const setter = UIManager.setLayoutAnimationEnabledExperimental;\n if (isAndroid && typeof setter === 'function') {\n setter(true);\n }\n}\n\n/**\n * True when the user asked the OS to reduce motion (web only). The expand/collapse layout\n * animation is then skipped so the panel appears/disappears instantly (WCAG 2.3.3). Safe under\n * SSR / where `matchMedia` is unavailable, and always false on native (handled by the caller).\n */\nfunction prefersReducedMotion(): boolean {\n if (Platform.OS !== 'web' || typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\n/** Animate the layout change caused by the next state update (expand/collapse). */\nexport function animateNextLayout(): void {\n // Honour reduced-motion: skip the animation entirely so the change is instant.\n if (prefersReducedMotion()) return;\n enableAndroidLayoutAnimationOnce();\n const configure = LayoutAnimation.configureNext;\n if (typeof configure !== 'function') return;\n try {\n configure(LayoutAnimation.Presets.easeInEaseOut);\n } catch {\n // LayoutAnimation is a no-op / unavailable on this platform — ignore.\n }\n}\n","/**\n * Accordion — a themed expand/collapse disclosure group.\n *\n * Owns the open-item state and shares it with its {@link AccordionItem} children via\n * context. Works controlled (`openIds` + `onOpenChange`) or uncontrolled\n * (`defaultOpenIds`, plus per-item `defaultOpen`). `allowMultiple` (default) lets any\n * number of items be open at once; set it false for single-open (radio-like) behaviour.\n *\n * `variant` picks the look: `plain` (default) renders borderless so it drops cleanly inside a\n * `Section` / `Card`; `boxed` renders each item as its own bordered, rounded box with a leading\n * ▸ marker (the AML v1 console `<details>` look).\n */\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport { AccordionContext, type AccordionContextValue } from './AccordionContext';\nimport type { AccordionItemProps } from './AccordionItem';\nimport type { AccordionVariant } from './AccordionVariant';\nimport { animateNextLayout } from './accordionAnimation';\n\nconst BOXED_GAP = 12;\n\nconst styles = StyleSheet.create({\n container: { alignSelf: 'stretch' },\n boxed: { gap: BOXED_GAP },\n});\n\nexport interface AccordionProps {\n /** `AccordionItem` children. */\n children?: React.ReactNode;\n /** Controlled open ids. When provided, the accordion is controlled. */\n openIds?: readonly string[];\n /** Initial open ids in uncontrolled mode. */\n defaultOpenIds?: readonly string[];\n /** Fired with the next open-id set whenever an item toggles. */\n onOpenChange?: (openIds: string[]) => void;\n /** Allow several items open at once (default true). False = single-open. */\n allowMultiple?: boolean;\n /** Visual treatment: `plain` (default, borderless) or `boxed` (bordered ▸ boxes). */\n variant?: AccordionVariant;\n testID?: string;\n style?: ViewStyle | ViewStyle[];\n}\n\n/** Read the initial open set from `defaultOpenIds` + any child `defaultOpen` flags. */\nfunction computeInitialOpen(\n children: React.ReactNode,\n defaultOpenIds: readonly string[] | undefined,\n allowMultiple: boolean,\n): Set<string> {\n const ids = new Set<string>(defaultOpenIds ?? []);\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n const props = child.props as Partial<AccordionItemProps>;\n if (props.defaultOpen === true && typeof props.id === 'string') {\n ids.add(props.id);\n }\n });\n if (!allowMultiple && ids.size > 1) {\n const first = ids.values().next().value;\n return new Set(first === undefined ? [] : [first]);\n }\n return ids;\n}\n\nexport const Accordion = ({\n children,\n openIds,\n defaultOpenIds,\n onOpenChange,\n allowMultiple = true,\n variant = 'plain',\n testID = 'accordion',\n style,\n}: AccordionProps): React.ReactElement => {\n const isControlled = openIds !== undefined;\n\n const [internalOpen, setInternalOpen] = useState<Set<string>>(() =>\n computeInitialOpen(children, defaultOpenIds, allowMultiple),\n );\n\n const openSet = useMemo<Set<string>>(\n () => (isControlled ? new Set(openIds) : internalOpen),\n [isControlled, openIds, internalOpen],\n );\n\n const toggle = useCallback(\n (id: string) => {\n animateNextLayout();\n const next = new Set(openSet);\n const willOpen = !next.has(id);\n if (!allowMultiple) next.clear();\n if (willOpen) {\n next.add(id);\n } else {\n next.delete(id);\n }\n if (!isControlled) setInternalOpen(next);\n if (onOpenChange !== undefined) onOpenChange(Array.from(next));\n },\n [allowMultiple, isControlled, onOpenChange, openSet],\n );\n\n const contextValue = useMemo<AccordionContextValue>(\n () => ({ openIds: openSet, toggle, allowMultiple, variant }),\n [openSet, toggle, allowMultiple, variant],\n );\n\n const containerStyle = useMemo<ViewStyle[]>(() => {\n const base = variant === 'boxed' ? [styles.container, styles.boxed] : [styles.container];\n if (style === undefined) return base;\n return [...base, ...(Array.isArray(style) ? style : [style])];\n }, [style, variant]);\n\n return (\n <AccordionContext.Provider value={contextValue}>\n <View style={containerStyle} testID={testID}>\n {children}\n </View>\n </AccordionContext.Provider>\n );\n};\n\nexport default Accordion;\n","/**\n * AccordionItem — one disclosure row: a pressable header (title, optional right\n * adornment/badge slot, a rotating chevron) plus a collapsible body region.\n *\n * Reads its open state, toggle and `variant` from the enclosing {@link Accordion} via context.\n * - `plain` (default): a borderless row with the title left and a right-hand chevron that\n * flips 180° on open, separated from the previous item by a hairline divider.\n * - `boxed`: the item is its own bordered, rounded box with a LEADING ▸ marker that rotates\n * 90° on open and a muted, 600-weight summary (the AML v1 console `<details>` look).\n */\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { Animated, Easing, Platform, Pressable, StyleSheet, Text, View, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\n\nimport { useAccordionContext } from './AccordionContext';\n\nimport { LAYOUT_I18N } from '../constants';\n\nconst HEADER_PADDING_H = 16;\nconst HEADER_PADDING_V = 12;\nconst BODY_PADDING_H = 16;\nconst BODY_PADDING_V = 12;\nconst HEADER_GAP = 8;\nconst TITLE_FONT_SIZE = 15;\nconst TITLE_FONT_WEIGHT = '600' as const;\nconst CHEVRON_SIZE = 18;\nconst ROTATE_DURATION_MS = 160;\nconst ROTATE_COLLAPSED = 0;\nconst ROTATE_EXPANDED = 1;\nconst COLLAPSED_DEG = '0deg';\nconst PLAIN_EXPANDED_DEG = '180deg';\nconst BOXED_EXPANDED_DEG = '90deg';\nconst DISABLED_OPACITY = 0.5;\nconst FULL_OPACITY = 1;\nconst ROLE_REGION = 'region';\n\n// Boxed variant (AML v1 `.sc-more` / `.adv-match` <details>).\nconst BOX_BORDER_RADIUS = 10;\nconst BOX_PADDING_H = 14;\nconst BOX_HEADER_PADDING_V = 8;\nconst BOX_BODY_PADDING_BOTTOM = 10;\nconst BOX_BODY_PADDING_TOP = 2;\nconst BOX_TITLE_FONT_SIZE = 14;\nconst BOX_MARKER_FONT_SIZE = 13;\nconst BOX_MARKER_GAP = 6;\nconst BOX_MARKER = '▸'; // ▸\n\nconst styles = StyleSheet.create({\n item: { borderTopWidth: StyleSheet.hairlineWidth },\n boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingHorizontal: HEADER_PADDING_H,\n paddingVertical: HEADER_PADDING_V,\n },\n boxHeader: { paddingHorizontal: 0, paddingVertical: BOX_HEADER_PADDING_V },\n headerLeft: { flexShrink: 1, flexGrow: 1 },\n headerLeftRow: { flexDirection: 'row', alignItems: 'center' },\n headerRight: { flexDirection: 'row', alignItems: 'center', marginLeft: HEADER_GAP },\n title: { fontSize: TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },\n boxTitle: { fontSize: BOX_TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },\n chevron: { marginLeft: HEADER_GAP },\n marker: { marginRight: BOX_MARKER_GAP },\n markerText: { fontSize: BOX_MARKER_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },\n body: { paddingHorizontal: BODY_PADDING_H, paddingBottom: BODY_PADDING_V },\n boxBody: { paddingHorizontal: 0, paddingBottom: BOX_BODY_PADDING_BOTTOM, paddingTop: BOX_BODY_PADDING_TOP },\n});\n\nexport interface AccordionItemProps {\n /** Stable unique id used for open-state tracking + derived testIDs. */\n id: string;\n /** Header title — a string (rendered as themed text) or custom node. */\n title: string | React.ReactNode;\n /** Optional right-hand adornment (badge, count, icon…) shown before the chevron. */\n right?: React.ReactNode;\n /** Collapsible body content. */\n children?: React.ReactNode;\n /** Start open in uncontrolled mode (ignored when the container is controlled). */\n defaultOpen?: boolean;\n /** Disable toggling for this item. */\n disabled?: boolean;\n /** testID for the header button. Body = `${testID}-body`, chevron = `${testID}-chevron`. */\n testID?: string;\n /** Accessible name for the header button (defaults to `title` when it is a string). */\n accessibilityLabel?: string;\n /** Accessible hint for the header button. */\n accessibilityHint?: string;\n}\n\n/**\n * Extra web-only DOM prop react-native-web's `Pressable` forwards but RN's types omit.\n * `Pressable` renders `accessibilityRole=\"button\"` as a native `<button>` (keyboard-operable\n * for free in real browsers); the handler calls `preventDefault()` so the native\n * Enter/Space activation does not ALSO fire `onPress` (no double toggle).\n */\ninterface WebKeyboardProps {\n onKeyDown?: (event: { key?: string; preventDefault?: () => void }) => void;\n}\n\nconst ACTIVATION_KEYS = ['Enter', ' ', 'Spacebar'];\nconst INSTANT_DURATION_MS = 0;\n\n/**\n * True when the user asked the OS to reduce motion (web only). The chevron/marker rotation then\n * snaps instead of easing (WCAG 2.3.3). Safe under SSR / where `matchMedia` is absent.\n */\nfunction prefersReducedMotion(): boolean {\n if (Platform.OS !== 'web' || typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nexport const AccordionItem = ({\n id,\n title,\n right,\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- read by the container's initial-open scan, not here\n defaultOpen: _defaultOpen,\n disabled = false,\n testID,\n accessibilityLabel,\n accessibilityHint,\n}: AccordionItemProps): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n const { openIds, toggle, variant } = useAccordionContext();\n const boxed = variant === 'boxed';\n\n const expanded = openIds.has(id);\n const headerTestID = testID ?? `accordion-item-${id}`;\n const bodyTestID = `${headerTestID}-body`;\n const chevronTestID = `${headerTestID}-chevron`;\n\n const [rotation] = useState(() => new Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));\n\n useEffect(() => {\n Animated.timing(rotation, {\n toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,\n duration: prefersReducedMotion() ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,\n easing: Easing.out(Easing.ease),\n useNativeDriver: Platform.OS !== 'web',\n }).start();\n }, [expanded, rotation]);\n\n const rotate = rotation.interpolate({\n inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],\n outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG],\n });\n\n const handlePress = useCallback(() => {\n if (!disabled) toggle(id);\n }, [disabled, id, toggle]);\n\n const handleKeyDown = useCallback(\n (event: { key?: string; preventDefault?: () => void }) => {\n if (disabled) return;\n const key = event.key ?? '';\n const isActivation = ACTIVATION_KEYS.includes(key);\n if (!isActivation) return;\n if (typeof event.preventDefault === 'function') event.preventDefault();\n toggle(id);\n },\n [disabled, id, toggle],\n );\n\n const keyboardProps: WebKeyboardProps =\n Platform.OS === 'web' ? { onKeyDown: handleKeyDown } : {};\n\n const itemStyle = useMemo<ViewStyle[]>(\n () =>\n boxed\n ? [styles.boxItem, { borderColor: colors.border }]\n : [styles.item, { borderTopColor: colors.border }],\n [boxed, colors.border],\n );\n const headerStyle = useMemo<ViewStyle[]>(\n () => [\n styles.header,\n ...(boxed ? [styles.boxHeader] : []),\n { opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY },\n ],\n [boxed, disabled],\n );\n\n const resolvedLabel =\n accessibilityLabel ?? (typeof title === 'string' ? title : undefined);\n\n const titleNode =\n typeof title === 'string' ? (\n <Text style={[boxed ? styles.boxTitle : styles.title, { color: boxed ? colors.textSecondary : colors.text }]}>\n {title}\n </Text>\n ) : (\n title\n );\n\n return (\n <View style={itemStyle}>\n <Pressable\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.accordionToggleHint)}\n accessibilityLabel={resolvedLabel}\n accessibilityRole=\"button\"\n accessibilityState={{ expanded, disabled }}\n aria-controls={bodyTestID}\n aria-expanded={expanded}\n disabled={disabled}\n style={headerStyle}\n testID={headerTestID}\n onPress={handlePress}\n {...keyboardProps}\n >\n <View style={[styles.headerLeft, boxed ? styles.headerLeftRow : null]}>\n {boxed ? (\n // Decorative — the open/closed state is already conveyed by aria-expanded on the header.\n <Animated.View\n accessibilityElementsHidden\n aria-hidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.marker, { transform: [{ rotate }] }]}\n testID={chevronTestID}\n >\n <Text style={[styles.markerText, { color: colors.textSecondary }]}>{BOX_MARKER}</Text>\n </Animated.View>\n ) : null}\n {titleNode}\n </View>\n <View style={styles.headerRight}>\n {right}\n {boxed ? null : (\n <Animated.View\n accessibilityElementsHidden\n aria-hidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.chevron, { transform: [{ rotate }] }]}\n >\n <SvgIcon color={colors.textSecondary} name=\"chevronDown\" size={CHEVRON_SIZE} testID={chevronTestID} />\n </Animated.View>\n )}\n </View>\n </Pressable>\n\n {expanded ? (\n <View\n accessibilityLabel={resolvedLabel}\n nativeID={bodyTestID}\n role={ROLE_REGION}\n style={boxed ? styles.boxBody : styles.body}\n testID={bodyTestID}\n >\n {children}\n </View>\n ) : null}\n </View>\n );\n};\n\nexport default AccordionItem;\n","/**\n * Pure truncation helpers for `TruncatedText`.\n *\n * WHY MIDDLE AND NOT TAIL: the component exists because full URLs (adverse-media article\n * links in the AML console) blew out their row. The obvious fix — RN's `numberOfLines={1}`,\n * which RN-web compiles to `text-overflow: ellipsis` — truncates at the TAIL, and a\n * tail-truncated URL is useless: every URL from one publisher collapses to the same\n * `https://timesofindia.indiatimes.com/city/de…` prefix, so the reader learns nothing about\n * WHICH article it is. The informative parts sit at both ends — the HOST (who published it,\n * the trust signal) and the SLUG (what it is about). The uninformative part is the middle\n * path. So we drop the middle:\n *\n * timesofindia.indiatimes.com/…/delhi-court-orders-probe\n *\n * CSS cannot express that, so it is computed here in JS. The component still applies\n * `numberOfLines={1}` on top as a hard backstop, so even if the width estimate is off the\n * text can never overflow its container.\n */\n\n/** The single-character ellipsis (U+2026) — one glyph, so it costs one character of budget. */\nexport const ELLIPSIS = '…';\n\n/** Below this many characters a middle-truncation leaves nothing readable on either side. */\nconst MIN_TRUNCATABLE_CHARS = 4;\n\n/** Leading `scheme://` and a leading `www.`, which carry no information for a reader. */\nconst SCHEME_PREFIX = /^[a-z][a-z0-9+.-]*:\\/\\//i;\nconst WWW_PREFIX = /^www\\./i;\n/** A single trailing slash — cosmetic only. */\nconst TRAILING_SLASH = /\\/$/;\n\n/**\n * Middle-truncate `value` to at most `maxChars` characters, joining the kept head and tail\n * with an ellipsis. Returns `value` unchanged when it already fits (or when `maxChars` is too\n * small to leave anything readable, in which case the caller's `numberOfLines` backstop clamps\n * it instead of us emitting a meaningless \"a…z\").\n *\n * The head keeps the extra character on an odd budget, because for both URLs and identifiers\n * the left side is the more identifying one.\n */\nexport function truncateMiddle(value: string, maxChars: number): string {\n if (maxChars < MIN_TRUNCATABLE_CHARS) return value;\n if (value.length <= maxChars) return value;\n\n const budget = maxChars - 1; // the ellipsis itself costs one character\n const head = Math.ceil(budget / 2);\n const tail = budget - head;\n return `${value.slice(0, head)}${ELLIPSIS}${value.slice(value.length - tail)}`;\n}\n\n/**\n * Strip the parts of a URL a human never needs to read — the scheme, a leading `www.`, and a\n * bare trailing slash — so the truncation budget is spent on the host and the slug instead.\n * Non-URL values (opaque list identifiers) pass through untouched.\n */\nexport function formatUrlForDisplay(value: string): string {\n const withoutScheme = value.replace(SCHEME_PREFIX, '');\n const withoutWww = withoutScheme.replace(WWW_PREFIX, '');\n const trimmed = withoutWww.replace(TRAILING_SLASH, '');\n return trimmed.length > 0 ? trimmed : value;\n}\n","/**\n * The width `TruncatedText` has to work with.\n *\n * WHY NOT `onLayout`, AND WHY NOT `ResizeObserver`: both were tried and neither delivered a\n * single callback for this element under react-native-web 0.21 — verified in Chrome, not\n * assumed. `onLayout` on a `<Text>` never fires; moving it to a wrapping `<View>` did not fire\n * either; observing the same node with a `ResizeObserver` produced zero notifications. A\n * measurement hook that silently never runs is worse than none, because the component keeps\n * rendering (just untruncated) and every unit test still passes.\n *\n * So on web the width is read straight off the DOM: the **parent's** inner width, in a ref\n * callback during commit, plus a `resize` listener. The parent is measured rather than the\n * element itself for a specific reason — the element shrink-wraps its own text, so measuring it\n * would feed our output back into our input and oscillate: truncate → element narrows →\n * re-measure smaller → truncate harder. The parent's width does not depend on what we put in it.\n *\n * Native keeps `onLayout`, where it works.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Platform, type LayoutChangeEvent } from 'react-native';\n\nconst UNMEASURED = 0;\nconst IS_WEB = Platform.OS === 'web';\n\n/** The usable inner width of `node`'s parent — its content box, less its padding. */\nfunction measureParentInnerWidth(node: HTMLElement): number {\n const parent = node.parentElement;\n if (parent === null) return UNMEASURED;\n const cs = window.getComputedStyle(parent);\n const padding = (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);\n return Math.max(UNMEASURED, parent.clientWidth - padding);\n}\n\nexport interface AvailableWidth {\n /** 0 until measured — callers render the full value for that first frame. */\n width: number;\n /** Attach to the measured element. On web it also captures the DOM node. */\n measureRef: (node: unknown) => void;\n /** Native measurement path; a no-op on web. */\n onLayout: (event: LayoutChangeEvent) => void;\n}\n\nexport function useAvailableWidth(): AvailableWidth {\n const [width, setWidth] = useState(UNMEASURED);\n const nodeRef = useRef<HTMLElement | null>(null);\n\n const measureRef = useCallback((node: unknown) => {\n if (!IS_WEB) return;\n nodeRef.current = node as HTMLElement | null;\n if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));\n }, []);\n\n useEffect(() => {\n if (!IS_WEB) return undefined;\n const remeasure = (): void => {\n const node = nodeRef.current;\n if (node !== null) setWidth(measureParentInnerWidth(node));\n };\n window.addEventListener('resize', remeasure);\n return () => window.removeEventListener('resize', remeasure);\n }, []);\n\n const onLayout = useCallback((event: LayoutChangeEvent) => {\n if (IS_WEB) return;\n setWidth(event.nativeEvent.layout.width);\n }, []);\n\n return { width, measureRef, onLayout };\n}\n","/**\n * TruncatedText — a single-line text/link that middle-truncates to fit its container and\n * never overflows, at any width.\n *\n * THREE THINGS THAT LOOK LIKE THEY WOULD WORK AND DO NOT (all verified against\n * react-native-web 0.21, not assumed):\n *\n * 1. `numberOfLines={1}` alone. RN-web compiles it to `text-overflow: ellipsis`, which only\n * truncates at the TAIL. Every URL from one publisher then collapses to the same\n * `timesofindia.indiatimes.com/city/de…` prefix — the reader cannot tell the articles\n * apart. There is no CSS for middle truncation, so it is computed in JS here.\n * 2. `title={full}` for the hover tooltip. RN-web's `<Text>` forwards exactly\n * `href`, `lang` and `pointerEvents` beyond the shared whitelist — `title` is dropped\n * silently. It is set on the host node through a ref instead (the same escape hatch\n * `ui-buttons/useKeyboardActivation` already uses).\n * 3. JS truncation alone. The character budget is estimated from the measured width, and an\n * estimate can be wrong for an unusual glyph mix. So `numberOfLines={1}` is ALSO applied,\n * as a hard backstop: if the estimate ever runs long, CSS clamps it. Overflow is then\n * impossible by construction rather than by tuning.\n * 4. `onLayout` (on the `<Text>` OR on a wrapping `<View>`), and `ResizeObserver`. None of the\n * three delivered a single callback for this element under RN-web 0.21. The measured width\n * stayed 0, the character budget stayed 0, and the component silently degraded to exactly\n * the tail-only CSS truncation of (1) — compiling, typechecking and passing its unit tests\n * the whole time, because the helpers are pure and were never the broken part. Only a\n * browser could catch it. Width now comes from `useAvailableWidth`, which reads the parent's\n * inner width straight off the DOM on web; see that module for why the PARENT.\n *\n * The full, untruncated value always stays reachable: as the accessible name (`aria-label`)\n * and, on web, as the native tooltip.\n */\nimport React, { useCallback, useMemo, useRef } from \"react\";\n\nimport { Platform, StyleSheet, Text, type TextStyle } from \"react-native\";\n\nimport { formatUrlForDisplay, truncateMiddle } from \"./truncate\";\nimport { useAvailableWidth } from \"./useAvailableWidth\";\n\n/**\n * Mean glyph width as a fraction of font size, for the system sans stack. Deliberately on the\n * WIDE side of the true average (~0.5) so the estimate errs toward truncating slightly early\n * rather than overflowing — and `numberOfLines` catches whatever it still gets wrong.\n */\nconst AVG_CHAR_WIDTH_RATIO = 0.58;\nconst DEFAULT_FONT_SIZE = 13;\n/** Width is unknown until the first `onLayout`; render the full string for that one frame. */\nconst UNMEASURED = 0;\n\nconst styles = StyleSheet.create({\n base: { fontSize: DEFAULT_FONT_SIZE },\n /** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */\n fill: { flexShrink: 1, minWidth: 0 },\n});\n\nexport interface TruncatedTextProps {\n /** The full value. Always the accessible name and the web tooltip, however it is displayed. */\n value: string;\n /**\n * Treat `value` as a URL: drop `scheme://`, a leading `www.` and a bare trailing slash so the\n * character budget is spent on the host and the slug rather than on boilerplate.\n */\n isUrl?: boolean;\n /** Web only: render a real `<a href>`, so middle-click and \"copy link address\" work. */\n href?: string;\n onPress?: () => void;\n style?: TextStyle | TextStyle[];\n testID: string;\n accessibilityLabel: string;\n accessibilityHint: string;\n}\n\n/** Characters that fit in `width` at `fontSize`, or 0 while the width is still unmeasured. */\nfunction charBudget(width: number, fontSize: number): number {\n if (width <= UNMEASURED) return UNMEASURED;\n return Math.floor(width / (fontSize * AVG_CHAR_WIDTH_RATIO));\n}\n\nexport const TruncatedText = ({\n value,\n isUrl = false,\n href,\n onPress,\n style,\n testID,\n accessibilityLabel,\n accessibilityHint,\n}: TruncatedTextProps): React.ReactElement => {\n const { width, measureRef, onLayout } = useAvailableWidth();\n const hostRef = useRef<Text | null>(null);\n\n /**\n * One ref doing two jobs: hand the node to the width measurement, and set the native\n * tooltip. RN-web renders `<Text>` to a real DOM node, so the ref is an HTMLElement there;\n * on native the ref is a Text instance and the tooltip step is skipped.\n */\n const attachRef = useCallback(\n (node: Text | null) => {\n hostRef.current = node;\n measureRef(node);\n if (Platform.OS !== \"web\" || node === null) return;\n (node as unknown as HTMLElement).setAttribute?.(\"title\", value);\n },\n [value, measureRef],\n );\n\n const flatStyle = useMemo(\n () => StyleSheet.flatten([styles.base, style]) as TextStyle,\n [style],\n );\n const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE;\n\n const display = useMemo(() => {\n const source = isUrl ? formatUrlForDisplay(value) : value;\n const budget = charBudget(width, fontSize);\n return budget === UNMEASURED ? source : truncateMiddle(source, budget);\n }, [value, isUrl, width, fontSize]);\n\n return (\n <Text\n ref={attachRef}\n onLayout={onLayout}\n numberOfLines={1}\n style={[styles.base, styles.fill, style]}\n testID={testID}\n accessibilityRole={\n onPress !== undefined || href !== undefined ? \"link\" : \"text\"\n }\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n onPress={onPress}\n {...(Platform.OS === \"web\" && href !== undefined ? { href } : {})}\n >\n {display}\n </Text>\n );\n};\n\nexport default TruncatedText;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/Section/Section.tsx","../src/constants.ts","../src/Heading/Heading.tsx","../src/StatusBadge/StatusBadge.tsx","../src/SegmentedControl/SegmentedControl.tsx","../src/UpgradePrompt/UpgradePrompt.tsx","../src/hooks/useFocusTrap.ts","../src/ModalDropdown/DropdownVariant.ts","../src/ModalDropdown/menuStacking.ts","../src/ModalDropdown/OptionRow.tsx","../src/ModalDropdown/useAnchorTracking.ts","../src/ModalDropdown/useMenuKeyboard.ts","../src/ModalDropdown/InlineMenu.tsx","../src/ModalDropdown/resolveDropdownVariant.ts","../src/ModalDropdown/ModalDropdown.tsx","../src/ModalShell/ModalShell.tsx","../src/Accordion/AccordionContext.ts","../src/Accordion/accordionAnimation.ts","../src/Accordion/Accordion.tsx","../src/Accordion/AccordionItem.tsx","../src/TruncatedText/truncate.ts","../src/TruncatedText/useAvailableWidth.ts","../src/TruncatedText/TruncatedText.tsx"],"names":["React","styles","StyleSheet","useUi","jsx","View","Text","DropdownVariant","BORDER_WIDTH","TouchableOpacity","Platform","useEffect","IS_WEB","BORDER_RADIUS","MENU_PADDING","useRef","useMemo","useState","useCallback","BODY_FONT_SIZE","jsxs","Modal","ScrollView","TITLE_FONT_SIZE","handleKeyDown","Pressable","SvgIcon","DEFAULT_FONT_SIZE","UNMEASURED"],"mappings":";;;;;;;;;;AASA,IAA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S,cAAA,CAAe,QAAQ,MAAM,CAAA;AAAA,EACvE,GAAG,CAAC,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,QAAQ,CAAC,CAAA;AAElC,EAAA,uBACExB,GAAAA;AAAA,IAACE,IAAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,SAAA;AAAA,MACL,QAAA;AAAA,MACA,aAAA,EAAe,CAAA;AAAA,MACf,OAAO,CAACL,QAAAA,CAAO,IAAA,EAAMA,QAAAA,CAAO,MAAM,KAAK,CAAA;AAAA,MACvC,MAAA;AAAA,MACA,iBAAA,EACE,OAAA,KAAY,MAAA,IAAa,IAAA,KAAS,SAAY,MAAA,GAAS,MAAA;AAAA,MAEzD,kBAAA;AAAA,MACA,iBAAA;AAAA,MACA,OAAA;AAAA,MACC,GAAIS,SAAS,EAAA,KAAO,KAAA,IAAS,SAAS,MAAA,GAAY,EAAE,IAAA,EAAK,GAAI,EAAC;AAAA,MAE9D,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"index.mjs","sourcesContent":["/**\n * Section — a bordered card container that themes its border + surface.\n */\nimport React from 'react';\n\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nconst styles = StyleSheet.create({\n card: {\n padding: 16,\n borderWidth: 1,\n borderRadius: 6,\n },\n});\n\nexport interface SectionProps {\n children?: React.ReactNode;\n style?: ViewStyle | ViewStyle[];\n}\n\nexport const Section = ({ children, style }: SectionProps): React.ReactElement => {\n const { theme } = useUi();\n\n const containerStyle = React.useMemo(\n () => [styles.card, { borderColor: theme.colors.border, backgroundColor: theme.colors.surface }, style],\n [theme.colors.border, theme.colors.surface, style],\n );\n\n return <View style={containerStyle}>{children}</View>;\n};\n\nexport default Section;\n","/** Default testIDs — match the apps' existing values so Playwright selectors keep working. */\nexport const LAYOUT_TEST_IDS = {\n headingText: 'heading-text',\n statusLabel: 'status-label',\n upgradePrompt: 'upgrade-prompt',\n upgradePromptCta: 'upgrade-prompt-cta',\n upgradePromptDismiss: 'upgrade-prompt-dismiss',\n modalShell: 'template-modal',\n modalShellClose: 'cancel-button',\n accordion: 'accordion',\n} as const;\n\n/** Route the UpgradePrompt CTA navigates to by default (the apps' billing settings path). */\nexport const DEFAULT_BILLING_ROUTE = '/settings/billing';\n\n/**\n * Every translation key this package resolves through `t(...)` — the host app's i18n contract.\n *\n * WHY THIS EXISTS: the kit is deliberately fallback-free. The neutral default `t` returns the key\n * itself, so a host that forgets a key does not silently show English — it shows the raw dotted\n * name to users, or announces it to screen readers. Without a machine-readable manifest each\n * portal had to hand-maintain its ui-layout key list, and hand-maintained lists rot: one app was\n * found missing 26 kit keys (rendering raw names to users), another had `accordionToggleHint`\n * undefined while `Accordion` was mounted, announcing the raw key to assistive tech.\n *\n * Bind a missing-key guard to this map (the same way apps already bind `TABLE_I18N` /\n * `FILTERS_I18N` from `@dloizides/ui-tables`) and an upgrade can never drift unnoticed. Every\n * `t(...)` call in this package references this map, so it cannot fall out of date.\n */\nexport const LAYOUT_I18N = {\n /** Placeholder shown by `ModalDropdown` when no option matches the current value. */\n selectPlaceholder: 'common.selectPlaceholder',\n /** Accessible name + hint of the modal-variant dropdown's dismiss backdrop. */\n dismissDropdown: 'common.dismissDropdown',\n dismissDropdownHint: 'common.dismissDropdownHint',\n /** Accessible hint on a single dropdown option row. */\n selectOptionHint: 'common.selectOptionHint',\n /** Default accessible hint on an `AccordionItem` header when the caller supplies none. */\n accordionToggleHint: 'common.accordionToggleHint',\n /** Default accessible hint on a `StatusBadge` when the caller supplies none. */\n statusBadgeHint: 'common.statusBadgeHint',\n /** `ModalShell`: accessible name of the dialog when its title is not a plain string. */\n dialog: 'common.dialog',\n /** `ModalShell`: accessible hint on the close button. */\n closeDialogHint: 'common.closeDialogHint',\n /** `ModalShell`: accessible name of the close button. */\n close: 'quizTemplates.cancel',\n /** `ModalShell`: heading fallback when no title is supplied. */\n closeHeading: 'close',\n upgradePromptTitle: 'settings.billing.upgradePrompt.title',\n /** Body copy, parameterised: \"…requires {{p1}}, you are on {{p2}}.\" */\n upgradePromptMessage: 'settings.billing.upgradePrompt.message',\n upgradePromptCta: 'settings.billing.upgradePrompt.cta',\n upgradePromptCtaHint: 'settings.billing.upgradePrompt.ctaHint',\n upgradePromptDismiss: 'settings.billing.upgradePrompt.dismiss',\n upgradePromptDismissHint: 'settings.billing.upgradePrompt.dismissHint',\n} as const;\n","/**\n * Heading — themed section heading text.\n */\nimport React from 'react';\n\nimport { StyleSheet, Text } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_TEST_IDS } from '../constants';\n\nconst styles = StyleSheet.create({\n heading: {\n fontWeight: '700',\n fontSize: 16,\n },\n});\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n}\n\nexport const Heading = ({ text, children }: HeadingProps): React.ReactElement => {\n const { theme } = useUi();\n\n const headingStyle = React.useMemo(\n () => [styles.heading, { color: theme.colors.text }],\n [theme.colors.text],\n );\n\n return (\n <Text accessibilityRole=\"header\" style={headingStyle} testID={LAYOUT_TEST_IDS.headingText}>\n {text ?? children}\n </Text>\n );\n};\n\nexport default Heading;\n","/**\n * StatusBadge — unified status pill. Colours are passed in; domain adapters map their\n * enums to label/color/backgroundColor.\n */\nimport React, { useMemo } from 'react';\n\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst DEFAULT_PADDING_H = 10;\nconst DEFAULT_PADDING_V = 4;\nconst DEFAULT_BORDER_RADIUS = 12;\nconst DEFAULT_FONT_SIZE = 12;\n\nconst styles = StyleSheet.create({\n badge: {\n paddingHorizontal: DEFAULT_PADDING_H,\n paddingVertical: DEFAULT_PADDING_V,\n borderRadius: DEFAULT_BORDER_RADIUS,\n alignSelf: 'flex-start',\n },\n text: {\n fontSize: DEFAULT_FONT_SIZE,\n fontWeight: '600',\n },\n});\n\nexport interface StatusBadgeProps {\n label: string;\n color: string;\n backgroundColor: string;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n}\n\nexport const StatusBadge = ({\n label,\n color,\n backgroundColor,\n testID = LAYOUT_TEST_IDS.statusLabel,\n accessibilityLabel,\n accessibilityHint,\n}: StatusBadgeProps): React.ReactElement => {\n const { t } = useUi();\n\n const dynamicBadge = useMemo(() => ({ backgroundColor }), [backgroundColor]);\n const dynamicText = useMemo(() => ({ color }), [color]);\n\n return (\n <View\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint)}\n accessibilityLabel={accessibilityLabel ?? label}\n style={[styles.badge, dynamicBadge]}\n testID={testID}\n >\n <Text style={[styles.text, dynamicText]}>{label}</Text>\n </View>\n );\n};\n\nexport default StatusBadge;\n","/**\n * SegmentedControl — a single rounded pill *track* holding N mutually-exclusive segments\n * (the iOS-style segmented / tab toggle). The selected segment lifts onto a raised surface\n * with a subtle shadow; the rest stay transparent. Promoted from the v1 AML console's\n * `.lf-mode` mode switch so erevna/katalogos/kefi can share ONE toggle instead of\n * hand-rolling two primary/ghost buttons.\n *\n * Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM/router/store/icon\n * imports. Labels are pre-localized strings; every colour is read from the\n * `@dloizides/ui-feedback` UiProvider theme, so it re-skins on tenant swap. Renders as a\n * `tablist` of `tab`s (`accessibilityRole` + `accessibilityState.selected`, which\n * react-native-web forwards to `role`/`aria-selected` on the DOM).\n */\nimport React from 'react';\n\nimport {\n Pressable,\n StyleSheet,\n Text,\n View,\n type PressableProps,\n type StyleProp,\n type ViewStyle,\n} from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nconst TRACK_PADDING = 3;\nconst TRACK_RADIUS = 999;\nconst SEGMENT_RADIUS = 999;\nconst SEGMENT_PAD_H = 15;\nconst SEGMENT_PAD_V = 7;\nconst SEGMENT_FONT = 14;\nconst SEGMENT_WEIGHT = '600';\nconst BORDER_WIDTH = 1;\n\n/**\n * Shadow under the SELECTED segment — matches v1 `.lf-mode__btn[aria-selected] box-shadow`.\n * Expressed as `boxShadow`: the `shadow*` family is deprecated in React Native and logged a\n * deprecation warning on every import of this module.\n */\nconst SEGMENT_BOX_SHADOW = '0px 1px 3px rgba(20, 30, 50, 0.1)';\n/** Android draws `elevation`, not `boxShadow`. */\nconst SHADOW_ELEVATION = 2;\nconst TRANSPARENT = 'transparent';\n\nconst styles = StyleSheet.create({\n track: {\n flexDirection: 'row',\n alignSelf: 'flex-start',\n alignItems: 'center',\n gap: TRACK_PADDING + 1,\n padding: TRACK_PADDING,\n borderRadius: TRACK_RADIUS,\n borderWidth: BORDER_WIDTH,\n },\n segment: {\n paddingHorizontal: SEGMENT_PAD_H,\n paddingVertical: SEGMENT_PAD_V,\n borderRadius: SEGMENT_RADIUS,\n },\n segmentSelected: {\n boxShadow: SEGMENT_BOX_SHADOW,\n elevation: SHADOW_ELEVATION,\n },\n label: {\n fontSize: SEGMENT_FONT,\n fontWeight: SEGMENT_WEIGHT,\n textAlign: 'center',\n },\n});\n\n/**\n * `aria-selected` marks the active tab for assistive tech. react-native's prop types omit\n * `aria-selected`, but react-native-web forwards `aria-*` to the DOM — so we attach it (no\n * `any`) rather than rely on `accessibilityState` (which this RNW build does not map to it).\n */\nfunction ariaSelectedProps(selected: boolean): PressableProps & { 'aria-selected': boolean } {\n return { 'aria-selected': selected };\n}\n\n/** One selectable segment. `value` is what `onChange` emits when it's pressed. */\nexport interface SegmentedOption<V extends string = string> {\n label: string;\n value: V;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n}\n\nexport interface SegmentedControlProps<V extends string = string> {\n /** The segments, left → right. */\n options: ReadonlyArray<SegmentedOption<V>>;\n /** The currently-selected value. */\n value: V;\n /** Fired with a segment's `value` when it is pressed. */\n onChange: (value: V) => void;\n /** Accessible name for the whole group (the `tablist`). */\n accessibilityLabel: string;\n /** Optional style override merged LAST onto the track. */\n style?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\n/**\n * A segmented toggle. Generic over the value union so callers get a typed `onChange`\n * (e.g. `SegmentedControl<'peps' | 'leaders'>`).\n */\nexport function SegmentedControl<V extends string = string>({\n options,\n value,\n onChange,\n accessibilityLabel,\n style,\n testID,\n}: SegmentedControlProps<V>): React.ReactElement {\n const { theme } = useUi();\n const { colors } = theme;\n\n return (\n <View\n accessibilityRole=\"tablist\"\n aria-label={accessibilityLabel}\n style={[styles.track, { backgroundColor: colors.background, borderColor: colors.border }, style]}\n testID={testID}\n >\n {options.map((opt) => {\n const selected = opt.value === value;\n return (\n <Pressable\n key={opt.value}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected }}\n accessibilityLabel={opt.accessibilityLabel ?? opt.label}\n accessibilityHint={opt.accessibilityHint}\n onPress={() => onChange(opt.value)}\n style={[\n styles.segment,\n selected ? styles.segmentSelected : null,\n { backgroundColor: selected ? colors.surface : TRANSPARENT },\n ]}\n testID={opt.testID}\n {...ariaSelectedProps(selected)}\n >\n <Text style={[styles.label, { color: selected ? colors.text : colors.textSecondary }]}>{opt.label}</Text>\n </Pressable>\n );\n })}\n </View>\n );\n}\n\nexport default SegmentedControl;\n","/**\n * UpgradePrompt — shown when a free-tier user hits a feature limit. CTA navigates to the\n * billing route via the injected navigate (default route overridable).\n */\nimport React from 'react';\n\nimport { StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS, DEFAULT_BILLING_ROUTE } from '../constants';\n\nconst PROMPT_PADDING = 20;\nconst PROMPT_BORDER_RADIUS = 12;\nconst PROMPT_BORDER_WIDTH = 1;\nconst TITLE_FONT_SIZE = 16;\nconst MESSAGE_FONT_SIZE = 14;\nconst BUTTON_PADDING_V = 12;\nconst BUTTON_BORDER_RADIUS = 8;\nconst BUTTON_FONT_SIZE = 14;\nconst DISMISS_FONT_SIZE = 13;\nconst TITLE_MARGIN_BOTTOM = 8;\nconst MESSAGE_MARGIN_BOTTOM = 16;\nconst CTA_MARGIN_BOTTOM = 8;\n\nconst styles = StyleSheet.create({\n container: {\n padding: PROMPT_PADDING,\n borderRadius: PROMPT_BORDER_RADIUS,\n borderWidth: PROMPT_BORDER_WIDTH,\n },\n title: { fontSize: TITLE_FONT_SIZE, fontWeight: '700', marginBottom: TITLE_MARGIN_BOTTOM },\n message: { fontSize: MESSAGE_FONT_SIZE, marginBottom: MESSAGE_MARGIN_BOTTOM },\n cta: { paddingVertical: BUTTON_PADDING_V, borderRadius: BUTTON_BORDER_RADIUS, alignItems: 'center', marginBottom: CTA_MARGIN_BOTTOM },\n ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: '700' },\n dismiss: { alignItems: 'center', paddingVertical: BUTTON_PADDING_V },\n dismissText: { fontSize: DISMISS_FONT_SIZE },\n});\n\nexport interface UpgradePromptProps {\n /** Human-readable name of the required tier (e.g. \"Pro\"). */\n requiredTier: string;\n /** Current tier name (e.g. \"Free\"). */\n currentTier: string;\n /** Called when the user dismisses the prompt. */\n onDismiss?: () => void;\n /** Route the CTA navigates to (defaults to the billing settings path). */\n billingRoute?: string;\n}\n\nexport const UpgradePrompt = ({\n requiredTier,\n currentTier,\n onDismiss,\n billingRoute = DEFAULT_BILLING_ROUTE,\n}: UpgradePromptProps): React.ReactElement => {\n const { theme, t, navigate } = useUi();\n const colors = theme.colors;\n const primary = theme.palette.primary['500'];\n\n function handleUpgradePress(): void {\n if (typeof navigate === 'function') navigate(billingRoute);\n }\n\n return (\n <View\n style={[styles.container, { borderColor: primary, backgroundColor: colors.surface }]}\n testID={LAYOUT_TEST_IDS.upgradePrompt}\n >\n <Text style={[styles.title, { color: colors.text }]}>\n {t(LAYOUT_I18N.upgradePromptTitle)}\n </Text>\n\n <Text style={[styles.message, { color: colors.textSecondary }]}>\n {t(LAYOUT_I18N.upgradePromptMessage, requiredTier, currentTier)}\n </Text>\n\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.upgradePromptCtaHint)}\n accessibilityLabel={t(LAYOUT_I18N.upgradePromptCta)}\n accessibilityRole=\"button\"\n style={[styles.cta, { backgroundColor: primary }]}\n testID={LAYOUT_TEST_IDS.upgradePromptCta}\n onPress={handleUpgradePress}\n >\n <Text style={[styles.ctaText, { color: colors.surface }]}>\n {t(LAYOUT_I18N.upgradePromptCta)}\n </Text>\n </TouchableOpacity>\n\n {onDismiss ? (\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.upgradePromptDismissHint)}\n accessibilityLabel={t(LAYOUT_I18N.upgradePromptDismiss)}\n accessibilityRole=\"button\"\n style={styles.dismiss}\n testID={LAYOUT_TEST_IDS.upgradePromptDismiss}\n onPress={onDismiss}\n >\n <Text style={[styles.dismissText, { color: colors.textSecondary }]}>\n {t(LAYOUT_I18N.upgradePromptDismiss)}\n </Text>\n </TouchableOpacity>\n ) : null}\n </View>\n );\n};\n\nexport default UpgradePrompt;\n","/**\n * Traps keyboard focus within a container element on web.\n * No-op on native platforms where `<Modal>` handles focus containment.\n *\n * On enable: saves the previously focused element and focuses the first focusable child.\n * Tab wraps from last to first; Shift+Tab wraps from first to last. On disable/unmount:\n * restores focus to the saved element.\n */\nimport { useEffect, useRef } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View } from 'react-native';\n\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'button:not([disabled])',\n 'input:not([disabled])',\n 'select:not([disabled])',\n 'textarea:not([disabled])',\n '[tabindex]:not([tabindex=\"-1\"])',\n].join(', ');\n\nfunction getFocusableElements(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\n}\n\nfunction savePreviousFocus(): HTMLElement | null {\n return document.activeElement instanceof HTMLElement ? document.activeElement : null;\n}\n\nfunction handleKeyDown(domNode: HTMLElement, event: KeyboardEvent): void {\n if (event.key !== 'Tab') return;\n\n const focusable = getFocusableElements(domNode);\n if (focusable.length === 0) {\n event.preventDefault();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (!first || !last) {\n event.preventDefault();\n return;\n }\n const active = document.activeElement;\n\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n}\n\nexport function useFocusTrap(containerRef: RefObject<View | null>, enabled: boolean): void {\n const previousFocusRef = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\n const domNode = containerRef.current as unknown as HTMLElement | null;\n if (!domNode) return;\n\n previousFocusRef.current = savePreviousFocus();\n queueMicrotask(() => getFocusableElements(domNode)[0]?.focus());\n\n const listener = (e: KeyboardEvent): void => handleKeyDown(domNode, e);\n domNode.addEventListener('keydown', listener);\n\n return () => {\n domNode.removeEventListener('keydown', listener);\n previousFocusRef.current?.focus();\n previousFocusRef.current = null;\n };\n }, [containerRef, enabled]);\n}\n","/**\n * How a {@link ModalDropdown} renders its list of options.\n *\n * Exported as a regular (non-`const`) enum on purpose: `const enum` values are\n * inlined at compile time and cannot cross a published-package boundary when the\n * consumer bundles with `isolatedModules` (esbuild / vite / babel — i.e. every\n * app that consumes this package). A regular enum emits a runtime object that is\n * safe to import and compare in any consumer.\n */\nexport enum DropdownVariant {\n /** Inline popover anchored directly under the trigger — the native `<select>` feel. */\n Menu = 'menu',\n /** Full modal / bottom-sheet overlay with a scrim (the original behaviour). */\n Modal = 'modal',\n}\n","/**\n * menuStacking — the stacking/positioning geometry for the inline dropdown menu.\n *\n * WHY THIS EXISTS (the bug it fixes): react-native-web renders **every** `View` with\n * `position: relative; z-index: 0`, so every View is its OWN stacking context. An inline\n * popover rendered `position:absolute` under its anchor therefore has its `zIndex` trapped\n * inside the anchor's (and the app's field wrapper's) `z-index: 0` context — it can never\n * rise above later-painting sibling Views (adjacent filter fields, the results table, cards).\n * That is why the open menu painted UNDERNEATH following content on wide/desktop web.\n *\n * THE FIX: on web the menu is rendered in a PORTAL to `document.body` with `position: fixed`\n * at the trigger's measured viewport rect and a high `zIndex`. A portal escapes every ancestor\n * stacking context AND every ancestor `overflow: hidden`, so the menu always paints on top and\n * is never clipped — the same \"menu above the table\" outcome the `@dloizides/ui-tables`\n * `SizeDropdown` achieves. On native the menu stays in-tree (`position:absolute` + `elevation`),\n * and the anchor gets a raised `zIndex` while open as defence-in-depth for direct siblings.\n *\n * These builders are pure so the stacking behaviour is unit-testable without RN-web's\n * class-name-based styling (which does not surface as inline DOM styles).\n */\nimport type { ViewStyle } from 'react-native';\n\n/** z-index for the open menu popover — high enough to clear app chrome (tables, cards, fields). */\nexport const MENU_Z_INDEX = 1000;\n/** z-index lifted onto the anchor WRAPPER while the menu is open (native/defence-in-depth). */\nexport const ANCHOR_OPEN_Z_INDEX = 1000;\n/** Native drop shadow depth so the popover reads as floating above the page. */\nexport const MENU_ELEVATION = 8;\n/** Gap between the trigger's bottom edge and the popover's top edge. */\nexport const MENU_TOP_GAP = 4;\n/** The popover scrolls past this height rather than growing unbounded. */\nexport const MENU_MAX_HEIGHT = 300;\n\nconst BORDER_RADIUS = 8;\nconst BORDER_WIDTH = 1;\nconst MENU_PADDING = 4;\n/** Soft drop shadow so the popover reads as floating above the page (web). */\nexport const MENU_BOX_SHADOW = '0px 2px 8px rgba(0, 0, 0, 0.15)';\n\n/** The trigger's viewport-space rect (from `getBoundingClientRect`) needed to place a fixed menu. */\nexport interface AnchorRect {\n top: number;\n left: number;\n width: number;\n bottom: number;\n}\n\n/**\n * Web portal popover style: `position: fixed` at the trigger rect with a high `zIndex`. Because\n * it is portalled to `document.body`, `fixed` positions it against the viewport, so it tracks the\n * trigger via the measured rect (recomputed on scroll/resize) and is clipped by nothing.\n *\n * The popover matches the trigger's width — right for a full-width field, but a COMPACT anchor (a\n * locale pill, an avatar chip, an icon button) would then get a menu too narrow to read its own\n * option labels. `minWidth` sets a floor for exactly that case; it never shrinks a menu.\n */\nexport function buildPortalPopoverStyle(rect: AnchorRect, minWidth = 0): ViewStyle {\n return {\n // RN's ViewStyle union omits 'fixed', but react-native-web honours it at runtime.\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- web-only position value\n position: 'fixed' as unknown as ViewStyle['position'],\n top: rect.bottom + MENU_TOP_GAP,\n left: rect.left,\n width: Math.max(rect.width, minWidth),\n zIndex: MENU_Z_INDEX,\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n padding: MENU_PADDING,\n maxHeight: MENU_MAX_HEIGHT,\n boxShadow: MENU_BOX_SHADOW,\n elevation: MENU_ELEVATION,\n };\n}\n\n/**\n * Anchor-wrapper stacking style: while the inline menu is open the wrapper is lifted to a raised\n * `zIndex` so it wins over immediate sibling views (defence-in-depth on top of the web portal;\n * the primary stacking behaviour on native). Returns `null` when closed so nothing changes.\n */\nexport function buildAnchorStackStyle(isMenuOpen: boolean): ViewStyle | null {\n return isMenuOpen ? { zIndex: ANCHOR_OPEN_Z_INDEX, elevation: MENU_ELEVATION } : null;\n}\n\n/**\n * The window the trigger is actually visible through: the viewport intersected with every\n * ancestor that clips (a scroll container, an `overflow: hidden` panel).\n */\nexport interface ClipBounds {\n top: number;\n left: number;\n bottom: number;\n right: number;\n}\n\n/**\n * Below this many pixels visible in either axis the trigger is, to a user, gone — so the menu\n * must not keep hanging off it. A few pixels rather than zero, because a trigger pinned at the\n * very edge of a scroll container that has bottomed out never reaches zero (see below).\n */\nexport const MIN_VISIBLE_PX = 8;\n\n/**\n * True when the trigger is no longer meaningfully visible, so an anchored menu would be pointing\n * at nothing and must close. Repositioning cannot solve this case — the menu simply follows its\n * trigger out of sight and hangs over unrelated content.\n *\n * TWO THINGS THIS DELIBERATELY IS NOT (both were shipped as bugs in 1.10.0):\n *\n * 1. **Not \"outside the viewport\".** RN-web apps scroll an inner `ScrollView`, not the document.\n * A trigger scrolled out of that inner scroller is invisible to the user while its rect is\n * still comfortably inside the viewport — a viewport-only test can never fire. Visibility is\n * therefore measured against `clip`, the intersection of the viewport with every clipping\n * ancestor. (The RECT stays viewport-relative, which is why repositioning worked throughout.)\n * 2. **Not \"entirely hidden\".** When a scroll container reaches the end of its range the trigger\n * stops with a sliver still inside the clip window — the real-world case was 4px — so \"fully\n * out\" is unreachable and the menu never closed. A small visible-pixel floor fixes that.\n */\nexport function isAnchorHidden(rect: AnchorRect, clip: ClipBounds, minVisiblePx: number): boolean {\n // A zero-AREA rect means \"not laid out yet\" — NOT \"off-screen\". Note this asks only about the\n // element's OWN box, never about where it sits: a trigger scrolled far out of view still has\n // its full width and height, so this can never swallow a genuine hidden case.\n const hasLayout = rect.width > 0 && rect.bottom > rect.top;\n const hasClip = clip.bottom > clip.top && clip.right > clip.left;\n if (!hasLayout || !hasClip) return false;\n\n const visibleHeight = Math.min(rect.bottom, clip.bottom) - Math.max(rect.top, clip.top);\n const visibleWidth = Math.min(rect.left + rect.width, clip.right) - Math.max(rect.left, clip.left);\n return visibleHeight < minVisiblePx || visibleWidth < minVisiblePx;\n}\n","/**\n * OptionRow — a single selectable option, shared by both the modal and the inline\n * menu variants of ModalDropdown so selection/rendering logic is never duplicated.\n */\nimport React, { useCallback } from 'react';\n\nimport { StyleSheet, Text, TouchableOpacity } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N } from '../constants';\n\nconst OPTION_BORDER_RADIUS = 4;\nconst BODY_FONT_SIZE = 14;\nconst SELECTED_FONT_WEIGHT = '600' as const;\nconst OPTION_PADDING_H = 16;\nconst OPTION_PADDING_V = 12;\n\nconst styles = StyleSheet.create({\n option: {\n paddingHorizontal: OPTION_PADDING_H,\n paddingVertical: OPTION_PADDING_V,\n borderRadius: OPTION_BORDER_RADIUS,\n },\n optionText: { fontSize: BODY_FONT_SIZE },\n selectedText: { fontWeight: SELECTED_FONT_WEIGHT },\n});\n\nexport interface OptionRowProps {\n testID: string;\n label: string;\n isSelected: boolean;\n /** Keyboard-highlighted row (arrow-key navigation) in the inline menu. */\n isHighlighted?: boolean;\n onSelect: () => void;\n}\n\nexport const OptionRow = ({\n testID,\n label,\n isSelected,\n isHighlighted = false,\n onSelect,\n}: OptionRowProps): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n\n const handlePress = useCallback(() => { onSelect(); }, [onSelect]);\n\n const isActive = isSelected || isHighlighted;\n const rowStyle = [styles.option, isActive ? { backgroundColor: colors.surfaceElevated } : null];\n const textStyle = [styles.optionText, { color: colors.text }, isSelected ? styles.selectedText : null];\n\n return (\n <TouchableOpacity\n accessible\n accessibilityHint={t(LAYOUT_I18N.selectOptionHint)}\n accessibilityLabel={label}\n accessibilityRole=\"button\"\n aria-selected={isSelected}\n style={rowStyle}\n testID={testID}\n onPress={handlePress}\n >\n <Text style={textStyle}>{label}</Text>\n </TouchableOpacity>\n );\n};\n\nexport default OptionRow;\n","/**\n * useAnchorTracking — keeps the fixed-positioned web popover glued to its trigger.\n *\n * WHY THIS IS HARDER THAN IT LOOKS: on web the menu is portalled to `document.body` with\n * `position: fixed` at the trigger's rect measured AT OPEN TIME. `fixed` is viewport-relative, so\n * the coordinate is only valid until something moves the trigger — after that the menu floats,\n * detached, over unrelated content.\n *\n * The original implementation listened for `scroll` (capture) + `resize` on `window`. That covers\n * scrolling, but leaves three real gaps this hook closes:\n *\n * 1. **Layout changes that fire no scroll event at all** — an accordion above the trigger\n * expanding, a sticky header changing height, a banner appearing, an async list rendering,\n * a font swapping. The trigger moves; nothing scrolls; no listener fires. A `ResizeObserver`\n * on the anchor and on `document.body` catches these.\n * 2. **The trigger leaving the viewport.** Repositioning alone cannot help here — the menu just\n * follows its trigger off-screen and hangs over unrelated content. We close instead\n * (see {@link isAnchorOutOfView}).\n * 3. **Layout thrash.** The old handler ran a synchronous `getBoundingClientRect()` (a forced\n * reflow) plus a React state update on EVERY scroll event — potentially hundreds per second\n * during a momentum scroll. Work is now coalesced into one `requestAnimationFrame` per frame.\n *\n * Scroll is observed in the CAPTURE phase on `document` so a scroll inside ANY ancestor scroll\n * container counts — element `scroll` events do not bubble, so a bubble-phase listener would only\n * ever see the document scroller.\n *\n * No-op on native, where the popover is an in-tree absolutely-positioned child that moves with its\n * anchor automatically.\n */\nimport { useLayoutEffect, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { MIN_VISIBLE_PX, isAnchorHidden, type AnchorRect, type ClipBounds } from './menuStacking';\n\nconst IS_WEB = Platform.OS === 'web';\n\n/** The RN-web `View` ref is an `HTMLElement` at runtime; native refs are not. */\nfunction toDomNode(containerRef: RefObject<RNView | null>): HTMLElement | null {\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\n const node = containerRef.current as unknown as HTMLElement | null;\n if (node === null || typeof node.getBoundingClientRect !== 'function') return null;\n return node;\n}\n\n/** Read the anchor's viewport rect (web only). Returns null when unavailable (native / no node). */\nexport function readAnchorRect(containerRef: RefObject<RNView | null>): AnchorRect | null {\n if (!IS_WEB) return null;\n const node = toDomNode(containerRef);\n if (node === null) return null;\n const r = node.getBoundingClientRect();\n return { top: r.top, left: r.left, width: r.width, bottom: r.bottom };\n}\n\n/** Does this element clip its children on the given axis (a scroll container, an overflow panel)? */\nfunction clipsAxis(overflow: string): boolean {\n return overflow !== '' && overflow !== 'visible';\n}\n\n/** Narrow `bounds` to `el`'s box on whichever axes `el` clips. */\nfunction clipToAncestor(bounds: ClipBounds, el: HTMLElement): void {\n const style = window.getComputedStyle(el);\n // The per-axis longhands are authoritative, but fall back to the `overflow` shorthand: not every\n // environment expands it (jsdom does not), and a missed clipping ancestor silently disables the\n // out-of-view close — the exact class of failure this whole hook exists to prevent.\n const clipsY = clipsAxis(style.overflowY) || clipsAxis(style.overflow);\n const clipsX = clipsAxis(style.overflowX) || clipsAxis(style.overflow);\n if (!clipsY && !clipsX) return;\n const r = el.getBoundingClientRect();\n if (clipsY) {\n bounds.top = Math.max(bounds.top, r.top);\n bounds.bottom = Math.min(bounds.bottom, r.bottom);\n }\n if (clipsX) {\n bounds.left = Math.max(bounds.left, r.left);\n bounds.right = Math.min(bounds.right, r.right);\n }\n}\n\n/**\n * The window the anchor is actually visible through: the viewport narrowed by every clipping\n * ancestor. THIS is what makes the out-of-view check work in an RN-web app, where the document\n * never scrolls and every screen lives inside an inner `ScrollView` — a trigger scrolled out of\n * that scroller is invisible while its rect is still inside the viewport.\n */\nexport function readClipBounds(node: HTMLElement | null): ClipBounds {\n const bounds: ClipBounds = { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };\n let el = node?.parentElement ?? null;\n while (el !== null && el !== document.body && el !== document.documentElement) {\n clipToAncestor(bounds, el);\n el = el.parentElement;\n }\n return bounds;\n}\n\n/**\n * Watch the anchor (and the page) for size/layout changes that move the trigger WITHOUT scrolling.\n * Returns null where `ResizeObserver` is unavailable (older browsers, jsdom) — the scroll/resize\n * listeners still apply, so tracking degrades rather than breaking.\n */\nfunction observeLayout(node: HTMLElement | null, onChange: () => void): ResizeObserver | null {\n if (typeof ResizeObserver !== 'function') return null;\n const observer = new ResizeObserver(onChange);\n if (node !== null) observer.observe(node);\n observer.observe(document.body);\n return observer;\n}\n\n/**\n * Track `containerRef`'s viewport rect while the menu is open.\n *\n * @param containerRef the anchor wrapper holding the trigger.\n * @param onOutOfView called once the anchor has left the viewport — the caller closes the menu.\n * Must be referentially stable (a `useCallback` with no deps), or the listeners re-subscribe.\n */\nexport function useAnchorTracking(\n containerRef: RefObject<RNView | null>,\n onOutOfView: () => void,\n): AnchorRect | null {\n const [rect, setRect] = useState<AnchorRect | null>(() => readAnchorRect(containerRef));\n\n useLayoutEffect(() => {\n if (!IS_WEB) return undefined;\n let frame: number | null = null;\n let isDisposed = false;\n let hasMeasured = false;\n\n const apply = (): void => {\n frame = null;\n if (isDisposed) return;\n const next = readAnchorRect(containerRef);\n setRect(next);\n // Never close on the FIRST measurement. Opening a dropdown whose trigger is already partly\n // clipped must still work; only movement AFTER the menu is open may close it.\n const isHidden =\n next !== null && isAnchorHidden(next, readClipBounds(toDomNode(containerRef)), MIN_VISIBLE_PX);\n if (hasMeasured && isHidden) onOutOfView();\n hasMeasured = true;\n };\n\n // Coalesce a burst of scroll/resize/layout events into a single measurement per frame.\n const schedule = (): void => {\n if (frame !== null) return;\n frame = window.requestAnimationFrame(apply);\n };\n\n apply();\n document.addEventListener('scroll', schedule, true);\n window.addEventListener('resize', schedule);\n const observer = observeLayout(toDomNode(containerRef), schedule);\n\n return () => {\n isDisposed = true;\n if (frame !== null) window.cancelAnimationFrame(frame);\n document.removeEventListener('scroll', schedule, true);\n window.removeEventListener('resize', schedule);\n if (observer !== null) observer.disconnect();\n };\n }, [containerRef, onOutOfView]);\n\n return rect;\n}\n","/**\n * useMenuKeyboard — web-only keyboard navigation + click-outside dismissal for the\n * inline dropdown menu. No-op on native platforms (the modal variant is used there).\n *\n * While enabled it wires, on `document`:\n * - ArrowDown / ArrowUp — move the highlight (clamped to the option range)\n * - Home / End — jump to first / last option\n * - Enter — select the highlighted option\n * - Escape — close the menu\n * - mousedown outside the container AND the menu — close the menu\n *\n * On web the menu popover is portalled to `document.body` (to escape ancestor stacking contexts),\n * so it is NOT a DOM descendant of `containerRef`. The outside-click check therefore consults the\n * optional `menuRef` too, otherwise a mousedown on an option would count as \"outside\" and close the\n * menu before the option's click could select it.\n *\n * WHY THE KEY LISTENER IS ON THE **CAPTURE** PHASE (a real bug this fixes): the trigger keeps DOM\n * focus while the menu is open, and react-native-web maps Enter on a focused Touchable to `onPress`.\n * React dispatches that from its ROOT container listener — an ancestor of the trigger but a\n * DESCENDANT of `document` — so on a BUBBLING listener React's handler ran FIRST: it toggled the\n * menu shut, React unmounted the popover, this effect's cleanup removed the very listener the event\n * was still travelling toward, and `document` never saw the Enter. Net effect: **Enter closed the\n * menu instead of selecting the highlighted option** — keyboard users could open and navigate a\n * dropdown but never choose with the keyboard. Listening in the CAPTURE phase puts this handler\n * ahead of React's, and `stopPropagation` on the keys the open menu owns keeps the trigger from\n * re-toggling behind our back.\n */\nimport { useEffect } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View } from 'react-native';\n\nexport interface MenuKeyboardParams {\n containerRef: RefObject<View | null>;\n /** The popover node (portalled on web); clicks inside it are NOT \"outside\". */\n menuRef?: RefObject<View | null>;\n enabled: boolean;\n itemCount: number;\n onHighlightChange: (next: (prev: number) => number) => void;\n onSelectHighlighted: () => void;\n onClose: () => void;\n}\n\n/** True when `target` is inside the DOM node held by `ref` (RN-web refs are HTMLElements at runtime). */\nfunction refContains(ref: RefObject<View | null> | undefined, target: Node | null): boolean {\n if (ref === undefined) return false;\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\n const node = ref.current as unknown as HTMLElement | null;\n return node !== null && target !== null && node.contains(target);\n}\n\nconst clampIndex = (index: number, itemCount: number): number => {\n if (index < 0) return 0;\n const lastIndex = itemCount - 1;\n return index > lastIndex ? lastIndex : index;\n};\n\n/**\n * An OPEN menu owns these keys: swallow them so the still-focused trigger (whose Enter\n * react-native-web maps to `onPress`) cannot toggle the menu shut behind the handler's back.\n */\nfunction claimKey(event: KeyboardEvent): void {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction buildKeyHandler(params: MenuKeyboardParams): (event: KeyboardEvent) => void {\n const { itemCount, onHighlightChange, onSelectHighlighted, onClose } = params;\n\n return (event: KeyboardEvent): void => {\n switch (event.key) {\n case 'ArrowDown':\n claimKey(event);\n onHighlightChange((prev) => clampIndex(prev + 1, itemCount));\n return;\n case 'ArrowUp':\n claimKey(event);\n onHighlightChange((prev) => clampIndex(prev - 1, itemCount));\n return;\n case 'Home':\n claimKey(event);\n onHighlightChange(() => 0);\n return;\n case 'End':\n claimKey(event);\n onHighlightChange(() => clampIndex(itemCount - 1, itemCount));\n return;\n case 'Enter':\n claimKey(event);\n onSelectHighlighted();\n return;\n case 'Escape':\n claimKey(event);\n onClose();\n return;\n default:\n }\n };\n}\n\nexport function useMenuKeyboard(params: MenuKeyboardParams): void {\n const { containerRef, menuRef, enabled, onClose } = params;\n\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n const onKeyDown = buildKeyHandler(params);\n\n const onMouseDown = (event: MouseEvent): void => {\n const target = event.target instanceof Node ? event.target : null;\n const insideAnchor = refContains(containerRef, target);\n const insideMenu = refContains(menuRef, target);\n if (!insideAnchor && !insideMenu) onClose();\n };\n\n // CAPTURE phase — see the file header: on the bubble phase React's root listener (the trigger's\n // Enter → onPress) ran first, closed the menu, and unmounted this listener mid-flight, so Enter\n // never selected. Capture puts the open menu's keys ahead of it.\n document.addEventListener('keydown', onKeyDown, true);\n document.addEventListener('mousedown', onMouseDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown, true);\n document.removeEventListener('mousedown', onMouseDown);\n };\n // `params` is rebuilt each render; the primitive/callback members it carries are the real deps.\n }, [containerRef, menuRef, enabled, onClose, params]);\n}\n","/**\n * InlineMenu — the anchored inline dropdown popover (web-native `<select>` feel).\n *\n * Dismissible via click-outside / Escape and navigable with the arrow keys + Enter (see\n * {@link useMenuKeyboard}). It reuses {@link OptionRow} for rendering/selection so no option\n * logic is duplicated.\n *\n * STACKING (the bug this file fixes): react-native-web gives every `View`\n * `position: relative; z-index: 0`, making each View its own stacking context. An absolutely\n * positioned popover therefore has its `zIndex` trapped inside its anchor/field wrapper and paints\n * UNDER later siblings (adjacent filter fields, the results table, cards). To escape that, on WEB\n * the popover is rendered in a PORTAL to `document.body` with `position: fixed` at the trigger's\n * measured viewport rect and a high `zIndex` — clipped by nothing, above everything. On native it\n * stays in-tree (`position:absolute` + `elevation`). See {@link menuStacking}.\n *\n * The `containerRef` is the relatively-positioned wrapper owned by ModalDropdown that holds the\n * trigger; on native the popover renders inside it. On web the popover lives in the portal, so\n * outside-click detection also consults this popover's own node (`menuRef`).\n *\n * `position: fixed` is viewport-relative, so the measured rect goes stale the moment anything moves\n * the trigger. {@link useAnchorTracking} owns keeping the two together — and closes the menu once\n * the trigger has left the viewport, rather than leaving it orphaned over unrelated content.\n */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { Platform, ScrollView, StyleSheet, View } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport type { DropdownOption } from './dropdownTypes';\nimport {\n MENU_BOX_SHADOW,\n MENU_ELEVATION,\n MENU_MAX_HEIGHT,\n MENU_TOP_GAP,\n MENU_Z_INDEX,\n buildPortalPopoverStyle,\n} from './menuStacking';\nimport { OptionRow } from './OptionRow';\nimport { useAnchorTracking } from './useAnchorTracking';\nimport { useMenuKeyboard } from './useMenuKeyboard';\n\nconst IS_WEB = Platform.OS === 'web';\n\nconst BORDER_RADIUS = 8;\nconst BORDER_WIDTH = 1;\nconst MENU_PADDING = 4;\n\nconst styles = StyleSheet.create({\n /** Native (in-tree) popover — anchored absolutely just under the trigger. */\n popover: {\n position: 'absolute',\n top: '100%',\n left: 0,\n right: 0,\n marginTop: MENU_TOP_GAP,\n zIndex: MENU_Z_INDEX,\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n padding: MENU_PADDING,\n maxHeight: MENU_MAX_HEIGHT,\n boxShadow: MENU_BOX_SHADOW,\n elevation: MENU_ELEVATION,\n },\n});\n\nexport interface InlineMenuProps<T> {\n testID: string;\n accessibilityLabel: string;\n value: T;\n options: ReadonlyArray<DropdownOption<T>>;\n containerRef: RefObject<RNView | null>;\n /** Custom testID per option row. Defaults to `` `${testID}-option-${value}` ``. */\n optionTestID?: (value: T) => string;\n /** Minimum popover width — a floor for COMPACT anchors, whose width cannot fit an option label. */\n menuMinWidth?: number;\n onSelect: (value: T) => void;\n onClose: () => void;\n}\n\nexport const InlineMenu = <T extends string | number>({\n testID,\n accessibilityLabel,\n value,\n options,\n containerRef,\n optionTestID,\n menuMinWidth = 0,\n onSelect,\n onClose,\n}: InlineMenuProps<T>): React.ReactElement | null => {\n const { theme } = useUi();\n const { colors } = theme;\n\n const menuRef = useRef<RNView>(null);\n // Tracks the trigger while open, and closes rather than orphaning the menu once the trigger\n // has scrolled out of the viewport entirely.\n const rect = useAnchorTracking(containerRef, onClose);\n\n const selectedIndex = useMemo(\n () => Math.max(0, options.findIndex((opt) => opt.value === value)),\n [options, value],\n );\n // Lazy init: start the keyboard highlight on the currently-selected option.\n const [highlightedIndex, setHighlightedIndex] = useState<number>(() => selectedIndex);\n\n const selectAt = useCallback(\n (index: number) => {\n const option = options[index];\n if (option !== undefined) onSelect(option.value);\n },\n [options, onSelect],\n );\n\n const selectHighlighted = useCallback(\n () => { selectAt(highlightedIndex); },\n [selectAt, highlightedIndex],\n );\n\n useMenuKeyboard({\n containerRef,\n menuRef,\n enabled: true,\n itemCount: options.length,\n onHighlightChange: setHighlightedIndex,\n onSelectHighlighted: selectHighlighted,\n onClose,\n });\n\n const popoverStyle = useMemo(() => {\n const themed = { borderColor: colors.border, backgroundColor: colors.surface };\n // Web: fixed-positioned in a portal at the measured trigger rect (escapes stacking + clipping).\n if (IS_WEB)\n return [\n buildPortalPopoverStyle(rect ?? { top: 0, left: 0, width: 0, bottom: 0 }, menuMinWidth),\n themed,\n ];\n // Native: in-tree absolute popover under the trigger (stretched to the anchor, floored the same).\n return [styles.popover, { minWidth: menuMinWidth }, themed];\n }, [colors.border, colors.surface, menuMinWidth, rect]);\n\n const menu = (\n <View\n ref={menuRef}\n accessibilityRole=\"menu\"\n aria-label={accessibilityLabel}\n style={popoverStyle}\n testID={`${testID}-menu`}\n >\n <ScrollView keyboardShouldPersistTaps=\"handled\">\n {options.map((option, index) => (\n <OptionRow\n key={String(option.value)}\n isHighlighted={index === highlightedIndex}\n isSelected={option.value === value}\n label={option.label}\n testID={\n optionTestID !== undefined ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`\n }\n onSelect={() => onSelect(option.value)}\n />\n ))}\n </ScrollView>\n </View>\n );\n\n // Portal to document.body on web so no ancestor stacking context / overflow can trap or clip it.\n if (IS_WEB) return createPortal(menu, document.body);\n return menu;\n};\n\nexport default InlineMenu;\n","/**\n * Responsive resolution of the effective {@link DropdownVariant}.\n *\n * `resolveDropdownVariant` is a pure function (easy to unit-test with a mocked\n * width); `useResolvedDropdownVariant` is the thin hook that feeds it the live\n * viewport width + platform.\n */\nimport { Platform, useWindowDimensions } from 'react-native';\n\nimport { DropdownVariant } from './DropdownVariant';\n\n/**\n * At or above this viewport width (web only) the dropdown defaults to the inline\n * anchored menu; below it — or on any native platform — it defaults to the modal.\n */\nexport const MENU_BREAKPOINT = 768;\n\n/** The web platform key that {@link Platform.OS} reports under react-native-web. */\nconst WEB_PLATFORM = 'web';\n\n/**\n * Pure resolver. An explicit `variant` always wins; otherwise the inline\n * {@link DropdownVariant.Menu} is chosen on wide web viewports and\n * {@link DropdownVariant.Modal} on narrow web or any native platform.\n */\nexport function resolveDropdownVariant(\n explicit: DropdownVariant | undefined,\n width: number,\n platformOS: string,\n): DropdownVariant {\n if (explicit !== undefined) return explicit;\n\n const isWideWeb = platformOS === WEB_PLATFORM && width >= MENU_BREAKPOINT;\n return isWideWeb ? DropdownVariant.Menu : DropdownVariant.Modal;\n}\n\n/** Hook wrapper that reads the live viewport width + platform and resolves the variant. */\nexport function useResolvedDropdownVariant(\n explicit: DropdownVariant | undefined,\n): DropdownVariant {\n const { width } = useWindowDimensions();\n return resolveDropdownVariant(explicit, width, Platform.OS);\n}\n","/**\n * ModalDropdown — generic dropdown selector (any value type via generics).\n *\n * Renders as either an inline anchored menu (web-native `<select>` feel) or a\n * modal / bottom-sheet, selectable per screen via the `variant` prop. When\n * `variant` is omitted the choice is **responsive**: inline menu on wide/desktop\n * web, modal on narrow/mobile (and always modal on native). Existing callers that\n * never passed `variant` therefore get the inline-on-desktop behaviour for free.\n *\n * Both variants share {@link OptionRow} for option rendering + selection.\n */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { FlatList, Modal, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useA11y } from '@dloizides/a11y';\nimport { useUi, MODAL_OVERLAY_COLOR } from '@dloizides/ui-feedback';\n\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { DropdownVariant } from './DropdownVariant';\nimport type { DropdownOption } from './dropdownTypes';\nimport { InlineMenu } from './InlineMenu';\nimport { buildAnchorStackStyle } from './menuStacking';\nimport { OptionRow } from './OptionRow';\nimport { useResolvedDropdownVariant } from './resolveDropdownVariant';\n\nimport { LAYOUT_I18N } from '../constants';\n\n/** State handed to a custom trigger renderer. */\nexport interface DropdownTriggerState {\n /** The selected option's label (or the select placeholder when nothing matches). */\n label: string;\n /** Whether the menu is currently open. */\n isOpen: boolean;\n}\n\nexport interface ModalDropdownProps<T> {\n testID: string;\n accessibilityLabel: string;\n accessibilityHint: string;\n value: T;\n options: ReadonlyArray<DropdownOption<T>>;\n onChange: (value: T) => void;\n /**\n * Force a rendering variant. When omitted the dropdown is **responsive**:\n * an inline anchored menu on wide/desktop web, a modal on narrow/mobile\n * (and always a modal on native). An explicit value overrides the auto choice.\n */\n variant?: DropdownVariant;\n /**\n * Custom ANCHOR content. When supplied, the caller owns the trigger's visuals\n * entirely (the default bordered field box is not rendered) — use it for compact\n * chips / avatars / icon triggers. The a11y wrapper (role=button, `aria-expanded`,\n * the label + hint, the testID) is still supplied by the dropdown, so a custom\n * trigger cannot drop the accessible contract. Omit for the default field look.\n */\n renderTrigger?: (state: DropdownTriggerState) => React.ReactNode;\n /**\n * Custom testID per option row. Defaults to `` `${testID}-option-${value}` ``.\n * Lets a caller keep a pre-existing selector stable when a flat control becomes\n * a dropdown.\n */\n optionTestID?: (value: T) => string;\n /**\n * Minimum width of the open inline menu. The menu otherwise matches the TRIGGER's width, which\n * is right for a full-width field but leaves a COMPACT anchor (a locale pill, an avatar chip, an\n * icon button — see `renderTrigger`) with a menu too narrow to read its own option labels. It is\n * a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.\n */\n menuMinWidth?: number;\n}\n\nconst BORDER_RADIUS = 8;\nconst BORDER_WIDTH = 1;\nconst BODY_FONT_SIZE = 14;\nconst MODAL_PADDING = 8;\nconst MODAL_MIN_WIDTH = 200;\nconst MODAL_MAX_HEIGHT = 300;\nconst CONTAINER_PADDING_H = 12;\nconst CONTAINER_PADDING_V = 10;\n\n/*\n * The hint used to be threaded by a private `buildHintProps` helper plus a hand-rolled\n * `srOnly` visually-hidden <Text>, both living in this file. That was a verbatim\n * reimplementation of `@dloizides/a11y`'s `useA11y` + `A11yHint` — same platform branch,\n * same 1x1-clip technique, same `aria-describedby` wiring — so it was a second place for\n * the SAME bug to regress, with none of that package's dual-platform test gate behind it.\n * It now delegates. See `useA11y` in the render below.\n */\n\nconst styles = StyleSheet.create({\n anchor: { position: 'relative' },\n container: {\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n paddingHorizontal: CONTAINER_PADDING_H,\n paddingVertical: CONTAINER_PADDING_V,\n },\n selectedText: { fontSize: BODY_FONT_SIZE },\n modalOverlay: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: MODAL_OVERLAY_COLOR,\n },\n modalContent: {\n borderRadius: BORDER_RADIUS,\n padding: MODAL_PADDING,\n minWidth: MODAL_MIN_WIDTH,\n maxHeight: MODAL_MAX_HEIGHT,\n },\n});\n\nexport const ModalDropdown = <T extends string | number>({\n testID,\n accessibilityLabel,\n accessibilityHint,\n value,\n options,\n onChange,\n variant,\n renderTrigger,\n optionTestID,\n menuMinWidth,\n}: ModalDropdownProps<T>): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n const resolvedVariant = useResolvedDropdownVariant(variant);\n const isMenu = resolvedVariant === DropdownVariant.Menu;\n\n const [isOpen, setIsOpen] = useState(false);\n /*\n * The trigger's accessible contract, emitted per-platform by the shared adapter:\n * `aria-label`/`aria-describedby`/`role`/`aria-expanded` on web, the `accessibility*`\n * props on native. `hintNode` is the visually-hidden description element — `null` on\n * native, where the hint is a first-class prop — and MUST be rendered inside the same\n * host component, which is why it sits among the trigger's children below.\n *\n * The hint id is no longer derived from `testID`: `useA11y` generates it from React's\n * `useId()`, which stays unique even if two dropdowns are ever handed the same testID.\n */\n const { a11yProps, hintNode } = useA11y({\n label: accessibilityLabel,\n hint: accessibilityHint,\n role: 'button',\n state: { expanded: isOpen },\n testID,\n });\n const anchorRef = useRef<View>(null);\n const dialogRef = useRef<View>(null);\n useFocusTrap(dialogRef, isOpen && !isMenu);\n\n const selectedLabel = useMemo(() => {\n const found = options.find((opt) => opt.value === value);\n return found?.label ?? t(LAYOUT_I18N.selectPlaceholder);\n }, [options, value, t]);\n\n const handleToggle = useCallback(() => { setIsOpen((prev) => !prev); }, []);\n const handleClose = useCallback(() => { setIsOpen(false); }, []);\n\n const handleSelect = useCallback(\n (optionValue: T) => {\n onChange(optionValue);\n setIsOpen(false);\n },\n [onChange],\n );\n\n // A custom trigger owns its own visuals, so the default bordered field box stands down.\n const containerStyle = useMemo(\n () =>\n renderTrigger !== undefined\n ? undefined\n : [styles.container, { borderColor: colors.border, backgroundColor: colors.surface }],\n [colors.border, colors.surface, renderTrigger],\n );\n\n const optionTestIDFor = useCallback(\n (optionValue: T): string =>\n optionTestID !== undefined ? optionTestID(optionValue) : `${testID}-option-${String(optionValue)}`,\n [optionTestID, testID],\n );\n // While the inline menu is open, lift the anchor wrapper's stacking so it wins over immediate\n // sibling views (defence-in-depth behind the web portal; the primary lift on native).\n const anchorStyle = useMemo(\n () => [styles.anchor, buildAnchorStackStyle(isMenu && isOpen)],\n [isMenu, isOpen],\n );\n const modalContentStyle = useMemo(\n () => [styles.modalContent, { backgroundColor: colors.surface }],\n [colors.surface],\n );\n\n const renderModalOption = useCallback(\n ({ item }: { item: DropdownOption<T> }) => (\n <OptionRow\n isSelected={item.value === value}\n label={item.label}\n testID={optionTestIDFor(item.value)}\n onSelect={() => handleSelect(item.value)}\n />\n ),\n [handleSelect, optionTestIDFor, value],\n );\n const keyExtractor = useCallback((item: DropdownOption<T>) => String(item.value), []);\n\n return (\n <View ref={anchorRef} style={anchorStyle}>\n <TouchableOpacity {...a11yProps} style={containerStyle} onPress={handleToggle}>\n {renderTrigger !== undefined ? (\n renderTrigger({ label: selectedLabel, isOpen })\n ) : (\n <Text style={[styles.selectedText, { color: colors.text }]}>{selectedLabel}</Text>\n )}\n {/* The hidden description node the trigger's `aria-describedby` points at. A DESCENDANT\n rather than a sibling, so it cannot outlive the trigger and leave the attribute\n dangling. `null` on native, where the hint is a first-class prop. */}\n {hintNode}\n </TouchableOpacity>\n\n {isMenu && isOpen ? (\n <InlineMenu\n accessibilityLabel={accessibilityLabel}\n containerRef={anchorRef}\n menuMinWidth={menuMinWidth}\n optionTestID={optionTestIDFor}\n options={options}\n testID={testID}\n value={value}\n onClose={handleClose}\n onSelect={handleSelect}\n />\n ) : null}\n\n {!isMenu ? (\n <Modal transparent animationType=\"fade\" visible={isOpen} onRequestClose={handleClose}>\n {/* The dismiss backdrop is a SIBLING behind the dialog, not its parent — a wrapping\n pressable would nest the option buttons inside a button (invalid DOM: \"<button>\n cannot contain a nested <button>\"). Absolute-fill catches taps outside the dialog. */}\n <View style={styles.modalOverlay}>\n <TouchableOpacity\n accessible\n accessibilityHint={t(LAYOUT_I18N.dismissDropdownHint)}\n accessibilityLabel={t(LAYOUT_I18N.dismissDropdown)}\n accessibilityRole=\"button\"\n activeOpacity={1}\n style={StyleSheet.absoluteFill}\n testID={`${testID}-backdrop`}\n onPress={handleClose}\n />\n <View\n ref={dialogRef}\n accessibilityViewIsModal\n aria-label={accessibilityLabel}\n role=\"dialog\"\n style={modalContentStyle}\n >\n <FlatList data={[...options]} keyExtractor={keyExtractor} renderItem={renderModalOption} />\n </View>\n </View>\n </Modal>\n ) : null}\n </View>\n );\n};\n\nexport default ModalDropdown;\n","/**\n * ModalShell — a slide-up full-screen modal with a themed header (title + close button)\n * and a scrollable body. Composes Heading (this package) + SvgIcon (@dloizides/ui-icons).\n */\nimport React from 'react';\n\nimport { Modal, ScrollView, StyleSheet, TouchableOpacity, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\n\nimport { Heading } from '../Heading/Heading';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst CLOSE_ICON_SIZE = 18;\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n padding: 16,\n },\n headerRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n },\n closeButton: {\n padding: 6,\n borderRadius: 6,\n },\n});\n\nexport interface ModalShellProps {\n visible: boolean;\n onCancel: () => void;\n title?: string | React.ReactNode;\n children?: React.ReactNode;\n contentStyle?: StyleProp<ViewStyle>;\n showClose?: boolean;\n}\n\nexport const ModalShell = ({\n visible,\n onCancel,\n title,\n children,\n contentStyle,\n showClose = true,\n}: ModalShellProps): React.ReactElement => {\n const { theme, t } = useUi();\n\n const containerStyle = React.useMemo(\n () => [styles.container, { backgroundColor: theme.colors.background }, contentStyle],\n [theme.colors.background, contentStyle],\n );\n const closeA11yLabel = t(LAYOUT_I18N.close);\n const accessibleTitle = typeof title === 'string' ? title : t(LAYOUT_I18N.dialog);\n\n return (\n <Modal\n animationType=\"slide\"\n testID={LAYOUT_TEST_IDS.modalShell}\n visible={visible}\n onRequestClose={onCancel}\n >\n <ScrollView\n accessibilityViewIsModal\n aria-label={accessibleTitle}\n role=\"dialog\"\n style={containerStyle}\n >\n <View style={styles.headerRow}>\n <Heading>{title ?? t(LAYOUT_I18N.closeHeading)}</Heading>\n {showClose ? (\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={closeA11yLabel}\n accessibilityRole=\"button\"\n style={styles.closeButton}\n testID={LAYOUT_TEST_IDS.modalShellClose}\n onPress={onCancel}\n >\n <SvgIcon color={theme.colors.textSecondary} name=\"close\" size={CLOSE_ICON_SIZE} />\n </TouchableOpacity>\n ) : null}\n </View>\n\n {children}\n </ScrollView>\n </Modal>\n );\n};\n\nexport default ModalShell;\n","/**\n * AccordionContext — shares the open-item set + toggle between the `Accordion`\n * container (which owns the state) and its `AccordionItem` children.\n */\nimport { createContext, useContext } from 'react';\n\nimport type { AccordionVariant } from './AccordionVariant';\n\nexport interface AccordionContextValue {\n /** Ids of the currently-open items. */\n openIds: ReadonlySet<string>;\n /** Toggle an item open/closed by id (respects `allowMultiple`). */\n toggle: (id: string) => void;\n /** When false, opening an item closes the others. */\n allowMultiple: boolean;\n /** Visual treatment shared with every item (`plain` default, or `boxed`). */\n variant: AccordionVariant;\n}\n\nexport const AccordionContext = createContext<AccordionContextValue | null>(null);\n\n/** Reads the accordion context; throws if an item is rendered outside an `<Accordion>`. */\nexport function useAccordionContext(): AccordionContextValue {\n const value = useContext(AccordionContext);\n if (value === null) {\n throw new Error('AccordionItem must be rendered inside an <Accordion>.');\n }\n return value;\n}\n","/**\n * accordionAnimation — a lightweight, cross-platform-safe open/close animation.\n *\n * `animateNextLayout()` asks the next layout pass to animate (RN `LayoutAnimation`).\n * It is a guarded no-op wherever `LayoutAnimation` is unavailable (e.g. react-native-web\n * stubs it), so it never throws on web OR native.\n */\nimport { LayoutAnimation, Platform, UIManager } from 'react-native';\n\nimport { prefersReducedMotion } from '@dloizides/rn-web-hooks';\n\nlet androidEnabled = false;\n\n/** Old-architecture Android requires opting in to LayoutAnimation once, at runtime. */\nfunction enableAndroidLayoutAnimationOnce(): void {\n if (androidEnabled) return;\n androidEnabled = true;\n const isAndroid = Platform.OS === 'android';\n const setter = UIManager.setLayoutAnimationEnabledExperimental;\n if (isAndroid && typeof setter === 'function') {\n setter(true);\n }\n}\n\n/*\n * `prefersReducedMotion` used to be defined right here, and again — character for character —\n * in AccordionItem.tsx. It now comes from @dloizides/rn-web-hooks, which already owned the\n * identical `(prefers-contrast: more)` probe and has a dual-platform test gate behind it.\n * The imperative form (rather than the `useReducedMotion` hook) is the right one for this\n * call site: `animateNextLayout` runs outside render, so it cannot call a hook.\n */\n\n/** Animate the layout change caused by the next state update (expand/collapse). */\nexport function animateNextLayout(): void {\n // Honour reduced-motion: skip the animation entirely so the change is instant.\n if (prefersReducedMotion()) return;\n enableAndroidLayoutAnimationOnce();\n const configure = LayoutAnimation.configureNext;\n if (typeof configure !== 'function') return;\n try {\n configure(LayoutAnimation.Presets.easeInEaseOut);\n } catch {\n // LayoutAnimation is a no-op / unavailable on this platform — ignore.\n }\n}\n","/**\n * Accordion — a themed expand/collapse disclosure group.\n *\n * Owns the open-item state and shares it with its {@link AccordionItem} children via\n * context. Works controlled (`openIds` + `onOpenChange`) or uncontrolled\n * (`defaultOpenIds`, plus per-item `defaultOpen`). `allowMultiple` (default) lets any\n * number of items be open at once; set it false for single-open (radio-like) behaviour.\n *\n * `variant` picks the look: `plain` (default) renders borderless so it drops cleanly inside a\n * `Section` / `Card`; `boxed` renders each item as its own bordered, rounded box with a leading\n * ▸ marker (the AML v1 console `<details>` look).\n */\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { StyleSheet, View, type ViewStyle } from 'react-native';\n\nimport { AccordionContext, type AccordionContextValue } from './AccordionContext';\nimport type { AccordionItemProps } from './AccordionItem';\nimport type { AccordionVariant } from './AccordionVariant';\nimport { animateNextLayout } from './accordionAnimation';\n\nconst BOXED_GAP = 12;\n\nconst styles = StyleSheet.create({\n container: { alignSelf: 'stretch' },\n boxed: { gap: BOXED_GAP },\n});\n\nexport interface AccordionProps {\n /** `AccordionItem` children. */\n children?: React.ReactNode;\n /** Controlled open ids. When provided, the accordion is controlled. */\n openIds?: readonly string[];\n /** Initial open ids in uncontrolled mode. */\n defaultOpenIds?: readonly string[];\n /** Fired with the next open-id set whenever an item toggles. */\n onOpenChange?: (openIds: string[]) => void;\n /** Allow several items open at once (default true). False = single-open. */\n allowMultiple?: boolean;\n /** Visual treatment: `plain` (default, borderless) or `boxed` (bordered ▸ boxes). */\n variant?: AccordionVariant;\n testID?: string;\n style?: ViewStyle | ViewStyle[];\n}\n\n/** Read the initial open set from `defaultOpenIds` + any child `defaultOpen` flags. */\nfunction computeInitialOpen(\n children: React.ReactNode,\n defaultOpenIds: readonly string[] | undefined,\n allowMultiple: boolean,\n): Set<string> {\n const ids = new Set<string>(defaultOpenIds ?? []);\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n const props = child.props as Partial<AccordionItemProps>;\n if (props.defaultOpen === true && typeof props.id === 'string') {\n ids.add(props.id);\n }\n });\n if (!allowMultiple && ids.size > 1) {\n const first = ids.values().next().value;\n return new Set(first === undefined ? [] : [first]);\n }\n return ids;\n}\n\nexport const Accordion = ({\n children,\n openIds,\n defaultOpenIds,\n onOpenChange,\n allowMultiple = true,\n variant = 'plain',\n testID = 'accordion',\n style,\n}: AccordionProps): React.ReactElement => {\n const isControlled = openIds !== undefined;\n\n const [internalOpen, setInternalOpen] = useState<Set<string>>(() =>\n computeInitialOpen(children, defaultOpenIds, allowMultiple),\n );\n\n const openSet = useMemo<Set<string>>(\n () => (isControlled ? new Set(openIds) : internalOpen),\n [isControlled, openIds, internalOpen],\n );\n\n const toggle = useCallback(\n (id: string) => {\n animateNextLayout();\n const next = new Set(openSet);\n const willOpen = !next.has(id);\n if (!allowMultiple) next.clear();\n if (willOpen) {\n next.add(id);\n } else {\n next.delete(id);\n }\n if (!isControlled) setInternalOpen(next);\n if (onOpenChange !== undefined) onOpenChange(Array.from(next));\n },\n [allowMultiple, isControlled, onOpenChange, openSet],\n );\n\n const contextValue = useMemo<AccordionContextValue>(\n () => ({ openIds: openSet, toggle, allowMultiple, variant }),\n [openSet, toggle, allowMultiple, variant],\n );\n\n const containerStyle = useMemo<ViewStyle[]>(() => {\n const base = variant === 'boxed' ? [styles.container, styles.boxed] : [styles.container];\n if (style === undefined) return base;\n return [...base, ...(Array.isArray(style) ? style : [style])];\n }, [style, variant]);\n\n return (\n <AccordionContext.Provider value={contextValue}>\n <View style={containerStyle} testID={testID}>\n {children}\n </View>\n </AccordionContext.Provider>\n );\n};\n\nexport default Accordion;\n","/**\n * AccordionItem — one disclosure row: a pressable header (title, optional right\n * adornment/badge slot, a rotating chevron) plus a collapsible body region.\n *\n * Reads its open state, toggle and `variant` from the enclosing {@link Accordion} via context.\n * - `plain` (default): a borderless row with the title left and a right-hand chevron that\n * flips 180° on open, separated from the previous item by a hairline divider.\n * - `boxed`: the item is its own bordered, rounded box with a LEADING ▸ marker that rotates\n * 90° on open and a muted, 600-weight summary (the AML v1 console `<details>` look).\n */\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { Animated, Easing, Platform, Pressable, StyleSheet, Text, View, type ViewStyle } from 'react-native';\n\nimport { useReducedMotion } from '@dloizides/rn-web-hooks';\nimport { useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\n\nimport { useAccordionContext } from './AccordionContext';\n\nimport { LAYOUT_I18N } from '../constants';\n\nconst HEADER_PADDING_H = 16;\nconst HEADER_PADDING_V = 12;\nconst BODY_PADDING_H = 16;\nconst BODY_PADDING_V = 12;\nconst HEADER_GAP = 8;\nconst TITLE_FONT_SIZE = 15;\nconst TITLE_FONT_WEIGHT = '600' as const;\nconst CHEVRON_SIZE = 18;\nconst ROTATE_DURATION_MS = 160;\nconst ROTATE_COLLAPSED = 0;\nconst ROTATE_EXPANDED = 1;\nconst COLLAPSED_DEG = '0deg';\nconst PLAIN_EXPANDED_DEG = '180deg';\nconst BOXED_EXPANDED_DEG = '90deg';\nconst DISABLED_OPACITY = 0.5;\nconst FULL_OPACITY = 1;\nconst ROLE_REGION = 'region';\n\n// Boxed variant (AML v1 `.sc-more` / `.adv-match` <details>).\nconst BOX_BORDER_RADIUS = 10;\nconst BOX_PADDING_H = 14;\nconst BOX_HEADER_PADDING_V = 8;\nconst BOX_BODY_PADDING_BOTTOM = 10;\nconst BOX_BODY_PADDING_TOP = 2;\nconst BOX_TITLE_FONT_SIZE = 14;\nconst BOX_MARKER_FONT_SIZE = 13;\nconst BOX_MARKER_GAP = 6;\nconst BOX_MARKER = '▸'; // ▸\n\nconst styles = StyleSheet.create({\n item: { borderTopWidth: StyleSheet.hairlineWidth },\n boxItem: { borderWidth: 1, borderRadius: BOX_BORDER_RADIUS, paddingHorizontal: BOX_PADDING_H },\n header: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingHorizontal: HEADER_PADDING_H,\n paddingVertical: HEADER_PADDING_V,\n },\n boxHeader: { paddingHorizontal: 0, paddingVertical: BOX_HEADER_PADDING_V },\n headerLeft: { flexShrink: 1, flexGrow: 1 },\n headerLeftRow: { flexDirection: 'row', alignItems: 'center' },\n headerRight: { flexDirection: 'row', alignItems: 'center', marginLeft: HEADER_GAP },\n title: { fontSize: TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },\n boxTitle: { fontSize: BOX_TITLE_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },\n chevron: { marginLeft: HEADER_GAP },\n marker: { marginRight: BOX_MARKER_GAP },\n markerText: { fontSize: BOX_MARKER_FONT_SIZE, fontWeight: TITLE_FONT_WEIGHT },\n body: { paddingHorizontal: BODY_PADDING_H, paddingBottom: BODY_PADDING_V },\n boxBody: { paddingHorizontal: 0, paddingBottom: BOX_BODY_PADDING_BOTTOM, paddingTop: BOX_BODY_PADDING_TOP },\n});\n\nexport interface AccordionItemProps {\n /** Stable unique id used for open-state tracking + derived testIDs. */\n id: string;\n /** Header title — a string (rendered as themed text) or custom node. */\n title: string | React.ReactNode;\n /** Optional right-hand adornment (badge, count, icon…) shown before the chevron. */\n right?: React.ReactNode;\n /** Collapsible body content. */\n children?: React.ReactNode;\n /** Start open in uncontrolled mode (ignored when the container is controlled). */\n defaultOpen?: boolean;\n /** Disable toggling for this item. */\n disabled?: boolean;\n /** testID for the header button. Body = `${testID}-body`, chevron = `${testID}-chevron`. */\n testID?: string;\n /** Accessible name for the header button (defaults to `title` when it is a string). */\n accessibilityLabel?: string;\n /** Accessible hint for the header button. */\n accessibilityHint?: string;\n}\n\n/**\n * Extra web-only DOM prop react-native-web's `Pressable` forwards but RN's types omit.\n * `Pressable` renders `accessibilityRole=\"button\"` as a native `<button>` (keyboard-operable\n * for free in real browsers); the handler calls `preventDefault()` so the native\n * Enter/Space activation does not ALSO fire `onPress` (no double toggle).\n */\ninterface WebKeyboardProps {\n onKeyDown?: (event: { key?: string; preventDefault?: () => void }) => void;\n}\n\nconst ACTIVATION_KEYS = ['Enter', ' ', 'Spacebar'];\nconst INSTANT_DURATION_MS = 0;\n\n/*\n * The local `prefersReducedMotion` that used to sit here was a character-for-character copy of\n * the one in accordionAnimation.ts. Both now come from @dloizides/rn-web-hooks. This call site\n * uses the HOOK rather than the imperative probe: it reads the preference during render, so the\n * chevron now responds when the user flips \"reduce motion\" mid-session — the one-shot copy kept\n * animating until some unrelated state change happened to re-run the effect.\n */\n\nexport const AccordionItem = ({\n id,\n title,\n right,\n children,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- read by the container's initial-open scan, not here\n defaultOpen: _defaultOpen,\n disabled = false,\n testID,\n accessibilityLabel,\n accessibilityHint,\n}: AccordionItemProps): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n const { openIds, toggle, variant } = useAccordionContext();\n const boxed = variant === 'boxed';\n\n const expanded = openIds.has(id);\n const headerTestID = testID ?? `accordion-item-${id}`;\n const bodyTestID = `${headerTestID}-body`;\n const chevronTestID = `${headerTestID}-chevron`;\n\n const [rotation] = useState(() => new Animated.Value(expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED));\n const reducedMotion = useReducedMotion();\n\n useEffect(() => {\n Animated.timing(rotation, {\n toValue: expanded ? ROTATE_EXPANDED : ROTATE_COLLAPSED,\n duration: reducedMotion ? INSTANT_DURATION_MS : ROTATE_DURATION_MS,\n easing: Easing.out(Easing.ease),\n useNativeDriver: Platform.OS !== 'web',\n }).start();\n }, [expanded, rotation, reducedMotion]);\n\n const rotate = rotation.interpolate({\n inputRange: [ROTATE_COLLAPSED, ROTATE_EXPANDED],\n outputRange: [COLLAPSED_DEG, boxed ? BOXED_EXPANDED_DEG : PLAIN_EXPANDED_DEG],\n });\n\n const handlePress = useCallback(() => {\n if (!disabled) toggle(id);\n }, [disabled, id, toggle]);\n\n const handleKeyDown = useCallback(\n (event: { key?: string; preventDefault?: () => void }) => {\n if (disabled) return;\n const key = event.key ?? '';\n const isActivation = ACTIVATION_KEYS.includes(key);\n if (!isActivation) return;\n if (typeof event.preventDefault === 'function') event.preventDefault();\n toggle(id);\n },\n [disabled, id, toggle],\n );\n\n const keyboardProps: WebKeyboardProps =\n Platform.OS === 'web' ? { onKeyDown: handleKeyDown } : {};\n\n const itemStyle = useMemo<ViewStyle[]>(\n () =>\n boxed\n ? [styles.boxItem, { borderColor: colors.border }]\n : [styles.item, { borderTopColor: colors.border }],\n [boxed, colors.border],\n );\n const headerStyle = useMemo<ViewStyle[]>(\n () => [\n styles.header,\n ...(boxed ? [styles.boxHeader] : []),\n { opacity: disabled ? DISABLED_OPACITY : FULL_OPACITY },\n ],\n [boxed, disabled],\n );\n\n const resolvedLabel =\n accessibilityLabel ?? (typeof title === 'string' ? title : undefined);\n\n const titleNode =\n typeof title === 'string' ? (\n <Text style={[boxed ? styles.boxTitle : styles.title, { color: boxed ? colors.textSecondary : colors.text }]}>\n {title}\n </Text>\n ) : (\n title\n );\n\n return (\n <View style={itemStyle}>\n <Pressable\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.accordionToggleHint)}\n accessibilityLabel={resolvedLabel}\n accessibilityRole=\"button\"\n accessibilityState={{ expanded, disabled }}\n aria-controls={bodyTestID}\n aria-expanded={expanded}\n disabled={disabled}\n style={headerStyle}\n testID={headerTestID}\n onPress={handlePress}\n {...keyboardProps}\n >\n <View style={[styles.headerLeft, boxed ? styles.headerLeftRow : null]}>\n {boxed ? (\n // Decorative — the open/closed state is already conveyed by aria-expanded on the header.\n <Animated.View\n accessibilityElementsHidden\n aria-hidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.marker, { transform: [{ rotate }] }]}\n testID={chevronTestID}\n >\n <Text style={[styles.markerText, { color: colors.textSecondary }]}>{BOX_MARKER}</Text>\n </Animated.View>\n ) : null}\n {titleNode}\n </View>\n <View style={styles.headerRight}>\n {right}\n {boxed ? null : (\n <Animated.View\n accessibilityElementsHidden\n aria-hidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.chevron, { transform: [{ rotate }] }]}\n >\n <SvgIcon color={colors.textSecondary} name=\"chevronDown\" size={CHEVRON_SIZE} testID={chevronTestID} />\n </Animated.View>\n )}\n </View>\n </Pressable>\n\n {expanded ? (\n <View\n accessibilityLabel={resolvedLabel}\n nativeID={bodyTestID}\n role={ROLE_REGION}\n style={boxed ? styles.boxBody : styles.body}\n testID={bodyTestID}\n >\n {children}\n </View>\n ) : null}\n </View>\n );\n};\n\nexport default AccordionItem;\n","/**\n * Pure truncation helpers for `TruncatedText`.\n *\n * WHY MIDDLE AND NOT TAIL: the component exists because full URLs (adverse-media article\n * links in the AML console) blew out their row. The obvious fix — RN's `numberOfLines={1}`,\n * which RN-web compiles to `text-overflow: ellipsis` — truncates at the TAIL, and a\n * tail-truncated URL is useless: every URL from one publisher collapses to the same\n * `https://timesofindia.indiatimes.com/city/de…` prefix, so the reader learns nothing about\n * WHICH article it is. The informative parts sit at both ends — the HOST (who published it,\n * the trust signal) and the SLUG (what it is about). The uninformative part is the middle\n * path. So we drop the middle:\n *\n * timesofindia.indiatimes.com/…/delhi-court-orders-probe\n *\n * CSS cannot express that, so it is computed here in JS. The component still applies\n * `numberOfLines={1}` on top as a hard backstop, so even if the width estimate is off the\n * text can never overflow its container.\n */\n\n/** The single-character ellipsis (U+2026) — one glyph, so it costs one character of budget. */\nexport const ELLIPSIS = '…';\n\n/** Below this many characters a middle-truncation leaves nothing readable on either side. */\nconst MIN_TRUNCATABLE_CHARS = 4;\n\n/** Leading `scheme://` and a leading `www.`, which carry no information for a reader. */\nconst SCHEME_PREFIX = /^[a-z][a-z0-9+.-]*:\\/\\//i;\nconst WWW_PREFIX = /^www\\./i;\n/** A single trailing slash — cosmetic only. */\nconst TRAILING_SLASH = /\\/$/;\n\n/**\n * Middle-truncate `value` to at most `maxChars` characters, joining the kept head and tail\n * with an ellipsis. Returns `value` unchanged when it already fits (or when `maxChars` is too\n * small to leave anything readable, in which case the caller's `numberOfLines` backstop clamps\n * it instead of us emitting a meaningless \"a…z\").\n *\n * The head keeps the extra character on an odd budget, because for both URLs and identifiers\n * the left side is the more identifying one.\n */\nexport function truncateMiddle(value: string, maxChars: number): string {\n if (maxChars < MIN_TRUNCATABLE_CHARS) return value;\n if (value.length <= maxChars) return value;\n\n const budget = maxChars - 1; // the ellipsis itself costs one character\n const head = Math.ceil(budget / 2);\n const tail = budget - head;\n return `${value.slice(0, head)}${ELLIPSIS}${value.slice(value.length - tail)}`;\n}\n\n/**\n * Strip the parts of a URL a human never needs to read — the scheme, a leading `www.`, and a\n * bare trailing slash — so the truncation budget is spent on the host and the slug instead.\n * Non-URL values (opaque list identifiers) pass through untouched.\n */\nexport function formatUrlForDisplay(value: string): string {\n const withoutScheme = value.replace(SCHEME_PREFIX, '');\n const withoutWww = withoutScheme.replace(WWW_PREFIX, '');\n const trimmed = withoutWww.replace(TRAILING_SLASH, '');\n return trimmed.length > 0 ? trimmed : value;\n}\n","/**\n * The width `TruncatedText` has to work with.\n *\n * WHY NOT `onLayout`, AND WHY NOT `ResizeObserver`: both were tried and neither delivered a\n * single callback for this element under react-native-web 0.21 — verified in Chrome, not\n * assumed. `onLayout` on a `<Text>` never fires; moving it to a wrapping `<View>` did not fire\n * either; observing the same node with a `ResizeObserver` produced zero notifications. A\n * measurement hook that silently never runs is worse than none, because the component keeps\n * rendering (just untruncated) and every unit test still passes.\n *\n * So on web the width is read straight off the DOM: the **parent's** inner width, in a ref\n * callback during commit, plus a `resize` listener. The parent is measured rather than the\n * element itself for a specific reason — the element shrink-wraps its own text, so measuring it\n * would feed our output back into our input and oscillate: truncate → element narrows →\n * re-measure smaller → truncate harder. The parent's width does not depend on what we put in it.\n *\n * Native keeps `onLayout`, where it works.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { Platform, type LayoutChangeEvent } from 'react-native';\n\nconst UNMEASURED = 0;\nconst IS_WEB = Platform.OS === 'web';\n\n/** The usable inner width of `node`'s parent — its content box, less its padding. */\nfunction measureParentInnerWidth(node: HTMLElement): number {\n const parent = node.parentElement;\n if (parent === null) return UNMEASURED;\n const cs = window.getComputedStyle(parent);\n const padding = (parseFloat(cs.paddingLeft) || 0) + (parseFloat(cs.paddingRight) || 0);\n return Math.max(UNMEASURED, parent.clientWidth - padding);\n}\n\nexport interface AvailableWidth {\n /** 0 until measured — callers render the full value for that first frame. */\n width: number;\n /** Attach to the measured element. On web it also captures the DOM node. */\n measureRef: (node: unknown) => void;\n /** Native measurement path; a no-op on web. */\n onLayout: (event: LayoutChangeEvent) => void;\n}\n\nexport function useAvailableWidth(): AvailableWidth {\n const [width, setWidth] = useState(UNMEASURED);\n const nodeRef = useRef<HTMLElement | null>(null);\n\n const measureRef = useCallback((node: unknown) => {\n if (!IS_WEB) return;\n nodeRef.current = node as HTMLElement | null;\n if (nodeRef.current !== null) setWidth(measureParentInnerWidth(nodeRef.current));\n }, []);\n\n useEffect(() => {\n if (!IS_WEB) return undefined;\n const remeasure = (): void => {\n const node = nodeRef.current;\n if (node !== null) setWidth(measureParentInnerWidth(node));\n };\n window.addEventListener('resize', remeasure);\n return () => window.removeEventListener('resize', remeasure);\n }, []);\n\n const onLayout = useCallback((event: LayoutChangeEvent) => {\n if (IS_WEB) return;\n setWidth(event.nativeEvent.layout.width);\n }, []);\n\n return { width, measureRef, onLayout };\n}\n","/**\n * TruncatedText — a single-line text/link that middle-truncates to fit its container and\n * never overflows, at any width.\n *\n * THREE THINGS THAT LOOK LIKE THEY WOULD WORK AND DO NOT (all verified against\n * react-native-web 0.21, not assumed):\n *\n * 1. `numberOfLines={1}` alone. RN-web compiles it to `text-overflow: ellipsis`, which only\n * truncates at the TAIL. Every URL from one publisher then collapses to the same\n * `timesofindia.indiatimes.com/city/de…` prefix — the reader cannot tell the articles\n * apart. There is no CSS for middle truncation, so it is computed in JS here.\n * 2. `title={full}` for the hover tooltip. RN-web's `<Text>` forwards exactly\n * `href`, `lang` and `pointerEvents` beyond the shared whitelist — `title` is dropped\n * silently. It is set on the host node through a ref instead (the same escape hatch\n * `ui-buttons/useKeyboardActivation` already uses).\n * 3. JS truncation alone. The character budget is estimated from the measured width, and an\n * estimate can be wrong for an unusual glyph mix. So `numberOfLines={1}` is ALSO applied,\n * as a hard backstop: if the estimate ever runs long, CSS clamps it. Overflow is then\n * impossible by construction rather than by tuning.\n * 4. `onLayout` (on the `<Text>` OR on a wrapping `<View>`), and `ResizeObserver`. None of the\n * three delivered a single callback for this element under RN-web 0.21. The measured width\n * stayed 0, the character budget stayed 0, and the component silently degraded to exactly\n * the tail-only CSS truncation of (1) — compiling, typechecking and passing its unit tests\n * the whole time, because the helpers are pure and were never the broken part. Only a\n * browser could catch it. Width now comes from `useAvailableWidth`, which reads the parent's\n * inner width straight off the DOM on web; see that module for why the PARENT.\n *\n * The full, untruncated value always stays reachable: as the accessible name (`aria-label`)\n * and, on web, as the native tooltip.\n */\nimport React, { useCallback, useMemo, useRef } from \"react\";\n\nimport { Platform, StyleSheet, Text, type TextStyle } from \"react-native\";\n\nimport { formatUrlForDisplay, truncateMiddle } from \"./truncate\";\nimport { useAvailableWidth } from \"./useAvailableWidth\";\n\n/**\n * Mean glyph width as a fraction of font size, for the system sans stack. Deliberately on the\n * WIDE side of the true average (~0.5) so the estimate errs toward truncating slightly early\n * rather than overflowing — and `numberOfLines` catches whatever it still gets wrong.\n */\nconst AVG_CHAR_WIDTH_RATIO = 0.58;\nconst DEFAULT_FONT_SIZE = 13;\n/** Width is unknown until the first `onLayout`; render the full string for that one frame. */\nconst UNMEASURED = 0;\n\nconst styles = StyleSheet.create({\n base: { fontSize: DEFAULT_FONT_SIZE },\n /** `minWidth: 0` lets the text shrink inside a flex row instead of forcing the row wider. */\n fill: { flexShrink: 1, minWidth: 0 },\n});\n\nexport interface TruncatedTextProps {\n /** The full value. Always the accessible name and the web tooltip, however it is displayed. */\n value: string;\n /**\n * Treat `value` as a URL: drop `scheme://`, a leading `www.` and a bare trailing slash so the\n * character budget is spent on the host and the slug rather than on boilerplate.\n */\n isUrl?: boolean;\n /** Web only: render a real `<a href>`, so middle-click and \"copy link address\" work. */\n href?: string;\n onPress?: () => void;\n style?: TextStyle | TextStyle[];\n testID: string;\n accessibilityLabel: string;\n accessibilityHint: string;\n}\n\n/** Characters that fit in `width` at `fontSize`, or 0 while the width is still unmeasured. */\nfunction charBudget(width: number, fontSize: number): number {\n if (width <= UNMEASURED) return UNMEASURED;\n return Math.floor(width / (fontSize * AVG_CHAR_WIDTH_RATIO));\n}\n\nexport const TruncatedText = ({\n value,\n isUrl = false,\n href,\n onPress,\n style,\n testID,\n accessibilityLabel,\n accessibilityHint,\n}: TruncatedTextProps): React.ReactElement => {\n const { width, measureRef, onLayout } = useAvailableWidth();\n const hostRef = useRef<Text | null>(null);\n\n /**\n * One ref doing two jobs: hand the node to the width measurement, and set the native\n * tooltip. RN-web renders `<Text>` to a real DOM node, so the ref is an HTMLElement there;\n * on native the ref is a Text instance and the tooltip step is skipped.\n */\n const attachRef = useCallback(\n (node: Text | null) => {\n hostRef.current = node;\n measureRef(node);\n if (Platform.OS !== \"web\" || node === null) return;\n (node as unknown as HTMLElement).setAttribute?.(\"title\", value);\n },\n [value, measureRef],\n );\n\n const flatStyle = useMemo(\n () => StyleSheet.flatten([styles.base, style]) as TextStyle,\n [style],\n );\n const fontSize = flatStyle.fontSize ?? DEFAULT_FONT_SIZE;\n\n const display = useMemo(() => {\n const source = isUrl ? formatUrlForDisplay(value) : value;\n const budget = charBudget(width, fontSize);\n return budget === UNMEASURED ? source : truncateMiddle(source, budget);\n }, [value, isUrl, width, fontSize]);\n\n return (\n <Text\n ref={attachRef}\n onLayout={onLayout}\n numberOfLines={1}\n style={[styles.base, styles.fill, style]}\n testID={testID}\n accessibilityRole={\n onPress !== undefined || href !== undefined ? \"link\" : \"text\"\n }\n accessibilityLabel={accessibilityLabel}\n accessibilityHint={accessibilityHint}\n onPress={onPress}\n {...(Platform.OS === \"web\" && href !== undefined ? { href } : {})}\n >\n {display}\n </Text>\n );\n};\n\nexport default TruncatedText;\n"]}
|