@marktiderman/genesis-ui-native 2.4.1 → 2.5.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 +30 -0
- package/dist/{chunk-BPD5DCFP.js → chunk-IDHW2NOP.js} +45 -5
- package/dist/chunk-IDHW2NOP.js.map +1 -0
- package/dist/{chunk-6TLBCRS6.js → chunk-YI7XVY2D.js} +9 -7
- package/dist/chunk-YI7XVY2D.js.map +1 -0
- package/dist/{chunk-RARJGZA3.js → chunk-YJV5MMZX.js} +2 -2
- package/dist/{chunk-RARJGZA3.js.map → chunk-YJV5MMZX.js.map} +1 -1
- package/dist/components/index.d.ts +26 -2
- package/dist/components/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/layouts/index.d.ts +10 -1
- package/dist/layouts/index.js +2 -2
- package/package.json +2 -2
- package/src/components/__tests__/loading-state.test.tsx +41 -0
- package/src/components/index.ts +3 -0
- package/src/components/loading-state.tsx +92 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +2 -1
- package/src/layouts/__tests__/screen-container.test.tsx +27 -0
- package/src/layouts/inbox-page.tsx +4 -7
- package/src/layouts/screen-container.tsx +18 -1
- package/dist/chunk-6TLBCRS6.js.map +0 -1
- package/dist/chunk-BPD5DCFP.js.map +0 -1
|
@@ -2,7 +2,7 @@ import * as react from 'react';
|
|
|
2
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, ScrollViewProps, TextInputProps, ViewProps,
|
|
5
|
+
import { TextProps, ScrollViewProps, TextInputProps, ViewProps, ColorValue, SwitchProps } from 'react-native';
|
|
6
6
|
import { o as NativeIconName, b as GenesisGlassModule } from '../native-modules-_Q5vIbd5.js';
|
|
7
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-_Q5vIbd5.js';
|
|
8
8
|
|
|
@@ -597,6 +597,30 @@ interface NativeSkeletonProps {
|
|
|
597
597
|
}
|
|
598
598
|
declare function NativeSkeleton(props: NativeSkeletonProps): react.JSX.Element;
|
|
599
599
|
|
|
600
|
+
type NativeLoadingStateEdge = "top" | "bottom" | "left" | "right";
|
|
601
|
+
interface NativeLoadingStateProps {
|
|
602
|
+
/** Text shown under the spinner. It is also what screen readers announce. */
|
|
603
|
+
label?: string;
|
|
604
|
+
/** What screen readers announce when no `label` is shown. Default `"Loading"`. */
|
|
605
|
+
accessibilityLabel?: string;
|
|
606
|
+
/** Spinner size. Default `"large"`. */
|
|
607
|
+
size?: "small" | "large";
|
|
608
|
+
/**
|
|
609
|
+
* `true` (default): fill the screen on the theme background, inside the
|
|
610
|
+
* safe area. `false`: a padded, centred block that fills its parent, for a
|
|
611
|
+
* screen body, a section or a list footer.
|
|
612
|
+
*/
|
|
613
|
+
fullScreen?: boolean;
|
|
614
|
+
/** Safe-area edges when `fullScreen`. Default all four. */
|
|
615
|
+
safeAreaEdges?: NativeLoadingStateEdge[];
|
|
616
|
+
/** Spinner color. Defaults to the theme tint. */
|
|
617
|
+
color?: ColorValue;
|
|
618
|
+
className?: string;
|
|
619
|
+
/** testID on the root; the spinner is `${testID}-spinner`, the label `${testID}-label`. Default `"loading-state"`. */
|
|
620
|
+
testID?: string;
|
|
621
|
+
}
|
|
622
|
+
declare function NativeLoadingState({ label, accessibilityLabel, size, fullScreen, safeAreaEdges, color, className, testID, }: NativeLoadingStateProps): react.JSX.Element;
|
|
623
|
+
|
|
600
624
|
declare const alertVariants: (props?: ({
|
|
601
625
|
variant?: "default" | "destructive" | "info" | "success" | "warning" | null | undefined;
|
|
602
626
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
@@ -1064,4 +1088,4 @@ interface NativeGlassSurfaceProps {
|
|
|
1064
1088
|
}
|
|
1065
1089
|
declare function NativeGlassSurface({ children, className, fallbackClassName, radius, tintColor, interactive, glassEffectStyle, testID, }: NativeGlassSurfaceProps): react.JSX.Element;
|
|
1066
1090
|
|
|
1067
|
-
export { Box, type BoxBackground, type BoxProps, FULL_SCREEN_DARK, 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, NativeFullScreenModal, type NativeFullScreenModalProps, 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 };
|
|
1091
|
+
export { Box, type BoxBackground, type BoxProps, FULL_SCREEN_DARK, 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, NativeFullScreenModal, type NativeFullScreenModalProps, 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, NativeLoadingState, type NativeLoadingStateEdge, type NativeLoadingStateProps, 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,7 @@
|
|
|
1
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, 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-
|
|
1
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, 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-YJV5MMZX.js';
|
|
2
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
3
|
import '../chunk-7PCWEY6R.js';
|
|
4
|
-
export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from '../chunk-
|
|
4
|
+
export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from '../chunk-IDHW2NOP.js';
|
|
5
5
|
export { GenesisModulesProvider, NativeBadge, NativeButton, NativeInput, NativeText, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from '../chunk-EFXCJ5AN.js';
|
|
6
6
|
import '../chunk-Z3AQYVUA.js';
|
|
7
7
|
import '../chunk-OHZD7KRO.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, 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';
|
|
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
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';
|
|
3
3
|
export { BrandExtensionsProvider, BrandExtensionsProviderProps, BrandExtensionsValue, ThemeMode, ThemeRoleColors, UseThemeRolesOptions, useGenesisExtension, useReducedMotion, useThemeMode, useThemeRoles } from './hooks/index.js';
|
|
4
4
|
export { AppleButtonModuleLike, AppleProviderOptions, AppleSignInButton, AppleSignInButtonProps, AuthBranding, AuthBrandingProps, AuthForm, AuthFormProps, AuthFormValues, AuthScreen, AuthScreenProps, AuthScreenSlotMap, ForgotPasswordLink, GoogleProviderOptions, InboxItem, InboxPage, InboxPageProps, InboxPageSlotMap, InboxSwipeAction, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProps, KeyboardScrollProvider, KeyboardToolbarProps, NavBarSaveButton, NavBarSaveButtonProps, NavBarSearchBar, NavBarSearchBarProps, NavBarTitle, NavBarTitleProps, NotificationItem, NotificationsPage, NotificationsPageProps, NotificationsPageSlotMap, SafeAreaEdge, ScreenContainer, ScreenContainerProps, ScreenHeaderProps, ScrollEdgeBehavior, SettingsPage, SettingsPageDangerousAction, SettingsPageProps, SettingsPageRow, SettingsPageSection, SettingsPageSlotMap, SettingsSubPage, SettingsSubPageProps, SocialAuthProvider, SocialAuthRow, SocialAuthRowProps, ThreadAttachment, ThreadComposer, ThreadLabels, ThreadMessage, ThreadPage, ThreadPageProps, ThreadPageSlotMap, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from './layouts/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, 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-
|
|
1
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeAvatar, NativeBanner, NativeChip, NativeChipGroup, NativeCombobox, NativeDatePicker, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeImage, NativeInlineAlert, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, 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-YJV5MMZX.js';
|
|
2
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
3
|
export { BrandExtensionsProvider, useGenesisExtension } from './chunk-D5RKSPMH.js';
|
|
4
4
|
export { useReducedMotion } from './chunk-7PCWEY6R.js';
|
|
5
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from './chunk-
|
|
6
|
-
export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from './chunk-
|
|
5
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from './chunk-YI7XVY2D.js';
|
|
6
|
+
export { NATIVE_ICON_NAMES, NativeEmptyState, NativeIcon, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, SF_SYMBOLS } from './chunk-IDHW2NOP.js';
|
|
7
7
|
export { GenesisModulesProvider, NativeBadge, NativeButton, NativeInput, NativeText, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from './chunk-EFXCJ5AN.js';
|
|
8
8
|
export { useThemeMode, useThemeRoles } from './chunk-Z3AQYVUA.js';
|
|
9
9
|
export { cn } from './chunk-OHZD7KRO.js';
|
package/dist/layouts/index.d.ts
CHANGED
|
@@ -33,6 +33,15 @@ interface ScreenContainerProps {
|
|
|
33
33
|
* Only used when `scroll` is true.
|
|
34
34
|
*/
|
|
35
35
|
keyboardShouldPersistTaps?: "always" | "never" | "handled";
|
|
36
|
+
/**
|
|
37
|
+
* When `true`, a centred `NativeLoadingState` (theme-tinted spinner,
|
|
38
|
+
* announced as loading) replaces the body, inside the same safe area and
|
|
39
|
+
* background. Use it for redirect and first-load screens: the body is
|
|
40
|
+
* unmounted while it's on, so a form underneath loses its state. Default `false`.
|
|
41
|
+
*/
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/** Text under the spinner while `loading`, and what screen readers announce: pass translated text. */
|
|
44
|
+
loadingLabel?: string;
|
|
36
45
|
/** Style on the root, e.g. a theme-role background color. */
|
|
37
46
|
style?: ViewStyle;
|
|
38
47
|
/** testID on the root container. */
|
|
@@ -73,7 +82,7 @@ interface ScreenHeaderProps {
|
|
|
73
82
|
* return <><Stack.Screen options={opts} /><ScreenContainer>...</ScreenContainer></>;
|
|
74
83
|
*/
|
|
75
84
|
declare function composeHeaderOptions(props: ScreenHeaderProps): Record<string, unknown>;
|
|
76
|
-
declare function ScreenContainer({ children, scroll, safeAreaEdges, statusBar, themeMode, className, contentClassName, keyboardShouldPersistTaps, style, testID, }: ScreenContainerProps): react.JSX.Element;
|
|
85
|
+
declare function ScreenContainer({ children, scroll, safeAreaEdges, statusBar, themeMode, className, contentClassName, keyboardShouldPersistTaps, loading, loadingLabel, style, testID, }: ScreenContainerProps): react.JSX.Element;
|
|
77
86
|
|
|
78
87
|
interface NavBarSaveButtonProps {
|
|
79
88
|
/** Press handler. Disabled when not provided OR when `disabled`/`loading`. */
|
package/dist/layouts/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, InboxPage, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NavBarSaveButton, NavBarSearchBar, NavBarTitle, NotificationsPage, ScreenContainer, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, composeHeaderOptions, confirmDiscardChanges, defaultStickyHeaderOffset, formatInboxTime, getInboxPageStackOptions, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, showInboxActions, useKeyboardScroll, useKeyboardToolbar } from '../chunk-YI7XVY2D.js';
|
|
2
|
+
import '../chunk-IDHW2NOP.js';
|
|
3
3
|
import '../chunk-EFXCJ5AN.js';
|
|
4
4
|
import '../chunk-Z3AQYVUA.js';
|
|
5
5
|
import '../chunk-OHZD7KRO.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktiderman/genesis-ui-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@expo/ui": ">=58.0.0",
|
|
70
70
|
"@gorhom/bottom-sheet": ">=5.0.0",
|
|
71
71
|
"@hookform/resolvers": "^3.0.0 || ^4.0.0 || ^5.0.0",
|
|
72
|
-
"@marktiderman/genesis-core": "^1.
|
|
72
|
+
"@marktiderman/genesis-core": "^1.10.0",
|
|
73
73
|
"@marktiderman/genesis-design-system": "^1.5.0",
|
|
74
74
|
"@react-native-community/datetimepicker": ">=8.0.0",
|
|
75
75
|
"@shopify/flash-list": ">=2.0.0",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// @feat:native-layouts
|
|
2
|
+
import { render, screen } from "@testing-library/react";
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import { NativeLoadingState } from "../loading-state";
|
|
5
|
+
|
|
6
|
+
describe("NativeLoadingState", () => {
|
|
7
|
+
it("fills the screen inside every safe-area edge, announced as one loading progress bar", () => {
|
|
8
|
+
render(<NativeLoadingState />);
|
|
9
|
+
const root = screen.getByTestId("loading-state");
|
|
10
|
+
expect(root.getAttribute("data-edges")).toBe("top,bottom,left,right");
|
|
11
|
+
const content = screen.getByTestId("loading-state-content");
|
|
12
|
+
expect(content.getAttribute("role")).toBe("progressbar");
|
|
13
|
+
expect(content.getAttribute("aria-label")).toBe("Loading");
|
|
14
|
+
expect(screen.getByTestId("loading-state-spinner")).toBeTruthy();
|
|
15
|
+
expect(screen.queryByTestId("loading-state-label")).toBeNull();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("shows a label under the spinner and announces it", () => {
|
|
19
|
+
render(<NativeLoadingState label="Signing you in" testID="boot" />);
|
|
20
|
+
expect(screen.getByTestId("boot-label").textContent).toBe("Signing you in");
|
|
21
|
+
expect(screen.getByTestId("boot-content").getAttribute("aria-label")).toBe("Signing you in");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("inline: no safe-area wrapper, the block is the root and takes the accessibility label", () => {
|
|
25
|
+
render(<NativeLoadingState fullScreen={false} size="small" accessibilityLabel="Loading more" testID="more" />);
|
|
26
|
+
const root = screen.getByTestId("more");
|
|
27
|
+
expect(root.getAttribute("data-edges")).toBeNull();
|
|
28
|
+
expect(root.getAttribute("role")).toBe("progressbar");
|
|
29
|
+
expect(root.getAttribute("aria-label")).toBe("Loading more");
|
|
30
|
+
expect(screen.queryByTestId("more-content")).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("colors the spinner with the theme tint unless told otherwise", () => {
|
|
34
|
+
const { unmount } = render(<NativeLoadingState testID="a" />);
|
|
35
|
+
const tinted = screen.getByTestId("a-spinner").getAttribute("color");
|
|
36
|
+
expect(tinted).toBeTruthy();
|
|
37
|
+
unmount();
|
|
38
|
+
render(<NativeLoadingState testID="b" color="#ff0000" />);
|
|
39
|
+
expect(screen.getByTestId("b-spinner").getAttribute("color")).toBe("#ff0000");
|
|
40
|
+
});
|
|
41
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -138,6 +138,9 @@ export type { NativeSeparatorProps } from "./separator";
|
|
|
138
138
|
export { NativeSkeleton } from "./skeleton";
|
|
139
139
|
export type { NativeSkeletonProps } from "./skeleton";
|
|
140
140
|
|
|
141
|
+
export { NativeLoadingState } from "./loading-state";
|
|
142
|
+
export type { NativeLoadingStateProps, NativeLoadingStateEdge } from "./loading-state";
|
|
143
|
+
|
|
141
144
|
export {
|
|
142
145
|
NativeAlert,
|
|
143
146
|
NativeAlertTitle,
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoadingState — a centred spinner for a screen (or part of one) that is
|
|
3
|
+
* waiting: a redirect while the session loads, the first fetch of a page.
|
|
4
|
+
*
|
|
5
|
+
* Use it instead of a hand-rolled `<View><ActivityIndicator /></View>`: the
|
|
6
|
+
* spinner takes the theme tint, screen readers hear one "Loading" progress
|
|
7
|
+
* bar (or your `label`), and the full-screen form sits inside the safe area
|
|
8
|
+
* on the screen background. For content-shaped placeholders (a list about to
|
|
9
|
+
* appear) use `NativeSkeleton`; for known progress use `NativeProgress`.
|
|
10
|
+
*
|
|
11
|
+
* if (!session) return <NativeLoadingState />; // whole screen
|
|
12
|
+
* <NativeLoadingState fullScreen={false} label="Loading more" size="small" />
|
|
13
|
+
*
|
|
14
|
+
* `ScreenContainer loading` renders the inline form in place of its body.
|
|
15
|
+
*
|
|
16
|
+
* @stability Beta
|
|
17
|
+
*/
|
|
18
|
+
import { ActivityIndicator, View, type ColorValue } from "react-native";
|
|
19
|
+
import { SafeAreaView } from "react-native-safe-area-context";
|
|
20
|
+
import { cn } from "../utils";
|
|
21
|
+
import { useThemeRoles } from "../hooks/use-theme-roles";
|
|
22
|
+
import { NativeText } from "./text";
|
|
23
|
+
|
|
24
|
+
export type NativeLoadingStateEdge = "top" | "bottom" | "left" | "right";
|
|
25
|
+
|
|
26
|
+
export interface NativeLoadingStateProps {
|
|
27
|
+
/** Text shown under the spinner. It is also what screen readers announce. */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** What screen readers announce when no `label` is shown. Default `"Loading"`. */
|
|
30
|
+
accessibilityLabel?: string;
|
|
31
|
+
/** Spinner size. Default `"large"`. */
|
|
32
|
+
size?: "small" | "large";
|
|
33
|
+
/**
|
|
34
|
+
* `true` (default): fill the screen on the theme background, inside the
|
|
35
|
+
* safe area. `false`: a padded, centred block that fills its parent, for a
|
|
36
|
+
* screen body, a section or a list footer.
|
|
37
|
+
*/
|
|
38
|
+
fullScreen?: boolean;
|
|
39
|
+
/** Safe-area edges when `fullScreen`. Default all four. */
|
|
40
|
+
safeAreaEdges?: NativeLoadingStateEdge[];
|
|
41
|
+
/** Spinner color. Defaults to the theme tint. */
|
|
42
|
+
color?: ColorValue;
|
|
43
|
+
className?: string;
|
|
44
|
+
/** testID on the root; the spinner is `${testID}-spinner`, the label `${testID}-label`. Default `"loading-state"`. */
|
|
45
|
+
testID?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const ALL_EDGES: NativeLoadingStateEdge[] = ["top", "bottom", "left", "right"];
|
|
49
|
+
|
|
50
|
+
export function NativeLoadingState({
|
|
51
|
+
label,
|
|
52
|
+
accessibilityLabel,
|
|
53
|
+
size = "large",
|
|
54
|
+
fullScreen = true,
|
|
55
|
+
safeAreaEdges = ALL_EDGES,
|
|
56
|
+
color,
|
|
57
|
+
className,
|
|
58
|
+
testID = "loading-state",
|
|
59
|
+
}: NativeLoadingStateProps) {
|
|
60
|
+
const roles = useThemeRoles();
|
|
61
|
+
const spoken = label ?? accessibilityLabel ?? "Loading";
|
|
62
|
+
|
|
63
|
+
const content = (
|
|
64
|
+
<View
|
|
65
|
+
testID={fullScreen ? `${testID}-content` : testID}
|
|
66
|
+
className={cn("items-center justify-center gap-3 px-4 py-8", !fullScreen && "flex-grow", !fullScreen && className)}
|
|
67
|
+
accessible
|
|
68
|
+
accessibilityRole="progressbar"
|
|
69
|
+
accessibilityLabel={spoken}
|
|
70
|
+
accessibilityState={{ busy: true }}
|
|
71
|
+
>
|
|
72
|
+
<ActivityIndicator testID={`${testID}-spinner`} size={size} color={(color ?? roles.tint) as string} />
|
|
73
|
+
{label ? (
|
|
74
|
+
<NativeText testID={`${testID}-label`} preset="body-sm" className="text-muted-foreground text-center">
|
|
75
|
+
{label}
|
|
76
|
+
</NativeText>
|
|
77
|
+
) : null}
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (!fullScreen) return content;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<SafeAreaView
|
|
85
|
+
testID={testID}
|
|
86
|
+
edges={safeAreaEdges}
|
|
87
|
+
className={cn("flex-1 items-center justify-center bg-background", className)}
|
|
88
|
+
>
|
|
89
|
+
{content}
|
|
90
|
+
</SafeAreaView>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -46,7 +46,8 @@ describe("InboxPage", () => {
|
|
|
46
46
|
it("shows a spinner while the first page loads, and an error (with Try again) when the read failed", () => {
|
|
47
47
|
const onRefresh = vi.fn();
|
|
48
48
|
const { unmount } = render(<InboxPage testID="inbox" items={[]} loading emptyTitle="No reports" />);
|
|
49
|
-
expect(screen.getByTestId("inbox-loading")).
|
|
49
|
+
expect(screen.getByTestId("inbox-loading").getAttribute("role")).toBe("progressbar");
|
|
50
|
+
expect(screen.getByTestId("inbox-loading").getAttribute("aria-label")).toBe("Loading");
|
|
50
51
|
expect(screen.queryByTestId("inbox-empty")).toBeNull();
|
|
51
52
|
unmount();
|
|
52
53
|
render(<InboxPage testID="inbox" items={[]} error errorTitle="Couldn't load" onRefresh={onRefresh} />);
|
|
@@ -78,3 +78,30 @@ describe("composeHeaderOptions", () => {
|
|
|
78
78
|
expect(opts.headerRight).toBe(right);
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
describe("ScreenContainer loading", () => {
|
|
83
|
+
it("replaces the body with a centred loading state inside the same safe area", () => {
|
|
84
|
+
render(
|
|
85
|
+
<ScreenContainer testID="screen" loading loadingLabel="Opening your space" scroll>
|
|
86
|
+
<span data-testid="child">Hello</span>
|
|
87
|
+
</ScreenContainer>,
|
|
88
|
+
);
|
|
89
|
+
expect(screen.queryByTestId("child")).toBeNull();
|
|
90
|
+
expect(screen.queryByTestId("screen-scroll")).toBeNull();
|
|
91
|
+
expect(screen.getByTestId("screen-body")).toBeTruthy();
|
|
92
|
+
const loading = screen.getByTestId("screen-loading");
|
|
93
|
+
expect(loading.getAttribute("role")).toBe("progressbar");
|
|
94
|
+
expect(loading.getAttribute("aria-label")).toBe("Opening your space");
|
|
95
|
+
expect(screen.getByTestId("screen").getAttribute("data-edges")).toBe("left,right");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("renders the children once loading ends", () => {
|
|
99
|
+
render(
|
|
100
|
+
<ScreenContainer testID="screen" loading={false}>
|
|
101
|
+
<span data-testid="child">Hello</span>
|
|
102
|
+
</ScreenContainer>,
|
|
103
|
+
);
|
|
104
|
+
expect(screen.getByTestId("child")).toBeTruthy();
|
|
105
|
+
expect(screen.queryByTestId("screen-loading")).toBeNull();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
*/
|
|
32
32
|
import { Fragment, useState, type ReactNode } from "react";
|
|
33
33
|
import { renderSlot, type SlotPropsFor, type Slots } from "@marktiderman/genesis-core/slots";
|
|
34
|
-
import {
|
|
34
|
+
import { Alert, FlatList, Platform, Pressable, ScrollView, StyleSheet, View } from "react-native";
|
|
35
35
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
36
36
|
import { useThemeRoles } from "../hooks/use-theme-roles";
|
|
37
37
|
import { NativeEmptyState } from "../components/empty-state";
|
|
@@ -39,6 +39,7 @@ import { NativeText } from "../components/text";
|
|
|
39
39
|
import { NativeButton } from "../components/button";
|
|
40
40
|
import { NativeBadge } from "../components/badge";
|
|
41
41
|
import { NativeRefreshControl } from "../components/refresh-control";
|
|
42
|
+
import { NativeLoadingState } from "../components/loading-state";
|
|
42
43
|
import { composeHeaderOptions, type ScreenHeaderProps } from "./screen-container";
|
|
43
44
|
|
|
44
45
|
/** An action on a row: swipe, long press, or an accessibility action. */
|
|
@@ -220,9 +221,7 @@ export function InboxPage({
|
|
|
220
221
|
>
|
|
221
222
|
{headerNode}
|
|
222
223
|
{loading ? (
|
|
223
|
-
<
|
|
224
|
-
<ActivityIndicator accessibilityLabel="Loading" />
|
|
225
|
-
</View>
|
|
224
|
+
<NativeLoadingState fullScreen={false} testID={`${testID}-loading`} />
|
|
226
225
|
) : (
|
|
227
226
|
renderSlot(
|
|
228
227
|
DefaultEmpty,
|
|
@@ -430,9 +429,7 @@ function UnreadDot({ unread, testID, color }: { unread: boolean; testID: string;
|
|
|
430
429
|
function DefaultFooter({ loadingMore, testID }: InboxPageSlotMap["footer"]) {
|
|
431
430
|
if (!loadingMore) return null;
|
|
432
431
|
return (
|
|
433
|
-
<
|
|
434
|
-
<ActivityIndicator accessibilityLabel="Loading more" />
|
|
435
|
-
</View>
|
|
432
|
+
<NativeLoadingState fullScreen={false} size="small" accessibilityLabel="Loading more" className="py-4" testID={testID} />
|
|
436
433
|
);
|
|
437
434
|
}
|
|
438
435
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* - StatusBar style (light / dark / auto)
|
|
7
7
|
* - Scroll vs static body
|
|
8
8
|
* - Tokens-aware background (`bg-background`)
|
|
9
|
+
* - A loading state (`loading`): a centred `NativeLoadingState` in place of the body
|
|
9
10
|
*
|
|
10
11
|
* Header customization is delegated: pass `headerLeft`, `headerRight`,
|
|
11
12
|
* `large`, `scrollEdgeBehavior`, `safeAreaEdges`, plus any direct
|
|
@@ -31,6 +32,7 @@ import { ScrollView, StatusBar, View, type ViewStyle } from "react-native";
|
|
|
31
32
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
32
33
|
import { cn } from "../utils";
|
|
33
34
|
import { useThemeMode } from "../hooks/use-theme-mode";
|
|
35
|
+
import { NativeLoadingState } from "../components/loading-state";
|
|
34
36
|
|
|
35
37
|
export type SafeAreaEdge = "top" | "bottom" | "left" | "right";
|
|
36
38
|
|
|
@@ -64,6 +66,15 @@ export interface ScreenContainerProps {
|
|
|
64
66
|
* Only used when `scroll` is true.
|
|
65
67
|
*/
|
|
66
68
|
keyboardShouldPersistTaps?: "always" | "never" | "handled";
|
|
69
|
+
/**
|
|
70
|
+
* When `true`, a centred `NativeLoadingState` (theme-tinted spinner,
|
|
71
|
+
* announced as loading) replaces the body, inside the same safe area and
|
|
72
|
+
* background. Use it for redirect and first-load screens: the body is
|
|
73
|
+
* unmounted while it's on, so a form underneath loses its state. Default `false`.
|
|
74
|
+
*/
|
|
75
|
+
loading?: boolean;
|
|
76
|
+
/** Text under the spinner while `loading`, and what screen readers announce: pass translated text. */
|
|
77
|
+
loadingLabel?: string;
|
|
67
78
|
/** Style on the root, e.g. a theme-role background color. */
|
|
68
79
|
style?: ViewStyle;
|
|
69
80
|
/** testID on the root container. */
|
|
@@ -170,6 +181,8 @@ export function ScreenContainer({
|
|
|
170
181
|
className,
|
|
171
182
|
contentClassName,
|
|
172
183
|
keyboardShouldPersistTaps = "handled",
|
|
184
|
+
loading = false,
|
|
185
|
+
loadingLabel,
|
|
173
186
|
style,
|
|
174
187
|
testID,
|
|
175
188
|
}: ScreenContainerProps) {
|
|
@@ -177,7 +190,11 @@ export function ScreenContainer({
|
|
|
177
190
|
const resolvedMode = themeMode === "system" ? osMode : themeMode;
|
|
178
191
|
const barStyle = resolveBarStyle(statusBar, resolvedMode);
|
|
179
192
|
|
|
180
|
-
const body =
|
|
193
|
+
const body = loading ? (
|
|
194
|
+
<View testID={testID ? `${testID}-body` : undefined} className={cn("flex-1", contentClassName)}>
|
|
195
|
+
<NativeLoadingState fullScreen={false} label={loadingLabel} testID={`${testID ?? "screen-container"}-loading`} />
|
|
196
|
+
</View>
|
|
197
|
+
) : scroll ? (
|
|
181
198
|
<ScrollView
|
|
182
199
|
testID={testID ? `${testID}-scroll` : undefined}
|
|
183
200
|
keyboardShouldPersistTaps={keyboardShouldPersistTaps}
|