@marktiderman/genesis-ui-native 3.2.2 → 3.4.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 (32) hide show
  1. package/dist/{chunk-C6Q5ZAVT.js → chunk-6KWEAGRD.js} +2 -2
  2. package/dist/chunk-6KWEAGRD.js.map +1 -0
  3. package/dist/{chunk-PO3MK6IY.js → chunk-GHYUNNNU.js} +3 -3
  4. package/dist/{chunk-PO3MK6IY.js.map → chunk-GHYUNNNU.js.map} +1 -1
  5. package/dist/{chunk-7HWS2JGX.js → chunk-LBVD7XXL.js} +3 -3
  6. package/dist/{chunk-7HWS2JGX.js.map → chunk-LBVD7XXL.js.map} +1 -1
  7. package/dist/{chunk-ON7WP4T6.js → chunk-VZ3PQLZ4.js} +4 -4
  8. package/dist/{chunk-ON7WP4T6.js.map → chunk-VZ3PQLZ4.js.map} +1 -1
  9. package/dist/{chunk-SXCG2REG.js → chunk-ZHVQTMNV.js} +3 -3
  10. package/dist/{chunk-SXCG2REG.js.map → chunk-ZHVQTMNV.js.map} +1 -1
  11. package/dist/components/index.d.ts +2 -2
  12. package/dist/components/index.js +3 -3
  13. package/dist/data/index.d.ts +42 -5
  14. package/dist/data/index.js +210 -20
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/icons/lucide.d.ts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +5 -5
  19. package/dist/layouts/index.js +3 -3
  20. package/dist/{native-modules-_Q5vIbd5.d.ts → native-modules-PwnGltOU.d.ts} +27 -1
  21. package/package.json +3 -3
  22. package/src/components/index.ts +2 -0
  23. package/src/data/NativeResourceFormField.tsx +12 -3
  24. package/src/data/resource-view/NativeLinkPicker.tsx +191 -0
  25. package/src/data/resource-view/NativeResourceFormSheet.tsx +25 -1
  26. package/src/data/resource-view/__tests__/native-link-picker.test.tsx +201 -0
  27. package/src/data/resource-view/__tests__/native-tel-field.test.tsx +79 -0
  28. package/src/data/resource-view/mapping.ts +60 -7
  29. package/src/data/resource-view/messages.ts +25 -0
  30. package/src/data/resource-view/use-native-resource-view.ts +21 -10
  31. package/src/native-modules.tsx +22 -1
  32. package/dist/chunk-C6Q5ZAVT.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { o as NativeIconName, c as GenesisIconComponent } from '../native-modules-_Q5vIbd5.js';
1
+ import { q as NativeIconName, c as GenesisIconComponent } from '../native-modules-PwnGltOU.js';
2
2
  import 'react';
3
3
  import 'react-native';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { Box, BoxBackground, BoxProps, FULL_SCREEN_DARK, FlexAlign, FlexJustify, Grid, GridProps, Inline, InlineProps, NativeAccordion, NativeAccordionContent, NativeAccordionContentProps, NativeAccordionItem, NativeAccordionItemProps, NativeAccordionProps, NativeAccordionTrigger, NativeAccordionTriggerProps, NativeAccordionType, NativeAlert, NativeAlertDescription, NativeAlertDescriptionProps, NativeAlertProps, NativeAlertTitle, NativeAlertTitleProps, NativeAvatar, NativeAvatarProps, NativeBadge, NativeBadgeProps, NativeBanner, NativeBannerProps, NativeButton, NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardProps, NativeCardTitle, NativeCardTitleProps, NativeCheckbox, NativeCheckboxProps, NativeChip, NativeChipGroup, NativeChipGroupMode, NativeChipGroupProps, NativeChipProps, NativeCombobox, NativeComboboxOption, NativeComboboxProps, NativeDatePicker, NativeDatePickerProps, NativeDialog, NativeDialogContent, NativeDialogContentProps, NativeDialogDescription, NativeDialogDescriptionProps, NativeDialogFooter, NativeDialogFooterProps, NativeDialogHeader, NativeDialogHeaderProps, NativeDialogProps, NativeDialogTitle, NativeDialogTitleProps, NativeDrawer, NativeDrawerProps, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuContentProps, NativeDropdownMenuItem, NativeDropdownMenuItemProps, NativeDropdownMenuProps, NativeDropdownMenuTrigger, NativeDropdownMenuTriggerProps, NativeEmptyState, NativeEmptyStateProps, NativeEmptyStateVariant, NativeFullScreenModal, NativeFullScreenModalProps, NativeGlassSurface, NativeGlassSurfaceProps, NativeHeaderCard, NativeHeaderCardProps, NativeIcon, NativeIconProps, NativeImage, NativeImageProps, NativeInlineAlert, NativeInlineAlertProps, NativeInlineAlertVariant, NativeInput, NativeInputProps, NativeLabel, NativeLabelProps, NativeListItem, NativeListItemDivider, NativeListItemProps, NativeLoadingState, NativeLoadingStateEdge, NativeLoadingStateProps, NativeNumberInput, NativeNumberInputProps, NativePagination, NativePaginationProps, NativePopover, NativePopoverContent, NativePopoverContentProps, NativePopoverProps, NativePopoverTrigger, NativePopoverTriggerProps, NativeProgress, NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, NativeRadioGroupItemProps, NativeRadioGroupProps, NativeRangeSlider, NativeRangeSliderProps, NativeRefreshControl, NativeRefreshControlProps, NativeSearchBar, NativeSearchBarProps, NativeSectionListHeader, NativeSectionListHeaderProps, NativeSegmentedControl, NativeSegmentedControlOption, NativeSegmentedControlProps, NativeSelect, NativeSelectContent, NativeSelectContentProps, NativeSelectItem, NativeSelectItemProps, NativeSelectProps, NativeSelectTrigger, NativeSelectTriggerProps, NativeSeparator, NativeSeparatorProps, NativeSheet, NativeSheetLibrary, NativeSheetProps, NativeSheetProvider, NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, NativeSkeletonProps, NativeSlider, NativeSliderProps, NativeStepper, NativeStepperProps, NativeStepperStep, NativeSwitch, NativeSwitchProps, NativeTabs, NativeTabsContent, NativeTabsContentProps, NativeTabsList, NativeTabsListProps, NativeTabsProps, NativeTabsTrigger, NativeTabsTriggerProps, NativeText, NativeTextProps, NativeTextarea, NativeTextareaProps, NativeTimePicker, NativeTimePickerProps, NativeToastOptions, NativeToastProvider, NativeToastProviderProps, NativeToastVariant, NativeToggle, NativeToggleProps, NativeTooltip, NativeTooltipContent, NativeTooltipContentProps, NativeTooltipProps, NativeTooltipTrigger, NativeTooltipTriggerProps, SpaceToken, SpacingPrefix, Stack, StackProps, TextPreset, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, spaceScale, spacingClass, textVariants, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './components/index.js';
2
- export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, b as GenesisGlassModule, c as GenesisIconComponent, d as GenesisIconSet, e as GenesisImageComponent, f as GenesisImageProps, g as GenesisListComponent, h as GenesisListProps, i as GenesisModules, j as GenesisModulesProvider, k as GenesisModulesProviderProps, l as GenesisReanimatedModule, m as GenesisSymbolComponent, n as GenesisSymbolProps, N as NATIVE_ICON_NAMES, o as NativeIconName, S as SF_SYMBOLS, u as useGenesisModules } from './native-modules-_Q5vIbd5.js';
2
+ export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, b as GenesisGlassModule, c as GenesisIconComponent, d as GenesisIconSet, e as GenesisImageComponent, f as GenesisImageProps, g as GenesisListComponent, h as GenesisListProps, i as GenesisModules, j as GenesisModulesProvider, k as GenesisModulesProviderProps, l as GenesisNavigationModule, m as GenesisNavigationTheme, n as GenesisReanimatedModule, o as GenesisSymbolComponent, p as GenesisSymbolProps, N as NATIVE_ICON_NAMES, q as NativeIconName, S as SF_SYMBOLS, u as useGenesisModules } from './native-modules-PwnGltOU.js';
3
3
  export { BrandExtensionsProvider, BrandExtensionsProviderProps, BrandExtensionsValue, ThemeMode, ThemeRoleColors, UseThemeRolesOptions, useGenesisExtension, useReducedMotion, useThemeMode, useThemeRoles } from './hooks/index.js';
4
4
  export { I as InboxItem, a as InboxPage, b as InboxPageProps, c as InboxPageSlotMap, d as InboxSwipeAction, S as SafeAreaEdge, e as ScreenContainer, f as ScreenContainerProps, g as ScreenHeaderProps, h as ScrollEdgeBehavior, i as composeHeaderOptions, j as formatInboxTime, k as getInboxPageStackOptions, s as showInboxActions } from './inbox-page-DZUR-PJ1.js';
5
5
  export { AppleButtonModuleLike, AppleProviderOptions, AppleSignInButton, AppleSignInButtonProps, AuthBranding, AuthBrandingProps, AuthForm, AuthFormProps, AuthFormValues, AuthScreen, AuthScreenProps, AuthScreenSlotMap, ForgotPasswordLink, GoogleProviderOptions, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProps, KeyboardScrollProvider, KeyboardToolbarProps, NavBarSaveButton, NavBarSaveButtonProps, NavBarSearchBar, NavBarSearchBarProps, NavBarTitle, NavBarTitleProps, NotificationItem, NotificationsPage, NotificationsPageProps, NotificationsPageSlotMap, SettingsPage, SettingsPageDangerousAction, SettingsPageProps, SettingsPageRow, SettingsPageSection, SettingsPageSlotMap, SettingsSubPage, SettingsSubPageProps, SocialAuthProvider, SocialAuthRow, SocialAuthRowProps, ThreadAttachment, ThreadComposer, ThreadLabels, ThreadMessage, ThreadPage, ThreadPageProps, ThreadPageSlotMap, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './layouts/index.js';
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeChip, NativeChipGroup, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-7HWS2JGX.js';
2
- export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeBanner, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeImage, NativeInlineAlert, NativeLabel, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants } from './chunk-PO3MK6IY.js';
1
+ export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeChip, NativeChipGroup, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-LBVD7XXL.js';
2
+ export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeBanner, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeImage, NativeInlineAlert, NativeLabel, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants } from './chunk-GHYUNNNU.js';
3
3
  export { BrandExtensionsProvider, useGenesisExtension } from './chunk-D5RKSPMH.js';
4
4
  export { useReducedMotion } from './chunk-7PCWEY6R.js';
5
- export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './chunk-ON7WP4T6.js';
6
- export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from './chunk-SXCG2REG.js';
7
- export { GenesisModulesProvider, NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from './chunk-C6Q5ZAVT.js';
5
+ export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './chunk-VZ3PQLZ4.js';
6
+ export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from './chunk-ZHVQTMNV.js';
7
+ export { GenesisModulesProvider, NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from './chunk-6KWEAGRD.js';
8
8
  export { useThemeMode, useThemeRoles } from './chunk-Z3AQYVUA.js';
9
9
  export { cn } from './chunk-OHZD7KRO.js';
10
10
  import './chunk-DGUM43GV.js';
@@ -1,6 +1,6 @@
1
- export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from '../chunk-ON7WP4T6.js';
2
- export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from '../chunk-SXCG2REG.js';
3
- import '../chunk-C6Q5ZAVT.js';
1
+ export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from '../chunk-VZ3PQLZ4.js';
2
+ export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from '../chunk-ZHVQTMNV.js';
3
+ import '../chunk-6KWEAGRD.js';
4
4
  import '../chunk-Z3AQYVUA.js';
5
5
  import '../chunk-OHZD7KRO.js';
6
6
  import '../chunk-DGUM43GV.js';
@@ -199,6 +199,31 @@ interface GenesisDatePickerProps {
199
199
  }
200
200
  /** The default export of `@expo/ui/community/datetime-picker`. */
201
201
  type GenesisDatePickerComponent = ComponentType<GenesisDatePickerProps>;
202
+ /** A React Navigation theme (`ReactNavigation.Theme`): the colors Genesis sets, and the fonts it keeps. */
203
+ interface GenesisNavigationTheme {
204
+ dark: boolean;
205
+ colors: {
206
+ primary: ColorValue;
207
+ background: ColorValue;
208
+ card: ColorValue;
209
+ text: ColorValue;
210
+ border: ColorValue;
211
+ notification: ColorValue;
212
+ };
213
+ fonts?: unknown;
214
+ }
215
+ /**
216
+ * React Navigation's theming. In an Expo Router app take it from `expo-router`: it bundles its own
217
+ * React Navigation, and its navigators read that copy's theme, not `@react-navigation/native`'s.
218
+ */
219
+ interface GenesisNavigationModule {
220
+ ThemeProvider: ComponentType<{
221
+ value: any;
222
+ children: ReactNode;
223
+ }>;
224
+ DefaultTheme: GenesisNavigationTheme;
225
+ DarkTheme: GenesisNavigationTheme;
226
+ }
202
227
  /** Every optional native module Genesis components can use. Each is optional on its own. */
203
228
  interface GenesisModules {
204
229
  list?: GenesisListComponent;
@@ -208,6 +233,7 @@ interface GenesisModules {
208
233
  symbol?: GenesisSymbolComponent;
209
234
  icons?: GenesisIconSet;
210
235
  datePicker?: GenesisDatePickerComponent;
236
+ navigation?: GenesisNavigationModule;
211
237
  }
212
238
  interface GenesisModulesProviderProps {
213
239
  modules: GenesisModules;
@@ -224,4 +250,4 @@ declare function GenesisModulesProvider({ modules, children }: GenesisModulesPro
224
250
  /** The modules given to the nearest `GenesisModulesProvider`; `{}` without one. */
225
251
  declare function useGenesisModules(): GenesisModules;
226
252
 
227
- export { type GenesisDatePickerComponent as G, NATIVE_ICON_NAMES as N, SF_SYMBOLS as S, type GenesisDatePickerProps as a, type GenesisGlassModule as b, type GenesisIconComponent as c, type GenesisIconSet as d, type GenesisImageComponent as e, type GenesisImageProps as f, type GenesisListComponent as g, type GenesisListProps as h, type GenesisModules as i, GenesisModulesProvider as j, type GenesisModulesProviderProps as k, type GenesisReanimatedModule as l, type GenesisSymbolComponent as m, type GenesisSymbolProps as n, type NativeIconName as o, useGenesisModules as u };
253
+ export { type GenesisDatePickerComponent as G, NATIVE_ICON_NAMES as N, SF_SYMBOLS as S, type GenesisDatePickerProps as a, type GenesisGlassModule as b, type GenesisIconComponent as c, type GenesisIconSet as d, type GenesisImageComponent as e, type GenesisImageProps as f, type GenesisListComponent as g, type GenesisListProps as h, type GenesisModules as i, GenesisModulesProvider as j, type GenesisModulesProviderProps as k, type GenesisNavigationModule as l, type GenesisNavigationTheme as m, type GenesisReanimatedModule as n, type GenesisSymbolComponent as o, type GenesisSymbolProps as p, type NativeIconName as q, useGenesisModules as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marktiderman/genesis-ui-native",
3
- "version": "3.2.2",
3
+ "version": "3.4.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -83,8 +83,8 @@
83
83
  "@expo/ui": ">=58.0.0",
84
84
  "@gorhom/bottom-sheet": ">=5.0.0",
85
85
  "@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
86
- "@marktiderman/genesis-core": "^2.4.0",
87
- "@marktiderman/genesis-design-system": "^1.6.0",
86
+ "@marktiderman/genesis-core": "^2.6.0",
87
+ "@marktiderman/genesis-design-system": "^1.7.0",
88
88
  "@react-native-community/datetimepicker": ">=8.0.0",
89
89
  "@shopify/flash-list": ">=2.0.0",
90
90
  "@tanstack/react-query": "^5.0.0",
@@ -282,6 +282,8 @@ export type {
282
282
  GenesisIconSet,
283
283
  GenesisDatePickerComponent,
284
284
  GenesisDatePickerProps,
285
+ GenesisNavigationModule,
286
+ GenesisNavigationTheme,
285
287
  } from "../native-modules";
286
288
 
287
289
  export { NativeIcon } from "./icon";
@@ -1,7 +1,7 @@
1
1
  import { titleCase } from "@marktiderman/genesis-core";
2
2
  import type { ResourceFormFieldDef } from "@marktiderman/genesis-core";
3
3
  import { Controller, type Control } from "react-hook-form";
4
- import { Pressable, View } from "react-native";
4
+ import { Pressable, View, type TextInputProps } from "react-native";
5
5
  import { NativeCheckbox } from "../components/checkbox";
6
6
  import { NativeInput } from "../components/input";
7
7
  import { NativeLabel } from "../components/label";
@@ -31,9 +31,10 @@ export interface NativeResourceFormFieldRendererProps {
31
31
  // Static lookup maps (module-scoped to avoid re-creation on each render)
32
32
  // ---------------------------------------------------------------------------
33
33
 
34
- const KEYBOARD_TYPE_MAP: Record<string, "default" | "email-address" | "url"> = {
34
+ const KEYBOARD_TYPE_MAP: Record<string, "default" | "email-address" | "url" | "phone-pad"> = {
35
35
  email: "email-address",
36
36
  url: "url",
37
+ tel: "phone-pad",
37
38
  text: "default",
38
39
  date: "default",
39
40
  };
@@ -41,6 +42,7 @@ const KEYBOARD_TYPE_MAP: Record<string, "default" | "email-address" | "url"> = {
41
42
  const AUTO_CAPITALIZE_MAP: Record<string, "none" | "sentences" | "words" | "characters"> = {
42
43
  email: "none",
43
44
  url: "none",
45
+ tel: "none",
44
46
  text: "sentences",
45
47
  date: "none",
46
48
  };
@@ -246,7 +248,9 @@ function NativeResourceFormFieldRenderer({
246
248
  }
247
249
 
248
250
  // ------------------------------------------------------------------
249
- // Text, email, url, date (and any other text-like types)
251
+ // Text, email, tel, url, date (and any other text-like types). Autofill only when the
252
+ // field asks for it (as on the web): on a form about someone else it would fill in the
253
+ // person holding the phone.
250
254
  // ------------------------------------------------------------------
251
255
  return (
252
256
  <View className="gap-1.5">
@@ -255,6 +259,11 @@ function NativeResourceFormFieldRenderer({
255
259
  placeholder={field.placeholder}
256
260
  keyboardType={KEYBOARD_TYPE_MAP[fieldType] ?? "default"}
257
261
  autoCapitalize={AUTO_CAPITALIZE_MAP[fieldType] ?? "sentences"}
262
+ {...(field.autoComplete
263
+ ? { autoComplete: field.autoComplete as TextInputProps["autoComplete"] }
264
+ : {})}
265
+ {...(field.inputMode ? { inputMode: field.inputMode } : {})}
266
+ {...(field.enterKeyHint ? { enterKeyHint: field.enterKeyHint } : {})}
258
267
  value={f.value != null ? String(f.value) : ""}
259
268
  onChangeText={f.onChange}
260
269
  editable={!isDisabled}
@@ -0,0 +1,191 @@
1
+ // A link's picker in NativeResourceView's form sheet (docs/RESOURCE-VIEW.md, "Links in forms"): the
2
+ // same rows as the web's RelationField, from core's useLinkOptions: the linked resource through
3
+ // the provider, under the linked view's scope and default filter, searched on the server and a
4
+ // page at a time. A row shows the chosen row's words; pressing it opens the list in place (no
5
+ // second sheet over the form), with a search bar, None for an optional link, and Show more.
6
+
7
+ import { useEffect, useMemo, useState } from "react";
8
+ import { Pressable, Text, View } from "react-native";
9
+ import { useLinkOptions, useRelationLabel, useViewer } from "@marktiderman/genesis-core/hooks";
10
+ import { NativeLabel } from "../../components/label";
11
+ import { NativeSearchBar } from "../../components/search-bar";
12
+ import { NativeText } from "../../components/text";
13
+ import { NativeButton } from "../../components/button";
14
+ import { isEmptyValue, useNativeResourceViewMessages } from "./display";
15
+ import { defaultNativeResourceViewMessages } from "./messages";
16
+ import type { NativeFormField } from "./mapping";
17
+
18
+ /** How long typing settles before the search goes to the server. */
19
+ const SEARCH_DEBOUNCE_MS = 300;
20
+
21
+ export interface NativeLinkPickerProps {
22
+ field: NativeFormField;
23
+ value: unknown;
24
+ /** The picked row's key as the row holds it; `null` when None is chosen. */
25
+ onChange: (value: string | number | null) => void;
26
+ /** The form's values, for a picker whose filters follow another field. */
27
+ values: Readonly<Record<string, unknown>>;
28
+ error?: string | undefined;
29
+ testID: string;
30
+ }
31
+
32
+ export function NativeLinkPicker({ field, value, onChange, values, error, testID }: NativeLinkPickerProps) {
33
+ const messages = useNativeResourceViewMessages();
34
+ const words = { ...defaultNativeResourceViewMessages.link!, ...messages.link };
35
+ const link = field.link!;
36
+ const viewer = useViewer();
37
+ const [open, setOpen] = useState(false);
38
+ const [query, setQuery] = useState("");
39
+ const [search, setSearch] = useState("");
40
+ useEffect(() => {
41
+ const timer = setTimeout(() => setSearch(query), SEARCH_DEBOUNCE_MS);
42
+ return () => clearTimeout(timer);
43
+ }, [query]);
44
+
45
+ // By value: the sheet re-renders on every keystroke.
46
+ const filtersKey = JSON.stringify(link.filters(viewer.scope, values));
47
+ const filters = useMemo(() => JSON.parse(filtersKey) as ReturnType<typeof link.filters>, [filtersKey]);
48
+ const labelField = field.labelField ?? link.labelField;
49
+ const list = useLinkOptions(
50
+ { resource: link.resource, field: link.field, labelField, searchFields: link.searchFields },
51
+ { filters, search, enabled: open, untitled: words.untitled! },
52
+ );
53
+
54
+ const loaded = isEmptyValue(value) ? undefined : list.options.find((o) => String(o.value) === String(value));
55
+ const looked = useRelationLabel({ resource: link.resource, field: link.field }, value, {
56
+ ...((list.labelField ?? labelField) ? { labelField: (list.labelField ?? labelField)! } : {}),
57
+ enabled: !isEmptyValue(value) && !loaded,
58
+ });
59
+ const chosen = isEmptyValue(value)
60
+ ? null
61
+ : (loaded?.label ??
62
+ (looked === undefined
63
+ ? undefined
64
+ : (looked ?? field.missingLabel ?? messages.common.hiddenLink ?? defaultNativeResourceViewMessages.common.hiddenLink!)));
65
+ const shown = chosen === undefined ? messages.common.empty : (chosen ?? words.placeholder!);
66
+
67
+ const pick = (next: string | number | null) => {
68
+ onChange(next);
69
+ setOpen(false);
70
+ setQuery("");
71
+ };
72
+
73
+ return (
74
+ <View testID={testID} style={{ gap: 6 }}>
75
+ <NativeLabel>{field.label}</NativeLabel>
76
+ <Pressable
77
+ testID={`${testID}-trigger`}
78
+ accessibilityRole="button"
79
+ // The error is read with the field, not only shown under it.
80
+ accessibilityLabel={error ? `${field.label}, ${shown}, ${error}` : `${field.label}, ${shown}`}
81
+ accessibilityState={{ expanded: open }}
82
+ onPress={() => setOpen((was) => !was)}
83
+ className="min-h-[44px] flex-row items-center justify-between rounded-md border border-input bg-background px-3"
84
+ >
85
+ <Text className={chosen ? "text-base text-foreground" : "text-base text-muted-foreground"} numberOfLines={1}>
86
+ {shown}
87
+ </Text>
88
+ <Text className="text-muted-foreground" accessible={false}>
89
+ {open ? "▴" : "▾"}
90
+ </Text>
91
+ </Pressable>
92
+ {open ? (
93
+ <View testID={`${testID}-list`} style={{ gap: 4 }} accessibilityRole="radiogroup" accessibilityLabel={field.label}>
94
+ {list.searchable ? (
95
+ <NativeSearchBar
96
+ testID={`${testID}-search`}
97
+ value={query}
98
+ onChange={setQuery}
99
+ placeholder={words.search!}
100
+ showCancel={false}
101
+ />
102
+ ) : null}
103
+ {!field.required && query === "" ? (
104
+ <Option
105
+ testID={`${testID}-none`}
106
+ label={words.none!}
107
+ muted
108
+ selected={isEmptyValue(value)}
109
+ onPress={() => pick(null)}
110
+ />
111
+ ) : null}
112
+ {list.isLoading ? (
113
+ <NativeText preset="caption" className="px-3 py-2 text-muted-foreground" testID={`${testID}-loading`}>
114
+ {messages.form.loading}
115
+ </NativeText>
116
+ ) : list.isError ? (
117
+ <NativeText preset="caption" className="px-3 py-2 text-destructive" accessibilityRole="alert">
118
+ {words.loadFailed}
119
+ </NativeText>
120
+ ) : list.options.length === 0 ? (
121
+ <NativeText preset="caption" className="px-3 py-2 text-muted-foreground" testID={`${testID}-empty`}>
122
+ {words.noResults}
123
+ </NativeText>
124
+ ) : (
125
+ list.options.map((option) => (
126
+ <Option
127
+ key={String(option.value)}
128
+ testID={`${testID}-option-${String(option.value)}`}
129
+ label={option.label}
130
+ selected={!isEmptyValue(value) && String(value) === String(option.value)}
131
+ onPress={() => pick(option.value)}
132
+ />
133
+ ))
134
+ )}
135
+ {list.hasMore ? (
136
+ <NativeButton
137
+ variant="ghost"
138
+ size="sm"
139
+ testID={`${testID}-more`}
140
+ disabled={list.isLoadingMore}
141
+ onPress={list.loadMore}
142
+ >
143
+ {list.isLoadingMore ? messages.list.loadingMore : words.loadMore!}
144
+ </NativeButton>
145
+ ) : null}
146
+ </View>
147
+ ) : null}
148
+ {error ? (
149
+ // A live region on Android; the alert role on iOS and the web.
150
+ <View accessibilityLiveRegion="polite">
151
+ <NativeText preset="caption" className="text-destructive" testID={`${testID}-error`} accessibilityRole="alert">
152
+ {error}
153
+ </NativeText>
154
+ </View>
155
+ ) : null}
156
+ </View>
157
+ );
158
+ }
159
+
160
+ function Option({
161
+ label,
162
+ selected,
163
+ muted = false,
164
+ onPress,
165
+ testID,
166
+ }: {
167
+ label: string;
168
+ selected: boolean;
169
+ muted?: boolean;
170
+ onPress: () => void;
171
+ testID: string;
172
+ }) {
173
+ return (
174
+ <Pressable
175
+ testID={testID}
176
+ // One choice of several: a radio, checked when it's the link's row.
177
+ accessibilityRole="radio"
178
+ accessibilityLabel={label}
179
+ accessibilityState={{ checked: selected }}
180
+ onPress={onPress}
181
+ className="min-h-[44px] flex-row items-center justify-between px-3"
182
+ >
183
+ <Text className={muted ? "text-base text-muted-foreground" : "text-base text-foreground"}>{label}</Text>
184
+ {selected ? (
185
+ <Text className="text-base text-primary" accessible={false}>
186
+ ✓
187
+ </Text>
188
+ ) : null}
189
+ </Pressable>
190
+ );
191
+ }
@@ -1,6 +1,7 @@
1
1
  // The form sheet a NativeResourceView opens for New and Edit: Cancel and Save in the bar, the
2
2
  // view's sections as grouped sections, native date and time pickers, choices as a segmented
3
- // control (up to four) or a list. Text, number, switch and list fields are drawn by
3
+ // control (up to four) or a list, links as a searchable list of the linked rows (NativeLinkPicker).
4
+ // Text, number, switch and list fields are drawn by
4
5
  // NativeResourceFormFieldRenderer, the same as NativeResourceForm. Read-only fields are text, never
5
6
  // inputs, and a save sends only the view's writable keys.
6
7
 
@@ -22,6 +23,7 @@ import { NativeResourceFormFieldRenderer } from "../NativeResourceFormField";
22
23
  import { dateToDay, dayToDate, displayText, isEmptyValue, resolveZone, useDisplayTimeZones, useNativeResourceViewMessages } from "./display";
23
24
  import { defaultNativeResourceViewMessages, fill } from "./messages";
24
25
  import { shownFields, type NativeFormField } from "./mapping";
26
+ import { NativeLinkPicker } from "./NativeLinkPicker";
25
27
  import type { SaveResult } from "./use-native-resource-view";
26
28
 
27
29
  type Values = Record<string, unknown>;
@@ -46,6 +48,7 @@ export interface NativeResourceFormSheetProps {
46
48
  const FIELD_TYPE: Partial<Record<NativeFormField["kind"], ResourceFormFieldDef["type"]>> = {
47
49
  text: "text",
48
50
  email: "email",
51
+ tel: "tel",
49
52
  url: "url",
50
53
  number: "number",
51
54
  textarea: "textarea",
@@ -221,6 +224,24 @@ function FormField({
221
224
  </View>
222
225
  );
223
226
  }
227
+ if (field.kind === "link" && field.link) {
228
+ return (
229
+ <Controller
230
+ name={field.key}
231
+ control={f.control}
232
+ render={({ field: input }) => (
233
+ <NativeLinkPicker
234
+ field={field}
235
+ value={input.value}
236
+ onChange={input.onChange}
237
+ values={f.getValues()}
238
+ error={error}
239
+ testID={id}
240
+ />
241
+ )}
242
+ />
243
+ );
244
+ }
224
245
  const type = FIELD_TYPE[field.kind];
225
246
  if (type) {
226
247
  const def: ResourceFormFieldDef = {
@@ -230,6 +251,9 @@ function FormField({
230
251
  required: field.required,
231
252
  ...(field.options ? { options: field.options } : {}),
232
253
  ...(field.max !== undefined ? { maxLength: field.max } : {}),
254
+ ...(field.autoComplete ? { autoComplete: field.autoComplete } : {}),
255
+ ...(field.inputMode ? { inputMode: field.inputMode } : {}),
256
+ ...(field.enterKeyHint ? { enterKeyHint: field.enterKeyHint } : {}),
233
257
  };
234
258
  return (
235
259
  <View testID={id}>
@@ -0,0 +1,201 @@
1
+ // @feat:resource-view-links
2
+ /**
3
+ * A link's picker in NativeResourceView's form sheet: the linked rows through the provider, under
4
+ * the linked view's scope and default filter; the picked key saved; None clears to null; a link
5
+ * the screen's filter pins stays read-only.
6
+ */
7
+ import { act, fireEvent, render, renderHook, screen, waitFor, within } from "@testing-library/react";
8
+ import { QueryClient } from "@tanstack/react-query";
9
+ import type { ReactNode } from "react";
10
+ import { describe, expect, it, vi } from "vitest";
11
+ import { defineResource, GenesisProvider, ViewerScope, type DataProvider, type FilterParam, type ListParams } from "@marktiderman/genesis-core";
12
+ import { defineView } from "@marktiderman/genesis-core/resource-view";
13
+ import { formFieldsFor, NativeResourceView, useNativeResourceView, writableValues } from "..";
14
+
15
+ type Task = { id: string; org_id: string; title: string; owner_id: string; reviewer_id: string | null };
16
+ type Person = { id: string; org_id: string; full_name: string; active: boolean };
17
+
18
+ const tasks = defineResource<Task>()({
19
+ name: "tasks",
20
+ key: "id",
21
+ labelField: "title",
22
+ fields: [
23
+ { name: "id", type: "string", hasDefault: true },
24
+ { name: "org_id", type: "string" },
25
+ { name: "title", type: "string" },
26
+ { name: "owner_id", type: "string", references: { resource: "people", field: "id" } },
27
+ { name: "reviewer_id", type: "string", nullable: true, references: { resource: "people", field: "id" } },
28
+ ],
29
+ });
30
+ const people = defineResource<Person>()({
31
+ name: "people",
32
+ key: "id",
33
+ labelField: "full_name",
34
+ fields: [
35
+ { name: "id", type: "string" },
36
+ { name: "org_id", type: "string" },
37
+ { name: "full_name", type: "string" },
38
+ { name: "active", type: "boolean" },
39
+ ],
40
+ });
41
+ const peopleView = defineView(people, { scope: ["org_id"], presets: { default: { filter: { active: true } } } });
42
+ const tasksView = defineView(tasks, {
43
+ scope: ["org_id"],
44
+ form: ["title", "owner_id", "reviewer_id"],
45
+ fields: { owner_id: { label: "Owner", link: { view: peopleView } }, reviewer_id: { label: "Reviewer", link: { view: peopleView } } },
46
+ });
47
+
48
+ const PEOPLE: Person[] = [
49
+ { id: "ada", org_id: "o1", full_name: "Ada Lovelace", active: true },
50
+ { id: "grace", org_id: "o1", full_name: "Grace Hopper", active: true },
51
+ { id: "gone", org_id: "o1", full_name: "Former Person", active: false },
52
+ { id: "other", org_id: "o2", full_name: "Elsewhere Person", active: true },
53
+ ];
54
+ const TASK: Task = { id: "t1", org_id: "o1", title: "Write", owner_id: "ada", reviewer_id: "grace" };
55
+
56
+ const matches = (row: Record<string, unknown>, f: FilterParam) =>
57
+ f.operator === "eq" ? row[f.field] === f.value : f.operator === "in" ? (f.value as unknown[]).includes(row[f.field]) : true;
58
+
59
+ function setup() {
60
+ const getList = vi.fn(async (resource: string, params: ListParams) => {
61
+ if (resource === "tasks") return { data: [TASK], total: 1 };
62
+ let rows = PEOPLE.filter((p) => (params.filters ?? []).every((f) => matches(p, f)));
63
+ if (params.search?.query) rows = rows.filter((p) => p.full_name.toLowerCase().includes(params.search!.query.toLowerCase()));
64
+ return { data: rows, total: rows.length };
65
+ });
66
+ const provider: DataProvider = {
67
+ getList: getList as unknown as DataProvider["getList"],
68
+ getOne: vi.fn(async () => ({ data: TASK })) as DataProvider["getOne"],
69
+ getMany: vi.fn(async () => ({ data: [] })),
70
+ create: vi.fn(async (_r, { data }) => ({ data: { id: "new", ...(data as object) } })) as DataProvider["create"],
71
+ update: vi.fn(async (_r, { id, data }) => ({ data: { id, ...(data as object) } })) as DataProvider["update"],
72
+ deleteOne: vi.fn(),
73
+ };
74
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
75
+ const Wrapper = ({ children }: { children: ReactNode }) => (
76
+ <GenesisProvider provider={provider} queryClient={queryClient}>
77
+ <ViewerScope viewer="u1" scope={{ orgId: "o1" }} timeZone="UTC">
78
+ {children}
79
+ </ViewerScope>
80
+ </GenesisProvider>
81
+ );
82
+ const peopleLists = () => getList.mock.calls.filter(([r, p]) => r === "people" && !(p.filters ?? []).some((f) => f.field === "id"));
83
+ return { Wrapper, provider, peopleLists };
84
+ }
85
+
86
+ const field = (key: string) => `native-resource-view-form-field-${key}`;
87
+
88
+ describe("a link's picker in the native form sheet", () => {
89
+ it("is a picker, not a typed id", () => {
90
+ const fields = formFieldsFor(tasksView, "create");
91
+ expect(fields.find((f) => f.key === "owner_id")).toMatchObject({ kind: "link", readOnly: false, required: true });
92
+ expect(fields.find((f) => f.key === "reviewer_id")).toMatchObject({ kind: "link", required: false });
93
+ });
94
+
95
+ it("lists the linked rows through the provider under the linked view's scope and default filter, and saves the picked key", async () => {
96
+ const { Wrapper, provider, peopleLists } = setup();
97
+ render(<NativeResourceView view={tasksView} />, { wrapper: Wrapper });
98
+ fireEvent.click(await screen.findByTestId("native-resource-view-create"));
99
+ const form = await screen.findByTestId("native-resource-view-form");
100
+ fireEvent.change(within(form).getByTestId(field("title")).querySelector("input")!, { target: { value: "Ship" } });
101
+ expect(peopleLists()).toHaveLength(0);
102
+ fireEvent.click(within(form).getByTestId(`${field("owner_id")}-trigger`));
103
+ await waitFor(() => expect(within(form).getByTestId(`${field("owner_id")}-option-grace`)).toBeTruthy());
104
+ expect(peopleLists()[0]![1].filters).toEqual([
105
+ { field: "org_id", operator: "eq", value: "o1" },
106
+ { field: "active", operator: "eq", value: true },
107
+ ]);
108
+ expect(within(form).queryByTestId(`${field("owner_id")}-option-gone`)).toBeNull();
109
+ expect(within(form).queryByTestId(`${field("owner_id")}-option-other`)).toBeNull();
110
+ // A required link has no None.
111
+ expect(within(form).queryByTestId(`${field("owner_id")}-none`)).toBeNull();
112
+ fireEvent.click(within(form).getByTestId(`${field("owner_id")}-option-grace`));
113
+ await waitFor(() => expect(within(form).getByTestId(`${field("owner_id")}-trigger`).textContent).toContain("Grace Hopper"));
114
+ fireEvent.click(within(form).getByTestId("native-resource-view-form-save"));
115
+ await waitFor(() => expect(provider.create).toHaveBeenCalled());
116
+ expect((provider.create as ReturnType<typeof vi.fn>).mock.calls[0]![1].data).toMatchObject({ title: "Ship", owner_id: "grace" });
117
+ });
118
+
119
+ it("clears an optional link to null with None", () => {
120
+ const fields = formFieldsFor(tasksView, "edit");
121
+ expect(writableValues(tasksView, "edit", fields, { ...TASK, reviewer_id: null }, new Set(["reviewer_id"]))).toEqual({ reviewer_id: null });
122
+ });
123
+
124
+ it("offers None for an optional link, and saves null", async () => {
125
+ const { Wrapper, provider } = setup();
126
+ render(<NativeResourceView view={tasksView} />, { wrapper: Wrapper });
127
+ const row = await screen.findByTestId("native-resource-view-row-t1");
128
+ act(() => {
129
+ row.dispatchEvent(new CustomEvent("accessibilityaction", { detail: "edit" }));
130
+ });
131
+ const form = await screen.findByTestId("native-resource-view-form");
132
+ const trigger = await within(form).findByTestId(`${field("reviewer_id")}-trigger`);
133
+ await waitFor(() => expect(trigger.textContent).toContain("Grace Hopper"));
134
+ fireEvent.click(trigger);
135
+ fireEvent.click(await within(form).findByTestId(`${field("reviewer_id")}-none`));
136
+ fireEvent.click(within(form).getByTestId("native-resource-view-form-save"));
137
+ await waitFor(() => expect(provider.update).toHaveBeenCalled());
138
+ expect((provider.update as ReturnType<typeof vi.fn>).mock.calls[0]![1]).toEqual({ id: "t1", data: { reviewer_id: null } });
139
+ });
140
+
141
+ it("keeps a link the screen's filter pins read-only on edit, and never sends it", async () => {
142
+ const { Wrapper, provider } = setup();
143
+ const { result } = renderHook(() => useNativeResourceView(tasksView, { filter: { owner_id: "ada" } }), { wrapper: Wrapper });
144
+ await waitFor(() => expect(result.current.rows).toHaveLength(1));
145
+ expect(result.current.formFields("create").map((f) => f.key)).toEqual(["title", "reviewer_id"]);
146
+ expect(result.current.formFields("edit").find((f) => f.key === "owner_id")).toMatchObject({ readOnly: true });
147
+ await act(async () => {
148
+ await result.current.save("edit", { ...TASK, owner_id: "grace", title: "Changed" }, TASK, new Set(["owner_id", "title"]));
149
+ });
150
+ expect((provider.update as ReturnType<typeof vi.fn>).mock.calls[0]![1]).toEqual({ id: "t1", data: { title: "Changed" } });
151
+ });
152
+
153
+ it("draws each choice as a radio, checked when it's the link's row", async () => {
154
+ const { Wrapper } = setup();
155
+ render(<NativeResourceView view={tasksView} />, { wrapper: Wrapper });
156
+ const row = await screen.findByTestId("native-resource-view-row-t1");
157
+ act(() => {
158
+ row.dispatchEvent(new CustomEvent("accessibilityaction", { detail: "edit" }));
159
+ });
160
+ const form = await screen.findByTestId("native-resource-view-form");
161
+ fireEvent.click(await within(form).findByTestId(`${field("owner_id")}-trigger`));
162
+ const ada = await within(form).findByTestId(`${field("owner_id")}-option-ada`);
163
+ const grace = within(form).getByTestId(`${field("owner_id")}-option-grace`);
164
+ expect(ada.getAttribute("role")).toBe("radio");
165
+ expect(ada.getAttribute("aria-checked")).toBe("true");
166
+ expect(grace.getAttribute("aria-checked")).toBe("false");
167
+ });
168
+
169
+ it("announces an error: in the trigger's label and as an alert", async () => {
170
+ const { Wrapper } = setup();
171
+ render(<NativeResourceView view={tasksView} />, { wrapper: Wrapper });
172
+ fireEvent.click(await screen.findByTestId("native-resource-view-create"));
173
+ const form = await screen.findByTestId("native-resource-view-form");
174
+ fireEvent.change(within(form).getByTestId(field("title")).querySelector("input")!, { target: { value: "Ship" } });
175
+ fireEvent.click(within(form).getByTestId("native-resource-view-form-save"));
176
+ const error = await within(form).findByTestId(`${field("owner_id")}-error`);
177
+ expect(error.getAttribute("role")).toBe("alert");
178
+ expect(within(form).getByTestId(`${field("owner_id")}-trigger`).getAttribute("aria-label")).toContain(error.textContent!);
179
+ });
180
+
181
+ it("offers only the rows of a list (in) filter on the link", () => {
182
+ const fields = formFieldsFor(tasksView, "edit", { within: { owner_id: ["ada", "gone"] } });
183
+ const owner = fields.find((f) => f.key === "owner_id")!;
184
+ expect(owner.link!.filters({ orgId: "o1" })).toEqual([
185
+ { field: "org_id", operator: "eq", value: "o1" },
186
+ { field: "active", operator: "eq", value: true },
187
+ { field: "id", operator: "in", value: ["ada", "gone"] },
188
+ ]);
189
+ expect(owner.link!.labelField).toBe("full_name");
190
+ // Other links are as they were.
191
+ expect(fields.find((f) => f.key === "reviewer_id")!.link!.filters({ orgId: "o1" })).toHaveLength(2);
192
+ });
193
+
194
+ it("holds the picker to a screen's list filter", async () => {
195
+ const { Wrapper } = setup();
196
+ const { result } = renderHook(() => useNativeResourceView(tasksView, { filter: { owner_id: ["ada", "grace"] } }), { wrapper: Wrapper });
197
+ await waitFor(() => expect(result.current.rows).toHaveLength(1));
198
+ const owner = result.current.formFields("create").find((f) => f.key === "owner_id")!;
199
+ expect(owner.link!.filters({ orgId: "o1" }).at(-1)).toEqual({ field: "id", operator: "in", value: ["ada", "grace"] });
200
+ });
201
+ });