@marktiderman/genesis-ui-native 3.10.0 → 3.11.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.
@@ -463,6 +463,8 @@ type NativeResourceSwipeableProps = Omit<InboxPageSlotMap["swipeable"], "actions
463
463
  };
464
464
  /** How rows show: a list (the default) or cards in columns, as the web's `mode`. */
465
465
  type NativeResourceViewMode = "list" | "grid";
466
+ /** The view types the phone draws: list, grid and gallery (ADR 0021). @stability Beta */
467
+ type NativeResourceViewType = NativeResourceViewMode | "gallery";
466
468
  /**
467
469
  * Spread onto your card's Pressable: the press (the screen's `onRowPress`, else the peek), the
468
470
  * long press (the row's actions), and the label and actions screen readers use. The same wiring
@@ -519,9 +521,15 @@ interface NativeResourceViewProps<T extends Row$1 = Row$1> extends NativeResourc
519
521
  /**
520
522
  * `"grid"`: cards in `numColumns` columns, as the web's `mode="grid"`. Sections, paging, pull to
521
523
  * refresh, the empty and error states, long press, accessibility and swipe actions all stay.
522
- * Default `"list"`.
524
+ * Default `"list"`. Prefer `type`; `mode` stays as its alias.
523
525
  */
524
526
  mode?: NativeResourceViewMode;
527
+ /**
528
+ * The view type (ADR 0021), as the web's `<ResourceView type>`: `"list"` (default), `"grid"`, or
529
+ * `"gallery"` (the grid as photos, from the view's `gallery` block). The phone has no board or
530
+ * calendar yet. Wins over `mode`.
531
+ */
532
+ type?: NativeResourceViewType;
525
533
  /** Columns in grid mode (React Native's FlatList name). Default 2. */
526
534
  numColumns?: number;
527
535
  /**
@@ -812,4 +820,4 @@ declare const defaultNativeResourceWorkspaceMessages: NativeRecordViewMessages;
812
820
  */
813
821
  declare function parseSettingNumber(text: string): number | null;
814
822
 
815
- export { type AnyResourceView, DEFAULT_MAX_PAGES, type DisplayContext, type DisplayRenderer, type DisplayRenderers, DisplayRenderersProvider, type DisplayTimeZones, DisplayTimeZonesProvider, type NativeCardFieldDef, NativeConflictSheet, type NativeConflictSheetMessages, type NativeConflictSheetProps, NativeDataFilters, type NativeDataFiltersProps, NativeDataPageShell, type NativeDataPageShellProps, type NativeDetailField, NativeDetailPanel, type NativeDetailPanelProps, NativeEmptyState, type NativeEmptyStateProps, type NativeFormField, type NativeFormFieldKind, NativeRecordView, type NativeRecordViewHeaderProps, NativeRecordViewMenu, type NativeRecordViewMessages, type NativeRecordViewProps, type NativeResourceCardActions, type NativeResourceCardPressableProps, NativeResourceForm, NativeResourceFormFieldRenderer, type NativeResourceFormFieldRendererProps, type NativeResourceFormProps, NativeResourceFormSheet, type NativeResourceFormSheetProps, NativeResourcePage, type NativeResourcePageProps, type NativeResourceRowItem, type NativeResourceScreenCan, type NativeResourceSection, type NativeResourceSwipeAction, type NativeResourceSwipeableProps, NativeResourceView, type NativeResourceViewMessages, NativeResourceViewMessagesProvider, type NativeResourceViewMode, type NativeResourceViewOptions, type NativeResourceViewProps, NativeResourceWorkspace, type NativeResourceWorkspaceHeaderProps, NativeResourceWorkspaceMenu, type NativeResourceWorkspaceMessages, type NativeResourceWorkspaceProps, SEARCH_DEBOUNCE_MS, SEGMENTED_SECTIONS_MAX, type SaveResult, type UseNativeResourceViewReturn, allowed, dateToDay, dayToDate, defaultNativeRecordViewMessages, defaultNativeResourceViewMessages, defaultNativeResourceWorkspaceMessages, displayText, formFieldsFor, formatDay, formatInstant, getNativeRecordViewStackOptions, getNativeResourceWorkspaceStackOptions, nativeDisplayRenderers, openableUrl, parseSettingNumber, resolveZone, rowItem, screenValues, sectionsFor, serverSort, serverSorts, swipeActionsFor, useDisplayCell, useDisplayTimeZones, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
823
+ export { type AnyResourceView, DEFAULT_MAX_PAGES, type DisplayContext, type DisplayRenderer, type DisplayRenderers, DisplayRenderersProvider, type DisplayTimeZones, DisplayTimeZonesProvider, type NativeCardFieldDef, NativeConflictSheet, type NativeConflictSheetMessages, type NativeConflictSheetProps, NativeDataFilters, type NativeDataFiltersProps, NativeDataPageShell, type NativeDataPageShellProps, type NativeDetailField, NativeDetailPanel, type NativeDetailPanelProps, NativeEmptyState, type NativeEmptyStateProps, type NativeFormField, type NativeFormFieldKind, NativeRecordView, type NativeRecordViewHeaderProps, NativeRecordViewMenu, type NativeRecordViewMessages, type NativeRecordViewProps, type NativeResourceCardActions, type NativeResourceCardPressableProps, NativeResourceForm, NativeResourceFormFieldRenderer, type NativeResourceFormFieldRendererProps, type NativeResourceFormProps, NativeResourceFormSheet, type NativeResourceFormSheetProps, NativeResourcePage, type NativeResourcePageProps, type NativeResourceRowItem, type NativeResourceScreenCan, type NativeResourceSection, type NativeResourceSwipeAction, type NativeResourceSwipeableProps, NativeResourceView, type NativeResourceViewMessages, NativeResourceViewMessagesProvider, type NativeResourceViewMode, type NativeResourceViewOptions, type NativeResourceViewProps, type NativeResourceViewType, NativeResourceWorkspace, type NativeResourceWorkspaceHeaderProps, NativeResourceWorkspaceMenu, type NativeResourceWorkspaceMessages, type NativeResourceWorkspaceProps, SEARCH_DEBOUNCE_MS, SEGMENTED_SECTIONS_MAX, type SaveResult, type UseNativeResourceViewReturn, allowed, dateToDay, dayToDate, defaultNativeRecordViewMessages, defaultNativeResourceViewMessages, defaultNativeResourceWorkspaceMessages, displayText, formFieldsFor, formatDay, formatInstant, getNativeRecordViewStackOptions, getNativeResourceWorkspaceStackOptions, nativeDisplayRenderers, openableUrl, parseSettingNumber, resolveZone, rowItem, screenValues, sectionsFor, serverSort, serverSorts, swipeActionsFor, useDisplayCell, useDisplayTimeZones, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
@@ -1207,9 +1207,9 @@ function swipeActionsFor(view, row, options) {
1207
1207
  return actions;
1208
1208
  }
1209
1209
  var SEGMENTED_MAX = 4;
1210
- function kindFor(display, options, widget) {
1210
+ function kindFor(display, options, control) {
1211
1211
  if (options) return options.length <= SEGMENTED_MAX ? "segmented" : "select";
1212
- if (widget === "tel" && display === "text") return "tel";
1212
+ if (control === "tel" && display === "text") return "tel";
1213
1213
  switch (display) {
1214
1214
  case "boolean":
1215
1215
  return "switch";
@@ -1259,7 +1259,7 @@ function formFieldsFor(view, mode, options = {}) {
1259
1259
  return {
1260
1260
  key: f.field.name,
1261
1261
  label: f.label,
1262
- kind: link ? "link" : kindFor(f.display, options2, f.field.widget),
1262
+ kind: link ? "link" : kindFor(f.display, options2, f.field.control ?? f.field.widget),
1263
1263
  display: f.display,
1264
1264
  required: !readOnly && f.required,
1265
1265
  readOnly,
@@ -2072,7 +2072,8 @@ function Screen(props) {
2072
2072
  header,
2073
2073
  emptyState,
2074
2074
  searchable,
2075
- mode = "list",
2075
+ mode: modeProp = "list",
2076
+ type,
2076
2077
  numColumns: columnsProp,
2077
2078
  gallery: screenGallery,
2078
2079
  renderCard,
@@ -2080,6 +2081,10 @@ function Screen(props) {
2080
2081
  testID = "native-resource-view",
2081
2082
  ...options
2082
2083
  } = props;
2084
+ const mode = type === "gallery" ? "grid" : type ?? modeProp;
2085
+ if (type === "gallery" && !view.definition.gallery && !screenGallery?.image) {
2086
+ throw new Error(`NativeResourceView(${view.resource}): type="gallery" needs a gallery block: the view's gallery.image, or gallery={{ image }}`);
2087
+ }
2083
2088
  const state = useNativeResourceView(view, options);
2084
2089
  const keyExtractor = useCallback((row) => recordKey(view, row), [view]);
2085
2090
  const messages = useNativeResourceViewMessages();