@marktiderman/genesis-ui-native 3.11.0 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -0
- package/dist/{chunk-ZUR4PK77.js → chunk-47CDRP43.js} +45 -166
- package/dist/chunk-47CDRP43.js.map +1 -0
- package/dist/{chunk-SG7LYX7Z.js → chunk-BQYT6TH2.js} +14 -6
- package/dist/chunk-BQYT6TH2.js.map +1 -0
- package/dist/{chunk-EAHK7D7N.js → chunk-C2ARUGT7.js} +146 -42
- package/dist/chunk-C2ARUGT7.js.map +1 -0
- package/dist/{chunk-VEWSY4TZ.js → chunk-D4UU6KIF.js} +236 -21
- package/dist/chunk-D4UU6KIF.js.map +1 -0
- package/dist/{chunk-GGH3ZQNO.js → chunk-TUDJDIGC.js} +4 -4
- package/dist/{chunk-GGH3ZQNO.js.map → chunk-TUDJDIGC.js.map} +1 -1
- package/dist/{chunk-PMS2V46D.js → chunk-VHUUOH46.js} +2 -2
- package/dist/{chunk-PMS2V46D.js.map → chunk-VHUUOH46.js.map} +1 -1
- package/dist/{chunk-IWWXERKQ.js → chunk-X5CPLUPZ.js} +1236 -136
- package/dist/chunk-X5CPLUPZ.js.map +1 -0
- package/dist/components/index.d.ts +510 -25
- package/dist/components/index.js +5 -5
- package/dist/data/index.d.ts +167 -33
- package/dist/data/index.js +1082 -760
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +7 -7
- package/dist/layouts/index.d.ts +79 -6
- package/dist/layouts/index.js +5 -5
- package/dist/{native-modules-Bkm1jHO-.d.ts → native-modules-6JnyeGR-.d.ts} +55 -1
- package/package.json +70 -4
- package/src/components/__tests__/combobox.test.tsx +20 -0
- package/src/components/__tests__/number-input.test.tsx +112 -1
- package/src/components/__tests__/parity-controls.test.tsx +366 -0
- package/src/components/__tests__/parity-display.test.tsx +295 -0
- package/src/components/__tests__/twin-props.test.tsx +114 -0
- package/src/components/badge.tsx +3 -0
- package/src/components/button-group.tsx +50 -0
- package/src/components/calendar.tsx +183 -0
- package/src/components/carousel.tsx +175 -0
- package/src/components/chart.tsx +268 -0
- package/src/components/chip-group.tsx +34 -14
- package/src/components/choice-card.tsx +56 -19
- package/src/components/combobox.tsx +6 -5
- package/src/components/empty-state.tsx +40 -0
- package/src/components/flatten-children.ts +13 -0
- package/src/components/index.ts +49 -1
- package/src/components/inline-alert.tsx +3 -1
- package/src/components/input-group.tsx +99 -0
- package/src/components/input-otp.tsx +124 -0
- package/src/components/input.tsx +40 -12
- package/src/components/list-item.tsx +20 -4
- package/src/components/number-input.tsx +45 -15
- package/src/components/radio-group.tsx +5 -0
- package/src/components/resource.tsx +227 -0
- package/src/components/settings-row.tsx +194 -0
- package/src/components/slider.tsx +3 -9
- package/src/components/sortable-list.tsx +287 -0
- package/src/components/stat-card.tsx +106 -0
- package/src/components/stepper.tsx +4 -2
- package/src/components/widget-tile.tsx +66 -0
- package/src/components/workspace-switcher.tsx +217 -0
- package/src/data/NativeCustomView.tsx +117 -0
- package/src/data/NativeFormFields.tsx +312 -0
- package/src/data/NativeRecordPeek.tsx +130 -0
- package/src/data/NativeResourceFormField.tsx +32 -0
- package/src/data/__tests__/parity-data.test.tsx +350 -0
- package/src/data/index.ts +13 -0
- package/src/layouts/__tests__/keyboard-scroll.test.tsx +58 -2
- package/src/layouts/__tests__/notifications-page.test.tsx +12 -0
- package/src/layouts/index.ts +13 -0
- package/src/layouts/keyboard.tsx +22 -2
- package/src/layouts/notifications-page.tsx +13 -35
- package/src/layouts/pages.tsx +262 -0
- package/src/native-modules.tsx +37 -0
- package/dist/chunk-EAHK7D7N.js.map +0 -1
- package/dist/chunk-IWWXERKQ.js.map +0 -1
- package/dist/chunk-SG7LYX7Z.js.map +0 -1
- package/dist/chunk-VEWSY4TZ.js.map +0 -1
- package/dist/chunk-ZUR4PK77.js.map +0 -1
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeChip, NativeChipGroup, NativeChoiceCard, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger,
|
|
2
|
-
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar,
|
|
3
|
-
export { NativeComposerBar, NativeThreadList, THREAD_AT_BOTTOM_POINTS, threadListMode, threadNearBottom } from '../chunk-
|
|
4
|
-
export { NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeContextMenu, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwipeRow, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants } from '../chunk-
|
|
5
|
-
export { GenesisModulesProvider, useGenesisModules } from '../chunk-
|
|
1
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, LIGHTBOX_DISMISS_DISTANCE, LIGHTBOX_DISMISS_VELOCITY, LIGHTBOX_DOUBLE_TAP_MS, LIGHTBOX_MAX_ZOOM, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeBulkBar, NativeButtonGroup, NativeCalendar, NativeCarousel, NativeChartContainer, NativeChip, NativeChipGroup, NativeChoiceCard, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFollowUpList, NativeFullScreenModal, NativeGalleryCard, NativeGlassSurface, NativeHeaderCard, NativeHeadlineNumbers, NativeInputGroup, NativeInputOTP, NativeLightbox, NativeLiveIndicator, NativeNumberInput, NativePagination, NativePasswordToggleField, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRating, NativeReadinessChip, NativeResourceSettingsPage, NativeResponsesToolbar, NativeSettingsRow, NativeShareSheet, NativeSlider, NativeSortableList, NativeStatCard, NativeStatusBadge, NativeStepper, NativeSummaryCard, NativeTabBar, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTierBadge, NativeToastProvider, NativeToggle, NativeToggleRow, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, NativeUserAvatar, NativeWhatsNewSheet, NativeWorkspaceSwitcher, NativeZoomablePhoto, Stack, defaultNativeLightboxLabels, lightboxPanLimit, lightboxPinchScale, lightboxShouldDismiss, lightboxTouchDistance, nextRating, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from '../chunk-X5CPLUPZ.js';
|
|
2
|
+
export { DEFAULT_GALLERY_RATIO, GALLERY_DEFAULTS, NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeGalleryGrid, NativeLabel, NativeProgress, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants, galleryItemRatio, justifyRows } from '../chunk-47CDRP43.js';
|
|
3
|
+
export { NativeComposerBar, NativeThreadList, THREAD_AT_BOTTOM_POINTS, threadListMode, threadNearBottom } from '../chunk-BQYT6TH2.js';
|
|
4
|
+
export { NATIVE_ICON_NAMES, NativeBadge, NativeBanner, NativeButton, NativeContextMenu, NativeEmptyState, NativeIcon, NativeImage, NativeInlineAlert, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeNoFeaturesFound, NativeNoFeedbackFound, NativeNoSearchResults, NativeRefreshControl, NativeSectionListHeader, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwipeRow, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants } from '../chunk-D4UU6KIF.js';
|
|
5
|
+
export { GenesisModulesProvider, useGenesisModules } from '../chunk-VHUUOH46.js';
|
|
6
6
|
import '../chunk-OHZD7KRO.js';
|
|
7
7
|
import '../chunk-DGUM43GV.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/data/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
3
|
import { ResourceFormFieldDef, BaseRecord, DataRow, FieldReference, WriteConflict, ResourceContract } from '@marktiderman/genesis-core';
|
|
4
|
-
import { Control, UseFormReturn } from 'react-hook-form';
|
|
5
|
-
import { UseResourceOptions } from '@marktiderman/genesis-core/hooks';
|
|
6
|
-
import { ResourceView,
|
|
4
|
+
import { Control, UseFormReturn, FieldErrors } from 'react-hook-form';
|
|
5
|
+
import { UseResourceOptions, WizardStep } from '@marktiderman/genesis-core/hooks';
|
|
6
|
+
import { ResourceView, Allowed, RowSummary, RowPicture, DisplayHint, ResolvedFormField, ResolvedLink, Viewer, ViewGallery, ResolvedColumn, RecordView, GroupRowsOptions, RowGroup } from '@marktiderman/genesis-core/resource-view';
|
|
7
7
|
import { b as InboxPageSlotMap, e as ScreenHeaderProps } from '../inbox-page-BGqR_cBs.js';
|
|
8
8
|
import { InboxSwipeAction } from '@marktiderman/genesis-core/conversation';
|
|
9
9
|
import { ReadinessLabels } from '@marktiderman/genesis-core/resource';
|
|
10
|
+
import { u as NativePickedFile, b as GenesisFilePicker } from '../native-modules-6JnyeGR-.js';
|
|
11
|
+
import { CustomViewStatus } from '@marktiderman/genesis-core/headless';
|
|
10
12
|
import '@marktiderman/genesis-core/slots';
|
|
11
13
|
import 'react-native';
|
|
12
14
|
|
|
@@ -216,8 +218,8 @@ interface NativeResourceViewMessages {
|
|
|
216
218
|
}
|
|
217
219
|
declare const defaultNativeResourceViewMessages: NativeResourceViewMessages;
|
|
218
220
|
|
|
219
|
-
type Row$
|
|
220
|
-
type AnyResourceView<T extends Row$
|
|
221
|
+
type Row$5 = Record<string, unknown>;
|
|
222
|
+
type AnyResourceView<T extends Row$5 = Row$5> = ResourceView<any, T & DataRow>;
|
|
221
223
|
/** What one row shows in a NativeListItem. */
|
|
222
224
|
interface NativeResourceRowItem {
|
|
223
225
|
id: string;
|
|
@@ -236,7 +238,7 @@ interface NativeResourceRowItem {
|
|
|
236
238
|
* A row as NativeListItem draws it: `view.summary(row)`'s title, subtitle and chips, and nothing
|
|
237
239
|
* else. A view that wants a second line says so in its summary.
|
|
238
240
|
*/
|
|
239
|
-
declare function rowItem<T extends Row$
|
|
241
|
+
declare function rowItem<T extends Row$5>(view: AnyResourceView<T>, row: T): NativeResourceRowItem;
|
|
240
242
|
interface NativeResourceSection<T> {
|
|
241
243
|
key: string;
|
|
242
244
|
/** Empty for the one section of an ungrouped view (no header is drawn). */
|
|
@@ -247,7 +249,7 @@ interface NativeResourceSection<T> {
|
|
|
247
249
|
* Rows in sections by `definition.groupBy`, in the order each group first appears (the server's
|
|
248
250
|
* sort, so paging never reorders what's on screen). Without `groupBy`, one untitled section.
|
|
249
251
|
*/
|
|
250
|
-
declare function sectionsFor<T extends Row$
|
|
252
|
+
declare function sectionsFor<T extends Row$5>(view: AnyResourceView<T>, rows: readonly T[], messages: NativeResourceViewMessages): NativeResourceSection<T>[];
|
|
251
253
|
/** A row action: InboxPage's swipe action plus an icon name and, when a guard refuses it, why. */
|
|
252
254
|
interface NativeResourceSwipeAction extends InboxSwipeAction {
|
|
253
255
|
/** An icon name from Genesis's set (`edit`, `trash`), mapped per platform. */
|
|
@@ -261,7 +263,7 @@ type NativeResourceScreenCan<T> = (action: "create" | "update" | "delete", row?:
|
|
|
261
263
|
* The effective right: the screen's rule AND the view's guard (never OR). The guard gets the
|
|
262
264
|
* viewer (`useViewer()`); without one it gets no one, so a guard that needs it refuses.
|
|
263
265
|
*/
|
|
264
|
-
declare function allowed<T extends Row$
|
|
266
|
+
declare function allowed<T extends Row$5>(view: AnyResourceView<T>, action: "create" | "update" | "delete", row: T | undefined, screen?: NativeResourceScreenCan<T>, viewer?: Viewer): Allowed | false;
|
|
265
267
|
interface SwipeActionOptions<T> {
|
|
266
268
|
messages: NativeResourceViewMessages;
|
|
267
269
|
/** The provider moves deleted rows to a recycle bin (`capabilities(resource).softDelete`). */
|
|
@@ -280,7 +282,7 @@ interface SwipeActionOptions<T> {
|
|
|
280
282
|
* A row's swipe actions, from the view's guards. A refused action stays in the list with its
|
|
281
283
|
* reason, so the person learns why; one the screen turns off (`false`) is left out.
|
|
282
284
|
*/
|
|
283
|
-
declare function swipeActionsFor<T extends Row$
|
|
285
|
+
declare function swipeActionsFor<T extends Row$5>(view: AnyResourceView<T>, row: T, options: SwipeActionOptions<T>): NativeResourceSwipeAction[];
|
|
284
286
|
/** How a form field is drawn. */
|
|
285
287
|
type NativeFormFieldKind = "text" | "email" | "tel" | "url" | "number" | "textarea" | "switch" | "segmented" | "select" | "date" | "datetime"
|
|
286
288
|
/** A link: a searchable list of the linked rows, through the provider. */
|
|
@@ -325,7 +327,7 @@ interface NativeFormField {
|
|
|
325
327
|
* `view.writable(mode)` lists it. A link the person can change is a picker (`kind: "link"`). Copied, never mutated: core caches and freezes `form()`. A create leaves read-only fields out (there is nothing to show yet); an edit shows
|
|
326
328
|
* them as text.
|
|
327
329
|
*/
|
|
328
|
-
declare function formFieldsFor<T extends Row$
|
|
330
|
+
declare function formFieldsFor<T extends Row$5>(view: AnyResourceView<T>, mode: "create" | "edit", options?: {
|
|
329
331
|
/**
|
|
330
332
|
* Fields the screen's filter fixes. A link among them stays read-only: the list is that
|
|
331
333
|
* record's (a client's sessions), and a picker would move the row out of it (as on the web).
|
|
@@ -343,15 +345,15 @@ declare function formFieldsFor<T extends Row$3>(view: AnyResourceView<T>, mode:
|
|
|
343
345
|
* An edit passes `dirty`, the fields the person changed, so a save never rewrites the rest. A
|
|
344
346
|
* cleared optional value (an empty text, a cleared number or date) is sent as null.
|
|
345
347
|
*/
|
|
346
|
-
declare function writableValues<T extends Row$
|
|
348
|
+
declare function writableValues<T extends Row$5>(view: AnyResourceView<T>, mode: "create" | "edit", fields: readonly NativeFormField[], values: Readonly<Record<string, unknown>>, dirty?: ReadonlySet<string>): Record<string, unknown>;
|
|
347
349
|
/** Field errors for a save: required fields with no value, and text over `max`. */
|
|
348
350
|
declare function validateValues(fields: readonly NativeFormField[], values: Readonly<Record<string, unknown>>, messages: NativeResourceViewMessages): Record<string, string>;
|
|
349
351
|
|
|
350
|
-
type Row$
|
|
352
|
+
type Row$4 = Record<string, unknown>;
|
|
351
353
|
type Filter = Readonly<Record<string, string | number | boolean | null | readonly (string | number)[]>>;
|
|
352
354
|
/** How long typing waits before the search goes to the server. */
|
|
353
355
|
declare const SEARCH_DEBOUNCE_MS = 300;
|
|
354
|
-
interface NativeResourceViewOptions<T extends Row$
|
|
356
|
+
interface NativeResourceViewOptions<T extends Row$4 = Row$4> {
|
|
355
357
|
/** A tab the view defines: its server filter. */
|
|
356
358
|
preset?: string;
|
|
357
359
|
/**
|
|
@@ -384,7 +386,7 @@ type SaveResult = {
|
|
|
384
386
|
message?: string;
|
|
385
387
|
fields: Record<string, string>;
|
|
386
388
|
};
|
|
387
|
-
interface UseNativeResourceViewReturn<T extends Row$
|
|
389
|
+
interface UseNativeResourceViewReturn<T extends Row$4 = Row$4> {
|
|
388
390
|
rows: T[];
|
|
389
391
|
/** Rows in `groupBy` sections (one untitled section when the view doesn't group). */
|
|
390
392
|
sections: NativeResourceSection<T>[];
|
|
@@ -451,12 +453,12 @@ type ServerSort = {
|
|
|
451
453
|
* page never lands in the middle of an earlier section, then the view's `orderBy` within each
|
|
452
454
|
* group. A provider without `multiSort` applies only the first.
|
|
453
455
|
*/
|
|
454
|
-
declare function serverSorts<T extends Row$
|
|
456
|
+
declare function serverSorts<T extends Row$4>(view: AnyResourceView<T>): ServerSort[];
|
|
455
457
|
/** The first of {@link serverSorts}: what a provider that sorts by one field gets. */
|
|
456
|
-
declare function serverSort<T extends Row$
|
|
457
|
-
declare function useNativeResourceView<T extends Row$
|
|
458
|
+
declare function serverSort<T extends Row$4>(view: AnyResourceView<T>): ServerSort | undefined;
|
|
459
|
+
declare function useNativeResourceView<T extends Row$4 = Row$4>(view: AnyResourceView<T>, options?: NativeResourceViewOptions<T>): UseNativeResourceViewReturn<T>;
|
|
458
460
|
|
|
459
|
-
type Row$
|
|
461
|
+
type Row$3 = Record<string, unknown>;
|
|
460
462
|
/** The gesture wrapper around a row, the same props as InboxPage's `swipeable` slot. */
|
|
461
463
|
type NativeResourceSwipeableProps = Omit<InboxPageSlotMap["swipeable"], "actions"> & {
|
|
462
464
|
actions: NativeResourceSwipeAction[];
|
|
@@ -502,7 +504,7 @@ interface NativeResourceCardActions {
|
|
|
502
504
|
first: boolean;
|
|
503
505
|
last: boolean;
|
|
504
506
|
}
|
|
505
|
-
interface NativeResourceViewProps<T extends Row$
|
|
507
|
+
interface NativeResourceViewProps<T extends Row$3 = Row$3> extends NativeResourceViewOptions<T> {
|
|
506
508
|
view: AnyResourceView<T>;
|
|
507
509
|
/** The heading above the list. Default the view's title; `false` when the navigation bar shows it. */
|
|
508
510
|
title?: string | false;
|
|
@@ -563,7 +565,7 @@ interface NativeResourceViewProps<T extends Row$1 = Row$1> extends NativeResourc
|
|
|
563
565
|
* <NativeResourceView view={brandsView} onRowPress={(b) => router.push(`/brands/${b.id}`)} />
|
|
564
566
|
* ```
|
|
565
567
|
*/
|
|
566
|
-
declare function NativeResourceView<T extends Row$
|
|
568
|
+
declare function NativeResourceView<T extends Row$3 = Row$3>(props: NativeResourceViewProps<T>): react.JSX.Element;
|
|
567
569
|
|
|
568
570
|
type Values = Record<string, unknown>;
|
|
569
571
|
interface NativeResourceFormSheetProps {
|
|
@@ -698,8 +700,8 @@ interface NativeConflictSheetProps {
|
|
|
698
700
|
*/
|
|
699
701
|
declare function NativeConflictSheet({ conflict, noun, label, format, onKeepMine, onTakeTheirs, onDismiss, messages, testID, }: NativeConflictSheetProps): react.JSX.Element;
|
|
700
702
|
|
|
701
|
-
type Row = Record<string, unknown>;
|
|
702
|
-
type AnyRecordView<T extends Row> = RecordView<ResourceContract<any>, T & DataRow>;
|
|
703
|
+
type Row$2 = Record<string, unknown>;
|
|
704
|
+
type AnyRecordView<T extends Row$2> = RecordView<ResourceContract<any>, T & DataRow>;
|
|
703
705
|
/**
|
|
704
706
|
* The words NativeRecordView shows. Override any of them with `messages`. The readiness
|
|
705
707
|
* chip's keys (`ready`, `empty`, `pending`, `problems`, `warnings`) are genesis-core/resource's
|
|
@@ -726,7 +728,7 @@ interface NativeRecordViewMessages extends ReadinessLabels {
|
|
|
726
728
|
declare const defaultNativeRecordViewMessages: NativeRecordViewMessages;
|
|
727
729
|
/** Up to this many sections show as a segmented control; more are pushed rows. */
|
|
728
730
|
declare const SEGMENTED_SECTIONS_MAX = 4;
|
|
729
|
-
interface NativeRecordViewHeaderProps<T extends Row = Row> {
|
|
731
|
+
interface NativeRecordViewHeaderProps<T extends Row$2 = Row$2> {
|
|
730
732
|
view: AnyRecordView<T>;
|
|
731
733
|
row: T;
|
|
732
734
|
/** Runs an allowed (and confirmed) action. Default: the provider's `runAction`. */
|
|
@@ -740,7 +742,7 @@ interface NativeRecordViewHeaderProps<T extends Row = Row> {
|
|
|
740
742
|
* (ActionSheetIOS, destructive ones in red); elsewhere a sheet of rows, since Android's alert
|
|
741
743
|
* shows at most three buttons. A refused action stays listed and explains why when pressed.
|
|
742
744
|
*/
|
|
743
|
-
declare function NativeRecordViewMenu<T extends Row = Row>(props: NativeRecordViewHeaderProps<T> & {
|
|
745
|
+
declare function NativeRecordViewMenu<T extends Row$2 = Row$2>(props: NativeRecordViewHeaderProps<T> & {
|
|
744
746
|
testID?: string;
|
|
745
747
|
}): react.JSX.Element | null;
|
|
746
748
|
/**
|
|
@@ -751,8 +753,8 @@ declare function NativeRecordViewMenu<T extends Row = Row>(props: NativeRecordVi
|
|
|
751
753
|
* <Stack.Screen options={getNativeRecordViewStackOptions({ view: brandRecordView, row: brand })} />
|
|
752
754
|
* ```
|
|
753
755
|
*/
|
|
754
|
-
declare function getNativeRecordViewStackOptions<T extends Row>(props: NativeRecordViewHeaderProps<T> & Omit<ScreenHeaderProps, "headerTitle">): Record<string, unknown>;
|
|
755
|
-
interface NativeRecordViewProps<T extends Row = Row> {
|
|
756
|
+
declare function getNativeRecordViewStackOptions<T extends Row$2>(props: NativeRecordViewHeaderProps<T> & Omit<ScreenHeaderProps, "headerTitle">): Record<string, unknown>;
|
|
757
|
+
interface NativeRecordViewProps<T extends Row$2 = Row$2> {
|
|
756
758
|
view: AnyRecordView<T>;
|
|
757
759
|
/** The record, as the screen loaded it. A save refreshes it through the cache. */
|
|
758
760
|
row: T;
|
|
@@ -792,24 +794,24 @@ interface NativeRecordViewProps<T extends Row = Row> {
|
|
|
792
794
|
* <NativeRecordView view={brandRecordView} row={brand} />
|
|
793
795
|
* ```
|
|
794
796
|
*/
|
|
795
|
-
declare function NativeRecordView<T extends Row = Row>(props: NativeRecordViewProps<T>): react.JSX.Element;
|
|
797
|
+
declare function NativeRecordView<T extends Row$2 = Row$2>(props: NativeRecordViewProps<T>): react.JSX.Element;
|
|
796
798
|
type OldPage<P extends {
|
|
797
799
|
view: unknown;
|
|
798
800
|
}> = Omit<P, "view"> & {
|
|
799
801
|
workspace: P["view"];
|
|
800
802
|
};
|
|
801
803
|
/** @deprecated Renamed `NativeRecordViewProps`; its `workspace` prop is now `view`. */
|
|
802
|
-
type NativeResourceWorkspaceProps<T extends Row = Row> = OldPage<NativeRecordViewProps<T>>;
|
|
804
|
+
type NativeResourceWorkspaceProps<T extends Row$2 = Row$2> = OldPage<NativeRecordViewProps<T>>;
|
|
803
805
|
/** @deprecated Renamed `NativeRecordView`, with `view` in place of `workspace`. */
|
|
804
|
-
declare function NativeResourceWorkspace<T extends Row = Row>({ workspace, ...props }: NativeResourceWorkspaceProps<T>): react.JSX.Element;
|
|
806
|
+
declare function NativeResourceWorkspace<T extends Row$2 = Row$2>({ workspace, ...props }: NativeResourceWorkspaceProps<T>): react.JSX.Element;
|
|
805
807
|
/** @deprecated Renamed `NativeRecordViewMenu`, with `view` in place of `workspace`. */
|
|
806
|
-
declare function NativeResourceWorkspaceMenu<T extends Row = Row>({ workspace, ...props }: OldPage<NativeRecordViewHeaderProps<T>> & {
|
|
808
|
+
declare function NativeResourceWorkspaceMenu<T extends Row$2 = Row$2>({ workspace, ...props }: OldPage<NativeRecordViewHeaderProps<T>> & {
|
|
807
809
|
testID?: string;
|
|
808
810
|
}): react.JSX.Element;
|
|
809
811
|
/** @deprecated Renamed `getNativeRecordViewStackOptions`, with `view` in place of `workspace`. */
|
|
810
|
-
declare function getNativeResourceWorkspaceStackOptions<T extends Row>({ workspace, ...props }: OldPage<NativeRecordViewHeaderProps<T>> & Omit<ScreenHeaderProps, "headerTitle">): Record<string, unknown>;
|
|
812
|
+
declare function getNativeResourceWorkspaceStackOptions<T extends Row$2>({ workspace, ...props }: OldPage<NativeRecordViewHeaderProps<T>> & Omit<ScreenHeaderProps, "headerTitle">): Record<string, unknown>;
|
|
811
813
|
/** @deprecated Renamed `NativeRecordViewHeaderProps`; its `workspace` prop is now `view`. */
|
|
812
|
-
type NativeResourceWorkspaceHeaderProps<T extends Row = Row> = OldPage<NativeRecordViewHeaderProps<T>>;
|
|
814
|
+
type NativeResourceWorkspaceHeaderProps<T extends Row$2 = Row$2> = OldPage<NativeRecordViewHeaderProps<T>>;
|
|
813
815
|
/** @deprecated Renamed `NativeRecordViewMessages`. */
|
|
814
816
|
type NativeResourceWorkspaceMessages = NativeRecordViewMessages;
|
|
815
817
|
/** @deprecated Renamed `defaultNativeRecordViewMessages`. */
|
|
@@ -820,4 +822,136 @@ declare const defaultNativeResourceWorkspaceMessages: NativeRecordViewMessages;
|
|
|
820
822
|
*/
|
|
821
823
|
declare function parseSettingNumber(text: string): number | null;
|
|
822
824
|
|
|
823
|
-
|
|
825
|
+
interface NativeFieldArrayRendererProps {
|
|
826
|
+
field: ResourceFormFieldDef;
|
|
827
|
+
control: Control<Record<string, unknown>>;
|
|
828
|
+
action: "create" | "edit";
|
|
829
|
+
watchedValues?: Record<string, unknown>;
|
|
830
|
+
/** The words. `{n}`: the item's number. `remove` is what a screen reader hears, `removeButton` the button's visible word. */
|
|
831
|
+
labels?: {
|
|
832
|
+
item?: string;
|
|
833
|
+
remove?: string;
|
|
834
|
+
removeButton?: string;
|
|
835
|
+
add?: string;
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
/** A field of `type: "array"`: one card per item, each with the field's `arrayFields`, and Add / Remove within `arrayMin` and `arrayMax`. */
|
|
839
|
+
declare function NativeFieldArrayRenderer({ field, control, action, watchedValues, labels }: NativeFieldArrayRendererProps): react.JSX.Element;
|
|
840
|
+
interface NativeFileUploadFieldProps {
|
|
841
|
+
field: ResourceFormFieldDef;
|
|
842
|
+
value: NativePickedFile | NativePickedFile[] | null;
|
|
843
|
+
onChange: (value: NativePickedFile | NativePickedFile[] | null) => void;
|
|
844
|
+
disabled?: boolean;
|
|
845
|
+
/** Opens the picker. Default `GenesisModules.filePicker`. */
|
|
846
|
+
pickFiles?: GenesisFilePicker;
|
|
847
|
+
/** The words. `pickFailed`: the picker rejected (a permission denied, a download that failed). */
|
|
848
|
+
labels?: {
|
|
849
|
+
choose?: string;
|
|
850
|
+
chooseMore?: string;
|
|
851
|
+
remove?: string;
|
|
852
|
+
noPicker?: string;
|
|
853
|
+
pickFailed?: string;
|
|
854
|
+
};
|
|
855
|
+
error?: string;
|
|
856
|
+
testID?: string;
|
|
857
|
+
}
|
|
858
|
+
/** A field of `type: "file"` or `"image"`: a button that opens the system picker, then the picked files with their size and a Remove each. */
|
|
859
|
+
declare function NativeFileUploadField({ field, value, onChange, disabled, pickFiles, labels, error, testID }: NativeFileUploadFieldProps): react.JSX.Element;
|
|
860
|
+
interface NativeRelationFieldProps {
|
|
861
|
+
field: ResourceFormFieldDef;
|
|
862
|
+
value: unknown;
|
|
863
|
+
/** The key as the field's `relation.keys` says: a string (`""` for none), or the row's own (`null` for none). */
|
|
864
|
+
onChange: (value: string | number | null) => void;
|
|
865
|
+
values?: Readonly<Record<string, unknown>>;
|
|
866
|
+
error?: string;
|
|
867
|
+
testID?: string;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* A field of `type: "relation"`: the linked resource's rows through the data provider, searched
|
|
871
|
+
* and paged on the server. The same picker NativeResourceView's form uses (NativeLinkPicker),
|
|
872
|
+
* fed from the field's `relation`.
|
|
873
|
+
*/
|
|
874
|
+
declare function NativeRelationField({ field, value, onChange, values, error, testID }: NativeRelationFieldProps): react.JSX.Element;
|
|
875
|
+
interface NativeWizardFormProps {
|
|
876
|
+
steps: WizardStep[];
|
|
877
|
+
form: UseFormReturn<Record<string, unknown>>;
|
|
878
|
+
fields: ResourceFormFieldDef[];
|
|
879
|
+
onSubmit: (data: Record<string, unknown>) => Promise<void>;
|
|
880
|
+
isSaving: boolean;
|
|
881
|
+
action: "create" | "edit";
|
|
882
|
+
onInvalid?: (errors: FieldErrors) => void;
|
|
883
|
+
renderField?: (field: ResourceFormFieldDef, control: UseFormReturn<Record<string, unknown>>["control"], action: "create" | "edit", watchedValues: Record<string, unknown>) => ReactNode;
|
|
884
|
+
labels?: {
|
|
885
|
+
back?: string;
|
|
886
|
+
next?: string;
|
|
887
|
+
create?: string;
|
|
888
|
+
save?: string;
|
|
889
|
+
};
|
|
890
|
+
testID?: string;
|
|
891
|
+
}
|
|
892
|
+
/** A form in steps (genesis-core's `useWizard`): the step's fields, its progress, Back and Next, and Create or Save on the last step. */
|
|
893
|
+
declare function NativeWizardForm({ steps, form, fields, onSubmit, isSaving, action, onInvalid, renderField, labels, testID }: NativeWizardFormProps): react.JSX.Element;
|
|
894
|
+
|
|
895
|
+
type Row$1 = Record<string, unknown>;
|
|
896
|
+
/** What a native custom view draws from: the status, the rows, the list's state and its helpers. */
|
|
897
|
+
interface NativeCustomViewState<T extends Row$1 = Row$1> {
|
|
898
|
+
view: AnyResourceView<T>;
|
|
899
|
+
type: "list";
|
|
900
|
+
status: CustomViewStatus;
|
|
901
|
+
error: string | null;
|
|
902
|
+
retry: () => void;
|
|
903
|
+
rows: T[];
|
|
904
|
+
/** The rows under headers: the view's `groupBy`, or `options.field`. */
|
|
905
|
+
groups: (rows?: readonly T[], options?: GroupRowsOptions) => RowGroup<T & DataRow>[];
|
|
906
|
+
/** Paging, search, refresh, the row's actions and the writes, as NativeResourceView has them. */
|
|
907
|
+
list: UseNativeResourceViewReturn<T>;
|
|
908
|
+
/** The person asked for less motion: skip or shorten animations. */
|
|
909
|
+
reducedMotion: boolean;
|
|
910
|
+
}
|
|
911
|
+
interface NativeCustomViewProps<T extends Row$1 = Row$1> extends NativeResourceViewOptions<T> {
|
|
912
|
+
view: AnyResourceView<T>;
|
|
913
|
+
/** Draws the view once there's something to show. */
|
|
914
|
+
children: (state: NativeCustomViewState<T>) => ReactNode;
|
|
915
|
+
loading?: ReactNode;
|
|
916
|
+
/** Replaces the empty state; `false` hands an empty view to `children` too. */
|
|
917
|
+
empty?: ReactNode | false;
|
|
918
|
+
/** Replaces the error state; a function gets the error and a retry. */
|
|
919
|
+
error?: ReactNode | ((error: string, retry: () => void) => ReactNode);
|
|
920
|
+
testID?: string;
|
|
921
|
+
}
|
|
922
|
+
/** A native custom view's data and states, headless. `<NativeCustomView>` calls it and draws the states. */
|
|
923
|
+
declare function useNativeCustomView<T extends Row$1 = Row$1>(view: AnyResourceView<T>, options?: NativeResourceViewOptions<T>): NativeCustomViewState<T>;
|
|
924
|
+
declare function NativeCustomView<T extends Row$1 = Row$1>({ view, children, loading, empty, error, testID, ...options }: NativeCustomViewProps<T>): react.JSX.Element;
|
|
925
|
+
|
|
926
|
+
type Row = Record<string, unknown>;
|
|
927
|
+
interface NativeRecordPeekProps<T extends Row = Row> extends Omit<NativeRecordViewProps<T>, "row"> {
|
|
928
|
+
/** The record, or null while none is open. */
|
|
929
|
+
row: T | null;
|
|
930
|
+
open: boolean;
|
|
931
|
+
onClose: () => void;
|
|
932
|
+
/** Shows Edit (where the screen's `can` and the view's update guard allow it): open the record's form. */
|
|
933
|
+
onEdit?: (row: T) => void;
|
|
934
|
+
/**
|
|
935
|
+
* Shows Delete (where `can` and the view's delete guard allow it). The peek confirms first, so
|
|
936
|
+
* pass the write itself (the provider's delete), never a handler that confirms again. Return its
|
|
937
|
+
* promise: the sheet closes when it resolves, and a rejection is shown in plain words.
|
|
938
|
+
*/
|
|
939
|
+
onDelete?: (row: T) => unknown;
|
|
940
|
+
/** The screen's own rule, as NativeResourceView's `can`: `false` hides Edit or Delete, a sentence refuses it. Only narrows the view's guards. */
|
|
941
|
+
can?: NativeResourceScreenCan<T>;
|
|
942
|
+
/** Above the record (a link to its full page). */
|
|
943
|
+
header?: ReactNode;
|
|
944
|
+
/** The sheet's heights. Default `["60%", "92%"]`. */
|
|
945
|
+
snapPoints?: (string | number)[];
|
|
946
|
+
/** Overrides for the resource-view messages (`common.edit`, `delete` / `bin`, `common.cancel`). */
|
|
947
|
+
labels?: {
|
|
948
|
+
edit?: string;
|
|
949
|
+
delete?: string;
|
|
950
|
+
deleteTitle?: string;
|
|
951
|
+
deleteBody?: string;
|
|
952
|
+
cancel?: string;
|
|
953
|
+
};
|
|
954
|
+
}
|
|
955
|
+
declare function NativeRecordPeek<T extends Row = Row>({ row, open, onClose, onEdit, onDelete, can, header, snapPoints, labels, testID, ...rest }: NativeRecordPeekProps<T>): react.JSX.Element;
|
|
956
|
+
|
|
957
|
+
export { type AnyResourceView, DEFAULT_MAX_PAGES, type DisplayContext, type DisplayRenderer, type DisplayRenderers, DisplayRenderersProvider, type DisplayTimeZones, DisplayTimeZonesProvider, type NativeCardFieldDef, NativeConflictSheet, type NativeConflictSheetMessages, type NativeConflictSheetProps, NativeCustomView, type NativeCustomViewProps, type NativeCustomViewState, NativeDataFilters, type NativeDataFiltersProps, NativeDataPageShell, type NativeDataPageShellProps, type NativeDetailField, NativeDetailPanel, type NativeDetailPanelProps, NativeEmptyState, type NativeEmptyStateProps, NativeFieldArrayRenderer, type NativeFieldArrayRendererProps, NativeFileUploadField, type NativeFileUploadFieldProps, type NativeFormField, type NativeFormFieldKind, NativeRecordPeek, type NativeRecordPeekProps, NativeRecordView, type NativeRecordViewHeaderProps, NativeRecordViewMenu, type NativeRecordViewMessages, type NativeRecordViewProps, NativeRelationField, type NativeRelationFieldProps, 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, NativeWizardForm, type NativeWizardFormProps, 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, useNativeCustomView, useNativeResourceView, useNativeResourceViewMessages, validateValues, writableValues };
|