@terreno/ui 57.19.2 → 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 +393 -0
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +3 -3
- package/dist/Accordion.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/Box.d.ts.map +1 -1
- package/dist/Box.js +38 -2
- package/dist/Box.js.map +1 -1
- package/dist/Card.js +2 -2
- package/dist/Card.js.map +1 -1
- package/dist/Common.d.ts +120 -7
- 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/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/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/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/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 +11 -0
- package/dist/SplitPage.d.ts.map +1 -1
- package/dist/SplitPage.js +11 -5
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts.map +1 -1
- package/dist/SplitPage.native.js +3 -1
- package/dist/SplitPage.native.js.map +1 -1
- 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/TextField.d.ts.map +1 -1
- package/dist/TextField.js +44 -10
- package/dist/TextField.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 +19 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -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/package.json +3 -2
- package/src/Accordion.test.tsx +5 -0
- package/src/Accordion.tsx +3 -8
- package/src/AreaChart.test.tsx +15 -0
- package/src/Avatar.test.tsx +8 -0
- package/src/Avatar.tsx +2 -0
- package/src/BarChart.test.tsx +15 -0
- package/src/Box.test.tsx +61 -1
- package/src/Box.tsx +44 -2
- package/src/Card.tsx +2 -2
- package/src/Common.ts +134 -7
- 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/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/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/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/SocialLoginButton.test.tsx +14 -0
- package/src/SocialLoginButton.tsx +51 -7
- package/src/SplitPage.native.tsx +3 -1
- package/src/SplitPage.tsx +11 -5
- package/src/SyncStatusBanner.test.tsx +61 -4
- package/src/SyncStatusBanner.tsx +29 -3
- 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__/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__/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/fieldElements/FieldError.tsx +1 -0
- package/src/fieldElements/__snapshots__/FieldError.test.tsx.snap +2 -0
- package/src/index.tsx +42 -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/Icon.tsx
CHANGED
|
@@ -1,10 +1,100 @@
|
|
|
1
1
|
import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
|
|
2
|
-
import {type FC, memo} from "react";
|
|
2
|
+
import {type FC, memo, useEffect, useState} from "react";
|
|
3
|
+
import {Platform, View} from "react-native";
|
|
3
4
|
|
|
4
5
|
import {type IconProps, iconSizeToNumber} from "./Common";
|
|
5
6
|
import {useCustomIcon} from "./IconRegistry";
|
|
6
7
|
import {useTheme} from "./Theme";
|
|
7
8
|
|
|
9
|
+
interface FontAwesomeGlyphProps {
|
|
10
|
+
brand: boolean;
|
|
11
|
+
color: string;
|
|
12
|
+
duotone: boolean;
|
|
13
|
+
light: boolean;
|
|
14
|
+
name: string;
|
|
15
|
+
regular: boolean;
|
|
16
|
+
sharp: boolean;
|
|
17
|
+
size: number;
|
|
18
|
+
solid: boolean;
|
|
19
|
+
testID?: string;
|
|
20
|
+
thin: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Static web HTML sets `__EXPO_ROUTER_HYDRATE__` and never clears it. Remember that the
|
|
25
|
+
* first hydration pass finished so later-mounted glyphs paint immediately.
|
|
26
|
+
*/
|
|
27
|
+
let didFinishStaticHydration = false;
|
|
28
|
+
let placeholderCommits = 0;
|
|
29
|
+
|
|
30
|
+
/** True only while a static web export is rendering or hydrating. Native and client-only web paint immediately. */
|
|
31
|
+
const isWebStaticHydration = (): boolean => {
|
|
32
|
+
if (didFinishStaticHydration || Platform.OS !== "web") {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (typeof document === "undefined") {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return (globalThis as {__EXPO_ROUTER_HYDRATE__?: boolean}).__EXPO_ROUTER_HYDRATE__ === true;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Test hook so hydration cases do not leak across files. */
|
|
42
|
+
export const resetIconStaticHydrationForTests = (): void => {
|
|
43
|
+
didFinishStaticHydration = false;
|
|
44
|
+
placeholderCommits = 0;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** How many times a glyph rendered the empty SSR placeholder. */
|
|
48
|
+
export const iconPlaceholderCommitsForTests = (): number => placeholderCommits;
|
|
49
|
+
|
|
50
|
+
const FontAwesomeGlyph: FC<FontAwesomeGlyphProps> = ({
|
|
51
|
+
brand,
|
|
52
|
+
color,
|
|
53
|
+
duotone,
|
|
54
|
+
light,
|
|
55
|
+
name,
|
|
56
|
+
regular,
|
|
57
|
+
sharp,
|
|
58
|
+
size,
|
|
59
|
+
solid,
|
|
60
|
+
testID,
|
|
61
|
+
thin,
|
|
62
|
+
}) => {
|
|
63
|
+
const deferGlyph = isWebStaticHydration();
|
|
64
|
+
const [showGlyph, setShowGlyph] = useState(!deferGlyph);
|
|
65
|
+
|
|
66
|
+
// Swap the SSR placeholder for the glyph once, and stop deferring icons mounted later.
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (!deferGlyph) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
didFinishStaticHydration = true;
|
|
72
|
+
setShowGlyph(true);
|
|
73
|
+
}, [deferGlyph]);
|
|
74
|
+
|
|
75
|
+
if (!showGlyph) {
|
|
76
|
+
placeholderCommits += 1;
|
|
77
|
+
return <View style={{height: size, width: size}} testID={testID} />;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<FontAwesome6
|
|
82
|
+
brand={brand}
|
|
83
|
+
color={color}
|
|
84
|
+
duotone={duotone}
|
|
85
|
+
light={light}
|
|
86
|
+
name={name}
|
|
87
|
+
regular={regular}
|
|
88
|
+
selectable={undefined}
|
|
89
|
+
sharp={sharp}
|
|
90
|
+
size={size}
|
|
91
|
+
solid={solid}
|
|
92
|
+
testID={testID}
|
|
93
|
+
thin={thin}
|
|
94
|
+
/>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
8
98
|
const IconComponent: FC<IconProps> = ({
|
|
9
99
|
color = "primary",
|
|
10
100
|
size = "md",
|
|
@@ -23,14 +113,13 @@ const IconComponent: FC<IconProps> = ({
|
|
|
23
113
|
}
|
|
24
114
|
|
|
25
115
|
return (
|
|
26
|
-
<
|
|
116
|
+
<FontAwesomeGlyph
|
|
27
117
|
brand={type === "brand"}
|
|
28
118
|
color={iconColor}
|
|
29
119
|
duotone={type === "duotone"}
|
|
30
120
|
light={type === "light" || type === "sharpLight"}
|
|
31
121
|
name={iconName}
|
|
32
122
|
regular={type === "regular"}
|
|
33
|
-
selectable={undefined}
|
|
34
123
|
sharp={type === "sharp"}
|
|
35
124
|
size={iconSize}
|
|
36
125
|
solid={type === "solid" || type === "sharpSolid"}
|
package/src/IconButton.test.tsx
CHANGED
|
@@ -151,6 +151,91 @@ describe("IconButton", () => {
|
|
|
151
151
|
expect(getByLabelText("Back to list").props.accessibilityHint).toBe("Back to list");
|
|
152
152
|
});
|
|
153
153
|
|
|
154
|
+
it("exercises the real button variants, indicator, and confirmation", async () => {
|
|
155
|
+
// bunSetup replaces ./IconButton with a null mock; the query suffix loads the real module.
|
|
156
|
+
const actualIconButtonPath = "./IconButton.tsx?real-branches";
|
|
157
|
+
const {IconButton: ActualIconButton} = (await import(
|
|
158
|
+
actualIconButtonPath
|
|
159
|
+
)) as typeof import("./IconButton");
|
|
160
|
+
const onClick = mock(() => Promise.resolve());
|
|
161
|
+
const {getByLabelText, getByText} = renderWithTheme(
|
|
162
|
+
<>
|
|
163
|
+
<ActualIconButton
|
|
164
|
+
accessibilityLabel="secondary"
|
|
165
|
+
iconName="check"
|
|
166
|
+
onClick={onClick}
|
|
167
|
+
variant="secondary"
|
|
168
|
+
/>
|
|
169
|
+
<ActualIconButton
|
|
170
|
+
accessibilityLabel="destructive"
|
|
171
|
+
iconName="trash"
|
|
172
|
+
onClick={onClick}
|
|
173
|
+
variant="destructive"
|
|
174
|
+
/>
|
|
175
|
+
<ActualIconButton
|
|
176
|
+
accessibilityLabel="navigation"
|
|
177
|
+
iconName="bars"
|
|
178
|
+
onClick={onClick}
|
|
179
|
+
size="sm"
|
|
180
|
+
variant="navigation"
|
|
181
|
+
/>
|
|
182
|
+
<ActualIconButton
|
|
183
|
+
accessibilityLabel="ghost active"
|
|
184
|
+
iconName="check"
|
|
185
|
+
onClick={onClick}
|
|
186
|
+
state="active"
|
|
187
|
+
variant="ghost"
|
|
188
|
+
/>
|
|
189
|
+
<ActualIconButton
|
|
190
|
+
accessibilityLabel="disabled"
|
|
191
|
+
disabled
|
|
192
|
+
iconName="check"
|
|
193
|
+
onClick={onClick}
|
|
194
|
+
/>
|
|
195
|
+
<ActualIconButton
|
|
196
|
+
accessibilityLabel="badge"
|
|
197
|
+
iconName="bell"
|
|
198
|
+
indicator="error"
|
|
199
|
+
indicatorText="5"
|
|
200
|
+
onClick={onClick}
|
|
201
|
+
/>
|
|
202
|
+
<ActualIconButton
|
|
203
|
+
accessibilityLabel="Delete"
|
|
204
|
+
confirmationHeading="Confirm Delete"
|
|
205
|
+
confirmationText="Are you sure?"
|
|
206
|
+
iconName="trash"
|
|
207
|
+
onClick={onClick}
|
|
208
|
+
withConfirmation
|
|
209
|
+
/>
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
expect(getByLabelText("badge").props.accessibilityHint).toBe("Press to perform badge action");
|
|
214
|
+
await act(async () => {
|
|
215
|
+
fireEvent.press(getByLabelText("Delete"));
|
|
216
|
+
});
|
|
217
|
+
expect(getByText("Are you sure?")).toBeTruthy();
|
|
218
|
+
await act(async () => {
|
|
219
|
+
fireEvent.press(getByText("Confirm"));
|
|
220
|
+
});
|
|
221
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("resets loading after the real button's click fails", async () => {
|
|
225
|
+
const actualIconButtonPath = "./IconButton.tsx?click-error";
|
|
226
|
+
const {IconButton: ActualIconButton} = (await import(
|
|
227
|
+
actualIconButtonPath
|
|
228
|
+
)) as typeof import("./IconButton");
|
|
229
|
+
const onClick = mock(() => Promise.reject(new Error("click failed")));
|
|
230
|
+
const {getByLabelText} = renderWithTheme(
|
|
231
|
+
<ActualIconButton accessibilityLabel="Save" iconName="check" loading onClick={onClick} />
|
|
232
|
+
);
|
|
233
|
+
await act(async () => {
|
|
234
|
+
await Promise.resolve(fireEvent.press(getByLabelText("Save"))).catch(() => undefined);
|
|
235
|
+
});
|
|
236
|
+
expect(onClick).toHaveBeenCalledTimes(1);
|
|
237
|
+
});
|
|
238
|
+
|
|
154
239
|
it("renders with confirmation props", () => {
|
|
155
240
|
const {toJSON} = renderWithTheme(
|
|
156
241
|
<IconButton
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
+
import {fireEvent} from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import {LabeledCheckBox} from "./LabeledCheckBox";
|
|
5
|
+
import {renderWithTheme} from "./test-utils";
|
|
6
|
+
|
|
7
|
+
describe("LabeledCheckBox", () => {
|
|
8
|
+
it("is a checkbox named by its label that reports the toggled state", () => {
|
|
9
|
+
const onChange = mock((_checked: boolean) => {});
|
|
10
|
+
const {getByLabelText, getByTestId} = renderWithTheme(
|
|
11
|
+
<LabeledCheckBox checked={false} label="Remember me" onChange={onChange} testID="remember" />
|
|
12
|
+
);
|
|
13
|
+
expect(getByLabelText("Remember me")).toBeTruthy();
|
|
14
|
+
expect(getByTestId("remember").props.role).toBe("checkbox");
|
|
15
|
+
expect(getByTestId("remember").props["aria-checked"]).toBe(false);
|
|
16
|
+
fireEvent.press(getByTestId("remember"));
|
|
17
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("toggles with Space and ignores other keys", () => {
|
|
21
|
+
const onChange = mock((_checked: boolean) => {});
|
|
22
|
+
const {getByTestId} = renderWithTheme(
|
|
23
|
+
<LabeledCheckBox checked label="Remember me" onChange={onChange} testID="remember" />
|
|
24
|
+
);
|
|
25
|
+
fireEvent(getByTestId("remember"), "keyDown", {key: "Enter", preventDefault: () => {}});
|
|
26
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
27
|
+
fireEvent(getByTestId("remember"), "keyDown", {nativeEvent: {key: " "}});
|
|
28
|
+
expect(onChange).toHaveBeenCalledWith(false);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("does not toggle while disabled", () => {
|
|
32
|
+
const onChange = mock((_checked: boolean) => {});
|
|
33
|
+
const {getByTestId} = renderWithTheme(
|
|
34
|
+
<LabeledCheckBox
|
|
35
|
+
checked={false}
|
|
36
|
+
disabled
|
|
37
|
+
label="Remember me"
|
|
38
|
+
onChange={onChange}
|
|
39
|
+
testID="remember"
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
fireEvent(getByTestId("remember"), "keyDown", {key: " ", preventDefault: () => {}});
|
|
43
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {type FC, useCallback} from "react";
|
|
2
|
+
import {Pressable} from "react-native";
|
|
3
|
+
|
|
4
|
+
import {Box} from "./Box";
|
|
5
|
+
import {CheckBox} from "./CheckBox";
|
|
6
|
+
import {Text} from "./Text";
|
|
7
|
+
|
|
8
|
+
/** The keydown event react-native-web hands a Pressable's `onKeyDown`. */
|
|
9
|
+
interface WebKeyDownEvent {
|
|
10
|
+
key?: string;
|
|
11
|
+
nativeEvent?: {key?: string};
|
|
12
|
+
preventDefault?: () => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface LabeledCheckBoxProps {
|
|
16
|
+
/** Sentence shown next to the box; also the accessible name. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Whether the box is checked. */
|
|
19
|
+
checked: boolean;
|
|
20
|
+
/** Called with the new checked state. */
|
|
21
|
+
onChange: (checked: boolean) => void;
|
|
22
|
+
/** Blocks toggling and marks the control disabled. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Smaller line under the label. It is not part of the accessible name. */
|
|
25
|
+
helperText?: string;
|
|
26
|
+
/** Test ID of the pressable checkbox. */
|
|
27
|
+
testID?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A checkbox with its label as one pressable `role="checkbox"` control. Internal to the auth
|
|
32
|
+
* screens and cards (trust this device, sign out other devices, I saved these codes).
|
|
33
|
+
*/
|
|
34
|
+
export const LabeledCheckBox: FC<LabeledCheckBoxProps> = ({
|
|
35
|
+
label,
|
|
36
|
+
checked,
|
|
37
|
+
onChange,
|
|
38
|
+
disabled = false,
|
|
39
|
+
helperText,
|
|
40
|
+
testID,
|
|
41
|
+
}) => {
|
|
42
|
+
const handleToggle = useCallback((): void => {
|
|
43
|
+
if (disabled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
onChange(!checked);
|
|
47
|
+
}, [checked, disabled, onChange]);
|
|
48
|
+
|
|
49
|
+
// react-native-web presses a Pressable on Space only for button roles, so a checkbox handles
|
|
50
|
+
// Space itself (Enter already presses it).
|
|
51
|
+
const handleKeyDown = useCallback(
|
|
52
|
+
(event: WebKeyDownEvent): void => {
|
|
53
|
+
const key = event.key ?? event.nativeEvent?.key;
|
|
54
|
+
if (key !== " " && key !== "Spacebar") {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
event.preventDefault?.();
|
|
58
|
+
handleToggle();
|
|
59
|
+
},
|
|
60
|
+
[handleToggle]
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Pressable
|
|
65
|
+
accessibilityLabel={label}
|
|
66
|
+
accessibilityState={{checked, disabled}}
|
|
67
|
+
aria-checked={checked}
|
|
68
|
+
aria-disabled={disabled}
|
|
69
|
+
aria-label={label}
|
|
70
|
+
disabled={disabled}
|
|
71
|
+
onPress={handleToggle}
|
|
72
|
+
{...({onKeyDown: handleKeyDown} as Record<string, unknown>)}
|
|
73
|
+
role="checkbox"
|
|
74
|
+
testID={testID}
|
|
75
|
+
>
|
|
76
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
77
|
+
<CheckBox selected={checked} size="md" />
|
|
78
|
+
<Box flex="shrink">
|
|
79
|
+
<Text>{label}</Text>
|
|
80
|
+
{Boolean(helperText) && (
|
|
81
|
+
<Text color="secondaryLight" size="sm">
|
|
82
|
+
{helperText}
|
|
83
|
+
</Text>
|
|
84
|
+
)}
|
|
85
|
+
</Box>
|
|
86
|
+
</Box>
|
|
87
|
+
</Pressable>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import {router, Stack, useGlobalSearchParams, usePathname, useSegments} from "expo-router";
|
|
2
|
+
import {
|
|
3
|
+
type ComponentProps,
|
|
4
|
+
createContext,
|
|
5
|
+
type FC,
|
|
6
|
+
type ReactElement,
|
|
7
|
+
useCallback,
|
|
8
|
+
useContext,
|
|
9
|
+
useState,
|
|
10
|
+
} from "react";
|
|
11
|
+
import {type LayoutChangeEvent, useWindowDimensions, View} from "react-native";
|
|
12
|
+
import {SafeAreaView} from "react-native-safe-area-context";
|
|
13
|
+
|
|
14
|
+
import type {ListDetailLayoutProps, ListDetailState} from "./Common";
|
|
15
|
+
import {IconButton} from "./IconButton";
|
|
16
|
+
import {useTheme} from "./Theme";
|
|
17
|
+
|
|
18
|
+
const DEFAULT_SPLIT_AT_WIDTH = 768;
|
|
19
|
+
const DEFAULT_LIST_WIDTH = 360;
|
|
20
|
+
const DEFAULT_DETAIL_ROUTE = "[id]";
|
|
21
|
+
const DEFAULT_PARAM_NAME = "id";
|
|
22
|
+
|
|
23
|
+
type StackScreenOptions = ComponentProps<typeof Stack>["screenOptions"];
|
|
24
|
+
type StackScreenOptionsProps = Parameters<
|
|
25
|
+
Extract<StackScreenOptions, (...args: never[]) => unknown>
|
|
26
|
+
>[0];
|
|
27
|
+
|
|
28
|
+
interface ListDetailContextValue extends ListDetailState {
|
|
29
|
+
emptyDetail?: ReactElement;
|
|
30
|
+
list: ReactElement;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// With the list already on screen, back never returns to it: the header's back button leaves the
|
|
34
|
+
// list/detail group instead, and the push animation is off. The web header ignores
|
|
35
|
+
// headerBackVisible and draws its own back button unless headerLeft is set.
|
|
36
|
+
const splitScreenOptions = ({navigation}: StackScreenOptionsProps) => {
|
|
37
|
+
const parent = navigation.getParent();
|
|
38
|
+
return {
|
|
39
|
+
animation: "none" as const,
|
|
40
|
+
headerBackVisible: false,
|
|
41
|
+
headerLeft: (): ReactElement | null => {
|
|
42
|
+
if (!parent?.canGoBack()) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
<IconButton
|
|
47
|
+
accessibilityHint="Leaves this list"
|
|
48
|
+
accessibilityLabel="Back"
|
|
49
|
+
iconName="arrow-left"
|
|
50
|
+
onClick={() => parent.goBack()}
|
|
51
|
+
testID="list-detail-leave"
|
|
52
|
+
variant="navigation"
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const mergeSplitScreenOptions = (
|
|
60
|
+
isSplit: boolean,
|
|
61
|
+
screenOptions: StackScreenOptions
|
|
62
|
+
): StackScreenOptions => {
|
|
63
|
+
if (!isSplit) {
|
|
64
|
+
return screenOptions;
|
|
65
|
+
}
|
|
66
|
+
return (props: StackScreenOptionsProps) => ({
|
|
67
|
+
...splitScreenOptions(props),
|
|
68
|
+
...(typeof screenOptions === "function" ? screenOptions(props) : screenOptions),
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// The open item is the detail route directly below the group's index; an `id` from a parent
|
|
73
|
+
// dynamic segment or a deeper route never counts.
|
|
74
|
+
const useSelectedId = ({
|
|
75
|
+
detailRoute,
|
|
76
|
+
indexHref,
|
|
77
|
+
paramName,
|
|
78
|
+
}: {
|
|
79
|
+
detailRoute: string;
|
|
80
|
+
indexHref: string;
|
|
81
|
+
paramName: string;
|
|
82
|
+
}): string | undefined => {
|
|
83
|
+
const pathname = usePathname();
|
|
84
|
+
const segments = useSegments();
|
|
85
|
+
const params = useGlobalSearchParams();
|
|
86
|
+
|
|
87
|
+
if (segments[segments.length - 1] !== detailRoute) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const raw = params[paramName];
|
|
91
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
92
|
+
if (!value) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
// The detail must sit directly below the index. Ids may contain "/", so compare whole paths.
|
|
96
|
+
const indexPath = indexHref.replace(/\/+$/, "");
|
|
97
|
+
const isDirectChild =
|
|
98
|
+
pathname === `${indexPath}/${value}` ||
|
|
99
|
+
pathname === `${indexPath}/${encodeURIComponent(value)}`;
|
|
100
|
+
return isDirectChild ? value : undefined;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const ListDetailContext = createContext<ListDetailContextValue | null>(null);
|
|
104
|
+
|
|
105
|
+
const useListDetailContext = (): ListDetailContextValue => {
|
|
106
|
+
const context = useContext(ListDetailContext);
|
|
107
|
+
if (!context) {
|
|
108
|
+
throw new Error("useListDetail must be used inside a ListDetailLayout");
|
|
109
|
+
}
|
|
110
|
+
return context;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Reads the list/detail layout state from the nearest ListDetailLayout.
|
|
115
|
+
*/
|
|
116
|
+
export const useListDetail = (): ListDetailState => {
|
|
117
|
+
const {clear, isSplit, select, selectedId} = useListDetailContext();
|
|
118
|
+
return {clear, isSplit, select, selectedId};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Route-driven list/detail layout for a route group's `_layout.tsx`. On a narrow layout it is
|
|
123
|
+
* an expo-router Stack: the index route shows the list and pushes the detail route. When the
|
|
124
|
+
* layout is at least `splitAtWidth` wide, the list stays in a left pane and the Stack shows
|
|
125
|
+
* the detail beside it. The Stack never moves in the tree, so crossing the breakpoint keeps
|
|
126
|
+
* the open route. `list` moves between the index screen and the left pane, so it remounts:
|
|
127
|
+
* keep list state such as filters or search text in the route or a store.
|
|
128
|
+
*
|
|
129
|
+
* ```tsx
|
|
130
|
+
* // app/mail/_layout.tsx
|
|
131
|
+
* export const unstable_settings = {initialRouteName: "index"};
|
|
132
|
+
* const MailLayout: React.FC = () => (
|
|
133
|
+
* <ListDetailLayout
|
|
134
|
+
* detailHref={(id) => `/mail/${id}`}
|
|
135
|
+
* emptyDetail={<Text>Select a message</Text>}
|
|
136
|
+
* indexHref="/mail"
|
|
137
|
+
* list={<MailList />}
|
|
138
|
+
* />
|
|
139
|
+
* );
|
|
140
|
+
* // app/mail/index.tsx
|
|
141
|
+
* const MailIndex: React.FC = () => <ListDetailIndex />;
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export const ListDetailLayout: FC<ListDetailLayoutProps> = ({
|
|
145
|
+
list,
|
|
146
|
+
detailHref,
|
|
147
|
+
indexHref,
|
|
148
|
+
emptyDetail,
|
|
149
|
+
detailRoute = DEFAULT_DETAIL_ROUTE,
|
|
150
|
+
paramName = DEFAULT_PARAM_NAME,
|
|
151
|
+
splitAtWidth = DEFAULT_SPLIT_AT_WIDTH,
|
|
152
|
+
listWidth = DEFAULT_LIST_WIDTH,
|
|
153
|
+
screenOptions,
|
|
154
|
+
children,
|
|
155
|
+
}) => {
|
|
156
|
+
const {theme} = useTheme();
|
|
157
|
+
const {width: windowWidth} = useWindowDimensions();
|
|
158
|
+
const [measuredWidth, setMeasuredWidth] = useState<number | undefined>(undefined);
|
|
159
|
+
|
|
160
|
+
// The layout may sit beside a sidebar, so its own width decides the split. The window
|
|
161
|
+
// width stands in until the first layout event.
|
|
162
|
+
const isSplit = (measuredWidth ?? windowWidth) >= splitAtWidth;
|
|
163
|
+
|
|
164
|
+
const onLayout = useCallback((event: LayoutChangeEvent): void => {
|
|
165
|
+
const {width} = event.nativeEvent.layout;
|
|
166
|
+
if (width > 0) {
|
|
167
|
+
setMeasuredWidth(width);
|
|
168
|
+
}
|
|
169
|
+
}, []);
|
|
170
|
+
|
|
171
|
+
const selectedId = useSelectedId({detailRoute, indexHref, paramName});
|
|
172
|
+
|
|
173
|
+
// When split, swap the open detail in place so back always returns to the list.
|
|
174
|
+
const select = useCallback(
|
|
175
|
+
(id: string): void => {
|
|
176
|
+
if (!isSplit || selectedId === undefined) {
|
|
177
|
+
router.push(detailHref(id));
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (id !== selectedId) {
|
|
181
|
+
router.replace(detailHref(id));
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
[detailHref, isSplit, selectedId]
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
// Pop back to the index inside this Stack. A detail opened from outside the group has no
|
|
188
|
+
// index below it, so dismissTo replaces it with the index rather than leaving the group.
|
|
189
|
+
const clear = useCallback((): void => {
|
|
190
|
+
if (selectedId === undefined) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
router.dismissTo(indexHref);
|
|
194
|
+
}, [indexHref, selectedId]);
|
|
195
|
+
|
|
196
|
+
const contextValue: ListDetailContextValue = {
|
|
197
|
+
clear,
|
|
198
|
+
emptyDetail,
|
|
199
|
+
isSplit,
|
|
200
|
+
list,
|
|
201
|
+
select,
|
|
202
|
+
selectedId,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<ListDetailContext.Provider value={contextValue}>
|
|
207
|
+
<View onLayout={onLayout} style={{flex: 1, flexDirection: "row"}} testID="list-detail-layout">
|
|
208
|
+
{/* Keep this slot even when empty so the detail pane, and its Stack, never remount. */}
|
|
209
|
+
{isSplit ? (
|
|
210
|
+
<View
|
|
211
|
+
style={{
|
|
212
|
+
borderRightColor: theme.border.default,
|
|
213
|
+
borderRightWidth: 1,
|
|
214
|
+
flexShrink: 0,
|
|
215
|
+
width: listWidth,
|
|
216
|
+
}}
|
|
217
|
+
testID="list-detail-list-pane"
|
|
218
|
+
>
|
|
219
|
+
{/* The pane has no Stack header, so it insets itself where it meets the screen edges. */}
|
|
220
|
+
<SafeAreaView edges={["top", "left", "bottom"]} style={{flex: 1}}>
|
|
221
|
+
{list}
|
|
222
|
+
</SafeAreaView>
|
|
223
|
+
</View>
|
|
224
|
+
) : null}
|
|
225
|
+
<View style={{flex: 1, minWidth: 0}} testID="list-detail-detail-pane">
|
|
226
|
+
<Stack screenOptions={mergeSplitScreenOptions(isSplit, screenOptions)}>{children}</Stack>
|
|
227
|
+
</View>
|
|
228
|
+
</View>
|
|
229
|
+
</ListDetailContext.Provider>
|
|
230
|
+
);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The route group's `index.tsx` screen. Shows the list when stacked, and the empty detail
|
|
235
|
+
* state when the list already sits in the left pane.
|
|
236
|
+
*/
|
|
237
|
+
export const ListDetailIndex: FC = () => {
|
|
238
|
+
const {emptyDetail, isSplit, list} = useListDetailContext();
|
|
239
|
+
if (!isSplit) {
|
|
240
|
+
return list;
|
|
241
|
+
}
|
|
242
|
+
return (
|
|
243
|
+
<View style={{flex: 1}} testID="list-detail-empty">
|
|
244
|
+
{emptyDetail}
|
|
245
|
+
</View>
|
|
246
|
+
);
|
|
247
|
+
};
|
package/src/MarkdownEditor.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import {ScrollView, useWindowDimensions} from "react-native";
|
|
|
3
3
|
import {Box} from "./Box";
|
|
4
4
|
import {Heading} from "./Heading";
|
|
5
5
|
import {MarkdownView} from "./MarkdownView";
|
|
6
|
+
import {isSupportedDesktopWidth} from "./MediaQuery";
|
|
6
7
|
import {TextField} from "./TextField";
|
|
7
8
|
|
|
8
9
|
interface MarkdownEditorProps {
|
|
@@ -30,7 +31,7 @@ export const MarkdownEditor: React.FC<MarkdownEditorProps> = ({
|
|
|
30
31
|
maxHeight = DEFAULT_MAX_HEIGHT,
|
|
31
32
|
}) => {
|
|
32
33
|
const {width} = useWindowDimensions();
|
|
33
|
-
const isDesktop = width
|
|
34
|
+
const isDesktop = isSupportedDesktopWidth({width});
|
|
34
35
|
|
|
35
36
|
const paneContainerStyle = {
|
|
36
37
|
flex: 1,
|