@marktiderman/genesis-ui-native 2.0.2 → 2.1.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 (38) hide show
  1. package/dist/{chunk-HNIEFTEL.js → chunk-F2TGDKOO.js} +2 -2
  2. package/dist/{chunk-HNIEFTEL.js.map → chunk-F2TGDKOO.js.map} +1 -1
  3. package/dist/{chunk-OMTXD7ND.js → chunk-U2SPACTV.js} +191 -76
  4. package/dist/chunk-U2SPACTV.js.map +1 -0
  5. package/dist/chunk-Z3AQYVUA.js +36 -0
  6. package/dist/chunk-Z3AQYVUA.js.map +1 -0
  7. package/dist/hooks/index.d.ts +12 -2
  8. package/dist/hooks/index.js +2 -2
  9. package/dist/index.d.ts +3 -2
  10. package/dist/index.js +3 -3
  11. package/dist/layouts/index.d.ts +110 -13
  12. package/dist/layouts/index.js +2 -2
  13. package/package.json +14 -14
  14. package/src/components/__tests__/badge.test.tsx +1 -0
  15. package/src/hooks/__tests__/use-theme-roles.test.tsx +30 -0
  16. package/src/hooks/index.ts +1 -0
  17. package/src/hooks/use-theme-roles.ts +45 -0
  18. package/src/layouts/__tests__/auth-screen.test.tsx +72 -0
  19. package/src/layouts/__tests__/auth.test.tsx +1 -0
  20. package/src/layouts/__tests__/keyboard-scroll.test.tsx +34 -0
  21. package/src/layouts/__tests__/nav-bar.test.tsx +1 -0
  22. package/src/layouts/__tests__/notifications-page-slots.test.tsx +23 -0
  23. package/src/layouts/__tests__/notifications-page.test.tsx +1 -0
  24. package/src/layouts/__tests__/screen-container.test.tsx +1 -0
  25. package/src/layouts/__tests__/settings-page-slots.test.tsx +41 -0
  26. package/src/layouts/__tests__/settings-page.test.tsx +1 -0
  27. package/src/layouts/__tests__/settings-sub-page.test.tsx +1 -0
  28. package/src/layouts/auth-screen.tsx +138 -0
  29. package/src/layouts/auth.tsx +13 -6
  30. package/src/layouts/index.ts +7 -1
  31. package/src/layouts/keyboard.tsx +39 -0
  32. package/src/layouts/notifications-page.tsx +63 -35
  33. package/src/layouts/screen-container.tsx +5 -1
  34. package/src/layouts/settings-page.tsx +122 -55
  35. package/src/layouts/settings-sub-page.tsx +21 -0
  36. package/dist/chunk-N4WHTQIO.js +0 -20
  37. package/dist/chunk-N4WHTQIO.js.map +0 -1
  38. package/dist/chunk-OMTXD7ND.js.map +0 -1
@@ -39,5 +39,5 @@ function useGenesisExtension(key) {
39
39
  }
40
40
 
41
41
  export { BrandExtensionsProvider, useGenesisExtension, useReducedMotion };
42
- //# sourceMappingURL=chunk-HNIEFTEL.js.map
43
- //# sourceMappingURL=chunk-HNIEFTEL.js.map
42
+ //# sourceMappingURL=chunk-F2TGDKOO.js.map
43
+ //# sourceMappingURL=chunk-F2TGDKOO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/use-reduced-motion.ts","../src/hooks/use-genesis-extension.ts"],"names":[],"mappings":";;;;AAYO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAE5C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAA,GAAU,IAAA;AACd,IAAA,iBAAA,CAAkB,qBAAA,EAAsB,CAAE,IAAA,CAAK,CAAC,CAAA,KAAM;AACpD,MAAA,IAAI,OAAA,aAAoB,CAAC,CAAA;AAAA,IAC3B,CAAC,CAAA;AACD,IAAA,MAAM,MAAM,iBAAA,CAAkB,gBAAA;AAAA,MAC5B,qBAAA;AAAA,MACA,CAAC,CAAA,KAAe,UAAA,CAAW,CAAC;AAAA,KAC9B;AACA,IAAA,OAAO,MAAM;AACX,MAAA,OAAA,GAAU,KAAA;AACV,MAAA,GAAA,EAAK,MAAA,IAAS;AAAA,IAChB,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,OAAA;AACT;ACmBA,IAAM,sBAAA,GAAyB,aAAA;AAAA,EAC7B;AACF,CAAA;AAOO,SAAS,uBAAA,CAAwB;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAAA,EAAiC;AAC/B,EAAA,OAAO,aAAA;AAAA,IACL,sBAAA,CAAuB,QAAA;AAAA,IACvB,EAAE,KAAA,EAAM;AAAA,IACR;AAAA,GACF;AACF;AAOO,SAAS,oBACd,GAAA,EACgC;AAChC,EAAA,MAAM,GAAA,GAAM,WAAW,sBAAsB,CAAA;AAC7C,EAAA,OAAO,MAAM,GAAG,CAAA;AAClB","file":"chunk-HNIEFTEL.js","sourcesContent":["/**\n * useReducedMotion — subscribe to the OS reduce-motion preference.\n *\n * Returns `true` when the user has enabled reduce-motion at the OS level.\n * Components that animate (Sheet, Drawer, Toast, etc.) honor this hook by\n * skipping non-essential transitions and snapping into final state.\n *\n * @stability Beta\n */\nimport { useEffect, useState } from \"react\";\nimport { AccessibilityInfo } from \"react-native\";\n\nexport function useReducedMotion(): boolean {\n const [reduced, setReduced] = useState(false);\n\n useEffect(() => {\n let mounted = true;\n AccessibilityInfo.isReduceMotionEnabled().then((v) => {\n if (mounted) setReduced(v);\n });\n const sub = AccessibilityInfo.addEventListener(\n \"reduceMotionChanged\",\n (v: boolean) => setReduced(v),\n );\n return () => {\n mounted = false;\n sub?.remove?.();\n };\n }, []);\n\n return reduced;\n}\n","/**\n * useGenesisExtension — read a brand-package `extensions[<key>]` token scale.\n *\n * Brand packages declare domain-specific token categories under the\n * `extensions` slot of the canonical schema (PRD-07 D8 design decision).\n * Genesis primitives don't read these — only consumer composites do — so\n * this hook is the canonical accessor.\n *\n * Resolution order:\n * 1. `BrandExtensionsContext` value (set via <BrandExtensionsProvider>)\n * 2. `undefined` — the extension key isn't declared\n *\n * Consumers wire the provider once at app root; calls anywhere downstream\n * read by key.\n *\n * <BrandExtensionsProvider value={brand.extensions}>\n * <App />\n * </BrandExtensionsProvider>\n *\n * const moodTokens = useGenesisExtension(\"mood\");\n * // moodTokens?.[500] etc. — shape is consumer-defined\n *\n * Type contract: the canonical `BrandExtensions` interface lives in\n * `@marktiderman/genesis-design-system` (declaration-merging surface). At\n * runtime, consumers may pass a partially-populated object whose keys\n * match their own augmented `BrandExtensions`. We intentionally accept\n * `Partial<BrandExtensions>` here so the provider works with brand\n * packages that haven't declared extensions yet (a common case in newly\n * scaffolded apps).\n *\n * @stability Beta\n */\nimport {\n createContext,\n createElement,\n useContext,\n type ReactNode,\n} from \"react\";\nimport type { BrandExtensions } from \"@marktiderman/genesis-design-system\";\n\n/**\n * Runtime shape passed to `<BrandExtensionsProvider>`. Consumers augment\n * the canonical `BrandExtensions` interface (in design-system) via TS\n * declaration merging; the provider accepts the resulting record.\n *\n * `Partial<>` so brand packages that have no extensions can still wrap\n * their app in the provider without TS errors.\n */\nexport type BrandExtensionsValue = Partial<BrandExtensions>;\n\nconst BrandExtensionsContext = createContext<BrandExtensionsValue | undefined>(\n undefined,\n);\n\nexport interface BrandExtensionsProviderProps {\n value?: BrandExtensionsValue;\n children: ReactNode;\n}\n\nexport function BrandExtensionsProvider({\n value,\n children,\n}: BrandExtensionsProviderProps) {\n return createElement(\n BrandExtensionsContext.Provider,\n { value },\n children,\n );\n}\n\n/**\n * Read an extension scale by key. Returns `undefined` when the provider\n * isn't mounted OR when the key isn't declared on the brand. The return\n * type follows the consumer's augmented `BrandExtensions[K]`.\n */\nexport function useGenesisExtension<K extends keyof BrandExtensions>(\n key: K,\n): BrandExtensions[K] | undefined {\n const ctx = useContext(BrandExtensionsContext);\n return ctx?.[key];\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/use-reduced-motion.ts","../src/hooks/use-genesis-extension.ts"],"names":[],"mappings":";;;;AAYO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAE5C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAA,GAAU,IAAA;AACd,IAAA,iBAAA,CAAkB,qBAAA,EAAsB,CAAE,IAAA,CAAK,CAAC,CAAA,KAAM;AACpD,MAAA,IAAI,OAAA,aAAoB,CAAC,CAAA;AAAA,IAC3B,CAAC,CAAA;AACD,IAAA,MAAM,MAAM,iBAAA,CAAkB,gBAAA;AAAA,MAC5B,qBAAA;AAAA,MACA,CAAC,CAAA,KAAe,UAAA,CAAW,CAAC;AAAA,KAC9B;AACA,IAAA,OAAO,MAAM;AACX,MAAA,OAAA,GAAU,KAAA;AACV,MAAA,GAAA,EAAK,MAAA,IAAS;AAAA,IAChB,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,OAAA;AACT;ACmBA,IAAM,sBAAA,GAAyB,aAAA;AAAA,EAC7B;AACF,CAAA;AAOO,SAAS,uBAAA,CAAwB;AAAA,EACtC,KAAA;AAAA,EACA;AACF,CAAA,EAAiC;AAC/B,EAAA,OAAO,aAAA;AAAA,IACL,sBAAA,CAAuB,QAAA;AAAA,IACvB,EAAE,KAAA,EAAM;AAAA,IACR;AAAA,GACF;AACF;AAOO,SAAS,oBACd,GAAA,EACgC;AAChC,EAAA,MAAM,GAAA,GAAM,WAAW,sBAAsB,CAAA;AAC7C,EAAA,OAAO,MAAM,GAAG,CAAA;AAClB","file":"chunk-F2TGDKOO.js","sourcesContent":["/**\n * useReducedMotion — subscribe to the OS reduce-motion preference.\n *\n * Returns `true` when the user has enabled reduce-motion at the OS level.\n * Components that animate (Sheet, Drawer, Toast, etc.) honor this hook by\n * skipping non-essential transitions and snapping into final state.\n *\n * @stability Beta\n */\nimport { useEffect, useState } from \"react\";\nimport { AccessibilityInfo } from \"react-native\";\n\nexport function useReducedMotion(): boolean {\n const [reduced, setReduced] = useState(false);\n\n useEffect(() => {\n let mounted = true;\n AccessibilityInfo.isReduceMotionEnabled().then((v) => {\n if (mounted) setReduced(v);\n });\n const sub = AccessibilityInfo.addEventListener(\n \"reduceMotionChanged\",\n (v: boolean) => setReduced(v),\n );\n return () => {\n mounted = false;\n sub?.remove?.();\n };\n }, []);\n\n return reduced;\n}\n","/**\n * useGenesisExtension — read a brand-package `extensions[<key>]` token scale.\n *\n * Brand packages declare domain-specific token categories under the\n * `extensions` slot of the canonical schema (PRD-07 D8 design decision).\n * Genesis primitives don't read these — only consumer composites do — so\n * this hook is the canonical accessor.\n *\n * Resolution order:\n * 1. `BrandExtensionsContext` value (set via <BrandExtensionsProvider>)\n * 2. `undefined` — the extension key isn't declared\n *\n * Consumers wire the provider once at app root; calls anywhere downstream\n * read by key.\n *\n * <BrandExtensionsProvider value={brand.extensions}>\n * <App />\n * </BrandExtensionsProvider>\n *\n * const moodTokens = useGenesisExtension(\"mood\");\n * // moodTokens?.[500] etc. — shape is consumer-defined\n *\n * Type contract: the canonical `BrandExtensions` interface lives in\n * `@marktiderman/genesis-design-system` (declaration-merging surface). At\n * runtime, consumers may pass a partially-populated object whose keys\n * match their own augmented `BrandExtensions`. We intentionally accept\n * `Partial<BrandExtensions>` here so the provider works with brand\n * packages that haven't declared extensions yet (a common case in newly\n * scaffolded apps).\n *\n * @stability Beta\n */\nimport {\n createContext,\n createElement,\n useContext,\n type ReactNode,\n} from \"react\";\nimport type { BrandExtensions } from \"@marktiderman/genesis-design-system\";\n\n/**\n * Runtime shape passed to `<BrandExtensionsProvider>`. Consumers augment\n * the canonical `BrandExtensions` interface (in design-system) via TS\n * declaration merging; the provider accepts the resulting record.\n *\n * `Partial<>` so brand packages that have no extensions can still wrap\n * their app in the provider without TS errors.\n */\nexport type BrandExtensionsValue = Partial<BrandExtensions>;\n\nconst BrandExtensionsContext = createContext<BrandExtensionsValue | undefined>(\n undefined,\n);\n\nexport interface BrandExtensionsProviderProps {\n value?: BrandExtensionsValue;\n children: ReactNode;\n}\n\nexport function BrandExtensionsProvider({\n value,\n children,\n}: BrandExtensionsProviderProps) {\n return createElement(\n BrandExtensionsContext.Provider,\n { value },\n children,\n );\n}\n\n/**\n * Read an extension scale by key. Returns `undefined` when the provider\n * isn't mounted OR when the key isn't declared on the brand. The return\n * type follows the consumer's augmented `BrandExtensions[K]`.\n */\nexport function useGenesisExtension<K extends keyof BrandExtensions>(\n key: K,\n): BrandExtensions[K] | undefined {\n const ctx = useContext(BrandExtensionsContext);\n return ctx?.[key];\n}\n"]}
@@ -1,12 +1,13 @@
1
1
  import { NativeSectionListHeader, NativeListItem, NativeListItemDivider, NativeEmptyState } from './chunk-ULS7I6ZS.js';
2
2
  import { NativeText, NativeButton, NativeInput } from './chunk-5HRGIA6F.js';
3
- import { useThemeMode } from './chunk-N4WHTQIO.js';
3
+ import { useThemeMode, useThemeRoles } from './chunk-Z3AQYVUA.js';
4
4
  import { cn } from './chunk-OHZD7KRO.js';
5
- import { ScrollView, View, StatusBar, Pressable, Text, TextInput, Alert, KeyboardAvoidingView, Platform, SectionList, RefreshControl } from 'react-native';
5
+ import { ScrollView, View, StatusBar, Pressable, Text, TextInput, Platform, Alert, KeyboardAvoidingView, SectionList, RefreshControl } from 'react-native';
6
6
  import { SafeAreaView } from 'react-native-safe-area-context';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
7
+ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
8
8
  import { nativeColors } from '@marktiderman/genesis-design-system/tokens/native';
9
- import { Fragment, useCallback, useState } from 'react';
9
+ import { createContext, Fragment, createElement, useContext, useCallback, useMemo, useState, useRef } from 'react';
10
+ import { renderSlot } from '@marktiderman/genesis-core/slots';
10
11
 
11
12
  function composeHeaderOptions(props) {
12
13
  const {
@@ -52,6 +53,7 @@ function ScreenContainer({
52
53
  className,
53
54
  contentClassName,
54
55
  keyboardShouldPersistTaps = "handled",
56
+ style,
55
57
  testID
56
58
  }) {
57
59
  const osMode = useThemeMode();
@@ -80,6 +82,7 @@ function ScreenContainer({
80
82
  testID: testID ?? "screen-container",
81
83
  edges: safeAreaEdges,
82
84
  className: cn("flex-1 bg-background", className),
85
+ style,
83
86
  children: [
84
87
  statusBar !== "hidden" ? /* @__PURE__ */ jsx(
85
88
  StatusBar,
@@ -237,8 +240,12 @@ function SettingsPage({
237
240
  dangerousActions,
238
241
  className,
239
242
  testID = "settings-page",
240
- children
243
+ children,
244
+ slots = {},
245
+ slotProps = {}
241
246
  }) {
247
+ const colors = useThemeRoles();
248
+ const inset = Platform.OS === "ios";
242
249
  return /* @__PURE__ */ jsxs(
243
250
  ScreenContainer,
244
251
  {
@@ -247,6 +254,7 @@ function SettingsPage({
247
254
  testID,
248
255
  contentClassName: "pb-8",
249
256
  className,
257
+ style: { backgroundColor: colors.groupedBackground },
250
258
  children: [
251
259
  children ? /* @__PURE__ */ jsx(View, { className: "px-4 pt-2", children }) : null,
252
260
  sections.map((section) => /* @__PURE__ */ jsxs(
@@ -255,65 +263,90 @@ function SettingsPage({
255
263
  testID: `${testID}-section-${section.id}`,
256
264
  className: "mt-6",
257
265
  children: [
258
- section.title ? /* @__PURE__ */ jsx(
259
- NativeSectionListHeader,
260
- {
261
- title: section.title,
262
- testID: `${testID}-section-${section.id}-header`
263
- }
266
+ section.title ? renderSlot(
267
+ DefaultSectionHeader,
268
+ slots.sectionHeader,
269
+ { title: section.title, testID: `${testID}-section-${section.id}-header` },
270
+ slotProps.sectionHeader
264
271
  ) : null,
265
- /* @__PURE__ */ jsx(View, { className: "border-y border-border bg-background", children: section.rows.map((row, rowIndex) => /* @__PURE__ */ jsxs(Fragment, { children: [
266
- /* @__PURE__ */ jsx(
267
- NativeListItem,
268
- {
269
- testID: row.testID ?? `${testID}-row-${row.id}`,
270
- title: row.title,
271
- subtitle: row.subtitle,
272
- leading: row.leading,
273
- trailing: row.trailing,
274
- showChevron: row.showChevron,
275
- onPress: row.onPress,
276
- disabled: row.disabled
277
- }
278
- ),
279
- rowIndex < section.rows.length - 1 ? /* @__PURE__ */ jsx(NativeListItemDivider, { className: "ml-4" }) : null
280
- ] }, row.id)) }),
281
- section.footnote ? /* @__PURE__ */ jsx(
282
- NativeText,
272
+ /* @__PURE__ */ jsx(
273
+ View,
283
274
  {
284
- preset: "body-sm",
285
- className: "px-4 pt-2 text-muted-foreground",
286
- children: section.footnote
275
+ className: inset ? "mx-4 overflow-hidden rounded-xl" : "border-y",
276
+ style: { backgroundColor: colors.surface, borderColor: colors.separator },
277
+ children: section.rows.map((row, rowIndex) => /* @__PURE__ */ jsx(Fragment, { children: renderSlot(
278
+ DefaultRow,
279
+ slots.row,
280
+ { ...row, testID: row.testID ?? `${testID}-row-${row.id}`, isLast: rowIndex === section.rows.length - 1 },
281
+ slotProps.row
282
+ ) }, row.id))
287
283
  }
288
- ) : null
284
+ ),
285
+ section.footnote ? renderSlot(DefaultFootnote, slots.footnote, { text: section.footnote }, slotProps.footnote) : null
289
286
  ]
290
287
  },
291
288
  section.id
292
289
  )),
293
- dangerousActions && dangerousActions.length > 0 ? /* @__PURE__ */ jsx(
294
- View,
290
+ dangerousActions && dangerousActions.length > 0 ? renderSlot(
291
+ DefaultDangerousActions,
292
+ slots.dangerousActions,
295
293
  {
296
- testID: `${testID}-dangerous-actions`,
297
- className: cn("mt-8 gap-2 px-4"),
298
- children: dangerousActions.map((action) => /* @__PURE__ */ jsx(
299
- NativeButton,
300
- {
301
- testID: action.testID ?? `${testID}-danger-${slug(action.label)}`,
302
- variant: action.emphasized ? "destructive" : "outline",
303
- onPress: action.onPress,
304
- children: action.label
305
- },
306
- action.label
307
- ))
308
- }
294
+ actions: dangerousActions.map((action) => ({ ...action, testID: action.testID ?? `${testID}-danger-${slug(action.label)}` })),
295
+ testID: `${testID}-dangerous-actions`
296
+ },
297
+ slotProps.dangerousActions
309
298
  ) : null
310
299
  ]
311
300
  }
312
301
  );
313
302
  }
303
+ function DefaultSectionHeader({ title, testID }) {
304
+ return /* @__PURE__ */ jsx(NativeSectionListHeader, { title, testID });
305
+ }
306
+ function DefaultRow({ isLast, id: _id, ...row }) {
307
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
308
+ /* @__PURE__ */ jsx(
309
+ NativeListItem,
310
+ {
311
+ testID: row.testID,
312
+ className: "bg-transparent",
313
+ title: row.title,
314
+ subtitle: row.subtitle,
315
+ leading: row.leading,
316
+ trailing: row.trailing,
317
+ showChevron: row.showChevron,
318
+ onPress: row.onPress,
319
+ disabled: row.disabled
320
+ }
321
+ ),
322
+ isLast ? null : /* @__PURE__ */ jsx(NativeListItemDivider, { className: "ml-4" })
323
+ ] });
324
+ }
325
+ function DefaultFootnote({ text }) {
326
+ return /* @__PURE__ */ jsx(NativeText, { preset: "body-sm", className: "px-4 pt-2 text-muted-foreground", children: text });
327
+ }
328
+ function DefaultDangerousActions({ actions, testID }) {
329
+ return /* @__PURE__ */ jsx(View, { testID, className: cn("mt-8 gap-2 px-4"), children: actions.map((action) => /* @__PURE__ */ jsx(
330
+ NativeButton,
331
+ {
332
+ testID: action.testID,
333
+ variant: action.emphasized ? "destructive" : "outline",
334
+ onPress: action.onPress,
335
+ children: action.label
336
+ },
337
+ action.label
338
+ )) });
339
+ }
314
340
  function slug(s) {
315
341
  return s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
316
342
  }
343
+ var KeyboardScrollContext = createContext(null);
344
+ function KeyboardScrollProvider({ component, children }) {
345
+ return createElement(KeyboardScrollContext.Provider, { value: component }, children);
346
+ }
347
+ function useKeyboardScroll() {
348
+ return useContext(KeyboardScrollContext);
349
+ }
317
350
  function confirmDiscardChanges(proceed) {
318
351
  Alert.alert(
319
352
  "Discard changes?",
@@ -378,6 +411,19 @@ function SettingsSubPage({
378
411
  },
379
412
  [onConfirmLeave]
380
413
  );
414
+ const KeyboardScroll = useKeyboardScroll();
415
+ if (KeyboardScroll) {
416
+ return /* @__PURE__ */ jsx(ScreenContainer, { safeAreaEdges: ["left", "right", "bottom"], testID, children: /* @__PURE__ */ jsx(
417
+ KeyboardScroll,
418
+ {
419
+ testID: `${testID}-keyboard`,
420
+ keyboardShouldPersistTaps: "handled",
421
+ contentInsetAdjustmentBehavior: "automatic",
422
+ bottomOffset: 24,
423
+ children: /* @__PURE__ */ jsx(View, { className: cn("p-4", className), children: /* @__PURE__ */ jsx(View, { testID: `${testID}-form`, className: "gap-4", children }) })
424
+ }
425
+ ) });
426
+ }
381
427
  return /* @__PURE__ */ jsx(
382
428
  KeyboardAvoidingView,
383
429
  {
@@ -465,9 +511,11 @@ function NotificationsPage({
465
511
  emptyTitle,
466
512
  emptyBody,
467
513
  className,
468
- testID = "notifications-page"
514
+ testID = "notifications-page",
515
+ slots = {},
516
+ slotProps = {}
469
517
  }) {
470
- const sections = groupByDate(items);
518
+ const sections = useMemo(() => groupByDate(items), [items]);
471
519
  if (items.length === 0) {
472
520
  return /* @__PURE__ */ jsx(
473
521
  SafeAreaView,
@@ -475,14 +523,15 @@ function NotificationsPage({
475
523
  testID,
476
524
  edges: ["left", "right", "bottom"],
477
525
  className: cn("flex-1 bg-background", className),
478
- children: emptyState ?? /* @__PURE__ */ jsx(
479
- NativeEmptyState,
526
+ children: emptyState ?? renderSlot(
527
+ DefaultEmpty,
528
+ slots.empty,
480
529
  {
481
- variant: "first-run",
482
530
  title: emptyTitle ?? "No notifications",
483
531
  body: emptyBody ?? "When you get a notification, it'll show up here.",
484
532
  testID: `${testID}-empty`
485
- }
533
+ },
534
+ slotProps.empty
486
535
  )
487
536
  }
488
537
  );
@@ -499,24 +548,9 @@ function NotificationsPage({
499
548
  testID: `${testID}-list`,
500
549
  sections,
501
550
  keyExtractor: (item) => item.id,
502
- renderSectionHeader: ({ section }) => /* @__PURE__ */ jsx(NativeSectionListHeader, { title: section.title }),
503
- renderItem: ({ item }) => /* @__PURE__ */ jsx(
504
- NativeListItem,
505
- {
506
- testID: item.testID ?? `${testID}-row-${item.id}`,
507
- title: item.title,
508
- subtitle: item.body,
509
- leading: item.leading ?? /* @__PURE__ */ jsx(
510
- UnreadDot,
511
- {
512
- unread: !!item.unread,
513
- testID: `${testID}-row-${item.id}-unread`
514
- }
515
- ),
516
- onPress: item.onPress
517
- }
518
- ),
519
- ItemSeparatorComponent: () => /* @__PURE__ */ jsx(View, { className: "h-px bg-border ml-4" }),
551
+ renderSectionHeader: ({ section }) => renderSlot(DefaultSectionHeader2, slots.sectionHeader, { title: section.title }, slotProps.sectionHeader),
552
+ renderItem: ({ item }) => renderSlot(DefaultRow2, slots.row, { ...item, testID: item.testID ?? `${testID}-row-${item.id}` }, slotProps.row),
553
+ ItemSeparatorComponent: RowSeparator,
520
554
  refreshControl: onRefresh ? /* @__PURE__ */ jsx(
521
555
  RefreshControl,
522
556
  {
@@ -531,6 +565,27 @@ function NotificationsPage({
531
565
  }
532
566
  );
533
567
  }
568
+ function RowSeparator() {
569
+ return /* @__PURE__ */ jsx(View, { className: "h-px bg-border ml-4" });
570
+ }
571
+ function DefaultSectionHeader2({ title }) {
572
+ return /* @__PURE__ */ jsx(NativeSectionListHeader, { title });
573
+ }
574
+ function DefaultRow2(item) {
575
+ return /* @__PURE__ */ jsx(
576
+ NativeListItem,
577
+ {
578
+ testID: item.testID,
579
+ title: item.title,
580
+ subtitle: item.body,
581
+ leading: item.leading ?? /* @__PURE__ */ jsx(UnreadDot, { unread: !!item.unread, testID: `${item.testID}-unread` }),
582
+ onPress: item.onPress
583
+ }
584
+ );
585
+ }
586
+ function DefaultEmpty({ title, body, testID }) {
587
+ return /* @__PURE__ */ jsx(NativeEmptyState, { variant: "first-run", title, body, testID });
588
+ }
534
589
  function UnreadDot({
535
590
  unread,
536
591
  testID
@@ -639,6 +694,7 @@ function AuthForm({
639
694
  const [password, setPassword] = useState("");
640
695
  const [localError, setLocalError] = useState(null);
641
696
  const [submitting, setSubmitting] = useState(false);
697
+ const passwordRef = useRef(null);
642
698
  const isMagic = mode === "magic-link";
643
699
  const resolvedSubmitLabel = submitLabel ?? (isMagic ? "Send magic link" : "Sign in");
644
700
  const handleSubmit = useCallback(async () => {
@@ -688,9 +744,12 @@ function AuthForm({
688
744
  autoCapitalize: "none",
689
745
  autoCorrect: false,
690
746
  keyboardType: "email-address",
747
+ textContentType: "emailAddress",
748
+ autoComplete: "email",
691
749
  returnKeyType: isMagic ? "send" : "next",
692
750
  editable: !loading && !submitting,
693
- onSubmitEditing: isMagic ? handleSubmit : void 0
751
+ submitBehavior: isMagic ? "blurAndSubmit" : "submit",
752
+ onSubmitEditing: isMagic ? handleSubmit : () => passwordRef.current?.focus()
694
753
  }
695
754
  )
696
755
  ] }),
@@ -699,12 +758,15 @@ function AuthForm({
699
758
  /* @__PURE__ */ jsx(
700
759
  NativeInput,
701
760
  {
761
+ ref: passwordRef,
702
762
  testID: `${testID}-password`,
703
763
  accessibilityLabel: "Password",
704
764
  value: password,
705
765
  onChangeText: setPassword,
706
766
  placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
707
767
  secureTextEntry: true,
768
+ textContentType: "password",
769
+ autoComplete: "current-password",
708
770
  autoCapitalize: "none",
709
771
  autoCorrect: false,
710
772
  returnKeyType: "send",
@@ -755,7 +817,60 @@ function ForgotPasswordLink({
755
817
  }
756
818
  );
757
819
  }
820
+ function AuthScreen({
821
+ branding,
822
+ providers,
823
+ form,
824
+ onForgotPassword,
825
+ footer,
826
+ slots = {},
827
+ slotProps = {},
828
+ testID = "auth-screen"
829
+ }) {
830
+ warnIfNoAppleSignIn(providers);
831
+ const forgot = onForgotPassword && (form.mode ?? "password") === "password" ? /* @__PURE__ */ jsx(ForgotPasswordLink, { onPress: onForgotPassword }) : null;
832
+ const formProps = { ...form, belowFields: form.belowFields ?? forgot, testID: form.testID ?? `${testID}-form` };
833
+ const KeyboardScroll = useKeyboardScroll();
834
+ const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
835
+ branding ? renderSlot(AuthBranding, slots.branding, { ...branding, testID: branding.testID ?? `${testID}-branding` }, slotProps.branding) : null,
836
+ providers?.length ? renderSlot(DefaultSocial, slots.social, { providers, testID: `${testID}-social` }, slotProps.social) : null,
837
+ renderSlot(AuthForm, slots.form, formProps, slotProps.form),
838
+ footer ? renderSlot(DefaultFooter, slots.footer, { children: footer, testID: `${testID}-footer` }, slotProps.footer) : null
839
+ ] });
840
+ if (KeyboardScroll) {
841
+ return /* @__PURE__ */ jsx(ScreenContainer, { testID, children: /* @__PURE__ */ jsx(
842
+ KeyboardScroll,
843
+ {
844
+ testID: `${testID}-keyboard`,
845
+ keyboardShouldPersistTaps: "handled",
846
+ contentInsetAdjustmentBehavior: "automatic",
847
+ bottomOffset: 24,
848
+ contentContainerStyle: { flexGrow: 1, justifyContent: "center", gap: 24, paddingHorizontal: 24, paddingVertical: 32 },
849
+ children: content
850
+ }
851
+ ) });
852
+ }
853
+ return /* @__PURE__ */ jsx(KeyboardAvoidingView, { testID: `${testID}-kav`, style: { flex: 1 }, behavior: Platform.OS === "ios" ? "padding" : void 0, children: /* @__PURE__ */ jsx(ScreenContainer, { scroll: true, keyboardShouldPersistTaps: "handled", testID, contentClassName: "flex-grow justify-center gap-6 px-6 py-8", children: content }) });
854
+ }
855
+ var warnedNoApple = /* @__PURE__ */ new Set();
856
+ function warnIfNoAppleSignIn(providers) {
857
+ const dev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env.NODE_ENV !== "production";
858
+ if (!dev || Platform.OS !== "ios" || !providers?.length) return;
859
+ if (providers.some((p) => p.id === "apple")) return;
860
+ const ids = providers.map((p) => p.id).join(",");
861
+ if (warnedNoApple.has(ids)) return;
862
+ warnedNoApple.add(ids);
863
+ console.warn(
864
+ `[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 a provider with id "apple".`
865
+ );
866
+ }
867
+ function DefaultSocial({ providers, testID }) {
868
+ return /* @__PURE__ */ jsx(SocialAuthRow, { providers, testID });
869
+ }
870
+ function DefaultFooter({ children, testID }) {
871
+ return /* @__PURE__ */ jsx(View, { testID, className: "items-center", children });
872
+ }
758
873
 
759
- export { AuthBranding, AuthForm, ForgotPasswordLink, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, composeHeaderOptions, confirmDiscardChanges, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions };
760
- //# sourceMappingURL=chunk-OMTXD7ND.js.map
761
- //# sourceMappingURL=chunk-OMTXD7ND.js.map
874
+ export { AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, composeHeaderOptions, confirmDiscardChanges, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, useKeyboardScroll };
875
+ //# sourceMappingURL=chunk-U2SPACTV.js.map
876
+ //# sourceMappingURL=chunk-U2SPACTV.js.map