@marktiderman/genesis-ui-native 2.5.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/{chunk-YJV5MMZX.js → chunk-7HWS2JGX.js} +7 -741
  2. package/dist/chunk-7HWS2JGX.js.map +1 -0
  3. package/dist/{chunk-IDHW2NOP.js → chunk-C6Q5ZAVT.js} +232 -6
  4. package/dist/chunk-C6Q5ZAVT.js.map +1 -0
  5. package/dist/{chunk-YI7XVY2D.js → chunk-ON7WP4T6.js} +13 -479
  6. package/dist/chunk-ON7WP4T6.js.map +1 -0
  7. package/dist/chunk-PO3MK6IY.js +1231 -0
  8. package/dist/chunk-PO3MK6IY.js.map +1 -0
  9. package/dist/chunk-SXCG2REG.js +479 -0
  10. package/dist/chunk-SXCG2REG.js.map +1 -0
  11. package/dist/components/index.d.ts +10 -3
  12. package/dist/components/index.js +3 -4
  13. package/dist/data/index.d.ts +482 -4
  14. package/dist/data/index.js +1480 -17
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/inbox-page-DZUR-PJ1.d.ts +199 -0
  17. package/dist/index.d.ts +2 -1
  18. package/dist/index.js +5 -5
  19. package/dist/layouts/index.d.ts +4 -195
  20. package/dist/layouts/index.js +3 -3
  21. package/package.json +2 -2
  22. package/src/components/__tests__/button-a11y.test.tsx +17 -0
  23. package/src/components/button.tsx +8 -2
  24. package/src/components/image.tsx +5 -0
  25. package/src/data/NativeDetailPanel.tsx +8 -1
  26. package/src/data/index.ts +1 -0
  27. package/src/data/resource-view/NativeResourceFormSheet.tsx +305 -0
  28. package/src/data/resource-view/NativeResourceView.tsx +536 -0
  29. package/src/data/resource-view/NativeResourceWorkspace.tsx +657 -0
  30. package/src/data/resource-view/__tests__/native-resource-view.test.tsx +977 -0
  31. package/src/data/resource-view/__tests__/native-resource-workspace.test.tsx +356 -0
  32. package/src/data/resource-view/display.tsx +259 -0
  33. package/src/data/resource-view/index.ts +61 -0
  34. package/src/data/resource-view/mapping.ts +333 -0
  35. package/src/data/resource-view/messages.ts +121 -0
  36. package/src/data/resource-view/use-native-resource-view.ts +309 -0
  37. package/dist/chunk-EFXCJ5AN.js +0 -234
  38. package/dist/chunk-EFXCJ5AN.js.map +0 -1
  39. package/dist/chunk-FIITITXO.js +0 -492
  40. package/dist/chunk-FIITITXO.js.map +0 -1
  41. package/dist/chunk-IDHW2NOP.js.map +0 -1
  42. package/dist/chunk-YI7XVY2D.js.map +0 -1
  43. package/dist/chunk-YJV5MMZX.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/layouts/screen-container.tsx","../src/layouts/nav-bar.tsx","../src/layouts/settings-page.tsx","../src/layouts/keyboard.tsx","../src/layouts/settings-sub-page.tsx","../src/layouts/notifications-page.tsx","../src/layouts/inbox-page.tsx","../src/layouts/thread-page.tsx","../src/layouts/auth.tsx","../src/layouts/auth-screen.tsx","../src/layouts/apple-sign-in.tsx","../src/layouts/google-sign-in.tsx"],"names":["jsx","jsxs","View","Fragment","Platform","Pressable","Text","useContext","useMemo","useCallback","renderSlot","DefaultSectionHeader","DefaultRow","SafeAreaView","ScrollView","IOS_GROUP_MARGIN","iosGroupRadius","DefaultEmpty","Alert","useState","UnreadDot","StyleSheet","createElement","KeyboardAvoidingView","TextInput","useRef","DefaultFooter"],"mappings":";;;;;;;;;;;AAsHO,SAAS,qBACd,KAAA,EACyB;AACzB,EAAA,MAAM;AAAA,IACJ,WAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,kBAAA;AAAA,IACA;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,MAAM,OAAgC,EAAC;AACvC,EAAA,IAAI,WAAA,KAAgB,MAAA,EAAW,IAAA,CAAK,KAAA,GAAQ,WAAA;AAC5C,EAAA,IAAI,UAAA,OAAiB,UAAA,GAAa,UAAA;AAClC,EAAA,IAAI,WAAA,OAAkB,WAAA,GAAc,WAA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AA;AAAA,GACF,EACF,CAAA;AAEJ;AAcA,IAAM,eAAe,EAAE,QAAA,EAAU,uBAAuB,SAAA,EAAW,oBAAA,EAAsB,WAAW,oBAAA,EAAqB;AAQlH,SAAS,cAAc,EAAE,KAAA,EAAO,KAAA,EAAO,GAAG,QAAO,EAAoD;AAC1G,EAAA,IAAII,QAAAA,CAAS,EAAA,KAAO,KAAA,IAAS,CAAC,OAAO,OAAO,IAAA;AAC5C,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,OAAA;AAAA,IACJ,KAAA,EAAO,KAAA,IAAS,YAAA,CAAa,MAAA,CAAO,QAAQ,UAAU,CAAA;AAAA,IACtD,SAAS,MAAA,CAAO,OAAA;AAAA,IAChB,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,MAAA,EAAQ,CAAC,EAAE,MAAA,EAAQ,QAAA,EAAS,qBAAMJ,GAAAA,CAAC,iBAAA,EAAA,EAAkB,KAAA,EAAe,GAAG,MAAA,EAAQ,UAAoB,MAAA,EAAgB;AAAA,GACrH;AACF;;;ACjGO,SAAS,cAAA,CAAe,EAAE,OAAA,EAAS,KAAA,GAAQ,wBAAwB,IAAA,EAAM,QAAA,EAAU,OAAA,GAAU,IAAA,EAAK,EAAqD;AAC5J,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,EAAA,OAAO,EAAE,EAAA,EAAI,QAAA,EAAU,KAAA,EAAO,IAAA,EAAM,SAAS,QAAA,EAAS;AACxD","file":"chunk-YI7XVY2D.js","sourcesContent":["/**\n * ScreenContainer — Layer-2 page primitive.\n *\n * Wires the chrome every layout needs without imposing layout structure:\n * - Safe-area edges (configurable via `safeAreaEdges`)\n * - StatusBar style (light / dark / auto)\n * - Scroll vs static body\n * - Tokens-aware background (`bg-background`)\n * - A loading state (`loading`): a centred `NativeLoadingState` in place of the body\n *\n * Header customization is delegated: pass `headerLeft`, `headerRight`,\n * `large`, `scrollEdgeBehavior`, `safeAreaEdges`, plus any direct\n * `headerOptions` passthrough to `<Stack.Screen options={...} />`. We\n * **do not** render the navigation header ourselves — Expo Router /\n * React Navigation render the platform-native header. Consumer either:\n *\n * (a) Wraps the screen in `<ScreenContainer>` and ALSO declares\n * `<Stack.Screen options={headerOptionsFromProps(props)} />` at the\n * top of the screen (we export a helper `composeHeaderOptions` for\n * this), OR\n * (b) Imports `<NavBarTitle>` / `<NavBarSearchBar>` / `<NavBarSaveButton>`\n * sub-primitives and threads them through `headerLeft` / `headerRight`\n * options manually.\n *\n * The Layer-3/4 layouts (SettingsPage, etc.) compose ScreenContainer + a\n * helper that wires Stack.Screen so consumers get the 3-line ergonomics.\n *\n * @stability Beta\n */\nimport type { ReactNode } from \"react\";\nimport { ScrollView, StatusBar, View, type ViewStyle } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { cn } from \"../utils\";\nimport { useThemeMode } from \"../hooks/use-theme-mode\";\nimport { NativeLoadingState } from \"../components/loading-state\";\n\nexport type SafeAreaEdge = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport type ScrollEdgeBehavior = \"match\" | \"transparent\" | \"opaque\";\n\nexport interface ScreenContainerProps {\n /** Screen body. Pass any node tree. */\n children: ReactNode;\n /** When `true`, the body is wrapped in a vertical ScrollView. Default `false`. */\n scroll?: boolean;\n /**\n * SafeAreaView edges. Defaults to `[\"left\", \"right\"]` — top/bottom are\n * normally handled by the navigation header / tab bar.\n */\n safeAreaEdges?: SafeAreaEdge[];\n /**\n * StatusBar appearance. `\"auto\"` follows the resolved theme mode.\n */\n statusBar?: \"light\" | \"dark\" | \"auto\" | \"hidden\";\n /**\n * Force light or dark theme on this screen regardless of OS preference.\n * Default `\"system\"` (follow OS).\n */\n themeMode?: \"light\" | \"dark\" | \"system\";\n /** Override root container className. */\n className?: string;\n /** Override inner content container className (the ScrollView's contentContainerClassName when scroll=true). */\n contentClassName?: string;\n /**\n * `keyboardShouldPersistTaps` for the inner ScrollView. Default `\"handled\"`.\n * Only used when `scroll` is true.\n */\n keyboardShouldPersistTaps?: \"always\" | \"never\" | \"handled\";\n /**\n * When `true`, a centred `NativeLoadingState` (theme-tinted spinner,\n * announced as loading) replaces the body, inside the same safe area and\n * background. Use it for redirect and first-load screens: the body is\n * unmounted while it's on, so a form underneath loses its state. Default `false`.\n */\n loading?: boolean;\n /** Text under the spinner while `loading`, and what screen readers announce: pass translated text. */\n loadingLabel?: string;\n /** Style on the root, e.g. a theme-role background color. */\n style?: ViewStyle;\n /** testID on the root container. */\n testID?: string;\n}\n\n/**\n * Layer-3 named-prop slots that layouts can accept and forward to\n * `composeHeaderOptions()` for `<Stack.Screen options={...}>`.\n */\nexport interface ScreenHeaderProps {\n /** Custom header title. Falls back to `<Stack.Screen name>` mapping. */\n headerTitle?: string;\n /** Custom node rendered on the left of the nav bar. */\n headerLeft?: () => ReactNode;\n /** Custom node rendered on the right of the nav bar. */\n headerRight?: () => ReactNode;\n /** When true, iOS uses large-title mode + scroll-edge appearance. */\n large?: boolean;\n /** iOS scroll-edge behavior. `\"match\"` collapses, `\"transparent\"` always transparent, `\"opaque\"` always opaque. */\n scrollEdgeBehavior?: ScrollEdgeBehavior;\n /** Direct passthrough merged INTO the resolved options object. Wins over named props. */\n headerOptions?: Record<string, unknown>;\n}\n\n/**\n * Compose a `<Stack.Screen options={...}>` object from Layer-3 named\n * props + a direct `headerOptions` passthrough. Layouts call this and\n * pass the result to `<Stack.Screen>` so the host's expo-router stack\n * renders a platform-native large title / scroll-edge appearance.\n *\n * Usage (in a layout primitive):\n *\n * const opts = composeHeaderOptions({\n * headerTitle: \"Settings\",\n * large: true,\n * scrollEdgeBehavior: \"match\",\n * headerOptions: rest.headerOptions,\n * });\n * return <><Stack.Screen options={opts} /><ScreenContainer>...</ScreenContainer></>;\n */\nexport function composeHeaderOptions(\n props: ScreenHeaderProps,\n): Record<string, unknown> {\n const {\n headerTitle,\n headerLeft,\n headerRight,\n large,\n scrollEdgeBehavior,\n headerOptions,\n } = props;\n\n const opts: Record<string, unknown> = {};\n if (headerTitle !== undefined) opts.title = headerTitle;\n if (headerLeft) opts.headerLeft = headerLeft;\n if (headerRight) opts.headerRight = headerRight;\n if (large) {\n // iOS large-title mode. Android falls back to standard.\n opts.headerLargeTitle = true;\n if (scrollEdgeBehavior === \"transparent\") {\n opts.headerTransparent = true;\n } else if (scrollEdgeBehavior === \"opaque\") {\n opts.headerLargeTitleShadowVisible = true;\n }\n }\n // Direct passthrough wins.\n if (headerOptions) {\n Object.assign(opts, headerOptions);\n }\n return opts;\n}\n\nconst DEFAULT_EDGES: SafeAreaEdge[] = [\"left\", \"right\"];\n\n// A see-through Android status bar. React Native 0.88 dropped both props from StatusBar's types\n// (Android is always edge to edge there, so they do nothing); earlier versions still need them.\n// Spread untyped so the screen compiles against either.\nconst TRANSLUCENT_ANDROID_BAR: Record<string, unknown> = { translucent: true, backgroundColor: \"transparent\" };\n\n/**\n * Resolve the StatusBar bar style from the user's `statusBar` setting +\n * the resolved theme mode. `\"auto\"` follows theme; explicit overrides\n * win; anything else falls back to `\"default\"`.\n */\nfunction resolveBarStyle(\n statusBar: \"light\" | \"dark\" | \"auto\" | \"hidden\",\n resolvedMode: \"light\" | \"dark\",\n): \"default\" | \"light-content\" | \"dark-content\" {\n if (statusBar === \"auto\") {\n return resolvedMode === \"dark\" ? \"light-content\" : \"dark-content\";\n }\n if (statusBar === \"light\") return \"light-content\";\n if (statusBar === \"dark\") return \"dark-content\";\n return \"default\";\n}\n\nexport function ScreenContainer({\n children,\n scroll = false,\n safeAreaEdges = DEFAULT_EDGES,\n statusBar = \"auto\",\n themeMode = \"system\",\n className,\n contentClassName,\n keyboardShouldPersistTaps = \"handled\",\n loading = false,\n loadingLabel,\n style,\n testID,\n}: ScreenContainerProps) {\n const osMode = useThemeMode();\n const resolvedMode = themeMode === \"system\" ? osMode : themeMode;\n const barStyle = resolveBarStyle(statusBar, resolvedMode);\n\n const body = loading ? (\n <View testID={testID ? `${testID}-body` : undefined} className={cn(\"flex-1\", contentClassName)}>\n <NativeLoadingState fullScreen={false} label={loadingLabel} testID={`${testID ?? \"screen-container\"}-loading`} />\n </View>\n ) : scroll ? (\n <ScrollView\n testID={testID ? `${testID}-scroll` : undefined}\n keyboardShouldPersistTaps={keyboardShouldPersistTaps}\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerClassName={cn(\"flex-grow\", contentClassName)}\n >\n {children}\n </ScrollView>\n ) : (\n <View\n testID={testID ? `${testID}-body` : undefined}\n className={cn(\"flex-1\", contentClassName)}\n >\n {children}\n </View>\n );\n\n return (\n <SafeAreaView\n testID={testID ?? \"screen-container\"}\n edges={safeAreaEdges}\n className={cn(\"flex-1 bg-background\", className)}\n style={style}\n >\n {statusBar !== \"hidden\" ? (\n <StatusBar\n barStyle={\n barStyle as\n | \"default\"\n | \"light-content\"\n | \"dark-content\"\n }\n {...TRANSLUCENT_ANDROID_BAR}\n />\n ) : (\n <StatusBar hidden />\n )}\n {body}\n </SafeAreaView>\n );\n}\n","/**\n * Nav-bar sub-primitives — escape hatches for `<Stack.Screen>` `headerLeft`,\n * `headerRight`, and custom title view.\n *\n * Use these when the named-prop slots on a layout aren't enough — e.g.,\n * a screen needs a save button on the right that's wired to dirty-state,\n * or a search bar replaces the title on a results screen.\n *\n * Pass directly into `headerLeft={() => <NavBarSearchBar ... />}` or\n * compose into a custom `headerTitle={() => <NavBarTitle ... />}` slot.\n *\n * @stability Beta\n */\nimport { Pressable, Text, TextInput, View } from \"react-native\";\nimport { nativeColors } from \"@marktiderman/genesis-design-system/tokens/native\";\nimport { cn } from \"../utils\";\n\n// ---------------------------------------------------------------------------\n// NavBarSaveButton\n// ---------------------------------------------------------------------------\n\nexport interface NavBarSaveButtonProps {\n /** Press handler. Disabled when not provided OR when `disabled`/`loading`. */\n onPress?: () => void;\n /** Visible label. Default `\"Save\"`. */\n label?: string;\n /** When true, the button is muted and not pressable. Use this for clean / pristine forms. */\n disabled?: boolean;\n /** When true, label switches to a busy indicator and presses are blocked. */\n loading?: boolean;\n /** When true, render label in destructive tone. */\n destructive?: boolean;\n className?: string;\n testID?: string;\n}\n\nexport function NavBarSaveButton({\n onPress,\n label = \"Save\",\n disabled,\n loading,\n destructive,\n className,\n testID,\n}: NavBarSaveButtonProps) {\n const isDisabled = !!disabled || !!loading || !onPress;\n return (\n <Pressable\n testID={testID ?? \"nav-bar-save-button\"}\n accessibilityRole=\"button\"\n accessibilityLabel={label}\n accessibilityState={{ disabled: isDisabled, busy: !!loading }}\n onPress={isDisabled ? undefined : onPress}\n disabled={isDisabled}\n className={cn(\"min-h-[44px] justify-center px-3\", className)}\n hitSlop={8}\n >\n <Text\n className={cn(\n \"text-base font-semibold\",\n destructive ? \"text-destructive\" : \"text-primary\",\n isDisabled && \"opacity-40\"\n )}\n >\n {loading ? \"…\" : label}\n </Text>\n </Pressable>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NavBarTitle\n// ---------------------------------------------------------------------------\n\nexport interface NavBarTitleProps {\n /** Title text. */\n title: string;\n /** Optional smaller subtitle line under the title. */\n subtitle?: string;\n /** Optional press handler — turns the title row into a tap target (e.g., reveal a picker). */\n onPress?: () => void;\n className?: string;\n testID?: string;\n}\n\nexport function NavBarTitle({\n title,\n subtitle,\n onPress,\n className,\n testID,\n}: NavBarTitleProps) {\n const inner = (\n <View className={cn(\"items-center justify-center\", className)}>\n <Text\n testID={testID ? `${testID}-title` : undefined}\n className=\"text-base font-semibold text-foreground\"\n numberOfLines={1}\n >\n {title}\n </Text>\n {subtitle ? (\n <Text\n testID={testID ? `${testID}-subtitle` : undefined}\n className=\"text-xs text-muted-foreground\"\n numberOfLines={1}\n >\n {subtitle}\n </Text>\n ) : null}\n </View>\n );\n\n if (onPress) {\n return (\n <Pressable\n testID={testID ?? \"nav-bar-title\"}\n accessibilityRole=\"button\"\n accessibilityLabel={subtitle ? `${title}, ${subtitle}` : title}\n onPress={onPress}\n hitSlop={8}\n >\n {inner}\n </Pressable>\n );\n }\n\n return (\n <View testID={testID ?? \"nav-bar-title\"} accessibilityRole=\"header\">\n {inner}\n </View>\n );\n}\n\n// ---------------------------------------------------------------------------\n// NavBarSearchBar\n// ---------------------------------------------------------------------------\n\nexport interface NavBarSearchBarProps {\n value: string;\n onChangeText: (next: string) => void;\n placeholder?: string;\n /** Called when the user submits the search (return key). */\n onSubmit?: () => void;\n /** Render a clear (X) button when value is non-empty. Default true. */\n clearable?: boolean;\n className?: string;\n testID?: string;\n}\n\n/**\n * Inline search input meant to occupy the title slot on a search results\n * screen. For a sticky search-below-the-header pattern, prefer the\n * standalone <NativeSearchBar> primitive.\n */\nexport function NavBarSearchBar({\n value,\n onChangeText,\n placeholder = \"Search\",\n onSubmit,\n clearable = true,\n className,\n testID,\n}: NavBarSearchBarProps) {\n return (\n <View\n testID={testID ?? \"nav-bar-search\"}\n className={cn(\n \"min-h-[36px] flex-row items-center rounded-full bg-muted px-3\",\n className\n )}\n >\n <TextInput\n testID={testID ? `${testID}-input` : undefined}\n accessibilityLabel={placeholder}\n value={value}\n onChangeText={onChangeText}\n onSubmitEditing={onSubmit}\n placeholder={placeholder}\n placeholderTextColor={nativeColors.neutral[400]}\n returnKeyType=\"search\"\n autoCorrect={false}\n autoCapitalize=\"none\"\n clearButtonMode={clearable ? \"while-editing\" : \"never\"}\n className=\"flex-1 text-base text-foreground\"\n />\n {clearable && value.length > 0 ? (\n <Pressable\n testID={testID ? `${testID}-clear` : undefined}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Clear search\"\n onPress={() => onChangeText(\"\")}\n hitSlop={8}\n className=\"ml-2 px-1\"\n >\n <Text className=\"text-base text-muted-foreground\">×</Text>\n </Pressable>\n ) : null}\n </View>\n );\n}\n","/**\n * SettingsPage — top-level settings layout.\n *\n * Composes `<ScreenContainer scroll>` underneath, renders a sectioned\n * `ListItem` list, and surfaces an optional dangerous-action footer\n * (e.g., \"Sign out\", \"Delete account\") in destructive tone.\n *\n * Why ship a layout: every consumer rebuilds this list with the same\n * three pieces (sections → rows → footer). Genesis ships the assembly so\n * consumers compose, not rebuild.\n *\n * Layer-3 customization: pass `headerTitle`, `headerLeft`, `headerRight`,\n * `large`, `scrollEdgeBehavior`, OR a direct `headerOptions={...}`\n * passthrough. The composed options are rendered via the consumer's own\n * `<Stack.Screen options={...}>` — see `getStackScreenOptions()` helper.\n *\n * Colors come from theme roles (`useThemeRoles`). On iOS it is the Settings\n * app's inset grouped style: the page is `systemGroupedBackground`, each\n * section a rounded group of cells on `secondarySystemGroupedBackground` with\n * hairline `separator` lines between cells, inset from the leading edge to\n * the cell text; the header is an uppercase footnote in `secondaryLabel`\n * above the group and the footnote sits under it in the same color. On\n * Android, cells are full width and the header is a Material subheader in the\n * theme's primary color. Neither platform draws a band or a rule behind a\n * header. Cell content itself is `NativeListItem`'s.\n *\n * Slots: replace or drop one part without leaving the layout. `slots`\n * swaps a part (`sectionHeader`, `row`, `footnote`, `dangerousActions`) for\n * your component, which receives exactly the props the default would;\n * `slotProps` feeds the default more props; `null` drops the part.\n *\n * Escape hatch: drop down to `<ScreenContainer>` if the layout structure\n * doesn't fit.\n *\n * @stability Beta\n */\nimport { Fragment, useState, type ReactNode } from \"react\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport { Platform, StyleSheet, View } from \"react-native\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\nimport { NativeListItem } from \"../components/list-item\";\nimport { NativeText } from \"../components/text\";\nimport { NativeButton } from \"../components/button\";\nimport { cn } from \"../utils\";\nimport {\n ScreenContainer,\n composeHeaderOptions,\n type ScreenHeaderProps,\n} from \"./screen-container\";\n\nexport interface SettingsPageRow {\n /** Stable id for keying. */\n id: string;\n title: string;\n subtitle?: string;\n /** Leading slot (icon, avatar, etc.). */\n leading?: ReactNode;\n /** Trailing slot (badge, switch, version string, etc.). */\n trailing?: ReactNode;\n /** When true, renders a chevron at the row end (drill-in affordance). */\n showChevron?: boolean;\n /** Press handler — required for chevron rows. */\n onPress?: () => void;\n /** Disable the row (greyed + non-pressable). */\n disabled?: boolean;\n /** testID override for the row. Falls back to `settings-row-<id>`. */\n testID?: string;\n}\n\nexport interface SettingsPageSection {\n /** Stable id for keying. */\n id: string;\n /** Optional uppercase section header. Pass `null` to skip the header for an unlabeled section. */\n title?: string;\n /** Optional caption rendered under the rows (compliance text, hint, etc.). */\n footnote?: string;\n /** Rows in render order. */\n rows: SettingsPageRow[];\n /**\n * Content rendered inside the section's group, after the rows: a part that\n * a pattern built on SettingsPage lets you replace (a block's slot), kept\n * under the same header, in the same group and above the same footnote.\n */\n children?: ReactNode;\n}\n\n/** A destructive-tone action in the footer, e.g. \"Sign out\". */\nexport interface SettingsPageDangerousAction {\n label: string;\n onPress: () => void;\n /** When true, renders with extra emphasis. Default `false`. */\n emphasized?: boolean;\n testID?: string;\n}\n\n/** The parts of a {@link SettingsPage} that `slots` and `slotProps` reach, with the props each receives. */\nexport type SettingsPageSlotMap = {\n sectionHeader: { title: string; testID: string };\n row: SettingsPageRow & { testID: string; isLast: boolean };\n footnote: { text: string };\n dangerousActions: { actions: SettingsPageDangerousAction[]; testID: string };\n};\n\nexport interface SettingsPageProps extends ScreenHeaderProps {\n /** Sectioned content. Order is preserved. */\n sections: SettingsPageSection[];\n /**\n * Optional dangerous-action row(s) shown after the last section in a\n * destructive-tone footer. Typical: \"Sign out\", \"Delete account\".\n */\n dangerousActions?: SettingsPageDangerousAction[];\n /** Replace (a component) or drop (`null`) one part. */\n slots?: Slots<SettingsPageSlotMap>;\n /** More props for a default part, merged over what the layout passes. */\n slotProps?: SlotPropsFor<SettingsPageSlotMap>;\n /** Override root container styling. */\n className?: string;\n /** testID on the root container. Default `\"settings-page\"`. */\n testID?: string;\n /** Pass-through children rendered ABOVE the first section (e.g., a profile card). */\n children?: ReactNode;\n}\n\n/**\n * Convenience helper for callers that want to wire `<Stack.Screen options={...}>`\n * without re-importing composeHeaderOptions. Defaults `large: true` and\n * `scrollEdgeBehavior: \"match\"` to match the Apple HIG large-title settings\n * pattern out of the box.\n */\nexport function getSettingsPageStackOptions(\n props: ScreenHeaderProps & { headerTitle?: string },\n): Record<string, unknown> {\n return composeHeaderOptions({\n headerTitle: props.headerTitle ?? \"Settings\",\n large: props.large ?? true,\n scrollEdgeBehavior: props.scrollEdgeBehavior ?? \"match\",\n headerLeft: props.headerLeft,\n headerRight: props.headerRight,\n headerOptions: props.headerOptions,\n });\n}\n\nexport function SettingsPage({\n sections,\n dangerousActions,\n className,\n testID = \"settings-page\",\n children,\n slots = {},\n slotProps = {},\n}: SettingsPageProps) {\n // Note: header props (headerTitle, headerLeft, headerRight, etc.) are\n // accepted on the type for API ergonomics but consumed by\n // getSettingsPageStackOptions() at the consumer's <Stack.Screen> level.\n const colors = useThemeRoles();\n const inset = Platform.OS === \"ios\";\n\n return (\n <ScreenContainer\n scroll\n safeAreaEdges={[\"left\", \"right\", \"bottom\"]}\n testID={testID}\n contentClassName=\"pb-8\"\n className={className}\n style={{ backgroundColor: colors.groupedBackground }}\n >\n {children ? <View className=\"px-4 pt-2\">{children}</View> : null}\n\n {sections.map((section) => (\n <View\n key={section.id}\n testID={`${testID}-section-${section.id}`}\n className=\"mt-6\"\n >\n {section.title\n ? renderSlot(\n DefaultSectionHeader,\n slots.sectionHeader,\n { title: section.title, testID: `${testID}-section-${section.id}-header` },\n slotProps.sectionHeader,\n )\n : null}\n <View\n testID={`${testID}-section-${section.id}-group`}\n className={inset ? \"overflow-hidden\" : \"border-y\"}\n style={[\n { backgroundColor: colors.surface, borderColor: colors.separator },\n inset ? { marginHorizontal: IOS_GROUP_MARGIN, borderRadius: iosGroupRadius() } : null,\n ]}\n >\n {section.rows.map((row, rowIndex) => (\n <Fragment key={row.id}>\n {renderSlot(\n DefaultRow,\n slots.row,\n { ...row, testID: row.testID ?? `${testID}-row-${row.id}`, isLast: rowIndex === section.rows.length - 1 },\n slotProps.row,\n )}\n </Fragment>\n ))}\n {section.children}\n </View>\n {section.footnote\n ? renderSlot(DefaultFootnote, slots.footnote, { text: section.footnote }, slotProps.footnote)\n : null}\n </View>\n ))}\n\n {dangerousActions && dangerousActions.length > 0\n ? renderSlot(\n DefaultDangerousActions,\n slots.dangerousActions,\n {\n actions: dangerousActions.map((action) => ({ ...action, testID: action.testID ?? `${testID}-danger-${slug(action.label)}` })),\n testID: `${testID}-dangerous-actions`,\n },\n slotProps.dangerousActions,\n )\n : null}\n </ScreenContainer>\n );\n}\n\n/** UIKit's inset grouped margin on a phone, in points. */\nconst IOS_GROUP_MARGIN = 16;\n\n/** UIKit's inset grouped corner radius: 10pt through iOS 18, 26pt from iOS 26. */\nfunction iosGroupRadius(): number {\n return Number.parseFloat(String(Platform.Version)) >= 26 ? 26 : 10;\n}\n\n/** From iOS 26 a separator also stops short of the trailing edge. */\nfunction iosTrailingSeparatorInset(): boolean {\n return Platform.OS === \"ios\" && Number.parseFloat(String(Platform.Version)) >= 26;\n}\n\n/**\n * iOS: the Settings app's inset grouped header, an uppercase footnote in\n * `secondaryLabel` on the page background. It sits over the group (same\n * margin) and is padded like a cell (`px-4`), so it lines up with the cell\n * text. Android: a Material list subheader in the brand's primary color\n * (`text-primary`, which follows the app's theme). Neither draws a band or a\n * rule. iOS reads uppercased text as written in capitals, so the label is the\n * title as written, and VoiceOver doesn't spell short words out.\n */\nfunction DefaultSectionHeader({ title, testID }: SettingsPageSlotMap[\"sectionHeader\"]) {\n const colors = useThemeRoles();\n if (Platform.OS === \"ios\") {\n return (\n <NativeText\n testID={testID}\n accessibilityRole=\"header\"\n accessibilityLabel={title}\n dynamicTypeRamp=\"footnote\"\n className=\"px-4 pb-1.5 pt-2\"\n style={{\n marginHorizontal: IOS_GROUP_MARGIN,\n color: colors.secondaryLabel,\n fontSize: 13,\n lineHeight: 18,\n textTransform: \"uppercase\",\n }}\n >\n {title}\n </NativeText>\n );\n }\n return (\n <NativeText\n testID={testID}\n accessibilityRole=\"header\"\n className=\"px-4 pb-2 pt-4 text-primary\"\n style={{ fontSize: 14, lineHeight: 20, fontWeight: \"500\" }}\n >\n {title}\n </NativeText>\n );\n}\n\nfunction DefaultRow({ isLast, id: _id, leading, ...row }: SettingsPageSlotMap[\"row\"]) {\n const colors = useThemeRoles();\n // A separator starts at the cell text: the same `px-4` (and `mr-3` past a\n // leading icon, measured once it lays out) as `NativeListItem`, so it lines\n // up whatever the NativeWind rem is. A row lays out start to end, so this\n // follows right-to-left layouts too.\n const [leadingWidth, setLeadingWidth] = useState(0);\n return (\n <>\n <NativeListItem\n testID={row.testID}\n // The cell wrapper carries the surface color from theme roles.\n className=\"bg-transparent\"\n title={row.title}\n subtitle={row.subtitle}\n leading={\n leading ? (\n <View onLayout={(event) => setLeadingWidth(event.nativeEvent.layout.width)}>{leading}</View>\n ) : undefined\n }\n trailing={row.trailing}\n showChevron={row.showChevron}\n onPress={row.onPress}\n disabled={row.disabled}\n />\n {isLast ? null : (\n <View\n testID={`${row.testID}-separator`}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n className=\"flex-row\"\n style={{ height: StyleSheet.hairlineWidth }}\n >\n <View className=\"w-4\" />\n {leading ? <View className=\"mr-3\" style={{ width: leadingWidth }} /> : null}\n <View testID={`${row.testID}-separator-line`} className=\"flex-1\" style={{ backgroundColor: colors.separator }} />\n {iosTrailingSeparatorInset() ? <View className=\"w-4\" /> : null}\n </View>\n )}\n </>\n );\n}\n\nfunction DefaultFootnote({ text }: SettingsPageSlotMap[\"footnote\"]) {\n const colors = useThemeRoles();\n if (Platform.OS === \"ios\") {\n return (\n <NativeText\n dynamicTypeRamp=\"footnote\"\n className=\"px-4 pt-1.5\"\n style={{ marginHorizontal: IOS_GROUP_MARGIN, color: colors.secondaryLabel, fontSize: 13, lineHeight: 18 }}\n >\n {text}\n </NativeText>\n );\n }\n return (\n <NativeText preset=\"body-sm\" className=\"px-4 pt-2\" style={{ color: colors.secondaryLabel }}>\n {text}\n </NativeText>\n );\n}\n\nfunction DefaultDangerousActions({ actions, testID }: SettingsPageSlotMap[\"dangerousActions\"]) {\n return (\n <View testID={testID} className={cn(\"mt-8 gap-2 px-4\")}>\n {actions.map((action) => (\n <NativeButton\n key={action.label}\n testID={action.testID}\n variant={action.emphasized ? \"destructive\" : \"outline\"}\n onPress={action.onPress}\n >\n {action.label}\n </NativeButton>\n ))}\n </View>\n );\n}\n\nfunction slug(s: string): string {\n return s\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-|-$/g, \"\");\n}\n","/**\n * Keyboard-aware scrolling for form screens. Expo recommends\n * react-native-keyboard-controller's `KeyboardAwareScrollView` over\n * `KeyboardAvoidingView` for real apps; it is an optional peer here, so an app\n * that has it passes it once:\n *\n * import { KeyboardAwareScrollView, KeyboardProvider, KeyboardToolbar } from \"react-native-keyboard-controller\";\n * <KeyboardProvider>\n * <KeyboardScrollProvider component={KeyboardAwareScrollView} toolbar={KeyboardToolbar}>…</KeyboardScrollProvider>\n * </KeyboardProvider>\n *\n * `KeyboardAwareScrollView` does nothing without react-native-keyboard-controller's\n * `KeyboardProvider` above it, mounted once at the root. (The native app\n * shell does both, with `keyboardProvider` and `keyboardScroll`.) Without a\n * scroll view here, form screens fall back to `KeyboardAvoidingView`.\n *\n * `toolbar` (optional, `KeyboardToolbar`) adds the previous / next / done bar\n * above the keyboard on Genesis's multi-field form layouts (`AuthScreen`,\n * `SettingsSubPage`). It needs `component` too: the bar sits beside the\n * keyboard-aware scroll view. Without it, nothing changes.\n *\n * @stability Beta\n */\nimport { createContext, createElement, useContext, useMemo, type ComponentType, type ReactNode } from \"react\";\nimport type { ViewStyle } from \"react-native\";\n\n/** The props Genesis passes to a keyboard-aware scroll view. */\nexport interface KeyboardScrollProps {\n children?: ReactNode;\n testID?: string;\n keyboardShouldPersistTaps?: \"always\" | \"never\" | \"handled\";\n contentContainerStyle?: ViewStyle;\n /** iOS: inset content under a translucent or large-title header, as `ScreenContainer` does. */\n contentInsetAdjustmentBehavior?: \"automatic\" | \"scrollableAxes\" | \"never\" | \"always\";\n /** Extra space between the focused input and the keyboard. */\n bottomOffset?: number;\n}\n\n/**\n * The props Genesis may pass to a keyboard toolbar, all optional and all\n * `KeyboardToolbar`'s own: a settings form passes none (previous / next /\n * done), a one-question form (forms-native's `FormFocus`) hides the arrows\n * and makes Done its Next or Send. To theme it, pass a wrapper defined at\n * module scope that renders it with your props and forwards these.\n */\nexport interface KeyboardToolbarProps {\n /** Show the previous / next arrows. `KeyboardToolbar`'s default is true. */\n showArrows?: boolean;\n /** The done button's label. */\n doneText?: ReactNode;\n /** Called when done is pressed. The keyboard closes too, unless the callback calls `event.preventDefault()`. */\n onDoneCallback?: (event: { preventDefault(): void }) => void;\n}\n\n/**\n * Height of react-native-keyboard-controller's `KeyboardToolbar`, kept clear\n * above the focused input. Mirrors `KEYBOARD_TOOLBAR_HEIGHT` in the library's\n * `src/components/KeyboardToolbar/constants.ts` (1.22): move them together.\n */\nexport const KEYBOARD_TOOLBAR_HEIGHT = 42;\n\ninterface KeyboardScrollValue {\n component: ComponentType<KeyboardScrollProps>;\n toolbar: ComponentType<KeyboardToolbarProps> | null;\n}\n\nconst KeyboardScrollContext = createContext<KeyboardScrollValue | null>(null);\n\nexport function KeyboardScrollProvider({\n component,\n toolbar,\n children,\n}: {\n component: ComponentType<KeyboardScrollProps>;\n /** `KeyboardToolbar` from react-native-keyboard-controller: previous / next / done above the keyboard. */\n toolbar?: ComponentType<KeyboardToolbarProps>;\n children: ReactNode;\n}) {\n const value = useMemo(() => ({ component, toolbar: toolbar ?? null }), [component, toolbar]);\n return createElement(KeyboardScrollContext.Provider, { value }, children);\n}\n\n/** The app's keyboard-aware scroll view, or null when none was provided. */\nexport function useKeyboardScroll(): ComponentType<KeyboardScrollProps> | null {\n return useContext(KeyboardScrollContext)?.component ?? null;\n}\n\n/** The app's keyboard toolbar, or null when none was provided (or no scroll view to go with it). */\nexport function useKeyboardToolbar(): ComponentType<KeyboardToolbarProps> | null {\n return useContext(KeyboardScrollContext)?.toolbar ?? null;\n}\n","/**\n * SettingsSubPage — drill-in detail layout.\n *\n * Composes a KeyboardAvoidingView + scroll + dirty-form leave warning +\n * optimistic-save pattern. The save action is surfaced in the nav bar via\n * a `<NavBarSaveButton>` rendered through `headerRight`.\n *\n * Why ship: the recurring shape is \"form fields + nav-bar Save + leave\n * guard\"; consumers re-implement this every time. Genesis ships the\n * shape so consumers focus on the form fields themselves.\n *\n * Layer-3 customization: pass `headerTitle`, `headerLeft`, OR a direct\n * `headerOptions={...}`. Use `getSettingsSubPageStackOptions()` to get a\n * `<Stack.Screen options={...}>` object (with the save button wired via\n * `headerRight`).\n *\n * @stability Beta\n */\nimport { useCallback, type ReactNode } from \"react\";\nimport { Alert, KeyboardAvoidingView, Platform, View } from \"react-native\";\nimport { cn } from \"../utils\";\nimport { KEYBOARD_TOOLBAR_HEIGHT, useKeyboardScroll, useKeyboardToolbar } from \"./keyboard\";\nimport {\n ScreenContainer,\n composeHeaderOptions,\n type ScreenHeaderProps,\n} from \"./screen-container\";\nimport { NavBarSaveButton } from \"./nav-bar\";\n\nexport interface SettingsSubPageProps extends ScreenHeaderProps {\n /** Form / detail body content. Pass any node tree. */\n children: ReactNode;\n /**\n * When true, the Save button is enabled and the back-confirm guard\n * fires when the user tries to leave. Mark `true` whenever the form\n * has unsaved changes.\n */\n dirty?: boolean;\n /** When true, the Save button shows a busy indicator and is non-pressable. */\n saving?: boolean;\n /** Save handler. Required to render a Save button in the nav bar. */\n onSave?: () => void | Promise<void>;\n /**\n * Confirm-leave hook. Implementations should integrate with the\n * navigator's `beforeRemove` listener (React Navigation) — Genesis\n * provides a default `Alert` confirm helper via `confirmDiscardChanges()`.\n * Pass null to opt OUT of the leave guard.\n */\n onConfirmLeave?: ((proceed: () => void) => void) | null;\n /** Save button label. Default `\"Save\"`. */\n saveLabel?: string;\n /** Override root container styling. */\n className?: string;\n /** testID on the root container. Default `\"settings-sub-page\"`. */\n testID?: string;\n}\n\n/**\n * Default leave-guard helper. Pops a native Alert with Discard / Keep\n * Editing buttons; calls `proceed()` only if the user opts to discard.\n *\n * <SettingsSubPage onConfirmLeave={confirmDiscardChanges} ... />\n */\nexport function confirmDiscardChanges(proceed: () => void): void {\n Alert.alert(\n \"Discard changes?\",\n \"You have unsaved changes. Leave this screen and lose them?\",\n [\n { text: \"Keep editing\", style: \"cancel\" },\n {\n text: \"Discard\",\n style: \"destructive\",\n onPress: () => proceed(),\n },\n ],\n );\n}\n\n/**\n * Compose `<Stack.Screen options={...}>` for a SettingsSubPage. Wires\n * the nav-bar Save button via `headerRight` automatically when `onSave`\n * is passed.\n */\nexport function getSettingsSubPageStackOptions(props: {\n headerTitle?: string;\n dirty?: boolean;\n saving?: boolean;\n onSave?: () => void | Promise<void>;\n saveLabel?: string;\n large?: boolean;\n scrollEdgeBehavior?: ScreenHeaderProps[\"scrollEdgeBehavior\"];\n headerLeft?: ScreenHeaderProps[\"headerLeft\"];\n headerRight?: ScreenHeaderProps[\"headerRight\"];\n headerOptions?: ScreenHeaderProps[\"headerOptions\"];\n}): Record<string, unknown> {\n const {\n headerTitle,\n dirty,\n saving,\n onSave,\n saveLabel = \"Save\",\n large = false,\n scrollEdgeBehavior,\n headerLeft,\n headerRight,\n headerOptions,\n } = props;\n\n // Auto-wire headerRight with save button if not overridden.\n const resolvedHeaderRight =\n headerRight ??\n (onSave\n ? () => (\n <NavBarSaveButton\n label={saveLabel}\n onPress={() => {\n void onSave();\n }}\n disabled={!dirty}\n loading={saving}\n />\n )\n : undefined);\n\n return composeHeaderOptions({\n headerTitle,\n headerLeft,\n headerRight: resolvedHeaderRight,\n large,\n scrollEdgeBehavior,\n headerOptions,\n });\n}\n\nexport function SettingsSubPage({\n children,\n onConfirmLeave,\n className,\n testID = \"settings-sub-page\",\n}: SettingsSubPageProps) {\n // Note: dirty / saving / onSave / saveLabel / screen header props are\n // consumed by getSettingsSubPageStackOptions() at the consumer level —\n // SettingsSubPage itself is intentionally minimal so the same component\n // works for both pure form pages AND screens with Stack.Screen options\n // wired separately. We only render the body chrome here.\n //\n // The actual `beforeRemove` wire-up lives at the consumer's navigator\n // level — they call `useNavigation().addListener('beforeRemove', ...)`\n // and inside the callback they invoke `props.onConfirmLeave(proceed)`.\n // We expose `confirmDiscardChanges()` as the canonical helper so\n // consumers get the leave-guard semantics for free.\n const _onConfirmLeave = useCallback(\n (proceed: () => void) => {\n if (onConfirmLeave === null) {\n proceed();\n return;\n }\n const fn = onConfirmLeave ?? confirmDiscardChanges;\n fn(proceed);\n },\n [onConfirmLeave],\n );\n void _onConfirmLeave;\n\n const KeyboardScroll = useKeyboardScroll();\n const KeyboardToolbar = useKeyboardToolbar();\n if (KeyboardScroll) {\n // No bottom edge here: the toolbar sticks to the keyboard from the container's bottom, so a\n // bottom inset (the home indicator, or a tab bar's height) would float it that far above the\n // keyboard, and leave it showing above the tab bar with the keyboard closed. The scroll view's\n // automatic content inset keeps the last field clear of the bottom instead.\n return (\n <ScreenContainer safeAreaEdges={[\"left\", \"right\"]} testID={testID}>\n <KeyboardScroll\n testID={`${testID}-keyboard`}\n keyboardShouldPersistTaps=\"handled\"\n contentInsetAdjustmentBehavior=\"automatic\"\n bottomOffset={KeyboardToolbar ? 24 + KEYBOARD_TOOLBAR_HEIGHT : 24}\n >\n {/* Same padding and className as the fallback path, so `className` overrides it the same way. */}\n <View className={cn(\"p-4\", className)}>\n <View testID={`${testID}-form`} className=\"gap-4\">\n {children}\n </View>\n </View>\n </KeyboardScroll>\n {KeyboardToolbar ? <KeyboardToolbar /> : null}\n </ScreenContainer>\n );\n }\n return (\n <KeyboardAvoidingView\n testID={`${testID}-kav`}\n style={{ flex: 1 }}\n behavior={Platform.OS === \"ios\" ? \"padding\" : undefined}\n >\n <ScreenContainer\n scroll\n safeAreaEdges={[\"left\", \"right\", \"bottom\"]}\n testID={testID}\n contentClassName={cn(\"p-4\", className)}\n keyboardShouldPersistTaps=\"handled\"\n >\n <View testID={`${testID}-form`} className=\"gap-4\">\n {children}\n </View>\n </ScreenContainer>\n </KeyboardAvoidingView>\n );\n}\n","/**\n * NotificationsPage — feed-style notifications list.\n *\n * Composes:\n * - SectionList grouped by relative date (Today / Yesterday / Earlier)\n * - Pull-to-refresh\n * - Empty state slot (auto-rendered when `items` is empty)\n * - Mark-all-read action surfaced via `headerRight` helper\n * - Per-row \"mark read\" action exposed via the consumer's row press\n * (swipe-to-mark-read is documented as Maestro / E2E only because it\n * requires gesture-handler — consumers wire it via their own row\n * wrapper; this layout exposes the unread state via row props).\n *\n * Slots: replace or drop (`null`) `sectionHeader`, `row` or `empty`\n * through `slots`; feed a default part through `slotProps`.\n *\n * Header customization: `headerTitle`, `headerLeft`, `headerRight`,\n * `headerOptions`. Use `getNotificationsPageStackOptions()` to wire a\n * \"Mark all read\" action via `headerRight` automatically.\n *\n * @stability Beta\n */\nimport { useCallback, useContext, useMemo, type ReactNode } from \"react\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport {\n Platform,\n Pressable,\n RefreshControl,\n ScrollView,\n SectionList,\n Text,\n View,\n} from \"react-native\";\nimport { SafeAreaInsetsContext, SafeAreaView } from \"react-native-safe-area-context\";\nimport { NativeSectionListHeader } from \"../components/section-list\";\nimport { NativeListItem } from \"../components/list-item\";\nimport { NativeEmptyState } from \"../components/empty-state\";\nimport { cn } from \"../utils\";\nimport { useGenesisModules } from \"../native-modules\";\nimport {\n composeHeaderOptions,\n type ScreenHeaderProps,\n} from \"./screen-container\";\n\nexport interface NotificationItem {\n /** Stable id. */\n id: string;\n /** Headline text. */\n title: string;\n /** Optional secondary line. */\n body?: string;\n /** ISO date string OR Date instance. Used for grouping. */\n timestamp: string | Date;\n /** Read flag. Unread rows render with emphasis (a leading dot). */\n unread?: boolean;\n /** Optional press handler — typically opens the related screen. */\n onPress?: () => void;\n /** Optional leading slot (avatar / icon). */\n leading?: ReactNode;\n /** testID override. Falls back to `notifications-row-<id>`. */\n testID?: string;\n}\n\n/** The parts of a {@link NotificationsPage} that `slots` and `slotProps` reach. */\nexport type NotificationsPageSlotMap = {\n sectionHeader: { title: string };\n row: NotificationItem & { testID: string };\n empty: { title: string; body: string; testID: string };\n};\n\nexport interface NotificationsPageProps extends ScreenHeaderProps {\n /** Notification items. Empty array → empty state. */\n items: NotificationItem[];\n /** When true, the SectionList shows the refresh spinner. */\n refreshing?: boolean;\n /** Pull-to-refresh handler. */\n onRefresh?: () => void | Promise<void>;\n /** Mark-all-read handler. When provided, exposes a header action. */\n onMarkAllRead?: () => void;\n /** Override the auto-rendered empty state. Prefer `slots.empty`. */\n emptyState?: ReactNode;\n /** Replace (a component) or drop (`null`) one part. */\n slots?: Slots<NotificationsPageSlotMap>;\n /** More props for a default part, merged over what the layout passes. */\n slotProps?: SlotPropsFor<NotificationsPageSlotMap>;\n /** Optional override of the empty-state title. */\n emptyTitle?: string;\n /** Optional override of the empty-state body copy. */\n emptyBody?: string;\n /**\n * Where a section header sticks, in points from the top of the list. Under a large-title header\n * (`getNotificationsPageStackOptions`' default) the list runs under the native header (iOS\n * insets its rows, and the title collapses as it scrolls), so a header stuck at 0 would sit\n * under the status bar. Default on iOS: under the collapsed navigation bar of an iPhone in\n * portrait (`defaultStickyHeaderOffset`); elsewhere 0. Pass 0 when the list starts below an\n * opaque header (a standard one before iOS 26), the safe area's top with no header, and your own\n * value on iPad (a 50 pt bar) or in landscape (32 pt).\n */\n stickyHeaderOffset?: number;\n /** Override root container styling. */\n className?: string;\n /** testID on the root container. Default `\"notifications-page\"`. */\n testID?: string;\n}\n\n/**\n * Compose `<Stack.Screen options={...}>` for a NotificationsPage. Wires\n * a \"Mark all read\" action via `headerRight` when `onMarkAllRead` is\n * passed.\n */\nexport function getNotificationsPageStackOptions(props: {\n headerTitle?: string;\n onMarkAllRead?: () => void;\n large?: boolean;\n scrollEdgeBehavior?: ScreenHeaderProps[\"scrollEdgeBehavior\"];\n headerLeft?: ScreenHeaderProps[\"headerLeft\"];\n headerRight?: ScreenHeaderProps[\"headerRight\"];\n headerOptions?: ScreenHeaderProps[\"headerOptions\"];\n}): Record<string, unknown> {\n const {\n headerTitle,\n onMarkAllRead,\n large,\n scrollEdgeBehavior,\n headerLeft,\n headerRight,\n headerOptions,\n } = props;\n\n const resolvedHeaderRight =\n headerRight ??\n (onMarkAllRead\n ? () => (\n <Pressable\n testID=\"notifications-mark-all-read\"\n accessibilityRole=\"button\"\n accessibilityLabel=\"Mark all read\"\n onPress={onMarkAllRead}\n hitSlop={8}\n className=\"min-h-[44px] justify-center px-3\"\n >\n <Text className=\"text-base text-primary\">Mark all read</Text>\n </Pressable>\n )\n : undefined);\n\n return composeHeaderOptions({\n headerTitle: headerTitle ?? \"Notifications\",\n headerLeft,\n headerRight: resolvedHeaderRight,\n large: large ?? true,\n scrollEdgeBehavior: scrollEdgeBehavior ?? \"match\",\n headerOptions,\n });\n}\n\n// Returns a stable section title for a timestamp. Computes against the\n// caller's local clock for consistency with the rest of the app.\nfunction bucketFor(ts: string | Date, now = new Date()): string {\n const d = typeof ts === \"string\" ? new Date(ts) : ts;\n const startOfDay = (date: Date) => {\n const x = new Date(date);\n x.setHours(0, 0, 0, 0);\n return x.getTime();\n };\n const today = startOfDay(now);\n const yesterday = today - 24 * 60 * 60 * 1000;\n const day = startOfDay(d);\n if (day === today) return \"Today\";\n if (day === yesterday) return \"Yesterday\";\n return \"Earlier\";\n}\n\ninterface Section {\n title: string;\n data: NotificationItem[];\n}\n\nfunction groupByDate(items: NotificationItem[], now = new Date()): Section[] {\n const map = new Map<string, NotificationItem[]>();\n // Iterate in input order so stable sort within bucket.\n for (const item of items) {\n const bucket = bucketFor(item.timestamp, now);\n const arr = map.get(bucket) ?? [];\n arr.push(item);\n map.set(bucket, arr);\n }\n // Stable section order: Today / Yesterday / Earlier.\n const order = [\"Today\", \"Yesterday\", \"Earlier\"];\n return order\n .filter((title) => map.has(title))\n .map((title) => ({\n title,\n data: map.get(title) ?? [],\n }));\n}\n\ntype FlatRow = { kind: \"header\"; title: string } | { kind: \"item\"; item: NotificationItem; last: boolean };\n\nfunction flattenSections(sections: Section[]): { rows: FlatRow[]; headerIndices: number[] } {\n const rows: FlatRow[] = [];\n const headerIndices: number[] = [];\n for (const section of sections) {\n headerIndices.push(rows.length);\n rows.push({ kind: \"header\", title: section.title });\n section.data.forEach((item, i) => rows.push({ kind: \"item\", item, last: i === section.data.length - 1 }));\n }\n return { rows, headerIndices };\n}\n\nfunction flatRowKey(row: FlatRow) {\n return row.kind === \"header\" ? `header:${row.title}` : row.item.id;\n}\n\n/** A row with its separator and the section's last row differ in height: separate recycling pools. */\nfunction flatRowType(row: FlatRow) {\n return row.kind === \"header\" ? \"header\" : row.last ? \"item-last\" : \"item\";\n}\n\nconst NO_SLOTS = {};\n\n/**\n * The height of iOS's compact navigation bar, below the status bar: 44 pt up to iOS 18, 54 pt\n * from iOS 26 (measured on an iOS 26 simulator, the collapsed large-title bar of a native stack).\n */\nexport function iosCompactNavigationBarHeight(version: number | string): number {\n const major = typeof version === \"number\" ? version : parseInt(version, 10);\n return Number.isFinite(major) && major >= 26 ? 54 : 44;\n}\n\n/**\n * Where a list's section headers stick by default: on iOS, the bottom of the collapsed\n * navigation bar (the safe area's top plus the compact bar), since the list runs under the\n * header; elsewhere 0 (the header sits above the list).\n */\nexport function defaultStickyHeaderOffset(os: string, version: number | string, safeAreaTop: number): number {\n return os === \"ios\" ? safeAreaTop + iosCompactNavigationBarHeight(version) : 0;\n}\n\n// Expose internal helpers for unit tests via a side-channel export.\nexport const __test = { bucketFor, groupByDate, flattenSections };\n\nexport function NotificationsPage({\n items,\n refreshing,\n onRefresh,\n emptyState,\n emptyTitle,\n emptyBody,\n className,\n testID = \"notifications-page\",\n slots = NO_SLOTS,\n slotProps = NO_SLOTS,\n stickyHeaderOffset,\n}: NotificationsPageProps) {\n // The context, not useSafeAreaInsets(): before a provider has measured (tests, the first frame) it is null, not a throw.\n const safeTop = useContext(SafeAreaInsetsContext)?.top ?? 0;\n const stickAt = stickyHeaderOffset ?? defaultStickyHeaderOffset(Platform.OS, Platform.Version, safeTop);\n // Note: header props (headerTitle, headerLeft, headerRight, large,\n // scrollEdgeBehavior, headerOptions) are accepted on the type for API\n // ergonomics but consumed by getNotificationsPageStackOptions() at the\n // consumer's <Stack.Screen> level — not by this component.\n\n const sections = useMemo(() => groupByDate(items), [items]);\n // FlashList v2 (`modules.list`) has no SectionList: the sections become one\n // flat list whose header rows stick (FlashList's own section-list recipe).\n const { list: FlashList } = useGenesisModules();\n const flat = useMemo(() => flattenSections(sections), [sections]);\n // Stable, so a parent re-render doesn't re-render every visible cell.\n const renderFlatRow = useCallback(\n ({ item: row }: { item: FlatRow }) =>\n row.kind === \"header\" ? (\n renderSlot(DefaultSectionHeader, slots.sectionHeader, { title: row.title }, slotProps.sectionHeader)\n ) : (\n <>\n {renderSlot(DefaultRow, slots.row, { ...row.item, testID: row.item.testID ?? `${testID}-row-${row.item.id}` }, slotProps.row)}\n {row.last ? null : <RowSeparator />}\n </>\n ),\n [slots, slotProps, testID],\n );\n\n if (items.length === 0) {\n // A scroll view, like the lists below: iOS insets only scroll views for the large-title\n // header and the tab bar, so a plain view would sit under the header (and the Dynamic Island).\n return (\n <SafeAreaView\n testID={testID}\n edges={[\"left\", \"right\", \"bottom\"]}\n className={cn(\"flex-1 bg-background\", className)}\n >\n <ScrollView\n testID={`${testID}-empty-scroll`}\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={{ flexGrow: 1, justifyContent: \"center\" }}\n refreshControl={\n onRefresh ? (\n <RefreshControl testID={`${testID}-refresh`} refreshing={!!refreshing} onRefresh={onRefresh} />\n ) : undefined\n }\n >\n {emptyState ??\n renderSlot(\n DefaultEmpty,\n slots.empty,\n {\n title: emptyTitle ?? \"No notifications\",\n body: emptyBody ?? \"When you get a notification, it'll show up here.\",\n testID: `${testID}-empty`,\n },\n slotProps.empty,\n )}\n </ScrollView>\n </SafeAreaView>\n );\n }\n\n if (FlashList) {\n return (\n <SafeAreaView\n testID={testID}\n edges={[\"left\", \"right\", \"bottom\"]}\n className={cn(\"flex-1 bg-background\", className)}\n >\n <FlashList\n testID={`${testID}-list`}\n data={flat.rows}\n keyExtractor={flatRowKey}\n getItemType={flatRowType}\n stickyHeaderIndices={flat.headerIndices}\n // Under the native header, not under the status bar.\n stickyHeaderConfig={{ offset: stickAt }}\n renderItem={renderFlatRow}\n refreshing={onRefresh ? !!refreshing : undefined}\n onRefresh={onRefresh ? () => void onRefresh() : undefined}\n contentContainerStyle={{ paddingBottom: 28 }}\n />\n </SafeAreaView>\n );\n }\n\n return (\n <SafeAreaView\n testID={testID}\n edges={[\"left\", \"right\", \"bottom\"]}\n className={cn(\"flex-1 bg-background\", className)}\n >\n <SectionList<NotificationItem, Section>\n testID={`${testID}-list`}\n sections={sections}\n keyExtractor={(item) => item.id}\n renderSectionHeader={({ section }) =>\n renderSlot(DefaultSectionHeader, slots.sectionHeader, { title: section.title }, slotProps.sectionHeader)\n }\n renderItem={({ item }) =>\n renderSlot(DefaultRow, slots.row, { ...item, testID: item.testID ?? `${testID}-row-${item.id}` }, slotProps.row)\n }\n ItemSeparatorComponent={RowSeparator}\n // React Native's sticky headers pin to the very top of the list, which is under the native\n // header on iOS, with no offset to move them down: with one, the headers scroll with\n // their rows instead. (FlashList, `modules.list`, sticks them under the header.)\n stickySectionHeadersEnabled={stickAt === 0}\n refreshControl={\n onRefresh ? (\n <RefreshControl\n testID={`${testID}-refresh`}\n refreshing={!!refreshing}\n onRefresh={onRefresh}\n />\n ) : undefined\n }\n contentContainerClassName=\"pb-8\"\n />\n </SafeAreaView>\n );\n}\n\nfunction RowSeparator() {\n return <View className=\"h-px bg-border ml-4\" />;\n}\n\nfunction DefaultSectionHeader({ title }: NotificationsPageSlotMap[\"sectionHeader\"]) {\n return <NativeSectionListHeader title={title} />;\n}\n\nfunction DefaultRow(item: NotificationsPageSlotMap[\"row\"]) {\n return (\n <NativeListItem\n testID={item.testID}\n title={item.title}\n subtitle={item.body}\n leading={item.leading ?? <UnreadDot unread={!!item.unread} testID={`${item.testID}-unread`} />}\n onPress={item.onPress}\n />\n );\n}\n\nfunction DefaultEmpty({ title, body, testID }: NotificationsPageSlotMap[\"empty\"]) {\n return <NativeEmptyState variant=\"first-run\" title={title} body={body} testID={testID} />;\n}\n\nfunction UnreadDot({\n unread,\n testID,\n}: {\n unread: boolean;\n testID?: string;\n}) {\n if (!unread) {\n return <View className=\"h-2 w-2\" testID={testID} />;\n }\n return (\n <View\n testID={testID}\n accessibilityLabel=\"Unread\"\n className=\"h-2 w-2 rounded-full bg-primary\"\n />\n );\n}\n","/**\n * InboxPage — a list of conversations or tickets: unread state, a time, a\n * preview line, swipe actions, pull to refresh, paging and an empty state.\n *\n * Generic: the rows are whatever the app has (support reports, direct\n * messages, an idea board). Data and actions come in as props; the layout\n * draws them the platform's way. On iOS it is the Settings app's inset\n * grouped style, like `SettingsPage`: the page is `groupedBackground`, the\n * rows one rounded group on `surface` with hairline separators that start at\n * the text. On Android rows are full width.\n *\n * Swipe actions: each row's `swipeActions` are always reachable without a\n * gesture library, as VoiceOver / TalkBack custom actions and on long press\n * (a menu). For the swipe itself, fill the `swipeable` slot with your\n * gesture-handler wrapper (`ReanimatedSwipeable` from\n * react-native-gesture-handler, an optional peer); it receives the actions\n * and the row.\n *\n * Rows: `avatar` puts a picture of who it is between the unread dot and the\n * text (an unread count shows at the end of the row, as in Mail); `leading`\n * replaces the dot.\n *\n * Slots: `row`, `swipeable`, `header` (above the group), `footer` (below it,\n * the paging spinner by default) and `empty`. `slots` swaps a part for your\n * component (same props), `slotProps` feeds the default more props, `null`\n * drops it.\n *\n * Header: `getInboxPageStackOptions()` for `<Stack.Screen options>`.\n *\n * @stability Beta\n */\nimport { Fragment, useState, type ReactNode } from \"react\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport { Alert, FlatList, Platform, Pressable, ScrollView, StyleSheet, View } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\nimport { NativeEmptyState } from \"../components/empty-state\";\nimport { NativeText } from \"../components/text\";\nimport { NativeButton } from \"../components/button\";\nimport { NativeBadge } from \"../components/badge\";\nimport { NativeRefreshControl } from \"../components/refresh-control\";\nimport { NativeLoadingState } from \"../components/loading-state\";\nimport { composeHeaderOptions, type ScreenHeaderProps } from \"./screen-container\";\n\n/** An action on a row: swipe, long press, or an accessibility action. */\nexport interface InboxSwipeAction {\n id: string;\n label: string;\n onPress: () => void;\n /** Destructive tone (delete, leave). */\n destructive?: boolean;\n}\n\nexport interface InboxItem {\n /** Stable id for keying. */\n id: string;\n title: string;\n /** The latest message or a summary, at most two lines. */\n preview?: string;\n /** When it last changed. Shown as a short time or date. */\n timestamp?: string | Date;\n /** Something new the person hasn't read: a dot, and the title in bold. */\n unread?: boolean;\n /** How many unread messages; shown as a count instead of the dot when above 0. */\n unreadCount?: number;\n /** A short status shown under the preview (\"In progress\", \"12 votes\"). */\n meta?: string;\n /** Replaces the unread dot (an icon). For a picture of who it is, use `avatar`, which keeps the dot. */\n leading?: ReactNode;\n /**\n * A picture of who or what it is (a `NativeAvatar`, about 40pt), between the\n * unread dot and the text. The separator then starts at the text. It is hidden\n * from screen readers; when it shows someone `title` doesn't name, say who in\n * `avatarLabel`.\n */\n avatar?: ReactNode;\n /** Who the avatar shows, read before the title, when `title` doesn't name them. */\n avatarLabel?: string;\n /** Shown at the end of the row (a vote button, a badge). Replaces the chevron. */\n trailing?: ReactNode;\n /** Opens the conversation. Rows with `onPress` show a chevron unless `trailing` is set. */\n onPress?: () => void;\n swipeActions?: InboxSwipeAction[];\n /** testID override. Default `<page testID>-row-<id>`. */\n testID?: string;\n}\n\n/** The parts `slots` and `slotProps` reach, with the props each receives. */\nexport type InboxPageSlotMap = {\n row: InboxItem & { testID: string; isFirst: boolean; isLast: boolean; timeLabel: string | null };\n swipeable: { actions: InboxSwipeAction[]; testID: string; children?: ReactNode };\n header: { testID: string };\n footer: { loadingMore: boolean; testID: string };\n empty: { title: string; body: string; actionLabel?: string; onAction?: () => void; testID: string };\n};\n\nexport interface InboxPageProps extends ScreenHeaderProps {\n /** Newest first, as they should show. Empty → the empty state. */\n items: InboxItem[];\n refreshing?: boolean;\n onRefresh?: () => void | Promise<void>;\n /** Called near the end of the list, to load the next page. */\n onEndReached?: () => void;\n /** A next page is loading: the default footer shows a spinner. */\n loadingMore?: boolean;\n /** Above the group (a filter, a call to action). Prefer `slots.header` for a component. */\n header?: ReactNode;\n /** An optional title over the group, in the Settings header style. */\n sectionTitle?: string;\n emptyTitle?: string;\n emptyBody?: string;\n /** The first page is loading: a spinner instead of the empty state. */\n loading?: boolean;\n /** The read failed: the empty slot shows `errorTitle` / `errorBody` instead (and pull to refresh retries). */\n error?: boolean;\n errorTitle?: string;\n errorBody?: string;\n /** A button in the empty state (\"Send feedback\"). */\n emptyActionLabel?: string;\n onEmptyAction?: () => void;\n /** How a row's time reads. Default: the time today, \"Yesterday\", the weekday this week, else the date. */\n formatTime?: (date: Date, now: Date) => string;\n /** The clock, for tests. */\n now?: () => Date;\n slots?: Slots<InboxPageSlotMap>;\n slotProps?: SlotPropsFor<InboxPageSlotMap>;\n /** testID on the root. Default `\"inbox-page\"`. */\n testID?: string;\n}\n\n/** `<Stack.Screen options>` for an InboxPage: a large title that collapses on scroll. */\nexport function getInboxPageStackOptions(props: ScreenHeaderProps & { headerTitle?: string }): Record<string, unknown> {\n return composeHeaderOptions({\n headerTitle: props.headerTitle ?? \"Inbox\",\n large: props.large ?? true,\n scrollEdgeBehavior: props.scrollEdgeBehavior ?? \"match\",\n headerLeft: props.headerLeft,\n headerRight: props.headerRight,\n headerOptions: props.headerOptions,\n });\n}\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\n/** The default row time: `9:41`, `Yesterday`, `Monday`, then a short date. */\nexport function formatInboxTime(date: Date, now: Date): string {\n const start = (d: Date) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();\n const days = Math.round((start(now) - start(date)) / DAY_MS);\n if (days <= 0) return date.toLocaleTimeString(undefined, { hour: \"numeric\", minute: \"2-digit\" });\n if (days === 1) return \"Yesterday\";\n if (days < 7) return date.toLocaleDateString(undefined, { weekday: \"long\" });\n return date.toLocaleDateString(undefined, { day: \"numeric\", month: \"short\", year: date.getFullYear() === now.getFullYear() ? undefined : \"numeric\" });\n}\n\n/** The row's leading padding, the unread dot's column, an avatar's default size and its gap to the text. */\nconst ROW_PADDING = 16;\nconst LEADING_WIDTH = 18;\nconst DEFAULT_AVATAR = 40;\nconst AVATAR_GAP = 12;\n\n/** UIKit's inset grouped margin on a phone, in points (as SettingsPage). */\nconst IOS_GROUP_MARGIN = 16;\n\nfunction iosGroupRadius(): number {\n return Number.parseFloat(String(Platform.Version)) >= 26 ? 26 : 10;\n}\n\nexport function InboxPage({\n items,\n refreshing,\n onRefresh,\n onEndReached,\n loadingMore = false,\n header,\n sectionTitle,\n emptyTitle,\n emptyBody,\n emptyActionLabel,\n onEmptyAction,\n loading = false,\n error = false,\n errorTitle,\n errorBody,\n formatTime = formatInboxTime,\n now = () => new Date(),\n slots = {},\n slotProps = {},\n testID = \"inbox-page\",\n}: InboxPageProps) {\n const colors = useThemeRoles();\n const clock = now();\n const rows: InboxPageSlotMap[\"row\"][] = items.map((item, index) => ({\n ...item,\n testID: item.testID ?? `${testID}-row-${item.id}`,\n isFirst: index === 0,\n isLast: index === items.length - 1,\n timeLabel: item.timestamp ? formatTime(typeof item.timestamp === \"string\" ? new Date(item.timestamp) : item.timestamp, clock) : null,\n }));\n\n const headerNode = (\n <View>\n {header ?? renderSlot(EmptyPart, slots.header, { testID: `${testID}-header` }, slotProps.header)}\n {sectionTitle ? <SectionTitle title={sectionTitle} testID={`${testID}-section-title`} /> : null}\n </View>\n );\n\n const refreshControl = onRefresh ? <NativeRefreshControl testID={`${testID}-refresh`} refreshing={!!refreshing} onRefresh={() => void onRefresh()} /> : undefined;\n\n if (items.length === 0) {\n // A scroll view, not a plain view: under a large-title (or translucent) header only a\n // scroll view's automatic content inset moves the content below the header, and pull to\n // refresh needs one too.\n return (\n <SafeAreaView testID={testID} edges={[\"left\", \"right\", \"bottom\"]} style={{ flex: 1, backgroundColor: colors.groupedBackground }}>\n <ScrollView\n testID={`${testID}-empty-scroll`}\n contentInsetAdjustmentBehavior=\"automatic\"\n keyboardShouldPersistTaps=\"handled\"\n contentContainerStyle={{ flexGrow: 1, paddingTop: 8, paddingBottom: 32 }}\n refreshControl={refreshControl}\n >\n {headerNode}\n {loading ? (\n <NativeLoadingState fullScreen={false} testID={`${testID}-loading`} />\n ) : (\n renderSlot(\n DefaultEmpty,\n slots.empty,\n error\n ? {\n title: errorTitle ?? \"Couldn't load this\",\n body: errorBody ?? \"Check your connection, then pull to refresh.\",\n actionLabel: onRefresh ? \"Try again\" : undefined,\n onAction: onRefresh ? () => void onRefresh() : undefined,\n testID: `${testID}-error`,\n }\n : {\n title: emptyTitle ?? \"Nothing here yet\",\n body: emptyBody ?? \"When there's something new, it shows up here.\",\n actionLabel: emptyActionLabel,\n onAction: onEmptyAction,\n testID: `${testID}-empty`,\n },\n slotProps.empty,\n )\n )}\n </ScrollView>\n </SafeAreaView>\n );\n }\n\n return (\n <SafeAreaView testID={testID} edges={[\"left\", \"right\", \"bottom\"]} style={{ flex: 1, backgroundColor: colors.groupedBackground }}>\n <FlatList\n testID={`${testID}-list`}\n data={rows}\n keyExtractor={(row) => row.id}\n contentInsetAdjustmentBehavior=\"automatic\"\n // The header can hold a text field (the idea board's \"Suggest\"): its button's first tap\n // must press it, not only close the keyboard.\n keyboardShouldPersistTaps=\"handled\"\n ListHeaderComponent={headerNode}\n ListFooterComponent={renderSlot(DefaultFooter, slots.footer, { loadingMore, testID: `${testID}-footer` }, slotProps.footer)}\n contentContainerStyle={{ paddingTop: 8, paddingBottom: 32 }}\n onEndReached={onEndReached}\n onEndReachedThreshold={0.5}\n refreshControl={refreshControl}\n renderItem={({ item: row }) => {\n const content = renderSlot(DefaultRow, slots.row, row, slotProps.row);\n const actions = row.swipeActions ?? [];\n return (\n <Fragment>\n {actions.length && slots.swipeable !== null\n ? renderSlot(PassThroughSwipeable, slots.swipeable, { actions, testID: `${row.testID}-swipe`, children: content }, slotProps.swipeable)\n : content}\n </Fragment>\n );\n }}\n />\n </SafeAreaView>\n );\n}\n\nfunction EmptyPart(_props: InboxPageSlotMap[\"header\"]) {\n return null;\n}\n\n/** The default `swipeable`: no gesture, just the row (its actions are on long press and in the accessibility actions). */\nfunction PassThroughSwipeable({ children }: InboxPageSlotMap[\"swipeable\"]) {\n return <>{children}</>;\n}\n\nfunction SectionTitle({ title, testID }: { title: string; testID: string }) {\n const colors = useThemeRoles();\n const ios = Platform.OS === \"ios\";\n return (\n <NativeText\n testID={testID}\n accessibilityRole=\"header\"\n className={ios ? \"px-4 pb-1.5 pt-2\" : \"px-4 pb-2 pt-4 text-primary\"}\n style={\n ios\n ? { marginHorizontal: IOS_GROUP_MARGIN, color: colors.secondaryLabel, fontSize: 13, lineHeight: 18, textTransform: \"uppercase\" }\n : { fontSize: 14, lineHeight: 20, fontWeight: \"500\" }\n }\n >\n {title}\n </NativeText>\n );\n}\n\n/** Opens a row's actions as a menu (long press). */\nexport function showInboxActions(title: string, actions: InboxSwipeAction[], cancelLabel = \"Cancel\"): void {\n Alert.alert(title, undefined, [\n ...actions.map((a) => ({ text: a.label, style: a.destructive ? (\"destructive\" as const) : (\"default\" as const), onPress: a.onPress })),\n { text: cancelLabel, style: \"cancel\" as const },\n ]);\n}\n\nfunction DefaultRow(row: InboxPageSlotMap[\"row\"]) {\n const colors = useThemeRoles();\n const ios = Platform.OS === \"ios\";\n const [pressed, setPressed] = useState(false);\n const actions = row.swipeActions ?? [];\n const radius = iosGroupRadius();\n const unreadLabel = row.unreadCount && row.unreadCount > 0 ? `${row.unreadCount} unread` : row.unread ? \"Unread\" : null;\n const label = [unreadLabel, row.avatar ? row.avatarLabel : null, row.title, row.timeLabel, row.preview, row.meta].filter(Boolean).join(\", \");\n // The separator starts at the text: the row's padding, the dot's column, and the avatar when there is one.\n const [avatarWidth, setAvatarWidth] = useState(0);\n const separatorInset = ROW_PADDING + LEADING_WIDTH + (row.avatar ? (avatarWidth || DEFAULT_AVATAR) + AVATAR_GAP : 0);\n return (\n <View\n testID={`${row.testID}-cell`}\n style={[\n { backgroundColor: colors.surface },\n ios\n ? {\n marginHorizontal: IOS_GROUP_MARGIN,\n borderTopLeftRadius: row.isFirst ? radius : 0,\n borderTopRightRadius: row.isFirst ? radius : 0,\n borderBottomLeftRadius: row.isLast ? radius : 0,\n borderBottomRightRadius: row.isLast ? radius : 0,\n overflow: \"hidden\",\n }\n : null,\n ]}\n >\n <Pressable\n testID={row.testID}\n accessibilityRole={row.onPress ? \"button\" : undefined}\n accessibilityLabel={label}\n accessibilityActions={actions.map((a) => ({ name: a.id, label: a.label }))}\n onAccessibilityAction={(event) => actions.find((a) => a.id === event.nativeEvent.actionName)?.onPress()}\n onPress={row.onPress}\n onLongPress={actions.length ? () => showInboxActions(row.title, actions) : undefined}\n onPressIn={() => setPressed(true)}\n onPressOut={() => setPressed(false)}\n style={{ flexDirection: \"row\", alignItems: \"center\", paddingHorizontal: ROW_PADDING, paddingVertical: 11, minHeight: 60, backgroundColor: pressed && row.onPress ? colors.fill : undefined }}\n >\n <View style={{ width: LEADING_WIDTH, alignItems: \"flex-start\" }}>\n {row.leading ?? (row.unreadCount && row.unreadCount > 0 ? null : <UnreadDot unread={!!row.unread} testID={`${row.testID}-unread`} color={colors.tint} />)}\n </View>\n {row.avatar ? (\n <View\n testID={`${row.testID}-avatar`}\n accessibilityElementsHidden\n importantForAccessibility=\"no-hide-descendants\"\n onLayout={(e) => setAvatarWidth(Math.round(e.nativeEvent.layout.width))}\n style={{ marginRight: AVATAR_GAP }}\n >\n {row.avatar}\n </View>\n ) : null}\n <View style={{ flex: 1, minWidth: 0 }}>\n <View style={{ flexDirection: \"row\", alignItems: \"baseline\" }}>\n <NativeText\n numberOfLines={1}\n style={{ flex: 1, color: colors.label, fontSize: 17, lineHeight: 22, fontWeight: row.unread || (row.unreadCount ?? 0) > 0 ? \"600\" : \"400\" }}\n >\n {row.title}\n </NativeText>\n {row.timeLabel ? (\n <NativeText testID={`${row.testID}-time`} style={{ marginLeft: 8, color: colors.secondaryLabel, fontSize: 15, lineHeight: 20 }}>\n {row.timeLabel}\n </NativeText>\n ) : null}\n </View>\n {row.preview ? (\n <NativeText numberOfLines={2} style={{ marginTop: 2, color: colors.secondaryLabel, fontSize: 15, lineHeight: 20 }}>\n {row.preview}\n </NativeText>\n ) : null}\n {row.meta ? (\n <NativeText testID={`${row.testID}-meta`} style={{ marginTop: 4, color: colors.tertiaryLabel, fontSize: 13, lineHeight: 18 }}>\n {row.meta}\n </NativeText>\n ) : null}\n </View>\n {row.unreadCount && row.unreadCount > 0 ? (\n <View style={{ marginLeft: 8 }}>\n <NativeBadge testID={`${row.testID}-count`}>{String(row.unreadCount)}</NativeBadge>\n </View>\n ) : null}\n {row.trailing ? <View style={{ marginLeft: 8 }}>{row.trailing}</View> : row.onPress ? <Chevron color={colors.tertiaryLabel} /> : null}\n </Pressable>\n {row.isLast ? null : (\n <View accessibilityElementsHidden importantForAccessibility=\"no-hide-descendants\" style={{ flexDirection: \"row\", height: StyleSheet.hairlineWidth }}>\n <View testID={`${row.testID}-separator-inset`} style={{ width: separatorInset }} />\n <View testID={`${row.testID}-separator-line`} style={{ flex: 1, backgroundColor: colors.separator }} />\n </View>\n )}\n </View>\n );\n}\n\nfunction Chevron({ color }: { color: unknown }) {\n return (\n <NativeText accessibilityElementsHidden importantForAccessibility=\"no\" style={{ marginLeft: 8, color: color as string, fontSize: 20, lineHeight: 22 }}>\n ›\n </NativeText>\n );\n}\n\nfunction UnreadDot({ unread, testID, color }: { unread: boolean; testID: string; color: unknown }) {\n if (!unread) return <View testID={testID} style={{ width: 10, height: 10 }} />;\n return <View testID={testID} style={{ width: 10, height: 10, borderRadius: 5, backgroundColor: color as string }} />;\n}\n\nfunction DefaultFooter({ loadingMore, testID }: InboxPageSlotMap[\"footer\"]) {\n if (!loadingMore) return null;\n return (\n <NativeLoadingState fullScreen={false} size=\"small\" accessibilityLabel=\"Loading more\" className=\"py-4\" testID={testID} />\n );\n}\n\nfunction DefaultEmpty({ title, body, actionLabel, onAction, testID }: InboxPageSlotMap[\"empty\"]) {\n return (\n <NativeEmptyState\n variant=\"first-run\"\n title={title}\n body={body}\n testID={testID}\n primaryAction={\n actionLabel && onAction ? (\n <NativeButton onPress={onAction} testID={`${testID}-action`}>\n {actionLabel}\n </NativeButton>\n ) : undefined\n }\n />\n );\n}\n","/**\n * ThreadPage — one conversation: messages oldest first, a composer at the\n * bottom that stays above the keyboard, attachments, a read receipt, and\n * \"load earlier\" paging.\n *\n * Generic: a support ticket with staff replies, a direct message, a comment\n * thread. Mine are on the trailing side in the tint, theirs on the leading\n * side on `surface`, over the `groupedBackground` page (SettingsPage's iOS\n * palette).\n *\n * Keyboard: with `KeyboardScrollProvider` (the native app shell's\n * `keyboardScroll`, react-native-keyboard-controller's\n * `KeyboardAwareScrollView`), the messages and the composer scroll together\n * and the composer is kept above the keyboard. Without it, a\n * `KeyboardAvoidingView` does the same on iOS. Either way the thread stays\n * scrolled to the newest message as it grows.\n *\n * Read-only: pass `composer={null}` (a closed ticket, a viewer) and an\n * optional `closedNotice`.\n *\n * Slots: `message`, `attachment`, `readReceipt`, `composer`,\n * `composerAccessory` (beside the input: attach a screenshot), `header`\n * (above the messages: what the thread is about), `earlier` and `empty`.\n *\n * @stability Beta\n */\nimport { createElement, useEffect, useRef, type ReactNode } from \"react\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport { ActivityIndicator, Image, KeyboardAvoidingView, Platform, Pressable, ScrollView, TextInput, View } from \"react-native\";\nimport { SafeAreaView } from \"react-native-safe-area-context\";\nimport { useThemeRoles } from \"../hooks/use-theme-roles\";\nimport { NativeButton } from \"../components/button\";\nimport { NativeEmptyState } from \"../components/empty-state\";\nimport { NativeText } from \"../components/text\";\nimport { composeHeaderOptions, type ScreenHeaderProps } from \"./screen-container\";\nimport { useKeyboardScroll } from \"./keyboard\";\n\nexport interface ThreadAttachment {\n id: string;\n /** An image URI (a signed URL, a file:// path). */\n uri: string;\n width?: number;\n height?: number;\n accessibilityLabel?: string;\n onPress?: () => void;\n}\n\nexport interface ThreadMessage {\n id: string;\n body: string;\n /** Sent by the person using the app: trailing side, tint. */\n mine: boolean;\n /** Shown over theirs (\"Support\"); never over mine. */\n authorName?: string;\n timestamp: string | Date;\n /** An optimistic message: `sending`, then `sent`, or `failed` with `onRetry`. */\n status?: \"sending\" | \"sent\" | \"failed\";\n onRetry?: () => void;\n attachments?: ThreadAttachment[];\n}\n\nexport interface ThreadComposer {\n value: string;\n onChangeText: (text: string) => void;\n onSend: () => void;\n /** A send is in flight: the button spins and won't send twice. */\n sending?: boolean;\n placeholder?: string;\n sendLabel?: string;\n /** Turns the send button off (besides an empty or blank value). */\n disabled?: boolean;\n maxLength?: number;\n}\n\n/** What the default parts say. */\nexport interface ThreadLabels {\n /** Who \"mine\" is, to VoiceOver. */\n you: string;\n sending: string;\n notSent: string;\n retryHint: string;\n}\n\nconst DEFAULT_LABELS: ThreadLabels = { you: \"You\", sending: \"Sending\", notSent: \"Not sent. Tap to retry.\", retryHint: \"Double tap to send again\" };\n\nexport type ThreadPageSlotMap = {\n message: ThreadMessage & { testID: string; timeLabel: string; showReadReceipt: boolean; labels: ThreadLabels };\n attachment: ThreadAttachment & { testID: string; mine: boolean };\n readReceipt: { label: string; testID: string };\n /** `accessory` is the `composerAccessory` slot, already rendered. */\n composer: ThreadComposer & { testID: string; accessory?: ReactNode };\n composerAccessory: { testID: string };\n header: { testID: string };\n earlier: { loading: boolean; onPress: () => void; label: string; testID: string };\n empty: { title: string; body: string; testID: string };\n};\n\nexport interface ThreadPageProps extends ScreenHeaderProps {\n /** Oldest first. */\n messages: ThreadMessage[];\n /** `null`: read-only, no composer. */\n composer: ThreadComposer | null;\n /** Shown instead of the composer when it is `null` (\"This conversation is closed\"). */\n closedNotice?: string;\n /** Above the messages (what the thread is about). Prefer `slots.header` for a component. */\n header?: ReactNode;\n /**\n * When the other side last read the thread. My newest message sent before\n * it shows the read receipt.\n */\n readAt?: string | Date | null;\n readLabel?: string;\n /** There are older messages: shows a \"load earlier\" button at the top. */\n hasEarlier?: boolean;\n onLoadEarlier?: () => void;\n loadingEarlier?: boolean;\n earlierLabel?: string;\n emptyTitle?: string;\n emptyBody?: string;\n formatTime?: (date: Date) => string;\n /** The words the defaults say, for translating. */\n labels?: Partial<ThreadLabels>;\n slots?: Slots<ThreadPageSlotMap>;\n slotProps?: SlotPropsFor<ThreadPageSlotMap>;\n /** testID on the root. Default `\"thread-page\"`. */\n testID?: string;\n}\n\n/** `<Stack.Screen options>` for a ThreadPage: a standard (not large) title, like Messages. */\nexport function getThreadPageStackOptions(props: ScreenHeaderProps & { headerTitle?: string }): Record<string, unknown> {\n return composeHeaderOptions({\n headerTitle: props.headerTitle ?? \"Conversation\",\n large: props.large ?? false,\n scrollEdgeBehavior: props.scrollEdgeBehavior,\n headerLeft: props.headerLeft,\n headerRight: props.headerRight,\n headerOptions: props.headerOptions,\n });\n}\n\nconst toDate = (value: string | Date) => (typeof value === \"string\" ? new Date(value) : value);\n\nfunction defaultTime(date: Date): string {\n return date.toLocaleString(undefined, { month: \"short\", day: \"numeric\", hour: \"numeric\", minute: \"2-digit\" });\n}\n\n/** The newest of my messages the other side has read, or null. */\nexport function readReceiptFor(messages: readonly ThreadMessage[], readAt: string | Date | null | undefined): string | null {\n if (!readAt) return null;\n const read = toDate(readAt).getTime();\n for (let i = messages.length - 1; i >= 0; i--) {\n const m = messages[i]!;\n if (m.mine && m.status !== \"sending\" && m.status !== \"failed\" && toDate(m.timestamp).getTime() <= read) return m.id;\n }\n return null;\n}\n\ninterface ScrollLike {\n scrollToEnd?: (options?: { animated?: boolean }) => void;\n}\n\nexport function ThreadPage({\n messages,\n composer,\n closedNotice,\n header,\n readAt,\n readLabel = \"Read\",\n hasEarlier = false,\n onLoadEarlier,\n loadingEarlier = false,\n earlierLabel = \"Load earlier messages\",\n emptyTitle,\n emptyBody,\n formatTime = defaultTime,\n labels: labelOverrides,\n slots = {},\n slotProps = {},\n testID = \"thread-page\",\n}: ThreadPageProps) {\n const colors = useThemeRoles();\n const KeyboardScroll = useKeyboardScroll();\n const scrollRef = useRef<ScrollLike | null>(null);\n const receiptFor = readReceiptFor(messages, readAt);\n const labels: ThreadLabels = { ...DEFAULT_LABELS, ...labelOverrides };\n const newest = messages[messages.length - 1]?.id;\n\n // Keep the newest message in view when one arrives (or is sent).\n useEffect(() => {\n scrollRef.current?.scrollToEnd?.({ animated: true });\n }, [newest]);\n\n const body = (\n <View style={{ flexGrow: 1 }}>\n {header ?? renderSlot(Nothing, slots.header, { testID: `${testID}-header` }, slotProps.header)}\n {hasEarlier && onLoadEarlier\n ? renderSlot(\n DefaultEarlier,\n slots.earlier,\n { loading: loadingEarlier, onPress: onLoadEarlier, label: earlierLabel, testID: `${testID}-earlier` },\n slotProps.earlier,\n )\n : null}\n <View testID={`${testID}-messages`} accessibilityRole=\"list\" style={{ flexGrow: 1, justifyContent: \"flex-end\", paddingHorizontal: 12, paddingVertical: 8, gap: 6 }}>\n {messages.length === 0\n ? renderSlot(\n DefaultEmpty,\n slots.empty,\n { title: emptyTitle ?? \"No messages yet\", body: emptyBody ?? \"Write the first one below.\", testID: `${testID}-empty` },\n slotProps.empty,\n )\n : messages.map((message) => (\n <View key={message.id}>\n {renderSlot(\n DefaultMessage,\n slots.message,\n {\n ...message,\n testID: `${testID}-message-${message.id}`,\n timeLabel: formatTime(toDate(message.timestamp)),\n showReadReceipt: message.id === receiptFor,\n labels,\n },\n slotProps.message,\n )}\n {message.attachments?.length ? (\n <View style={{ flexDirection: \"row\", flexWrap: \"wrap\", gap: 6, justifyContent: message.mine ? \"flex-end\" : \"flex-start\", marginTop: 4 }}>\n {message.attachments.map((attachment) => (\n <View key={attachment.id}>\n {renderSlot(\n DefaultAttachment,\n slots.attachment,\n { ...attachment, mine: message.mine, testID: `${testID}-attachment-${attachment.id}` },\n slotProps.attachment,\n )}\n </View>\n ))}\n </View>\n ) : null}\n {message.id === receiptFor\n ? renderSlot(DefaultReadReceipt, slots.readReceipt, { label: readLabel, testID: `${testID}-read-receipt` }, slotProps.readReceipt)\n : null}\n </View>\n ))}\n </View>\n </View>\n );\n\n const footer = composer ? (\n renderSlot(\n DefaultComposer,\n slots.composer,\n {\n ...composer,\n testID: `${testID}-composer`,\n accessory: renderSlot(Nothing, slots.composerAccessory, { testID: `${testID}-composer-accessory` }, slotProps.composerAccessory),\n },\n slotProps.composer,\n )\n ) : closedNotice ? (\n <NativeText testID={`${testID}-closed`} style={{ textAlign: \"center\", padding: 16, color: colors.secondaryLabel, fontSize: 13, lineHeight: 18 }}>\n {closedNotice}\n </NativeText>\n ) : null;\n\n const page = { flex: 1, backgroundColor: colors.groupedBackground };\n const onContentSizeChange = () => scrollRef.current?.scrollToEnd?.({ animated: false });\n\n if (KeyboardScroll) {\n // The composer scrolls with the messages, so the keyboard-aware view keeps it (the focused input) above the keyboard.\n return (\n <SafeAreaView testID={testID} edges={[\"left\", \"right\", \"bottom\"]} style={page}>\n {createElement(\n KeyboardScroll as never,\n {\n ref: scrollRef,\n testID: `${testID}-keyboard`,\n keyboardShouldPersistTaps: \"handled\",\n contentInsetAdjustmentBehavior: \"automatic\",\n contentContainerStyle: { flexGrow: 1 },\n bottomOffset: 8,\n onContentSizeChange,\n } as never,\n body,\n footer,\n )}\n </SafeAreaView>\n );\n }\n return (\n <SafeAreaView testID={testID} edges={[\"left\", \"right\", \"bottom\"]} style={page}>\n <KeyboardAvoidingView testID={`${testID}-kav`} style={{ flex: 1 }} behavior={Platform.OS === \"ios\" ? \"padding\" : undefined} keyboardVerticalOffset={Platform.OS === \"ios\" ? 100 : 0}>\n <ScrollView\n ref={scrollRef as never}\n testID={`${testID}-scroll`}\n keyboardShouldPersistTaps=\"handled\"\n contentInsetAdjustmentBehavior=\"automatic\"\n contentContainerStyle={{ flexGrow: 1 }}\n onContentSizeChange={onContentSizeChange}\n >\n {body}\n </ScrollView>\n {footer}\n </KeyboardAvoidingView>\n </SafeAreaView>\n );\n}\n\nfunction Nothing(_props: { testID: string }) {\n return null;\n}\n\nfunction DefaultEarlier({ loading, onPress, label, testID }: ThreadPageSlotMap[\"earlier\"]) {\n return (\n <View style={{ alignItems: \"center\", paddingTop: 8 }}>\n <NativeButton variant=\"ghost\" size=\"sm\" onPress={onPress} loading={loading} testID={testID}>\n {label}\n </NativeButton>\n </View>\n );\n}\n\nfunction DefaultEmpty({ title, body, testID }: ThreadPageSlotMap[\"empty\"]) {\n return <NativeEmptyState variant=\"first-run\" title={title} body={body} testID={testID} />;\n}\n\n// No `color` key on mine: an undefined color in the style would override the class's.\nconst MINE_TEXT = { fontSize: 17, lineHeight: 22 } as const;\n\nfunction DefaultMessage(message: ThreadPageSlotMap[\"message\"]) {\n const colors = useThemeRoles();\n const failed = message.status === \"failed\";\n const { labels } = message;\n const label = [message.mine ? labels.you : (message.authorName ?? \"\"), message.body, message.timeLabel, failed ? labels.notSent : message.status === \"sending\" ? labels.sending : null]\n .filter(Boolean)\n .join(\", \");\n return (\n <View style={{ alignItems: message.mine ? \"flex-end\" : \"flex-start\" }}>\n {!message.mine && message.authorName ? (\n <NativeText style={{ marginLeft: 12, marginBottom: 2, color: colors.secondaryLabel, fontSize: 12, lineHeight: 16 }}>{message.authorName}</NativeText>\n ) : null}\n <Pressable\n testID={message.testID}\n accessible\n accessibilityLabel={label}\n accessibilityHint={failed && message.onRetry ? labels.retryHint : undefined}\n onPress={failed ? message.onRetry : undefined}\n style={{\n maxWidth: \"80%\",\n paddingHorizontal: 14,\n paddingVertical: 8,\n borderRadius: 18,\n backgroundColor: message.mine ? colors.tint : colors.surface,\n opacity: message.status === \"sending\" ? 0.6 : 1,\n }}\n >\n <NativeText className={message.mine ? \"text-primary-foreground\" : undefined} style={message.mine ? MINE_TEXT : { ...MINE_TEXT, color: colors.label }}>\n {message.body}\n </NativeText>\n </Pressable>\n <NativeText\n testID={`${message.testID}-time`}\n style={{ marginTop: 2, marginHorizontal: 12, color: failed ? colors.destructive : colors.tertiaryLabel, fontSize: 11, lineHeight: 14 }}\n >\n {failed ? labels.notSent : message.timeLabel}\n </NativeText>\n </View>\n );\n}\n\nfunction DefaultAttachment({ uri, width, height, accessibilityLabel, onPress, testID }: ThreadPageSlotMap[\"attachment\"]) {\n const ratio = width && height ? width / height : 0.6;\n const w = 140;\n return (\n <Pressable testID={testID} accessibilityRole=\"image\" accessibilityLabel={accessibilityLabel ?? \"Attachment\"} onPress={onPress} disabled={!onPress}>\n <Image source={{ uri }} style={{ width: w, height: Math.round(w / ratio), borderRadius: 12 }} resizeMode=\"cover\" />\n </Pressable>\n );\n}\n\nfunction DefaultReadReceipt({ label, testID }: ThreadPageSlotMap[\"readReceipt\"]) {\n const colors = useThemeRoles();\n return (\n <NativeText testID={testID} style={{ alignSelf: \"flex-end\", marginHorizontal: 12, color: colors.secondaryLabel, fontSize: 11, lineHeight: 14 }}>\n {label}\n </NativeText>\n );\n}\n\nfunction DefaultComposer({\n value,\n onChangeText,\n onSend,\n sending = false,\n placeholder = \"Message\",\n sendLabel = \"Send\",\n disabled = false,\n maxLength,\n testID,\n accessory,\n}: ThreadPageSlotMap[\"composer\"]) {\n const colors = useThemeRoles();\n const blank = !value.trim();\n return (\n <View\n testID={testID}\n style={{ flexDirection: \"row\", alignItems: \"flex-end\", gap: 8, paddingHorizontal: 12, paddingTop: 8, paddingBottom: 8, backgroundColor: colors.groupedBackground }}\n >\n {accessory}\n <TextInput\n testID={`${testID}-input`}\n value={value}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={colors.tertiaryLabel as string}\n accessibilityLabel={placeholder}\n multiline\n maxLength={maxLength}\n editable={!sending}\n style={{\n flex: 1,\n minHeight: 36,\n maxHeight: 120,\n paddingHorizontal: 14,\n paddingTop: 8,\n paddingBottom: 8,\n borderRadius: 18,\n fontSize: 17,\n color: colors.label as string,\n backgroundColor: colors.surface,\n }}\n />\n {sending ? (\n <View style={{ height: 36, justifyContent: \"center\", paddingHorizontal: 8 }}>\n <ActivityIndicator testID={`${testID}-sending`} accessibilityLabel=\"Sending\" />\n </View>\n ) : (\n <NativeButton size=\"sm\" onPress={onSend} disabled={disabled || blank} testID={`${testID}-send`}>\n {sendLabel}\n </NativeButton>\n )}\n </View>\n );\n}\n","/**\n * Auth primitive group (PRD-07 simplification #3).\n *\n * Auth flows are the most consumer-divergent screen in any app. Instead\n * of shipping a god-component with a sea of variants, Genesis ships\n * three small primitives that consumers compose on a regular `<View>`:\n *\n * - <AuthBranding> — slot for branded logo + headline + subhead\n * - <SocialAuthRow> — provider buttons (Apple / Google / GitHub / …)\n * - <AuthForm> — email + password (or magic link) + submit\n *\n * Composition lives in `apps/<consumer>/...` — see\n * `standards/usage-doctrine.md` § Auth composition for worked examples.\n *\n * @stability Beta\n */\nimport { Fragment, useCallback, useRef, useState, type ReactNode } from \"react\";\nimport { Pressable, Text, View } from \"react-native\";\nimport { NativeButton } from \"../components/button\";\nimport { NativeInput } from \"../components/input\";\nimport { NativeText } from \"../components/text\";\nimport { cn } from \"../utils\";\n\n// ---------------------------------------------------------------------------\n// AuthBranding — branding slot above the form\n// ---------------------------------------------------------------------------\n\nexport interface AuthBrandingProps {\n /** Brand mark (logo node). */\n logo?: ReactNode;\n /** Headline text. Renders as h1. */\n headline?: string;\n /** Subhead under the headline. Renders as muted body. */\n subhead?: string;\n /** Override the root container styling. */\n className?: string;\n testID?: string;\n}\n\nexport function AuthBranding({\n logo,\n headline,\n subhead,\n className,\n testID = \"auth-branding\",\n}: AuthBrandingProps) {\n return (\n <View\n testID={testID}\n accessibilityRole=\"header\"\n className={cn(\"items-center gap-3 pb-8\", className)}\n >\n {logo ? (\n <View testID={`${testID}-logo`} className=\"mb-2\">\n {logo}\n </View>\n ) : null}\n {headline ? (\n <NativeText\n preset=\"h1\"\n testID={`${testID}-headline`}\n className=\"text-center\"\n >\n {headline}\n </NativeText>\n ) : null}\n {subhead ? (\n <NativeText\n preset=\"body\"\n testID={`${testID}-subhead`}\n className=\"text-center text-muted-foreground\"\n >\n {subhead}\n </NativeText>\n ) : null}\n </View>\n );\n}\n\n// ---------------------------------------------------------------------------\n// SocialAuthRow — provider buttons\n// ---------------------------------------------------------------------------\n\nexport type SocialAuthProvider = {\n /** Stable id used as React key + testID suffix. */\n id: string;\n /** Visible label, e.g., \"Continue with Apple\". */\n label: string;\n /** Optional leading icon node. */\n icon?: ReactNode;\n /** Press handler. */\n onPress: () => void | Promise<void>;\n /** When true, the button is disabled (e.g., loading). */\n disabled?: boolean;\n /**\n * Draw the provider's own button instead of the default outline button,\n * for a provider whose brand rules require theirs (Apple: see\n * `appleProvider`). Receives the testID the default would use.\n */\n render?: (props: { testID: string; disabled?: boolean }) => ReactNode;\n};\n\nexport interface SocialAuthRowProps {\n providers: SocialAuthProvider[];\n /**\n * Optional separator label rendered between social row and the form\n * below (e.g., \"or\"). Pass `null` to suppress. Default `\"or\"`.\n */\n separator?: string | null;\n /** Override root container styling. */\n className?: string;\n testID?: string;\n}\n\nexport function SocialAuthRow({\n providers,\n separator = \"or\",\n className,\n testID = \"social-auth-row\",\n}: SocialAuthRowProps) {\n if (providers.length === 0) return null;\n return (\n <View testID={testID} className={cn(\"gap-3\", className)}>\n <View className=\"gap-2\">\n {providers.map((p) =>\n p.render ? (\n <Fragment key={p.id}>{p.render({ testID: `${testID}-${p.id}`, disabled: p.disabled })}</Fragment>\n ) : (\n <NativeButton\n key={p.id}\n testID={`${testID}-${p.id}`}\n variant=\"outline\"\n disabled={p.disabled}\n onPress={() => {\n void p.onPress();\n }}\n >\n <View className=\"flex-row items-center gap-2\">\n {p.icon}\n <Text className=\"text-sm font-medium text-foreground\">\n {p.label}\n </Text>\n </View>\n </NativeButton>\n ),\n )}\n </View>\n {separator !== null && separator !== undefined ? (\n <View\n testID={`${testID}-separator`}\n className=\"my-2 flex-row items-center gap-3\"\n accessibilityElementsHidden\n >\n <View className=\"h-px flex-1 bg-border\" />\n <Text className=\"text-xs uppercase tracking-wider text-muted-foreground\">\n {separator}\n </Text>\n <View className=\"h-px flex-1 bg-border\" />\n </View>\n ) : null}\n </View>\n );\n}\n\n// ---------------------------------------------------------------------------\n// AuthForm — email + password (or magic link) + submit\n// ---------------------------------------------------------------------------\n\nexport interface AuthFormValues {\n email: string;\n /** Empty string when `mode === \"magic-link\"`. */\n password: string;\n}\n\nexport interface AuthFormProps {\n /**\n * `\"password\"` (default) renders email + password.\n * `\"magic-link\"` renders email only and the submit button label\n * defaults to \"Send magic link\".\n */\n mode?: \"password\" | \"magic-link\";\n /** Submit handler. Receives the current form values. */\n onSubmit: (values: AuthFormValues) => void | Promise<void>;\n /**\n * Optional validation slot — return `null` to allow submission, or a\n * string error message to block. Called on every submit.\n */\n validate?: (values: AuthFormValues) => string | null;\n /** Override the submit button label. */\n submitLabel?: string;\n /** When true, submit button is disabled and shows a busy indicator. */\n loading?: boolean;\n /**\n * Top-level error (set by the consumer after a server-side rejection,\n * e.g., \"Invalid credentials\"). Shown above the submit button.\n */\n errorMessage?: string;\n /** Initial email. Useful for \"log in as <user>\" deep links. */\n initialEmail?: string;\n /** Slot rendered AFTER the inputs but BEFORE the submit (e.g., \"Forgot password\" link). */\n belowFields?: ReactNode;\n /** Override root container styling. */\n className?: string;\n testID?: string;\n}\n\nexport function AuthForm({\n mode = \"password\",\n onSubmit,\n validate,\n submitLabel,\n loading,\n errorMessage,\n initialEmail = \"\",\n belowFields,\n className,\n testID = \"auth-form\",\n}: AuthFormProps) {\n const [email, setEmail] = useState(initialEmail);\n const [password, setPassword] = useState(\"\");\n const [localError, setLocalError] = useState<string | null>(null);\n const [submitting, setSubmitting] = useState(false);\n const passwordRef = useRef<{ focus(): void } | null>(null);\n\n const isMagic = mode === \"magic-link\";\n const resolvedSubmitLabel =\n submitLabel ?? (isMagic ? \"Send magic link\" : \"Sign in\");\n\n const handleSubmit = useCallback(async () => {\n // Guard against double-tap and stacked submits — the user's onSubmit\n // is async, so we own a local `submitting` flag in addition to the\n // parent-controlled `loading` prop.\n if (submitting || loading) return;\n\n setLocalError(null);\n const values: AuthFormValues = {\n email: email.trim(),\n password: isMagic ? \"\" : password,\n };\n if (validate) {\n const err = validate(values);\n if (err) {\n setLocalError(err);\n return;\n }\n }\n if (!values.email) {\n setLocalError(\"Email is required\");\n return;\n }\n if (!isMagic && !values.password) {\n setLocalError(\"Password is required\");\n return;\n }\n\n // Await the consumer's onSubmit so we surface unhandled rejections\n // as a local error string instead of dropping them on the floor.\n setSubmitting(true);\n try {\n await onSubmit(values);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n setLocalError(message);\n } finally {\n setSubmitting(false);\n }\n }, [email, password, isMagic, validate, onSubmit, submitting, loading]);\n\n const visibleError = errorMessage ?? localError ?? null;\n\n return (\n <View testID={testID} className={cn(\"gap-3\", className)}>\n <View className=\"gap-1\">\n <Text className=\"text-sm font-medium text-foreground\">Email</Text>\n <NativeInput\n testID={`${testID}-email`}\n accessibilityLabel=\"Email\"\n value={email}\n onChangeText={setEmail}\n placeholder=\"you@example.com\"\n autoCapitalize=\"none\"\n autoCorrect={false}\n keyboardType=\"email-address\"\n textContentType=\"emailAddress\"\n autoComplete=\"email\"\n returnKeyType={isMagic ? \"send\" : \"next\"}\n editable={!loading && !submitting}\n // Magic-link mode: the email field is the last input, so return\n // submits. Password mode: React Native doesn't move focus by\n // itself, so return focuses the password field and keeps the\n // keyboard open.\n submitBehavior={isMagic ? \"blurAndSubmit\" : \"submit\"}\n onSubmitEditing={isMagic ? handleSubmit : () => passwordRef.current?.focus()}\n />\n </View>\n\n {isMagic ? null : (\n <View className=\"gap-1\">\n <Text className=\"text-sm font-medium text-foreground\">Password</Text>\n <NativeInput\n ref={passwordRef}\n testID={`${testID}-password`}\n accessibilityLabel=\"Password\"\n value={password}\n onChangeText={setPassword}\n placeholder=\"••••••••\"\n secureTextEntry\n textContentType=\"password\"\n autoComplete=\"current-password\"\n autoCapitalize=\"none\"\n autoCorrect={false}\n returnKeyType=\"send\"\n editable={!loading && !submitting}\n onSubmitEditing={handleSubmit}\n />\n </View>\n )}\n\n {belowFields}\n\n {visibleError ? (\n <Text\n testID={`${testID}-error`}\n accessibilityRole=\"alert\"\n className=\"text-sm text-destructive\"\n >\n {visibleError}\n </Text>\n ) : null}\n\n <NativeButton\n testID={`${testID}-submit`}\n onPress={() => {\n void handleSubmit();\n }}\n loading={loading || submitting}\n disabled={loading || submitting}\n >\n {resolvedSubmitLabel}\n </NativeButton>\n </View>\n );\n}\n\n// Convenience: a \"Forgot password?\" link consumers can drop into the\n// `belowFields` slot. Kept as a simple Pressable so it inherits brand\n// tokens via the consumer's tailwind config.\nexport function ForgotPasswordLink({\n onPress,\n label = \"Forgot password?\",\n testID = \"auth-forgot-password\",\n}: {\n onPress: () => void;\n label?: string;\n testID?: string;\n}) {\n return (\n <Pressable\n testID={testID}\n accessibilityRole=\"link\"\n accessibilityLabel={label}\n onPress={onPress}\n hitSlop={8}\n className=\"self-end\"\n >\n <Text className=\"text-sm font-medium text-primary\">{label}</Text>\n </Pressable>\n );\n}\n","/**\n * AuthScreen — a whole sign-in screen: branding, social providers, the\n * email form with a \"Forgot password?\" link, and a footer (terms, a\n * sign-up link). It assembles the auth primitives (`AuthBranding`,\n * `SocialAuthRow`, `AuthForm`, `ForgotPasswordLink`) so an app passes\n * props instead of composing them.\n *\n * The form stays above the keyboard on small phones: with the app's\n * `KeyboardScrollProvider` (react-native-keyboard-controller), else with\n * `KeyboardAvoidingView`. With the provider's `toolbar` (`KeyboardToolbar`),\n * a previous / next / done bar rides above the keyboard. In development, on\n * iOS, it warns when a third-party provider is offered without Sign in with\n * Apple (App Store Review Guideline 4.8 rejects that). `appleProvider()`\n * adds Apple's own button in one line.\n *\n * Slots: replace or drop (`null`) `branding`, `social`, `form` or `footer`;\n * `slotProps` feeds a default part. Composing the primitives yourself is\n * still the escape hatch.\n *\n * @stability Beta\n */\nimport type { ReactNode } from \"react\";\nimport { KeyboardAvoidingView, Platform, View } from \"react-native\";\nimport { renderSlot, type SlotPropsFor, type Slots } from \"@marktiderman/genesis-core/slots\";\nimport {\n AuthBranding,\n AuthForm,\n ForgotPasswordLink,\n SocialAuthRow,\n type AuthBrandingProps,\n type AuthFormProps,\n type SocialAuthProvider,\n} from \"./auth\";\nimport { ScreenContainer } from \"./screen-container\";\nimport { KEYBOARD_TOOLBAR_HEIGHT, useKeyboardScroll, useKeyboardToolbar } from \"./keyboard\";\n\n/** The parts of an {@link AuthScreen} that `slots` and `slotProps` reach. */\nexport type AuthScreenSlotMap = {\n branding: AuthBrandingProps;\n social: { providers: SocialAuthProvider[]; testID: string };\n form: AuthFormProps;\n footer: { children: ReactNode; testID: string };\n};\n\nexport interface AuthScreenProps {\n /** Logo, headline and subhead above everything else. */\n branding?: AuthBrandingProps;\n /**\n * Sign-in providers (Apple, Google…). None: no social row. A `null` or\n * `false` entry is skipped, so a platform-only provider such as\n * `appleProvider(...)` (null off iOS) goes in the list as is.\n */\n providers?: Array<SocialAuthProvider | null | false | undefined>;\n /** The email form. */\n form: AuthFormProps;\n /** Adds a \"Forgot password?\" link below the fields (password mode only). */\n onForgotPassword?: () => void;\n /** Below the form: terms, a sign-up link. */\n footer?: ReactNode;\n /** Replace (a component) or drop (`null`) one part. */\n slots?: Slots<AuthScreenSlotMap>;\n /** More props for a default part, merged over what the screen passes. */\n slotProps?: SlotPropsFor<AuthScreenSlotMap>;\n /** testID on the root container. Default `\"auth-screen\"`. */\n testID?: string;\n}\n\nexport function AuthScreen({\n branding,\n providers: givenProviders,\n form,\n onForgotPassword,\n footer,\n slots = {},\n slotProps = {},\n testID = \"auth-screen\",\n}: AuthScreenProps) {\n const providers = givenProviders?.filter((p): p is SocialAuthProvider => !!p);\n warnIfNoAppleSignIn(providers);\n const forgot =\n onForgotPassword && (form.mode ?? \"password\") === \"password\" ? <ForgotPasswordLink onPress={onForgotPassword} /> : null;\n const formProps: AuthFormProps = { ...form, belowFields: form.belowFields ?? forgot, testID: form.testID ?? `${testID}-form` };\n const KeyboardScroll = useKeyboardScroll();\n const KeyboardToolbar = useKeyboardToolbar();\n const content = (\n <>\n {branding ? renderSlot(AuthBranding, slots.branding, { ...branding, testID: branding.testID ?? `${testID}-branding` }, slotProps.branding) : null}\n {providers?.length\n ? renderSlot(DefaultSocial, slots.social, { providers, testID: `${testID}-social` }, slotProps.social)\n : null}\n {renderSlot(AuthForm, slots.form, formProps, slotProps.form)}\n {footer ? renderSlot(DefaultFooter, slots.footer, { children: footer, testID: `${testID}-footer` }, slotProps.footer) : null}\n </>\n );\n if (KeyboardScroll) {\n return (\n <ScreenContainer testID={testID}>\n <KeyboardScroll\n testID={`${testID}-keyboard`}\n keyboardShouldPersistTaps=\"handled\"\n contentInsetAdjustmentBehavior=\"automatic\"\n bottomOffset={KeyboardToolbar ? 24 + KEYBOARD_TOOLBAR_HEIGHT : 24}\n contentContainerStyle={{ flexGrow: 1, justifyContent: \"center\", gap: 24, paddingHorizontal: 24, paddingVertical: 32 }}\n >\n {content}\n </KeyboardScroll>\n {KeyboardToolbar ? <KeyboardToolbar /> : null}\n </ScreenContainer>\n );\n }\n return (\n <KeyboardAvoidingView testID={`${testID}-kav`} style={{ flex: 1 }} behavior={Platform.OS === \"ios\" ? \"padding\" : undefined}>\n <ScreenContainer scroll keyboardShouldPersistTaps=\"handled\" testID={testID} contentClassName=\"flex-grow justify-center gap-6 px-6 py-8\">\n {content}\n </ScreenContainer>\n </KeyboardAvoidingView>\n );\n}\n\ndeclare const __DEV__: boolean | undefined;\ndeclare const process: { env: Record<string, string | undefined> } | undefined;\nconst warnedNoApple = new Set<string>();\n\n/** Development-only: App Store Review Guideline 4.8 requires Sign in with Apple alongside third-party sign-in. */\nfunction warnIfNoAppleSignIn(providers: SocialAuthProvider[] | undefined) {\n const dev = typeof __DEV__ !== \"undefined\" ? __DEV__ : typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\";\n if (!dev || Platform.OS !== \"ios\" || !providers?.length) return;\n if (providers.some((p) => p.id === \"apple\")) return;\n const ids = providers.map((p) => p.id).join(\",\");\n if (warnedNoApple.has(ids)) return;\n warnedNoApple.add(ids);\n console.warn(\n `[genesis] AuthScreen offers ${providers.map((p) => p.label).join(\", \")} on iOS without Sign in with Apple. App Store Review Guideline 4.8 requires it; add appleProvider({ apple: AppleAuthentication, onPress }) (or any provider with id \"apple\"). If you did, expo-apple-authentication wasn't passed in.`,\n );\n}\n\nfunction DefaultSocial({ providers, testID }: AuthScreenSlotMap[\"social\"]) {\n return <SocialAuthRow providers={providers} testID={testID} />;\n}\n\nfunction DefaultFooter({ children, testID }: AuthScreenSlotMap[\"footer\"]) {\n return (\n <View testID={testID} className=\"items-center\">\n {children}\n </View>\n );\n}\n","/**\n * Sign in with Apple for `AuthScreen` / `SocialAuthRow`, drawn with Apple's\n * own `AppleAuthenticationButton` (Apple's Human Interface Guidelines require\n * its button; a look-alike gets an app rejected). Nothing here imports\n * `expo-apple-authentication`: pass the module in.\n *\n * ```tsx\n * import * as AppleAuthentication from \"expo-apple-authentication\";\n *\n * <AuthScreen providers={[appleProvider({ apple: AppleAuthentication, onPress: signIn }), google]} … />\n * ```\n *\n * `appleProvider` returns `null` off iOS or without the module, and\n * `AuthScreen` skips a `null` provider, so the same line works everywhere.\n *\n * @stability Beta\n */\nimport { useRef, useState, type ComponentType } from \"react\";\nimport { Platform, View, type ViewStyle } from \"react-native\";\nimport { useThemeMode } from \"../hooks/use-theme-mode\";\nimport type { SocialAuthProvider } from \"./auth\";\n\n/** The parts of `expo-apple-authentication` the button uses. Pass the module itself. */\nexport interface AppleButtonModuleLike {\n AppleAuthenticationButton: ComponentType<{\n buttonType: number;\n buttonStyle: number;\n cornerRadius?: number;\n onPress: () => void;\n // The style the button is given, typed as the module types it: with `unknown` here the real\n // module's button (which takes a ViewStyle) wasn't assignable under strictFunctionTypes.\n style?: ViewStyle;\n testID?: string;\n accessibilityState?: { disabled?: boolean; busy?: boolean };\n }>;\n AppleAuthenticationButtonType: { SIGN_IN: number; CONTINUE: number; SIGN_UP: number };\n AppleAuthenticationButtonStyle: { BLACK: number; WHITE: number; WHITE_OUTLINE: number };\n}\n\nexport interface AppleSignInButtonProps {\n /** `expo-apple-authentication`. */\n apple: AppleButtonModuleLike;\n /** Usually `() => signInWithApple(supabase, AppleAuthentication, { digest })` from `@marktiderman/genesis-supabase/native`. */\n onPress: () => void | Promise<void>;\n /** Apple's wording: \"Sign in with Apple\", \"Continue with Apple\" (default) or \"Sign up with Apple\". */\n type?: \"sign-in\" | \"continue\" | \"sign-up\";\n /** `\"auto\"` (default): black in light mode, white in dark, as Apple recommends. */\n appearance?: \"auto\" | \"black\" | \"white\" | \"white-outline\";\n /** Default 10, to sit with Genesis buttons. */\n cornerRadius?: number;\n /** Default 44, the recommended touch target (Apple's HIG minimum for this button is 30pt). */\n height?: number;\n /** Dims the button and ignores presses. It is also ignored on its own while an `onPress` promise is pending, so a second tap can't open a second sheet. */\n disabled?: boolean;\n testID?: string;\n}\n\n/** Apple's branded button, full width. Renders nothing off iOS. */\nexport function AppleSignInButton({\n apple,\n onPress,\n type = \"continue\",\n appearance = \"auto\",\n cornerRadius = 10,\n height = 44,\n disabled,\n testID = \"apple-sign-in\",\n}: AppleSignInButtonProps) {\n const mode = useThemeMode();\n // A ref, not only state: two taps in the same frame both see the old state.\n const pending = useRef(false);\n const [busy, setBusy] = useState(false);\n if (Platform.OS !== \"ios\") return null;\n const press = async () => {\n if (disabled || pending.current) return;\n pending.current = true;\n setBusy(true);\n try {\n await onPress();\n } finally {\n pending.current = false;\n setBusy(false);\n }\n };\n const inactive = !!disabled || busy;\n const { AppleAuthenticationButton, AppleAuthenticationButtonType: Type, AppleAuthenticationButtonStyle: Style } = apple;\n const buttonType = type === \"sign-in\" ? Type.SIGN_IN : type === \"sign-up\" ? Type.SIGN_UP : Type.CONTINUE;\n const resolved = appearance === \"auto\" ? (mode === \"dark\" ? \"white\" : \"black\") : appearance;\n const buttonStyle = resolved === \"white\" ? Style.WHITE : resolved === \"white-outline\" ? Style.WHITE_OUTLINE : Style.BLACK;\n return (\n <View testID={`${testID}-container`} pointerEvents={inactive ? \"none\" : \"auto\"} style={disabled ? { opacity: 0.5 } : undefined}>\n <AppleAuthenticationButton\n testID={testID}\n buttonType={buttonType}\n buttonStyle={buttonStyle}\n cornerRadius={cornerRadius}\n style={{ width: \"100%\", height }}\n accessibilityState={{ disabled: inactive, busy }}\n onPress={() => {\n void press();\n }}\n />\n </View>\n );\n}\n\nexport interface AppleProviderOptions extends Omit<AppleSignInButtonProps, \"apple\" | \"testID\"> {\n /** `expo-apple-authentication`, or `undefined` where it isn't installed. */\n apple: AppleButtonModuleLike | null | undefined;\n /**\n * The provider's `label`, used only by `AuthScreen`'s dev warning and a\n * custom `social` slot. Apple's button draws and announces its own localized\n * text. Default follows `type`: \"Continue with Apple\", \"Sign in with Apple\"\n * or \"Sign up with Apple\".\n */\n label?: string;\n}\n\nconst APPLE_LABELS = { continue: \"Continue with Apple\", \"sign-in\": \"Sign in with Apple\", \"sign-up\": \"Sign up with Apple\" } as const;\n\n/**\n * A `SocialAuthProvider` (id `\"apple\"`) that draws Apple's button, for\n * `AuthScreen`'s `providers`. `null` off iOS or without the module.\n *\n * @stability Beta\n */\nexport function appleProvider({ apple, label, ...button }: AppleProviderOptions): SocialAuthProvider | null {\n if (Platform.OS !== \"ios\" || !apple) return null;\n return {\n id: \"apple\",\n label: label ?? APPLE_LABELS[button.type ?? \"continue\"],\n onPress: button.onPress,\n disabled: button.disabled,\n render: ({ testID, disabled }) => <AppleSignInButton apple={apple} {...button} disabled={disabled} testID={testID} />,\n };\n}\n","/**\n * Google sign-in for `AuthScreen` / `SocialAuthRow`: the provider entry,\n * drawn as the row's outline button. Nothing here imports\n * `@react-native-google-signin/google-signin`; sign in with\n * `signInWithGoogle` from `@marktiderman/genesis-supabase/native`.\n *\n * ```tsx\n * <AuthScreen providers={[appleProvider({ apple, onPress: onApple }), googleProvider({ onPress: onGoogle })]} … />\n * ```\n *\n * Google's branding guidelines want its \"G\" mark on the button: pass it as\n * `icon` (Genesis ships no Google artwork). On iOS, offer Sign in with Apple\n * too (App Store Review Guideline 4.8); `AuthScreen` warns in development\n * when it's missing.\n *\n * @stability Beta\n */\nimport type { ReactNode } from \"react\";\nimport type { SocialAuthProvider } from \"./auth\";\n\nexport interface GoogleProviderOptions {\n /** Usually `() => signInWithGoogle(supabase, GoogleOneTapSignIn, { digest })`. */\n onPress: () => void | Promise<void>;\n /** Default \"Continue with Google\", Google's own wording. */\n label?: string;\n /** Google's \"G\" mark, as the app draws it. */\n icon?: ReactNode;\n disabled?: boolean;\n /** `false` (or `null`) gives `null`, so a switched-off provider goes in the list as is. Default true. */\n enabled?: boolean | null;\n}\n\n/**\n * A `SocialAuthProvider` (id `\"google\"`) for `AuthScreen`'s `providers`, or\n * `null` when `enabled` is false.\n *\n * @stability Beta\n */\nexport function googleProvider({ onPress, label = \"Continue with Google\", icon, disabled, enabled = true }: GoogleProviderOptions): SocialAuthProvider | null {\n if (!enabled) return null;\n return { id: \"google\", label, icon, onPress, disabled };\n}\n"]}