@dloizides/ui-layout 1.40.0 → 1.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Section/SectionVariant.ts","../src/Section/Section.tsx","../src/AppText/TextKind.ts","../src/AppText/AppText.tsx","../src/constants.ts","../src/responsive.ts","../src/hooks/useIsWideViewport.ts","../src/ScreenColumn/ScreenColumn.tsx","../src/Heading/Heading.tsx","../src/StatusBadge/StatusBadge.tsx","../src/StickyPreview/hooks/useStuckSentinel.ts","../src/StickyPreview/hooks/useVisibleViewport.ts","../src/StickyPreview/StickyPreview.tsx","../src/hooks/useEscapeKey.ts","../src/hooks/useFocusTrap.ts","../src/hooks/useScrollLock.ts","../src/Modal/Modal.tsx","../src/PageFrame/components/PageOverlay.tsx","../src/PageFrame/utils/pageScale.ts","../src/PageFrame/PageFrame.tsx","../src/SegmentedControl/SegmentedControl.tsx","../src/Tabs/TabsCollapsedTrigger.ts","../src/ModalDropdown/DropdownVariant.ts","../src/ModalDropdown/menuStacking.ts","../src/ModalDropdown/MenuHeading.tsx","../src/ModalDropdown/SelectedMarker.ts","../src/ModalDropdown/OptionRow.tsx","../src/ModalDropdown/useAnchorTracking.ts","../src/ModalDropdown/useMenuKeyboard.ts","../src/ModalDropdown/useMenuPlacement.ts","../src/ModalDropdown/InlineMenu.tsx","../src/ModalDropdown/resolveDropdownVariant.ts","../src/ModalDropdown/ModalDropdown.tsx","../src/Tabs/TabsMenu.tsx","../src/Tabs/tabsResponsive.ts","../src/Tabs/Tabs.tsx","../src/UpgradePrompt/UpgradePrompt.tsx","../src/ModalShell/ModalShell.tsx","../src/SideSheet/SideSheet.tsx","../src/BottomSheet/BottomSheet.tsx","../src/Modal/ConfirmDialog.tsx","../src/Accordion/AccordionContext.ts","../src/Accordion/Accordion.tsx","../src/Accordion/AccordionItem.tsx","../src/TruncatedText/truncate.ts","../src/TruncatedText/useAvailableWidth.ts","../src/TruncatedText/TruncatedText.tsx","../src/CopyableId/CopyStatus.ts","../src/CopyableId/copyText.ts","../src/CopyableId/useCopyToClipboard.ts","../src/CopyableId/CopyableId.tsx","../src/BuildInfoFooter/formatBuildInfo.ts","../src/BuildInfoFooter/useApiCommit.ts","../src/BuildInfoFooter/BuildInfoFooter.tsx","../src/ListRow/components/CheckMark.tsx","../src/ListRow/hooks/useListRowTone.ts","../src/ListRow/hooks/useRowPalette.ts","../src/ListRow/RowSelectedStyle.ts","../src/ListRow/utils/focusVisible.ts","../src/ListRow/utils/rowLook.ts","../src/ListRow/ListRow.tsx"],"names":["SectionVariant","React","TextKind","useUi","jsx","styles","StyleSheet","View","Text","useState","useRef","useEffect","useMemo","Platform","jsxs","RNModal","ScrollView","Fragment","Pressable","TabsCollapsedTrigger","DropdownVariant","BORDER_WIDTH","SelectedMarker","useCallback","TouchableOpacity","IS_WEB","useLayoutEffect","BORDER_RADIUS","MENU_PADDING","Animated","useWindowDimensions","BODY_FONT_SIZE","MODAL_OVERLAY_COLOR","useEnterExit","Modal","PANEL_ENTER_SCALE","MIN_TOUCH_TARGET_PX","SvgIcon","CLOSE_ICON_SIZE","MESSAGE_FONT_SIZE","HEADER_GAP","TITLE_FONT_SIZE","handleKeyDown","DEFAULT_FONT_SIZE","UNMEASURED","CopyStatus","ROW_GAP","createContext","useContext","RowSelectedStyle","TRANSPARENT"],"mappings":";;;;;;;;;;;;;;;AAAO,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,gBAAA,MAAA,CAAA,GAAO,MAAA;AAFG,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;ACWZ,IAAM,MAAA,GAAS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,aAAU,MAAA,EAAQ,OAAA,CAAQ,QAAQ,MAAA,EAAQ,IAAA,CAAK,WAAA,EAAa,UAAA,EAAY,QAAQ,UAAA,EAAY,IAAA,EAAM,QAAQ,MAAA,EAAQ,MAAA,EAAQ,aAAa,CAAA,GACtI,IAAA;AAAA,0BACJU,IAAAA,CAACP,IAAAA,EAAA,EAAK,KAAA,EAAOF,SAAO,IAAA,EAClB,QAAA,EAAA;AAAA,4BAAAS,IAAAA,CAACP,IAAAA,EAAA,EAAK,KAAA,EAAOF,SAAO,IAAA,EACjB,QAAA,EAAA;AAAA,cAAA,IAAA,CAAK,KAAA,EAAO,IAAA,CAAK,UAAA,EAAY,IAAI,CAAA;AAAA,cACjC,IAAA,CAAK,QAAA,EAAU,IAAA,CAAK,SAAA,EAAW,IAAI;AAAA,aAAA,EACtC,CAAA;AAAA,4BACAS,IAAAA,CAACP,IAAAA,EAAA,EAAK,KAAA,EAAOF,SAAO,IAAA,EAClB,QAAA,EAAA;AAAA,8BAAAD,GAAAA,CAACG,IAAAA,EAAA,EAAK,KAAA,EAAOF,QAAAA,CAAO,MAAA,EAAS,QAAA,EAAA,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,SAAA,EAAW,KAAK,CAAA,EAAE,CAAA;AAAA,cAC9D,MAAA,KAAW,MAAA,GAAY,IAAA,mBAAOD,GAAAA,CAACG,MAAA,EAAK,KAAA,EAAOF,QAAAA,CAAO,MAAA,EAAS,QAAA,EAAA,MAAA,EAAO;AAAA,aAAA,EACrE;AAAA,WAAA,EACF;AAAA;AAAA;AAAA,KACF;AAAA,IACC,KAAA,IAAS;AAAA,GAAA,EACZ,CAAA;AAEJ","file":"index.mjs","sourcesContent":["export enum SectionVariant {\n Panel = 'panel',\n Card = 'card',\n}\n","/**\n * Section — a bordered card container that themes its border + surface.\n */\nimport React from 'react';\n\nimport { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { SectionVariant } from './SectionVariant';\n\nconst styles = StyleSheet.create({\n card: {\n padding: 16,\n borderWidth: 1,\n borderRadius: 6,\n },\n raised: {\n borderRadius: 12,\n gap: 12,\n },\n});\n\nexport interface SectionProps {\n children?: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n variant?: SectionVariant;\n testID?: string;\n}\n\nexport const Section = ({\n children,\n style,\n variant = SectionVariant.Panel,\n testID,\n}: SectionProps): React.ReactElement => {\n const { theme } = useUi();\n const isCard = variant === SectionVariant.Card;\n const fill = isCard ? theme.colors.background : theme.colors.surface;\n\n const containerStyle = React.useMemo(\n () => [styles.card, isCard ? styles.raised : null, { borderColor: theme.colors.border, backgroundColor: fill }, style],\n [theme.colors.border, fill, isCard, style],\n );\n\n return (\n <View style={containerStyle} testID={testID}>\n {children}\n </View>\n );\n};\n\nexport default Section;\n","export enum TextKind {\n Title = 'title',\n Heading = 'heading',\n Body = 'body',\n Strong = 'strong',\n Muted = 'muted',\n Small = 'small',\n}\n","import React from 'react';\n\nimport { Text, type StyleProp, type TextStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { TextKind } from './TextKind';\n\nexport interface AppTextProps {\n kind?: TextKind;\n color?: string;\n style?: StyleProp<TextStyle>;\n testID?: string;\n children: React.ReactNode;\n}\n\nconst SIZES: Record<TextKind, TextStyle> = {\n [TextKind.Title]: { fontSize: 24, fontWeight: '700', lineHeight: 30 },\n [TextKind.Heading]: { fontSize: 17, fontWeight: '700', lineHeight: 24 },\n [TextKind.Body]: { fontSize: 15, lineHeight: 22 },\n [TextKind.Strong]: { fontSize: 15, fontWeight: '700', lineHeight: 22 },\n [TextKind.Muted]: { fontSize: 14, lineHeight: 20 },\n [TextKind.Small]: { fontSize: 12, lineHeight: 16 },\n};\n\nexport const AppText = ({\n kind = TextKind.Body,\n color,\n style,\n testID,\n children,\n}: AppTextProps): React.ReactElement => {\n const { theme } = useUi();\n const quiet = kind === TextKind.Muted || kind === TextKind.Small;\n return (\n <Text\n style={[\n SIZES[kind],\n { color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },\n style,\n ]}\n testID={testID}\n >\n {children}\n </Text>\n );\n};\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 stickyPreview: 'sticky-preview',\n pageFrame: 'page-frame',\n upgradePrompt: 'upgrade-prompt',\n upgradePromptCta: 'upgrade-prompt-cta',\n upgradePromptDismiss: 'upgrade-prompt-dismiss',\n modalShell: 'template-modal',\n modalShellClose: 'cancel-button',\n /** Default base testID for the centered `Modal`; ✕ is `modal-close`, backdrop `modal-backdrop`. */\n modal: 'modal',\n sideSheet: 'side-sheet',\n bottomSheet: 'bottom-sheet',\n /** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */\n confirmDialog: 'confirm-dialog',\n accordion: 'accordion',\n /** Default testID for the `BuildInfoFooter` caption (`v<version>`). */\n buildInfoFooter: 'build-info-footer',\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 /**\n * Accessible hint on the collapsed (mobile) `Tabs` menu trigger — the button\n * that shows the active section and opens the vertical list of sections.\n */\n tabsMenuHint: 'common.tabsMenuHint',\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 /** `Modal`: accessible name + web tooltip of the top-right ✕ close button. */\n dialogClose: 'common.close',\n /** `PageFrame` (`enlargeable`): accessible name + hint of the preview that opens the full-size page. */\n pageEnlarge: 'common.pageEnlarge',\n pageEnlargeHint: 'common.pageEnlargeHint',\n /** `ConfirmDialog`: default Confirm button label (overridable via `confirmLabel`) + its hint. */\n confirm: 'common.confirm',\n confirmHint: 'common.confirmHint',\n /** `ConfirmDialog`: default Cancel button label (overridable via `cancelLabel`) + its hint. */\n cancel: 'common.cancel',\n cancelHint: 'common.cancelHint',\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 /** `CopyableId`: the copy control's label in each of its three states, plus its hint. */\n copy: 'common.copy',\n copyHint: 'common.copyHint',\n copied: 'common.copied',\n /**\n * Shown when the clipboard write genuinely failed — non-secure context, denied permission.\n * This string reaching a user is CORRECT behaviour, not a defect: the alternative is them\n * believing they hold an identifier they do not.\n */\n copyFailed: 'common.copyFailed',\n /** `CopyableId`: hint on the value itself, explaining it is shortened for display. */\n copyableIdHint: 'common.copyableIdHint',\n /** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */\n buildInfoHint: 'common.buildInfoHint',\n} as const;\n\n/*\n * ---------------------------------------------------------------------------\n * Responsive breakpoints + the minimum touch target (mobile-first.md rule 7).\n *\n * These are the ONE source for the numbers the kit and the seven portals change\n * shape at. Before this, four literals existed with no shared source:\n * `MENU_BREAKPOINT` (here), `RAIL_FULL_BREAKPOINT` and\n * `DEFAULT_SEARCH_BREAKPOINT` (`@dloizides/ui-nav`) and `MOBILE_BREAKPOINT`\n * (nextgame-web's D1 theme). Three of them agreed at 768 by coincidence rather\n * than by reference, and each was named after its CALL SITE, which is exactly\n * why nobody noticed they were the same rule.\n *\n * The two breakpoints are deliberately DIFFERENT numbers and must stay so: they\n * answer different questions. Collapsing them into one would move type on every\n * portal.\n * ---------------------------------------------------------------------------\n */\n\n/**\n * Viewport width (px) below which the TYPE ramp drops to its mobile sizes.\n *\n * Typography, not layout. A type scale steps down earlier than a column layout\n * collapses because a 44px display line is unreadable on a phone long before a\n * two-column grid stops fitting. nextgame-web's D1 ramp (`typeStyle`) is the\n * only implementation today; the number lives here so the next one reuses it.\n */\nexport const TYPE_SCALE_BREAKPOINT = 600;\n\n/**\n * Viewport width (px) at/above which LAYOUT keeps its wide form: the inline\n * anchored dropdown menu, the horizontal tab row, the persistent nav rail, the\n * inline sidebar search field. Below it each collapses to its phone affordance.\n *\n * This is the value `MENU_BREAKPOINT`, `RAIL_FULL_BREAKPOINT` and\n * `DEFAULT_SEARCH_BREAKPOINT` each hard-coded independently.\n */\nexport const LAYOUT_COLLAPSE_BREAKPOINT = 768;\n\n/**\n * Minimum interactive hit box, in CSS px, on BOTH axes — measured on the box,\n * never on the glyph inside it. WCAG 2.5.5 / mobile-first.md.\n */\nexport const MIN_TARGET_PX = 44;\n","/**\r\n * The wide-web viewport rule, in one place.\r\n *\r\n * `ModalDropdown` and `Tabs` each computed `platformOS === 'web' && width >= n`\r\n * inline. The predicate is the same rule in both: on ANY native platform the\r\n * surface is a phone or tablet, never a desktop, so the wide form is refused at\r\n * every width; on web it turns on at the breakpoint.\r\n */\r\nimport { LAYOUT_COLLAPSE_BREAKPOINT } from './constants';\r\n\r\n/** The web platform key that `Platform.OS` reports under react-native-web. */\r\nexport const WEB_PLATFORM = 'web';\r\n\r\n/**\r\n * `true` only on a web viewport at/above `breakpoint`. Native always returns\r\n * `false`, whatever the width.\r\n */\r\nexport function isWideWebViewport(\r\n width: number,\r\n platformOS: string,\r\n breakpoint: number = LAYOUT_COLLAPSE_BREAKPOINT,\r\n): boolean {\r\n return platformOS === WEB_PLATFORM && width >= breakpoint;\r\n}\r\n","import { Platform, useWindowDimensions } from 'react-native';\n\nimport { LAYOUT_COLLAPSE_BREAKPOINT } from '../constants';\nimport { isWideWebViewport } from '../responsive';\n\nexport function useIsWideViewport(breakpoint: number = LAYOUT_COLLAPSE_BREAKPOINT): boolean {\n const { width } = useWindowDimensions();\n return isWideWebViewport(width, Platform.OS, breakpoint);\n}\n","import React from 'react';\n\nimport { StyleSheet, View } from 'react-native';\n\nimport { useIsWideViewport } from '../hooks/useIsWideViewport';\n\nconst styles = StyleSheet.create({\n outer: { alignItems: 'center', width: '100%' },\n column: { width: '100%', gap: 16 },\n desktop: { paddingHorizontal: 32, paddingVertical: 24 },\n mobile: { paddingHorizontal: 16, paddingVertical: 16 },\n wide: { maxWidth: 1200 },\n narrow: { maxWidth: 720 },\n});\n\nexport interface ScreenColumnProps {\n children: React.ReactNode;\n narrow?: boolean;\n}\n\nexport const ScreenColumn = ({ children, narrow = false }: ScreenColumnProps): React.ReactElement => {\n const isWide = useIsWideViewport();\n return (\n <View style={styles.outer}>\n <View style={[styles.column, isWide ? styles.desktop : styles.mobile, narrow ? styles.narrow : styles.wide]}>\n {children}\n </View>\n </View>\n );\n};\n","/**\n * Heading — themed section heading text, rendered as a REAL `<h1>`–`<h6>` on web.\n *\n * ## Why `level` exists\n *\n * `accessibilityRole=\"header\"` maps to the ARIA `heading` role, which react-native-web turns\n * into a real heading element — but with no `aria-level` it always emits `<h1>`. A screen\n * having several `<h1>`s and no `<h2>` is a flat document: heading navigation, the primary way\n * assistive-tech users move around a long page, lists every section as a peer of the page title.\n *\n * `level` supplies `aria-level`, which RN-web uses to pick `h{level}`. It defaults to 2 rather\n * than 1 on purpose: a page has exactly ONE `<h1>` (its title) and many section headings, so the\n * common case must be the safe one. A second `<h1>` is a defect that renders identically to a\n * correct heading, so nothing about the page would reveal the mistake.\n *\n * The visual size is deliberately NOT derived from `level`. Heading level is document structure;\n * type scale is design. Tying them together is what pushes authors to pick a level for its font\n * size and break the outline to get the look they want.\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\n/** Section heading — the common case. A page's single `<h1>` must ask for level 1 explicitly. */\nconst DEFAULT_HEADING_LEVEL = 2;\n\n/** `h1`–`h6`; HTML defines no `h7`. */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n /**\n * Document outline depth → `<h1>`–`<h6>` on web, `aria-level` on native. Defaults to 2.\n * Pick it from the page's STRUCTURE, never from how large you want the text to look.\n */\n level?: HeadingLevel;\n /**\n * Merged AFTER the themed base, for the genuine one-off — a page title that needs to be\n * visibly larger than a section heading. Structure stays in `level`; size lives here.\n */\n style?: React.ComponentProps<typeof Text>['style'];\n testID?: string;\n}\n\nexport const Heading = ({\n text,\n children,\n level = DEFAULT_HEADING_LEVEL,\n style,\n testID,\n}: HeadingProps): React.ReactElement => {\n const { theme } = useUi();\n\n const headingStyle = React.useMemo(\n () => [styles.heading, { color: theme.colors.text }, style],\n [theme.colors.text, style],\n );\n\n return (\n <Text\n accessibilityRole=\"header\"\n aria-level={level}\n style={headingStyle}\n testID={testID ?? LAYOUT_TEST_IDS.headingText}\n >\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;\nconst ICON_GAP = 4;\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 // Never wider than the container: a long label wraps inside the pill instead of being clipped.\n maxWidth: '100%',\n },\n badgeWithIcon: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: ICON_GAP,\n },\n badgeDashed: {\n borderWidth: 1,\n borderStyle: 'dashed',\n },\n text: {\n fontSize: DEFAULT_FONT_SIZE,\n fontWeight: '600',\n flexShrink: 1,\n },\n});\n\nexport interface StatusBadgeProps {\n label: string;\n color: string;\n backgroundColor: string;\n icon?: React.ReactNode;\n dashed?: boolean;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n}\n\nexport const StatusBadge = ({\n label,\n color,\n backgroundColor,\n icon,\n dashed = false,\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 dashedColor = useMemo(() => ({ borderColor: color }), [color]);\n const dynamicText = useMemo(() => ({ color }), [color]);\n const hasIcon = icon !== undefined && icon !== null;\n\n return (\n <View\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint)}\n accessibilityLabel={accessibilityLabel ?? label}\n style={[styles.badge, hasIcon && styles.badgeWithIcon, dynamicBadge, dashed && styles.badgeDashed, dashed && dashedColor]}\n testID={testID}\n >\n {hasIcon ? <View aria-hidden>{icon}</View> : null}\n <Text style={[styles.text, dynamicText]}>{label}</Text>\n </View>\n );\n};\n\nexport default StatusBadge;\n","import { useEffect, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport type { View } from 'react-native';\n\n/** True when the sentinel has scrolled above the sticky line, not merely out of view below it. */\nexport function isPastStickyLine(sentinelTop: number, isIntersecting: boolean, topOffset: number): boolean {\n return !isIntersecting && sentinelTop < topOffset;\n}\n\n/** Watches a sentinel placed just above a sticky element and reports when that element is stuck. */\nexport function useStuckSentinel(topOffset: number): { sentinelRef: RefObject<View | null>; isStuck: boolean } {\n const sentinelRef = useRef<View>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n const node = sentinelRef.current as unknown as Element | null;\n if (node === null || typeof IntersectionObserver === 'undefined') return undefined;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const entry = entries[entries.length - 1];\n if (entry !== undefined) setIsStuck(isPastStickyLine(entry.boundingClientRect.top, entry.isIntersecting, topOffset));\n },\n { rootMargin: `-${topOffset}px 0px 0px 0px` },\n );\n observer.observe(node);\n return () => observer.disconnect();\n }, [topOffset]);\n\n return { sentinelRef, isStuck };\n}\n","import { useEffect, useRef, useState } from 'react';\n\nconst KEYBOARD_HEIGHT_RATIO = 0.75;\n\nexport interface VisibleViewport {\n offsetTop: number;\n keyboardOpen: boolean;\n}\n\nconst INITIAL: VisibleViewport = { offsetTop: 0, keyboardOpen: false };\n\n/** True when the visible height has dropped far enough below the tallest height seen at this width. */\nexport function isKeyboardOpen(visibleHeight: number, tallestHeight: number): boolean {\n return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;\n}\n\n/** Tracks the Visual Viewport offset and keyboard state; stays at its initial value where the API is absent. */\nexport function useVisibleViewport(): VisibleViewport {\n const [state, setState] = useState<VisibleViewport>(INITIAL);\n const tallest = useRef({ width: 0, height: 0 });\n\n useEffect(() => {\n const viewport = typeof window === 'undefined' ? undefined : window.visualViewport;\n if (viewport === undefined || viewport === null) return undefined;\n\n const read = (): void => {\n const unzoomedHeight = viewport.height * viewport.scale;\n const unzoomedWidth = viewport.width * viewport.scale;\n const widthChanged = tallest.current.width !== unzoomedWidth;\n const height = widthChanged ? unzoomedHeight : Math.max(tallest.current.height, unzoomedHeight);\n tallest.current = { width: unzoomedWidth, height };\n const offsetTop = viewport.offsetTop;\n const keyboardOpen = isKeyboardOpen(unzoomedHeight, height);\n setState((previous) =>\n previous.offsetTop === offsetTop && previous.keyboardOpen === keyboardOpen\n ? previous\n : { offsetTop, keyboardOpen },\n );\n };\n\n read();\n viewport.addEventListener('resize', read);\n viewport.addEventListener('scroll', read);\n return () => {\n viewport.removeEventListener('resize', read);\n viewport.removeEventListener('scroll', read);\n };\n }, []);\n\n return state;\n}\n","import React, { useMemo } from 'react';\n\nimport { Platform, StyleSheet, View } from 'react-native';\nimport type { ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_TEST_IDS } from '../constants';\nimport { WEB_PLATFORM } from '../responsive';\nimport { useStuckSentinel } from './hooks/useStuckSentinel';\nimport { useVisibleViewport } from './hooks/useVisibleViewport';\n\nconst STICKY_Z_INDEX = 5;\n\nconst styles = StyleSheet.create({\n sentinel: { height: 1, marginBottom: -1 },\n compact: { borderBottomWidth: 1 },\n});\n\nexport interface StickyPreviewProps {\n full: React.ReactNode;\n compact: React.ReactNode;\n forceCompact?: boolean;\n topOffset?: number;\n accessibilityLabel: string;\n accessibilityHint?: string;\n testID?: string;\n}\n\n/** Keeps a preview at the top of the visible viewport, swapping to its compact slot while space is short. */\nexport const StickyPreview = ({\n full,\n compact,\n forceCompact = false,\n topOffset = 0,\n accessibilityLabel,\n accessibilityHint,\n testID = LAYOUT_TEST_IDS.stickyPreview,\n}: StickyPreviewProps): React.ReactElement => {\n const { theme } = useUi();\n const { offsetTop, keyboardOpen } = useVisibleViewport();\n const { sentinelRef, isStuck } = useStuckSentinel(topOffset);\n const isCompact = forceCompact || isStuck || keyboardOpen;\n\n const pinned = useMemo(() => {\n const web = { position: 'sticky', top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };\n return (Platform.OS === WEB_PLATFORM ? web : {}) as unknown as ViewStyle;\n }, [offsetTop, topOffset]);\n\n return (\n <>\n <View aria-hidden ref={sentinelRef} style={styles.sentinel} />\n <View\n accessibilityHint={accessibilityHint}\n accessibilityLabel={accessibilityLabel}\n role=\"region\"\n style={[\n pinned,\n { backgroundColor: theme.colors.background, borderColor: theme.colors.border },\n isCompact && styles.compact,\n ]}\n testID={testID}\n >\n <View testID={`${testID}-${isCompact ? 'compact' : 'full'}`}>{isCompact ? compact : full}</View>\n </View>\n </>\n );\n};\n\nexport default StickyPreview;\n","/**\n * useEscapeKey — calls `onClose` when the user presses Escape (web only).\n *\n * No-op on native, where a dialog is dismissed with the hardware back button through\n * RN `Modal`'s `onRequestClose`. The `document` listener is attached ONLY while `enabled`,\n * so a closed dialog never intercepts an Escape meant for something else on the page.\n */\nimport { useEffect } from 'react';\n\nimport { Platform } from 'react-native';\n\nexport function useEscapeKey(enabled: boolean, onClose: () => void): void {\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [enabled, onClose]);\n}\n","/**\r\n * Traps keyboard focus within a container element on web.\r\n * No-op on native platforms where `<Modal>` handles focus containment.\r\n *\r\n * On enable: saves the previously focused element and focuses `initialFocusTestID`, else keeps a\r\n * child that already took focus (autoFocus), else the first focusable child.\r\n * Tab wraps from last to first; Shift+Tab wraps from first to last. On disable/unmount:\r\n * restores focus to the saved element.\r\n */\r\nimport { useEffect, useRef } from 'react';\r\nimport type { RefObject } from 'react';\r\n\r\nimport { Platform } from 'react-native';\r\nimport type { View } from 'react-native';\r\n\r\nconst FOCUSABLE_SELECTOR = [\r\n 'a[href]',\r\n 'button:not([disabled])',\r\n 'input:not([disabled])',\r\n 'select:not([disabled])',\r\n 'textarea:not([disabled])',\r\n '[tabindex]:not([tabindex=\"-1\"])',\r\n].join(', ');\r\n\r\nfunction getFocusableElements(container: HTMLElement): HTMLElement[] {\r\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\r\n}\r\n\r\nfunction savePreviousFocus(): HTMLElement | null {\r\n return document.activeElement instanceof HTMLElement ? document.activeElement : null;\r\n}\r\n\r\nfunction focusInitial(domNode: HTMLElement, initialFocusTestID: string | undefined): void {\r\n const named =\r\n initialFocusTestID === undefined\r\n ? null\r\n : domNode.querySelector<HTMLElement>(`[data-testid=\"${initialFocusTestID}\"]`);\r\n if (named) {\r\n named.focus();\r\n return;\r\n }\r\n if (domNode.contains(document.activeElement)) return;\r\n getFocusableElements(domNode)[0]?.focus();\r\n}\r\n\r\nfunction handleKeyDown(domNode: HTMLElement, event: KeyboardEvent): void {\r\n if (event.key !== 'Tab') return;\r\n\r\n const focusable = getFocusableElements(domNode);\r\n if (focusable.length === 0) {\r\n event.preventDefault();\r\n return;\r\n }\r\n\r\n const first = focusable[0];\r\n const last = focusable[focusable.length - 1];\r\n if (!first || !last) {\r\n event.preventDefault();\r\n return;\r\n }\r\n const active = document.activeElement;\r\n\r\n if (event.shiftKey && active === first) {\r\n event.preventDefault();\r\n last.focus();\r\n } else if (!event.shiftKey && active === last) {\r\n event.preventDefault();\r\n first.focus();\r\n }\r\n}\r\n\r\nexport function useFocusTrap(\r\n containerRef: RefObject<View | null>,\r\n enabled: boolean,\r\n initialFocusTestID?: string,\r\n): void {\r\n const previousFocusRef = useRef<HTMLElement | null>(null);\r\n\r\n useEffect(() => {\r\n if (Platform.OS !== 'web' || !enabled) return;\r\n\r\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\r\n const domNode = containerRef.current as unknown as HTMLElement | null;\r\n if (!domNode) return;\r\n\r\n const previous = savePreviousFocus();\r\n previousFocusRef.current = previous !== null && domNode.contains(previous) ? null : previous;\r\n queueMicrotask(() => focusInitial(domNode, initialFocusTestID));\r\n\r\n const listener = (e: KeyboardEvent): void => handleKeyDown(domNode, e);\r\n domNode.addEventListener('keydown', listener);\r\n\r\n return () => {\r\n domNode.removeEventListener('keydown', listener);\r\n previousFocusRef.current?.focus();\r\n previousFocusRef.current = null;\r\n };\r\n }, [containerRef, enabled, initialFocusTestID]);\r\n}\r\n","/**\n * useScrollLock — freezes page scroll (web only) while `enabled`, restoring the prior\n * `document.body` overflow on cleanup.\n *\n * No-op on native, where the RN `Modal` already covers the screen. Prevents the content\n * BEHIND an open dialog from scrolling under the backdrop while the dialog is focus-trapped.\n */\nimport { useEffect } from 'react';\n\nimport { Platform } from 'react-native';\n\nexport function useScrollLock(enabled: boolean): void {\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n const { body } = document;\n const previousOverflow = body.style.overflow;\n body.style.overflow = 'hidden';\n\n return () => {\n body.style.overflow = previousOverflow;\n };\n }, [enabled]);\n}\n","/**\n * Modal — a themed, CENTERED dialog overlay for RN + RN-web.\n *\n * Distinct from this package's {@link import('../ModalShell/ModalShell').ModalShell}, which is a\n * full-screen slide-up sheet. `Modal` is the floating card an app opens over the current screen:\n * a scrim, a rounded surface, an optional header (title + a top-right ✕ close), a scrollable body,\n * and an optional footer (action buttons). It is the shared shell {@link ConfirmDialog} is built on,\n * and the replacement for per-app dialogs like kefi-web's `PromoterActionModal`.\n *\n * DISMISSAL — four routes, all funnel to `onClose`:\n * - the top-right ✕ button (web tooltip + aria-label \"Close\"; a 44dp `IconButton` target),\n * - a press on the backdrop scrim (a SIBLING of the dialog, so option/action buttons are never\n * nested inside a button — invalid DOM),\n * - Escape on web (via {@link useEscapeKey}),\n * - the hardware back button on native (RN `Modal`'s `onRequestClose`).\n *\n * ACCESSIBILITY: the dialog carries `role=\"dialog\"` + `aria-modal` (via `accessibilityViewIsModal`)\n * and an accessible name (`accessibilityLabel` → `title` → the neutral \"dialog\" key). Focus is\n * trapped within the dialog on web ({@link useFocusTrap}) and restored to the opener on close, and\n * page scroll behind the dialog is locked ({@link useScrollLock}).\n *\n * Every colour is read from the app's theme via `useUi()` — no raw literals.\n */\nimport React, { useMemo, useRef } from 'react';\n\nimport { Animated, Modal as RNModal, ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';\n\nimport { IconButton } from '@dloizides/ui-buttons';\nimport { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { Heading } from '../Heading/Heading';\nimport { useEscapeKey } from '../hooks/useEscapeKey';\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { useScrollLock } from '../hooks/useScrollLock';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport type { ModalSize } from './ModalSize';\n\nconst OVERLAY_PADDING = 16;\nconst DIALOG_RADIUS = 12;\nconst DIALOG_PADDING = 16;\nconst HEADER_GAP = 12;\nconst FOOTER_MARGIN = 16;\nconst HEADER_MARGIN = 12;\n/** The dialog never grows past most of the viewport height; its body scrolls instead. */\nconst DIALOG_MAX_HEIGHT = '90%';\n/** The panel enters scaled slightly down (and fades in), settling to its natural size. */\nconst PANEL_ENTER_SCALE = 0.96;\n\n/** Max width per size preset. A floor-less card otherwise stretches to the full viewport on web. */\nconst SIZE_MAX_WIDTH: Record<ModalSize, number> = { sm: 360, md: 480, lg: 640, xl: 880 };\n\nconst styles = StyleSheet.create({\n overlay: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: OVERLAY_PADDING,\n },\n // The scrim is its OWN animated layer (behind the tap-catcher and the panel) so its opacity\n // can fade independently of the panel's fade+scale. `animationType` is a native-only no-op on\n // react-native-web, which is why the fade is driven by `Animated` instead. `pointerEvents` lives\n // in style (not the deprecated prop) so taps fall through to the sibling tap-catcher below.\n scrim: { backgroundColor: MODAL_OVERLAY_COLOR, pointerEvents: 'none' },\n dialog: {\n width: '100%',\n borderRadius: DIALOG_RADIUS,\n padding: DIALOG_PADDING,\n maxHeight: DIALOG_MAX_HEIGHT,\n },\n headerRow: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n columnGap: HEADER_GAP,\n marginBottom: HEADER_MARGIN,\n },\n // Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.\n titleWrap: { flex: 1 },\n footer: { marginTop: FOOTER_MARGIN },\n});\n\nexport interface ModalProps {\n /** Whether the dialog is mounted + shown. */\n visible: boolean;\n /** Called by every dismissal route: ✕, backdrop, Escape (web), hardware back (native). */\n onClose: () => void;\n /** Header title. Omit for a chromeless dialog (the ✕ still shows unless `showClose` is false). */\n title?: string;\n /** Dialog body. Rendered inside a scroll view so long content scrolls within the dialog. */\n children?: React.ReactNode;\n /** Optional footer, typically an action-button row (see {@link ConfirmDialog}). */\n footer?: React.ReactNode;\n /** Max-width preset. Default `md`. */\n size?: ModalSize;\n /**\n * Show the top-right ✕ close button. Default `true`. `ConfirmDialog` sets it `false` — it offers\n * an explicit Cancel, and hiding the ✕ lets the web focus trap land on the SAFE Cancel action.\n */\n showClose?: boolean;\n /** Base testID. Default `modal`. The ✕ is `${testID}-close`, the backdrop `${testID}-backdrop`. */\n testID?: string;\n /** Accessible name of the dialog. Falls back to `title`, then the neutral \"dialog\" key. */\n accessibilityLabel?: string;\n /** testID of the control focused on open (web). Default: an autoFocus child, else the first focusable. */\n initialFocusTestID?: string;\n}\n\nexport const Modal = ({\n visible,\n onClose,\n title,\n children,\n footer,\n size = 'md',\n showClose = true,\n testID = LAYOUT_TEST_IDS.modal,\n accessibilityLabel,\n initialFocusTestID,\n}: ModalProps): React.ReactElement => {\n const { theme, t } = useUi();\n const dialogRef = useRef<View>(null);\n\n // Backdrop fades opacity only; the panel fades AND scales in from 0.96. Both share `visible`,\n // so they enter/exit in lock-step. `panel.mounted` keeps the whole RN `Modal` host (and thus\n // the backdrop) in the tree through the exit fade — RN `Modal` unmounting on `visible=false`\n // is exactly what makes the native-only `animationType` snap on web, so we drive it ourselves.\n const backdrop = useEnterExit({ visible });\n const panel = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });\n const mounted = panel.mounted || backdrop.mounted;\n\n useFocusTrap(dialogRef, visible, initialFocusTestID);\n useEscapeKey(visible, onClose);\n useScrollLock(visible);\n\n const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);\n const closeLabel = t(LAYOUT_I18N.dialogClose);\n\n const dialogStyle = useMemo(\n () => [styles.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],\n [theme.colors.surface, size],\n );\n\n const hasHeader = title !== undefined || showClose;\n\n return (\n <RNModal transparent visible={mounted} onRequestClose={onClose}>\n <View style={styles.overlay}>\n {/* Animated scrim layer — fades independently, behind the tap-catcher and the panel. */}\n <Animated.View\n style={[StyleSheet.absoluteFill, styles.scrim, { opacity: backdrop.style.opacity }]}\n />\n {/* Backdrop is a SIBLING behind the dialog, not its parent: a wrapping pressable would nest\n the footer's action buttons inside a button (invalid DOM). Absolute-fill catches taps\n outside the dialog surface. */}\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={onClose}\n />\n <Animated.View\n ref={dialogRef}\n accessibilityViewIsModal\n aria-label={accessibleName}\n role=\"dialog\"\n style={[dialogStyle, panel.style]}\n testID={testID}\n >\n {hasHeader ? (\n <View style={styles.headerRow}>\n <View style={styles.titleWrap}>\n {title !== undefined ? <Heading>{title}</Heading> : null}\n </View>\n {showClose ? (\n <IconButton\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={closeLabel}\n appearance=\"ghost\"\n renderIcon={(color, iconSize) => <SvgIcon color={color} name=\"close\" size={iconSize} />}\n size=\"md\"\n testID={`${testID}-close`}\n tooltip={closeLabel}\n variant=\"ghost\"\n onPress={onClose}\n />\n ) : null}\n </View>\n ) : null}\n\n <ScrollView>{children}</ScrollView>\n\n {footer !== undefined ? <View style={styles.footer}>{footer}</View> : null}\n </Animated.View>\n </View>\n </RNModal>\n );\n};\n\nexport default Modal;\n","import React from 'react';\n\nimport { ScrollView, View } from 'react-native';\nimport type { ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N } from '../../constants';\nimport { Modal } from '../../Modal/Modal';\nimport type { PageSize } from '../utils/pageScale';\n\nconst CENTRED_ROW: ViewStyle = { flexGrow: 1, justifyContent: 'center' };\n\nexport interface PageOverlayProps {\n children: React.ReactNode;\n pageSize: PageSize;\n visible: boolean;\n onClose: () => void;\n testID: string;\n}\n\n/** Shows the page at scale 1 in a dialog; centred, never narrower than its page width; the dialog scrolls when it is larger. */\nexport const PageOverlay = ({ children, pageSize, visible, onClose, testID }: PageOverlayProps): React.ReactElement => {\n const { t } = useUi();\n\n return (\n <Modal accessibilityLabel={t(LAYOUT_I18N.pageEnlarge)} size=\"xl\" testID={testID} visible={visible} onClose={onClose}>\n <ScrollView horizontal contentContainerStyle={CENTRED_ROW}>\n <View\n style={{ width: pageSize.width, minWidth: pageSize.width, height: pageSize.height, flexShrink: 0 }}\n testID={`${testID}-page`}\n >\n {children}\n </View>\n </ScrollView>\n </Modal>\n );\n};\n","export interface PageSize {\n width: number;\n height: number;\n}\n\nexport interface ScaledFrame {\n scale: number;\n height: number;\n offsetX: number;\n offsetY: number;\n}\n\nconst HALF = 2;\n\n/** A4 at 96 CSS px per inch: 210 x 297 mm. */\nexport const A4_PAGE: PageSize = { width: 794, height: 1123 };\n\n/** The factor that fits a page of `pageWidth` into `containerWidth`, never above 1; 1 while unmeasured. */\nexport const pageScale = (containerWidth: number, pageWidth: number): number => {\n if (containerWidth <= 0 || pageWidth <= 0) return 1;\n return Math.min(1, containerWidth / pageWidth);\n};\n\n/** The scale, outer height and the offsets that pin a centre-scaled page to the top-left corner. */\nexport const scaledFrame = (containerWidth: number, page: PageSize): ScaledFrame => {\n const scale = pageScale(containerWidth, page.width);\n return {\n scale,\n height: page.height * scale,\n offsetX: ((scale - 1) * page.width) / HALF,\n offsetY: ((scale - 1) * page.height) / HALF,\n };\n};\n","import React, { useCallback, useState } from 'react';\n\nimport { Pressable, StyleSheet, View } from 'react-native';\nimport type { LayoutChangeEvent } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport { PageOverlay } from './components/PageOverlay';\nimport { A4_PAGE, scaledFrame } from './utils/pageScale';\nimport type { PageSize } from './utils/pageScale';\n\nconst styles = StyleSheet.create({\n outer: { width: '100%', overflow: 'hidden' },\n page: { position: 'absolute', top: 0, left: 0 },\n trigger: { width: '100%', cursor: 'pointer' },\n});\n\nexport interface PageFrameProps {\n children: React.ReactNode;\n pageSize?: PageSize;\n testID?: string;\n /** When true, a press or Enter on the preview opens the page at full size in an overlay. */\n enlargeable?: boolean;\n}\n\n/** Lays children out at a fixed page size and scales the page down to the container width, never up. */\nexport const PageFrame = ({\n children,\n pageSize = A4_PAGE,\n testID = LAYOUT_TEST_IDS.pageFrame,\n enlargeable = false,\n}: PageFrameProps): React.ReactElement => {\n const { t } = useUi();\n const [containerWidth, setContainerWidth] = useState(0);\n const [enlarged, setEnlarged] = useState(false);\n const onLayout = useCallback((event: LayoutChangeEvent) => {\n setContainerWidth(event.nativeEvent.layout.width);\n }, []);\n const open = useCallback(() => setEnlarged(true), []);\n const close = useCallback(() => setEnlarged(false), []);\n const frame = scaledFrame(containerWidth, pageSize);\n\n const preview = (\n <View style={[styles.outer, { height: frame.height }]} testID={testID} onLayout={onLayout}>\n <View\n style={[\n styles.page,\n {\n width: pageSize.width,\n height: pageSize.height,\n transform: [{ translateX: frame.offsetX }, { translateY: frame.offsetY }, { scale: frame.scale }],\n },\n ]}\n >\n {children}\n </View>\n </View>\n );\n if (!enlargeable) return preview;\n\n return (\n <>\n <Pressable\n accessibilityHint={t(LAYOUT_I18N.pageEnlargeHint)}\n accessibilityLabel={t(LAYOUT_I18N.pageEnlarge)}\n accessibilityRole=\"button\"\n style={styles.trigger}\n testID={`${testID}-enlarge`}\n onPress={open}\n >\n {preview}\n </Pressable>\n <PageOverlay pageSize={pageSize} testID={`${testID}-overlay`} visible={enlarged} onClose={close}>\n {children}\n </PageOverlay>\n </>\n );\n};\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\nimport { MIN_TARGET_PX } from '../constants';\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 minHeight: MIN_TARGET_PX,\n justifyContent: 'center',\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 * How the COLLAPSED (mobile) {@link import('./Tabs').Tabs} menu trigger presents.\n *\n * Below the collapse breakpoint the tab strip becomes a single trigger that opens\n * the vertical section list. This selects that trigger's affordance:\n *\n * - `Caret` — a bordered field showing the active section's label + a rotating ▾\n * caret. The default, so every existing consumer is visually unchanged.\n * - `Hamburger` — a ☰ menu icon (the universal mobile-nav affordance) leading the\n * active section's label. Opt in for a phone-first nav that reads as a menu.\n *\n * Exported as a regular (non-`const`) enum on purpose — the SAME reason as\n * {@link import('../ModalDropdown/DropdownVariant').DropdownVariant}: a `const enum`\n * is inlined at compile time and cannot cross a published-package boundary when the\n * consumer bundles with `isolatedModules` (esbuild / vite / babel — i.e. every app\n * that consumes this package). A regular enum emits a runtime object safe to import\n * and compare in any consumer.\n */\nexport enum TabsCollapsedTrigger {\n /** Bordered field with the active label + a rotating ▾ caret (default, unchanged). */\n Caret = 'caret',\n /** A ☰ hamburger icon leading the active label — the mobile-nav affordance. */\n Hamburger = 'hamburger',\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 { Z_INDEX } from '@dloizides/design-tokens';\nimport type { ViewStyle } from 'react-native';\n\n/**\n * z-index for the open menu popover — above app chrome AND above an open RN-web Modal, whose\n * body-level fixed container (`Z_INDEX.modal`) is a sibling of the portaled menu.\n */\nexport const MENU_Z_INDEX = Z_INDEX.popover;\n/** z-index lifted onto the anchor WRAPPER while the menu is open (native/defence-in-depth). */\nexport const ANCHOR_OPEN_Z_INDEX = Z_INDEX.dropdown;\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\n/**\n * The height cap for the option list's SCROLL VIEWPORT — the popover's own `maxHeight` cannot make a\n * long list scroll on its own: react-native-web gives Views `flex-shrink: 0`, so the inner ScrollView\n * grows to full content height and spills PAST the popover frame instead of scrolling inside it.\n * Capping the ScrollView makes it the scroll boundary, so a long list (e.g. a 20+ option category\n * filter) scrolls with a scrollbar. It sits just inside the popover, discounting the border + padding\n * on both edges, so it is strictly below {@link MENU_MAX_HEIGHT}.\n */\nexport const MENU_SCROLL_MAX_HEIGHT = MENU_MAX_HEIGHT - (BORDER_WIDTH + MENU_PADDING) * 2;\n\n/** The option list's scroll cap for a popover capped at `popoverMaxHeight`, inside its border and padding. */\nexport function menuScrollMaxHeight(popoverMaxHeight: number): number {\n return Math.max(0, popoverMaxHeight - (BORDER_WIDTH + MENU_PADDING) * 2);\n}\n\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/** Keep the popover at least this far from the viewport's left/right edge when it must be clamped. */\nexport const MENU_VIEWPORT_MARGIN = 8;\n/** Menu width floor for a custom (compact) trigger whose caller set no `menuMinWidth`. */\nexport const COMPACT_TRIGGER_MENU_MIN_WIDTH = 160;\n\n/** The caller's `menuMinWidth` when set; otherwise the compact floor for a custom trigger, else none. */\nexport function resolveMenuMinWidth(menuMinWidth: number | undefined, hasCustomTrigger: boolean): number | undefined {\n if (menuMinWidth !== undefined) return menuMinWidth;\n return hasCustomTrigger ? COMPACT_TRIGGER_MENU_MIN_WIDTH : undefined;\n}\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/** Where the open menu sits vertically: `top` when below the trigger, `bottom` when above it. */\nexport interface MenuPlacement {\n top?: number;\n bottom?: number;\n maxHeight: number;\n}\n\n/** Opens below unless the menu does not fit there and more room exists above; capped to the room on its side. */\nexport function resolveMenuPlacement(rect: AnchorRect, viewportHeight: number, menuHeight: number): MenuPlacement {\n if (viewportHeight <= 0) return { top: rect.bottom + MENU_TOP_GAP, maxHeight: MENU_MAX_HEIGHT };\n const top = Math.max(MENU_VIEWPORT_MARGIN, rect.bottom + MENU_TOP_GAP);\n const bottom = Math.max(MENU_VIEWPORT_MARGIN, viewportHeight - rect.top + MENU_TOP_GAP);\n const roomBelow = viewportHeight - top - MENU_VIEWPORT_MARGIN;\n const roomAbove = viewportHeight - bottom - MENU_VIEWPORT_MARGIN;\n const fitsBelow = roomBelow >= Math.min(menuHeight, MENU_MAX_HEIGHT);\n const cap = (room: number): number => Math.max(0, Math.min(MENU_MAX_HEIGHT, room));\n if (!fitsBelow && roomAbove > roomBelow) return { bottom, maxHeight: cap(roomAbove) };\n return { top, maxHeight: cap(roomBelow) };\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 *\n * A floored menu can be WIDER than its (compact) trigger, so anchoring its left edge to the\n * trigger would push it off the right of the viewport — the widened \"More ▾\" overflow menu, whose\n * trigger sits near the right of the bar, is exactly that case. When `viewportWidth` is given the\n * left is clamped so the menu's right edge clears the margin (sliding it left, right-aligning it to\n * the trigger in the limit) without ever crossing the left margin. `viewportWidth = 0` (unknown, or\n * the pure/native path) keeps the original trigger-anchored behaviour untouched.\n */\nexport function buildPortalPopoverStyle(\n rect: AnchorRect,\n minWidth = 0,\n viewportWidth = 0,\n placement: MenuPlacement = resolveMenuPlacement(rect, 0, MENU_MAX_HEIGHT),\n): ViewStyle {\n const width = Math.max(rect.width, minWidth);\n let left = rect.left;\n if (viewportWidth > 0) {\n const maxLeft = viewportWidth - width - MENU_VIEWPORT_MARGIN;\n left = Math.max(MENU_VIEWPORT_MARGIN, Math.min(rect.left, maxLeft));\n }\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 ...placement,\n left,\n width,\n zIndex: MENU_Z_INDEX,\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n padding: MENU_PADDING,\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","import React from 'react';\n\nimport { StyleSheet, Text } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nconst HEADING_FONT_SIZE = 12;\nconst HEADING_FONT_WEIGHT = '600' as const;\nconst HEADING_PADDING_H = 16;\nconst HEADING_PADDING_TOP = 8;\nconst HEADING_PADDING_BOTTOM = 4;\nconst HEADING_LETTER_SPACING = 0.5;\n\nconst styles = StyleSheet.create({\n heading: {\n fontSize: HEADING_FONT_SIZE,\n fontWeight: HEADING_FONT_WEIGHT,\n letterSpacing: HEADING_LETTER_SPACING,\n paddingHorizontal: HEADING_PADDING_H,\n paddingTop: HEADING_PADDING_TOP,\n paddingBottom: HEADING_PADDING_BOTTOM,\n },\n});\n\nexport interface MenuHeadingProps {\n testID: string;\n text: string;\n}\n\n/** Visible, non-focusable heading shown at the top of an open dropdown menu. */\nexport const MenuHeading = ({ testID, text }: MenuHeadingProps): React.ReactElement => {\n const { theme } = useUi();\n\n return (\n <Text\n accessibilityRole=\"header\"\n style={[styles.heading, { color: theme.colors.textSecondary }]}\n testID={`${testID}-menu-heading`}\n >\n {text}\n </Text>\n );\n};\n\nexport default MenuHeading;\n","/** How a dropdown option row marks the currently selected value. */\nexport enum SelectedMarker {\n Bold = 'bold',\n AccentCheck = 'accent-check',\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, View } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, MIN_TARGET_PX } from '../constants';\n\nimport { SelectedMarker } from './SelectedMarker';\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;\nconst ACCENT_BAR_WIDTH = 3;\nconst CHECK_GAP = 8;\nconst CHECK_GLYPH = '✓';\n\nconst styles = StyleSheet.create({\n option: {\n paddingHorizontal: OPTION_PADDING_H,\n paddingVertical: OPTION_PADDING_V,\n minHeight: MIN_TARGET_PX,\n justifyContent: 'center',\n borderRadius: OPTION_BORDER_RADIUS,\n },\n optionText: { fontSize: BODY_FONT_SIZE },\n selectedText: { fontWeight: SELECTED_FONT_WEIGHT },\n markedRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n columnGap: CHECK_GAP,\n borderLeftWidth: ACCENT_BAR_WIDTH,\n borderLeftColor: 'transparent',\n paddingLeft: OPTION_PADDING_H - ACCENT_BAR_WIDTH,\n },\n markedText: { flexShrink: 1 },\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 /** `AccentCheck` marks the selected row with an accent left bar and a trailing check. */\n selectedMarker?: SelectedMarker;\n /** Renders the row as `role=\"menuitem\"` (rows of a `role=\"menu\"` popover). */\n asMenuItem?: boolean;\n}\n\nexport const OptionRow = ({\n testID,\n label,\n isSelected,\n isHighlighted = false,\n onSelect,\n selectedMarker = SelectedMarker.Bold,\n asMenuItem = false,\n}: OptionRowProps): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n\n const handlePress = useCallback(() => { onSelect(); }, [onSelect]);\n\n const accentColor = theme.palette.primary['500'];\n const isMarked = selectedMarker === SelectedMarker.AccentCheck;\n const isActive = isSelected || isHighlighted;\n const rowStyle = [\n styles.option,\n isMarked ? styles.markedRow : null,\n isActive ? { backgroundColor: colors.surfaceElevated } : null,\n isMarked && isSelected ? { borderLeftColor: accentColor } : null,\n ];\n const textStyle = [\n styles.optionText,\n { color: colors.text },\n isSelected ? styles.selectedText : null,\n isMarked ? styles.markedText : null,\n ];\n const selectionProps = asMenuItem ? { 'aria-current': isSelected ? 'true' : undefined } : { 'aria-selected': isSelected };\n\n return (\n <TouchableOpacity\n accessible\n accessibilityHint={t(LAYOUT_I18N.selectOptionHint)}\n accessibilityLabel={label}\n accessibilityRole={asMenuItem ? 'menuitem' : 'button'}\n {...(selectionProps as object)}\n style={rowStyle}\n testID={testID}\n onPress={handlePress}\n >\n <Text style={textStyle}>{label}</Text>\n {isMarked && isSelected ? (\n <View aria-hidden testID={`${testID}-check`}>\n <Text style={[styles.selectedText, { color: accentColor }]}>{CHECK_GLYPH}</Text>\n </View>\n ) : null}\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. */\nexport function 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 */\n/**\n * Field-wise rect equality. `readAnchorRect` builds a FRESH object every measurement, so an\n * identity check (`Object.is`, React's own bail-out) NEVER matches and every scheduled measurement\n * re-rendered the menu — including the ones that found the anchor exactly where it already was.\n *\n * That is not a performance nicety. `rect` feeds `InlineMenu`'s `popoverStyle` memo, so a new\n * identity rewrites the portalled menu's DOM and re-creates its option rows; and the hook's own\n * `ResizeObserver` observes `document.body`, which the menu is portalled INTO — so a re-render\n * could re-arm the observer that caused it. The loop is self-sustaining: this test harness hits\n * \"Maximum update depth exceeded\", and a real browser instead shows a menu whose box never settles,\n * which is what Playwright reports as \"element is not stable\" and then \"element was detached\".\n * Comparing by VALUE is what breaks the cycle.\n */\nfunction isSameRect(a: AnchorRect | null, b: AnchorRect | null): boolean {\n if (a === null || b === null) return a === b;\n return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;\n}\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 // Value-equal measurement ⇒ no state write, so an unmoved anchor cannot re-render the menu.\n setRect((previous) => (isSameRect(previous, next) ? previous : 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","import { useLayoutEffect, useMemo, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { MENU_MAX_HEIGHT, resolveMenuPlacement, type AnchorRect, type MenuPlacement } from './menuStacking';\nimport { toDomNode } from './useAnchorTracking';\n\nconst IS_WEB = Platform.OS === 'web';\nconst UNMEASURED_RECT: AnchorRect = { top: 0, left: 0, width: 0, bottom: 0 };\n\nfunction readViewportHeight(): number {\n return IS_WEB && typeof window !== 'undefined' ? window.innerHeight : 0;\n}\n\n/** The open menu's vertical placement on web, from its measured height and the current viewport height. */\nexport function useMenuPlacement(\n rect: AnchorRect | null,\n menuRef: RefObject<RNView | null>,\n itemCount: number,\n): MenuPlacement {\n const [menuHeight, setMenuHeight] = useState(MENU_MAX_HEIGHT);\n const [viewportHeight, setViewportHeight] = useState(readViewportHeight);\n\n useLayoutEffect(() => {\n const measured = toDomNode(menuRef)?.offsetHeight ?? 0;\n if (measured > 0) setMenuHeight(measured);\n }, [menuRef, itemCount]);\n\n useLayoutEffect(() => {\n if (!IS_WEB) return undefined;\n const onResize = (): void => setViewportHeight(readViewportHeight());\n window.addEventListener('resize', onResize);\n return () => window.removeEventListener('resize', onResize);\n }, []);\n\n return useMemo(\n () => resolveMenuPlacement(rect ?? UNMEASURED_RECT, viewportHeight, menuHeight),\n [rect, viewportHeight, menuHeight],\n );\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 *\n * MOUNTED IS NOT OPEN. ModalDropdown keeps this component mounted PAST logical close so the exit\n * fade can play (`useEnterExit`'s `mounted`). Anything here keyed on mount therefore outlives the\n * menu by the length of that animation — and {@link useMenuKeyboard} installs a DOCUMENT-CAPTURE\n * keydown listener that `preventDefault()`s Enter/Escape/Arrows. Left keyed on mount, a closing\n * menu swallows the user's next keystroke for the whole exit window: the trigger already reports\n * `aria-expanded=\"false\"`, yet Enter never reaches it and the browser never synthesises the click\n * that would re-open it. `isOpen` is that distinction, threaded down from the owner.\n *\n * The same window had a second, worse half: the options themselves stayed CLICKABLE and\n * SCREEN-READER-VISIBLE for the whole fade. A fast second click could therefore activate an option\n * from a menu the user had already dismissed — on every dropdown in every portal, not just a nav\n * overflow. `isOpen` now also makes the popover inert the instant it goes false: `aria-hidden` on\n * the menu node takes the whole subtree out of the accessibility tree, `pointerEvents: 'none'` on\n * the animated wrapper stops the browser routing a click into it, and `handleSelect` refuses the\n * selection outright — belt and braces, because pointer-events cannot stop a click DISPATCHED at\n * the node (focus-driven activation, assistive tech, a test), and neither attribute is retroactive\n * for an event already in flight. The fade itself is untouched; only its interactivity ends early.\n */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { Animated, Platform, ScrollView, StyleSheet, View } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\nimport type { UseEnterExitResult } from '@dloizides/ui-motion';\n\nimport type { DropdownOption } from './dropdownTypes';\nimport {\n MENU_BOX_SHADOW,\n MENU_ELEVATION,\n MENU_MAX_HEIGHT,\n MENU_SCROLL_MAX_HEIGHT,\n MENU_TOP_GAP,\n MENU_Z_INDEX,\n buildPortalPopoverStyle,\n menuScrollMaxHeight,\n} from './menuStacking';\nimport { MenuHeading } from './MenuHeading';\nimport { OptionRow } from './OptionRow';\nimport type { SelectedMarker } from './SelectedMarker';\nimport { useAnchorTracking } from './useAnchorTracking';\nimport { useMenuKeyboard } from './useMenuKeyboard';\nimport { useMenuPlacement } from './useMenuPlacement';\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 // The enter/exit fade+scale lives on an INNER wrapper so the outer popover keeps its raw DOM\n // node (the `menuRef` outside-click / keyboard logic and the web portal target depend on it).\n // `transformOrigin: 'top'` makes the scale grow downward FROM the anchor rather than the centre.\n animated: { transformOrigin: 'top', flexShrink: 1 },\n animatedAbove: { transformOrigin: 'bottom' },\n // Exit fade only: the dying popover must not receive the next click. See the file header.\n inert: { pointerEvents: 'none' },\n // Bound the scroll viewport so a list longer than the popover scrolls (with a scrollbar) instead of\n // overflowing the frame — the popover's own maxHeight cannot do this (see MENU_SCROLL_MAX_HEIGHT).\n scroll: { maxHeight: MENU_SCROLL_MAX_HEIGHT },\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 /**\n * The owner's LOGICAL open state — not \"is this component mounted\". Gates the document-capture\n * keyboard listener so a menu that is closing (still mounted for its exit fade) stops claiming\n * keys the moment it is logically closed. See the file header.\n */\n isOpen: boolean;\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 /** Visible heading at the top of the menu; also becomes the menu's accessible name. */\n menuHeading?: string;\n /** Enter/exit fade+scale style from the owner's `useEnterExit`, applied to the inner wrapper. */\n animatedStyle?: UseEnterExitResult['style'];\n selectedMarker?: SelectedMarker;\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 isOpen,\n optionTestID,\n menuMinWidth = 0,\n menuHeading,\n animatedStyle,\n selectedMarker,\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 const placement = useMenuPlacement(rect, menuRef, options.length);\n const opensAbove = placement.bottom !== undefined;\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 // Refuses a selection from a menu that is logically closed but still fading. See the file header.\n const handleSelect = useCallback(\n (optionValue: T) => { if (isOpen) onSelect(optionValue); },\n [isOpen, onSelect],\n );\n\n const selectAt = useCallback(\n (index: number) => {\n const option = options[index];\n if (option !== undefined) handleSelect(option.value);\n },\n [options, handleSelect],\n );\n\n const selectHighlighted = useCallback(\n () => { selectAt(highlightedIndex); },\n [selectAt, highlightedIndex],\n );\n\n useMenuKeyboard({\n containerRef,\n menuRef,\n enabled: isOpen,\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 // Pass the viewport width so a floored menu wider than its trigger is clamped inside the edge\n // rather than spilling off-screen. `rect` is a memo dep and re-measures on scroll/resize, so the\n // width is re-read then too.\n if (IS_WEB) {\n const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : 0;\n return [\n buildPortalPopoverStyle(rect ?? { top: 0, left: 0, width: 0, bottom: 0 }, menuMinWidth, viewportWidth, placement),\n themed,\n ];\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, placement, rect]);\n\n const scrollStyle = IS_WEB ? { maxHeight: menuScrollMaxHeight(placement.maxHeight) } : styles.scroll;\n\n const menu = (\n <View\n ref={menuRef}\n accessibilityRole=\"menu\"\n aria-hidden={!isOpen}\n aria-label={menuHeading ?? accessibilityLabel}\n style={popoverStyle}\n testID={`${testID}-menu`}\n >\n <Animated.View\n pointerEvents={isOpen ? 'auto' : 'none'}\n style={[styles.animated, opensAbove ? styles.animatedAbove : null, animatedStyle, isOpen ? null : styles.inert]}\n >\n {menuHeading !== undefined ? <MenuHeading testID={testID} text={menuHeading} /> : null}\n <ScrollView style={scrollStyle} keyboardShouldPersistTaps=\"handled\">\n {options.map((option, index) => (\n <OptionRow\n key={String(option.value)}\n asMenuItem\n isHighlighted={index === highlightedIndex}\n isSelected={option.value === value}\n label={option.label}\n selectedMarker={selectedMarker}\n testID={\n optionTestID !== undefined ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`\n }\n onSelect={() => handleSelect(option.value)}\n />\n ))}\n </ScrollView>\n </Animated.View>\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 { LAYOUT_COLLAPSE_BREAKPOINT } from '../constants';\nimport { isWideWebViewport } from '../responsive';\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 *\n * Kept as an alias of the kit-wide {@link LAYOUT_COLLAPSE_BREAKPOINT} so existing\n * importers keep compiling; new code should import the shared name.\n */\nexport const MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;\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 return isWideWebViewport(width, platformOS, MENU_BREAKPOINT)\n ? DropdownVariant.Menu\n : 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 { Animated, FlatList, Modal, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useA11y, MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';\nimport { useUi, MODAL_OVERLAY_COLOR } from '@dloizides/ui-feedback';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { DropdownVariant } from './DropdownVariant';\nimport type { DropdownOption } from './dropdownTypes';\nimport { InlineMenu } from './InlineMenu';\nimport { MenuHeading } from './MenuHeading';\nimport { buildAnchorStackStyle, resolveMenuMinWidth } from './menuStacking';\nimport { OptionRow } from './OptionRow';\nimport type { SelectedMarker } from './SelectedMarker';\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: a `renderTrigger` menu floors at 160, a field keeps its width.\n */\n menuMinWidth?: number;\n /**\n * Show a MENU affordance on the DEFAULT trigger: a caret (▾) pinned to the trailing edge that\n * rotates to point up while the menu is open, and a ≥44dp hit target. Opt-in and OFF by default,\n * so every existing field-style dropdown in the kit renders unchanged; a control that must read\n * as a tappable menu rather than a static chip (the collapsed {@link import('../Tabs/Tabs').Tabs}\n * section switcher) sets it. Ignored when a custom `renderTrigger` is supplied — that caller owns\n * its own visuals, affordance included.\n */\n showCaret?: boolean;\n /**\n * Present the DEFAULT trigger as a HAMBURGER (☰) menu: the universal mobile-nav glyph LEADING the\n * active option's label, with the same bordered field box and ≥44dp hit target. Opt-in and OFF by\n * default. When set it takes precedence over `showCaret` (a hamburger already IS the \"this is a\n * menu\" cue, so the trailing caret is redundant), and — like `showCaret` — it is ignored when a\n * custom `renderTrigger` is supplied. The glyph is a font character (U+2630), so no icon package\n * enters this contract-pure kit, and it is decorative: the trigger's `aria-label` names the\n * control, so screen readers do not announce it.\n */\n showHamburger?: boolean;\n /** Visible, non-focusable heading at the top of the open menu; it also names the menu. */\n menuHeading?: string;\n /** How the selected option is marked; `AccentCheck` = accent left bar + check. */\n selectedMarker?: SelectedMarker;\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/** WCAG 2.5.5 minimum target size — the caret trigger must be comfortably tappable on a phone. */\nconst MIN_TOUCH_TARGET = 44;\nconst CARET_FONT_SIZE = 12;\n/** Gap between the label and the trailing caret (also the gap after the leading hamburger). */\nconst CARET_GAP = 8;\n/** ▾ (U+25BE) — a font glyph, so no icon package is imported into this contract-pure kit. */\nconst CARET_GLYPH = '▾';\n/** ☰ (U+2630) — the hamburger menu glyph, likewise a font character (no icon package). */\nconst HAMBURGER_GLYPH = '☰';\n/** The hamburger reads as an icon, so it sits a touch larger than the body label. */\nconst HAMBURGER_FONT_SIZE = 18;\n/** Caret points up while the menu is open, down while closed. */\nconst CARET_OPEN_ROTATION = '180deg';\nconst CARET_CLOSED_ROTATION = '0deg';\n/** The open popover fades + scales in from just under its natural size (subtle, anchor-origin). */\nconst POPOVER_ENTER_SCALE = 0.96;\n/** A snappy popover duration — the open eases in, the close reads as near-instant. */\nconst POPOVER_MOTION_MS = 120;\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 // Match the shared control height used by @dloizides/ui-forms inputs (same MIN_TOUCH_TARGET_PX\n // floor from @dloizides/a11y), so a select trigger and a text/typeahead field sitting side by\n // side in a filter bar are exactly the same height. Centre the label within that floor.\n minHeight: MIN_TOUCH_TARGET_PX,\n justifyContent: 'center',\n },\n // Caret variant: a row with the label leading and the caret pinned to the trailing edge, at a\n // phone-friendly minimum height. Only applied when `showCaret` is set, so field dropdowns are\n // untouched.\n containerMenu: {\n minHeight: MIN_TOUCH_TARGET,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n columnGap: CARET_GAP,\n },\n // Hamburger variant: the ☰ glyph LEADS the label (icon-first, like a phone nav button), so the\n // row packs to the start rather than pushing a trailing caret to the far edge. Same tap target.\n containerHamburger: {\n minHeight: MIN_TOUCH_TARGET,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-start',\n columnGap: CARET_GAP,\n },\n selectedText: { fontSize: BODY_FONT_SIZE },\n // The label may shrink/ellipsize; the caret / hamburger glyph never does.\n selectedTextMenu: { flexShrink: 1 },\n caret: { fontSize: CARET_FONT_SIZE, flexShrink: 0 },\n hamburger: { fontSize: HAMBURGER_FONT_SIZE, flexShrink: 0 },\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 showCaret = false,\n showHamburger = false,\n menuHeading,\n selectedMarker,\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 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 triggerRef = useRef<View>(null);\n const popupProps = { 'aria-haspopup': isMenu ? 'menu' : 'dialog' } as object;\n const dialogRef = useRef<View>(null);\n useFocusTrap(dialogRef, isOpen && !isMenu);\n\n // The popover (inline menu on web-desktop, centered modal on mobile/native) fades + scales in\n // on open and reverses on close. `mounted` keeps the node in the tree through the exit fade —\n // without it the popover would snap out (the RN `Modal` `animationType` is a no-op on web).\n // Under reduced-motion the enter/exit collapse to instant, so the close reads as immediate.\n const menuAnim = useEnterExit({\n visible: isMenu && isOpen,\n fromScale: POPOVER_ENTER_SCALE,\n duration: POPOVER_MOTION_MS,\n });\n const modalAnim = useEnterExit({\n visible: !isMenu && isOpen,\n fromScale: POPOVER_ENTER_SCALE,\n duration: POPOVER_MOTION_MS,\n });\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 triggerRef.current?.focus();\n },\n [onChange],\n );\n\n // The hamburger is the stronger affordance, so it wins when both are set: a ☰ trigger has no\n // reason to also carry a trailing caret.\n const isHamburger = showHamburger;\n const isCaret = showCaret && !isHamburger;\n\n // A custom trigger owns its own visuals, so the default bordered field box stands down. Otherwise\n // the bordered field box renders, gaining the menu row layout + ≥44dp tap target when either the\n // caret or the hamburger affordance is on.\n const containerStyle = useMemo(\n () =>\n renderTrigger !== undefined\n ? undefined\n : [\n styles.container,\n isHamburger ? styles.containerHamburger : isCaret ? styles.containerMenu : null,\n { borderColor: colors.border, backgroundColor: colors.surface },\n ],\n [colors.border, colors.surface, renderTrigger, isHamburger, isCaret],\n );\n const hamburgerStyle = useMemo(\n () => [styles.hamburger, { color: colors.textSecondary }],\n [colors.textSecondary],\n );\n const caretStyle = useMemo(\n () => [\n styles.caret,\n { color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] },\n ],\n [colors.textSecondary, isOpen],\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 selectedMarker={selectedMarker}\n testID={optionTestIDFor(item.value)}\n onSelect={() => handleSelect(item.value)}\n />\n ),\n [handleSelect, optionTestIDFor, selectedMarker, value],\n );\n const keyExtractor = useCallback((item: DropdownOption<T>) => String(item.value), []);\n\n return (\n <View ref={anchorRef} style={anchorStyle}>\n <TouchableOpacity {...a11yProps} {...popupProps} ref={triggerRef} style={containerStyle} onPress={handleToggle}>\n {renderTrigger !== undefined ? (\n renderTrigger({ label: selectedLabel, isOpen })\n ) : isHamburger ? (\n <>\n <Text style={hamburgerStyle}>{HAMBURGER_GLYPH}</Text>\n <Text numberOfLines={1} style={[styles.selectedText, styles.selectedTextMenu, { color: colors.text }]}>\n {selectedLabel}\n </Text>\n </>\n ) : isCaret ? (\n <>\n <Text numberOfLines={1} style={[styles.selectedText, styles.selectedTextMenu, { color: colors.text }]}>\n {selectedLabel}\n </Text>\n {/* Decorative: the trigger's aria-label already names the control, so screen readers\n ignore this glyph. It exists to make the control read as a menu, not a chip. */}\n <Text style={caretStyle}>{CARET_GLYPH}</Text>\n </>\n ) : (\n <Text style={[styles.selectedText, { color: colors.text }]}>{selectedLabel}</Text>\n )}\n {hintNode}\n </TouchableOpacity>\n\n {isMenu && menuAnim.mounted ? (\n <InlineMenu\n accessibilityLabel={accessibilityLabel}\n animatedStyle={menuAnim.style}\n containerRef={anchorRef}\n isOpen={isOpen}\n menuHeading={menuHeading}\n menuMinWidth={resolveMenuMinWidth(menuMinWidth, renderTrigger !== undefined)}\n optionTestID={optionTestIDFor}\n options={options}\n selectedMarker={selectedMarker}\n testID={testID}\n value={value}\n onClose={handleClose}\n onSelect={handleSelect}\n />\n ) : null}\n\n {!isMenu ? (\n <Modal transparent visible={modalAnim.mounted} 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 <Animated.View\n ref={dialogRef}\n accessibilityViewIsModal\n aria-label={menuHeading ?? accessibilityLabel}\n role=\"dialog\"\n style={[modalContentStyle, modalAnim.style]}\n >\n <FlatList\n data={[...options]}\n keyExtractor={keyExtractor}\n ListHeaderComponent={menuHeading !== undefined ? <MenuHeading testID={testID} text={menuHeading} /> : null}\n renderItem={renderModalOption}\n />\n </Animated.View>\n </View>\n </Modal>\n ) : null}\n </View>\n );\n};\n\nexport default ModalDropdown;\n","/**\n * TabsMenu — the COLLAPSED (mobile) form of {@link Tabs}.\n *\n * Below the collapse breakpoint the horizontal tab strip becomes a genuine menu:\n * a single trigger button that shows the active section's label and opens a\n * vertical list of every section. It is a thin adapter over the kit's existing\n * {@link ModalDropdown} select primitive, so it inherits the menu/listbox\n * semantics, the focus trap, the dismiss backdrop and the dual-platform a11y\n * contract for free — no new dropdown behaviour is reimplemented here.\n *\n * By default it opts into `ModalDropdown`'s `showCaret` so the trigger reads\n * unmistakably as a section SWITCHER — a bordered field with a rotating ▾ caret and\n * a ≥44dp tap target — rather than a static chip that gives no hint it is tappable.\n * That was the live defect on the collapsed organizer nav: the trigger looked like a\n * pill. A consumer can instead pass `collapsedTrigger={TabsCollapsedTrigger.Hamburger}`\n * to present the universal ☰ mobile-nav glyph (leading the active label); the opened\n * list, the a11y contract and the testIDs are identical either way.\n *\n * E2E survival: each option row's `testID` is the tab descriptor's own `testID`\n * when supplied, otherwise the `{idPrefix}-tab-{key}` pattern the wide strip uses\n * for its tab element ids — so a selector that targets a tab keeps resolving the\n * same tab in the collapsed menu (the menu must be opened first, as with any\n * select).\n */\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport type { TabDescriptor } from './Tabs';\nimport { TabsCollapsedTrigger } from './TabsCollapsedTrigger';\nimport { LAYOUT_I18N } from '../constants';\nimport type { DropdownOption } from '../ModalDropdown/dropdownTypes';\nimport { ModalDropdown } from '../ModalDropdown/ModalDropdown';\n\nexport interface TabsMenuProps {\n /** The tabs to list, in order. */\n tabs: ReadonlyArray<TabDescriptor>;\n /** The currently-active tab `key` — shown on the trigger and marked selected. */\n activeKey: string;\n /** Fired with a tab's `key` when its menu row is chosen. */\n onChange: (key: string) => void;\n /** Accessible name for the menu (the tablist's name in collapsed form). */\n accessibilityLabel: string;\n /** Prefix used to derive per-option testIDs when a descriptor supplies none. */\n idPrefix: string;\n /** testID for the menu trigger. */\n testID: string;\n /**\n * How the collapsed trigger presents — a caret field (default) or a ☰ hamburger.\n * See {@link TabsCollapsedTrigger}. Defaults to `Caret` so existing consumers are\n * unchanged.\n */\n collapsedTrigger?: TabsCollapsedTrigger;\n}\n\n/** The collapsed tab menu. Renders the kit's `ModalDropdown` seeded from the tabs. */\nexport const TabsMenu = ({\n tabs,\n activeKey,\n onChange,\n accessibilityLabel,\n idPrefix,\n testID,\n collapsedTrigger = TabsCollapsedTrigger.Caret,\n}: TabsMenuProps): React.ReactElement => {\n const { t } = useUi();\n\n const options = useMemo<ReadonlyArray<DropdownOption<string>>>(\n () => tabs.map((tab) => ({ label: tab.label, value: tab.key })),\n [tabs],\n );\n\n const optionTestID = useCallback(\n (key: string): string => {\n const found = tabs.find((tab) => tab.key === key);\n return found?.testID ?? `${idPrefix}-tab-${key}`;\n },\n [tabs, idPrefix],\n );\n\n const isHamburger = collapsedTrigger === TabsCollapsedTrigger.Hamburger;\n\n return (\n <ModalDropdown\n accessibilityHint={t(LAYOUT_I18N.tabsMenuHint)}\n accessibilityLabel={accessibilityLabel}\n optionTestID={optionTestID}\n options={options}\n showCaret={!isHamburger}\n showHamburger={isHamburger}\n testID={testID}\n value={activeKey}\n onChange={onChange}\n />\n );\n};\n\nexport default TabsMenu;\n","/**\r\n * Responsive collapse decision for {@link Tabs}.\r\n *\r\n * The tab row is a full desktop affordance; on a phone a horizontally-scrolling\r\n * chip strip is hard to use (\"not a real menu, not mobile friendly\"). BELOW a\r\n * breakpoint the strip collapses to a genuine menu (a button showing the active\r\n * tab that opens a vertical list). The threshold reuses the SAME viewport rule\r\n * the kit already uses to decide `ModalDropdown`'s menu-vs-modal split, so the\r\n * whole layout kit changes shape at one consistent breakpoint.\r\n *\r\n * `shouldCollapseTabs` is a pure function (trivially unit-testable with a mocked\r\n * width); `useTabsCollapsed` is the thin hook that feeds it the live viewport\r\n * width + platform.\r\n */\r\nimport { Platform, useWindowDimensions } from 'react-native';\r\n\r\nimport { LAYOUT_COLLAPSE_BREAKPOINT } from '../constants';\r\nimport { isWideWebViewport } from '../responsive';\r\n\r\n/**\r\n * Default collapse threshold — the shared kit breakpoint. At or above this\r\n * viewport width (web only) `Tabs` stays a row; below it — or on any native\r\n * platform — it collapses to the menu.\r\n */\r\nexport const TABS_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;\r\n\r\n/**\r\n * Pure resolver: collapse to the menu unless we are on a WIDE WEB viewport. On\r\n * native (any width) the tabs always collapse — a native app is a phone/tablet\r\n * surface, never a desktop tab bar.\r\n */\r\nexport function shouldCollapseTabs(\r\n width: number,\r\n platformOS: string,\r\n breakpoint: number,\r\n): boolean {\r\n return !isWideWebViewport(width, platformOS, breakpoint);\r\n}\r\n\r\n/** Hook wrapper that reads the live viewport width + platform and resolves collapse. */\r\nexport function useTabsCollapsed(breakpoint: number): boolean {\r\n const { width } = useWindowDimensions();\r\n return shouldCollapseTabs(width, Platform.OS, breakpoint);\r\n}\r\n","/**\n * Tabs — a named-section shell for a long dashboard. On WIDE viewports it is a\n * horizontal strip of pill tabs (a single scrollable `nowrap` row) plus the\n * active tab's panel. BELOW the collapse breakpoint it becomes a genuine mobile\n * MENU — a button showing the active section that opens a vertical list of all\n * sections — because a scrolling chip strip \"is not a real menu and not mobile\n * friendly\" on a phone. The active panel renders identically in both modes.\n *\n * It is deliberately CONTROLLED — the host owns `activeKey` and `onChange`, so\n * the selected tab can be driven from a route param, restored from storage, or\n * changed programmatically. The active panel is passed as `children`.\n *\n * A11y: WIDE mode keeps `role=tablist` / `role=tab` with `aria-selected` and the\n * `aria-controls` / `aria-labelledby` tab⇄panel wiring. COLLAPSED mode delegates\n * to {@link ModalDropdown}'s menu/listbox semantics (a `role=button` trigger that\n * opens a selectable list). The rendered panel is `aria-labelledby` the active\n * tab id in BOTH modes.\n *\n * Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /\n * router / store / icon imports. `label`s are pre-localized strings supplied by\n * the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider\n * theme, so the shell re-skins on tenant swap.\n */\nimport React from 'react';\n\nimport {\n Pressable,\n ScrollView,\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\nimport { MIN_TARGET_PX } from '../constants';\nimport { TabsCollapsedTrigger } from './TabsCollapsedTrigger';\nimport { TabsMenu } from './TabsMenu';\nimport { TABS_COLLAPSE_BREAKPOINT, useTabsCollapsed } from './tabsResponsive';\n\nconst PILL_RADIUS = 999;\nconst PILL_PAD_H = 16;\nconst PILL_PAD_V = 8;\nconst PILL_MIN_HEIGHT = MIN_TARGET_PX;\nconst PILL_FONT = 14;\nconst PILL_WEIGHT = '600';\nconst ROW_GAP = 8;\nconst COLUMN_GAP = 8;\nconst ROW_PAD_V = 8;\nconst PANEL_PAD_TOP = 16;\nconst BORDER_WIDTH = 1;\n\n/** Ink for a pill sitting on the accent (active) background — full-contrast white. */\nconst TEXT_ON_PRIMARY = '#ffffff';\n\nconst styles = StyleSheet.create({\n root: {\n width: '100%',\n },\n // The full-width rule under the row lives here (not on the strip) so it spans the\n // whole width even when the tabs are narrower than the viewport (desktop) and is\n // not clipped to the scroll content width.\n stripOuter: {\n width: '100%',\n borderBottomWidth: BORDER_WIDTH,\n },\n strip: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n columnGap: COLUMN_GAP,\n rowGap: ROW_GAP,\n paddingVertical: ROW_PAD_V,\n },\n pill: {\n // Keep each pill at its natural size so the row scrolls instead of squashing\n // the tabs when they don't all fit.\n flexShrink: 0,\n paddingHorizontal: PILL_PAD_H,\n paddingVertical: PILL_PAD_V,\n borderRadius: PILL_RADIUS,\n minHeight: PILL_MIN_HEIGHT,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n },\n pillText: {\n fontSize: PILL_FONT,\n fontWeight: PILL_WEIGHT,\n textAlign: 'center',\n },\n panel: {\n paddingTop: PANEL_PAD_TOP,\n },\n});\n\n/**\n * `aria-selected` marks the active tab for assistive tech, and `aria-controls` /\n * `id` / `aria-labelledby` link a tab to its panel. react-native's prop types\n * omit these, but react-native-web forwards `aria-*` / `id` to the DOM — so we\n * attach them (no `any`) rather than rely on `accessibilityState` alone.\n */\ntype AriaTabProps = PressableProps & {\n 'aria-selected': boolean;\n 'aria-controls': string;\n id: string;\n};\n\nfunction ariaTabProps(selected: boolean, panelId: string, tabId: string): AriaTabProps {\n return { 'aria-selected': selected, 'aria-controls': panelId, id: tabId };\n}\n\n/** `id` + `aria-labelledby` link the tabpanel back to its controlling tab. */\ninterface AriaPanelProps {\n 'aria-labelledby': string;\n id: string;\n}\n\n/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */\nexport interface TabDescriptor {\n /** Stable identity — emitted by `onChange`, compared against `activeKey`. */\n key: string;\n /** Pre-localized, human-readable tab label. */\n label: string;\n testID?: string;\n /** Accessible name; defaults to `label`. */\n accessibilityLabel?: string;\n /** Accessible hint announced after the label. */\n accessibilityHint?: string;\n}\n\nexport interface TabsProps {\n /** The tabs, left → right. */\n tabs: ReadonlyArray<TabDescriptor>;\n /** The currently-active tab `key`. */\n activeKey: string;\n /** Fired with a tab's `key` when it is pressed (wide) or chosen (collapsed). */\n onChange: (key: string) => void;\n /** Accessible name for the whole tablist / collapsed menu. */\n accessibilityLabel: string;\n /** The panel content for the active tab. */\n children?: React.ReactNode;\n /** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */\n idPrefix?: string;\n /**\n * Viewport width (dp) at/above which the tabs stay a horizontal ROW; below it\n * (or on native) they collapse to the mobile menu. Defaults to the shared kit\n * breakpoint ({@link TABS_COLLAPSE_BREAKPOINT}, 768). Pass a large number to\n * force the menu, or `0` to keep the row on any web width.\n */\n collapseBelow?: number;\n /**\n * How the COLLAPSED (mobile) menu trigger presents — a caret field (default) or a\n * ☰ hamburger. See {@link TabsCollapsedTrigger}. Defaults to `Caret`, so existing\n * consumers are unchanged; a phone-first nav opts into `Hamburger`. Only affects the\n * collapsed form — the wide pill strip is identical either way.\n */\n collapsedTrigger?: TabsCollapsedTrigger;\n /** Style override merged onto the root container. */\n style?: StyleProp<ViewStyle>;\n /** Style override merged onto the tab strip (wide mode only). */\n stripStyle?: StyleProp<ViewStyle>;\n /** Style override merged onto the panel wrapper. */\n panelStyle?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\ninterface WideTabStripProps {\n tabs: ReadonlyArray<TabDescriptor>;\n activeKey: string;\n onChange: (key: string) => void;\n accessibilityLabel: string;\n idPrefix: string;\n borderColor: string;\n primaryColor: string;\n textSecondary: string;\n surfaceElevated: string;\n stripStyle?: StyleProp<ViewStyle>;\n}\n\n/** The wide, horizontally-scrollable pill row. Unchanged desktop behaviour. */\nconst WideTabStrip = ({\n tabs,\n activeKey,\n onChange,\n accessibilityLabel,\n idPrefix,\n borderColor,\n primaryColor,\n textSecondary,\n surfaceElevated,\n stripStyle,\n}: WideTabStripProps): React.ReactElement => (\n <View style={[styles.stripOuter, { borderBottomColor: borderColor }]}>\n <ScrollView horizontal showsHorizontalScrollIndicator={false}>\n <View accessibilityRole=\"tablist\" aria-label={accessibilityLabel} style={[styles.strip, stripStyle]}>\n {tabs.map((tab) => {\n const selected = tab.key === activeKey;\n const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;\n const pillColor = selected ? primaryColor : surfaceElevated;\n const tabId = `${idPrefix}-tab-${tab.key}`;\n const panelId = `${idPrefix}-panel-${tab.key}`;\n return (\n <Pressable\n key={tab.key}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected }}\n accessibilityLabel={tab.accessibilityLabel ?? tab.label}\n accessibilityHint={tab.accessibilityHint}\n onPress={() => onChange(tab.key)}\n style={[styles.pill, { backgroundColor: pillColor }]}\n testID={tab.testID}\n {...ariaTabProps(selected, panelId, tabId)}\n >\n <Text style={[styles.pillText, { color: textColor }]}>{tab.label}</Text>\n </Pressable>\n );\n })}\n </View>\n </ScrollView>\n </View>\n);\n\n/**\n * A controlled tabbed section shell. Renders the active tab's panel plus either\n * the wide pill strip or — below `collapseBelow` — the mobile menu. Generic-free\n * by design: tab identity is a plain string `key`.\n */\nexport const Tabs = ({\n tabs,\n activeKey,\n onChange,\n accessibilityLabel,\n children,\n idPrefix = 'tabs',\n collapseBelow = TABS_COLLAPSE_BREAKPOINT,\n collapsedTrigger = TabsCollapsedTrigger.Caret,\n style,\n stripStyle,\n panelStyle,\n testID,\n}: TabsProps): React.ReactElement => {\n const { theme } = useUi();\n const { colors } = theme;\n const collapsed = useTabsCollapsed(collapseBelow);\n\n const activePanelId = `${idPrefix}-panel-${activeKey}`;\n const activeTabId = `${idPrefix}-tab-${activeKey}`;\n const panelAria: AriaPanelProps = { 'aria-labelledby': activeTabId, id: activePanelId };\n\n return (\n <View style={[styles.root, style]} testID={testID}>\n {collapsed ? (\n <TabsMenu\n accessibilityLabel={accessibilityLabel}\n activeKey={activeKey}\n collapsedTrigger={collapsedTrigger}\n idPrefix={idPrefix}\n tabs={tabs}\n testID={`${idPrefix}-menu`}\n onChange={onChange}\n />\n ) : (\n <WideTabStrip\n accessibilityLabel={accessibilityLabel}\n activeKey={activeKey}\n borderColor={colors.border}\n idPrefix={idPrefix}\n primaryColor={theme.palette.primary['500']}\n stripStyle={stripStyle}\n surfaceElevated={colors.surfaceElevated}\n tabs={tabs}\n textSecondary={colors.textSecondary}\n onChange={onChange}\n />\n )}\n <View accessibilityRole=\"none\" style={[styles.panel, panelStyle]} {...panelAria}>\n {children}\n </View>\n </View>\n );\n};\n\nexport default Tabs;\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, MIN_TARGET_PX } 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: {\n minHeight: MIN_TARGET_PX,\n paddingVertical: BUTTON_PADDING_V,\n borderRadius: BUTTON_BORDER_RADIUS,\n alignItems: 'center',\n justifyContent: 'center',\n marginBottom: CTA_MARGIN_BOTTOM,\n },\n ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: '700' },\n dismiss: { minHeight: MIN_TARGET_PX, alignItems: 'center', justifyContent: '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 * 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 { Animated, Modal, ScrollView, StyleSheet, TouchableOpacity, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';\nimport { useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { Heading } from '../Heading/Heading';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst CLOSE_ICON_SIZE = 18;\n/** The sheet enters scaled slightly down (and fades in), settling to its natural size. */\nconst PANEL_ENTER_SCALE = 0.96;\n\nconst styles = StyleSheet.create({\n animatedFill: { flex: 1 },\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 minWidth: MIN_TOUCH_TARGET_PX,\n minHeight: MIN_TOUCH_TARGET_PX,\n alignItems: 'center',\n justifyContent: 'center',\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 // The sheet fades + scales in on open and reverses on close; `mounted` keeps the RN `Modal`\n // host in the tree through the exit fade, replacing the native-only `animationType=\"slide\"`\n // (a no-op on react-native-web, where the sheet used to snap).\n const { style: sheetStyle, mounted } = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });\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 transparent\n testID={LAYOUT_TEST_IDS.modalShell}\n visible={mounted}\n onRequestClose={onCancel}\n >\n <Animated.View style={[styles.animatedFill, sheetStyle]}>\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 </Animated.View>\n </Modal>\n );\n};\n\nexport default ModalShell;\n","import React, { useRef } from 'react';\n\nimport { Animated, Modal as RNModal, Pressable, ScrollView, StyleSheet, View } from 'react-native';\n\nimport { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { AppText } from '../AppText/AppText';\nimport { TextKind } from '../AppText/TextKind';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS, MIN_TARGET_PX } from '../constants';\nimport { useEscapeKey } from '../hooks/useEscapeKey';\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { useIsWideViewport } from '../hooks/useIsWideViewport';\nimport { useScrollLock } from '../hooks/useScrollLock';\n\nconst SHEET_WIDTH = 560;\nconst PHONE_CORNER = 16;\nconst PHONE_ENTER_OFFSET = 24;\n\nconst styles = StyleSheet.create({\n root: { flex: 1 },\n scrim: { backgroundColor: MODAL_OVERLAY_COLOR, pointerEvents: 'none' },\n sheet: { position: 'absolute', bottom: 0, overflow: 'hidden' },\n wide: { top: 0, right: 0, width: SHEET_WIDTH, maxWidth: '100%', borderLeftWidth: 1 },\n phone: {\n top: MIN_TARGET_PX,\n left: 0,\n right: 0,\n borderTopLeftRadius: PHONE_CORNER,\n borderTopRightRadius: PHONE_CORNER,\n },\n title: { paddingHorizontal: 16, paddingTop: 16 },\n scroll: { flex: 1 },\n content: { padding: 16, gap: 12 },\n bar: { flexDirection: 'row', justifyContent: 'flex-end', gap: 8, padding: 16, borderTopWidth: 1 },\n});\n\nexport interface SideSheetProps {\n visible: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n footer: React.ReactNode;\n testID?: string;\n accessibilityLabel?: string;\n initialFocusTestID?: string;\n}\n\n/** A panel over the screen: from the bottom on a phone, from the right on a computer. */\nexport const SideSheet = ({\n visible,\n onClose,\n title,\n children,\n footer,\n testID = LAYOUT_TEST_IDS.sideSheet,\n accessibilityLabel,\n initialFocusTestID,\n}: SideSheetProps): React.ReactElement => {\n const { theme, t } = useUi();\n const isWide = useIsWideViewport();\n const sheetRef = useRef<View>(null);\n const backdrop = useEnterExit({ visible });\n const panel = useEnterExit({ visible, translateY: isWide ? 0 : PHONE_ENTER_OFFSET });\n const edges = { borderColor: theme.colors.border };\n\n useFocusTrap(sheetRef, visible && panel.mounted, initialFocusTestID);\n useEscapeKey(visible, onClose);\n useScrollLock(visible);\n\n return (\n <RNModal transparent visible={panel.mounted || backdrop.mounted} onRequestClose={onClose}>\n <View style={styles.root}>\n <Animated.View style={[StyleSheet.absoluteFill, styles.scrim, { opacity: backdrop.style.opacity }]} />\n <Pressable\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={t(LAYOUT_I18N.dialogClose)}\n accessibilityRole=\"button\"\n style={StyleSheet.absoluteFill}\n testID={`${testID}-scrim`}\n onPress={onClose}\n />\n <Animated.View\n ref={sheetRef}\n accessibilityViewIsModal\n aria-modal\n aria-label={accessibilityLabel ?? title}\n role=\"dialog\"\n style={[\n styles.sheet,\n isWide ? styles.wide : styles.phone,\n edges,\n { backgroundColor: theme.colors.surface },\n panel.style,\n ]}\n testID={testID}\n >\n <View style={styles.title}>\n <AppText kind={TextKind.Title}>{title}</AppText>\n </View>\n <ScrollView contentContainerStyle={styles.content} style={styles.scroll}>\n {children}\n </ScrollView>\n <View style={[styles.bar, edges]}>{footer}</View>\n </Animated.View>\n </View>\n </RNModal>\n );\n};\n","import React, { useRef } from 'react';\n\nimport { Animated, Modal as RNModal, Pressable, ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';\n\nimport { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';\nimport { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { AppText } from '../AppText/AppText';\nimport { TextKind } from '../AppText/TextKind';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport { useEscapeKey } from '../hooks/useEscapeKey';\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { useIsWideViewport } from '../hooks/useIsWideViewport';\nimport { useScrollLock } from '../hooks/useScrollLock';\n\nconst DEFAULT_MAX_HEIGHT_FRACTION = 0.92;\nconst PERCENT = 100;\nconst WIDE_MAX_WIDTH = 560;\nconst TOP_CORNER = 16;\nconst ENTER_OFFSET = 24;\nconst CLOSE_ICON_SIZE = 18;\n\nconst styles = StyleSheet.create({\n root: { flex: 1 },\n backdrop: { backgroundColor: MODAL_OVERLAY_COLOR, pointerEvents: 'none' },\n panel: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n overflow: 'hidden',\n borderTopLeftRadius: TOP_CORNER,\n borderTopRightRadius: TOP_CORNER,\n },\n wide: { maxWidth: WIDE_MAX_WIDTH, marginHorizontal: 'auto' },\n header: { flexDirection: 'row', alignItems: 'center', gap: 8, paddingLeft: 16, paddingRight: 8, paddingTop: 8 },\n title: { flex: 1 },\n close: { minWidth: MIN_TOUCH_TARGET_PX, minHeight: MIN_TOUCH_TARGET_PX, alignItems: 'center', justifyContent: 'center' },\n body: { flexGrow: 0, flexShrink: 1 },\n content: { padding: 16, gap: 12 },\n footer: { padding: 16, borderTopWidth: 1 },\n});\n\nexport interface BottomSheetProps {\n visible: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n footer?: React.ReactNode;\n maxHeightFraction?: number;\n testID?: string;\n accessibilityLabel?: string;\n initialFocusTestID?: string;\n}\n\n/** A content-height panel docked to the screen bottom, with a dimmed backdrop and an optional pinned footer. */\nexport const BottomSheet = ({\n visible,\n onClose,\n title,\n children,\n footer,\n maxHeightFraction = DEFAULT_MAX_HEIGHT_FRACTION,\n testID = LAYOUT_TEST_IDS.bottomSheet,\n accessibilityLabel,\n initialFocusTestID,\n}: BottomSheetProps): React.ReactElement => {\n const { theme, t } = useUi();\n const isWide = useIsWideViewport();\n const panelRef = useRef<View>(null);\n const backdrop = useEnterExit({ visible });\n const panel = useEnterExit({ visible, translateY: ENTER_OFFSET });\n const hasFooter = footer !== undefined && footer !== null;\n const panelSize = { maxHeight: `${maxHeightFraction * PERCENT}%` as const };\n\n useFocusTrap(panelRef, visible && panel.mounted, initialFocusTestID);\n useEscapeKey(visible, onClose);\n useScrollLock(visible);\n\n return (\n <RNModal transparent visible={panel.mounted || backdrop.mounted} onRequestClose={onClose}>\n <View style={styles.root}>\n <Animated.View style={[StyleSheet.absoluteFill, styles.backdrop, { opacity: backdrop.style.opacity }]} />\n <Pressable\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={t(LAYOUT_I18N.dialogClose)}\n accessibilityRole=\"button\"\n style={StyleSheet.absoluteFill}\n testID={`${testID}-backdrop`}\n onPress={onClose}\n />\n <Animated.View\n ref={panelRef}\n accessibilityViewIsModal\n aria-modal\n aria-label={accessibilityLabel ?? title}\n role=\"dialog\"\n style={[\n styles.panel,\n isWide ? styles.wide : null,\n panelSize,\n { backgroundColor: theme.colors.surface },\n panel.style,\n ]}\n testID={testID}\n >\n <View style={styles.header}>\n <View style={styles.title}>\n <AppText kind={TextKind.Title}>{title}</AppText>\n </View>\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={t(LAYOUT_I18N.dialogClose)}\n accessibilityRole=\"button\"\n style={styles.close}\n testID={`${testID}-close`}\n onPress={onClose}\n >\n <SvgIcon color={theme.colors.textSecondary} name=\"close\" size={CLOSE_ICON_SIZE} />\n </TouchableOpacity>\n </View>\n <ScrollView contentContainerStyle={styles.content} style={styles.body}>\n {children}\n </ScrollView>\n {hasFooter ? (\n <View style={[styles.footer, { borderColor: theme.colors.border }]} testID={`${testID}-footer`}>\n {footer}\n </View>\n ) : null}\n </Animated.View>\n </View>\n </RNModal>\n );\n};\n","/**\n * ConfirmDialog — a confirm/cancel popup built ON {@link Modal}, for the \"are you sure?\" moment.\n *\n * Replaces per-app inline confirms (e.g. kefi-web's inline attendee-delete row) with one shared,\n * themed dialog reused across every portal. Renders the `message` in the body and a Cancel + Confirm\n * button row (from `@dloizides/ui-buttons`) in the footer. When `destructive` is set the Confirm\n * button uses the `danger` variant — the red, irreversible-action treatment.\n *\n * SAFE BY DEFAULT: Cancel is FIRST in the DOM, so the web focus trap lands on it — a keyboard user\n * never has a destructive Confirm pre-focused. Cancel, the backdrop, and Escape all call `onCancel`;\n * the ✕ is hidden (the explicit Cancel is the dismiss affordance). While `busy`, Confirm shows its\n * spinner and Cancel is disabled, so a slow delete cannot be fired twice or cancelled mid-flight.\n */\nimport React from 'react';\n\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport { Button } from '@dloizides/ui-buttons';\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { Modal } from './Modal';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst MESSAGE_FONT_SIZE = 14;\nconst MESSAGE_LINE_HEIGHT = 20;\nconst BUTTON_GAP = 12;\n\nconst styles = StyleSheet.create({\n message: { fontSize: MESSAGE_FONT_SIZE, lineHeight: MESSAGE_LINE_HEIGHT },\n footer: { flexDirection: 'row', justifyContent: 'flex-end', columnGap: BUTTON_GAP },\n});\n\nexport interface ConfirmDialogProps {\n /** Whether the dialog is shown. */\n visible: boolean;\n /** Header title, e.g. \"Remove attendee?\". */\n title: string;\n /** Body copy, e.g. \"This can't be undone.\" */\n message: string;\n /** Confirm button label. Defaults to the host's `common.confirm` translation. */\n confirmLabel?: string;\n /** Cancel button label. Defaults to the host's `common.cancel` translation. */\n cancelLabel?: string;\n /** Red `danger` Confirm for an irreversible action. Default `false` (blue `primary`). */\n destructive?: boolean;\n /** Called when the user presses Confirm. */\n onConfirm: () => void;\n /** Called by Cancel, the backdrop, and Escape. */\n onCancel: () => void;\n /** In-flight: Confirm shows a spinner and Cancel is disabled. Default `false`. */\n busy?: boolean;\n /** Base testID. Default `confirm-dialog`. Confirm is `${testID}-confirm`, Cancel `${testID}-cancel`. */\n testID?: string;\n}\n\nexport const ConfirmDialog = ({\n visible,\n title,\n message,\n confirmLabel,\n cancelLabel,\n destructive = false,\n onConfirm,\n onCancel,\n busy = false,\n testID = LAYOUT_TEST_IDS.confirmDialog,\n}: ConfirmDialogProps): React.ReactElement => {\n const { theme, t } = useUi();\n\n const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);\n const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);\n\n const footer = (\n <View style={styles.footer}>\n {/* Cancel FIRST — the web focus trap focuses the first focusable child, so the SAFE action is\n the default, never a destructive Confirm. It is also visually first (Confirm trails right). */}\n <Button\n accessibilityHint={t(LAYOUT_I18N.cancelHint)}\n accessibilityLabel={resolvedCancel}\n disabled={busy}\n label={resolvedCancel}\n testID={`${testID}-cancel`}\n variant=\"secondary\"\n onPress={onCancel}\n />\n <Button\n accessibilityHint={t(LAYOUT_I18N.confirmHint)}\n accessibilityLabel={resolvedConfirm}\n label={resolvedConfirm}\n loading={busy}\n testID={`${testID}-confirm`}\n variant={destructive ? 'danger' : 'primary'}\n onPress={onConfirm}\n />\n </View>\n );\n\n return (\n <Modal\n footer={footer}\n showClose={false}\n size=\"sm\"\n testID={testID}\n title={title}\n visible={visible}\n onClose={onCancel}\n >\n <Text style={[styles.message, { color: theme.colors.text }]} testID={`${testID}-message`}>\n {message}\n </Text>\n </Modal>\n );\n};\n\nexport default ConfirmDialog;\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 * 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';\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 // The per-item body height is animated by `Collapse` (@dloizides/ui-motion), which works on\n // web + native; there is no longer a `LayoutAnimation` to prime here.\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';\nimport { Collapse } from '@dloizides/ui-motion';\n\nimport { useAccordionContext } from './AccordionContext';\n\nimport { LAYOUT_I18N, MIN_TARGET_PX } 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 // Hit box floor on the pressable header box itself (mobile-first.md); padding alone gave 35px.\n minHeight: MIN_TARGET_PX,\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 {/* `Collapse` (from @dloizides/ui-motion) animates the body height on web AND native —\n RN `LayoutAnimation` (the previous approach) is a no-op under react-native-web, so the\n body used to SNAP open/closed on the web build. The body stays mounted at all times\n (clipped to height 0 when collapsed), so `aria-controls` always resolves and the open\n state is conveyed by the header's `aria-expanded`. */}\n <Collapse open={expanded} testID={`${headerTestID}-collapse`}>\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 </Collapse>\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","/**\n * The three states a copy affordance can be in. Its own file per the repo's\n * \"one exported enum per file\" rule.\n *\n * `Failed` is a first-class state on purpose. Clipboard writes genuinely fail in the browser —\n * a non-secure context (plain http, which is how every staging box and LAN preview is served)\n * has no `navigator.clipboard` at all, and even on https the Permissions API can reject. A\n * control that swallowed that would leave the analyst believing they hold an ID they do not,\n * and they would only find out after pasting the WRONG thing into a re-screen.\n */\nexport const enum CopyStatus {\n Idle = 'idle',\n Copied = 'copied',\n Failed = 'failed',\n}\n","/**\n * Write a string to the system clipboard, reporting honestly whether it worked.\n *\n * THREE PATHS, IN ORDER, BECAUSE THE OBVIOUS ONE IS NOT ENOUGH:\n *\n * 1. `navigator.clipboard.writeText` — the modern API. It is gated on a SECURE CONTEXT, so it is\n * simply `undefined` on plain http. Every staging box and LAN preview in this fleet is served\n * over http, which means the happy path is missing exactly where people test. It can also\n * reject at call time (permission denied, document not focused), so the promise is caught, not\n * assumed.\n * 2. `document.execCommand('copy')` over an off-screen textarea — deprecated, but it is\n * synchronous, needs no permission, and works in non-secure contexts. It is the reason a copy\n * button behaves the same on http staging as on https prod.\n * 3. Neither available (React Native, or a hostile browser) — return `false`. The caller then\n * shows a visible failure instead of a fake \"Copied!\". A host that wants real native clipboard\n * support injects its own writer rather than this package taking a native dependency.\n *\n * Returns `true` only when a write actually succeeded.\n */\n\n/** Off-screen, non-focusable-by-mouse placement for the fallback textarea. */\nconst OFFSCREEN_POSITION = '-9999px';\n\n/** Does this environment expose a DOM we can use at all? */\nfunction hasDom(): boolean {\n return typeof document !== 'undefined' && document.body !== null;\n}\n\n/**\n * The legacy path: put the text in a textarea, select it, ask the document to copy the selection.\n * The textarea is always removed, including when `execCommand` throws.\n */\nfunction copyViaExecCommand(value: string): boolean {\n if (!hasDom()) return false;\n\n const area = document.createElement('textarea');\n area.value = value;\n // `readOnly` stops a mobile keyboard popping up; the styles keep the node out of view and out\n // of the layout so nothing shifts for the one frame it exists.\n area.readOnly = true;\n area.setAttribute('aria-hidden', 'true');\n area.style.position = 'fixed';\n area.style.top = OFFSCREEN_POSITION;\n area.style.left = OFFSCREEN_POSITION;\n area.style.opacity = '0';\n\n document.body.appendChild(area);\n try {\n area.select();\n area.setSelectionRange(0, value.length);\n return document.execCommand('copy');\n } catch {\n return false;\n } finally {\n document.body.removeChild(area);\n }\n}\n\n/** True when the async clipboard API is actually present (it is absent in non-secure contexts). */\nfunction hasAsyncClipboard(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.clipboard?.writeText === 'function'\n );\n}\n\n/**\n * Copy `value`, returning whether it landed on the clipboard.\n *\n * `writer` lets a host inject a platform clipboard (React Native's `Clipboard.setString`, say)\n * without this package depending on one. An injected writer that throws falls through to the DOM\n * paths rather than failing outright.\n */\nexport async function copyText(\n value: string,\n writer?: (text: string) => void | Promise<void>,\n): Promise<boolean> {\n if (value === '') return false;\n\n if (writer !== undefined) {\n try {\n await writer(value);\n return true;\n } catch {\n /* fall through to the DOM paths below */\n }\n }\n\n if (hasAsyncClipboard()) {\n try {\n await navigator.clipboard.writeText(value);\n return true;\n } catch {\n /* fall through — a rejected write is normal on http and when the doc is unfocused */\n }\n }\n\n return copyViaExecCommand(value);\n}\n","/**\n * Copy-with-feedback state: run a clipboard write, expose whether it succeeded, and return to\n * idle after a beat so the control does not sit on a stale \"Copied!\" forever.\n *\n * Split out of the component so the timing and the failure branch are testable without a\n * renderer — the part most likely to be wrong is the part that only shows up when the clipboard\n * says no, which is hard to reach through the UI.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { copyText } from './copyText';\nimport { CopyStatus } from './CopyStatus';\n\n/** How long the \"Copied!\"/\"Copy failed\" confirmation stays up before reverting to idle. */\nexport const COPY_FEEDBACK_MS = 2000;\n\nexport interface CopyToClipboard {\n status: CopyStatus;\n /** Fire-and-forget: performs the write and drives `status`. Safe to pass straight to onPress. */\n copy: () => void;\n}\n\n/**\n * @param value the text to copy\n * @param writer optional platform clipboard writer (see `copyText`)\n */\nexport function useCopyToClipboard(\n value: string,\n writer?: (text: string) => void | Promise<void>,\n): CopyToClipboard {\n const [status, setStatus] = useState<CopyStatus>(CopyStatus.Idle);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n // Guards a setState after unmount: the clipboard write is async, and a drawer can close\n // mid-flight.\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n if (timerRef.current !== null) clearTimeout(timerRef.current);\n };\n }, []);\n\n const copy = useCallback((): void => {\n void (async () => {\n const ok = await copyText(value, writer);\n if (!mountedRef.current) return;\n\n setStatus(ok ? CopyStatus.Copied : CopyStatus.Failed);\n\n if (timerRef.current !== null) clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => {\n if (mountedRef.current) setStatus(CopyStatus.Idle);\n }, COPY_FEEDBACK_MS);\n })();\n }, [value, writer]);\n\n return { status, copy };\n}\n","/**\r\n * CopyableId — show a long machine identifier (a GUID, a reference, a correlation id) so a human\r\n * can both READ enough of it to tell two apart, and TAKE it in one action.\r\n *\r\n * WHY MIDDLE TRUNCATION AND NOT `numberOfLines={1}`: two GUIDs from the same table share a\r\n * prefix far more often than intuition suggests, and tail-truncation renders them IDENTICALLY —\r\n * `3f2a9c81-…`. The tail is what distinguishes them, so both ends must survive. That is exactly\r\n * what `TruncatedText` already solves for URLs, so this composes it rather than re-deriving it.\r\n *\r\n * WHY A COPY BUTTON IS NOT OPTIONAL POLISH: an ID exists to be pasted somewhere else — into a\r\n * re-screen, a support ticket, a SQL console. Displaying a truncated GUID with no copy affordance\r\n * is strictly WORSE than not showing it, because what is on screen is not the value: hand-select\r\n * it and you get `3f2a9c81…d4e7`, ellipsis and all, which silently fails wherever it is pasted.\r\n * The full value is therefore always the accessible name and the web tooltip, and the button\r\n * copies the full value, never the display string.\r\n *\r\n * FAILURE IS SHOWN, NOT SWALLOWED: see `copyText` — clipboard writes really do fail on plain\r\n * http, which is how staging is served. A silent failure would hand the analyst a false belief.\r\n */\r\nimport React, { useMemo } from 'react';\r\n\r\nimport { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';\r\n\r\nimport { useUi } from '@dloizides/ui-feedback';\r\n\r\nimport { LAYOUT_I18N, MIN_TARGET_PX } from '../constants';\r\nimport { TruncatedText } from '../TruncatedText/TruncatedText';\r\nimport { CopyStatus } from './CopyStatus';\r\nimport { useCopyToClipboard } from './useCopyToClipboard';\r\n\r\nconst LABEL_FONT_SIZE = 11;\r\nconst VALUE_FONT_SIZE = 12;\r\nconst ACTION_FONT_SIZE = 12;\r\nconst ROW_GAP = 8;\r\nconst CELL_GAP = 2;\r\nconst LABEL_LETTER_SPACING = 0.4;\r\nconst ACTION_PADDING_H = 6;\r\nconst ACTION_PADDING_V = 2;\r\nconst ACTION_RADIUS = 6;\r\n\r\nconst styles = StyleSheet.create({\r\n cell: { gap: CELL_GAP },\r\n label: {\r\n fontSize: LABEL_FONT_SIZE,\r\n fontWeight: '700',\r\n letterSpacing: LABEL_LETTER_SPACING,\r\n textTransform: 'uppercase',\r\n },\r\n row: { flexDirection: 'row', alignItems: 'center', gap: ROW_GAP },\r\n /**\r\n * The truncation width comes from this wrapper, not from the row: `TruncatedText` measures its\r\n * PARENT (see `useAvailableWidth`), and the row also holds the copy button.\r\n *\r\n * `flex: 1` IS LOAD-BEARING — do not weaken it to `flexShrink: 1`. A shrink-only wrapper\r\n * SHRINK-WRAPS its content, which makes the measured parent width depend on the very string we\r\n * are computing: truncate -> wrapper narrows -> re-measure smaller -> truncate harder. Verified\r\n * in Chrome: with `flexShrink: 1` a 506px-wide container and a 306px one both rendered the SAME\r\n * 196px string, i.e. the id was cut short with 300px of room going spare. `flex: 1` makes the\r\n * wrapper fill the row's leftover width instead, so its size is independent of what we put in\r\n * it — the same reason `useAvailableWidth` measures the parent and not the element.\r\n *\r\n * `minWidth: 0` is what actually permits a flex child to go below its content width.\r\n */\r\n valueWrap: { flex: 1, minWidth: 0 },\r\n value: { fontSize: VALUE_FONT_SIZE, fontWeight: '600' },\r\n action: {\r\n fontSize: ACTION_FONT_SIZE,\r\n fontWeight: '600',\r\n paddingHorizontal: ACTION_PADDING_H,\r\n paddingVertical: ACTION_PADDING_V,\r\n borderRadius: ACTION_RADIUS,\r\n // 44x44 hit box on the rendered box (it measured 40x20). `lineHeight` = the floor keeps the\r\n // label vertically centred without wrapping the Text in another element.\r\n minHeight: MIN_TARGET_PX,\r\n minWidth: MIN_TARGET_PX,\r\n lineHeight: MIN_TARGET_PX,\r\n textAlign: 'center',\r\n },\r\n});\r\n\r\nexport interface CopyableIdProps {\r\n /** The full identifier. Always what gets copied, and always the accessible name / tooltip. */\r\n value: string;\r\n /** Optional eyebrow above the value (e.g. \"Screening ID\"). Pass pre-localized. */\r\n label?: string;\r\n /**\r\n * Style for the outer container.\r\n *\r\n * Hosts should give this a width that does NOT derive from its own content — a `flexBasis`, a\r\n * `width`, or `flex: 1`. The component measures its container to decide how much of the value\r\n * to show, so a shrink-to-fit parent makes the available width depend on the string being\r\n * computed, and the id renders clipped with space to spare.\r\n */\r\n style?: StyleProp<ViewStyle>;\r\n /** Base testID; the copy control is `${testID}-copy` and the value `${testID}-value`. */\r\n testID: string;\r\n /** Accessible name for the value itself. Pass pre-localized; falls back to the raw value. */\r\n accessibilityLabel?: string;\r\n /**\r\n * Platform clipboard writer, for hosts that have one (React Native). Omit on web — the DOM\r\n * paths in `copyText` cover it.\r\n */\r\n writer?: (text: string) => void | Promise<void>;\r\n}\r\n\r\n/** Colour scale step used for every state tone. */\r\nconst TONE_STEP = '500';\r\n\r\n/**\r\n * The copy control's label and tone for a given status.\r\n *\r\n * `semantic.success` is NOT a guaranteed key on the theme contract — only `semantic.error` is\r\n * (see `FeedbackThemeSemantic`). A host that ships no success scale falls back to the primary\r\n * colour rather than rendering an undefined colour, which RN-web turns into unstyled black.\r\n */\r\nfunction useActionState(status: CopyStatus): { key: string; color: string } {\r\n const { theme } = useUi();\r\n return useMemo(() => {\r\n const primary = theme.palette.primary[TONE_STEP];\r\n if (status === CopyStatus.Copied) {\r\n return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };\r\n }\r\n if (status === CopyStatus.Failed) {\r\n return { key: LAYOUT_I18N.copyFailed, color: theme.semantic.error[TONE_STEP] };\r\n }\r\n return { key: LAYOUT_I18N.copy, color: primary };\r\n }, [status, theme]);\r\n}\r\n\r\nexport const CopyableId = ({\r\n value,\r\n label,\r\n style,\r\n testID,\r\n accessibilityLabel,\r\n writer,\r\n}: CopyableIdProps): React.ReactElement => {\r\n const { theme, t } = useUi();\r\n const { colors } = theme;\r\n const { status, copy } = useCopyToClipboard(value, writer);\r\n const action = useActionState(status);\r\n\r\n return (\r\n <View style={[styles.cell, style]} testID={testID}>\r\n {label !== undefined && (\r\n <Text style={[styles.label, { color: colors.textSecondary }]}>{label}</Text>\r\n )}\r\n <View style={styles.row}>\r\n <View style={styles.valueWrap}>\r\n <TruncatedText\r\n value={value}\r\n style={[styles.value, { color: colors.text }]}\r\n testID={`${testID}-value`}\r\n accessibilityLabel={accessibilityLabel ?? value}\r\n accessibilityHint={t(LAYOUT_I18N.copyableIdHint)}\r\n />\r\n </View>\r\n <Text\r\n onPress={copy}\r\n accessibilityRole=\"button\"\r\n // The accessible NAME carries the status, because `accessibilityHint` is dropped by\r\n // react-native-web and never reaches the DOM — a screen-reader user would otherwise get\r\n // no confirmation at all that the copy happened.\r\n accessibilityLabel={t(action.key)}\r\n accessibilityHint={t(LAYOUT_I18N.copyHint)}\r\n testID={`${testID}-copy`}\r\n style={[styles.action, { color: action.color }]}\r\n >\r\n {t(action.key)}\r\n </Text>\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nexport default CopyableId;\r\n","/**\n * Pure formatting for the build-info caption — split out of the component so the label\n * assembly (the part with the branches: no version, version only, version + api commit) is\n * testable without a renderer.\n */\n\n/** Leading glyph on the build version, e.g. `v1.2.0`. */\nexport const BUILD_INFO_PREFIX = 'v';\n\n/** Separator between the app build and the API commit, e.g. `v1.2.0 · api abc1234`. */\nexport const API_COMMIT_SEPARATOR = ' · api ';\n\n/** How many leading chars of a commit sha to show — a 7-char short sha is the git default. */\nconst SHORT_COMMIT_LENGTH = 7;\n\n/** First {@link SHORT_COMMIT_LENGTH} chars of a (trimmed) commit sha. A short sha is enough to\n * identify a build; the full 40-char hash is noise in a footer caption. */\nexport function shortenCommit(commit: string): string {\n return commit.trim().slice(0, SHORT_COMMIT_LENGTH);\n}\n\n/** Drop a single trailing slash so `${base}/version` never doubles up (`https://x//version`). */\nexport function trimTrailingSlash(url: string): string {\n return url.endsWith('/') ? url.slice(0, -1) : url;\n}\n\n/**\n * The caption text: `v<buildVersion>`, plus ` · api <sha7>` when a non-empty commit is known.\n * Both inputs are trimmed; an empty/whitespace commit is treated as absent (no API suffix).\n */\nexport function formatBuildInfo(buildVersion: string, apiCommit?: string): string {\n const base = `${BUILD_INFO_PREFIX}${buildVersion.trim()}`;\n const commit = apiCommit?.trim();\n if (commit === undefined || commit === '') return base;\n return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;\n}\n","/**\n * Best-effort fetch of an API's build commit for {@link BuildInfoFooter}.\n *\n * When `apiBaseUrl` is set, GETs `${apiBaseUrl}/version` once and returns its `commit` field.\n * ANY failure (offline, 404, non-JSON, no `fetch`) leaves the commit `undefined` and the footer\n * shows only the app build version — a version caption must never surface a network error to the\n * user. The write is guarded against a mid-flight unmount.\n */\nimport { useEffect, useRef, useState } from 'react';\n\nimport { trimTrailingSlash } from './formatBuildInfo';\n\n/** Shape of the `/version` payload this hook reads. Only `commit` is consumed. */\nexport interface VersionResponse {\n commit?: string;\n}\n\n/**\n * @param apiBaseUrl origin/base to read `/version` from; when absent/empty the hook stays inert.\n * @param fetchImpl injectable `fetch` (testing seam); defaults to the global when present.\n * @returns the API commit once resolved, else `undefined`.\n */\nexport function useApiCommit(apiBaseUrl?: string, fetchImpl?: typeof fetch): string | undefined {\n const [commit, setCommit] = useState<string | undefined>(undefined);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n useEffect(() => {\n if (apiBaseUrl === undefined || apiBaseUrl === '') return;\n const doFetch = fetchImpl ?? (typeof fetch !== 'undefined' ? fetch : undefined);\n if (doFetch === undefined) return;\n\n void (async () => {\n try {\n const res = await doFetch(`${trimTrailingSlash(apiBaseUrl)}/version`);\n if (!res.ok) return;\n const body = (await res.json()) as VersionResponse;\n const value = body.commit;\n if (mountedRef.current && value !== undefined && value !== '') setCommit(value);\n } catch {\n // Best-effort: any failure leaves the commit undefined; the footer shows the version alone.\n return;\n }\n })();\n }, [apiBaseUrl, fetchImpl]);\n\n return commit;\n}\n","/**\n * BuildInfoFooter — a small, unobtrusive caption that shows which build the app is running:\n * `v<buildVersion>`, optionally `· api <sha7>` when an API base (or an explicit commit) is given.\n *\n * The FE half of \"know what's deployed\": each portal reads its stamped build id (an\n * `EXPO_PUBLIC_BUILD_VERSION` inlined at build time — the same git sha CI hands `@dloizides/pwa-sw`'s\n * `PWA_BUILD_VERSION`) and passes it in. The API commit is OPTIONAL and prop-driven, so apps with no\n * `/version` endpoint still get a version caption.\n *\n * Themable, no raw colours: the muted text uses the app theme's `textSecondary` via `useUi()`.\n */\nimport React, { useMemo } from 'react';\n\nimport { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport { formatBuildInfo } from './formatBuildInfo';\nimport { useApiCommit } from './useApiCommit';\n\nconst FOOTER_PADDING_V = 6;\nconst FOOTER_PADDING_H = 12;\nconst FOOTER_FONT_SIZE = 11;\nconst FOOTER_OPACITY = 0.75;\n\nconst styles = StyleSheet.create({\n footer: {\n paddingVertical: FOOTER_PADDING_V,\n paddingHorizontal: FOOTER_PADDING_H,\n alignItems: 'center',\n },\n text: {\n fontSize: FOOTER_FONT_SIZE,\n opacity: FOOTER_OPACITY,\n },\n});\n\nexport interface BuildInfoFooterProps {\n /** The app's stamped build id (git sha or timestamp), inlined at build time. */\n buildVersion: string;\n /**\n * Optional API base; when set (and no explicit `apiCommit` is given) the footer GETs\n * `${apiBaseUrl}/version` best-effort and appends `· api <sha7>`. Failures are silent.\n */\n apiBaseUrl?: string;\n /** Optional explicit API commit — supply it to skip the `/version` fetch entirely. */\n apiCommit?: string;\n /** Injectable `fetch` for tests; defaults to the global. */\n fetchImpl?: typeof fetch;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport const BuildInfoFooter = ({\n buildVersion,\n apiBaseUrl,\n apiCommit,\n fetchImpl,\n testID = LAYOUT_TEST_IDS.buildInfoFooter,\n accessibilityLabel,\n accessibilityHint,\n style,\n}: BuildInfoFooterProps): React.ReactElement => {\n const { theme, t } = useUi();\n\n // Only fetch when the app has not already supplied the commit — an explicit prop wins.\n const fetchedCommit = useApiCommit(apiCommit === undefined ? apiBaseUrl : undefined, fetchImpl);\n const commit = apiCommit ?? fetchedCommit;\n const label = formatBuildInfo(buildVersion, commit);\n\n const textStyle = useMemo(\n () => [styles.text, { color: theme.colors.textSecondary }],\n [theme.colors.textSecondary],\n );\n\n return (\n <View\n accessibilityLabel={accessibilityLabel ?? label}\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint)}\n style={[styles.footer, style]}\n testID={testID}\n >\n <Text style={textStyle}>{label}</Text>\n </View>\n );\n};\n\nexport default BuildInfoFooter;\n","import React from 'react';\n\nimport { StyleSheet, Text, View } from 'react-native';\n\nconst SIZE = 22;\nconst BORDER = 2;\nconst GLYPH_SIZE = 14;\nconst GLYPH_LINE = 16;\nconst TICK = '✓';\n\nconst styles = StyleSheet.create({\n circle: {\n width: SIZE,\n height: SIZE,\n borderRadius: SIZE / 2,\n borderWidth: BORDER,\n alignItems: 'center',\n justifyContent: 'center',\n },\n glyph: { fontSize: GLYPH_SIZE, fontWeight: '700', lineHeight: GLYPH_LINE },\n});\n\ninterface CheckMarkProps {\n filled: boolean;\n accent: string;\n ring: string;\n glyphColor: string;\n testID?: string;\n}\n\n/** The decorative selection circle of the `check` row style. */\nexport const CheckMark = ({ filled, accent, ring, glyphColor, testID }: CheckMarkProps): React.ReactElement => (\n <View\n aria-hidden\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : undefined }]}\n testID={testID}\n >\n {filled ? <Text style={[styles.glyph, { color: glyphColor }]}>{TICK}</Text> : null}\n </View>\n);\n","import { createContext, useContext } from 'react';\n\nexport interface ListRowTone {\n textColor: string;\n inverse: boolean;\n}\n\nexport const ListRowToneContext = createContext<ListRowTone | null>(null);\n\n/** Reads the enclosing `ListRow` text tone so custom slot content follows a filled row; `null` outside a row. */\nexport function useListRowTone(): ListRowTone | null {\n return useContext(ListRowToneContext);\n}\n","import { useUi } from '@dloizides/ui-feedback';\n\nimport type { RowPalette } from '../utils/rowLook';\n\n/** Maps the host theme onto the colours a `ListRow` draws with. */\nexport function useRowPalette(): RowPalette {\n const { colors, palette, semantic } = useUi().theme;\n const accent = palette.primary['500'];\n const tint = palette.primary['50'] ?? colors.surface;\n return {\n accent,\n accentTint: tint,\n background: colors.background,\n surface: colors.surface,\n border: colors.border,\n text: colors.text,\n hover: tint,\n pressed: palette.primary['100'] ?? colors.surfaceElevated,\n focus: semantic.info?.['500'] ?? accent,\n };\n}\n","export enum RowSelectedStyle {\n Surface = 'surface',\n AccentBar = 'accent-bar',\n Filled = 'filled',\n Raised = 'raised',\n Outline = 'outline',\n Check = 'check',\n}\n","interface SelectorMatcher {\n matches: (selector: string) => boolean;\n}\n\nfunction canMatch(target: unknown): target is SelectorMatcher {\n return typeof target === 'object' && target !== null && typeof (target as Partial<SelectorMatcher>).matches === 'function';\n}\n\n/** True when a focus came from the keyboard (`:focus-visible`); a mouse or touch press returns false. */\nexport function isFocusVisible(target: unknown): boolean {\n if (!canMatch(target)) return true;\n try {\n return target.matches(':focus-visible');\n } catch {\n return true;\n }\n}\n","import type { ViewStyle } from 'react-native';\n\nimport { RowSelectedStyle } from '../RowSelectedStyle';\n\nconst BAR_WIDTH = 4;\nconst OUTLINE_WIDTH = 2;\nconst FOCUS_GAP = 2;\nconst FOCUS_WIDTH = 4;\nconst CARD_RADIUS = 8;\nconst CARD_INSET_V = 4;\nconst CARD_INSET_H = 8;\nconst CARD_SHADOW = '0px 2px 8px rgba(20, 30, 50, 0.16)';\nconst TRANSPARENT = 'transparent';\n\nexport interface RowPalette {\n accent: string;\n accentTint: string;\n background: string;\n surface: string;\n border: string;\n text: string;\n hover: string;\n pressed: string;\n focus: string;\n}\n\nexport interface RowState {\n selected: boolean;\n hovered: boolean;\n pressed: boolean;\n focused: boolean;\n}\n\nexport interface RowLook {\n container: ViewStyle;\n titleColor: string;\n textColor: string;\n inverse: boolean;\n showCheck: boolean;\n checkFilled: boolean;\n}\n\nfunction inset(width: number, color: string): string {\n return `inset 0px 0px 0px ${String(width)}px ${color}`;\n}\n\nfunction interactionFill(state: RowState, palette: RowPalette): string | undefined {\n if (state.pressed) return palette.pressed;\n if (state.hovered) return palette.hover;\n return undefined;\n}\n\nfunction selectedContainer(style: RowSelectedStyle, palette: RowPalette): ViewStyle {\n switch (style) {\n case RowSelectedStyle.AccentBar:\n return { backgroundColor: palette.accentTint, borderLeftColor: palette.accent };\n case RowSelectedStyle.Filled:\n return { backgroundColor: palette.accent };\n case RowSelectedStyle.Raised:\n return { backgroundColor: palette.background, borderColor: palette.accent, boxShadow: CARD_SHADOW };\n case RowSelectedStyle.Outline:\n return { backgroundColor: palette.background, boxShadow: inset(OUTLINE_WIDTH, palette.accent) };\n case RowSelectedStyle.Check:\n return { backgroundColor: palette.background };\n default:\n return { backgroundColor: palette.surface };\n }\n}\n\nfunction baseContainer(style: RowSelectedStyle): ViewStyle {\n if (style === RowSelectedStyle.AccentBar) return { borderLeftWidth: BAR_WIDTH, borderLeftColor: TRANSPARENT };\n if (style !== RowSelectedStyle.Raised) return {};\n return {\n borderWidth: 1,\n borderColor: TRANSPARENT,\n borderRadius: CARD_RADIUS,\n marginVertical: CARD_INSET_V,\n marginHorizontal: CARD_INSET_H,\n };\n}\n\nfunction withFocus(container: ViewStyle, focused: boolean, palette: RowPalette): ViewStyle {\n if (!focused) return container;\n const ring = `${inset(FOCUS_GAP, palette.background)}, ${inset(FOCUS_WIDTH, palette.focus)}`;\n const existing = typeof container.boxShadow === 'string' ? container.boxShadow : undefined;\n const keepsInset = existing?.startsWith('inset') === true;\n return { ...container, boxShadow: keepsInset ? `${ring}, ${String(existing)}` : ring };\n}\n\n/** Resolves a row's container style and text colours from its selected style and state. */\nexport function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook {\n const inverse = state.selected && style === RowSelectedStyle.Filled;\n const selected = state.selected ? selectedContainer(style, palette) : {};\n const fill = inverse ? undefined : interactionFill(state, palette);\n const fillStyle: ViewStyle = fill === undefined ? {} : { backgroundColor: fill };\n const container = { ...baseContainer(style), ...selected, ...fillStyle };\n const accentsTitle = state.selected && style === RowSelectedStyle.AccentBar;\n const textColor = inverse ? palette.background : palette.text;\n return {\n container: withFocus(container, state.focused, palette),\n titleColor: accentsTitle ? palette.accent : textColor,\n textColor,\n inverse,\n showCheck: style === RowSelectedStyle.Check,\n checkFilled: style === RowSelectedStyle.Check && state.selected,\n };\n}\n","import React, { useMemo, useState } from 'react';\r\n\r\nimport { Pressable, StyleSheet, Text, View, type PressableProps } from 'react-native';\r\n\r\nimport { useUi } from '@dloizides/ui-feedback';\r\n\r\nimport { MIN_TARGET_PX } from '../constants';\r\n\r\nimport { CheckMark } from './components/CheckMark';\r\nimport { ListRowToneContext } from './hooks/useListRowTone';\r\nimport { useRowPalette } from './hooks/useRowPalette';\r\nimport { RowSelectedStyle } from './RowSelectedStyle';\r\nimport { isFocusVisible } from './utils/focusVisible';\r\nimport { resolveRowLook } from './utils/rowLook';\r\n\r\nconst FONT = 15;\r\nconst PAD_H = 16;\r\nconst PAD_V = 12;\r\nconst GAP = 4;\r\nconst MARK_GAP = 12;\r\nconst LINE_GAP = 8;\r\n\r\nconst styles = StyleSheet.create({\r\n row: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n gap: MARK_GAP,\r\n paddingHorizontal: PAD_H,\r\n paddingVertical: PAD_V,\r\n borderTopWidth: 1,\r\n minHeight: MIN_TARGET_PX,\r\n },\r\n body: { flex: 1, minWidth: 0, gap: GAP },\r\n line: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: LINE_GAP },\r\n shrink: { flexShrink: 1, minWidth: 0 },\r\n strong: { fontSize: FONT, fontWeight: '600' },\r\n badges: { flexDirection: 'row', flexWrap: 'wrap', gap: GAP, justifyContent: 'flex-end' },\r\n});\r\n\r\nexport interface ListRowProps {\r\n title: React.ReactNode;\r\n trailing?: React.ReactNode;\r\n meta?: React.ReactNode;\r\n badges?: React.ReactNode;\r\n after?: React.ReactNode;\r\n selected: boolean;\r\n selectedStyle?: RowSelectedStyle;\r\n onPress: () => void;\r\n accessibilityLabel: string;\r\n accessibilityHint: string;\r\n testID?: string;\r\n}\r\n\r\ninterface WebPressState {\r\n pressed: boolean;\r\n hovered?: boolean;\r\n}\r\n\r\nfunction pressedProps(selected: boolean): PressableProps & { 'aria-pressed': boolean } {\r\n return { 'aria-pressed': selected };\r\n}\r\n\r\nfunction focusTarget(event: unknown): unknown {\r\n return (event as { nativeEvent?: { target?: unknown } } | undefined)?.nativeEvent?.target;\r\n}\r\n\r\nfunction slot(node: React.ReactNode, color: string, strong: boolean): React.ReactNode {\r\n if (typeof node !== 'string') return node;\r\n return <Text style={[styles.shrink, strong ? styles.strong : null, { color }]}>{node}</Text>;\r\n}\r\n\r\n/** A selectable list row with title, trailing, meta and badge slots and one selected-style setting. */\r\nexport const ListRow = ({\r\n title,\r\n trailing,\r\n meta,\r\n badges,\r\n after,\r\n selected,\r\n selectedStyle = RowSelectedStyle.Surface,\r\n onPress,\r\n accessibilityLabel,\r\n accessibilityHint,\r\n testID,\r\n}: ListRowProps): React.ReactElement => {\r\n const palette = useRowPalette();\r\n const { colors } = useUi().theme;\r\n const [focused, setFocused] = useState(false);\r\n const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);\r\n const tone = useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);\r\n const checkTestId = testID === undefined ? undefined : `${testID}-check`;\r\n return (\r\n <ListRowToneContext.Provider value={tone}>\r\n <Pressable\r\n accessibilityHint={accessibilityHint}\r\n accessibilityLabel={accessibilityLabel}\r\n accessibilityRole=\"button\"\r\n accessibilityState={{ selected }}\r\n style={(state) => {\r\n const { pressed, hovered } = state as WebPressState;\r\n const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);\r\n return [styles.row, { borderTopColor: colors.border }, look.container];\r\n }}\r\n testID={testID}\r\n onBlur={() => {\r\n setFocused(false);\r\n }}\r\n onFocus={(event) => {\r\n setFocused(isFocusVisible(focusTarget(event)));\r\n }}\r\n onPress={onPress}\r\n {...pressedProps(selected)}\r\n >\r\n {rest.showCheck ? (\r\n <CheckMark accent={palette.accent} filled={rest.checkFilled} glyphColor={palette.background} ring={palette.border} testID={checkTestId} />\r\n ) : null}\r\n <View style={styles.body}>\r\n <View style={styles.line}>\r\n {slot(title, rest.titleColor, true)}\r\n {slot(trailing, rest.textColor, true)}\r\n </View>\r\n <View style={styles.line}>\r\n <View style={styles.shrink}>{slot(meta, rest.textColor, false)}</View>\r\n {badges === undefined ? null : <View style={styles.badges}>{badges}</View>}\r\n </View>\r\n </View>\r\n </Pressable>\r\n {after ?? null}\r\n </ListRowToneContext.Provider>\r\n );\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/Section/SectionVariant.ts","../src/Section/Section.tsx","../src/AppText/TextKind.ts","../src/AppText/AppText.tsx","../src/constants.ts","../src/responsive.ts","../src/hooks/useIsWideViewport.ts","../src/ScreenColumn/ScreenColumn.tsx","../src/Heading/Heading.tsx","../src/StatusBadge/StatusBadge.tsx","../src/StickyPreview/hooks/useStuckSentinel.ts","../src/StickyPreview/hooks/useVisibleViewport.ts","../src/StickyPreview/StickyPreview.tsx","../src/hooks/useEscapeKey.ts","../src/hooks/useFocusTrap.ts","../src/hooks/useScrollLock.ts","../src/Modal/Modal.tsx","../src/PageFrame/components/PageOverlay.tsx","../src/PageFrame/utils/pageScale.ts","../src/PageFrame/PageFrame.tsx","../src/SegmentedControl/SegmentedControl.tsx","../src/Tabs/TabsCollapsedTrigger.ts","../src/ModalDropdown/DropdownVariant.ts","../src/ModalDropdown/menuStacking.ts","../src/ModalDropdown/MenuHeading.tsx","../src/ModalDropdown/SelectedMarker.ts","../src/ModalDropdown/OptionRow.tsx","../src/ModalDropdown/useAnchorTracking.ts","../src/ModalDropdown/useMenuKeyboard.ts","../src/ModalDropdown/useMenuPlacement.ts","../src/ModalDropdown/InlineMenu.tsx","../src/ModalDropdown/resolveDropdownVariant.ts","../src/ModalDropdown/ModalDropdown.tsx","../src/Tabs/TabsMenu.tsx","../src/Tabs/tabsResponsive.ts","../src/Tabs/Tabs.tsx","../src/UpgradePrompt/UpgradePrompt.tsx","../src/ModalShell/ModalShell.tsx","../src/SideSheet/SideSheet.tsx","../src/BottomSheet/BottomSheet.tsx","../src/Modal/ConfirmDialog.tsx","../src/Accordion/AccordionContext.ts","../src/Accordion/Accordion.tsx","../src/Accordion/AccordionItem.tsx","../src/TruncatedText/truncate.ts","../src/TruncatedText/useAvailableWidth.ts","../src/TruncatedText/TruncatedText.tsx","../src/CopyableId/CopyStatus.ts","../src/CopyableId/copyText.ts","../src/CopyableId/useCopyToClipboard.ts","../src/CopyableId/CopyableId.tsx","../src/BuildInfoFooter/formatBuildInfo.ts","../src/BuildInfoFooter/useApiCommit.ts","../src/BuildInfoFooter/BuildInfoFooter.tsx","../src/ListRow/components/CheckMark.tsx","../src/ListRow/hooks/useListRowTone.ts","../src/ListRow/hooks/useRowPalette.ts","../src/ListRow/RowSelectedStyle.ts","../src/ListRow/utils/focusVisible.ts","../src/ListRow/utils/rowLook.ts","../src/ListRow/ListRow.tsx"],"names":["SectionVariant","React","TextKind","useUi","jsx","styles","StyleSheet","View","Text","useState","useRef","useEffect","useMemo","Platform","jsxs","RNModal","ScrollView","Fragment","Pressable","TabsCollapsedTrigger","DropdownVariant","BORDER_WIDTH","SelectedMarker","useCallback","TouchableOpacity","IS_WEB","useLayoutEffect","BORDER_RADIUS","MENU_PADDING","Animated","useWindowDimensions","BODY_FONT_SIZE","MODAL_OVERLAY_COLOR","useEnterExit","Modal","PANEL_ENTER_SCALE","MIN_TOUCH_TARGET_PX","SvgIcon","CLOSE_ICON_SIZE","MESSAGE_FONT_SIZE","HEADER_GAP","TITLE_FONT_SIZE","handleKeyDown","DEFAULT_FONT_SIZE","UNMEASURED","CopyStatus","ROW_GAP","createContext","useContext","RowSelectedStyle","TRANSPARENT"],"mappings":";;;;;;;;;;;;;;;AAAO,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,gBAAA,MAAA,CAAA,GAAO,MAAA;AAFG,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;ACWZ,IAAM,MAAA,GAAS,WAAW,MAAA,CAAO;AAAA,EAC/B,IAAA,EAAM;AAAA,IACJ,OAAA,EAAS,EAAA;AAAA,IACT,WAAA,EAAa,CAAA;AAAA,IACb,YAAA,EAAc;AAAA,GAChB;AAAA,EACA,MAAA,EAAQ;AAAA,IACN,YAAA,EAAc,EAAA;AAAA,IACd,GAAA,EAAK;AAAA;AAET,CAAC,CAAA;AASM,IAAM,UAAU,CAAC;AAAA,EACtB,QAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA,GAAA,OAAA;AAAA,EAC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AO,IAAA,EAClB,QAAA,EAAA;AAAA,4BAAAS,IAAAA,CAACP,IAAAA,EAAA,EAAK,KAAA,EAAOF,SAAO,IAAA,EACjB,QAAA,EAAA;AAAA,cAAA,IAAA,CAAK,KAAA,EAAO,IAAA,CAAK,UAAA,EAAY,IAAI,CAAA;AAAA,cACjC,IAAA,CAAK,QAAA,EAAU,IAAA,CAAK,SAAA,EAAW,IAAI;AAAA,aAAA,EACtC,CAAA;AAAA,4BACAS,IAAAA,CAACP,IAAAA,EAAA,EAAK,KAAA,EAAOF,SAAO,IAAA,EAClB,QAAA,EAAA;AAAA,8BAAAD,GAAAA,CAACG,IAAAA,EAAA,EAAK,KAAA,EAAOF,QAAAA,CAAO,MAAA,EAAS,QAAA,EAAA,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,SAAA,EAAW,KAAK,CAAA,EAAE,CAAA;AAAA,cAC9D,MAAA,KAAW,MAAA,GAAY,IAAA,mBAAOD,GAAAA,CAACG,MAAA,EAAK,KAAA,EAAOF,QAAAA,CAAO,MAAA,EAAS,QAAA,EAAA,MAAA,EAAO;AAAA,aAAA,EACrE;AAAA,WAAA,EACF;AAAA;AAAA;AAAA,KACF;AAAA,IACC,KAAA,IAAS;AAAA,GAAA,EACZ,CAAA;AAEJ","file":"index.mjs","sourcesContent":["export enum SectionVariant {\n Panel = 'panel',\n Card = 'card',\n}\n","/**\n * Section — a bordered card container that themes its border + surface.\n */\nimport React from 'react';\n\nimport { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { SectionVariant } from './SectionVariant';\n\nconst styles = StyleSheet.create({\n card: {\n padding: 16,\n borderWidth: 1,\n borderRadius: 6,\n },\n raised: {\n borderRadius: 12,\n gap: 12,\n },\n});\n\nexport interface SectionProps {\n children?: React.ReactNode;\n style?: StyleProp<ViewStyle>;\n variant?: SectionVariant;\n testID?: string;\n}\n\nexport const Section = ({\n children,\n style,\n variant = SectionVariant.Panel,\n testID,\n}: SectionProps): React.ReactElement => {\n const { theme } = useUi();\n const isCard = variant === SectionVariant.Card;\n const fill = isCard ? theme.colors.background : theme.colors.surface;\n\n const containerStyle = React.useMemo(\n () => [styles.card, isCard ? styles.raised : null, { borderColor: theme.colors.border, backgroundColor: fill }, style],\n [theme.colors.border, fill, isCard, style],\n );\n\n return (\n <View style={containerStyle} testID={testID}>\n {children}\n </View>\n );\n};\n\nexport default Section;\n","export enum TextKind {\n Title = 'title',\n Heading = 'heading',\n Body = 'body',\n Strong = 'strong',\n Muted = 'muted',\n Small = 'small',\n}\n","import React from 'react';\n\nimport { Text, type StyleProp, type TextStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { TextKind } from './TextKind';\n\nexport interface AppTextProps {\n kind?: TextKind;\n color?: string;\n style?: StyleProp<TextStyle>;\n testID?: string;\n children: React.ReactNode;\n}\n\nconst SIZES: Record<TextKind, TextStyle> = {\n [TextKind.Title]: { fontSize: 24, fontWeight: '700', lineHeight: 30 },\n [TextKind.Heading]: { fontSize: 17, fontWeight: '700', lineHeight: 24 },\n [TextKind.Body]: { fontSize: 15, lineHeight: 22 },\n [TextKind.Strong]: { fontSize: 15, fontWeight: '700', lineHeight: 22 },\n [TextKind.Muted]: { fontSize: 14, lineHeight: 20 },\n [TextKind.Small]: { fontSize: 12, lineHeight: 16 },\n};\n\nexport const AppText = ({\n kind = TextKind.Body,\n color,\n style,\n testID,\n children,\n}: AppTextProps): React.ReactElement => {\n const { theme } = useUi();\n const quiet = kind === TextKind.Muted || kind === TextKind.Small;\n return (\n <Text\n style={[\n SIZES[kind],\n { color: color ?? (quiet ? theme.colors.textSecondary : theme.colors.text) },\n style,\n ]}\n testID={testID}\n >\n {children}\n </Text>\n );\n};\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 stickyPreview: 'sticky-preview',\n pageFrame: 'page-frame',\n upgradePrompt: 'upgrade-prompt',\n upgradePromptCta: 'upgrade-prompt-cta',\n upgradePromptDismiss: 'upgrade-prompt-dismiss',\n modalShell: 'template-modal',\n modalShellClose: 'cancel-button',\n /** Default base testID for the centered `Modal`; ✕ is `modal-close`, backdrop `modal-backdrop`. */\n modal: 'modal',\n sideSheet: 'side-sheet',\n bottomSheet: 'bottom-sheet',\n /** Default base testID for `ConfirmDialog`; Confirm/Cancel are `confirm-dialog-{confirm,cancel}`. */\n confirmDialog: 'confirm-dialog',\n accordion: 'accordion',\n /** Default testID for the `BuildInfoFooter` caption (`v<version>`). */\n buildInfoFooter: 'build-info-footer',\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 /**\n * Accessible hint on the collapsed (mobile) `Tabs` menu trigger — the button\n * that shows the active section and opens the vertical list of sections.\n */\n tabsMenuHint: 'common.tabsMenuHint',\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 /** `Modal`: accessible name + web tooltip of the top-right ✕ close button. */\n dialogClose: 'common.close',\n /** `PageFrame` (`enlargeable`): accessible name + hint of the preview that opens the full-size page. */\n pageEnlarge: 'common.pageEnlarge',\n pageEnlargeHint: 'common.pageEnlargeHint',\n /** `ConfirmDialog`: default Confirm button label (overridable via `confirmLabel`) + its hint. */\n confirm: 'common.confirm',\n confirmHint: 'common.confirmHint',\n /** `ConfirmDialog`: default Cancel button label (overridable via `cancelLabel`) + its hint. */\n cancel: 'common.cancel',\n cancelHint: 'common.cancelHint',\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 /** `CopyableId`: the copy control's label in each of its three states, plus its hint. */\n copy: 'common.copy',\n copyHint: 'common.copyHint',\n copied: 'common.copied',\n /**\n * Shown when the clipboard write genuinely failed — non-secure context, denied permission.\n * This string reaching a user is CORRECT behaviour, not a defect: the alternative is them\n * believing they hold an identifier they do not.\n */\n copyFailed: 'common.copyFailed',\n /** `CopyableId`: hint on the value itself, explaining it is shortened for display. */\n copyableIdHint: 'common.copyableIdHint',\n /** `BuildInfoFooter`: accessible hint on the version caption (the visible `v<version>` is the label). */\n buildInfoHint: 'common.buildInfoHint',\n} as const;\n\n/*\n * ---------------------------------------------------------------------------\n * Responsive breakpoints + the minimum touch target (mobile-first.md rule 7).\n *\n * These are the ONE source for the numbers the kit and the seven portals change\n * shape at. Before this, four literals existed with no shared source:\n * `MENU_BREAKPOINT` (here), `RAIL_FULL_BREAKPOINT` and\n * `DEFAULT_SEARCH_BREAKPOINT` (`@dloizides/ui-nav`) and `MOBILE_BREAKPOINT`\n * (nextgame-web's D1 theme). Three of them agreed at 768 by coincidence rather\n * than by reference, and each was named after its CALL SITE, which is exactly\n * why nobody noticed they were the same rule.\n *\n * The two breakpoints are deliberately DIFFERENT numbers and must stay so: they\n * answer different questions. Collapsing them into one would move type on every\n * portal.\n * ---------------------------------------------------------------------------\n */\n\n/**\n * Viewport width (px) below which the TYPE ramp drops to its mobile sizes.\n *\n * Typography, not layout. A type scale steps down earlier than a column layout\n * collapses because a 44px display line is unreadable on a phone long before a\n * two-column grid stops fitting. nextgame-web's D1 ramp (`typeStyle`) is the\n * only implementation today; the number lives here so the next one reuses it.\n */\nexport const TYPE_SCALE_BREAKPOINT = 600;\n\n/**\n * Viewport width (px) at/above which LAYOUT keeps its wide form: the inline\n * anchored dropdown menu, the horizontal tab row, the persistent nav rail, the\n * inline sidebar search field. Below it each collapses to its phone affordance.\n *\n * This is the value `MENU_BREAKPOINT`, `RAIL_FULL_BREAKPOINT` and\n * `DEFAULT_SEARCH_BREAKPOINT` each hard-coded independently.\n */\nexport const LAYOUT_COLLAPSE_BREAKPOINT = 768;\n\n/**\n * Minimum interactive hit box, in CSS px, on BOTH axes — measured on the box,\n * never on the glyph inside it. WCAG 2.5.5 / mobile-first.md.\n */\nexport const MIN_TARGET_PX = 44;\n","/**\r\n * The wide-web viewport rule, in one place.\r\n *\r\n * `ModalDropdown` and `Tabs` each computed `platformOS === 'web' && width >= n`\r\n * inline. The predicate is the same rule in both: on ANY native platform the\r\n * surface is a phone or tablet, never a desktop, so the wide form is refused at\r\n * every width; on web it turns on at the breakpoint.\r\n */\r\nimport { LAYOUT_COLLAPSE_BREAKPOINT } from './constants';\r\n\r\n/** The web platform key that `Platform.OS` reports under react-native-web. */\r\nexport const WEB_PLATFORM = 'web';\r\n\r\n/**\r\n * `true` only on a web viewport at/above `breakpoint`. Native always returns\r\n * `false`, whatever the width.\r\n */\r\nexport function isWideWebViewport(\r\n width: number,\r\n platformOS: string,\r\n breakpoint: number = LAYOUT_COLLAPSE_BREAKPOINT,\r\n): boolean {\r\n return platformOS === WEB_PLATFORM && width >= breakpoint;\r\n}\r\n","import { Platform, useWindowDimensions } from 'react-native';\n\nimport { LAYOUT_COLLAPSE_BREAKPOINT } from '../constants';\nimport { isWideWebViewport } from '../responsive';\n\nexport function useIsWideViewport(breakpoint: number = LAYOUT_COLLAPSE_BREAKPOINT): boolean {\n const { width } = useWindowDimensions();\n return isWideWebViewport(width, Platform.OS, breakpoint);\n}\n","import React from 'react';\n\nimport { StyleSheet, View } from 'react-native';\n\nimport { useIsWideViewport } from '../hooks/useIsWideViewport';\n\nconst styles = StyleSheet.create({\n outer: { alignItems: 'center', width: '100%' },\n column: { width: '100%', gap: 16 },\n desktop: { paddingHorizontal: 32, paddingVertical: 24 },\n mobile: { paddingHorizontal: 16, paddingVertical: 16 },\n wide: { maxWidth: 1200 },\n narrow: { maxWidth: 720 },\n});\n\nexport interface ScreenColumnProps {\n children: React.ReactNode;\n narrow?: boolean;\n}\n\nexport const ScreenColumn = ({ children, narrow = false }: ScreenColumnProps): React.ReactElement => {\n const isWide = useIsWideViewport();\n return (\n <View style={styles.outer}>\n <View style={[styles.column, isWide ? styles.desktop : styles.mobile, narrow ? styles.narrow : styles.wide]}>\n {children}\n </View>\n </View>\n );\n};\n","/**\n * Heading — themed section heading text, rendered as a REAL `<h1>`–`<h6>` on web.\n *\n * ## Why `level` exists\n *\n * `accessibilityRole=\"header\"` maps to the ARIA `heading` role, which react-native-web turns\n * into a real heading element — but with no `aria-level` it always emits `<h1>`. A screen\n * having several `<h1>`s and no `<h2>` is a flat document: heading navigation, the primary way\n * assistive-tech users move around a long page, lists every section as a peer of the page title.\n *\n * `level` supplies `aria-level`, which RN-web uses to pick `h{level}`. It defaults to 2 rather\n * than 1 on purpose: a page has exactly ONE `<h1>` (its title) and many section headings, so the\n * common case must be the safe one. A second `<h1>` is a defect that renders identically to a\n * correct heading, so nothing about the page would reveal the mistake.\n *\n * The visual size is deliberately NOT derived from `level`. Heading level is document structure;\n * type scale is design. Tying them together is what pushes authors to pick a level for its font\n * size and break the outline to get the look they want.\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\n/** Section heading — the common case. A page's single `<h1>` must ask for level 1 explicitly. */\nconst DEFAULT_HEADING_LEVEL = 2;\n\n/** `h1`–`h6`; HTML defines no `h7`. */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingProps {\n text?: string;\n children?: React.ReactNode;\n /**\n * Document outline depth → `<h1>`–`<h6>` on web, `aria-level` on native. Defaults to 2.\n * Pick it from the page's STRUCTURE, never from how large you want the text to look.\n */\n level?: HeadingLevel;\n /**\n * Merged AFTER the themed base, for the genuine one-off — a page title that needs to be\n * visibly larger than a section heading. Structure stays in `level`; size lives here.\n */\n style?: React.ComponentProps<typeof Text>['style'];\n testID?: string;\n}\n\nexport const Heading = ({\n text,\n children,\n level = DEFAULT_HEADING_LEVEL,\n style,\n testID,\n}: HeadingProps): React.ReactElement => {\n const { theme } = useUi();\n\n const headingStyle = React.useMemo(\n () => [styles.heading, { color: theme.colors.text }, style],\n [theme.colors.text, style],\n );\n\n return (\n <Text\n accessibilityRole=\"header\"\n aria-level={level}\n style={headingStyle}\n testID={testID ?? LAYOUT_TEST_IDS.headingText}\n >\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;\nconst ICON_GAP = 4;\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 // Never wider than the container: a long label wraps inside the pill instead of being clipped.\n maxWidth: '100%',\n },\n badgeWithIcon: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: ICON_GAP,\n },\n badgeDashed: {\n borderWidth: 1,\n borderStyle: 'dashed',\n },\n text: {\n fontSize: DEFAULT_FONT_SIZE,\n fontWeight: '600',\n flexShrink: 1,\n },\n});\n\nexport interface StatusBadgeProps {\n label: string;\n color: string;\n backgroundColor: string;\n icon?: React.ReactNode;\n dashed?: boolean;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n}\n\nexport const StatusBadge = ({\n label,\n color,\n backgroundColor,\n icon,\n dashed = false,\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 dashedColor = useMemo(() => ({ borderColor: color }), [color]);\n const dynamicText = useMemo(() => ({ color }), [color]);\n const hasIcon = icon !== undefined && icon !== null;\n\n return (\n <View\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.statusBadgeHint)}\n accessibilityLabel={accessibilityLabel ?? label}\n style={[styles.badge, hasIcon && styles.badgeWithIcon, dynamicBadge, dashed && styles.badgeDashed, dashed && dashedColor]}\n testID={testID}\n >\n {hasIcon ? <View aria-hidden>{icon}</View> : null}\n <Text style={[styles.text, dynamicText]}>{label}</Text>\n </View>\n );\n};\n\nexport default StatusBadge;\n","import { useEffect, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport type { View } from 'react-native';\n\n/** True when the sentinel has scrolled above the sticky line, not merely out of view below it. */\nexport function isPastStickyLine(sentinelTop: number, isIntersecting: boolean, topOffset: number): boolean {\n return !isIntersecting && sentinelTop < topOffset;\n}\n\n/** Watches a sentinel placed just above a sticky element and reports when that element is stuck. */\nexport function useStuckSentinel(topOffset: number): { sentinelRef: RefObject<View | null>; isStuck: boolean } {\n const sentinelRef = useRef<View>(null);\n const [isStuck, setIsStuck] = useState(false);\n\n useEffect(() => {\n const node = sentinelRef.current as unknown as Element | null;\n if (node === null || typeof IntersectionObserver === 'undefined') return undefined;\n\n const observer = new IntersectionObserver(\n (entries) => {\n const entry = entries[entries.length - 1];\n if (entry !== undefined) setIsStuck(isPastStickyLine(entry.boundingClientRect.top, entry.isIntersecting, topOffset));\n },\n { rootMargin: `-${topOffset}px 0px 0px 0px` },\n );\n observer.observe(node);\n return () => observer.disconnect();\n }, [topOffset]);\n\n return { sentinelRef, isStuck };\n}\n","import { useEffect, useRef, useState } from 'react';\n\nconst KEYBOARD_HEIGHT_RATIO = 0.75;\n\nexport interface VisibleViewport {\n offsetTop: number;\n keyboardOpen: boolean;\n}\n\nconst INITIAL: VisibleViewport = { offsetTop: 0, keyboardOpen: false };\n\n/** True when the visible height has dropped far enough below the tallest height seen at this width. */\nexport function isKeyboardOpen(visibleHeight: number, tallestHeight: number): boolean {\n return visibleHeight < tallestHeight * KEYBOARD_HEIGHT_RATIO;\n}\n\n/** Tracks the Visual Viewport offset and keyboard state; stays at its initial value where the API is absent. */\nexport function useVisibleViewport(): VisibleViewport {\n const [state, setState] = useState<VisibleViewport>(INITIAL);\n const tallest = useRef({ width: 0, height: 0 });\n\n useEffect(() => {\n const viewport = typeof window === 'undefined' ? undefined : window.visualViewport;\n if (viewport === undefined || viewport === null) return undefined;\n\n const read = (): void => {\n const unzoomedHeight = viewport.height * viewport.scale;\n const unzoomedWidth = viewport.width * viewport.scale;\n const widthChanged = tallest.current.width !== unzoomedWidth;\n const height = widthChanged ? unzoomedHeight : Math.max(tallest.current.height, unzoomedHeight);\n tallest.current = { width: unzoomedWidth, height };\n const offsetTop = viewport.offsetTop;\n const keyboardOpen = isKeyboardOpen(unzoomedHeight, height);\n setState((previous) =>\n previous.offsetTop === offsetTop && previous.keyboardOpen === keyboardOpen\n ? previous\n : { offsetTop, keyboardOpen },\n );\n };\n\n read();\n viewport.addEventListener('resize', read);\n viewport.addEventListener('scroll', read);\n return () => {\n viewport.removeEventListener('resize', read);\n viewport.removeEventListener('scroll', read);\n };\n }, []);\n\n return state;\n}\n","import React, { useMemo } from 'react';\n\nimport { Platform, StyleSheet, View } from 'react-native';\nimport type { ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_TEST_IDS } from '../constants';\nimport { WEB_PLATFORM } from '../responsive';\nimport { useStuckSentinel } from './hooks/useStuckSentinel';\nimport { useVisibleViewport } from './hooks/useVisibleViewport';\n\nconst STICKY_Z_INDEX = 5;\n\nconst styles = StyleSheet.create({\n sentinel: { height: 1, marginBottom: -1 },\n compact: { borderBottomWidth: 1 },\n});\n\nexport interface StickyPreviewProps {\n full: React.ReactNode;\n compact: React.ReactNode;\n forceCompact?: boolean;\n topOffset?: number;\n accessibilityLabel: string;\n accessibilityHint?: string;\n testID?: string;\n}\n\n/** Keeps a preview at the top of the visible viewport, swapping to its compact slot while space is short. */\nexport const StickyPreview = ({\n full,\n compact,\n forceCompact = false,\n topOffset = 0,\n accessibilityLabel,\n accessibilityHint,\n testID = LAYOUT_TEST_IDS.stickyPreview,\n}: StickyPreviewProps): React.ReactElement => {\n const { theme } = useUi();\n const { offsetTop, keyboardOpen } = useVisibleViewport();\n const { sentinelRef, isStuck } = useStuckSentinel(topOffset);\n const isCompact = forceCompact || isStuck || keyboardOpen;\n\n const pinned = useMemo(() => {\n const web = { position: 'sticky', top: topOffset + offsetTop, zIndex: STICKY_Z_INDEX };\n return (Platform.OS === WEB_PLATFORM ? web : {}) as unknown as ViewStyle;\n }, [offsetTop, topOffset]);\n\n return (\n <>\n <View aria-hidden ref={sentinelRef} style={styles.sentinel} />\n <View\n accessibilityHint={accessibilityHint}\n accessibilityLabel={accessibilityLabel}\n role=\"region\"\n style={[\n pinned,\n { backgroundColor: theme.colors.background, borderColor: theme.colors.border },\n isCompact && styles.compact,\n ]}\n testID={testID}\n >\n <View testID={`${testID}-${isCompact ? 'compact' : 'full'}`}>{isCompact ? compact : full}</View>\n </View>\n </>\n );\n};\n\nexport default StickyPreview;\n","/**\n * useEscapeKey — calls `onClose` when the user presses Escape (web only).\n *\n * No-op on native, where a dialog is dismissed with the hardware back button through\n * RN `Modal`'s `onRequestClose`. The `document` listener is attached ONLY while `enabled`,\n * so a closed dialog never intercepts an Escape meant for something else on the page.\n */\nimport { useEffect } from 'react';\n\nimport { Platform } from 'react-native';\n\nexport function useEscapeKey(enabled: boolean, onClose: () => void): void {\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n const onKeyDown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', onKeyDown);\n\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [enabled, onClose]);\n}\n","/**\r\n * Traps keyboard focus within a container element on web.\r\n * No-op on native platforms where `<Modal>` handles focus containment.\r\n *\r\n * On enable: saves the previously focused element and focuses `initialFocusTestID`, else keeps a\r\n * child that already took focus (autoFocus), else the first focusable child.\r\n * Tab wraps from last to first; Shift+Tab wraps from first to last. On disable/unmount:\r\n * restores focus to the saved element.\r\n */\r\nimport { useEffect, useRef } from 'react';\r\nimport type { RefObject } from 'react';\r\n\r\nimport { Platform } from 'react-native';\r\nimport type { View } from 'react-native';\r\n\r\nconst FOCUSABLE_SELECTOR = [\r\n 'a[href]',\r\n 'button:not([disabled])',\r\n 'input:not([disabled])',\r\n 'select:not([disabled])',\r\n 'textarea:not([disabled])',\r\n '[tabindex]:not([tabindex=\"-1\"])',\r\n].join(', ');\r\n\r\nfunction getFocusableElements(container: HTMLElement): HTMLElement[] {\r\n return Array.from(container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR));\r\n}\r\n\r\nfunction savePreviousFocus(): HTMLElement | null {\r\n return document.activeElement instanceof HTMLElement ? document.activeElement : null;\r\n}\r\n\r\nfunction focusInitial(domNode: HTMLElement, initialFocusTestID: string | undefined): void {\r\n const named =\r\n initialFocusTestID === undefined\r\n ? null\r\n : domNode.querySelector<HTMLElement>(`[data-testid=\"${initialFocusTestID}\"]`);\r\n if (named) {\r\n named.focus();\r\n return;\r\n }\r\n if (domNode.contains(document.activeElement)) return;\r\n getFocusableElements(domNode)[0]?.focus();\r\n}\r\n\r\nfunction handleKeyDown(domNode: HTMLElement, event: KeyboardEvent): void {\r\n if (event.key !== 'Tab') return;\r\n\r\n const focusable = getFocusableElements(domNode);\r\n if (focusable.length === 0) {\r\n event.preventDefault();\r\n return;\r\n }\r\n\r\n const first = focusable[0];\r\n const last = focusable[focusable.length - 1];\r\n if (!first || !last) {\r\n event.preventDefault();\r\n return;\r\n }\r\n const active = document.activeElement;\r\n\r\n if (event.shiftKey && active === first) {\r\n event.preventDefault();\r\n last.focus();\r\n } else if (!event.shiftKey && active === last) {\r\n event.preventDefault();\r\n first.focus();\r\n }\r\n}\r\n\r\nexport function useFocusTrap(\r\n containerRef: RefObject<View | null>,\r\n enabled: boolean,\r\n initialFocusTestID?: string,\r\n): void {\r\n const previousFocusRef = useRef<HTMLElement | null>(null);\r\n\r\n useEffect(() => {\r\n if (Platform.OS !== 'web' || !enabled) return;\r\n\r\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- RN web ref is an HTMLElement at runtime\r\n const domNode = containerRef.current as unknown as HTMLElement | null;\r\n if (!domNode) return;\r\n\r\n const previous = savePreviousFocus();\r\n previousFocusRef.current = previous !== null && domNode.contains(previous) ? null : previous;\r\n queueMicrotask(() => focusInitial(domNode, initialFocusTestID));\r\n\r\n const listener = (e: KeyboardEvent): void => handleKeyDown(domNode, e);\r\n domNode.addEventListener('keydown', listener);\r\n\r\n return () => {\r\n domNode.removeEventListener('keydown', listener);\r\n previousFocusRef.current?.focus();\r\n previousFocusRef.current = null;\r\n };\r\n }, [containerRef, enabled, initialFocusTestID]);\r\n}\r\n","/**\n * useScrollLock — freezes page scroll (web only) while `enabled`, restoring the prior\n * `document.body` overflow on cleanup.\n *\n * No-op on native, where the RN `Modal` already covers the screen. Prevents the content\n * BEHIND an open dialog from scrolling under the backdrop while the dialog is focus-trapped.\n */\nimport { useEffect } from 'react';\n\nimport { Platform } from 'react-native';\n\nexport function useScrollLock(enabled: boolean): void {\n useEffect(() => {\n if (Platform.OS !== 'web' || !enabled) return;\n\n const { body } = document;\n const previousOverflow = body.style.overflow;\n body.style.overflow = 'hidden';\n\n return () => {\n body.style.overflow = previousOverflow;\n };\n }, [enabled]);\n}\n","/**\n * Modal — a themed, CENTERED dialog overlay for RN + RN-web.\n *\n * Distinct from this package's {@link import('../ModalShell/ModalShell').ModalShell}, which is a\n * full-screen slide-up sheet. `Modal` is the floating card an app opens over the current screen:\n * a scrim, a rounded surface, an optional header (title + a top-right ✕ close), a scrollable body,\n * and an optional footer (action buttons). It is the shared shell {@link ConfirmDialog} is built on,\n * and the replacement for per-app dialogs like kefi-web's `PromoterActionModal`.\n *\n * DISMISSAL — four routes, all funnel to `onClose`:\n * - the top-right ✕ button (web tooltip + aria-label \"Close\"; a 44dp `IconButton` target),\n * - a press on the backdrop scrim (a SIBLING of the dialog, so option/action buttons are never\n * nested inside a button — invalid DOM),\n * - Escape on web (via {@link useEscapeKey}),\n * - the hardware back button on native (RN `Modal`'s `onRequestClose`).\n *\n * ACCESSIBILITY: the dialog carries `role=\"dialog\"` + `aria-modal` (via `accessibilityViewIsModal`)\n * and an accessible name (`accessibilityLabel` → `title` → the neutral \"dialog\" key). Focus is\n * trapped within the dialog on web ({@link useFocusTrap}) and restored to the opener on close, and\n * page scroll behind the dialog is locked ({@link useScrollLock}).\n *\n * Every colour is read from the app's theme via `useUi()` — no raw literals.\n */\nimport React, { useMemo, useRef } from 'react';\n\nimport { Animated, Modal as RNModal, ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';\n\nimport { IconButton } from '@dloizides/ui-buttons';\nimport { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { Heading } from '../Heading/Heading';\nimport { useEscapeKey } from '../hooks/useEscapeKey';\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { useScrollLock } from '../hooks/useScrollLock';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport type { ModalSize } from './ModalSize';\n\nconst OVERLAY_PADDING = 16;\nconst DIALOG_RADIUS = 12;\nconst DIALOG_PADDING = 16;\nconst HEADER_GAP = 12;\nconst FOOTER_MARGIN = 16;\nconst HEADER_MARGIN = 12;\n/** The dialog never grows past most of the viewport height; its body scrolls instead. */\nconst DIALOG_MAX_HEIGHT = '90%';\n/** The panel enters scaled slightly down (and fades in), settling to its natural size. */\nconst PANEL_ENTER_SCALE = 0.96;\n\n/** Max width per size preset. A floor-less card otherwise stretches to the full viewport on web. */\nconst SIZE_MAX_WIDTH: Record<ModalSize, number> = { sm: 360, md: 480, lg: 640, xl: 880 };\n\nconst styles = StyleSheet.create({\n overlay: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n padding: OVERLAY_PADDING,\n },\n // The scrim is its OWN animated layer (behind the tap-catcher and the panel) so its opacity\n // can fade independently of the panel's fade+scale. `animationType` is a native-only no-op on\n // react-native-web, which is why the fade is driven by `Animated` instead. `pointerEvents` lives\n // in style (not the deprecated prop) so taps fall through to the sibling tap-catcher below.\n scrim: { backgroundColor: MODAL_OVERLAY_COLOR, pointerEvents: 'none' },\n dialog: {\n width: '100%',\n borderRadius: DIALOG_RADIUS,\n padding: DIALOG_PADDING,\n maxHeight: DIALOG_MAX_HEIGHT,\n },\n headerRow: {\n flexDirection: 'row',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n columnGap: HEADER_GAP,\n marginBottom: HEADER_MARGIN,\n },\n // Occupies the header's leading space so the ✕ pins to the trailing edge even without a title.\n titleWrap: { flex: 1 },\n footer: { marginTop: FOOTER_MARGIN },\n});\n\nexport interface ModalProps {\n /** Whether the dialog is mounted + shown. */\n visible: boolean;\n /** Called by every dismissal route: ✕, backdrop, Escape (web), hardware back (native). */\n onClose: () => void;\n /** Header title. Omit for a chromeless dialog (the ✕ still shows unless `showClose` is false). */\n title?: string;\n /** Dialog body. Rendered inside a scroll view so long content scrolls within the dialog. */\n children?: React.ReactNode;\n /** Optional footer, typically an action-button row (see {@link ConfirmDialog}). */\n footer?: React.ReactNode;\n /** Max-width preset. Default `md`. */\n size?: ModalSize;\n /**\n * Show the top-right ✕ close button. Default `true`. `ConfirmDialog` sets it `false` — it offers\n * an explicit Cancel, and hiding the ✕ lets the web focus trap land on the SAFE Cancel action.\n */\n showClose?: boolean;\n /** Base testID. Default `modal`. The ✕ is `${testID}-close`, the backdrop `${testID}-backdrop`. */\n testID?: string;\n /** Accessible name of the dialog. Falls back to `title`, then the neutral \"dialog\" key. */\n accessibilityLabel?: string;\n /** testID of the control focused on open (web). Default: an autoFocus child, else the first focusable. */\n initialFocusTestID?: string;\n}\n\nexport const Modal = ({\n visible,\n onClose,\n title,\n children,\n footer,\n size = 'md',\n showClose = true,\n testID = LAYOUT_TEST_IDS.modal,\n accessibilityLabel,\n initialFocusTestID,\n}: ModalProps): React.ReactElement => {\n const { theme, t } = useUi();\n const dialogRef = useRef<View>(null);\n\n // Backdrop fades opacity only; the panel fades AND scales in from 0.96. Both share `visible`,\n // so they enter/exit in lock-step. `panel.mounted` keeps the whole RN `Modal` host (and thus\n // the backdrop) in the tree through the exit fade — RN `Modal` unmounting on `visible=false`\n // is exactly what makes the native-only `animationType` snap on web, so we drive it ourselves.\n const backdrop = useEnterExit({ visible });\n const panel = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });\n const mounted = panel.mounted || backdrop.mounted;\n\n useFocusTrap(dialogRef, visible, initialFocusTestID);\n useEscapeKey(visible, onClose);\n useScrollLock(visible);\n\n const accessibleName = accessibilityLabel ?? title ?? t(LAYOUT_I18N.dialog);\n const closeLabel = t(LAYOUT_I18N.dialogClose);\n\n const dialogStyle = useMemo(\n () => [styles.dialog, { backgroundColor: theme.colors.surface, maxWidth: SIZE_MAX_WIDTH[size] }],\n [theme.colors.surface, size],\n );\n\n const hasHeader = title !== undefined || showClose;\n\n return (\n <RNModal transparent visible={mounted} onRequestClose={onClose}>\n <View style={styles.overlay}>\n {/* Animated scrim layer — fades independently, behind the tap-catcher and the panel. */}\n <Animated.View\n style={[StyleSheet.absoluteFill, styles.scrim, { opacity: backdrop.style.opacity }]}\n />\n {/* Backdrop is a SIBLING behind the dialog, not its parent: a wrapping pressable would nest\n the footer's action buttons inside a button (invalid DOM). Absolute-fill catches taps\n outside the dialog surface. */}\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={onClose}\n />\n <Animated.View\n ref={dialogRef}\n accessibilityViewIsModal\n aria-label={accessibleName}\n role=\"dialog\"\n style={[dialogStyle, panel.style]}\n testID={testID}\n >\n {hasHeader ? (\n <View style={styles.headerRow}>\n <View style={styles.titleWrap}>\n {title !== undefined ? <Heading>{title}</Heading> : null}\n </View>\n {showClose ? (\n <IconButton\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={closeLabel}\n appearance=\"ghost\"\n renderIcon={(color, iconSize) => <SvgIcon color={color} name=\"close\" size={iconSize} />}\n size=\"md\"\n testID={`${testID}-close`}\n tooltip={closeLabel}\n variant=\"ghost\"\n onPress={onClose}\n />\n ) : null}\n </View>\n ) : null}\n\n <ScrollView>{children}</ScrollView>\n\n {footer !== undefined ? <View style={styles.footer}>{footer}</View> : null}\n </Animated.View>\n </View>\n </RNModal>\n );\n};\n\nexport default Modal;\n","import React from 'react';\n\nimport { ScrollView, View } from 'react-native';\nimport type { ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N } from '../../constants';\nimport { Modal } from '../../Modal/Modal';\nimport type { PageSize } from '../utils/pageScale';\n\nconst CENTRED_ROW: ViewStyle = { flexGrow: 1, justifyContent: 'center' };\n\nexport interface PageOverlayProps {\n children: React.ReactNode;\n pageSize: PageSize;\n visible: boolean;\n onClose: () => void;\n testID: string;\n}\n\n/** Shows the page at scale 1 in a dialog; centred, never narrower than its page width; the dialog scrolls when it is larger. */\nexport const PageOverlay = ({ children, pageSize, visible, onClose, testID }: PageOverlayProps): React.ReactElement => {\n const { t } = useUi();\n\n return (\n <Modal accessibilityLabel={t(LAYOUT_I18N.pageEnlarge)} size=\"xl\" testID={testID} visible={visible} onClose={onClose}>\n <ScrollView horizontal contentContainerStyle={CENTRED_ROW}>\n <View\n style={{ width: pageSize.width, minWidth: pageSize.width, height: pageSize.height, flexShrink: 0 }}\n testID={`${testID}-page`}\n >\n {children}\n </View>\n </ScrollView>\n </Modal>\n );\n};\n","export interface PageSize {\n width: number;\n height: number;\n}\n\nexport interface ScaledFrame {\n scale: number;\n height: number;\n offsetX: number;\n offsetY: number;\n}\n\nconst HALF = 2;\n\n/** A4 at 96 CSS px per inch: 210 x 297 mm. */\nexport const A4_PAGE: PageSize = { width: 794, height: 1123 };\n\n/** The factor that fits a page of `pageWidth` into `containerWidth`, never above 1; 1 while unmeasured. */\nexport const pageScale = (containerWidth: number, pageWidth: number): number => {\n if (containerWidth <= 0 || pageWidth <= 0) return 1;\n return Math.min(1, containerWidth / pageWidth);\n};\n\n/** The scale, outer height and the offsets that pin a centre-scaled page to the top-left corner. */\nexport const scaledFrame = (containerWidth: number, page: PageSize): ScaledFrame => {\n const scale = pageScale(containerWidth, page.width);\n return {\n scale,\n height: page.height * scale,\n offsetX: ((scale - 1) * page.width) / HALF,\n offsetY: ((scale - 1) * page.height) / HALF,\n };\n};\n","import React, { useCallback, useState } from 'react';\n\nimport { Pressable, StyleSheet, View } from 'react-native';\nimport type { LayoutChangeEvent } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport { PageOverlay } from './components/PageOverlay';\nimport { A4_PAGE, scaledFrame } from './utils/pageScale';\nimport type { PageSize } from './utils/pageScale';\n\nconst styles = StyleSheet.create({\n outer: { width: '100%', overflow: 'hidden' },\n page: { position: 'absolute', top: 0, left: 0 },\n trigger: { width: '100%', cursor: 'pointer' },\n});\n\nexport interface PageFrameProps {\n children: React.ReactNode;\n pageSize?: PageSize;\n testID?: string;\n /** When true, a press or Enter on the preview opens the page at full size in an overlay. */\n enlargeable?: boolean;\n}\n\n/** Lays children out at a fixed page size and scales the page down to the container width, never up. */\nexport const PageFrame = ({\n children,\n pageSize = A4_PAGE,\n testID = LAYOUT_TEST_IDS.pageFrame,\n enlargeable = false,\n}: PageFrameProps): React.ReactElement => {\n const { t } = useUi();\n const [containerWidth, setContainerWidth] = useState(0);\n const [enlarged, setEnlarged] = useState(false);\n const onLayout = useCallback((event: LayoutChangeEvent) => {\n setContainerWidth(event.nativeEvent.layout.width);\n }, []);\n const open = useCallback(() => setEnlarged(true), []);\n const close = useCallback(() => setEnlarged(false), []);\n const frame = scaledFrame(containerWidth, pageSize);\n\n const preview = (\n <View style={[styles.outer, { height: frame.height }]} testID={testID} onLayout={onLayout}>\n <View\n style={[\n styles.page,\n {\n width: pageSize.width,\n height: pageSize.height,\n transform: [{ translateX: frame.offsetX }, { translateY: frame.offsetY }, { scale: frame.scale }],\n },\n ]}\n >\n {children}\n </View>\n </View>\n );\n if (!enlargeable) return preview;\n\n return (\n <>\n <Pressable\n accessibilityHint={t(LAYOUT_I18N.pageEnlargeHint)}\n accessibilityLabel={t(LAYOUT_I18N.pageEnlarge)}\n accessibilityRole=\"button\"\n style={styles.trigger}\n testID={`${testID}-enlarge`}\n onPress={open}\n >\n {preview}\n </Pressable>\n <PageOverlay pageSize={pageSize} testID={`${testID}-overlay`} visible={enlarged} onClose={close}>\n {children}\n </PageOverlay>\n </>\n );\n};\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\nimport { MIN_TARGET_PX } from '../constants';\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 minHeight: MIN_TARGET_PX,\n justifyContent: 'center',\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 * How the COLLAPSED (mobile) {@link import('./Tabs').Tabs} menu trigger presents.\n *\n * Below the collapse breakpoint the tab strip becomes a single trigger that opens\n * the vertical section list. This selects that trigger's affordance:\n *\n * - `Caret` — a bordered field showing the active section's label + a rotating ▾\n * caret. The default, so every existing consumer is visually unchanged.\n * - `Hamburger` — a ☰ menu icon (the universal mobile-nav affordance) leading the\n * active section's label. Opt in for a phone-first nav that reads as a menu.\n *\n * Exported as a regular (non-`const`) enum on purpose — the SAME reason as\n * {@link import('../ModalDropdown/DropdownVariant').DropdownVariant}: a `const enum`\n * is inlined at compile time and cannot cross a published-package boundary when the\n * consumer bundles with `isolatedModules` (esbuild / vite / babel — i.e. every app\n * that consumes this package). A regular enum emits a runtime object safe to import\n * and compare in any consumer.\n */\nexport enum TabsCollapsedTrigger {\n /** Bordered field with the active label + a rotating ▾ caret (default, unchanged). */\n Caret = 'caret',\n /** A ☰ hamburger icon leading the active label — the mobile-nav affordance. */\n Hamburger = 'hamburger',\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 { Z_INDEX } from '@dloizides/design-tokens';\nimport type { ViewStyle } from 'react-native';\n\n/**\n * z-index for the open menu popover — above app chrome AND above an open RN-web Modal, whose\n * body-level fixed container (`Z_INDEX.modal`) is a sibling of the portaled menu.\n */\nexport const MENU_Z_INDEX = Z_INDEX.popover;\n/** z-index lifted onto the anchor WRAPPER while the menu is open (native/defence-in-depth). */\nexport const ANCHOR_OPEN_Z_INDEX = Z_INDEX.dropdown;\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\n/**\n * The height cap for the option list's SCROLL VIEWPORT — the popover's own `maxHeight` cannot make a\n * long list scroll on its own: react-native-web gives Views `flex-shrink: 0`, so the inner ScrollView\n * grows to full content height and spills PAST the popover frame instead of scrolling inside it.\n * Capping the ScrollView makes it the scroll boundary, so a long list (e.g. a 20+ option category\n * filter) scrolls with a scrollbar. It sits just inside the popover, discounting the border + padding\n * on both edges, so it is strictly below {@link MENU_MAX_HEIGHT}.\n */\nexport const MENU_SCROLL_MAX_HEIGHT = MENU_MAX_HEIGHT - (BORDER_WIDTH + MENU_PADDING) * 2;\n\n/** The option list's scroll cap for a popover capped at `popoverMaxHeight`, inside its border and padding. */\nexport function menuScrollMaxHeight(popoverMaxHeight: number): number {\n return Math.max(0, popoverMaxHeight - (BORDER_WIDTH + MENU_PADDING) * 2);\n}\n\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/** Keep the popover at least this far from the viewport's left/right edge when it must be clamped. */\nexport const MENU_VIEWPORT_MARGIN = 8;\n/** Menu width floor for a custom (compact) trigger whose caller set no `menuMinWidth`. */\nexport const COMPACT_TRIGGER_MENU_MIN_WIDTH = 160;\n\n/** The caller's `menuMinWidth` when set; otherwise the compact floor for a custom trigger, else none. */\nexport function resolveMenuMinWidth(menuMinWidth: number | undefined, hasCustomTrigger: boolean): number | undefined {\n if (menuMinWidth !== undefined) return menuMinWidth;\n return hasCustomTrigger ? COMPACT_TRIGGER_MENU_MIN_WIDTH : undefined;\n}\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/** Where the open menu sits vertically: `top` when below the trigger, `bottom` when above it. */\nexport interface MenuPlacement {\n top?: number;\n bottom?: number;\n maxHeight: number;\n}\n\n/** Opens below unless the menu does not fit there and more room exists above; capped to the room on its side. */\nexport function resolveMenuPlacement(rect: AnchorRect, viewportHeight: number, menuHeight: number): MenuPlacement {\n if (viewportHeight <= 0) return { top: rect.bottom + MENU_TOP_GAP, maxHeight: MENU_MAX_HEIGHT };\n const top = Math.max(MENU_VIEWPORT_MARGIN, rect.bottom + MENU_TOP_GAP);\n const bottom = Math.max(MENU_VIEWPORT_MARGIN, viewportHeight - rect.top + MENU_TOP_GAP);\n const roomBelow = viewportHeight - top - MENU_VIEWPORT_MARGIN;\n const roomAbove = viewportHeight - bottom - MENU_VIEWPORT_MARGIN;\n const fitsBelow = roomBelow >= Math.min(menuHeight, MENU_MAX_HEIGHT);\n const cap = (room: number): number => Math.max(0, Math.min(MENU_MAX_HEIGHT, room));\n if (!fitsBelow && roomAbove > roomBelow) return { bottom, maxHeight: cap(roomAbove) };\n return { top, maxHeight: cap(roomBelow) };\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 *\n * A floored menu can be WIDER than its (compact) trigger, so anchoring its left edge to the\n * trigger would push it off the right of the viewport — the widened \"More ▾\" overflow menu, whose\n * trigger sits near the right of the bar, is exactly that case. When `viewportWidth` is given the\n * left is clamped so the menu's right edge clears the margin (sliding it left, right-aligning it to\n * the trigger in the limit) without ever crossing the left margin. `viewportWidth = 0` (unknown, or\n * the pure/native path) keeps the original trigger-anchored behaviour untouched.\n */\nexport function buildPortalPopoverStyle(\n rect: AnchorRect,\n minWidth = 0,\n viewportWidth = 0,\n placement: MenuPlacement = resolveMenuPlacement(rect, 0, MENU_MAX_HEIGHT),\n): ViewStyle {\n const width = Math.max(rect.width, minWidth);\n let left = rect.left;\n if (viewportWidth > 0) {\n const maxLeft = viewportWidth - width - MENU_VIEWPORT_MARGIN;\n left = Math.max(MENU_VIEWPORT_MARGIN, Math.min(rect.left, maxLeft));\n }\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 ...placement,\n left,\n width,\n zIndex: MENU_Z_INDEX,\n borderWidth: BORDER_WIDTH,\n borderRadius: BORDER_RADIUS,\n padding: MENU_PADDING,\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","import React from 'react';\n\nimport { StyleSheet, Text } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nconst HEADING_FONT_SIZE = 12;\nconst HEADING_FONT_WEIGHT = '600' as const;\nconst HEADING_PADDING_H = 16;\nconst HEADING_PADDING_TOP = 8;\nconst HEADING_PADDING_BOTTOM = 4;\nconst HEADING_LETTER_SPACING = 0.5;\n\nconst styles = StyleSheet.create({\n heading: {\n fontSize: HEADING_FONT_SIZE,\n fontWeight: HEADING_FONT_WEIGHT,\n letterSpacing: HEADING_LETTER_SPACING,\n paddingHorizontal: HEADING_PADDING_H,\n paddingTop: HEADING_PADDING_TOP,\n paddingBottom: HEADING_PADDING_BOTTOM,\n },\n});\n\nexport interface MenuHeadingProps {\n testID: string;\n text: string;\n}\n\n/** Visible, non-focusable heading shown at the top of an open dropdown menu. */\nexport const MenuHeading = ({ testID, text }: MenuHeadingProps): React.ReactElement => {\n const { theme } = useUi();\n\n return (\n <Text\n accessibilityRole=\"header\"\n style={[styles.heading, { color: theme.colors.textSecondary }]}\n testID={`${testID}-menu-heading`}\n >\n {text}\n </Text>\n );\n};\n\nexport default MenuHeading;\n","/** How a dropdown option row marks the currently selected value. */\nexport enum SelectedMarker {\n Bold = 'bold',\n AccentCheck = 'accent-check',\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, View } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, MIN_TARGET_PX } from '../constants';\n\nimport { SelectedMarker } from './SelectedMarker';\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;\nconst ACCENT_BAR_WIDTH = 3;\nconst CHECK_GAP = 8;\nconst CHECK_GLYPH = '✓';\n\nconst styles = StyleSheet.create({\n option: {\n paddingHorizontal: OPTION_PADDING_H,\n paddingVertical: OPTION_PADDING_V,\n minHeight: MIN_TARGET_PX,\n justifyContent: 'center',\n borderRadius: OPTION_BORDER_RADIUS,\n },\n optionText: { fontSize: BODY_FONT_SIZE },\n selectedText: { fontWeight: SELECTED_FONT_WEIGHT },\n markedRow: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n columnGap: CHECK_GAP,\n borderLeftWidth: ACCENT_BAR_WIDTH,\n borderLeftColor: 'transparent',\n paddingLeft: OPTION_PADDING_H - ACCENT_BAR_WIDTH,\n },\n markedText: { flexShrink: 1 },\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 /** `AccentCheck` marks the selected row with an accent left bar and a trailing check. */\n selectedMarker?: SelectedMarker;\n /** Renders the row as `role=\"menuitem\"` (rows of a `role=\"menu\"` popover). */\n asMenuItem?: boolean;\n}\n\nexport const OptionRow = ({\n testID,\n label,\n isSelected,\n isHighlighted = false,\n onSelect,\n selectedMarker = SelectedMarker.Bold,\n asMenuItem = false,\n}: OptionRowProps): React.ReactElement => {\n const { theme, t } = useUi();\n const { colors } = theme;\n\n const handlePress = useCallback(() => { onSelect(); }, [onSelect]);\n\n const accentColor = theme.palette.primary['500'];\n const isMarked = selectedMarker === SelectedMarker.AccentCheck;\n const isActive = isSelected || isHighlighted;\n const rowStyle = [\n styles.option,\n isMarked ? styles.markedRow : null,\n isActive ? { backgroundColor: colors.surfaceElevated } : null,\n isMarked && isSelected ? { borderLeftColor: accentColor } : null,\n ];\n const textStyle = [\n styles.optionText,\n { color: colors.text },\n isSelected ? styles.selectedText : null,\n isMarked ? styles.markedText : null,\n ];\n const selectionProps = asMenuItem ? { 'aria-current': isSelected ? 'true' : undefined } : { 'aria-selected': isSelected };\n\n return (\n <TouchableOpacity\n accessible\n accessibilityHint={t(LAYOUT_I18N.selectOptionHint)}\n accessibilityLabel={label}\n accessibilityRole={asMenuItem ? 'menuitem' : 'button'}\n {...(selectionProps as object)}\n style={rowStyle}\n testID={testID}\n onPress={handlePress}\n >\n <Text style={textStyle}>{label}</Text>\n {isMarked && isSelected ? (\n <View aria-hidden testID={`${testID}-check`}>\n <Text style={[styles.selectedText, { color: accentColor }]}>{CHECK_GLYPH}</Text>\n </View>\n ) : null}\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. */\nexport function 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 */\n/**\n * Field-wise rect equality. `readAnchorRect` builds a FRESH object every measurement, so an\n * identity check (`Object.is`, React's own bail-out) NEVER matches and every scheduled measurement\n * re-rendered the menu — including the ones that found the anchor exactly where it already was.\n *\n * That is not a performance nicety. `rect` feeds `InlineMenu`'s `popoverStyle` memo, so a new\n * identity rewrites the portalled menu's DOM and re-creates its option rows; and the hook's own\n * `ResizeObserver` observes `document.body`, which the menu is portalled INTO — so a re-render\n * could re-arm the observer that caused it. The loop is self-sustaining: this test harness hits\n * \"Maximum update depth exceeded\", and a real browser instead shows a menu whose box never settles,\n * which is what Playwright reports as \"element is not stable\" and then \"element was detached\".\n * Comparing by VALUE is what breaks the cycle.\n */\nfunction isSameRect(a: AnchorRect | null, b: AnchorRect | null): boolean {\n if (a === null || b === null) return a === b;\n return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;\n}\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 // Value-equal measurement ⇒ no state write, so an unmoved anchor cannot re-render the menu.\n setRect((previous) => (isSameRect(previous, next) ? previous : 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","import { useLayoutEffect, useMemo, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { Platform } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { MENU_MAX_HEIGHT, resolveMenuPlacement, type AnchorRect, type MenuPlacement } from './menuStacking';\nimport { toDomNode } from './useAnchorTracking';\n\nconst IS_WEB = Platform.OS === 'web';\nconst UNMEASURED_RECT: AnchorRect = { top: 0, left: 0, width: 0, bottom: 0 };\n\nfunction readViewportHeight(): number {\n return IS_WEB && typeof window !== 'undefined' ? window.innerHeight : 0;\n}\n\n/** The open menu's vertical placement on web, from its measured height and the current viewport height. */\nexport function useMenuPlacement(\n rect: AnchorRect | null,\n menuRef: RefObject<RNView | null>,\n itemCount: number,\n): MenuPlacement {\n const [menuHeight, setMenuHeight] = useState(MENU_MAX_HEIGHT);\n const [viewportHeight, setViewportHeight] = useState(readViewportHeight);\n\n useLayoutEffect(() => {\n const measured = toDomNode(menuRef)?.offsetHeight ?? 0;\n if (measured > 0) setMenuHeight(measured);\n }, [menuRef, itemCount]);\n\n useLayoutEffect(() => {\n if (!IS_WEB) return undefined;\n const onResize = (): void => setViewportHeight(readViewportHeight());\n window.addEventListener('resize', onResize);\n return () => window.removeEventListener('resize', onResize);\n }, []);\n\n return useMemo(\n () => resolveMenuPlacement(rect ?? UNMEASURED_RECT, viewportHeight, menuHeight),\n [rect, viewportHeight, menuHeight],\n );\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 *\n * MOUNTED IS NOT OPEN. ModalDropdown keeps this component mounted PAST logical close so the exit\n * fade can play (`useEnterExit`'s `mounted`). Anything here keyed on mount therefore outlives the\n * menu by the length of that animation — and {@link useMenuKeyboard} installs a DOCUMENT-CAPTURE\n * keydown listener that `preventDefault()`s Enter/Escape/Arrows. Left keyed on mount, a closing\n * menu swallows the user's next keystroke for the whole exit window: the trigger already reports\n * `aria-expanded=\"false\"`, yet Enter never reaches it and the browser never synthesises the click\n * that would re-open it. `isOpen` is that distinction, threaded down from the owner.\n *\n * The same window had a second, worse half: the options themselves stayed CLICKABLE and\n * SCREEN-READER-VISIBLE for the whole fade. A fast second click could therefore activate an option\n * from a menu the user had already dismissed — on every dropdown in every portal, not just a nav\n * overflow. `isOpen` now also makes the popover inert the instant it goes false: `aria-hidden` on\n * the menu node takes the whole subtree out of the accessibility tree, `pointerEvents: 'none'` on\n * the animated wrapper stops the browser routing a click into it, and `handleSelect` refuses the\n * selection outright — belt and braces, because pointer-events cannot stop a click DISPATCHED at\n * the node (focus-driven activation, assistive tech, a test), and neither attribute is retroactive\n * for an event already in flight. The fade itself is untouched; only its interactivity ends early.\n */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\n\nimport { createPortal } from 'react-dom';\nimport { Animated, Platform, ScrollView, StyleSheet, View } from 'react-native';\nimport type { View as RNView } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\nimport type { UseEnterExitResult } from '@dloizides/ui-motion';\n\nimport type { DropdownOption } from './dropdownTypes';\nimport {\n MENU_BOX_SHADOW,\n MENU_ELEVATION,\n MENU_MAX_HEIGHT,\n MENU_SCROLL_MAX_HEIGHT,\n MENU_TOP_GAP,\n MENU_Z_INDEX,\n buildPortalPopoverStyle,\n menuScrollMaxHeight,\n} from './menuStacking';\nimport { MenuHeading } from './MenuHeading';\nimport { OptionRow } from './OptionRow';\nimport type { SelectedMarker } from './SelectedMarker';\nimport { useAnchorTracking } from './useAnchorTracking';\nimport { useMenuKeyboard } from './useMenuKeyboard';\nimport { useMenuPlacement } from './useMenuPlacement';\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 // The enter/exit fade+scale lives on an INNER wrapper so the outer popover keeps its raw DOM\n // node (the `menuRef` outside-click / keyboard logic and the web portal target depend on it).\n // `transformOrigin: 'top'` makes the scale grow downward FROM the anchor rather than the centre.\n animated: { transformOrigin: 'top', flexShrink: 1 },\n animatedAbove: { transformOrigin: 'bottom' },\n // Exit fade only: the dying popover must not receive the next click. See the file header.\n inert: { pointerEvents: 'none' },\n // Bound the scroll viewport so a list longer than the popover scrolls (with a scrollbar) instead of\n // overflowing the frame — the popover's own maxHeight cannot do this (see MENU_SCROLL_MAX_HEIGHT).\n scroll: { maxHeight: MENU_SCROLL_MAX_HEIGHT },\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 /**\n * The owner's LOGICAL open state — not \"is this component mounted\". Gates the document-capture\n * keyboard listener so a menu that is closing (still mounted for its exit fade) stops claiming\n * keys the moment it is logically closed. See the file header.\n */\n isOpen: boolean;\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 /** Visible heading at the top of the menu; also becomes the menu's accessible name. */\n menuHeading?: string;\n /** Enter/exit fade+scale style from the owner's `useEnterExit`, applied to the inner wrapper. */\n animatedStyle?: UseEnterExitResult['style'];\n selectedMarker?: SelectedMarker;\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 isOpen,\n optionTestID,\n menuMinWidth = 0,\n menuHeading,\n animatedStyle,\n selectedMarker,\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 const placement = useMenuPlacement(rect, menuRef, options.length);\n const opensAbove = placement.bottom !== undefined;\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 // Refuses a selection from a menu that is logically closed but still fading. See the file header.\n const handleSelect = useCallback(\n (optionValue: T) => { if (isOpen) onSelect(optionValue); },\n [isOpen, onSelect],\n );\n\n const selectAt = useCallback(\n (index: number) => {\n const option = options[index];\n if (option !== undefined) handleSelect(option.value);\n },\n [options, handleSelect],\n );\n\n const selectHighlighted = useCallback(\n () => { selectAt(highlightedIndex); },\n [selectAt, highlightedIndex],\n );\n\n useMenuKeyboard({\n containerRef,\n menuRef,\n enabled: isOpen,\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 // Pass the viewport width so a floored menu wider than its trigger is clamped inside the edge\n // rather than spilling off-screen. `rect` is a memo dep and re-measures on scroll/resize, so the\n // width is re-read then too.\n if (IS_WEB) {\n const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : 0;\n return [\n buildPortalPopoverStyle(rect ?? { top: 0, left: 0, width: 0, bottom: 0 }, menuMinWidth, viewportWidth, placement),\n themed,\n ];\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, placement, rect]);\n\n const scrollStyle = IS_WEB ? { maxHeight: menuScrollMaxHeight(placement.maxHeight) } : styles.scroll;\n\n const menu = (\n <View\n ref={menuRef}\n accessibilityRole=\"menu\"\n aria-hidden={!isOpen}\n aria-label={menuHeading ?? accessibilityLabel}\n style={popoverStyle}\n testID={`${testID}-menu`}\n >\n <Animated.View\n pointerEvents={isOpen ? 'auto' : 'none'}\n style={[styles.animated, opensAbove ? styles.animatedAbove : null, animatedStyle, isOpen ? null : styles.inert]}\n >\n {menuHeading !== undefined ? <MenuHeading testID={testID} text={menuHeading} /> : null}\n <ScrollView style={scrollStyle} keyboardShouldPersistTaps=\"handled\">\n {options.map((option, index) => (\n <OptionRow\n key={String(option.value)}\n asMenuItem\n isHighlighted={index === highlightedIndex}\n isSelected={option.value === value}\n label={option.label}\n selectedMarker={selectedMarker}\n testID={\n optionTestID !== undefined ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`\n }\n onSelect={() => handleSelect(option.value)}\n />\n ))}\n </ScrollView>\n </Animated.View>\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 { LAYOUT_COLLAPSE_BREAKPOINT } from '../constants';\nimport { isWideWebViewport } from '../responsive';\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 *\n * Kept as an alias of the kit-wide {@link LAYOUT_COLLAPSE_BREAKPOINT} so existing\n * importers keep compiling; new code should import the shared name.\n */\nexport const MENU_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;\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 return isWideWebViewport(width, platformOS, MENU_BREAKPOINT)\n ? DropdownVariant.Menu\n : 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 { Animated, FlatList, Modal, StyleSheet, Text, TouchableOpacity, View } from 'react-native';\n\nimport { useA11y, MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';\nimport { useUi, MODAL_OVERLAY_COLOR } from '@dloizides/ui-feedback';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { DropdownVariant } from './DropdownVariant';\nimport type { DropdownOption } from './dropdownTypes';\nimport { InlineMenu } from './InlineMenu';\nimport { MenuHeading } from './MenuHeading';\nimport { buildAnchorStackStyle, resolveMenuMinWidth } from './menuStacking';\nimport { OptionRow } from './OptionRow';\nimport type { SelectedMarker } from './SelectedMarker';\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: a `renderTrigger` menu floors at 160, a field keeps its width.\n */\n menuMinWidth?: number;\n /**\n * Show a MENU affordance on the DEFAULT trigger: a caret (▾) pinned to the trailing edge that\n * rotates to point up while the menu is open, and a ≥44dp hit target. Opt-in and OFF by default,\n * so every existing field-style dropdown in the kit renders unchanged; a control that must read\n * as a tappable menu rather than a static chip (the collapsed {@link import('../Tabs/Tabs').Tabs}\n * section switcher) sets it. Ignored when a custom `renderTrigger` is supplied — that caller owns\n * its own visuals, affordance included.\n */\n showCaret?: boolean;\n /**\n * Present the DEFAULT trigger as a HAMBURGER (☰) menu: the universal mobile-nav glyph LEADING the\n * active option's label, with the same bordered field box and ≥44dp hit target. Opt-in and OFF by\n * default. When set it takes precedence over `showCaret` (a hamburger already IS the \"this is a\n * menu\" cue, so the trailing caret is redundant), and — like `showCaret` — it is ignored when a\n * custom `renderTrigger` is supplied. The glyph is a font character (U+2630), so no icon package\n * enters this contract-pure kit, and it is decorative: the trigger's `aria-label` names the\n * control, so screen readers do not announce it.\n */\n showHamburger?: boolean;\n /** Visible, non-focusable heading at the top of the open menu; it also names the menu. */\n menuHeading?: string;\n /** How the selected option is marked; `AccentCheck` = accent left bar + check. */\n selectedMarker?: SelectedMarker;\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/** WCAG 2.5.5 minimum target size — the caret trigger must be comfortably tappable on a phone. */\nconst MIN_TOUCH_TARGET = 44;\nconst CARET_FONT_SIZE = 12;\n/** Gap between the label and the trailing caret (also the gap after the leading hamburger). */\nconst CARET_GAP = 8;\n/** ▾ (U+25BE) — a font glyph, so no icon package is imported into this contract-pure kit. */\nconst CARET_GLYPH = '▾';\n/** ☰ (U+2630) — the hamburger menu glyph, likewise a font character (no icon package). */\nconst HAMBURGER_GLYPH = '☰';\n/** The hamburger reads as an icon, so it sits a touch larger than the body label. */\nconst HAMBURGER_FONT_SIZE = 18;\n/** Caret points up while the menu is open, down while closed. */\nconst CARET_OPEN_ROTATION = '180deg';\nconst CARET_CLOSED_ROTATION = '0deg';\n/** The open popover fades + scales in from just under its natural size (subtle, anchor-origin). */\nconst POPOVER_ENTER_SCALE = 0.96;\n/** A snappy popover duration — the open eases in, the close reads as near-instant. */\nconst POPOVER_MOTION_MS = 120;\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 // Match the shared control height used by @dloizides/ui-forms inputs (same MIN_TOUCH_TARGET_PX\n // floor from @dloizides/a11y), so a select trigger and a text/typeahead field sitting side by\n // side in a filter bar are exactly the same height. Centre the label within that floor.\n minHeight: MIN_TOUCH_TARGET_PX,\n justifyContent: 'center',\n },\n // Caret variant: a row with the label leading and the caret pinned to the trailing edge, at a\n // phone-friendly minimum height. Only applied when `showCaret` is set, so field dropdowns are\n // untouched.\n containerMenu: {\n minHeight: MIN_TOUCH_TARGET,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'space-between',\n columnGap: CARET_GAP,\n },\n // Hamburger variant: the ☰ glyph LEADS the label (icon-first, like a phone nav button), so the\n // row packs to the start rather than pushing a trailing caret to the far edge. Same tap target.\n containerHamburger: {\n minHeight: MIN_TOUCH_TARGET,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-start',\n columnGap: CARET_GAP,\n },\n selectedText: { fontSize: BODY_FONT_SIZE },\n // The label may shrink/ellipsize; the caret / hamburger glyph never does.\n selectedTextMenu: { flexShrink: 1 },\n caret: { fontSize: CARET_FONT_SIZE, flexShrink: 0 },\n hamburger: { fontSize: HAMBURGER_FONT_SIZE, flexShrink: 0 },\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 showCaret = false,\n showHamburger = false,\n menuHeading,\n selectedMarker,\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 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 triggerRef = useRef<View>(null);\n const popupProps = { 'aria-haspopup': isMenu ? 'menu' : 'dialog' } as object;\n const dialogRef = useRef<View>(null);\n useFocusTrap(dialogRef, isOpen && !isMenu);\n\n // The popover (inline menu on web-desktop, centered modal on mobile/native) fades + scales in\n // on open and reverses on close. `mounted` keeps the node in the tree through the exit fade —\n // without it the popover would snap out (the RN `Modal` `animationType` is a no-op on web).\n // Under reduced-motion the enter/exit collapse to instant, so the close reads as immediate.\n const menuAnim = useEnterExit({\n visible: isMenu && isOpen,\n fromScale: POPOVER_ENTER_SCALE,\n duration: POPOVER_MOTION_MS,\n });\n const modalAnim = useEnterExit({\n visible: !isMenu && isOpen,\n fromScale: POPOVER_ENTER_SCALE,\n duration: POPOVER_MOTION_MS,\n });\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 triggerRef.current?.focus();\n },\n [onChange],\n );\n\n // The hamburger is the stronger affordance, so it wins when both are set: a ☰ trigger has no\n // reason to also carry a trailing caret.\n const isHamburger = showHamburger;\n const isCaret = showCaret && !isHamburger;\n\n // A custom trigger owns its own visuals, so the default bordered field box stands down. Otherwise\n // the bordered field box renders, gaining the menu row layout + ≥44dp tap target when either the\n // caret or the hamburger affordance is on.\n const containerStyle = useMemo(\n () =>\n renderTrigger !== undefined\n ? undefined\n : [\n styles.container,\n isHamburger ? styles.containerHamburger : isCaret ? styles.containerMenu : null,\n { borderColor: colors.border, backgroundColor: colors.surface },\n ],\n [colors.border, colors.surface, renderTrigger, isHamburger, isCaret],\n );\n const hamburgerStyle = useMemo(\n () => [styles.hamburger, { color: colors.textSecondary }],\n [colors.textSecondary],\n );\n const caretStyle = useMemo(\n () => [\n styles.caret,\n { color: colors.textSecondary, transform: [{ rotate: isOpen ? CARET_OPEN_ROTATION : CARET_CLOSED_ROTATION }] },\n ],\n [colors.textSecondary, isOpen],\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 selectedMarker={selectedMarker}\n testID={optionTestIDFor(item.value)}\n onSelect={() => handleSelect(item.value)}\n />\n ),\n [handleSelect, optionTestIDFor, selectedMarker, value],\n );\n const keyExtractor = useCallback((item: DropdownOption<T>) => String(item.value), []);\n\n return (\n <View ref={anchorRef} style={anchorStyle}>\n <TouchableOpacity {...a11yProps} {...popupProps} ref={triggerRef} style={containerStyle} onPress={handleToggle}>\n {renderTrigger !== undefined ? (\n renderTrigger({ label: selectedLabel, isOpen })\n ) : isHamburger ? (\n <>\n <Text style={hamburgerStyle}>{HAMBURGER_GLYPH}</Text>\n <Text numberOfLines={1} style={[styles.selectedText, styles.selectedTextMenu, { color: colors.text }]}>\n {selectedLabel}\n </Text>\n </>\n ) : isCaret ? (\n <>\n <Text numberOfLines={1} style={[styles.selectedText, styles.selectedTextMenu, { color: colors.text }]}>\n {selectedLabel}\n </Text>\n {/* Decorative: the trigger's aria-label already names the control, so screen readers\n ignore this glyph. It exists to make the control read as a menu, not a chip. */}\n <Text style={caretStyle}>{CARET_GLYPH}</Text>\n </>\n ) : (\n <Text style={[styles.selectedText, { color: colors.text }]}>{selectedLabel}</Text>\n )}\n {hintNode}\n </TouchableOpacity>\n\n {isMenu && menuAnim.mounted ? (\n <InlineMenu\n accessibilityLabel={accessibilityLabel}\n animatedStyle={menuAnim.style}\n containerRef={anchorRef}\n isOpen={isOpen}\n menuHeading={menuHeading}\n menuMinWidth={resolveMenuMinWidth(menuMinWidth, renderTrigger !== undefined)}\n optionTestID={optionTestIDFor}\n options={options}\n selectedMarker={selectedMarker}\n testID={testID}\n value={value}\n onClose={handleClose}\n onSelect={handleSelect}\n />\n ) : null}\n\n {!isMenu ? (\n <Modal transparent visible={modalAnim.mounted} 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 <Animated.View\n ref={dialogRef}\n accessibilityViewIsModal\n aria-label={menuHeading ?? accessibilityLabel}\n role=\"dialog\"\n style={[modalContentStyle, modalAnim.style]}\n >\n <FlatList\n data={[...options]}\n keyExtractor={keyExtractor}\n ListHeaderComponent={menuHeading !== undefined ? <MenuHeading testID={testID} text={menuHeading} /> : null}\n renderItem={renderModalOption}\n />\n </Animated.View>\n </View>\n </Modal>\n ) : null}\n </View>\n );\n};\n\nexport default ModalDropdown;\n","/**\n * TabsMenu — the COLLAPSED (mobile) form of {@link Tabs}.\n *\n * Below the collapse breakpoint the horizontal tab strip becomes a genuine menu:\n * a single trigger button that shows the active section's label and opens a\n * vertical list of every section. It is a thin adapter over the kit's existing\n * {@link ModalDropdown} select primitive, so it inherits the menu/listbox\n * semantics, the focus trap, the dismiss backdrop and the dual-platform a11y\n * contract for free — no new dropdown behaviour is reimplemented here.\n *\n * By default it opts into `ModalDropdown`'s `showCaret` so the trigger reads\n * unmistakably as a section SWITCHER — a bordered field with a rotating ▾ caret and\n * a ≥44dp tap target — rather than a static chip that gives no hint it is tappable.\n * That was the live defect on the collapsed organizer nav: the trigger looked like a\n * pill. A consumer can instead pass `collapsedTrigger={TabsCollapsedTrigger.Hamburger}`\n * to present the universal ☰ mobile-nav glyph (leading the active label); the opened\n * list, the a11y contract and the testIDs are identical either way.\n *\n * E2E survival: each option row's `testID` is the tab descriptor's own `testID`\n * when supplied, otherwise the `{idPrefix}-tab-{key}` pattern the wide strip uses\n * for its tab element ids — so a selector that targets a tab keeps resolving the\n * same tab in the collapsed menu (the menu must be opened first, as with any\n * select).\n */\nimport React, { useCallback, useMemo } from 'react';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport type { TabDescriptor } from './Tabs';\nimport { TabsCollapsedTrigger } from './TabsCollapsedTrigger';\nimport { LAYOUT_I18N } from '../constants';\nimport type { DropdownOption } from '../ModalDropdown/dropdownTypes';\nimport { ModalDropdown } from '../ModalDropdown/ModalDropdown';\n\nexport interface TabsMenuProps {\n /** The tabs to list, in order. */\n tabs: ReadonlyArray<TabDescriptor>;\n /** The currently-active tab `key` — shown on the trigger and marked selected. */\n activeKey: string;\n /** Fired with a tab's `key` when its menu row is chosen. */\n onChange: (key: string) => void;\n /** Accessible name for the menu (the tablist's name in collapsed form). */\n accessibilityLabel: string;\n /** Prefix used to derive per-option testIDs when a descriptor supplies none. */\n idPrefix: string;\n /** testID for the menu trigger. */\n testID: string;\n /**\n * How the collapsed trigger presents — a caret field (default) or a ☰ hamburger.\n * See {@link TabsCollapsedTrigger}. Defaults to `Caret` so existing consumers are\n * unchanged.\n */\n collapsedTrigger?: TabsCollapsedTrigger;\n}\n\n/** The collapsed tab menu. Renders the kit's `ModalDropdown` seeded from the tabs. */\nexport const TabsMenu = ({\n tabs,\n activeKey,\n onChange,\n accessibilityLabel,\n idPrefix,\n testID,\n collapsedTrigger = TabsCollapsedTrigger.Caret,\n}: TabsMenuProps): React.ReactElement => {\n const { t } = useUi();\n\n const options = useMemo<ReadonlyArray<DropdownOption<string>>>(\n () => tabs.map((tab) => ({ label: tab.label, value: tab.key })),\n [tabs],\n );\n\n const optionTestID = useCallback(\n (key: string): string => {\n const found = tabs.find((tab) => tab.key === key);\n return found?.testID ?? `${idPrefix}-tab-${key}`;\n },\n [tabs, idPrefix],\n );\n\n const isHamburger = collapsedTrigger === TabsCollapsedTrigger.Hamburger;\n\n return (\n <ModalDropdown\n accessibilityHint={t(LAYOUT_I18N.tabsMenuHint)}\n accessibilityLabel={accessibilityLabel}\n optionTestID={optionTestID}\n options={options}\n showCaret={!isHamburger}\n showHamburger={isHamburger}\n testID={testID}\n value={activeKey}\n onChange={onChange}\n />\n );\n};\n\nexport default TabsMenu;\n","/**\r\n * Responsive collapse decision for {@link Tabs}.\r\n *\r\n * The tab row is a full desktop affordance; on a phone a horizontally-scrolling\r\n * chip strip is hard to use (\"not a real menu, not mobile friendly\"). BELOW a\r\n * breakpoint the strip collapses to a genuine menu (a button showing the active\r\n * tab that opens a vertical list). The threshold reuses the SAME viewport rule\r\n * the kit already uses to decide `ModalDropdown`'s menu-vs-modal split, so the\r\n * whole layout kit changes shape at one consistent breakpoint.\r\n *\r\n * `shouldCollapseTabs` is a pure function (trivially unit-testable with a mocked\r\n * width); `useTabsCollapsed` is the thin hook that feeds it the live viewport\r\n * width + platform.\r\n */\r\nimport { Platform, useWindowDimensions } from 'react-native';\r\n\r\nimport { LAYOUT_COLLAPSE_BREAKPOINT } from '../constants';\r\nimport { isWideWebViewport } from '../responsive';\r\n\r\n/**\r\n * Default collapse threshold — the shared kit breakpoint. At or above this\r\n * viewport width (web only) `Tabs` stays a row; below it — or on any native\r\n * platform — it collapses to the menu.\r\n */\r\nexport const TABS_COLLAPSE_BREAKPOINT = LAYOUT_COLLAPSE_BREAKPOINT;\r\n\r\n/**\r\n * Pure resolver: collapse to the menu unless we are on a WIDE WEB viewport. On\r\n * native (any width) the tabs always collapse — a native app is a phone/tablet\r\n * surface, never a desktop tab bar.\r\n */\r\nexport function shouldCollapseTabs(\r\n width: number,\r\n platformOS: string,\r\n breakpoint: number,\r\n): boolean {\r\n return !isWideWebViewport(width, platformOS, breakpoint);\r\n}\r\n\r\n/** Hook wrapper that reads the live viewport width + platform and resolves collapse. */\r\nexport function useTabsCollapsed(breakpoint: number): boolean {\r\n const { width } = useWindowDimensions();\r\n return shouldCollapseTabs(width, Platform.OS, breakpoint);\r\n}\r\n","/**\n * Tabs — a named-section shell for a long dashboard. On WIDE viewports it is a\n * horizontal strip of pill tabs (a single scrollable `nowrap` row) plus the\n * active tab's panel. BELOW the collapse breakpoint it becomes a genuine mobile\n * MENU — a button showing the active section that opens a vertical list of all\n * sections — because a scrolling chip strip \"is not a real menu and not mobile\n * friendly\" on a phone. The active panel renders identically in both modes.\n *\n * It is deliberately CONTROLLED — the host owns `activeKey` and `onChange`, so\n * the selected tab can be driven from a route param, restored from storage, or\n * changed programmatically. The active panel is passed as `children`.\n *\n * A11y: WIDE mode keeps `role=tablist` / `role=tab` with `aria-selected` and the\n * `aria-controls` / `aria-labelledby` tab⇄panel wiring. COLLAPSED mode delegates\n * to {@link ModalDropdown}'s menu/listbox semantics (a `role=button` trigger that\n * opens a selectable list). The rendered panel is `aria-labelledby` the active\n * tab id in BOTH modes.\n *\n * Contract discipline (same as the rest of `@dloizides/ui-layout`): NO FM /\n * router / store / icon imports. `label`s are pre-localized strings supplied by\n * the caller; every colour is read from the `@dloizides/ui-feedback` UiProvider\n * theme, so the shell re-skins on tenant swap.\n */\nimport React from 'react';\n\nimport {\n Pressable,\n ScrollView,\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\nimport { MIN_TARGET_PX } from '../constants';\nimport { TabsCollapsedTrigger } from './TabsCollapsedTrigger';\nimport { TabsMenu } from './TabsMenu';\nimport { TABS_COLLAPSE_BREAKPOINT, useTabsCollapsed } from './tabsResponsive';\n\nconst PILL_RADIUS = 999;\nconst PILL_PAD_H = 16;\nconst PILL_PAD_V = 8;\nconst PILL_MIN_HEIGHT = MIN_TARGET_PX;\nconst PILL_FONT = 14;\nconst PILL_WEIGHT = '600';\nconst ROW_GAP = 8;\nconst COLUMN_GAP = 8;\nconst ROW_PAD_V = 8;\nconst PANEL_PAD_TOP = 16;\nconst BORDER_WIDTH = 1;\n\n/** Ink for a pill sitting on the accent (active) background — full-contrast white. */\nconst TEXT_ON_PRIMARY = '#ffffff';\n\nconst styles = StyleSheet.create({\n root: {\n width: '100%',\n },\n // The full-width rule under the row lives here (not on the strip) so it spans the\n // whole width even when the tabs are narrower than the viewport (desktop) and is\n // not clipped to the scroll content width.\n stripOuter: {\n width: '100%',\n borderBottomWidth: BORDER_WIDTH,\n },\n strip: {\n flexDirection: 'row',\n flexWrap: 'nowrap',\n alignItems: 'center',\n columnGap: COLUMN_GAP,\n rowGap: ROW_GAP,\n paddingVertical: ROW_PAD_V,\n },\n pill: {\n // Keep each pill at its natural size so the row scrolls instead of squashing\n // the tabs when they don't all fit.\n flexShrink: 0,\n paddingHorizontal: PILL_PAD_H,\n paddingVertical: PILL_PAD_V,\n borderRadius: PILL_RADIUS,\n minHeight: PILL_MIN_HEIGHT,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n },\n pillText: {\n fontSize: PILL_FONT,\n fontWeight: PILL_WEIGHT,\n textAlign: 'center',\n },\n panel: {\n paddingTop: PANEL_PAD_TOP,\n },\n});\n\n/**\n * `aria-selected` marks the active tab for assistive tech, and `aria-controls` /\n * `id` / `aria-labelledby` link a tab to its panel. react-native's prop types\n * omit these, but react-native-web forwards `aria-*` / `id` to the DOM — so we\n * attach them (no `any`) rather than rely on `accessibilityState` alone.\n */\ntype AriaTabProps = PressableProps & {\n 'aria-selected': boolean;\n 'aria-controls': string;\n id: string;\n};\n\nfunction ariaTabProps(selected: boolean, panelId: string, tabId: string): AriaTabProps {\n return { 'aria-selected': selected, 'aria-controls': panelId, id: tabId };\n}\n\n/** `id` + `aria-labelledby` link the tabpanel back to its controlling tab. */\ninterface AriaPanelProps {\n 'aria-labelledby': string;\n id: string;\n}\n\n/** One tab in the strip. `key` is what `onChange` emits and what selects the panel. */\nexport interface TabDescriptor {\n /** Stable identity — emitted by `onChange`, compared against `activeKey`. */\n key: string;\n /** Pre-localized, human-readable tab label. */\n label: string;\n testID?: string;\n /** Accessible name; defaults to `label`. */\n accessibilityLabel?: string;\n /** Accessible hint announced after the label. */\n accessibilityHint?: string;\n}\n\nexport interface TabsProps {\n /** The tabs, left → right. */\n tabs: ReadonlyArray<TabDescriptor>;\n /** The currently-active tab `key`. */\n activeKey: string;\n /** Fired with a tab's `key` when it is pressed (wide) or chosen (collapsed). */\n onChange: (key: string) => void;\n /** Accessible name for the whole tablist / collapsed menu. */\n accessibilityLabel: string;\n /** The panel content for the active tab. */\n children?: React.ReactNode;\n /** Prefix for the generated tab / panel element ids (must be unique per Tabs on a page). */\n idPrefix?: string;\n /**\n * Viewport width (dp) at/above which the tabs stay a horizontal ROW; below it\n * (or on native) they collapse to the mobile menu. Defaults to the shared kit\n * breakpoint ({@link TABS_COLLAPSE_BREAKPOINT}, 768). Pass a large number to\n * force the menu, or `0` to keep the row on any web width.\n */\n collapseBelow?: number;\n /**\n * How the COLLAPSED (mobile) menu trigger presents — a caret field (default) or a\n * ☰ hamburger. See {@link TabsCollapsedTrigger}. Defaults to `Caret`, so existing\n * consumers are unchanged; a phone-first nav opts into `Hamburger`. Only affects the\n * collapsed form — the wide pill strip is identical either way.\n */\n collapsedTrigger?: TabsCollapsedTrigger;\n /** Style override merged onto the root container. */\n style?: StyleProp<ViewStyle>;\n /** Style override merged onto the tab strip (wide mode only). */\n stripStyle?: StyleProp<ViewStyle>;\n /** Style override merged onto the panel wrapper. */\n panelStyle?: StyleProp<ViewStyle>;\n testID?: string;\n}\n\ninterface WideTabStripProps {\n tabs: ReadonlyArray<TabDescriptor>;\n activeKey: string;\n onChange: (key: string) => void;\n accessibilityLabel: string;\n idPrefix: string;\n borderColor: string;\n primaryColor: string;\n textSecondary: string;\n surfaceElevated: string;\n stripStyle?: StyleProp<ViewStyle>;\n}\n\n/** The wide, horizontally-scrollable pill row. Unchanged desktop behaviour. */\nconst WideTabStrip = ({\n tabs,\n activeKey,\n onChange,\n accessibilityLabel,\n idPrefix,\n borderColor,\n primaryColor,\n textSecondary,\n surfaceElevated,\n stripStyle,\n}: WideTabStripProps): React.ReactElement => (\n <View style={[styles.stripOuter, { borderBottomColor: borderColor }]}>\n <ScrollView horizontal showsHorizontalScrollIndicator={false}>\n <View accessibilityRole=\"tablist\" aria-label={accessibilityLabel} style={[styles.strip, stripStyle]}>\n {tabs.map((tab) => {\n const selected = tab.key === activeKey;\n const textColor = selected ? TEXT_ON_PRIMARY : textSecondary;\n const pillColor = selected ? primaryColor : surfaceElevated;\n const tabId = `${idPrefix}-tab-${tab.key}`;\n const panelId = `${idPrefix}-panel-${tab.key}`;\n return (\n <Pressable\n key={tab.key}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected }}\n accessibilityLabel={tab.accessibilityLabel ?? tab.label}\n accessibilityHint={tab.accessibilityHint}\n onPress={() => onChange(tab.key)}\n style={[styles.pill, { backgroundColor: pillColor }]}\n testID={tab.testID}\n {...ariaTabProps(selected, panelId, tabId)}\n >\n <Text style={[styles.pillText, { color: textColor }]}>{tab.label}</Text>\n </Pressable>\n );\n })}\n </View>\n </ScrollView>\n </View>\n);\n\n/**\n * A controlled tabbed section shell. Renders the active tab's panel plus either\n * the wide pill strip or — below `collapseBelow` — the mobile menu. Generic-free\n * by design: tab identity is a plain string `key`.\n */\nexport const Tabs = ({\n tabs,\n activeKey,\n onChange,\n accessibilityLabel,\n children,\n idPrefix = 'tabs',\n collapseBelow = TABS_COLLAPSE_BREAKPOINT,\n collapsedTrigger = TabsCollapsedTrigger.Caret,\n style,\n stripStyle,\n panelStyle,\n testID,\n}: TabsProps): React.ReactElement => {\n const { theme } = useUi();\n const { colors } = theme;\n const collapsed = useTabsCollapsed(collapseBelow);\n\n const activePanelId = `${idPrefix}-panel-${activeKey}`;\n const activeTabId = `${idPrefix}-tab-${activeKey}`;\n const panelAria: AriaPanelProps = { 'aria-labelledby': activeTabId, id: activePanelId };\n\n return (\n <View style={[styles.root, style]} testID={testID}>\n {collapsed ? (\n <TabsMenu\n accessibilityLabel={accessibilityLabel}\n activeKey={activeKey}\n collapsedTrigger={collapsedTrigger}\n idPrefix={idPrefix}\n tabs={tabs}\n testID={`${idPrefix}-menu`}\n onChange={onChange}\n />\n ) : (\n <WideTabStrip\n accessibilityLabel={accessibilityLabel}\n activeKey={activeKey}\n borderColor={colors.border}\n idPrefix={idPrefix}\n primaryColor={theme.palette.primary['500']}\n stripStyle={stripStyle}\n surfaceElevated={colors.surfaceElevated}\n tabs={tabs}\n textSecondary={colors.textSecondary}\n onChange={onChange}\n />\n )}\n <View accessibilityRole=\"none\" style={[styles.panel, panelStyle]} {...panelAria}>\n {children}\n </View>\n </View>\n );\n};\n\nexport default Tabs;\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, MIN_TARGET_PX } 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: {\n minHeight: MIN_TARGET_PX,\n paddingVertical: BUTTON_PADDING_V,\n borderRadius: BUTTON_BORDER_RADIUS,\n alignItems: 'center',\n justifyContent: 'center',\n marginBottom: CTA_MARGIN_BOTTOM,\n },\n ctaText: { fontSize: BUTTON_FONT_SIZE, fontWeight: '700' },\n dismiss: { minHeight: MIN_TARGET_PX, alignItems: 'center', justifyContent: '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 * 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 { Animated, Modal, ScrollView, StyleSheet, TouchableOpacity, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';\nimport { useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { Heading } from '../Heading/Heading';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst CLOSE_ICON_SIZE = 18;\n/** The sheet enters scaled slightly down (and fades in), settling to its natural size. */\nconst PANEL_ENTER_SCALE = 0.96;\n\nconst styles = StyleSheet.create({\n animatedFill: { flex: 1 },\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 minWidth: MIN_TOUCH_TARGET_PX,\n minHeight: MIN_TOUCH_TARGET_PX,\n alignItems: 'center',\n justifyContent: 'center',\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 // The sheet fades + scales in on open and reverses on close; `mounted` keeps the RN `Modal`\n // host in the tree through the exit fade, replacing the native-only `animationType=\"slide\"`\n // (a no-op on react-native-web, where the sheet used to snap).\n const { style: sheetStyle, mounted } = useEnterExit({ visible, fromScale: PANEL_ENTER_SCALE });\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 transparent\n testID={LAYOUT_TEST_IDS.modalShell}\n visible={mounted}\n onRequestClose={onCancel}\n >\n <Animated.View style={[styles.animatedFill, sheetStyle]}>\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 </Animated.View>\n </Modal>\n );\n};\n\nexport default ModalShell;\n","import React, { useRef } from 'react';\n\nimport { Animated, Modal as RNModal, Pressable, ScrollView, StyleSheet, View } from 'react-native';\n\nimport { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { AppText } from '../AppText/AppText';\nimport { TextKind } from '../AppText/TextKind';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS, MIN_TARGET_PX } from '../constants';\nimport { useEscapeKey } from '../hooks/useEscapeKey';\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { useIsWideViewport } from '../hooks/useIsWideViewport';\nimport { useScrollLock } from '../hooks/useScrollLock';\n\nconst SHEET_WIDTH = 560;\nconst PHONE_CORNER = 16;\nconst PHONE_ENTER_OFFSET = 24;\n\nconst styles = StyleSheet.create({\n root: { flex: 1 },\n scrim: { backgroundColor: MODAL_OVERLAY_COLOR, pointerEvents: 'none' },\n sheet: { position: 'absolute', bottom: 0, overflow: 'hidden' },\n wide: { top: 0, right: 0, width: SHEET_WIDTH, maxWidth: '100%', borderLeftWidth: 1 },\n phone: {\n top: MIN_TARGET_PX,\n left: 0,\n right: 0,\n borderTopLeftRadius: PHONE_CORNER,\n borderTopRightRadius: PHONE_CORNER,\n },\n title: { paddingHorizontal: 16, paddingTop: 16 },\n scroll: { flex: 1 },\n content: { padding: 16, gap: 12 },\n bar: { flexDirection: 'row', justifyContent: 'flex-end', gap: 8, padding: 16, borderTopWidth: 1 },\n});\n\nexport interface SideSheetProps {\n visible: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n footer: React.ReactNode;\n testID?: string;\n accessibilityLabel?: string;\n initialFocusTestID?: string;\n}\n\n/** A panel over the screen: from the bottom on a phone, from the right on a computer. */\nexport const SideSheet = ({\n visible,\n onClose,\n title,\n children,\n footer,\n testID = LAYOUT_TEST_IDS.sideSheet,\n accessibilityLabel,\n initialFocusTestID,\n}: SideSheetProps): React.ReactElement => {\n const { theme, t } = useUi();\n const isWide = useIsWideViewport();\n const sheetRef = useRef<View>(null);\n const backdrop = useEnterExit({ visible });\n const panel = useEnterExit({ visible, translateY: isWide ? 0 : PHONE_ENTER_OFFSET });\n const edges = { borderColor: theme.colors.border };\n\n useFocusTrap(sheetRef, visible && panel.mounted, initialFocusTestID);\n useEscapeKey(visible, onClose);\n useScrollLock(visible);\n\n return (\n <RNModal transparent visible={panel.mounted || backdrop.mounted} onRequestClose={onClose}>\n <View style={styles.root}>\n <Animated.View style={[StyleSheet.absoluteFill, styles.scrim, { opacity: backdrop.style.opacity }]} />\n <Pressable\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={t(LAYOUT_I18N.dialogClose)}\n accessibilityRole=\"button\"\n style={StyleSheet.absoluteFill}\n testID={`${testID}-scrim`}\n onPress={onClose}\n />\n <Animated.View\n ref={sheetRef}\n accessibilityViewIsModal\n aria-modal\n aria-label={accessibilityLabel ?? title}\n role=\"dialog\"\n style={[\n styles.sheet,\n isWide ? styles.wide : styles.phone,\n edges,\n { backgroundColor: theme.colors.surface },\n panel.style,\n ]}\n testID={testID}\n >\n <View style={styles.title}>\n <AppText kind={TextKind.Title}>{title}</AppText>\n </View>\n <ScrollView contentContainerStyle={styles.content} style={styles.scroll}>\n {children}\n </ScrollView>\n <View style={[styles.bar, edges]}>{footer}</View>\n </Animated.View>\n </View>\n </RNModal>\n );\n};\n","import React, { useRef } from 'react';\n\nimport { Animated, Platform, Modal as RNModal, Pressable, ScrollView, StyleSheet, TouchableOpacity, View } from 'react-native';\n\nimport { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';\nimport { MODAL_OVERLAY_COLOR, useUi } from '@dloizides/ui-feedback';\nimport { SvgIcon } from '@dloizides/ui-icons';\nimport { useEnterExit } from '@dloizides/ui-motion';\n\nimport { AppText } from '../AppText/AppText';\nimport { TextKind } from '../AppText/TextKind';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport { useEscapeKey } from '../hooks/useEscapeKey';\nimport { useFocusTrap } from '../hooks/useFocusTrap';\nimport { useIsWideViewport } from '../hooks/useIsWideViewport';\nimport { useScrollLock } from '../hooks/useScrollLock';\n\nconst DEFAULT_MAX_HEIGHT_FRACTION = 0.92;\nconst PERCENT = 100;\nconst WIDE_MAX_WIDTH = 560;\nconst TOP_CORNER = 16;\nconst ENTER_OFFSET = 24;\nconst CLOSE_ICON_SIZE = 18;\n\nconst styles = StyleSheet.create({\n root: { flex: 1 },\n backdrop: { backgroundColor: MODAL_OVERLAY_COLOR, pointerEvents: 'none' },\n panel: {\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n overflow: 'hidden',\n borderTopLeftRadius: TOP_CORNER,\n borderTopRightRadius: TOP_CORNER,\n },\n wide: { maxWidth: WIDE_MAX_WIDTH, marginHorizontal: 'auto' },\n header: { flexDirection: 'row', alignItems: 'center', gap: 8, paddingLeft: 16, paddingRight: 8, paddingTop: 8 },\n title: { flex: 1 },\n close: { minWidth: MIN_TOUCH_TARGET_PX, minHeight: MIN_TOUCH_TARGET_PX, alignItems: 'center', justifyContent: 'center' },\n body: { flexGrow: 0, flexShrink: 1 },\n content: { padding: 16, gap: 12 },\n footer: { padding: 16, borderTopWidth: 1 },\n});\n\nexport interface BottomSheetProps {\n visible: boolean;\n onClose: () => void;\n title: string;\n children: React.ReactNode;\n footer?: React.ReactNode;\n maxHeightFraction?: number;\n testID?: string;\n accessibilityLabel?: string;\n initialFocusTestID?: string;\n}\n\n/** A content-height panel docked to the screen bottom, with a dimmed backdrop and an optional pinned footer. */\nexport const BottomSheet = ({\n visible,\n onClose,\n title,\n children,\n footer,\n maxHeightFraction = DEFAULT_MAX_HEIGHT_FRACTION,\n testID = LAYOUT_TEST_IDS.bottomSheet,\n accessibilityLabel,\n initialFocusTestID,\n}: BottomSheetProps): React.ReactElement => {\n const { theme, t } = useUi();\n const isWide = useIsWideViewport();\n const panelRef = useRef<View>(null);\n const backdrop = useEnterExit({ visible });\n const panel = useEnterExit({ visible, translateY: ENTER_OFFSET });\n const hasFooter = footer !== undefined && footer !== null;\n const panelSize = { maxHeight: `${maxHeightFraction * PERCENT}%` as const };\n\n useFocusTrap(panelRef, visible && panel.mounted, initialFocusTestID);\n useEscapeKey(visible, onClose);\n useScrollLock(visible);\n\n const hardwareBackClose = Platform.OS === 'web' ? undefined : onClose;\n\n return (\n <RNModal transparent visible={panel.mounted || backdrop.mounted} onRequestClose={hardwareBackClose}>\n <View style={styles.root}>\n <Animated.View style={[StyleSheet.absoluteFill, styles.backdrop, { opacity: backdrop.style.opacity }]} />\n <Pressable\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={t(LAYOUT_I18N.dialogClose)}\n accessibilityRole=\"button\"\n style={StyleSheet.absoluteFill}\n testID={`${testID}-backdrop`}\n onPress={onClose}\n />\n <Animated.View\n ref={panelRef}\n accessibilityViewIsModal\n aria-modal\n aria-label={accessibilityLabel ?? title}\n role=\"dialog\"\n style={[\n styles.panel,\n isWide ? styles.wide : null,\n panelSize,\n { backgroundColor: theme.colors.surface },\n panel.style,\n ]}\n testID={testID}\n >\n <View style={styles.header}>\n <View style={styles.title}>\n <AppText kind={TextKind.Title}>{title}</AppText>\n </View>\n <TouchableOpacity\n accessibilityHint={t(LAYOUT_I18N.closeDialogHint)}\n accessibilityLabel={t(LAYOUT_I18N.dialogClose)}\n accessibilityRole=\"button\"\n style={styles.close}\n testID={`${testID}-close`}\n onPress={onClose}\n >\n <SvgIcon color={theme.colors.textSecondary} name=\"close\" size={CLOSE_ICON_SIZE} />\n </TouchableOpacity>\n </View>\n <ScrollView contentContainerStyle={styles.content} style={styles.body}>\n {children}\n </ScrollView>\n {hasFooter ? (\n <View style={[styles.footer, { borderColor: theme.colors.border }]} testID={`${testID}-footer`}>\n {footer}\n </View>\n ) : null}\n </Animated.View>\n </View>\n </RNModal>\n );\n};\n","/**\n * ConfirmDialog — a confirm/cancel popup built ON {@link Modal}, for the \"are you sure?\" moment.\n *\n * Replaces per-app inline confirms (e.g. kefi-web's inline attendee-delete row) with one shared,\n * themed dialog reused across every portal. Renders the `message` in the body and a Cancel + Confirm\n * button row (from `@dloizides/ui-buttons`) in the footer. When `destructive` is set the Confirm\n * button uses the `danger` variant — the red, irreversible-action treatment.\n *\n * SAFE BY DEFAULT: Cancel is FIRST in the DOM, so the web focus trap lands on it — a keyboard user\n * never has a destructive Confirm pre-focused. Cancel, the backdrop, and Escape all call `onCancel`;\n * the ✕ is hidden (the explicit Cancel is the dismiss affordance). While `busy`, Confirm shows its\n * spinner and Cancel is disabled, so a slow delete cannot be fired twice or cancelled mid-flight.\n */\nimport React from 'react';\n\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport { Button } from '@dloizides/ui-buttons';\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { Modal } from './Modal';\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\n\nconst MESSAGE_FONT_SIZE = 14;\nconst MESSAGE_LINE_HEIGHT = 20;\nconst BUTTON_GAP = 12;\n\nconst styles = StyleSheet.create({\n message: { fontSize: MESSAGE_FONT_SIZE, lineHeight: MESSAGE_LINE_HEIGHT },\n footer: { flexDirection: 'row', justifyContent: 'flex-end', columnGap: BUTTON_GAP },\n});\n\nexport interface ConfirmDialogProps {\n /** Whether the dialog is shown. */\n visible: boolean;\n /** Header title, e.g. \"Remove attendee?\". */\n title: string;\n /** Body copy, e.g. \"This can't be undone.\" */\n message: string;\n /** Confirm button label. Defaults to the host's `common.confirm` translation. */\n confirmLabel?: string;\n /** Cancel button label. Defaults to the host's `common.cancel` translation. */\n cancelLabel?: string;\n /** Red `danger` Confirm for an irreversible action. Default `false` (blue `primary`). */\n destructive?: boolean;\n /** Called when the user presses Confirm. */\n onConfirm: () => void;\n /** Called by Cancel, the backdrop, and Escape. */\n onCancel: () => void;\n /** In-flight: Confirm shows a spinner and Cancel is disabled. Default `false`. */\n busy?: boolean;\n /** Base testID. Default `confirm-dialog`. Confirm is `${testID}-confirm`, Cancel `${testID}-cancel`. */\n testID?: string;\n}\n\nexport const ConfirmDialog = ({\n visible,\n title,\n message,\n confirmLabel,\n cancelLabel,\n destructive = false,\n onConfirm,\n onCancel,\n busy = false,\n testID = LAYOUT_TEST_IDS.confirmDialog,\n}: ConfirmDialogProps): React.ReactElement => {\n const { theme, t } = useUi();\n\n const resolvedConfirm = confirmLabel ?? t(LAYOUT_I18N.confirm);\n const resolvedCancel = cancelLabel ?? t(LAYOUT_I18N.cancel);\n\n const footer = (\n <View style={styles.footer}>\n {/* Cancel FIRST — the web focus trap focuses the first focusable child, so the SAFE action is\n the default, never a destructive Confirm. It is also visually first (Confirm trails right). */}\n <Button\n accessibilityHint={t(LAYOUT_I18N.cancelHint)}\n accessibilityLabel={resolvedCancel}\n disabled={busy}\n label={resolvedCancel}\n testID={`${testID}-cancel`}\n variant=\"secondary\"\n onPress={onCancel}\n />\n <Button\n accessibilityHint={t(LAYOUT_I18N.confirmHint)}\n accessibilityLabel={resolvedConfirm}\n label={resolvedConfirm}\n loading={busy}\n testID={`${testID}-confirm`}\n variant={destructive ? 'danger' : 'primary'}\n onPress={onConfirm}\n />\n </View>\n );\n\n return (\n <Modal\n footer={footer}\n showClose={false}\n size=\"sm\"\n testID={testID}\n title={title}\n visible={visible}\n onClose={onCancel}\n >\n <Text style={[styles.message, { color: theme.colors.text }]} testID={`${testID}-message`}>\n {message}\n </Text>\n </Modal>\n );\n};\n\nexport default ConfirmDialog;\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 * 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';\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 // The per-item body height is animated by `Collapse` (@dloizides/ui-motion), which works on\n // web + native; there is no longer a `LayoutAnimation` to prime here.\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';\nimport { Collapse } from '@dloizides/ui-motion';\n\nimport { useAccordionContext } from './AccordionContext';\n\nimport { LAYOUT_I18N, MIN_TARGET_PX } 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 // Hit box floor on the pressable header box itself (mobile-first.md); padding alone gave 35px.\n minHeight: MIN_TARGET_PX,\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 {/* `Collapse` (from @dloizides/ui-motion) animates the body height on web AND native —\n RN `LayoutAnimation` (the previous approach) is a no-op under react-native-web, so the\n body used to SNAP open/closed on the web build. The body stays mounted at all times\n (clipped to height 0 when collapsed), so `aria-controls` always resolves and the open\n state is conveyed by the header's `aria-expanded`. */}\n <Collapse open={expanded} testID={`${headerTestID}-collapse`}>\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 </Collapse>\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","/**\n * The three states a copy affordance can be in. Its own file per the repo's\n * \"one exported enum per file\" rule.\n *\n * `Failed` is a first-class state on purpose. Clipboard writes genuinely fail in the browser —\n * a non-secure context (plain http, which is how every staging box and LAN preview is served)\n * has no `navigator.clipboard` at all, and even on https the Permissions API can reject. A\n * control that swallowed that would leave the analyst believing they hold an ID they do not,\n * and they would only find out after pasting the WRONG thing into a re-screen.\n */\nexport const enum CopyStatus {\n Idle = 'idle',\n Copied = 'copied',\n Failed = 'failed',\n}\n","/**\n * Write a string to the system clipboard, reporting honestly whether it worked.\n *\n * THREE PATHS, IN ORDER, BECAUSE THE OBVIOUS ONE IS NOT ENOUGH:\n *\n * 1. `navigator.clipboard.writeText` — the modern API. It is gated on a SECURE CONTEXT, so it is\n * simply `undefined` on plain http. Every staging box and LAN preview in this fleet is served\n * over http, which means the happy path is missing exactly where people test. It can also\n * reject at call time (permission denied, document not focused), so the promise is caught, not\n * assumed.\n * 2. `document.execCommand('copy')` over an off-screen textarea — deprecated, but it is\n * synchronous, needs no permission, and works in non-secure contexts. It is the reason a copy\n * button behaves the same on http staging as on https prod.\n * 3. Neither available (React Native, or a hostile browser) — return `false`. The caller then\n * shows a visible failure instead of a fake \"Copied!\". A host that wants real native clipboard\n * support injects its own writer rather than this package taking a native dependency.\n *\n * Returns `true` only when a write actually succeeded.\n */\n\n/** Off-screen, non-focusable-by-mouse placement for the fallback textarea. */\nconst OFFSCREEN_POSITION = '-9999px';\n\n/** Does this environment expose a DOM we can use at all? */\nfunction hasDom(): boolean {\n return typeof document !== 'undefined' && document.body !== null;\n}\n\n/**\n * The legacy path: put the text in a textarea, select it, ask the document to copy the selection.\n * The textarea is always removed, including when `execCommand` throws.\n */\nfunction copyViaExecCommand(value: string): boolean {\n if (!hasDom()) return false;\n\n const area = document.createElement('textarea');\n area.value = value;\n // `readOnly` stops a mobile keyboard popping up; the styles keep the node out of view and out\n // of the layout so nothing shifts for the one frame it exists.\n area.readOnly = true;\n area.setAttribute('aria-hidden', 'true');\n area.style.position = 'fixed';\n area.style.top = OFFSCREEN_POSITION;\n area.style.left = OFFSCREEN_POSITION;\n area.style.opacity = '0';\n\n document.body.appendChild(area);\n try {\n area.select();\n area.setSelectionRange(0, value.length);\n return document.execCommand('copy');\n } catch {\n return false;\n } finally {\n document.body.removeChild(area);\n }\n}\n\n/** True when the async clipboard API is actually present (it is absent in non-secure contexts). */\nfunction hasAsyncClipboard(): boolean {\n return (\n typeof navigator !== 'undefined' &&\n typeof navigator.clipboard?.writeText === 'function'\n );\n}\n\n/**\n * Copy `value`, returning whether it landed on the clipboard.\n *\n * `writer` lets a host inject a platform clipboard (React Native's `Clipboard.setString`, say)\n * without this package depending on one. An injected writer that throws falls through to the DOM\n * paths rather than failing outright.\n */\nexport async function copyText(\n value: string,\n writer?: (text: string) => void | Promise<void>,\n): Promise<boolean> {\n if (value === '') return false;\n\n if (writer !== undefined) {\n try {\n await writer(value);\n return true;\n } catch {\n /* fall through to the DOM paths below */\n }\n }\n\n if (hasAsyncClipboard()) {\n try {\n await navigator.clipboard.writeText(value);\n return true;\n } catch {\n /* fall through — a rejected write is normal on http and when the doc is unfocused */\n }\n }\n\n return copyViaExecCommand(value);\n}\n","/**\n * Copy-with-feedback state: run a clipboard write, expose whether it succeeded, and return to\n * idle after a beat so the control does not sit on a stale \"Copied!\" forever.\n *\n * Split out of the component so the timing and the failure branch are testable without a\n * renderer — the part most likely to be wrong is the part that only shows up when the clipboard\n * says no, which is hard to reach through the UI.\n */\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport { copyText } from './copyText';\nimport { CopyStatus } from './CopyStatus';\n\n/** How long the \"Copied!\"/\"Copy failed\" confirmation stays up before reverting to idle. */\nexport const COPY_FEEDBACK_MS = 2000;\n\nexport interface CopyToClipboard {\n status: CopyStatus;\n /** Fire-and-forget: performs the write and drives `status`. Safe to pass straight to onPress. */\n copy: () => void;\n}\n\n/**\n * @param value the text to copy\n * @param writer optional platform clipboard writer (see `copyText`)\n */\nexport function useCopyToClipboard(\n value: string,\n writer?: (text: string) => void | Promise<void>,\n): CopyToClipboard {\n const [status, setStatus] = useState<CopyStatus>(CopyStatus.Idle);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n // Guards a setState after unmount: the clipboard write is async, and a drawer can close\n // mid-flight.\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n if (timerRef.current !== null) clearTimeout(timerRef.current);\n };\n }, []);\n\n const copy = useCallback((): void => {\n void (async () => {\n const ok = await copyText(value, writer);\n if (!mountedRef.current) return;\n\n setStatus(ok ? CopyStatus.Copied : CopyStatus.Failed);\n\n if (timerRef.current !== null) clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => {\n if (mountedRef.current) setStatus(CopyStatus.Idle);\n }, COPY_FEEDBACK_MS);\n })();\n }, [value, writer]);\n\n return { status, copy };\n}\n","/**\r\n * CopyableId — show a long machine identifier (a GUID, a reference, a correlation id) so a human\r\n * can both READ enough of it to tell two apart, and TAKE it in one action.\r\n *\r\n * WHY MIDDLE TRUNCATION AND NOT `numberOfLines={1}`: two GUIDs from the same table share a\r\n * prefix far more often than intuition suggests, and tail-truncation renders them IDENTICALLY —\r\n * `3f2a9c81-…`. The tail is what distinguishes them, so both ends must survive. That is exactly\r\n * what `TruncatedText` already solves for URLs, so this composes it rather than re-deriving it.\r\n *\r\n * WHY A COPY BUTTON IS NOT OPTIONAL POLISH: an ID exists to be pasted somewhere else — into a\r\n * re-screen, a support ticket, a SQL console. Displaying a truncated GUID with no copy affordance\r\n * is strictly WORSE than not showing it, because what is on screen is not the value: hand-select\r\n * it and you get `3f2a9c81…d4e7`, ellipsis and all, which silently fails wherever it is pasted.\r\n * The full value is therefore always the accessible name and the web tooltip, and the button\r\n * copies the full value, never the display string.\r\n *\r\n * FAILURE IS SHOWN, NOT SWALLOWED: see `copyText` — clipboard writes really do fail on plain\r\n * http, which is how staging is served. A silent failure would hand the analyst a false belief.\r\n */\r\nimport React, { useMemo } from 'react';\r\n\r\nimport { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';\r\n\r\nimport { useUi } from '@dloizides/ui-feedback';\r\n\r\nimport { LAYOUT_I18N, MIN_TARGET_PX } from '../constants';\r\nimport { TruncatedText } from '../TruncatedText/TruncatedText';\r\nimport { CopyStatus } from './CopyStatus';\r\nimport { useCopyToClipboard } from './useCopyToClipboard';\r\n\r\nconst LABEL_FONT_SIZE = 11;\r\nconst VALUE_FONT_SIZE = 12;\r\nconst ACTION_FONT_SIZE = 12;\r\nconst ROW_GAP = 8;\r\nconst CELL_GAP = 2;\r\nconst LABEL_LETTER_SPACING = 0.4;\r\nconst ACTION_PADDING_H = 6;\r\nconst ACTION_PADDING_V = 2;\r\nconst ACTION_RADIUS = 6;\r\n\r\nconst styles = StyleSheet.create({\r\n cell: { gap: CELL_GAP },\r\n label: {\r\n fontSize: LABEL_FONT_SIZE,\r\n fontWeight: '700',\r\n letterSpacing: LABEL_LETTER_SPACING,\r\n textTransform: 'uppercase',\r\n },\r\n row: { flexDirection: 'row', alignItems: 'center', gap: ROW_GAP },\r\n /**\r\n * The truncation width comes from this wrapper, not from the row: `TruncatedText` measures its\r\n * PARENT (see `useAvailableWidth`), and the row also holds the copy button.\r\n *\r\n * `flex: 1` IS LOAD-BEARING — do not weaken it to `flexShrink: 1`. A shrink-only wrapper\r\n * SHRINK-WRAPS its content, which makes the measured parent width depend on the very string we\r\n * are computing: truncate -> wrapper narrows -> re-measure smaller -> truncate harder. Verified\r\n * in Chrome: with `flexShrink: 1` a 506px-wide container and a 306px one both rendered the SAME\r\n * 196px string, i.e. the id was cut short with 300px of room going spare. `flex: 1` makes the\r\n * wrapper fill the row's leftover width instead, so its size is independent of what we put in\r\n * it — the same reason `useAvailableWidth` measures the parent and not the element.\r\n *\r\n * `minWidth: 0` is what actually permits a flex child to go below its content width.\r\n */\r\n valueWrap: { flex: 1, minWidth: 0 },\r\n value: { fontSize: VALUE_FONT_SIZE, fontWeight: '600' },\r\n action: {\r\n fontSize: ACTION_FONT_SIZE,\r\n fontWeight: '600',\r\n paddingHorizontal: ACTION_PADDING_H,\r\n paddingVertical: ACTION_PADDING_V,\r\n borderRadius: ACTION_RADIUS,\r\n // 44x44 hit box on the rendered box (it measured 40x20). `lineHeight` = the floor keeps the\r\n // label vertically centred without wrapping the Text in another element.\r\n minHeight: MIN_TARGET_PX,\r\n minWidth: MIN_TARGET_PX,\r\n lineHeight: MIN_TARGET_PX,\r\n textAlign: 'center',\r\n },\r\n});\r\n\r\nexport interface CopyableIdProps {\r\n /** The full identifier. Always what gets copied, and always the accessible name / tooltip. */\r\n value: string;\r\n /** Optional eyebrow above the value (e.g. \"Screening ID\"). Pass pre-localized. */\r\n label?: string;\r\n /**\r\n * Style for the outer container.\r\n *\r\n * Hosts should give this a width that does NOT derive from its own content — a `flexBasis`, a\r\n * `width`, or `flex: 1`. The component measures its container to decide how much of the value\r\n * to show, so a shrink-to-fit parent makes the available width depend on the string being\r\n * computed, and the id renders clipped with space to spare.\r\n */\r\n style?: StyleProp<ViewStyle>;\r\n /** Base testID; the copy control is `${testID}-copy` and the value `${testID}-value`. */\r\n testID: string;\r\n /** Accessible name for the value itself. Pass pre-localized; falls back to the raw value. */\r\n accessibilityLabel?: string;\r\n /**\r\n * Platform clipboard writer, for hosts that have one (React Native). Omit on web — the DOM\r\n * paths in `copyText` cover it.\r\n */\r\n writer?: (text: string) => void | Promise<void>;\r\n}\r\n\r\n/** Colour scale step used for every state tone. */\r\nconst TONE_STEP = '500';\r\n\r\n/**\r\n * The copy control's label and tone for a given status.\r\n *\r\n * `semantic.success` is NOT a guaranteed key on the theme contract — only `semantic.error` is\r\n * (see `FeedbackThemeSemantic`). A host that ships no success scale falls back to the primary\r\n * colour rather than rendering an undefined colour, which RN-web turns into unstyled black.\r\n */\r\nfunction useActionState(status: CopyStatus): { key: string; color: string } {\r\n const { theme } = useUi();\r\n return useMemo(() => {\r\n const primary = theme.palette.primary[TONE_STEP];\r\n if (status === CopyStatus.Copied) {\r\n return { key: LAYOUT_I18N.copied, color: theme.semantic.success?.[TONE_STEP] ?? primary };\r\n }\r\n if (status === CopyStatus.Failed) {\r\n return { key: LAYOUT_I18N.copyFailed, color: theme.semantic.error[TONE_STEP] };\r\n }\r\n return { key: LAYOUT_I18N.copy, color: primary };\r\n }, [status, theme]);\r\n}\r\n\r\nexport const CopyableId = ({\r\n value,\r\n label,\r\n style,\r\n testID,\r\n accessibilityLabel,\r\n writer,\r\n}: CopyableIdProps): React.ReactElement => {\r\n const { theme, t } = useUi();\r\n const { colors } = theme;\r\n const { status, copy } = useCopyToClipboard(value, writer);\r\n const action = useActionState(status);\r\n\r\n return (\r\n <View style={[styles.cell, style]} testID={testID}>\r\n {label !== undefined && (\r\n <Text style={[styles.label, { color: colors.textSecondary }]}>{label}</Text>\r\n )}\r\n <View style={styles.row}>\r\n <View style={styles.valueWrap}>\r\n <TruncatedText\r\n value={value}\r\n style={[styles.value, { color: colors.text }]}\r\n testID={`${testID}-value`}\r\n accessibilityLabel={accessibilityLabel ?? value}\r\n accessibilityHint={t(LAYOUT_I18N.copyableIdHint)}\r\n />\r\n </View>\r\n <Text\r\n onPress={copy}\r\n accessibilityRole=\"button\"\r\n // The accessible NAME carries the status, because `accessibilityHint` is dropped by\r\n // react-native-web and never reaches the DOM — a screen-reader user would otherwise get\r\n // no confirmation at all that the copy happened.\r\n accessibilityLabel={t(action.key)}\r\n accessibilityHint={t(LAYOUT_I18N.copyHint)}\r\n testID={`${testID}-copy`}\r\n style={[styles.action, { color: action.color }]}\r\n >\r\n {t(action.key)}\r\n </Text>\r\n </View>\r\n </View>\r\n );\r\n};\r\n\r\nexport default CopyableId;\r\n","/**\n * Pure formatting for the build-info caption — split out of the component so the label\n * assembly (the part with the branches: no version, version only, version + api commit) is\n * testable without a renderer.\n */\n\n/** Leading glyph on the build version, e.g. `v1.2.0`. */\nexport const BUILD_INFO_PREFIX = 'v';\n\n/** Separator between the app build and the API commit, e.g. `v1.2.0 · api abc1234`. */\nexport const API_COMMIT_SEPARATOR = ' · api ';\n\n/** How many leading chars of a commit sha to show — a 7-char short sha is the git default. */\nconst SHORT_COMMIT_LENGTH = 7;\n\n/** First {@link SHORT_COMMIT_LENGTH} chars of a (trimmed) commit sha. A short sha is enough to\n * identify a build; the full 40-char hash is noise in a footer caption. */\nexport function shortenCommit(commit: string): string {\n return commit.trim().slice(0, SHORT_COMMIT_LENGTH);\n}\n\n/** Drop a single trailing slash so `${base}/version` never doubles up (`https://x//version`). */\nexport function trimTrailingSlash(url: string): string {\n return url.endsWith('/') ? url.slice(0, -1) : url;\n}\n\n/**\n * The caption text: `v<buildVersion>`, plus ` · api <sha7>` when a non-empty commit is known.\n * Both inputs are trimmed; an empty/whitespace commit is treated as absent (no API suffix).\n */\nexport function formatBuildInfo(buildVersion: string, apiCommit?: string): string {\n const base = `${BUILD_INFO_PREFIX}${buildVersion.trim()}`;\n const commit = apiCommit?.trim();\n if (commit === undefined || commit === '') return base;\n return `${base}${API_COMMIT_SEPARATOR}${shortenCommit(commit)}`;\n}\n","/**\n * Best-effort fetch of an API's build commit for {@link BuildInfoFooter}.\n *\n * When `apiBaseUrl` is set, GETs `${apiBaseUrl}/version` once and returns its `commit` field.\n * ANY failure (offline, 404, non-JSON, no `fetch`) leaves the commit `undefined` and the footer\n * shows only the app build version — a version caption must never surface a network error to the\n * user. The write is guarded against a mid-flight unmount.\n */\nimport { useEffect, useRef, useState } from 'react';\n\nimport { trimTrailingSlash } from './formatBuildInfo';\n\n/** Shape of the `/version` payload this hook reads. Only `commit` is consumed. */\nexport interface VersionResponse {\n commit?: string;\n}\n\n/**\n * @param apiBaseUrl origin/base to read `/version` from; when absent/empty the hook stays inert.\n * @param fetchImpl injectable `fetch` (testing seam); defaults to the global when present.\n * @returns the API commit once resolved, else `undefined`.\n */\nexport function useApiCommit(apiBaseUrl?: string, fetchImpl?: typeof fetch): string | undefined {\n const [commit, setCommit] = useState<string | undefined>(undefined);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n useEffect(() => {\n if (apiBaseUrl === undefined || apiBaseUrl === '') return;\n const doFetch = fetchImpl ?? (typeof fetch !== 'undefined' ? fetch : undefined);\n if (doFetch === undefined) return;\n\n void (async () => {\n try {\n const res = await doFetch(`${trimTrailingSlash(apiBaseUrl)}/version`);\n if (!res.ok) return;\n const body = (await res.json()) as VersionResponse;\n const value = body.commit;\n if (mountedRef.current && value !== undefined && value !== '') setCommit(value);\n } catch {\n // Best-effort: any failure leaves the commit undefined; the footer shows the version alone.\n return;\n }\n })();\n }, [apiBaseUrl, fetchImpl]);\n\n return commit;\n}\n","/**\n * BuildInfoFooter — a small, unobtrusive caption that shows which build the app is running:\n * `v<buildVersion>`, optionally `· api <sha7>` when an API base (or an explicit commit) is given.\n *\n * The FE half of \"know what's deployed\": each portal reads its stamped build id (an\n * `EXPO_PUBLIC_BUILD_VERSION` inlined at build time — the same git sha CI hands `@dloizides/pwa-sw`'s\n * `PWA_BUILD_VERSION`) and passes it in. The API commit is OPTIONAL and prop-driven, so apps with no\n * `/version` endpoint still get a version caption.\n *\n * Themable, no raw colours: the muted text uses the app theme's `textSecondary` via `useUi()`.\n */\nimport React, { useMemo } from 'react';\n\nimport { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';\n\nimport { useUi } from '@dloizides/ui-feedback';\n\nimport { LAYOUT_I18N, LAYOUT_TEST_IDS } from '../constants';\nimport { formatBuildInfo } from './formatBuildInfo';\nimport { useApiCommit } from './useApiCommit';\n\nconst FOOTER_PADDING_V = 6;\nconst FOOTER_PADDING_H = 12;\nconst FOOTER_FONT_SIZE = 11;\nconst FOOTER_OPACITY = 0.75;\n\nconst styles = StyleSheet.create({\n footer: {\n paddingVertical: FOOTER_PADDING_V,\n paddingHorizontal: FOOTER_PADDING_H,\n alignItems: 'center',\n },\n text: {\n fontSize: FOOTER_FONT_SIZE,\n opacity: FOOTER_OPACITY,\n },\n});\n\nexport interface BuildInfoFooterProps {\n /** The app's stamped build id (git sha or timestamp), inlined at build time. */\n buildVersion: string;\n /**\n * Optional API base; when set (and no explicit `apiCommit` is given) the footer GETs\n * `${apiBaseUrl}/version` best-effort and appends `· api <sha7>`. Failures are silent.\n */\n apiBaseUrl?: string;\n /** Optional explicit API commit — supply it to skip the `/version` fetch entirely. */\n apiCommit?: string;\n /** Injectable `fetch` for tests; defaults to the global. */\n fetchImpl?: typeof fetch;\n testID?: string;\n accessibilityLabel?: string;\n accessibilityHint?: string;\n style?: StyleProp<ViewStyle>;\n}\n\nexport const BuildInfoFooter = ({\n buildVersion,\n apiBaseUrl,\n apiCommit,\n fetchImpl,\n testID = LAYOUT_TEST_IDS.buildInfoFooter,\n accessibilityLabel,\n accessibilityHint,\n style,\n}: BuildInfoFooterProps): React.ReactElement => {\n const { theme, t } = useUi();\n\n // Only fetch when the app has not already supplied the commit — an explicit prop wins.\n const fetchedCommit = useApiCommit(apiCommit === undefined ? apiBaseUrl : undefined, fetchImpl);\n const commit = apiCommit ?? fetchedCommit;\n const label = formatBuildInfo(buildVersion, commit);\n\n const textStyle = useMemo(\n () => [styles.text, { color: theme.colors.textSecondary }],\n [theme.colors.textSecondary],\n );\n\n return (\n <View\n accessibilityLabel={accessibilityLabel ?? label}\n accessibilityHint={accessibilityHint ?? t(LAYOUT_I18N.buildInfoHint)}\n style={[styles.footer, style]}\n testID={testID}\n >\n <Text style={textStyle}>{label}</Text>\n </View>\n );\n};\n\nexport default BuildInfoFooter;\n","import React from 'react';\n\nimport { StyleSheet, Text, View } from 'react-native';\n\nconst SIZE = 22;\nconst BORDER = 2;\nconst GLYPH_SIZE = 14;\nconst GLYPH_LINE = 16;\nconst TICK = '✓';\n\nconst styles = StyleSheet.create({\n circle: {\n width: SIZE,\n height: SIZE,\n borderRadius: SIZE / 2,\n borderWidth: BORDER,\n alignItems: 'center',\n justifyContent: 'center',\n },\n glyph: { fontSize: GLYPH_SIZE, fontWeight: '700', lineHeight: GLYPH_LINE },\n});\n\ninterface CheckMarkProps {\n filled: boolean;\n accent: string;\n ring: string;\n glyphColor: string;\n testID?: string;\n}\n\n/** The decorative selection circle of the `check` row style. */\nexport const CheckMark = ({ filled, accent, ring, glyphColor, testID }: CheckMarkProps): React.ReactElement => (\n <View\n aria-hidden\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n style={[styles.circle, { borderColor: filled ? accent : ring, backgroundColor: filled ? accent : undefined }]}\n testID={testID}\n >\n {filled ? <Text style={[styles.glyph, { color: glyphColor }]}>{TICK}</Text> : null}\n </View>\n);\n","import { createContext, useContext } from 'react';\n\nexport interface ListRowTone {\n textColor: string;\n inverse: boolean;\n}\n\nexport const ListRowToneContext = createContext<ListRowTone | null>(null);\n\n/** Reads the enclosing `ListRow` text tone so custom slot content follows a filled row; `null` outside a row. */\nexport function useListRowTone(): ListRowTone | null {\n return useContext(ListRowToneContext);\n}\n","import { useUi } from '@dloizides/ui-feedback';\n\nimport type { RowPalette } from '../utils/rowLook';\n\n/** Maps the host theme onto the colours a `ListRow` draws with. */\nexport function useRowPalette(): RowPalette {\n const { colors, palette, semantic } = useUi().theme;\n const accent = palette.primary['500'];\n const tint = palette.primary['50'] ?? colors.surface;\n return {\n accent,\n accentTint: tint,\n background: colors.background,\n surface: colors.surface,\n border: colors.border,\n text: colors.text,\n hover: tint,\n pressed: palette.primary['100'] ?? colors.surfaceElevated,\n focus: semantic.info?.['500'] ?? accent,\n };\n}\n","export enum RowSelectedStyle {\n Surface = 'surface',\n AccentBar = 'accent-bar',\n Filled = 'filled',\n Raised = 'raised',\n Outline = 'outline',\n Check = 'check',\n}\n","interface SelectorMatcher {\n matches: (selector: string) => boolean;\n}\n\nfunction canMatch(target: unknown): target is SelectorMatcher {\n return typeof target === 'object' && target !== null && typeof (target as Partial<SelectorMatcher>).matches === 'function';\n}\n\n/** True when a focus came from the keyboard (`:focus-visible`); a mouse or touch press returns false. */\nexport function isFocusVisible(target: unknown): boolean {\n if (!canMatch(target)) return true;\n try {\n return target.matches(':focus-visible');\n } catch {\n return true;\n }\n}\n","import type { ViewStyle } from 'react-native';\n\nimport { RowSelectedStyle } from '../RowSelectedStyle';\n\nconst BAR_WIDTH = 4;\nconst OUTLINE_WIDTH = 2;\nconst FOCUS_GAP = 2;\nconst FOCUS_WIDTH = 4;\nconst CARD_RADIUS = 8;\nconst CARD_INSET_V = 4;\nconst CARD_INSET_H = 8;\nconst CARD_SHADOW = '0px 2px 8px rgba(20, 30, 50, 0.16)';\nconst TRANSPARENT = 'transparent';\n\nexport interface RowPalette {\n accent: string;\n accentTint: string;\n background: string;\n surface: string;\n border: string;\n text: string;\n hover: string;\n pressed: string;\n focus: string;\n}\n\nexport interface RowState {\n selected: boolean;\n hovered: boolean;\n pressed: boolean;\n focused: boolean;\n}\n\nexport interface RowLook {\n container: ViewStyle;\n titleColor: string;\n textColor: string;\n inverse: boolean;\n showCheck: boolean;\n checkFilled: boolean;\n}\n\nfunction inset(width: number, color: string): string {\n return `inset 0px 0px 0px ${String(width)}px ${color}`;\n}\n\nfunction interactionFill(state: RowState, palette: RowPalette): string | undefined {\n if (state.pressed) return palette.pressed;\n if (state.hovered) return palette.hover;\n return undefined;\n}\n\nfunction selectedContainer(style: RowSelectedStyle, palette: RowPalette): ViewStyle {\n switch (style) {\n case RowSelectedStyle.AccentBar:\n return { backgroundColor: palette.accentTint, borderLeftColor: palette.accent };\n case RowSelectedStyle.Filled:\n return { backgroundColor: palette.accent };\n case RowSelectedStyle.Raised:\n return { backgroundColor: palette.background, borderColor: palette.accent, boxShadow: CARD_SHADOW };\n case RowSelectedStyle.Outline:\n return { backgroundColor: palette.background, boxShadow: inset(OUTLINE_WIDTH, palette.accent) };\n case RowSelectedStyle.Check:\n return { backgroundColor: palette.background };\n default:\n return { backgroundColor: palette.surface };\n }\n}\n\nfunction baseContainer(style: RowSelectedStyle): ViewStyle {\n if (style === RowSelectedStyle.AccentBar) return { borderLeftWidth: BAR_WIDTH, borderLeftColor: TRANSPARENT };\n if (style !== RowSelectedStyle.Raised) return {};\n return {\n borderWidth: 1,\n borderColor: TRANSPARENT,\n borderRadius: CARD_RADIUS,\n marginVertical: CARD_INSET_V,\n marginHorizontal: CARD_INSET_H,\n };\n}\n\nfunction withFocus(container: ViewStyle, focused: boolean, palette: RowPalette): ViewStyle {\n if (!focused) return container;\n const ring = `${inset(FOCUS_GAP, palette.background)}, ${inset(FOCUS_WIDTH, palette.focus)}`;\n const existing = typeof container.boxShadow === 'string' ? container.boxShadow : undefined;\n const keepsInset = existing?.startsWith('inset') === true;\n return { ...container, boxShadow: keepsInset ? `${ring}, ${String(existing)}` : ring };\n}\n\n/** Resolves a row's container style and text colours from its selected style and state. */\nexport function resolveRowLook(style: RowSelectedStyle, state: RowState, palette: RowPalette): RowLook {\n const inverse = state.selected && style === RowSelectedStyle.Filled;\n const selected = state.selected ? selectedContainer(style, palette) : {};\n const fill = inverse ? undefined : interactionFill(state, palette);\n const fillStyle: ViewStyle = fill === undefined ? {} : { backgroundColor: fill };\n const container = { ...baseContainer(style), ...selected, ...fillStyle };\n const accentsTitle = state.selected && style === RowSelectedStyle.AccentBar;\n const textColor = inverse ? palette.background : palette.text;\n return {\n container: withFocus(container, state.focused, palette),\n titleColor: accentsTitle ? palette.accent : textColor,\n textColor,\n inverse,\n showCheck: style === RowSelectedStyle.Check,\n checkFilled: style === RowSelectedStyle.Check && state.selected,\n };\n}\n","import React, { useMemo, useState } from 'react';\r\n\r\nimport { Pressable, StyleSheet, Text, View, type PressableProps } from 'react-native';\r\n\r\nimport { useUi } from '@dloizides/ui-feedback';\r\n\r\nimport { MIN_TARGET_PX } from '../constants';\r\n\r\nimport { CheckMark } from './components/CheckMark';\r\nimport { ListRowToneContext } from './hooks/useListRowTone';\r\nimport { useRowPalette } from './hooks/useRowPalette';\r\nimport { RowSelectedStyle } from './RowSelectedStyle';\r\nimport { isFocusVisible } from './utils/focusVisible';\r\nimport { resolveRowLook } from './utils/rowLook';\r\n\r\nconst FONT = 15;\r\nconst PAD_H = 16;\r\nconst PAD_V = 12;\r\nconst GAP = 4;\r\nconst MARK_GAP = 12;\r\nconst LINE_GAP = 8;\r\n\r\nconst styles = StyleSheet.create({\r\n row: {\r\n flexDirection: 'row',\r\n alignItems: 'center',\r\n gap: MARK_GAP,\r\n paddingHorizontal: PAD_H,\r\n paddingVertical: PAD_V,\r\n borderTopWidth: 1,\r\n minHeight: MIN_TARGET_PX,\r\n },\r\n body: { flex: 1, minWidth: 0, gap: GAP },\r\n line: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', gap: LINE_GAP },\r\n shrink: { flexShrink: 1, minWidth: 0 },\r\n strong: { fontSize: FONT, fontWeight: '600' },\r\n badges: { flexDirection: 'row', flexWrap: 'wrap', gap: GAP, justifyContent: 'flex-end' },\r\n});\r\n\r\nexport interface ListRowProps {\r\n title: React.ReactNode;\r\n trailing?: React.ReactNode;\r\n meta?: React.ReactNode;\r\n badges?: React.ReactNode;\r\n after?: React.ReactNode;\r\n selected: boolean;\r\n selectedStyle?: RowSelectedStyle;\r\n onPress: () => void;\r\n accessibilityLabel: string;\r\n accessibilityHint: string;\r\n testID?: string;\r\n}\r\n\r\ninterface WebPressState {\r\n pressed: boolean;\r\n hovered?: boolean;\r\n}\r\n\r\nfunction pressedProps(selected: boolean): PressableProps & { 'aria-pressed': boolean } {\r\n return { 'aria-pressed': selected };\r\n}\r\n\r\nfunction focusTarget(event: unknown): unknown {\r\n return (event as { nativeEvent?: { target?: unknown } } | undefined)?.nativeEvent?.target;\r\n}\r\n\r\nfunction slot(node: React.ReactNode, color: string, strong: boolean): React.ReactNode {\r\n if (typeof node !== 'string') return node;\r\n return <Text style={[styles.shrink, strong ? styles.strong : null, { color }]}>{node}</Text>;\r\n}\r\n\r\n/** A selectable list row with title, trailing, meta and badge slots and one selected-style setting. */\r\nexport const ListRow = ({\r\n title,\r\n trailing,\r\n meta,\r\n badges,\r\n after,\r\n selected,\r\n selectedStyle = RowSelectedStyle.Surface,\r\n onPress,\r\n accessibilityLabel,\r\n accessibilityHint,\r\n testID,\r\n}: ListRowProps): React.ReactElement => {\r\n const palette = useRowPalette();\r\n const { colors } = useUi().theme;\r\n const [focused, setFocused] = useState(false);\r\n const rest = resolveRowLook(selectedStyle, { selected, hovered: false, pressed: false, focused }, palette);\r\n const tone = useMemo(() => ({ textColor: rest.textColor, inverse: rest.inverse }), [rest.textColor, rest.inverse]);\r\n const checkTestId = testID === undefined ? undefined : `${testID}-check`;\r\n return (\r\n <ListRowToneContext.Provider value={tone}>\r\n <Pressable\r\n accessibilityHint={accessibilityHint}\r\n accessibilityLabel={accessibilityLabel}\r\n accessibilityRole=\"button\"\r\n accessibilityState={{ selected }}\r\n style={(state) => {\r\n const { pressed, hovered } = state as WebPressState;\r\n const look = resolveRowLook(selectedStyle, { selected, pressed, focused, hovered: hovered === true }, palette);\r\n return [styles.row, { borderTopColor: colors.border }, look.container];\r\n }}\r\n testID={testID}\r\n onBlur={() => {\r\n setFocused(false);\r\n }}\r\n onFocus={(event) => {\r\n setFocused(isFocusVisible(focusTarget(event)));\r\n }}\r\n onPress={onPress}\r\n {...pressedProps(selected)}\r\n >\r\n {rest.showCheck ? (\r\n <CheckMark accent={palette.accent} filled={rest.checkFilled} glyphColor={palette.background} ring={palette.border} testID={checkTestId} />\r\n ) : null}\r\n <View style={styles.body}>\r\n <View style={styles.line}>\r\n {slot(title, rest.titleColor, true)}\r\n {slot(trailing, rest.textColor, true)}\r\n </View>\r\n <View style={styles.line}>\r\n <View style={styles.shrink}>{slot(meta, rest.textColor, false)}</View>\r\n {badges === undefined ? null : <View style={styles.badges}>{badges}</View>}\r\n </View>\r\n </View>\r\n </Pressable>\r\n {after ?? null}\r\n </ListRowToneContext.Provider>\r\n );\r\n};\r\n"]}
|