@marktiderman/genesis-ui-native 2.2.0 → 2.3.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.
- package/README.md +82 -0
- package/dist/chunk-7PCWEY6R.js +27 -0
- package/dist/chunk-7PCWEY6R.js.map +1 -0
- package/dist/chunk-D5RKSPMH.js +24 -0
- package/dist/chunk-D5RKSPMH.js.map +1 -0
- package/dist/{chunk-5HRGIA6F.js → chunk-EFXCJ5AN.js} +76 -3
- package/dist/chunk-EFXCJ5AN.js.map +1 -0
- package/dist/{chunk-ULS7I6ZS.js → chunk-ERHGCWTY.js} +81 -12
- package/dist/chunk-ERHGCWTY.js.map +1 -0
- package/dist/{chunk-2WCXMJL6.js → chunk-FIITITXO.js} +67 -108
- package/dist/chunk-FIITITXO.js.map +1 -0
- package/dist/chunk-FZY2IXOX.js +1559 -0
- package/dist/chunk-FZY2IXOX.js.map +1 -0
- package/dist/{chunk-TXJT55JC.js → chunk-W7BK3ARU.js} +715 -293
- package/dist/chunk-W7BK3ARU.js.map +1 -0
- package/dist/components/index.d.ts +142 -17
- package/dist/components/index.js +6 -4
- package/dist/data/index.d.ts +7 -1
- package/dist/data/index.js +31 -6
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/icons/lucide.d.ts +7 -0
- package/dist/icons/lucide.js +47 -0
- package/dist/icons/lucide.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -6
- package/dist/layouts/index.d.ts +320 -4
- package/dist/layouts/index.js +3 -3
- package/dist/native-modules-BSVaEb3D.d.ts +206 -0
- package/package.json +34 -5
- package/src/__tests__/fake-modules.tsx +134 -0
- package/src/__tests__/native-modules-lists.test.tsx +70 -0
- package/src/__tests__/native-modules.test.tsx +631 -0
- package/src/components/__tests__/sheet.test.tsx +193 -0
- package/src/components/__tests__/toast.test.tsx +15 -0
- package/src/components/avatar.tsx +69 -16
- package/src/components/date-time-picker.tsx +128 -10
- package/src/components/drawer.tsx +158 -68
- package/src/components/dropdown-menu.tsx +7 -6
- package/src/components/glass-surface.tsx +150 -0
- package/src/components/icon.tsx +66 -0
- package/src/components/image.tsx +89 -0
- package/src/components/index.ts +33 -2
- package/src/components/list-item.tsx +29 -9
- package/src/components/popover.tsx +12 -9
- package/src/components/segmented-control.tsx +7 -1
- package/src/components/sheet.tsx +276 -133
- package/src/components/skeleton.tsx +75 -53
- package/src/components/toast.tsx +185 -87
- package/src/data/NativeResourcePage.tsx +48 -3
- package/src/data/__tests__/resource-page-offline.test.tsx +47 -0
- package/src/hooks/use-reduced-motion.ts +24 -10
- package/src/icon-names.ts +49 -0
- package/src/icons/lucide.ts +88 -0
- package/src/layouts/__tests__/google-sign-in.test.tsx +26 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +155 -0
- package/src/layouts/__tests__/keyboard-scroll.test.tsx +42 -1
- package/src/layouts/__tests__/settings-page-native-look.test.tsx +142 -0
- package/src/layouts/__tests__/thread-page.test.tsx +128 -0
- package/src/layouts/auth-screen.tsx +6 -3
- package/src/layouts/google-sign-in.tsx +42 -0
- package/src/layouts/inbox-page.tsx +408 -0
- package/src/layouts/index.ts +37 -2
- package/src/layouts/keyboard.tsx +61 -9
- package/src/layouts/notifications-page.tsx +133 -16
- package/src/layouts/settings-page.tsx +117 -14
- package/src/layouts/settings-sub-page.tsx +9 -3
- package/src/layouts/thread-page.tsx +444 -0
- package/src/native-modules.tsx +186 -0
- package/dist/chunk-2WCXMJL6.js.map +0 -1
- package/dist/chunk-5HRGIA6F.js.map +0 -1
- package/dist/chunk-F2TGDKOO.js +0 -43
- package/dist/chunk-F2TGDKOO.js.map +0 -1
- package/dist/chunk-FZTUSM56.js +0 -935
- package/dist/chunk-FZTUSM56.js.map +0 -1
- package/dist/chunk-TXJT55JC.js.map +0 -1
- package/dist/chunk-ULS7I6ZS.js.map +0 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default from 'react';
|
|
2
|
+
import react__default, { ReactNode } from 'react';
|
|
3
3
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
|
-
import { TextProps, TextInputProps, ViewProps, SwitchProps } from 'react-native';
|
|
5
|
+
import { TextProps, ScrollViewProps, TextInputProps, ViewProps, SwitchProps, ColorValue } from 'react-native';
|
|
6
|
+
import { o as NativeIconName, b as GenesisGlassModule } from '../native-modules-BSVaEb3D.js';
|
|
7
|
+
export { G as GenesisDatePickerComponent, a as GenesisDatePickerProps, 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, S as SF_SYMBOLS, u as useGenesisModules } from '../native-modules-BSVaEb3D.js';
|
|
6
8
|
|
|
7
9
|
declare const textVariants: (props?: ({
|
|
8
10
|
preset?: "h1" | "h2" | "h3" | "h4" | "body" | "body-sm" | "caption" | "label" | null | undefined;
|
|
@@ -124,18 +126,60 @@ declare function useToast(): NativeToastContextValue;
|
|
|
124
126
|
interface NativeSheetProps {
|
|
125
127
|
/** Controlled visibility. */
|
|
126
128
|
open: boolean;
|
|
127
|
-
/** Fired when the user dismisses the sheet (backdrop,
|
|
129
|
+
/** Fired when the user dismisses the sheet (backdrop, swipe down, Android back). Set `open` false in it. */
|
|
128
130
|
onOpenChange: (open: boolean) => void;
|
|
129
|
-
/** Snap points
|
|
131
|
+
/** Snap points, with `@gorhom/bottom-sheet` only (see `NativeSheetProvider`). e.g. ["25%", "50%", "90%"]. */
|
|
130
132
|
snapPoints?: (string | number)[];
|
|
131
|
-
/** Index of initial snap point. Default 0. */
|
|
133
|
+
/** Index of initial snap point, with `@gorhom/bottom-sheet` only. Default 0. */
|
|
132
134
|
initialSnapIndex?: number;
|
|
133
|
-
/**
|
|
135
|
+
/** Keep the sheet open when the user taps the backdrop, swipes it down or presses Android back. Default false. */
|
|
134
136
|
disableBackdropDismiss?: boolean;
|
|
135
|
-
children:
|
|
137
|
+
children: ReactNode;
|
|
136
138
|
testID?: string;
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
/**
|
|
141
|
+
* The parts of `@gorhom/bottom-sheet` (v5) the sheet uses. Pass the whole
|
|
142
|
+
* module: `import * as BottomSheet from "@gorhom/bottom-sheet"`.
|
|
143
|
+
*/
|
|
144
|
+
interface NativeSheetLibrary {
|
|
145
|
+
BottomSheetModal: unknown;
|
|
146
|
+
BottomSheetView: unknown;
|
|
147
|
+
BottomSheetBackdrop: unknown;
|
|
148
|
+
BottomSheetModalProvider: unknown;
|
|
149
|
+
/** Used by `NativeSheetScrollView` when present. */
|
|
150
|
+
BottomSheetScrollView?: unknown;
|
|
151
|
+
}
|
|
152
|
+
interface NativeSheetProviderProps {
|
|
153
|
+
/**
|
|
154
|
+
* `@gorhom/bottom-sheet` v5 (`import * as BottomSheet from "@gorhom/bottom-sheet"`).
|
|
155
|
+
* Read once. The app must also wrap its root in gesture-handler's
|
|
156
|
+
* `GestureHandlerRootView` and set Reanimated up, as the library requires.
|
|
157
|
+
* Sheet content renders in the library's portal, inside this provider:
|
|
158
|
+
* mount it below the providers sheets read (data, session, navigation).
|
|
159
|
+
*/
|
|
160
|
+
bottomSheet: NativeSheetLibrary;
|
|
161
|
+
children: ReactNode;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Opts every `NativeSheet` below it into `@gorhom/bottom-sheet` and mounts
|
|
165
|
+
* the library's `BottomSheetModalProvider`. A module missing any export the
|
|
166
|
+
* sheet needs is reported with `console.error` and ignored, so sheets fall
|
|
167
|
+
* back to the native modal instead of crashing on open.
|
|
168
|
+
*
|
|
169
|
+
* @stability Beta
|
|
170
|
+
*/
|
|
171
|
+
declare function NativeSheetProvider({ bottomSheet, children }: NativeSheetProviderProps): react.JSX.Element;
|
|
172
|
+
/** @stability Beta */
|
|
173
|
+
declare function NativeSheet(props: NativeSheetProps): react.JSX.Element;
|
|
174
|
+
/**
|
|
175
|
+
* A `ScrollView` for sheet content: the library's `BottomSheetScrollView`
|
|
176
|
+
* under `NativeSheetProvider` (so scrolling and dragging the sheet don't
|
|
177
|
+
* fight), React Native's otherwise. Sized to its content until it reaches
|
|
178
|
+
* the sheet's height.
|
|
179
|
+
*
|
|
180
|
+
* @stability Beta
|
|
181
|
+
*/
|
|
182
|
+
declare function NativeSheetScrollView({ style, ...props }: ScrollViewProps): react.JSX.Element;
|
|
139
183
|
|
|
140
184
|
interface NativePopoverProps {
|
|
141
185
|
open?: boolean;
|
|
@@ -172,7 +216,7 @@ interface NativeDrawerProps {
|
|
|
172
216
|
className?: string;
|
|
173
217
|
testID?: string;
|
|
174
218
|
}
|
|
175
|
-
declare function NativeDrawer(
|
|
219
|
+
declare function NativeDrawer(props: NativeDrawerProps): react.JSX.Element;
|
|
176
220
|
|
|
177
221
|
type NativeAccordionType = "single" | "multiple";
|
|
178
222
|
interface NativeAccordionProps {
|
|
@@ -486,10 +530,10 @@ interface NativeRefreshControlProps {
|
|
|
486
530
|
declare function NativeRefreshControl(props: NativeRefreshControlProps): react.JSX.Element | null;
|
|
487
531
|
|
|
488
532
|
declare const badgeVariants: (props?: ({
|
|
489
|
-
variant?: "default" | "secondary" | "outline" | "destructive" | "
|
|
533
|
+
variant?: "default" | "secondary" | "outline" | "destructive" | "info" | "success" | "warning" | "muted" | null | undefined;
|
|
490
534
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
491
535
|
declare const badgeTextVariants: (props?: ({
|
|
492
|
-
variant?: "default" | "secondary" | "outline" | "destructive" | "
|
|
536
|
+
variant?: "default" | "secondary" | "outline" | "destructive" | "info" | "success" | "warning" | "muted" | null | undefined;
|
|
493
537
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
494
538
|
interface NativeBadgeProps extends VariantProps<typeof badgeVariants> {
|
|
495
539
|
className?: string;
|
|
@@ -526,16 +570,16 @@ interface NativeSkeletonProps {
|
|
|
526
570
|
circle?: boolean;
|
|
527
571
|
testID?: string;
|
|
528
572
|
}
|
|
529
|
-
declare function NativeSkeleton(
|
|
573
|
+
declare function NativeSkeleton(props: NativeSkeletonProps): react.JSX.Element;
|
|
530
574
|
|
|
531
575
|
declare const alertVariants: (props?: ({
|
|
532
|
-
variant?: "default" | "destructive" | "
|
|
576
|
+
variant?: "default" | "destructive" | "info" | "success" | "warning" | null | undefined;
|
|
533
577
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
534
578
|
declare const alertTitleTextVariants: (props?: ({
|
|
535
|
-
variant?: "default" | "destructive" | "
|
|
579
|
+
variant?: "default" | "destructive" | "info" | "success" | "warning" | null | undefined;
|
|
536
580
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
537
581
|
declare const alertDescriptionTextVariants: (props?: ({
|
|
538
|
-
variant?: "default" | "destructive" | "
|
|
582
|
+
variant?: "default" | "destructive" | "info" | "success" | "warning" | null | undefined;
|
|
539
583
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
540
584
|
interface NativeAlertProps extends VariantProps<typeof alertVariants> {
|
|
541
585
|
className?: string;
|
|
@@ -566,9 +610,23 @@ interface NativeAvatarProps {
|
|
|
566
610
|
fallback?: string;
|
|
567
611
|
/** Size in pixels. Defaults to 40. Use className for NativeWind sizing. */
|
|
568
612
|
size?: number;
|
|
613
|
+
/**
|
|
614
|
+
* expo-image only: a blurhash or thumbhash shown while the picture loads,
|
|
615
|
+
* as expo-image's `placeholder` takes it (`{ blurhash }`, `{ thumbhash }`).
|
|
616
|
+
*/
|
|
617
|
+
placeholder?: {
|
|
618
|
+
blurhash: string;
|
|
619
|
+
} | {
|
|
620
|
+
thumbhash: string;
|
|
621
|
+
};
|
|
622
|
+
/**
|
|
623
|
+
* expo-image only: resets the view when it changes, for rows a recycling
|
|
624
|
+
* list (FlashList) reuses. Default the image URL.
|
|
625
|
+
*/
|
|
626
|
+
recyclingKey?: string;
|
|
569
627
|
testID?: string;
|
|
570
628
|
}
|
|
571
|
-
declare function NativeAvatar({ className, src, alt, fallback, size,
|
|
629
|
+
declare function NativeAvatar({ className, src, alt, fallback, size, placeholder, recyclingKey, testID, }: NativeAvatarProps): react.JSX.Element;
|
|
572
630
|
|
|
573
631
|
interface NativeProgressProps {
|
|
574
632
|
className?: string;
|
|
@@ -914,4 +972,71 @@ interface GridProps extends ViewProps {
|
|
|
914
972
|
*/
|
|
915
973
|
declare function Grid({ columns, gap, className, children, ...props }: GridProps): react.JSX.Element;
|
|
916
974
|
|
|
917
|
-
|
|
975
|
+
interface NativeIconProps {
|
|
976
|
+
name: NativeIconName;
|
|
977
|
+
/** Points. Default 20. */
|
|
978
|
+
size?: number;
|
|
979
|
+
/** Default the theme's label color. */
|
|
980
|
+
color?: ColorValue;
|
|
981
|
+
/** iOS SF Symbol weight. */
|
|
982
|
+
weight?: "ultraLight" | "thin" | "light" | "regular" | "medium" | "semibold" | "bold" | "heavy" | "black";
|
|
983
|
+
/** Read by screen readers. Without it the icon is decorative and hidden from them. */
|
|
984
|
+
label?: string;
|
|
985
|
+
testID?: string;
|
|
986
|
+
}
|
|
987
|
+
declare function NativeIcon({ name, size, color, weight, label, testID }: NativeIconProps): react.JSX.Element;
|
|
988
|
+
|
|
989
|
+
interface NativeImageProps {
|
|
990
|
+
src: string;
|
|
991
|
+
/** Read by screen readers. Without it the picture is decorative. */
|
|
992
|
+
alt?: string;
|
|
993
|
+
className?: string;
|
|
994
|
+
width?: number;
|
|
995
|
+
height?: number;
|
|
996
|
+
/** Default `"cover"`. */
|
|
997
|
+
contentFit?: "cover" | "contain";
|
|
998
|
+
/** expo-image only: `{ blurhash }` or `{ thumbhash }` shown while loading. */
|
|
999
|
+
placeholder?: {
|
|
1000
|
+
blurhash: string;
|
|
1001
|
+
} | {
|
|
1002
|
+
thumbhash: string;
|
|
1003
|
+
};
|
|
1004
|
+
/** expo-image only: resets the view when it changes (recycled rows). Default `src`. */
|
|
1005
|
+
recyclingKey?: string;
|
|
1006
|
+
/** expo-image only: load order among images. */
|
|
1007
|
+
priority?: "low" | "normal" | "high";
|
|
1008
|
+
testID?: string;
|
|
1009
|
+
}
|
|
1010
|
+
declare function NativeImage({ src, alt, className, width, height, contentFit, placeholder, recyclingKey, priority, testID, }: NativeImageProps): react.JSX.Element;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* True while the user has Reduce Transparency on (iOS), `null` until the
|
|
1014
|
+
* first answer. Always false elsewhere, and on a runtime that can't say.
|
|
1015
|
+
*/
|
|
1016
|
+
declare function useReduceTransparency(): boolean | null;
|
|
1017
|
+
/** expo-glass-effect's `GlassView` when Liquid Glass can be drawn here, else `null`. */
|
|
1018
|
+
declare function useLiquidGlass(): GenesisGlassModule["GlassView"] | null;
|
|
1019
|
+
interface NativeGlassSurfaceProps {
|
|
1020
|
+
children?: ReactNode;
|
|
1021
|
+
/**
|
|
1022
|
+
* Layout classes (padding, gap, width). Without glass they merge with
|
|
1023
|
+
* `fallbackClassName` on one view, so they can override it (`rounded-*`,
|
|
1024
|
+
* `bg-*`). On glass they go on the view inside the glass: the glass's shape
|
|
1025
|
+
* comes from `radius` alone, and a `bg-*` here paints over the glass.
|
|
1026
|
+
*/
|
|
1027
|
+
className?: string;
|
|
1028
|
+
/** The solid look when glass can't be drawn, radius included. Default `"rounded-xl border border-border bg-card"`. */
|
|
1029
|
+
fallbackClassName?: string;
|
|
1030
|
+
/** The glass's corner radius in points. Default 16. */
|
|
1031
|
+
radius?: number;
|
|
1032
|
+
/** Glass tint (a color string). */
|
|
1033
|
+
tintColor?: string;
|
|
1034
|
+
/** Glass reacts to touch. Default false. */
|
|
1035
|
+
interactive?: boolean;
|
|
1036
|
+
/** Default `"regular"`. */
|
|
1037
|
+
glassEffectStyle?: "regular" | "clear";
|
|
1038
|
+
testID?: string;
|
|
1039
|
+
}
|
|
1040
|
+
declare function NativeGlassSurface({ children, className, fallbackClassName, radius, tintColor, interactive, glassEffectStyle, testID, }: NativeGlassSurfaceProps): react.JSX.Element;
|
|
1041
|
+
|
|
1042
|
+
export { Box, type BoxBackground, type BoxProps, type FlexAlign, type FlexJustify, GenesisGlassModule, Grid, type GridProps, Inline, type InlineProps, NativeAccordion, NativeAccordionContent, type NativeAccordionContentProps, NativeAccordionItem, type NativeAccordionItemProps, type NativeAccordionProps, NativeAccordionTrigger, type NativeAccordionTriggerProps, type NativeAccordionType, NativeAlert, NativeAlertDescription, type NativeAlertDescriptionProps, type NativeAlertProps, NativeAlertTitle, type NativeAlertTitleProps, NativeAvatar, type NativeAvatarProps, NativeBadge, type NativeBadgeProps, NativeBanner, type NativeBannerProps, NativeButton, type NativeButtonProps, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, type NativeCardProps, NativeCardTitle, type NativeCardTitleProps, NativeCheckbox, type NativeCheckboxProps, NativeChip, NativeChipGroup, type NativeChipGroupMode, type NativeChipGroupProps, type NativeChipProps, NativeCombobox, type NativeComboboxOption, type NativeComboboxProps, NativeDatePicker, type NativeDatePickerProps, NativeDialog, NativeDialogContent, type NativeDialogContentProps, NativeDialogDescription, type NativeDialogDescriptionProps, NativeDialogFooter, type NativeDialogFooterProps, NativeDialogHeader, type NativeDialogHeaderProps, type NativeDialogProps, NativeDialogTitle, type NativeDialogTitleProps, NativeDrawer, type NativeDrawerProps, NativeDropdownMenu, NativeDropdownMenuContent, type NativeDropdownMenuContentProps, NativeDropdownMenuItem, type NativeDropdownMenuItemProps, type NativeDropdownMenuProps, NativeDropdownMenuTrigger, type NativeDropdownMenuTriggerProps, NativeEmptyState, type NativeEmptyStateProps, type NativeEmptyStateVariant, NativeGlassSurface, type NativeGlassSurfaceProps, NativeHeaderCard, type NativeHeaderCardProps, NativeIcon, NativeIconName, type NativeIconProps, NativeImage, type NativeImageProps, NativeInlineAlert, type NativeInlineAlertProps, type NativeInlineAlertVariant, NativeInput, type NativeInputProps, NativeLabel, type NativeLabelProps, NativeListItem, NativeListItemDivider, type NativeListItemProps, NativeNumberInput, type NativeNumberInputProps, NativePagination, type NativePaginationProps, NativePopover, NativePopoverContent, type NativePopoverContentProps, type NativePopoverProps, NativePopoverTrigger, type NativePopoverTriggerProps, NativeProgress, type NativeProgressProps, NativeRadioGroup, NativeRadioGroupItem, type NativeRadioGroupItemProps, type NativeRadioGroupProps, NativeRangeSlider, type NativeRangeSliderProps, NativeRefreshControl, type NativeRefreshControlProps, NativeSearchBar, type NativeSearchBarProps, NativeSectionListHeader, type NativeSectionListHeaderProps, NativeSegmentedControl, type NativeSegmentedControlOption, type NativeSegmentedControlProps, NativeSelect, NativeSelectContent, type NativeSelectContentProps, NativeSelectItem, type NativeSelectItemProps, type NativeSelectProps, NativeSelectTrigger, type NativeSelectTriggerProps, NativeSeparator, type NativeSeparatorProps, NativeSheet, type NativeSheetLibrary, type NativeSheetProps, NativeSheetProvider, type NativeSheetProviderProps, NativeSheetScrollView, NativeSkeleton, type NativeSkeletonProps, NativeSlider, type NativeSliderProps, NativeStepper, type NativeStepperProps, type NativeStepperStep, NativeSwitch, type NativeSwitchProps, NativeTabs, NativeTabsContent, type NativeTabsContentProps, NativeTabsList, type NativeTabsListProps, type NativeTabsProps, NativeTabsTrigger, type NativeTabsTriggerProps, NativeText, type NativeTextProps, NativeTextarea, type NativeTextareaProps, NativeTimePicker, type NativeTimePickerProps, type NativeToastOptions, NativeToastProvider, type NativeToastProviderProps, type NativeToastVariant, NativeToggle, type NativeToggleProps, NativeTooltip, NativeTooltipContent, type NativeTooltipContentProps, type NativeTooltipProps, NativeTooltipTrigger, type NativeTooltipTriggerProps, type SpaceToken, type SpacingPrefix, Stack, type StackProps, type TextPreset, alertVariants, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, spaceScale, spacingClass, textVariants, toggleVariants, useLiquidGlass, useReduceTransparency, useToast };
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { Box, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeHeaderCard, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRefreshControl, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useToast } from '../chunk-
|
|
2
|
-
export { NativeAlert, NativeAlertDescription, NativeAlertTitle,
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
export { Box, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeRefreshControl, NativeSearchBar, NativeSegmentedControl, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeTimePicker, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from '../chunk-W7BK3ARU.js';
|
|
2
|
+
export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeLabel, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSkeleton, NativeSwitch, NativeTextarea, alertVariants } from '../chunk-FIITITXO.js';
|
|
3
|
+
import '../chunk-7PCWEY6R.js';
|
|
4
|
+
export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeSectionListHeader, SF_SYMBOLS } from '../chunk-ERHGCWTY.js';
|
|
5
|
+
export { GenesisModulesProvider, NativeBadge, NativeButton, NativeInput, NativeText, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from '../chunk-EFXCJ5AN.js';
|
|
6
|
+
import '../chunk-Z3AQYVUA.js';
|
|
5
7
|
import '../chunk-OHZD7KRO.js';
|
|
6
8
|
import '../chunk-DGUM43GV.js';
|
|
7
9
|
//# sourceMappingURL=index.js.map
|
package/dist/data/index.d.ts
CHANGED
|
@@ -110,7 +110,13 @@ interface NativeResourcePageProps<T extends BaseRecord = BaseRecord> {
|
|
|
110
110
|
createLabel?: string;
|
|
111
111
|
headerRight?: ReactNode;
|
|
112
112
|
emptyState?: ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Shown while the list has nothing saved and its fetch is paused because
|
|
115
|
+
* the device is offline (`networkMode: "offlineFirst"`), instead of an empty
|
|
116
|
+
* list that says there is nothing. Default: a one-line offline message.
|
|
117
|
+
*/
|
|
118
|
+
offlineState?: ReactNode;
|
|
113
119
|
}
|
|
114
|
-
declare function NativeResourcePage<T extends BaseRecord = BaseRecord>({ resource, resourceOptions, title, subtitle, cardFields, renderItem, searchFields, searchPlaceholder, statusFilter, onItemPress, titleField, onCreatePress, createLabel, headerRight, emptyState, }: NativeResourcePageProps<T>): react.JSX.Element;
|
|
120
|
+
declare function NativeResourcePage<T extends BaseRecord = BaseRecord>({ resource, resourceOptions, title, subtitle, cardFields, renderItem, searchFields, searchPlaceholder, statusFilter, onItemPress, titleField, onCreatePress, createLabel, headerRight, emptyState, offlineState, }: NativeResourcePageProps<T>): react.JSX.Element;
|
|
115
121
|
|
|
116
122
|
export { type NativeCardFieldDef, NativeDataFilters, type NativeDataFiltersProps, NativeDataPageShell, type NativeDataPageShellProps, type NativeDetailField, NativeDetailPanel, type NativeDetailPanelProps, NativeEmptyState, type NativeEmptyStateProps, NativeResourceForm, NativeResourceFormFieldRenderer, type NativeResourceFormFieldRendererProps, type NativeResourceFormProps, NativeResourcePage, type NativeResourcePageProps };
|
package/dist/data/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { NativeCard, NativeCardContent, NativeSeparator, NativeLabel, NativeSwitch, NativeCheckbox, NativeSelect, NativeSelectTrigger, NativeSelectContent, NativeSelectItem, NativeTextarea, NativeAlert, NativeAlertTitle, NativeAlertDescription, NativeSkeleton, NativeCardHeader, NativeCardTitle } from '../chunk-FIITITXO.js';
|
|
2
|
+
import '../chunk-7PCWEY6R.js';
|
|
3
|
+
import { NativeText, NativeButton, NativeInput, NativeBadge, useGenesisModules } from '../chunk-EFXCJ5AN.js';
|
|
3
4
|
import '../chunk-OHZD7KRO.js';
|
|
4
5
|
import '../chunk-DGUM43GV.js';
|
|
5
6
|
import { View, ScrollView, Pressable, FlatList } from 'react-native';
|
|
@@ -556,8 +557,10 @@ function NativeResourcePage({
|
|
|
556
557
|
onCreatePress,
|
|
557
558
|
createLabel = "New",
|
|
558
559
|
headerRight,
|
|
559
|
-
emptyState
|
|
560
|
+
emptyState,
|
|
561
|
+
offlineState
|
|
560
562
|
}) {
|
|
563
|
+
const { list: FlashList } = useGenesisModules();
|
|
561
564
|
const [search, setSearchLocal] = useState("");
|
|
562
565
|
const [selectedStatuses, setSelectedStatuses] = useState([]);
|
|
563
566
|
const statusFilterConfig = useMemo(() => {
|
|
@@ -604,6 +607,7 @@ function NativeResourcePage({
|
|
|
604
607
|
const items = list.data?.data ?? [];
|
|
605
608
|
const isLoading = list.isLoading;
|
|
606
609
|
const hasError = list.isError;
|
|
610
|
+
const isOfflineEmpty = list.isPaused && list.data === void 0;
|
|
607
611
|
const resolvedFields = useMemo(() => {
|
|
608
612
|
if (titleField && cardFields) {
|
|
609
613
|
const resolved = cardFields.map((f, i) => resolveField(f, i));
|
|
@@ -698,14 +702,18 @@ function NativeResourcePage({
|
|
|
698
702
|
[search, searchPlaceholder, statusOptions, selectedStatuses]
|
|
699
703
|
);
|
|
700
704
|
const ListEmptyComponent = useMemo(
|
|
701
|
-
() => isLoading ? null :
|
|
705
|
+
() => isLoading ? null : isOfflineEmpty ? (
|
|
706
|
+
// In the list, under its header, so search and filters stay usable offline: clearing a
|
|
707
|
+
// search brings back the saved rows.
|
|
708
|
+
/* @__PURE__ */ jsx(View, { testID: "native-resource-offline", className: "flex-1 items-center justify-center px-4 py-12 gap-4", children: offlineState ?? /* @__PURE__ */ jsx(NativeText, { preset: "body", className: "text-muted-foreground text-center", children: "You're offline. This list loads when you're back online." }) })
|
|
709
|
+
) : /* @__PURE__ */ jsx(Fragment, { children: emptyState ?? /* @__PURE__ */ jsx(
|
|
702
710
|
NativeEmptyState,
|
|
703
711
|
{
|
|
704
712
|
hasFilters: hasActiveFilters,
|
|
705
713
|
onClearFilters: hasActiveFilters ? handleClearFilters : void 0
|
|
706
714
|
}
|
|
707
715
|
) }),
|
|
708
|
-
[isLoading, emptyState, hasActiveFilters, handleClearFilters]
|
|
716
|
+
[isLoading, isOfflineEmpty, offlineState, emptyState, hasActiveFilters, handleClearFilters]
|
|
709
717
|
);
|
|
710
718
|
const renderPageContent = () => {
|
|
711
719
|
if (isLoading) {
|
|
@@ -722,16 +730,33 @@ function NativeResourcePage({
|
|
|
722
730
|
/* @__PURE__ */ jsx(NativeButton, { variant: "outline", size: "sm", onPress: () => list.refetch(), children: "Try Again" })
|
|
723
731
|
] });
|
|
724
732
|
}
|
|
733
|
+
if (FlashList) {
|
|
734
|
+
return /* @__PURE__ */ jsx(
|
|
735
|
+
FlashList,
|
|
736
|
+
{
|
|
737
|
+
testID: "native-resource-page-list",
|
|
738
|
+
data: items,
|
|
739
|
+
keyExtractor,
|
|
740
|
+
renderItem: renderFlatListItem,
|
|
741
|
+
ListHeaderComponent,
|
|
742
|
+
ListEmptyComponent,
|
|
743
|
+
contentContainerStyle: { paddingBottom: 24 },
|
|
744
|
+
refreshing: refreshing && !list.isPaused,
|
|
745
|
+
onRefresh: handleRefresh
|
|
746
|
+
}
|
|
747
|
+
);
|
|
748
|
+
}
|
|
725
749
|
return /* @__PURE__ */ jsx(
|
|
726
750
|
FlatList,
|
|
727
751
|
{
|
|
752
|
+
testID: "native-resource-page-list",
|
|
728
753
|
data: items,
|
|
729
754
|
keyExtractor,
|
|
730
755
|
renderItem: renderFlatListItem,
|
|
731
756
|
ListHeaderComponent,
|
|
732
757
|
ListEmptyComponent,
|
|
733
758
|
contentContainerStyle: { flexGrow: 1, paddingBottom: 24 },
|
|
734
|
-
refreshing,
|
|
759
|
+
refreshing: refreshing && !list.isPaused,
|
|
735
760
|
onRefresh: handleRefresh
|
|
736
761
|
}
|
|
737
762
|
);
|