@terreno/ui 57.18.0 → 57.20.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/.ai/guidelines/core.md +1 -1
- package/CHANGELOG.md +2074 -0
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +3 -3
- package/dist/Accordion.js.map +1 -1
- package/dist/AreaChart.d.ts.map +1 -1
- package/dist/AreaChart.js +2 -2
- package/dist/AreaChart.js.map +1 -1
- package/dist/Avatar.d.ts.map +1 -1
- package/dist/Avatar.js +3 -1
- package/dist/Avatar.js.map +1 -1
- package/dist/BarChart.d.ts.map +1 -1
- package/dist/BarChart.js +2 -2
- package/dist/BarChart.js.map +1 -1
- package/dist/Box.d.ts.map +1 -1
- package/dist/Box.js +66 -8
- package/dist/Box.js.map +1 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/Card.js +5 -4
- package/dist/Card.js.map +1 -1
- package/dist/ChartCard.d.ts.map +1 -1
- package/dist/ChartCard.js +4 -2
- package/dist/ChartCard.js.map +1 -1
- package/dist/Common.d.ts +240 -14
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.d.ts +1 -1
- package/dist/ConsentFormScreen.d.ts.map +1 -1
- package/dist/ConsentFormScreen.js +13 -4
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/DateTimeField.d.ts.map +1 -1
- package/dist/DateTimeField.js +5 -3
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DonutChart.d.ts.map +1 -1
- package/dist/DonutChart.js +2 -2
- package/dist/DonutChart.js.map +1 -1
- package/dist/Field.d.ts.map +1 -1
- package/dist/Field.js +2 -0
- package/dist/Field.js.map +1 -1
- package/dist/FormContainer.d.ts +68 -0
- package/dist/FormContainer.d.ts.map +1 -0
- package/dist/FormContainer.js +79 -0
- package/dist/FormContainer.js.map +1 -0
- package/dist/GPTChat.d.ts.map +1 -1
- package/dist/GPTChat.js +2 -1
- package/dist/GPTChat.js.map +1 -1
- package/dist/Heading.d.ts +1 -1
- package/dist/Heading.d.ts.map +1 -1
- package/dist/Heading.js +5 -2
- package/dist/Heading.js.map +1 -1
- package/dist/Icon.d.ts +4 -0
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +43 -2
- package/dist/Icon.js.map +1 -1
- package/dist/LabeledCheckBox.d.ts +22 -0
- package/dist/LabeledCheckBox.d.ts.map +1 -0
- package/dist/LabeledCheckBox.js +30 -0
- package/dist/LabeledCheckBox.js.map +1 -0
- package/dist/LineChart.d.ts.map +1 -1
- package/dist/LineChart.js +2 -2
- package/dist/LineChart.js.map +1 -1
- package/dist/ListDetailLayout.d.ts +36 -0
- package/dist/ListDetailLayout.d.ts.map +1 -0
- package/dist/ListDetailLayout.js +153 -0
- package/dist/ListDetailLayout.js.map +1 -0
- package/dist/MarkdownEditor.d.ts.map +1 -1
- package/dist/MarkdownEditor.js +2 -1
- package/dist/MarkdownEditor.js.map +1 -1
- package/dist/MediaQuery.d.ts +1 -1
- package/dist/MediaQuery.d.ts.map +1 -1
- package/dist/MediaQuery.js +1 -1
- package/dist/MediaQuery.js.map +1 -1
- package/dist/OtpField.d.ts +60 -0
- package/dist/OtpField.d.ts.map +1 -0
- package/dist/OtpField.js +154 -0
- package/dist/OtpField.js.map +1 -0
- package/dist/Page.d.ts +1 -0
- package/dist/Page.d.ts.map +1 -1
- package/dist/Page.js +10 -1
- package/dist/Page.js.map +1 -1
- package/dist/ProvisionalConsentSigner.d.ts +21 -0
- package/dist/ProvisionalConsentSigner.d.ts.map +1 -0
- package/dist/ProvisionalConsentSigner.js +199 -0
- package/dist/ProvisionalConsentSigner.js.map +1 -0
- package/dist/ResponsiveBreakpoint.d.ts +5 -0
- package/dist/ResponsiveBreakpoint.d.ts.map +1 -1
- package/dist/ResponsiveBreakpoint.js +7 -0
- package/dist/ResponsiveBreakpoint.js.map +1 -1
- package/dist/Scorecard.d.ts.map +1 -1
- package/dist/Scorecard.js +5 -2
- package/dist/Scorecard.js.map +1 -1
- package/dist/Skeleton.d.ts +39 -0
- package/dist/Skeleton.d.ts.map +1 -0
- package/dist/Skeleton.js +195 -0
- package/dist/Skeleton.js.map +1 -0
- package/dist/SocialLoginButton.d.ts +10 -0
- package/dist/SocialLoginButton.d.ts.map +1 -1
- package/dist/SocialLoginButton.js +26 -8
- package/dist/SocialLoginButton.js.map +1 -1
- package/dist/SplitPage.d.ts +12 -1
- package/dist/SplitPage.d.ts.map +1 -1
- package/dist/SplitPage.js +14 -7
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts +1 -1
- package/dist/SplitPage.native.d.ts.map +1 -1
- package/dist/SplitPage.native.js +6 -3
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/SplitPageLoading.d.ts +14 -0
- package/dist/SplitPageLoading.d.ts.map +1 -0
- package/dist/SplitPageLoading.js +19 -0
- package/dist/SplitPageLoading.js.map +1 -0
- package/dist/SyncStatusBanner.d.ts +7 -1
- package/dist/SyncStatusBanner.d.ts.map +1 -1
- package/dist/SyncStatusBanner.js +20 -4
- package/dist/SyncStatusBanner.js.map +1 -1
- package/dist/Text.d.ts +3 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +2 -0
- package/dist/Text.js.map +1 -1
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +44 -10
- package/dist/TextField.js.map +1 -1
- package/dist/charts/ChartFrame.d.ts +2 -2
- package/dist/charts/ChartFrame.d.ts.map +1 -1
- package/dist/charts/ChartFrame.js +9 -2
- package/dist/charts/ChartFrame.js.map +1 -1
- package/dist/fieldElements/FieldError.d.ts.map +1 -1
- package/dist/fieldElements/FieldError.js +1 -1
- package/dist/fieldElements/FieldError.js.map +1 -1
- package/dist/index.d.ts +21 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/lazyBoundaries/heavyOptionalExports.d.ts +3 -0
- package/dist/lazyBoundaries/heavyOptionalExports.d.ts.map +1 -1
- package/dist/lazyBoundaries/heavyOptionalExports.js +2 -0
- package/dist/lazyBoundaries/heavyOptionalExports.js.map +1 -1
- package/dist/login/LastUsedBadge.d.ts +14 -0
- package/dist/login/LastUsedBadge.d.ts.map +1 -0
- package/dist/login/LastUsedBadge.js +23 -0
- package/dist/login/LastUsedBadge.js.map +1 -0
- package/dist/login/LoginAccountCard.d.ts +38 -0
- package/dist/login/LoginAccountCard.d.ts.map +1 -0
- package/dist/login/LoginAccountCard.js +72 -0
- package/dist/login/LoginAccountCard.js.map +1 -0
- package/dist/login/LoginAccountList.d.ts +33 -0
- package/dist/login/LoginAccountList.d.ts.map +1 -0
- package/dist/login/LoginAccountList.js +30 -0
- package/dist/login/LoginAccountList.js.map +1 -0
- package/dist/login/LoginScreen.d.ts +4 -4
- package/dist/login/LoginScreen.d.ts.map +1 -1
- package/dist/login/LoginScreen.js +294 -13
- package/dist/login/LoginScreen.js.map +1 -1
- package/dist/login/OutlinePill.d.ts +28 -0
- package/dist/login/OutlinePill.d.ts.map +1 -0
- package/dist/login/OutlinePill.js +48 -0
- package/dist/login/OutlinePill.js.map +1 -0
- package/dist/login/TwoFactorChallengeScreen.d.ts +26 -0
- package/dist/login/TwoFactorChallengeScreen.d.ts.map +1 -0
- package/dist/login/TwoFactorChallengeScreen.js +139 -0
- package/dist/login/TwoFactorChallengeScreen.js.map +1 -0
- package/dist/login/loginMethods.d.ts +27 -0
- package/dist/login/loginMethods.d.ts.map +1 -0
- package/dist/login/loginMethods.js +37 -0
- package/dist/login/loginMethods.js.map +1 -0
- package/dist/login/loginTypes.d.ts +202 -5
- package/dist/login/loginTypes.d.ts.map +1 -1
- package/dist/pdfHtmlTemplate.d.ts +17 -0
- package/dist/pdfHtmlTemplate.d.ts.map +1 -1
- package/dist/pdfHtmlTemplate.js +78 -0
- package/dist/pdfHtmlTemplate.js.map +1 -1
- package/dist/security/AccountSecurityScreen.d.ts +10 -0
- package/dist/security/AccountSecurityScreen.d.ts.map +1 -0
- package/dist/security/AccountSecurityScreen.js +50 -0
- package/dist/security/AccountSecurityScreen.js.map +1 -0
- package/dist/security/LinkedAccountsCard.d.ts +32 -0
- package/dist/security/LinkedAccountsCard.d.ts.map +1 -0
- package/dist/security/LinkedAccountsCard.js +145 -0
- package/dist/security/LinkedAccountsCard.js.map +1 -0
- package/dist/security/PasskeysCard.d.ts +39 -0
- package/dist/security/PasskeysCard.d.ts.map +1 -0
- package/dist/security/PasskeysCard.js +168 -0
- package/dist/security/PasskeysCard.js.map +1 -0
- package/dist/security/PasswordCard.d.ts +32 -0
- package/dist/security/PasswordCard.d.ts.map +1 -0
- package/dist/security/PasswordCard.js +198 -0
- package/dist/security/PasswordCard.js.map +1 -0
- package/dist/security/SessionsCard.d.ts +39 -0
- package/dist/security/SessionsCard.d.ts.map +1 -0
- package/dist/security/SessionsCard.js +168 -0
- package/dist/security/SessionsCard.js.map +1 -0
- package/dist/security/TwoFactorSettingsCard.d.ts +55 -0
- package/dist/security/TwoFactorSettingsCard.d.ts.map +1 -0
- package/dist/security/TwoFactorSettingsCard.js +458 -0
- package/dist/security/TwoFactorSettingsCard.js.map +1 -0
- package/dist/security/securityMethods.d.ts +40 -0
- package/dist/security/securityMethods.d.ts.map +1 -0
- package/dist/security/securityMethods.js +66 -0
- package/dist/security/securityMethods.js.map +1 -0
- package/dist/security/securityTypes.d.ts +467 -0
- package/dist/security/securityTypes.d.ts.map +1 -0
- package/dist/security/securityTypes.js +2 -0
- package/dist/security/securityTypes.js.map +1 -0
- package/dist/security/userAgent.d.ts +26 -0
- package/dist/security/userAgent.d.ts.map +1 -0
- package/dist/security/userAgent.js +80 -0
- package/dist/security/userAgent.js.map +1 -0
- package/dist/signUp/OAuthButtons.d.ts +28 -5
- package/dist/signUp/OAuthButtons.d.ts.map +1 -1
- package/dist/signUp/OAuthButtons.js +44 -5
- package/dist/signUp/OAuthButtons.js.map +1 -1
- package/dist/signUp/SignUpScreen.d.ts.map +1 -1
- package/dist/signUp/SignUpScreen.js +50 -5
- package/dist/signUp/SignUpScreen.js.map +1 -1
- package/dist/signUp/signUpTypes.d.ts +21 -1
- package/dist/signUp/signUpTypes.d.ts.map +1 -1
- package/dist/useConsentForms.d.ts +9 -0
- package/dist/useConsentForms.d.ts.map +1 -1
- package/dist/useConsentForms.js +18 -0
- package/dist/useConsentForms.js.map +1 -1
- package/dist/useProvisionalConsent.d.ts +124 -0
- package/dist/useProvisionalConsent.d.ts.map +1 -0
- package/dist/useProvisionalConsent.js +79 -0
- package/dist/useProvisionalConsent.js.map +1 -0
- package/dist/withLoading.d.ts +20 -0
- package/dist/withLoading.d.ts.map +1 -0
- package/dist/withLoading.js +24 -0
- package/dist/withLoading.js.map +1 -0
- package/package.json +4 -2
- package/src/Accordion.test.tsx +5 -0
- package/src/Accordion.tsx +3 -8
- package/src/AreaChart.test.tsx +15 -0
- package/src/AreaChart.tsx +6 -0
- package/src/Avatar.test.tsx +8 -0
- package/src/Avatar.tsx +2 -0
- package/src/BarChart.test.tsx +15 -0
- package/src/BarChart.tsx +6 -0
- package/src/Box.test.tsx +131 -1
- package/src/Box.tsx +77 -8
- package/src/Card.test.tsx +48 -0
- package/src/Card.tsx +13 -2
- package/src/ChartCard.test.tsx +30 -0
- package/src/ChartCard.tsx +18 -1
- package/src/Common.ts +263 -14
- package/src/ConsentFormScreen.test.tsx +84 -0
- package/src/ConsentFormScreen.tsx +28 -4
- package/src/DateTimeField.tsx +5 -3
- package/src/DonutChart.test.tsx +15 -0
- package/src/DonutChart.tsx +6 -0
- package/src/Field.tsx +2 -0
- package/src/FilePickerButton.test.tsx +35 -0
- package/src/FormContainer.test.tsx +242 -0
- package/src/FormContainer.tsx +177 -0
- package/src/GPTChat.test.tsx +16 -0
- package/src/GPTChat.tsx +8 -2
- package/src/Heading.test.tsx +14 -0
- package/src/Heading.tsx +6 -1
- package/src/Icon.test.tsx +52 -1
- package/src/Icon.tsx +92 -3
- package/src/IconButton.test.tsx +85 -0
- package/src/LabeledCheckBox.test.tsx +45 -0
- package/src/LabeledCheckBox.tsx +89 -0
- package/src/LineChart.test.tsx +18 -0
- package/src/LineChart.tsx +6 -0
- package/src/ListDetailLayout.tsx +247 -0
- package/src/MarkdownEditor.tsx +2 -1
- package/src/MediaQuery.ts +1 -0
- package/src/OtpField.test.tsx +280 -0
- package/src/OtpField.tsx +307 -0
- package/src/Page.test.tsx +38 -0
- package/src/Page.tsx +38 -19
- package/src/ProvisionalConsentSigner.test.tsx +625 -0
- package/src/ProvisionalConsentSigner.tsx +423 -0
- package/src/ResponsiveBreakpoint.test.tsx +7 -0
- package/src/ResponsiveBreakpoint.tsx +14 -0
- package/src/RootImportRegression.test.tsx +3 -0
- package/src/Scorecard.test.tsx +11 -0
- package/src/Scorecard.tsx +21 -0
- package/src/Skeleton.test.tsx +262 -0
- package/src/Skeleton.tsx +430 -0
- package/src/SocialLoginButton.test.tsx +14 -0
- package/src/SocialLoginButton.tsx +51 -7
- package/src/SplitPage.native.tsx +16 -3
- package/src/SplitPage.tsx +29 -12
- package/src/SplitPageLoading.test.tsx +51 -0
- package/src/SplitPageLoading.tsx +53 -0
- package/src/SyncStatusBanner.test.tsx +61 -4
- package/src/SyncStatusBanner.tsx +29 -3
- package/src/Text.tsx +4 -1
- package/src/TextField.test.tsx +150 -0
- package/src/TextField.tsx +66 -8
- package/src/__snapshots__/AddressField.test.tsx.snap +12 -0
- package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +15 -0
- package/src/__snapshots__/Avatar.test.tsx.snap +1 -0
- package/src/__snapshots__/CustomSelectField.test.tsx.snap +3 -0
- package/src/__snapshots__/EmailField.test.tsx.snap +6 -0
- package/src/__snapshots__/Field.test.tsx.snap +37 -0
- package/src/__snapshots__/HeightField.test.tsx.snap +2 -0
- package/src/__snapshots__/MobileAddressAutoComplete.test.tsx.snap +3 -0
- package/src/__snapshots__/NumberField.test.tsx.snap +3 -0
- package/src/__snapshots__/Page.test.tsx.snap +28 -5
- package/src/__snapshots__/PhoneNumberField.test.tsx.snap +12 -0
- package/src/__snapshots__/Slider.test.tsx.snap +1 -0
- package/src/__snapshots__/SocialLoginButton.test.tsx.snap +43 -22
- package/src/__snapshots__/SplitPage.test.tsx.snap +16 -0
- package/src/__snapshots__/TapToEdit.test.tsx.snap +3 -0
- package/src/__snapshots__/TextArea.test.tsx.snap +17 -1
- package/src/__snapshots__/TextField.test.tsx.snap +19 -2
- package/src/__snapshots__/TypedSignatureField.test.tsx.snap +3 -0
- package/src/__snapshots__/UnifiedAddressAutoComplete.test.tsx.snap +18 -0
- package/src/__snapshots__/WebAddressAutocomplete.test.tsx.snap +12 -0
- package/src/bunSetup.ts +13 -1
- package/src/charts/ChartFrame.tsx +19 -8
- package/src/fieldElements/FieldError.tsx +1 -0
- package/src/fieldElements/__snapshots__/FieldError.test.tsx.snap +2 -0
- package/src/index.tsx +44 -1
- package/src/isolated/ListDetailLayout.isolated.tsx +634 -0
- package/src/lazyBoundaries/heavyOptionalExports.tsx +7 -0
- package/src/login/LastUsedBadge.tsx +40 -0
- package/src/login/LoginAccountCard.tsx +205 -0
- package/src/login/LoginAccountList.tsx +115 -0
- package/src/login/LoginScreen.test.tsx +837 -1
- package/src/login/LoginScreen.tsx +674 -91
- package/src/login/OutlinePill.tsx +110 -0
- package/src/login/TwoFactorChallengeScreen.test.tsx +376 -0
- package/src/login/TwoFactorChallengeScreen.tsx +307 -0
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +1454 -334
- package/src/login/loginMethods.test.ts +53 -0
- package/src/login/loginMethods.ts +60 -0
- package/src/login/loginTypes.ts +208 -5
- package/src/pdfHtmlTemplate.test.ts +243 -4
- package/src/pdfHtmlTemplate.ts +93 -0
- package/src/security/AccountSecurityScreen.test.tsx +262 -0
- package/src/security/AccountSecurityScreen.tsx +156 -0
- package/src/security/LinkedAccountsCard.test.tsx +371 -0
- package/src/security/LinkedAccountsCard.tsx +297 -0
- package/src/security/PasskeysCard.test.tsx +378 -0
- package/src/security/PasskeysCard.tsx +371 -0
- package/src/security/PasswordCard.test.tsx +445 -0
- package/src/security/PasswordCard.tsx +342 -0
- package/src/security/SessionsCard.test.tsx +349 -0
- package/src/security/SessionsCard.tsx +362 -0
- package/src/security/TwoFactorSettingsCard.test.tsx +700 -0
- package/src/security/TwoFactorSettingsCard.tsx +872 -0
- package/src/security/securityMethods.test.ts +101 -0
- package/src/security/securityMethods.ts +104 -0
- package/src/security/securityTypes.ts +480 -0
- package/src/security/userAgent.test.ts +119 -0
- package/src/security/userAgent.ts +102 -0
- package/src/signUp/OAuthButtons.test.tsx +27 -0
- package/src/signUp/OAuthButtons.tsx +153 -19
- package/src/signUp/SignUpScreen.test.tsx +170 -1
- package/src/signUp/SignUpScreen.tsx +87 -25
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +22 -11
- package/src/signUp/signUpTypes.ts +23 -1
- package/src/useConsentForms.test.ts +37 -1
- package/src/useConsentForms.ts +25 -0
- package/src/useProvisionalConsent.test.ts +256 -0
- package/src/useProvisionalConsent.ts +218 -0
- package/src/withLoading.test.tsx +61 -0
- package/src/withLoading.tsx +50 -0
|
@@ -98,6 +98,20 @@ describe("SocialLoginButton", () => {
|
|
|
98
98
|
expect(button.props.disabled).toBe(true);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
+
it("follows later changes to the loading prop", () => {
|
|
102
|
+
const onPress = createMockOnPress();
|
|
103
|
+
const {getByTestId, rerender} = renderWithTheme(
|
|
104
|
+
<SocialLoginButton onPress={onPress} provider="google" />
|
|
105
|
+
);
|
|
106
|
+
expect(getByTestId("social-login-google").props.disabled).toBeFalsy();
|
|
107
|
+
|
|
108
|
+
rerender(<SocialLoginButton loading onPress={onPress} provider="google" />);
|
|
109
|
+
expect(getByTestId("social-login-google").props.disabled).toBe(true);
|
|
110
|
+
|
|
111
|
+
rerender(<SocialLoginButton loading={false} onPress={onPress} provider="google" />);
|
|
112
|
+
expect(getByTestId("social-login-google").props.disabled).toBeFalsy();
|
|
113
|
+
});
|
|
114
|
+
|
|
101
115
|
it("uses correct testID", () => {
|
|
102
116
|
const onPress = createMockOnPress();
|
|
103
117
|
const {getByTestId} = renderWithTheme(
|
|
@@ -5,6 +5,7 @@ import {ActivityIndicator, Pressable, Text, View} from "react-native";
|
|
|
5
5
|
|
|
6
6
|
import {Box} from "./Box";
|
|
7
7
|
import type {SocialLoginButtonProps} from "./Common";
|
|
8
|
+
import {OutlinePill} from "./login/OutlinePill";
|
|
8
9
|
import {useTheme} from "./Theme";
|
|
9
10
|
import {Unifier} from "./Unifier";
|
|
10
11
|
|
|
@@ -39,14 +40,26 @@ const PROVIDER_ICONS: Record<string, string> = {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
|
-
* Display names for social providers
|
|
43
|
+
* Display names for the branded social providers.
|
|
43
44
|
*/
|
|
44
|
-
const
|
|
45
|
+
export const SOCIAL_PROVIDER_NAMES: Record<string, string> = {
|
|
45
46
|
apple: "Apple",
|
|
46
47
|
github: "GitHub",
|
|
47
48
|
google: "Google",
|
|
48
49
|
};
|
|
49
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The display name of a branded provider id, or undefined for any other id. Ids come from the
|
|
53
|
+
* server and from device storage, so an id such as `__proto__` or `constructor` must not read an
|
|
54
|
+
* `Object.prototype` member.
|
|
55
|
+
*/
|
|
56
|
+
export const getSocialProviderName = (providerId: string): string | undefined => {
|
|
57
|
+
if (!Object.hasOwn(SOCIAL_PROVIDER_NAMES, providerId)) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return SOCIAL_PROVIDER_NAMES[providerId];
|
|
61
|
+
};
|
|
62
|
+
|
|
50
63
|
/**
|
|
51
64
|
* A branded social login button for OAuth authentication.
|
|
52
65
|
*
|
|
@@ -64,6 +77,7 @@ const PROVIDER_NAMES: Record<string, string> = {
|
|
|
64
77
|
* ```
|
|
65
78
|
*/
|
|
66
79
|
export const SocialLoginButton: FC<SocialLoginButtonProps> = ({
|
|
80
|
+
accessibilityLabel,
|
|
67
81
|
provider,
|
|
68
82
|
onPress,
|
|
69
83
|
loading: propsLoading,
|
|
@@ -72,8 +86,13 @@ export const SocialLoginButton: FC<SocialLoginButtonProps> = ({
|
|
|
72
86
|
fullWidth = true,
|
|
73
87
|
text,
|
|
74
88
|
testID,
|
|
89
|
+
lastUsedLabel,
|
|
90
|
+
lastUsedTestID,
|
|
75
91
|
}) => {
|
|
76
|
-
|
|
92
|
+
// Pressing tracks the button's own onPress; the parent's `loading` prop is read on every render
|
|
93
|
+
// so a parent can start or clear the spinner after mount.
|
|
94
|
+
const [isPressing, setIsPressing] = useState(false);
|
|
95
|
+
const loading = isPressing || propsLoading;
|
|
77
96
|
const {theme} = useTheme();
|
|
78
97
|
const resolvedTestID = testID ?? `social-login-${provider}`;
|
|
79
98
|
|
|
@@ -96,7 +115,7 @@ export const SocialLoginButton: FC<SocialLoginButtonProps> = ({
|
|
|
96
115
|
}, [provider, variant, theme]);
|
|
97
116
|
|
|
98
117
|
const iconName = PROVIDER_ICONS[provider];
|
|
99
|
-
const providerName =
|
|
118
|
+
const providerName = SOCIAL_PROVIDER_NAMES[provider];
|
|
100
119
|
const buttonText = text ?? `Continue with ${providerName}`;
|
|
101
120
|
|
|
102
121
|
const handlePress = useMemo(
|
|
@@ -104,14 +123,14 @@ export const SocialLoginButton: FC<SocialLoginButtonProps> = ({
|
|
|
104
123
|
debounce(
|
|
105
124
|
async () => {
|
|
106
125
|
await Unifier.utils.haptic();
|
|
107
|
-
|
|
126
|
+
setIsPressing(true);
|
|
108
127
|
|
|
109
128
|
try {
|
|
110
129
|
await onPress();
|
|
111
130
|
} catch (error) {
|
|
112
131
|
console.error(`Social login error (${provider}):`, error);
|
|
113
132
|
} finally {
|
|
114
|
-
|
|
133
|
+
setIsPressing(false);
|
|
115
134
|
}
|
|
116
135
|
},
|
|
117
136
|
500,
|
|
@@ -126,10 +145,35 @@ export const SocialLoginButton: FC<SocialLoginButtonProps> = ({
|
|
|
126
145
|
|
|
127
146
|
const isDisabled = disabled || loading;
|
|
128
147
|
|
|
148
|
+
if (variant === "outline") {
|
|
149
|
+
return (
|
|
150
|
+
<OutlinePill
|
|
151
|
+
accessibilityLabel={accessibilityLabel ?? buttonText}
|
|
152
|
+
disabled={disabled}
|
|
153
|
+
icon={
|
|
154
|
+
iconName ? (
|
|
155
|
+
<FontAwesome6
|
|
156
|
+
brand
|
|
157
|
+
color={isDisabled ? theme.text.secondaryLight : theme.text.primary}
|
|
158
|
+
name={iconName}
|
|
159
|
+
size={18}
|
|
160
|
+
/>
|
|
161
|
+
) : undefined
|
|
162
|
+
}
|
|
163
|
+
lastUsedLabel={lastUsedLabel}
|
|
164
|
+
lastUsedTestID={lastUsedTestID}
|
|
165
|
+
loading={loading}
|
|
166
|
+
onPress={handlePress}
|
|
167
|
+
testID={resolvedTestID}
|
|
168
|
+
text={buttonText}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
129
173
|
return (
|
|
130
174
|
<Pressable
|
|
131
175
|
accessibilityHint={`Sign in with ${providerName}`}
|
|
132
|
-
aria-label={buttonText}
|
|
176
|
+
aria-label={accessibilityLabel ?? buttonText}
|
|
133
177
|
aria-role="button"
|
|
134
178
|
disabled={isDisabled}
|
|
135
179
|
onPress={handlePress}
|
package/src/SplitPage.native.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Native SplitPage stays a stacked list/detail at every mobile breakpoint, including tablet `lg`.
|
|
2
|
+
// Prefer `ListDetailLayout` for new list/detail screens: it keeps the selected item in the route
|
|
3
|
+
// and splits into two panes when the layout is wide enough.
|
|
2
4
|
import {useCallback, useEffect, useState} from "react";
|
|
3
5
|
import flattenChildren from "react-keyed-flatten-children";
|
|
4
6
|
import {Dimensions, type ListRenderItemInfo, View} from "react-native";
|
|
@@ -9,11 +11,15 @@ import type {SplitPageListItem, SplitPageProps} from "./Common";
|
|
|
9
11
|
import {FlatList} from "./FlatList";
|
|
10
12
|
import {IconButton} from "./IconButton";
|
|
11
13
|
import {Spinner} from "./Spinner";
|
|
14
|
+
import {SplitPageLoading} from "./SplitPageLoading";
|
|
12
15
|
import {Unifier} from "./Unifier";
|
|
13
16
|
|
|
14
17
|
export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
15
18
|
children,
|
|
16
19
|
loading = false,
|
|
20
|
+
loadingAnimation,
|
|
21
|
+
loadingComponent,
|
|
22
|
+
loadingLabel,
|
|
17
23
|
color,
|
|
18
24
|
keyboardOffset,
|
|
19
25
|
renderListViewItem,
|
|
@@ -156,8 +162,15 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
156
162
|
keyboardOffset={keyboardOffset}
|
|
157
163
|
width="100%"
|
|
158
164
|
>
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
<SplitPageLoading
|
|
166
|
+
loading={loading}
|
|
167
|
+
loadingAnimation={loadingAnimation}
|
|
168
|
+
loadingComponent={loadingComponent}
|
|
169
|
+
loadingLabel={loadingLabel}
|
|
170
|
+
spinner={<Spinner color="light" size="md" />}
|
|
171
|
+
>
|
|
172
|
+
{selectedId === undefined ? renderList() : renderMainContent}
|
|
173
|
+
</SplitPageLoading>
|
|
161
174
|
</Box>
|
|
162
175
|
);
|
|
163
176
|
};
|
package/src/SplitPage.tsx
CHANGED
|
@@ -26,6 +26,7 @@ import {IconButton} from "./IconButton";
|
|
|
26
26
|
import {isNarrowViewport} from "./MediaQuery";
|
|
27
27
|
import {SegmentedControl} from "./SegmentedControl";
|
|
28
28
|
import {Spinner} from "./Spinner";
|
|
29
|
+
import {SplitPageLoading} from "./SplitPageLoading";
|
|
29
30
|
import {useTheme} from "./Theme";
|
|
30
31
|
|
|
31
32
|
// flex: 1 (basis 0, shrink 1) sizes the content container to the pane. A height: "100%"
|
|
@@ -76,15 +77,24 @@ const renderDesktopChildColumn = ({
|
|
|
76
77
|
);
|
|
77
78
|
};
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
/**
|
|
81
|
+
* A component for rendering a list on one side and a details view on the right for large screens,
|
|
82
|
+
* and a scrollable list where clicking an item takes you the details view.
|
|
83
|
+
* On web, opt in to minimum widths for the desktop side-by-side children, or a labeled pager
|
|
84
|
+
* on the narrow viewport. `narrowBelowWidth` chooses that viewport from the window width;
|
|
85
|
+
* otherwise it follows `isNarrowViewport()`. The native SplitPage ignores those props.
|
|
86
|
+
*
|
|
87
|
+
* Prefer `ListDetailLayout` for new list/detail screens. It keeps the selected item in the
|
|
88
|
+
* route, so deep links and back navigation work, and splits on native tablets too. SplitPage
|
|
89
|
+
* remains supported for list/detail views that do not have their own routes.
|
|
90
|
+
*/
|
|
84
91
|
export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
85
92
|
children,
|
|
86
93
|
tabs = [],
|
|
87
94
|
loading = false,
|
|
95
|
+
loadingAnimation,
|
|
96
|
+
loadingComponent,
|
|
97
|
+
loadingLabel,
|
|
88
98
|
color,
|
|
89
99
|
keyboardOffset,
|
|
90
100
|
renderListViewItem,
|
|
@@ -671,13 +681,20 @@ export const SplitPage = <TItem extends SplitPageListItem = SplitPageListItem>({
|
|
|
671
681
|
padding={isLabeledPagerBody ? 0 : 2}
|
|
672
682
|
width="100%"
|
|
673
683
|
>
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
684
|
+
<SplitPageLoading
|
|
685
|
+
loading={loading}
|
|
686
|
+
loadingAnimation={loadingAnimation}
|
|
687
|
+
loadingComponent={loadingComponent}
|
|
688
|
+
loadingLabel={loadingLabel}
|
|
689
|
+
spinner={
|
|
690
|
+
<Spinner
|
|
691
|
+
color={theme.text.primary as unknown as ComponentProps<typeof Spinner>["color"]}
|
|
692
|
+
size="md"
|
|
693
|
+
/>
|
|
694
|
+
}
|
|
695
|
+
>
|
|
696
|
+
{isNarrowLayout ? renderMobileSplitPage() : renderSplitPage()}
|
|
697
|
+
</SplitPageLoading>
|
|
681
698
|
</Box>
|
|
682
699
|
);
|
|
683
700
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {describe, expect, it} from "bun:test";
|
|
2
|
+
import {View} from "react-native";
|
|
3
|
+
|
|
4
|
+
import {SkeletonList} from "./Skeleton";
|
|
5
|
+
import {SplitPageLoading} from "./SplitPageLoading";
|
|
6
|
+
import {renderWithTheme} from "./test-utils";
|
|
7
|
+
|
|
8
|
+
// Skeletons are hidden from assistive tech, so queries opt in to hidden elements.
|
|
9
|
+
const HIDDEN = {includeHiddenElements: true};
|
|
10
|
+
|
|
11
|
+
describe("SplitPageLoading", () => {
|
|
12
|
+
it("renders only the content when not loading", () => {
|
|
13
|
+
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
14
|
+
<SplitPageLoading loading={false} spinner={<View testID="spinner" />}>
|
|
15
|
+
<View testID="content" />
|
|
16
|
+
</SplitPageLoading>
|
|
17
|
+
);
|
|
18
|
+
expect(getByTestId("content")).toBeTruthy();
|
|
19
|
+
expect(queryByTestId("split-page-loading")).toBeNull();
|
|
20
|
+
expect(queryByTestId("spinner")).toBeNull();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("shows a busy, labeled spinner beside the content without a loadingComponent", () => {
|
|
24
|
+
const {getByTestId} = renderWithTheme(
|
|
25
|
+
<SplitPageLoading loading loadingLabel="Loading inbox" spinner={<View testID="spinner" />}>
|
|
26
|
+
<View testID="content" />
|
|
27
|
+
</SplitPageLoading>
|
|
28
|
+
);
|
|
29
|
+
const region = getByTestId("split-page-loading");
|
|
30
|
+
expect(region.props["aria-busy"]).toBe(true);
|
|
31
|
+
expect(region.props.accessibilityLabel).toBe("Loading inbox");
|
|
32
|
+
expect(getByTestId("spinner")).toBeTruthy();
|
|
33
|
+
expect(getByTestId("content")).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("replaces the content with the loadingComponent", () => {
|
|
37
|
+
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
38
|
+
<SplitPageLoading
|
|
39
|
+
loading
|
|
40
|
+
loadingComponent={<SkeletonList testID="skeleton" />}
|
|
41
|
+
spinner={<View testID="spinner" />}
|
|
42
|
+
>
|
|
43
|
+
<View testID="content" />
|
|
44
|
+
</SplitPageLoading>
|
|
45
|
+
);
|
|
46
|
+
expect(getByTestId("split-page-loading").props["aria-busy"]).toBe(true);
|
|
47
|
+
expect(getByTestId("skeleton", HIDDEN)).toBeTruthy();
|
|
48
|
+
expect(queryByTestId("content")).toBeNull();
|
|
49
|
+
expect(queryByTestId("spinner")).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type {FC, ReactNode} from "react";
|
|
2
|
+
|
|
3
|
+
import {Box} from "./Box";
|
|
4
|
+
import type {LoadingProps} from "./Common";
|
|
5
|
+
|
|
6
|
+
interface SplitPageLoadingProps extends LoadingProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
spinner: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Every SplitPage test id is a fixed `split-page-*` value because SplitPage takes no testID prop.
|
|
12
|
+
const SPLIT_PAGE_LOADING_TEST_ID = "split-page-loading";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* SplitPage's loading region, shared by the web and native SplitPage. Without a
|
|
16
|
+
* `loadingComponent`, a busy spinner sits beside the content; with one, the placeholder replaces
|
|
17
|
+
* the list and detail. Both paths announce `loadingLabel` and set the busy state.
|
|
18
|
+
*/
|
|
19
|
+
export const SplitPageLoading: FC<SplitPageLoadingProps> = ({
|
|
20
|
+
children,
|
|
21
|
+
loading,
|
|
22
|
+
loadingAnimation,
|
|
23
|
+
loadingComponent,
|
|
24
|
+
loadingLabel,
|
|
25
|
+
spinner,
|
|
26
|
+
}) => {
|
|
27
|
+
if (!loading) {
|
|
28
|
+
return <>{children}</>;
|
|
29
|
+
}
|
|
30
|
+
if (!loadingComponent) {
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Box
|
|
34
|
+
loading
|
|
35
|
+
loadingComponent={spinner}
|
|
36
|
+
loadingLabel={loadingLabel}
|
|
37
|
+
testID={SPLIT_PAGE_LOADING_TEST_ID}
|
|
38
|
+
/>
|
|
39
|
+
{children}
|
|
40
|
+
</>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return (
|
|
44
|
+
<Box
|
|
45
|
+
flex="grow"
|
|
46
|
+
loading
|
|
47
|
+
loadingAnimation={loadingAnimation}
|
|
48
|
+
loadingComponent={loadingComponent}
|
|
49
|
+
loadingLabel={loadingLabel}
|
|
50
|
+
testID={SPLIT_PAGE_LOADING_TEST_ID}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -1,18 +1,75 @@
|
|
|
1
|
-
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
-
import {fireEvent} from "@testing-library/react-native";
|
|
1
|
+
import {describe, expect, it, jest, mock} from "bun:test";
|
|
2
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
3
3
|
|
|
4
4
|
import {SyncStatusBanner} from "./SyncStatusBanner";
|
|
5
5
|
import {renderWithTheme} from "./test-utils";
|
|
6
6
|
|
|
7
7
|
describe("SyncStatusBanner", () => {
|
|
8
|
-
it("renders the offline indicator when
|
|
8
|
+
it("renders the offline indicator immediately when the grace period is 0", () => {
|
|
9
9
|
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
10
|
-
<SyncStatusBanner
|
|
10
|
+
<SyncStatusBanner
|
|
11
|
+
conflictCount={0}
|
|
12
|
+
isOnline={false}
|
|
13
|
+
isSyncing={false}
|
|
14
|
+
offlineGraceMs={0}
|
|
15
|
+
queuedCount={0}
|
|
16
|
+
/>
|
|
11
17
|
);
|
|
12
18
|
expect(getByTestId("sync-offline-indicator")).toBeTruthy();
|
|
13
19
|
expect(queryByTestId("sync-syncing-indicator")).toBeNull();
|
|
14
20
|
});
|
|
15
21
|
|
|
22
|
+
it("waits out the grace period before showing the offline indicator", () => {
|
|
23
|
+
jest.useFakeTimers();
|
|
24
|
+
try {
|
|
25
|
+
const {queryByTestId} = renderWithTheme(
|
|
26
|
+
<SyncStatusBanner conflictCount={0} isOnline={false} queuedCount={0} />
|
|
27
|
+
);
|
|
28
|
+
expect(queryByTestId("sync-offline-indicator")).toBeNull();
|
|
29
|
+
act(() => {
|
|
30
|
+
jest.advanceTimersByTime(2999);
|
|
31
|
+
});
|
|
32
|
+
expect(queryByTestId("sync-offline-indicator")).toBeNull();
|
|
33
|
+
act(() => {
|
|
34
|
+
jest.advanceTimersByTime(1);
|
|
35
|
+
});
|
|
36
|
+
expect(queryByTestId("sync-offline-indicator")).toBeTruthy();
|
|
37
|
+
} finally {
|
|
38
|
+
jest.useRealTimers();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("does not flash offline for a drop shorter than the grace period", () => {
|
|
43
|
+
jest.useFakeTimers();
|
|
44
|
+
try {
|
|
45
|
+
const view = renderWithTheme(
|
|
46
|
+
<SyncStatusBanner conflictCount={0} isOnline={true} queuedCount={0} />
|
|
47
|
+
);
|
|
48
|
+
view.rerender(<SyncStatusBanner conflictCount={0} isOnline={false} queuedCount={0} />);
|
|
49
|
+
act(() => {
|
|
50
|
+
jest.advanceTimersByTime(1000);
|
|
51
|
+
});
|
|
52
|
+
view.rerender(<SyncStatusBanner conflictCount={0} isOnline={true} queuedCount={0} />);
|
|
53
|
+
act(() => {
|
|
54
|
+
jest.advanceTimersByTime(5000);
|
|
55
|
+
});
|
|
56
|
+
expect(view.queryByTestId("sync-offline-indicator")).toBeNull();
|
|
57
|
+
} finally {
|
|
58
|
+
jest.useRealTimers();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("hides the offline indicator as soon as connectivity returns", () => {
|
|
63
|
+
const view = renderWithTheme(
|
|
64
|
+
<SyncStatusBanner conflictCount={0} isOnline={false} offlineGraceMs={0} queuedCount={0} />
|
|
65
|
+
);
|
|
66
|
+
expect(view.queryByTestId("sync-offline-indicator")).toBeTruthy();
|
|
67
|
+
view.rerender(
|
|
68
|
+
<SyncStatusBanner conflictCount={0} isOnline={true} offlineGraceMs={0} queuedCount={0} />
|
|
69
|
+
);
|
|
70
|
+
expect(view.queryByTestId("sync-offline-indicator")).toBeNull();
|
|
71
|
+
});
|
|
72
|
+
|
|
16
73
|
it("hides the offline indicator when online", () => {
|
|
17
74
|
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
18
75
|
<SyncStatusBanner conflictCount={0} isOnline={true} isSyncing={false} queuedCount={0} />
|
package/src/SyncStatusBanner.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import {useCallback} from "react";
|
|
2
|
+
import {useCallback, useEffect, useState} from "react";
|
|
3
3
|
|
|
4
4
|
import {Badge} from "./Badge";
|
|
5
5
|
import {Box} from "./Box";
|
|
@@ -7,9 +7,18 @@ import {Box} from "./Box";
|
|
|
7
7
|
/** Queued count above which the banner switches to a numeric drain-progress display. */
|
|
8
8
|
const PROGRESS_THRESHOLD = 20;
|
|
9
9
|
|
|
10
|
+
/** Default time connectivity must stay lost before the offline badge appears. */
|
|
11
|
+
const DEFAULT_OFFLINE_GRACE_MS = 3000;
|
|
12
|
+
|
|
10
13
|
export interface SyncStatusBannerProps {
|
|
11
14
|
/** Whether the client currently has connectivity. */
|
|
12
15
|
isOnline: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* How long (ms) `isOnline` must stay false before the offline badge shows. Absorbs the
|
|
18
|
+
* not-yet-connected window at startup and sub-second socket blips so the badge does not
|
|
19
|
+
* flash. Going back online hides it immediately. Defaults to 3000; pass 0 to show at once.
|
|
20
|
+
*/
|
|
21
|
+
offlineGraceMs?: number;
|
|
13
22
|
/** Number of mutations waiting in the durable outbox. */
|
|
14
23
|
queuedCount: number;
|
|
15
24
|
/**
|
|
@@ -45,7 +54,7 @@ export interface SyncStatusBannerProps {
|
|
|
45
54
|
|
|
46
55
|
/**
|
|
47
56
|
* Compact, presentational sync-state banner for local-first (e.g. @terreno/syncdb) screens:
|
|
48
|
-
* offline indicator, queued mutation count (with drain progress once the queue grows past
|
|
57
|
+
* offline indicator (shown only after a short grace period), queued mutation count (with drain progress once the queue grows past
|
|
49
58
|
* {@link PROGRESS_THRESHOLD}), a paused-for-auth indicator, a pressable failed count, and a
|
|
50
59
|
* pressable conflict badge. Initial bootstrap "Syncing…" is intentionally not shown here —
|
|
51
60
|
* apps should surface that as a one-shot toast on launch (see SyncHealthToast). It is
|
|
@@ -54,6 +63,7 @@ export interface SyncStatusBannerProps {
|
|
|
54
63
|
*/
|
|
55
64
|
export const SyncStatusBanner: React.FC<SyncStatusBannerProps> = ({
|
|
56
65
|
isOnline,
|
|
66
|
+
offlineGraceMs = DEFAULT_OFFLINE_GRACE_MS,
|
|
57
67
|
queuedCount,
|
|
58
68
|
isSyncing: _isSyncing,
|
|
59
69
|
conflictCount,
|
|
@@ -67,6 +77,22 @@ export const SyncStatusBanner: React.FC<SyncStatusBannerProps> = ({
|
|
|
67
77
|
onOpenFailed,
|
|
68
78
|
testID = "sync-status-banner",
|
|
69
79
|
}) => {
|
|
80
|
+
const [isOfflineSettled, setIsOfflineSettled] = useState(!isOnline && offlineGraceMs <= 0);
|
|
81
|
+
|
|
82
|
+
// Only surface "Offline" once connectivity has stayed lost for the grace period.
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (isOnline) {
|
|
85
|
+
setIsOfflineSettled(false);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (offlineGraceMs <= 0) {
|
|
89
|
+
setIsOfflineSettled(true);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const timer = setTimeout(() => setIsOfflineSettled(true), offlineGraceMs);
|
|
93
|
+
return (): void => clearTimeout(timer);
|
|
94
|
+
}, [isOnline, offlineGraceMs]);
|
|
95
|
+
|
|
70
96
|
const handleOpenConflicts = useCallback((): void => {
|
|
71
97
|
onOpenConflicts?.();
|
|
72
98
|
}, [onOpenConflicts]);
|
|
@@ -83,7 +109,7 @@ export const SyncStatusBanner: React.FC<SyncStatusBannerProps> = ({
|
|
|
83
109
|
|
|
84
110
|
return (
|
|
85
111
|
<Box direction="row" gap={2} marginBottom={4} minHeight={20} testID={testID} wrap>
|
|
86
|
-
{!isOnline && (
|
|
112
|
+
{!isOnline && isOfflineSettled && (
|
|
87
113
|
<Box alignItems="center" direction="row" gap={1} testID="sync-offline-indicator">
|
|
88
114
|
<Badge status="error" value="Offline" />
|
|
89
115
|
</Box>
|
package/src/Text.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {Text as NativeText, Platform, type TextStyle} from "react-native";
|
|
3
3
|
|
|
4
|
-
import type {TextProps} from "./Common";
|
|
4
|
+
import type {TextProps, TextSize} from "./Common";
|
|
5
5
|
import {Hyperlink} from "./Hyperlink";
|
|
6
6
|
import {useTerrenoFontsLoaded} from "./TerrenoFontProvider";
|
|
7
7
|
import {useTheme} from "./Theme";
|
|
@@ -24,6 +24,9 @@ const fontSizeAndWeighMobile = {
|
|
|
24
24
|
|
|
25
25
|
const fontSizes = Platform.OS === "web" ? fontSizeAndWeightWeb : fontSizeAndWeighMobile;
|
|
26
26
|
|
|
27
|
+
/** Font size in pixels that `Text` renders at `size` on the current platform. */
|
|
28
|
+
export const getTextFontSize = (size: TextSize): number => fontSizes[size].size;
|
|
29
|
+
|
|
27
30
|
const TextComponent = ({
|
|
28
31
|
accessibilityRole,
|
|
29
32
|
align = "left",
|