@marktiderman/genesis-ui-native 2.6.0 → 2.7.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/dist/{chunk-KZEIF4YI.js → chunk-7HWS2JGX.js} +3 -3
- package/dist/{chunk-KZEIF4YI.js.map → chunk-7HWS2JGX.js.map} +1 -1
- package/dist/{chunk-3S5XVER4.js → chunk-C6Q5ZAVT.js} +4 -3
- package/dist/chunk-C6Q5ZAVT.js.map +1 -0
- package/dist/{chunk-VMSIKSU2.js → chunk-ON7WP4T6.js} +4 -4
- package/dist/{chunk-VMSIKSU2.js.map → chunk-ON7WP4T6.js.map} +1 -1
- package/dist/{chunk-56QLEHHV.js → chunk-PO3MK6IY.js} +3 -3
- package/dist/{chunk-56QLEHHV.js.map → chunk-PO3MK6IY.js.map} +1 -1
- package/dist/{chunk-6JBNSW4D.js → chunk-SXCG2REG.js} +3 -3
- package/dist/{chunk-6JBNSW4D.js.map → chunk-SXCG2REG.js.map} +1 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/components/index.js +3 -3
- package/dist/data/index.d.ts +122 -22
- package/dist/data/index.js +440 -25
- package/dist/data/index.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/layouts/index.js +3 -3
- package/package.json +2 -2
- package/src/components/__tests__/button-a11y.test.tsx +17 -0
- package/src/components/button.tsx +8 -2
- package/src/data/resource-view/NativeResourceView.tsx +11 -3
- package/src/data/resource-view/NativeResourceWorkspace.tsx +657 -0
- package/src/data/resource-view/__tests__/native-resource-view.test.tsx +108 -1
- package/src/data/resource-view/__tests__/native-resource-workspace.test.tsx +356 -0
- package/src/data/resource-view/display.tsx +6 -3
- package/src/data/resource-view/index.ts +11 -0
- package/src/data/resource-view/mapping.ts +12 -5
- package/src/data/resource-view/use-native-resource-view.ts +7 -5
- package/dist/chunk-3S5XVER4.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeChip, NativeChipGroup, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-
|
|
2
|
-
export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeBanner, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeImage, NativeInlineAlert, NativeLabel, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants } from './chunk-
|
|
1
|
+
export { Box, FULL_SCREEN_DARK, Grid, Inline, NativeAccordion, NativeAccordionContent, NativeAccordionItem, NativeAccordionTrigger, NativeChip, NativeChipGroup, NativeCombobox, NativeDialog, NativeDialogContent, NativeDialogDescription, NativeDialogFooter, NativeDialogHeader, NativeDialogTitle, NativeDrawer, NativeDropdownMenu, NativeDropdownMenuContent, NativeDropdownMenuItem, NativeDropdownMenuTrigger, NativeFullScreenModal, NativeGlassSurface, NativeHeaderCard, NativeNumberInput, NativePagination, NativePopover, NativePopoverContent, NativePopoverTrigger, NativeProgress, NativeRadioGroup, NativeRadioGroupItem, NativeRangeSlider, NativeSlider, NativeStepper, NativeTabs, NativeTabsContent, NativeTabsList, NativeTabsTrigger, NativeToastProvider, NativeToggle, NativeTooltip, NativeTooltipContent, NativeTooltipTrigger, Stack, spaceScale, spacingClass, toggleVariants, useLiquidGlass, useReduceTransparency, useToast } from './chunk-7HWS2JGX.js';
|
|
2
|
+
export { NativeAlert, NativeAlertDescription, NativeAlertTitle, NativeAvatar, NativeBanner, NativeCard, NativeCardContent, NativeCardDescription, NativeCardFooter, NativeCardHeader, NativeCardTitle, NativeCheckbox, NativeDatePicker, NativeImage, NativeInlineAlert, NativeLabel, NativeSearchBar, NativeSegmentedControl, NativeSelect, NativeSelectContent, NativeSelectItem, NativeSelectTrigger, NativeSeparator, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwitch, NativeTextarea, NativeTimePicker, alertVariants } from './chunk-PO3MK6IY.js';
|
|
3
3
|
export { BrandExtensionsProvider, useGenesisExtension } from './chunk-D5RKSPMH.js';
|
|
4
4
|
export { useReducedMotion } from './chunk-7PCWEY6R.js';
|
|
5
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './chunk-
|
|
6
|
-
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from './chunk-
|
|
7
|
-
export { GenesisModulesProvider, NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from './chunk-
|
|
5
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from './chunk-ON7WP4T6.js';
|
|
6
|
+
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from './chunk-SXCG2REG.js';
|
|
7
|
+
export { GenesisModulesProvider, NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants, useGenesisModules } from './chunk-C6Q5ZAVT.js';
|
|
8
8
|
export { useThemeMode, useThemeRoles } from './chunk-Z3AQYVUA.js';
|
|
9
9
|
export { cn } from './chunk-OHZD7KRO.js';
|
|
10
10
|
import './chunk-DGUM43GV.js';
|
package/dist/layouts/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from '../chunk-
|
|
2
|
-
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, readReceiptFor, useKeyboardScroll, useKeyboardToolbar } from '../chunk-ON7WP4T6.js';
|
|
2
|
+
export { InboxPage, NavBarSaveButton, NavBarSearchBar, NavBarTitle, ScreenContainer, composeHeaderOptions, formatInboxTime, getInboxPageStackOptions, showInboxActions } from '../chunk-SXCG2REG.js';
|
|
3
|
+
import '../chunk-C6Q5ZAVT.js';
|
|
4
4
|
import '../chunk-Z3AQYVUA.js';
|
|
5
5
|
import '../chunk-OHZD7KRO.js';
|
|
6
6
|
import '../chunk-DGUM43GV.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktiderman/genesis-ui-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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.14.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,17 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { NativeButton } from "../button";
|
|
4
|
+
|
|
5
|
+
describe("NativeButton accessibility", () => {
|
|
6
|
+
it("takes a label and a state, keeping its own disabled", () => {
|
|
7
|
+
render(
|
|
8
|
+
<NativeButton testID="b" accessibilityLabel="Remove your vote for Dark mode" accessibilityState={{ selected: true }} disabled>
|
|
9
|
+
Voted
|
|
10
|
+
</NativeButton>,
|
|
11
|
+
);
|
|
12
|
+
const button = screen.getByTestId("b");
|
|
13
|
+
expect(button.getAttribute("aria-label")).toBe("Remove your vote for Dark mode");
|
|
14
|
+
expect(button.getAttribute("aria-selected")).toBe("true");
|
|
15
|
+
expect(button.getAttribute("aria-disabled")).toBe("true");
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @stability Stable
|
|
5
5
|
*/
|
|
6
6
|
import { type VariantProps, cva } from "class-variance-authority";
|
|
7
|
-
import { ActivityIndicator, Pressable, Text } from "react-native";
|
|
7
|
+
import { ActivityIndicator, Pressable, Text, type AccessibilityState } from "react-native";
|
|
8
8
|
import { cn } from "../utils";
|
|
9
9
|
|
|
10
10
|
const buttonVariants = cva(
|
|
@@ -61,6 +61,11 @@ export interface NativeButtonProps
|
|
|
61
61
|
disabled?: boolean;
|
|
62
62
|
loading?: boolean;
|
|
63
63
|
testID?: string;
|
|
64
|
+
/** What a screen reader says, when the text alone isn't enough ("Vote for Dark mode"). Default: the text. */
|
|
65
|
+
accessibilityLabel?: string;
|
|
66
|
+
accessibilityHint?: string;
|
|
67
|
+
/** Merged with the button's own `disabled` and `busy`: `{ selected: true }` for a vote cast, a filter on. */
|
|
68
|
+
accessibilityState?: AccessibilityState;
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
function NativeButton({
|
|
@@ -72,6 +77,7 @@ function NativeButton({
|
|
|
72
77
|
onPress,
|
|
73
78
|
disabled,
|
|
74
79
|
loading,
|
|
80
|
+
accessibilityState,
|
|
75
81
|
...props
|
|
76
82
|
}: NativeButtonProps) {
|
|
77
83
|
const isDisabled = disabled || loading;
|
|
@@ -86,7 +92,7 @@ function NativeButton({
|
|
|
86
92
|
onPress={onPress}
|
|
87
93
|
disabled={isDisabled}
|
|
88
94
|
accessibilityRole="button"
|
|
89
|
-
accessibilityState={{ disabled: isDisabled, busy: loading }}
|
|
95
|
+
accessibilityState={{ ...accessibilityState, disabled: isDisabled, busy: loading }}
|
|
90
96
|
{...props}
|
|
91
97
|
>
|
|
92
98
|
{loading ? (
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { memo, useCallback, useMemo, useRef, useState, type ComponentType, type ReactNode } from "react";
|
|
17
17
|
import { Alert, Platform, Pressable, SectionList, View } from "react-native";
|
|
18
18
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
19
|
-
import type
|
|
19
|
+
import { encodeRecordKey, type BaseRecord, type DataRow } from "@marktiderman/genesis-core";
|
|
20
20
|
import { isTimeZone, personTimeZone } from "@marktiderman/genesis-core/dates";
|
|
21
21
|
import { useOne, useOptionalViewerScope } from "@marktiderman/genesis-core/hooks";
|
|
22
22
|
import type { RowPicture } from "@marktiderman/genesis-core/resource-view";
|
|
@@ -91,7 +91,14 @@ const IOS_GROUP_MARGIN = 16;
|
|
|
91
91
|
const GROUP_RADIUS = Number.parseFloat(String(Platform.Version)) >= 26 ? 26 : 10;
|
|
92
92
|
const IOS = Platform.OS === "ios";
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
// Rows are keyed by the view's key fields (`keyFields`), so composite keys never collide.
|
|
95
|
+
const recordKey = (view: AnyResourceView<Row>, row: Row) => {
|
|
96
|
+
try {
|
|
97
|
+
return String(encodeRecordKey(view.contract, row as DataRow));
|
|
98
|
+
} catch {
|
|
99
|
+
return String((row as DataRow).id);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
95
102
|
|
|
96
103
|
/**
|
|
97
104
|
* A native list screen from a view:
|
|
@@ -255,6 +262,7 @@ function Screen<T extends Row = Row>(props: NativeResourceViewProps<T>) {
|
|
|
255
262
|
} = props;
|
|
256
263
|
void _zone;
|
|
257
264
|
const state = useNativeResourceView<T>(view, options);
|
|
265
|
+
const keyExtractor = useCallback((row: T) => recordKey(view as AnyResourceView<Row>, row), [view]);
|
|
258
266
|
const messages = useNativeResourceViewMessages();
|
|
259
267
|
const colors = useThemeRoles();
|
|
260
268
|
const cell = useDisplayCell();
|
|
@@ -514,7 +522,7 @@ function Screen<T extends Row = Row>(props: NativeResourceViewProps<T>) {
|
|
|
514
522
|
fields={sheet?.mode === "edit" ? editFields : createFields}
|
|
515
523
|
initial={sheet?.mode === "edit" ? ((editRow.data as Row | undefined) ?? (editRow.isError ? sheet.row : undefined)) : undefined}
|
|
516
524
|
loading={editLoading}
|
|
517
|
-
recordKey={sheet?.row ?
|
|
525
|
+
recordKey={sheet?.row ? recordKey(view as AnyResourceView<Row>, sheet.row) : "new"}
|
|
518
526
|
onCancel={() => setSheet(null)}
|
|
519
527
|
onSave={async (values, dirty) => {
|
|
520
528
|
const result = await state.save(sheet?.mode ?? "create", values, sheet?.row, dirty);
|