@terreno/ui 57.20.0 → 58.0.0-beta.1
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 +93 -0
- package/dist/ActionSheet.d.ts +9 -9
- package/dist/ActionSheet.d.ts.map +1 -1
- package/dist/ActionSheet.js +11 -4
- package/dist/ActionSheet.js.map +1 -1
- package/dist/AnnouncementNavigator.d.ts +7 -1
- package/dist/AnnouncementNavigator.d.ts.map +1 -1
- package/dist/AnnouncementNavigator.js +15 -16
- package/dist/AnnouncementNavigator.js.map +1 -1
- package/dist/Avatar.d.ts.map +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/Avatar.js.map +1 -1
- package/dist/Box.d.ts.map +1 -1
- package/dist/Box.js +3 -1
- package/dist/Box.js.map +1 -1
- package/dist/Common.d.ts +71 -39
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.d.ts.map +1 -1
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/ConsentNavigator.d.ts +5 -3
- package/dist/ConsentNavigator.d.ts.map +1 -1
- package/dist/ConsentNavigator.js +4 -4
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/CustomSelectField.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +37 -12
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js +6 -6
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DropdownPanel.d.ts +0 -5
- package/dist/DropdownPanel.d.ts.map +1 -1
- package/dist/DropdownPanel.js +0 -5
- package/dist/DropdownPanel.js.map +1 -1
- package/dist/FilterAccordion.d.ts.map +1 -1
- package/dist/FilterAccordion.js.map +1 -1
- package/dist/FilterBoolean.d.ts.map +1 -1
- package/dist/FilterBoolean.js.map +1 -1
- package/dist/FilterSelectMenu.js +1 -1
- package/dist/FilterSelectMenu.js.map +1 -1
- package/dist/GPTChat.d.ts.map +1 -1
- package/dist/GPTChat.js.map +1 -1
- package/dist/Heading.d.ts.map +1 -1
- package/dist/Heading.js +6 -12
- package/dist/Heading.js.map +1 -1
- package/dist/HeightField.d.ts.map +1 -1
- package/dist/HeightField.js +9 -9
- package/dist/HeightField.js.map +1 -1
- package/dist/Hyperlink.d.ts.map +1 -1
- package/dist/Hyperlink.js +6 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Image.d.ts +1 -1
- package/dist/MarkdownEditorField.d.ts.map +1 -1
- package/dist/MarkdownEditorField.js +1 -1
- package/dist/MarkdownEditorField.js.map +1 -1
- package/dist/OfflineBanner.d.ts +3 -2
- package/dist/OfflineBanner.d.ts.map +1 -1
- package/dist/OfflineBanner.js +3 -2
- package/dist/OfflineBanner.js.map +1 -1
- package/dist/OtpField.d.ts.map +1 -1
- package/dist/OtpField.js +4 -4
- package/dist/OtpField.js.map +1 -1
- package/dist/PickerSelect.d.ts +4 -4
- package/dist/PickerSelect.d.ts.map +1 -1
- package/dist/PickerSelect.js +9 -9
- package/dist/PickerSelect.js.map +1 -1
- package/dist/ProvisionalConsentSigner.d.ts +3 -2
- package/dist/ProvisionalConsentSigner.d.ts.map +1 -1
- package/dist/ProvisionalConsentSigner.js +2 -2
- package/dist/ProvisionalConsentSigner.js.map +1 -1
- package/dist/SidebarNavigation.js +2 -2
- package/dist/SidebarNavigation.js.map +1 -1
- package/dist/SidebarNavigation.native.js +2 -2
- package/dist/SidebarNavigation.native.js.map +1 -1
- package/dist/Skeleton.js.map +1 -1
- package/dist/TapToEdit.d.ts +1 -1
- package/dist/TapToEdit.d.ts.map +1 -1
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +27 -50
- package/dist/Text.js.map +1 -1
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js +4 -4
- package/dist/TextField.js.map +1 -1
- package/dist/Theme.d.ts.map +1 -1
- package/dist/Theme.js +16 -0
- package/dist/Theme.js.map +1 -1
- package/dist/ThumbsUpDownFeedback.d.ts.map +1 -1
- package/dist/ThumbsUpDownFeedback.js.map +1 -1
- package/dist/ToastNotifications.d.ts.map +1 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +1 -1
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/WebDropdownMenu.d.ts +3 -3
- package/dist/WebDropdownMenu.d.ts.map +1 -1
- package/dist/WebDropdownMenu.js +1 -1
- package/dist/WebDropdownMenu.js.map +1 -1
- package/dist/announcementPlatform.d.ts +5 -0
- package/dist/announcementPlatform.d.ts.map +1 -1
- package/dist/announcementPlatform.js +9 -0
- package/dist/announcementPlatform.js.map +1 -1
- package/dist/asks/AskCard.d.ts +2 -2
- package/dist/asks/AskCard.d.ts.map +1 -1
- package/dist/dataTableColumnWidths.d.ts +76 -0
- package/dist/dataTableColumnWidths.d.ts.map +1 -0
- package/dist/dataTableColumnWidths.js +181 -0
- package/dist/dataTableColumnWidths.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/login/LoginScreen.js.map +1 -1
- package/dist/requestClient.d.ts +71 -0
- package/dist/requestClient.d.ts.map +1 -0
- package/dist/requestClient.js +139 -0
- package/dist/requestClient.js.map +1 -0
- package/dist/security/PasswordCard.d.ts.map +1 -1
- package/dist/security/PasswordCard.js.map +1 -1
- package/dist/security/TwoFactorSettingsCard.d.ts.map +1 -1
- package/dist/security/TwoFactorSettingsCard.js +1 -1
- package/dist/security/TwoFactorSettingsCard.js.map +1 -1
- package/dist/signUp/SignUpScreen.js.map +1 -1
- package/dist/table/Table.d.ts.map +1 -1
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableTitle.d.ts.map +1 -1
- package/dist/table/TableTitle.js +2 -1
- package/dist/table/TableTitle.js.map +1 -1
- package/dist/textFontSizes.d.ts +12 -0
- package/dist/textFontSizes.d.ts.map +1 -0
- package/dist/textFontSizes.js +21 -0
- package/dist/textFontSizes.js.map +1 -0
- package/dist/useAcknowledgeAnnouncement.d.ts +8 -63
- package/dist/useAcknowledgeAnnouncement.d.ts.map +1 -1
- package/dist/useAcknowledgeAnnouncement.js +31 -80
- package/dist/useAcknowledgeAnnouncement.js.map +1 -1
- package/dist/useAnnouncements.d.ts +14 -47
- package/dist/useAnnouncements.d.ts.map +1 -1
- package/dist/useAnnouncements.js +30 -57
- package/dist/useAnnouncements.js.map +1 -1
- package/dist/useConsentForms.d.ts +6 -38
- package/dist/useConsentForms.d.ts.map +1 -1
- package/dist/useConsentForms.js +25 -48
- package/dist/useConsentForms.js.map +1 -1
- package/dist/useProvisionalConsent.d.ts +7 -58
- package/dist/useProvisionalConsent.d.ts.map +1 -1
- package/dist/useProvisionalConsent.js +57 -67
- package/dist/useProvisionalConsent.js.map +1 -1
- package/dist/useSubmitConsent.d.ts +9 -39
- package/dist/useSubmitConsent.d.ts.map +1 -1
- package/dist/useSubmitConsent.js +10 -39
- package/dist/useSubmitConsent.js.map +1 -1
- package/package.json +40 -38
- package/src/ActionSheet.test.tsx +13 -13
- package/src/ActionSheet.tsx +18 -5
- package/src/AddressField.test.tsx +9 -3
- package/src/AnnouncementNavigator.test.tsx +219 -319
- package/src/AnnouncementNavigator.tsx +25 -20
- package/src/Avatar.tsx +2 -9
- package/src/Badge.test.tsx +1 -1
- package/src/Banner.test.tsx +0 -1
- package/src/Box.test.tsx +85 -77
- package/src/Box.tsx +4 -2
- package/src/Button.test.tsx +11 -6
- package/src/Card.test.tsx +2 -2
- package/src/Common.ts +79 -44
- package/src/ConflictSheet.test.tsx +5 -5
- package/src/ConsentFormScreen.test.tsx +3 -1
- package/src/ConsentFormScreen.tsx +2 -1
- package/src/ConsentNavigator.test.tsx +166 -243
- package/src/ConsentNavigator.tsx +9 -13
- package/src/CustomSelectField.test.tsx +16 -4
- package/src/CustomSelectField.tsx +3 -3
- package/src/DataTable.test.tsx +73 -5
- package/src/DataTable.tsx +72 -19
- package/src/DataTableVirtualizationRegression.test.tsx +1 -0
- package/src/DateTimeActionSheet.test.tsx +2 -0
- package/src/DateTimeField.test.tsx +3 -12
- package/src/DateTimeField.tsx +10 -10
- package/src/DismissButton.test.tsx +22 -4
- package/src/DropdownPanel.tsx +0 -6
- package/src/EmailField.test.tsx +13 -22
- package/src/EmojiSelector.test.tsx +2 -2
- package/src/ErrorBoundary.test.tsx +5 -3
- package/src/Field.test.tsx +20 -44
- package/src/FilterAccordion.tsx +3 -3
- package/src/FilterBoolean.tsx +3 -3
- package/src/FilterSelectMenu.tsx +1 -1
- package/src/GPTChat.test.tsx +24 -16
- package/src/GPTChat.tsx +10 -9
- package/src/Heading.test.tsx +1 -1
- package/src/Heading.tsx +7 -14
- package/src/HeightField.tsx +17 -10
- package/src/Hyperlink.tsx +6 -3
- package/src/Icon.test.tsx +2 -2
- package/src/Image.test.tsx +1 -1
- package/src/Link.test.tsx +13 -6
- package/src/MarkdownEditorField.tsx +10 -2
- package/src/MarkdownView.test.tsx +10 -6
- package/src/MobileAddressAutoComplete.test.tsx +2 -1
- package/src/Modal.test.tsx +10 -3
- package/src/ModalSheet.test.tsx +11 -10
- package/src/MultiselectField.test.tsx +17 -3
- package/src/NumberField.test.tsx +14 -14
- package/src/NumberPickerActionSheet.test.tsx +1 -1
- package/src/OfflineBanner.tsx +3 -2
- package/src/OpenAPIContext.test.tsx +4 -4
- package/src/OpenAPIRenderRegression.test.tsx +1 -1
- package/src/OtpField.tsx +6 -5
- package/src/P0RenderRegression.test.tsx +7 -1
- package/src/P1RenderRegression.test.tsx +1 -0
- package/src/P2ButtonRenderRegression.test.tsx +1 -0
- package/src/Page.test.tsx +1 -1
- package/src/PhoneNumberField.test.tsx +14 -38
- package/src/PickerSelect.tsx +12 -11
- package/src/Popover.test.tsx +2 -2
- package/src/ProvisionalConsentSigner.test.tsx +140 -113
- package/src/ProvisionalConsentSigner.tsx +5 -4
- package/src/RadioField.test.tsx +7 -2
- package/src/SegmentedControl.test.tsx +21 -12
- package/src/SidebarNavigation.native.tsx +2 -2
- package/src/SidebarNavigation.test.tsx +18 -6
- package/src/SidebarNavigation.tsx +2 -2
- package/src/Signature.test.tsx +20 -23
- package/src/Skeleton.tsx +1 -1
- package/src/Slider.test.tsx +1 -1
- package/src/SplitPage.test.tsx +15 -5
- package/src/TapToEdit.test.tsx +40 -17
- package/src/TapToEdit.tsx +1 -1
- package/src/TerrenoFontProvider.test.tsx +1 -1
- package/src/Text.test.tsx +4 -4
- package/src/Text.tsx +25 -51
- package/src/TextField.test.tsx +82 -9
- package/src/TextField.tsx +6 -5
- package/src/Theme.test.tsx +49 -0
- package/src/Theme.tsx +16 -0
- package/src/ThumbsUpDownFeedback.tsx +3 -3
- package/src/Toast.test.tsx +5 -5
- package/src/ToastNotifications.test.tsx +73 -70
- package/src/ToastNotifications.tsx +3 -2
- package/src/ToastNotifications.webModal.test.tsx +6 -3
- package/src/Tooltip.test.tsx +3 -3
- package/src/Tooltip.tsx +2 -1
- package/src/UnifiedAddressAutoComplete.test.tsx +1 -1
- package/src/UserInactivity.test.tsx +1 -0
- package/src/WebAddressAutocomplete.test.tsx +12 -12
- package/src/WebAddressAutocomplete.tsx +3 -3
- package/src/WebDropdownMenu.test.tsx +16 -15
- package/src/WebDropdownMenu.tsx +16 -5
- package/src/__snapshots__/Card.test.tsx.snap +1 -1
- package/src/__snapshots__/DataTable.test.tsx.snap +13 -0
- package/src/__snapshots__/DismissButton.test.tsx.snap +3 -3
- package/src/__snapshots__/Field.test.tsx.snap +4 -2
- package/src/__snapshots__/Heading.test.tsx.snap +1 -1
- package/src/__snapshots__/Image.test.tsx.snap +1 -1
- package/src/__snapshots__/Page.test.tsx.snap +2 -2
- package/src/__snapshots__/Text.test.tsx.snap +1 -1
- package/src/announcementPlatform.ts +10 -0
- package/src/asks/AskCard.test.tsx +20 -15
- package/src/asks/AskCard.tsx +2 -2
- package/src/asks/AskFiles.test.tsx +5 -1
- package/src/asks/askFileRefs.test.ts +1 -1
- package/src/asks/askSummary.test.ts +2 -2
- package/src/benchmarks/importTiming.ts +1 -1
- package/src/blocks/BlocksView.test.tsx +20 -11
- package/src/bunSetup.ts +43 -1
- package/src/dataTableColumnWidths.test.ts +266 -0
- package/src/dataTableColumnWidths.ts +272 -0
- package/src/dataTableFilters.test.tsx +1 -1
- package/src/index.tsx +9 -2
- package/src/isolated/ListDetailLayout.isolated.tsx +2 -4
- package/src/login/LoginScreen.test.tsx +6 -6
- package/src/login/LoginScreen.tsx +2 -2
- package/src/requestClient.test.ts +288 -0
- package/src/requestClient.ts +228 -0
- package/src/security/PasswordCard.test.tsx +3 -3
- package/src/security/PasswordCard.tsx +7 -5
- package/src/security/TwoFactorSettingsCard.tsx +10 -3
- package/src/signUp/SignUpScreen.test.tsx +4 -4
- package/src/signUp/SignUpScreen.tsx +2 -2
- package/src/table/Table.tsx +1 -2
- package/src/table/TableTitle.tsx +2 -1
- package/src/table/tableContext.test.tsx +5 -5
- package/src/test-utils.tsx +132 -1
- package/src/testing/reactDomServer.d.ts +7 -0
- package/src/textFontSizes.ts +31 -0
- package/src/useAcknowledgeAnnouncement.test.ts +101 -193
- package/src/useAcknowledgeAnnouncement.ts +69 -147
- package/src/useAnnouncements.test.ts +122 -186
- package/src/useAnnouncements.ts +49 -105
- package/src/useConsentForms.test.ts +59 -112
- package/src/useConsentForms.ts +37 -87
- package/src/useProvisionalConsent.test.ts +74 -150
- package/src/useProvisionalConsent.ts +79 -125
- package/src/useSubmitConsent.test.ts +59 -85
- package/src/useSubmitConsent.ts +22 -77
|
@@ -351,7 +351,7 @@ describe("EmojiSelector", () => {
|
|
|
351
351
|
},
|
|
352
352
|
];
|
|
353
353
|
const getItemMock = mock(async () => JSON.stringify(existing));
|
|
354
|
-
const setItemMock = mock(async () => undefined);
|
|
354
|
+
const setItemMock = mock(async (_key: string, _value: string) => undefined);
|
|
355
355
|
const originalGetItem = AsyncStorage.getItem;
|
|
356
356
|
const originalSetItem = AsyncStorage.setItem;
|
|
357
357
|
AsyncStorage.getItem = getItemMock as unknown as typeof AsyncStorage.getItem;
|
|
@@ -396,7 +396,7 @@ describe("EmojiSelector", () => {
|
|
|
396
396
|
const onEmojiSelected = mock(() => {});
|
|
397
397
|
const originalGetItem = AsyncStorage.getItem;
|
|
398
398
|
const originalSetItem = AsyncStorage.setItem;
|
|
399
|
-
const setItemMock = mock(async () => undefined);
|
|
399
|
+
const setItemMock = mock(async (_key: string, _value: string) => undefined);
|
|
400
400
|
AsyncStorage.setItem = setItemMock as unknown as typeof AsyncStorage.setItem;
|
|
401
401
|
try {
|
|
402
402
|
const {root, UNSAFE_getAllByType} = renderWithTheme(
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {afterAll, beforeAll, describe, expect, it, mock, spyOn} from "bun:test";
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
|
+
import type {ErrorPageProps} from "./Common";
|
|
4
5
|
import {ErrorBoundary} from "./ErrorBoundary";
|
|
5
6
|
import {ErrorPage} from "./ErrorPage";
|
|
6
7
|
import {Text} from "./Text";
|
|
7
|
-
import {renderWithTheme} from "./test-utils";
|
|
8
|
+
import {elementProps, renderWithTheme} from "./test-utils";
|
|
8
9
|
|
|
9
10
|
describe("ErrorBoundary", () => {
|
|
10
11
|
// Suppress console.warn during tests
|
|
@@ -89,7 +90,8 @@ describe("ErrorBoundary", () => {
|
|
|
89
90
|
const renderedElement = boundary.render() as React.ReactElement;
|
|
90
91
|
|
|
91
92
|
expect(renderedElement.type).toBe(ErrorPage);
|
|
92
|
-
|
|
93
|
-
expect(
|
|
93
|
+
const pageProps = elementProps<ErrorPageProps>(renderedElement);
|
|
94
|
+
expect(pageProps.error).toBe(error);
|
|
95
|
+
expect(typeof pageProps.resetError).toBe("function");
|
|
94
96
|
});
|
|
95
97
|
});
|
package/src/Field.test.tsx
CHANGED
|
@@ -6,33 +6,23 @@ import {renderWithTheme} from "./test-utils";
|
|
|
6
6
|
|
|
7
7
|
describe("Field", () => {
|
|
8
8
|
it("renders text field by default", () => {
|
|
9
|
-
const {toJSON} = renderWithTheme(<Field
|
|
9
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} value="" />);
|
|
10
10
|
expect(toJSON()).toMatchSnapshot();
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it("renders text field with type text", () => {
|
|
14
|
-
const {toJSON} = renderWithTheme(
|
|
15
|
-
<Field label="Name" onChange={() => {}} type="text" value="" />
|
|
16
|
-
);
|
|
14
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="text" value="" />);
|
|
17
15
|
expect(toJSON()).toMatchSnapshot();
|
|
18
16
|
});
|
|
19
17
|
|
|
20
18
|
it("renders password field", () => {
|
|
21
|
-
const {toJSON} = renderWithTheme(
|
|
22
|
-
<Field label="Password" onChange={() => {}} type="password" value="" />
|
|
23
|
-
);
|
|
19
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="password" value="" />);
|
|
24
20
|
expect(toJSON()).toMatchSnapshot();
|
|
25
21
|
});
|
|
26
22
|
|
|
27
23
|
it("reveals the password value from the visibility toggle", () => {
|
|
28
24
|
const {getByDisplayValue, getByTestId} = renderWithTheme(
|
|
29
|
-
<Field
|
|
30
|
-
label="Password"
|
|
31
|
-
onChange={() => {}}
|
|
32
|
-
testID="field-password"
|
|
33
|
-
type="password"
|
|
34
|
-
value="hunter2"
|
|
35
|
-
/>
|
|
25
|
+
<Field onChange={() => {}} testID="field-password" type="password" value="hunter2" />
|
|
36
26
|
);
|
|
37
27
|
|
|
38
28
|
expect(getByDisplayValue("hunter2").props.secureTextEntry).toBe(true);
|
|
@@ -42,58 +32,46 @@ describe("Field", () => {
|
|
|
42
32
|
});
|
|
43
33
|
|
|
44
34
|
it("renders email field", () => {
|
|
45
|
-
const {toJSON} = renderWithTheme(
|
|
46
|
-
<Field label="Email" onChange={() => {}} type="email" value="" />
|
|
47
|
-
);
|
|
35
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="email" value="" />);
|
|
48
36
|
expect(toJSON()).toMatchSnapshot();
|
|
49
37
|
});
|
|
50
38
|
|
|
51
39
|
it("renders url field", () => {
|
|
52
|
-
const {toJSON} = renderWithTheme(
|
|
53
|
-
<Field label="Website" onChange={() => {}} type="url" value="" />
|
|
54
|
-
);
|
|
40
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="url" value="" />);
|
|
55
41
|
expect(toJSON()).toMatchSnapshot();
|
|
56
42
|
});
|
|
57
43
|
|
|
58
44
|
it("renders number field", () => {
|
|
59
|
-
const {toJSON} = renderWithTheme(
|
|
60
|
-
<Field label="Age" onChange={() => {}} type="number" value="" />
|
|
61
|
-
);
|
|
45
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="number" value="" />);
|
|
62
46
|
expect(toJSON()).toMatchSnapshot();
|
|
63
47
|
});
|
|
64
48
|
|
|
65
49
|
it("renders textarea field", () => {
|
|
66
|
-
const {toJSON} = renderWithTheme(
|
|
67
|
-
<Field label="Description" onChange={() => {}} type="textarea" value="" />
|
|
68
|
-
);
|
|
50
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="textarea" value="" />);
|
|
69
51
|
expect(toJSON()).toMatchSnapshot();
|
|
70
52
|
});
|
|
71
53
|
|
|
72
54
|
it("renders boolean field", () => {
|
|
73
55
|
const handleChange = mock((_value: boolean) => {});
|
|
74
56
|
const {toJSON} = renderWithTheme(
|
|
75
|
-
<Field
|
|
57
|
+
<Field onChange={handleChange} type="boolean" value={false} />
|
|
76
58
|
);
|
|
77
59
|
expect(toJSON()).toMatchSnapshot();
|
|
78
60
|
});
|
|
79
61
|
|
|
80
62
|
it("renders date field", () => {
|
|
81
|
-
const {toJSON} = renderWithTheme(
|
|
82
|
-
<Field label="Birth Date" onChange={() => {}} type="date" value={null} />
|
|
83
|
-
);
|
|
63
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="date" value={undefined} />);
|
|
84
64
|
expect(toJSON()).toMatchSnapshot();
|
|
85
65
|
});
|
|
86
66
|
|
|
87
67
|
it("renders time field", () => {
|
|
88
|
-
const {toJSON} = renderWithTheme(
|
|
89
|
-
<Field label="Start Time" onChange={() => {}} type="time" value={null} />
|
|
90
|
-
);
|
|
68
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="time" value={undefined} />);
|
|
91
69
|
expect(toJSON()).toMatchSnapshot();
|
|
92
70
|
});
|
|
93
71
|
|
|
94
72
|
it("renders datetime field", () => {
|
|
95
73
|
const {toJSON} = renderWithTheme(
|
|
96
|
-
<Field
|
|
74
|
+
<Field onChange={() => {}} type="datetime" value={undefined} />
|
|
97
75
|
);
|
|
98
76
|
expect(toJSON()).toMatchSnapshot();
|
|
99
77
|
});
|
|
@@ -101,7 +79,6 @@ describe("Field", () => {
|
|
|
101
79
|
it("renders select field", () => {
|
|
102
80
|
const {toJSON} = renderWithTheme(
|
|
103
81
|
<Field
|
|
104
|
-
label="Country"
|
|
105
82
|
onChange={() => {}}
|
|
106
83
|
options={[
|
|
107
84
|
{label: "USA", value: "us"},
|
|
@@ -117,12 +94,12 @@ describe("Field", () => {
|
|
|
117
94
|
it("renders multiselect field", () => {
|
|
118
95
|
const {toJSON} = renderWithTheme(
|
|
119
96
|
<Field
|
|
120
|
-
label="Skills"
|
|
121
97
|
onChange={() => {}}
|
|
122
98
|
options={[
|
|
123
99
|
{label: "JavaScript", value: "js"},
|
|
124
100
|
{label: "Python", value: "py"},
|
|
125
101
|
]}
|
|
102
|
+
title="Skills"
|
|
126
103
|
type="multiselect"
|
|
127
104
|
value={[]}
|
|
128
105
|
/>
|
|
@@ -132,22 +109,23 @@ describe("Field", () => {
|
|
|
132
109
|
|
|
133
110
|
it("renders address field", () => {
|
|
134
111
|
const {toJSON} = renderWithTheme(
|
|
135
|
-
<Field
|
|
112
|
+
<Field
|
|
113
|
+
onChange={() => {}}
|
|
114
|
+
type="address"
|
|
115
|
+
value={{address1: "", city: "", state: "", zipcode: ""}}
|
|
116
|
+
/>
|
|
136
117
|
);
|
|
137
118
|
expect(toJSON()).toMatchSnapshot();
|
|
138
119
|
});
|
|
139
120
|
|
|
140
121
|
it("renders phoneNumber field", () => {
|
|
141
|
-
const {toJSON} = renderWithTheme(
|
|
142
|
-
<Field label="Phone" onChange={() => {}} type="phoneNumber" value="" />
|
|
143
|
-
);
|
|
122
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="phoneNumber" value="" />);
|
|
144
123
|
expect(toJSON()).toMatchSnapshot();
|
|
145
124
|
});
|
|
146
125
|
|
|
147
126
|
it("renders customSelect field", () => {
|
|
148
127
|
const {toJSON} = renderWithTheme(
|
|
149
128
|
<Field
|
|
150
|
-
label="Custom"
|
|
151
129
|
onChange={() => {}}
|
|
152
130
|
options={[
|
|
153
131
|
{label: "Option A", value: "a"},
|
|
@@ -161,9 +139,7 @@ describe("Field", () => {
|
|
|
161
139
|
});
|
|
162
140
|
|
|
163
141
|
it("renders signature field", () => {
|
|
164
|
-
const {toJSON} = renderWithTheme(
|
|
165
|
-
<Field label="Sign here" onChange={() => {}} type="signature" value="" />
|
|
166
|
-
);
|
|
142
|
+
const {toJSON} = renderWithTheme(<Field onChange={() => {}} type="signature" value="" />);
|
|
167
143
|
expect(toJSON()).toMatchSnapshot();
|
|
168
144
|
});
|
|
169
145
|
});
|
package/src/FilterAccordion.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type FC, useState} from "react";
|
|
1
|
+
import {type ComponentProps, type FC, useState} from "react";
|
|
2
2
|
import {Pressable, View} from "react-native";
|
|
3
3
|
|
|
4
4
|
import type {FilterAccordionProps} from "./Common";
|
|
@@ -12,7 +12,7 @@ import {resolveTestID} from "./testing/resolveTestId";
|
|
|
12
12
|
// Native Web forwards it. A disclosure button needs its own spacebar handler
|
|
13
13
|
// (per ARIA, Space activates it) since role="button" only activates on Enter.
|
|
14
14
|
interface WebKeyDownEvent {
|
|
15
|
-
key
|
|
15
|
+
key?: string;
|
|
16
16
|
preventDefault: () => void;
|
|
17
17
|
repeat?: boolean;
|
|
18
18
|
}
|
|
@@ -83,7 +83,7 @@ export const FilterAccordion: FC<FilterAccordionProps> = ({
|
|
|
83
83
|
testID={testID}
|
|
84
84
|
>
|
|
85
85
|
<Pressable
|
|
86
|
-
{...webKeyDownProps}
|
|
86
|
+
{...(webKeyDownProps as Pick<ComponentProps<typeof Pressable>, "onKeyDown">)}
|
|
87
87
|
accessibilityRole="button"
|
|
88
88
|
accessibilityState={{expanded: isExpanded}}
|
|
89
89
|
aria-expanded={isExpanded}
|
package/src/FilterBoolean.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {type FC, useState} from "react";
|
|
1
|
+
import {type ComponentProps, type FC, useState} from "react";
|
|
2
2
|
import {Pressable, View} from "react-native";
|
|
3
3
|
|
|
4
4
|
import type {FilterBooleanProps} from "./Common";
|
|
@@ -11,7 +11,7 @@ import {resolveTestID} from "./testing/resolveTestId";
|
|
|
11
11
|
// Native Web forwards it. A switch needs its own spacebar handler (per ARIA,
|
|
12
12
|
// Space toggles it) since role="switch" only activates on Enter on the web.
|
|
13
13
|
interface WebKeyDownEvent {
|
|
14
|
-
key
|
|
14
|
+
key?: string;
|
|
15
15
|
preventDefault: () => void;
|
|
16
16
|
repeat?: boolean;
|
|
17
17
|
}
|
|
@@ -74,7 +74,7 @@ export const FilterBoolean: FC<FilterBooleanProps> = ({
|
|
|
74
74
|
|
|
75
75
|
return (
|
|
76
76
|
<Pressable
|
|
77
|
-
{...webKeyDownProps}
|
|
77
|
+
{...(webKeyDownProps as Pick<ComponentProps<typeof Pressable>, "onKeyDown">)}
|
|
78
78
|
accessibilityRole="switch"
|
|
79
79
|
accessibilityState={{checked: value, disabled}}
|
|
80
80
|
aria-checked={value}
|
package/src/FilterSelectMenu.tsx
CHANGED
|
@@ -63,7 +63,7 @@ export const FilterSelectMenu: FC<FilterSelectMenuProps> = ({
|
|
|
63
63
|
onChange={onChange}
|
|
64
64
|
options={options}
|
|
65
65
|
placeholder={placeholder}
|
|
66
|
-
// The
|
|
66
|
+
// The DropdownPanel is a fixed portal on document.body (zIndex 9999).
|
|
67
67
|
// Render the menu in a matching body portal so it floats above the
|
|
68
68
|
// panel instead of a React Native Modal that would stack behind it.
|
|
69
69
|
renderMenuInBodyPortal
|
package/src/GPTChat.test.tsx
CHANGED
|
@@ -4,15 +4,22 @@ import {act, fireEvent, render, waitFor, within} from "@testing-library/react-na
|
|
|
4
4
|
import {assert} from "chai";
|
|
5
5
|
import {setImageAsync, setStringAsync} from "expo-clipboard";
|
|
6
6
|
import React from "react";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import {
|
|
8
|
+
AccessibilityInfo,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
Platform,
|
|
11
|
+
Pressable,
|
|
12
|
+
ScrollView,
|
|
13
|
+
type TextProps,
|
|
14
|
+
} from "react-native";
|
|
15
|
+
|
|
16
|
+
import type {AskSubmission, ChatAsk, ChatAskState} from "./asks/askTypes";
|
|
10
17
|
import type {SelectedFile} from "./FilePickerButton";
|
|
11
18
|
import type {GPTChatHistory, GPTChatMessage, GPTChatProps, MessageContentPart} from "./GPTChat";
|
|
12
19
|
import {GPTChat} from "./GPTChat";
|
|
13
20
|
import {Text} from "./Text";
|
|
14
21
|
import {ThemeProvider} from "./Theme";
|
|
15
|
-
import {renderWithTheme} from "./test-utils";
|
|
22
|
+
import {elementProps, findAllByHostType, renderWithTheme} from "./test-utils";
|
|
16
23
|
|
|
17
24
|
const mockedSetImageAsync = setImageAsync as unknown as ReturnType<typeof mock>;
|
|
18
25
|
const mockedSetStringAsync = setStringAsync as unknown as ReturnType<typeof mock>;
|
|
@@ -588,7 +595,7 @@ describe("GPTChat", () => {
|
|
|
588
595
|
const link = {click: () => clicked.push("click"), download: "", href: ""};
|
|
589
596
|
const appended: unknown[] = [];
|
|
590
597
|
const removed: unknown[] = [];
|
|
591
|
-
const domGlobals = globalThis as
|
|
598
|
+
const domGlobals = globalThis as unknown as {
|
|
592
599
|
document?: unknown;
|
|
593
600
|
window?: unknown;
|
|
594
601
|
};
|
|
@@ -626,7 +633,7 @@ describe("GPTChat", () => {
|
|
|
626
633
|
role: "assistant",
|
|
627
634
|
},
|
|
628
635
|
];
|
|
629
|
-
const domGlobals = globalThis as
|
|
636
|
+
const domGlobals = globalThis as unknown as {window?: unknown};
|
|
630
637
|
const originalWindow = domGlobals.window;
|
|
631
638
|
domGlobals.window = undefined;
|
|
632
639
|
|
|
@@ -1021,7 +1028,7 @@ describe("GPTChat asks", () => {
|
|
|
1021
1028
|
title: "Choose a plan",
|
|
1022
1029
|
};
|
|
1023
1030
|
|
|
1024
|
-
const planAsk = (state: Partial<
|
|
1031
|
+
const planAsk = (state: Partial<ChatAskState> & {input?: ChoiceAskInput} = {}): ChatAsk => ({
|
|
1025
1032
|
input: PLAN_INPUT,
|
|
1026
1033
|
kind: "choice",
|
|
1027
1034
|
status: "pending",
|
|
@@ -1407,8 +1414,9 @@ describe("GPTChat asks", () => {
|
|
|
1407
1414
|
|
|
1408
1415
|
rerender(chatWith({historyId: "h2", onAskSubmit, toolCallId: "call_second"}));
|
|
1409
1416
|
|
|
1410
|
-
const spinners =
|
|
1411
|
-
(
|
|
1417
|
+
const spinners = findAllByHostType(
|
|
1418
|
+
getByTestId("gpt-ask-call_second-submit"),
|
|
1419
|
+
"ActivityIndicator"
|
|
1412
1420
|
);
|
|
1413
1421
|
assert.lengthOf(spinners, 0);
|
|
1414
1422
|
assert.isFalse(isDisabled(getByTestId("gpt-ask-call_second-button-skip")));
|
|
@@ -1429,8 +1437,8 @@ describe("GPTChat asks", () => {
|
|
|
1429
1437
|
/>,
|
|
1430
1438
|
{
|
|
1431
1439
|
createNodeMock: (element) =>
|
|
1432
|
-
element.
|
|
1433
|
-
element.
|
|
1440
|
+
elementProps<TextProps>(element).accessibilityRole === "header" &&
|
|
1441
|
+
elementProps<TextProps>(element).children === PLAN_INPUT.prompt
|
|
1434
1442
|
? 42
|
|
1435
1443
|
: scrollable,
|
|
1436
1444
|
wrapper: ThemeProvider,
|
|
@@ -1480,7 +1488,7 @@ describe("GPTChat asks", () => {
|
|
|
1480
1488
|
|
|
1481
1489
|
it("leaves assistant markdown in place when uiBlocks is off", async () => {
|
|
1482
1490
|
const {queryByTestId, toJSON} = renderChat({
|
|
1483
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1491
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1484
1492
|
});
|
|
1485
1493
|
assert.isNull(queryByTestId("gpt-blocks-m1"));
|
|
1486
1494
|
await waitFor(() => {
|
|
@@ -1492,7 +1500,7 @@ describe("GPTChat asks", () => {
|
|
|
1492
1500
|
const onSubmit = mock(() => {});
|
|
1493
1501
|
const onBlockAction = mock(() => {});
|
|
1494
1502
|
const {getByText} = renderChat({
|
|
1495
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1503
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1496
1504
|
onBlockAction,
|
|
1497
1505
|
onSubmit,
|
|
1498
1506
|
uiBlocks: true,
|
|
@@ -1526,7 +1534,7 @@ describe("GPTChat asks", () => {
|
|
|
1526
1534
|
})
|
|
1527
1535
|
);
|
|
1528
1536
|
const {getByTestId, getByText, queryByText} = renderChat({
|
|
1529
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1537
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1530
1538
|
hostActions: ["export_csv"],
|
|
1531
1539
|
onBlockCallback,
|
|
1532
1540
|
uiBlocks: true,
|
|
@@ -1558,7 +1566,7 @@ describe("GPTChat asks", () => {
|
|
|
1558
1566
|
it("appends an assistant message when a callback returns text", async () => {
|
|
1559
1567
|
const onBlockCallback = mock(async () => ({text: "Export started"}));
|
|
1560
1568
|
const {getByText} = renderChat({
|
|
1561
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1569
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1562
1570
|
hostActions: ["export_csv"],
|
|
1563
1571
|
onBlockCallback,
|
|
1564
1572
|
uiBlocks: true,
|
|
@@ -1613,7 +1621,7 @@ describe("GPTChat asks", () => {
|
|
|
1613
1621
|
})
|
|
1614
1622
|
);
|
|
1615
1623
|
const props = {
|
|
1616
|
-
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant"}],
|
|
1624
|
+
currentMessages: [{content: BLOCKS_REPLY, id: "m1", role: "assistant" as const}],
|
|
1617
1625
|
histories,
|
|
1618
1626
|
hostActions: ["export_csv"],
|
|
1619
1627
|
onBlockCallback,
|
package/src/GPTChat.tsx
CHANGED
|
@@ -11,12 +11,13 @@ import React, {useCallback, useEffect, useRef, useState} from "react";
|
|
|
11
11
|
import {
|
|
12
12
|
AccessibilityInfo,
|
|
13
13
|
findNodeHandle,
|
|
14
|
-
type Text as NativeText,
|
|
15
14
|
Platform,
|
|
16
15
|
Image as RNImage,
|
|
17
|
-
type
|
|
18
|
-
type
|
|
16
|
+
type ScrollViewInstance,
|
|
17
|
+
type TextInputInstance,
|
|
18
|
+
type TextInstance,
|
|
19
19
|
View,
|
|
20
|
+
type ViewInstance,
|
|
20
21
|
} from "react-native";
|
|
21
22
|
|
|
22
23
|
import {AttachmentPreview} from "./AttachmentPreview";
|
|
@@ -1020,10 +1021,10 @@ const AskFocusTarget = ({
|
|
|
1020
1021
|
renderCard,
|
|
1021
1022
|
}: {
|
|
1022
1023
|
label: string;
|
|
1023
|
-
renderCard: (promptRef: React.RefObject<
|
|
1024
|
+
renderCard: (promptRef: React.RefObject<TextInstance | null>) => React.ReactElement;
|
|
1024
1025
|
}): React.ReactElement => {
|
|
1025
|
-
const viewRef = useRef<
|
|
1026
|
-
const promptRef = useRef<
|
|
1026
|
+
const viewRef = useRef<ViewInstance>(null);
|
|
1027
|
+
const promptRef = useRef<TextInstance>(null);
|
|
1027
1028
|
|
|
1028
1029
|
// Focus the ask once, when it mounts; later renders of the same ask leave focus alone.
|
|
1029
1030
|
useEffect(() => {
|
|
@@ -1064,7 +1065,7 @@ const AskTranscriptItem = ({
|
|
|
1064
1065
|
onAskSubmit?: AskSubmitHandler;
|
|
1065
1066
|
resolveAskFiles?: AskFilesResolver;
|
|
1066
1067
|
}): React.ReactElement => {
|
|
1067
|
-
const renderCard = (promptRef?: React.Ref<
|
|
1068
|
+
const renderCard = (promptRef?: React.Ref<TextInstance>): React.ReactElement => (
|
|
1068
1069
|
<AskCard
|
|
1069
1070
|
ask={ask}
|
|
1070
1071
|
errors={errors}
|
|
@@ -1453,7 +1454,7 @@ export const GPTChat = ({
|
|
|
1453
1454
|
const [inputValue, setInputValue] = useState("");
|
|
1454
1455
|
const [editingHistoryId, setEditingHistoryId] = useState<string | null>(null);
|
|
1455
1456
|
const [editingTitle, setEditingTitle] = useState("");
|
|
1456
|
-
const scrollViewRef = useRef<
|
|
1457
|
+
const scrollViewRef = useRef<ScrollViewInstance>(null);
|
|
1457
1458
|
const [isScrolledUp, setIsScrolledUp] = useState(false);
|
|
1458
1459
|
const contentHeightRef = useRef(0);
|
|
1459
1460
|
const scrollOffsetRef = useRef(0);
|
|
@@ -1558,7 +1559,7 @@ export const GPTChat = ({
|
|
|
1558
1559
|
const [inputElement, setInputElement] = useState<HTMLElement | null>(null);
|
|
1559
1560
|
|
|
1560
1561
|
// On React Native Web the TextInput ref is the underlying DOM element.
|
|
1561
|
-
const handleInputRef = useCallback((ref:
|
|
1562
|
+
const handleInputRef = useCallback((ref: TextInputInstance | null) => {
|
|
1562
1563
|
setInputElement(ref as unknown as HTMLElement | null);
|
|
1563
1564
|
}, []);
|
|
1564
1565
|
|
package/src/Heading.test.tsx
CHANGED
|
@@ -50,7 +50,7 @@ describe("Heading", () => {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
it("applies secondary color", () => {
|
|
53
|
-
const {toJSON} = renderWithTheme(<Heading color="
|
|
53
|
+
const {toJSON} = renderWithTheme(<Heading color="secondaryDark">Secondary</Heading>);
|
|
54
54
|
expect(toJSON()).toMatchSnapshot();
|
|
55
55
|
});
|
|
56
56
|
|
package/src/Heading.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {Text as NativeText, Platform, type
|
|
2
|
+
import {Text as NativeText, Platform, type TextStyle} from "react-native";
|
|
3
3
|
|
|
4
4
|
import type {HeadingProps} from "./Common";
|
|
5
5
|
import {useTerrenoFontsLoaded} from "./TerrenoFontProvider";
|
|
@@ -34,19 +34,12 @@ const HeadingComponent = ({
|
|
|
34
34
|
const {theme} = useTheme();
|
|
35
35
|
useTerrenoFontsLoaded();
|
|
36
36
|
|
|
37
|
-
const style:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
style.fontSize = fontSizes[size || "md"].size;
|
|
46
|
-
if (align) {
|
|
47
|
-
style.textAlign = align;
|
|
48
|
-
}
|
|
49
|
-
style.color = theme.text[color];
|
|
37
|
+
const style: TextStyle = {
|
|
38
|
+
color: theme.text[color],
|
|
39
|
+
fontFamily: size === "sm" ? "heading-semibold" : "heading-bold",
|
|
40
|
+
fontSize: fontSizes[size || "md"].size,
|
|
41
|
+
...(align ? {textAlign: align} : {}),
|
|
42
|
+
};
|
|
50
43
|
|
|
51
44
|
// react-native-web turns role="heading" plus aria-level into <h1>-<h6>; native maps the role
|
|
52
45
|
// to the header accessibility role. RN's TextProps don't declare aria-level, hence the spread.
|
package/src/HeightField.tsx
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import {type FC, useCallback, useEffect, useMemo, useRef, useState} from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
Pressable,
|
|
5
|
+
type StyleProp,
|
|
6
|
+
TextInput,
|
|
7
|
+
type TextInputInstance,
|
|
8
|
+
View,
|
|
9
|
+
} from "react-native";
|
|
3
10
|
|
|
4
11
|
import type {ActionSheet} from "./ActionSheet";
|
|
5
12
|
import {Box} from "./Box";
|
|
@@ -57,7 +64,7 @@ interface HeightSegmentProps {
|
|
|
57
64
|
label: string;
|
|
58
65
|
disabled?: boolean;
|
|
59
66
|
maxValue: number;
|
|
60
|
-
inputRef?: (ref:
|
|
67
|
+
inputRef?: (ref: TextInputInstance | null) => void;
|
|
61
68
|
error?: boolean;
|
|
62
69
|
focused?: boolean;
|
|
63
70
|
}
|
|
@@ -92,11 +99,11 @@ const HeightSegment: FC<HeightSegmentProps> = ({
|
|
|
92
99
|
[onChange, maxValue]
|
|
93
100
|
);
|
|
94
101
|
|
|
95
|
-
let borderColor = focused ? theme.
|
|
102
|
+
let borderColor = focused ? theme.field.borderFocus : theme.field.border;
|
|
96
103
|
if (disabled) {
|
|
97
|
-
borderColor = theme.
|
|
104
|
+
borderColor = theme.field.borderDisabled;
|
|
98
105
|
} else if (error) {
|
|
99
|
-
borderColor = theme.
|
|
106
|
+
borderColor = theme.field.borderError;
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
return (
|
|
@@ -104,7 +111,7 @@ const HeightSegment: FC<HeightSegmentProps> = ({
|
|
|
104
111
|
<View
|
|
105
112
|
style={{
|
|
106
113
|
alignItems: "center",
|
|
107
|
-
backgroundColor: disabled ? theme.
|
|
114
|
+
backgroundColor: disabled ? theme.field.backgroundDisabled : theme.field.background,
|
|
108
115
|
borderColor,
|
|
109
116
|
borderRadius: 4,
|
|
110
117
|
borderWidth: focused ? 3 : 1,
|
|
@@ -244,11 +251,11 @@ export const HeightField: FC<HeightFieldProps> = ({
|
|
|
244
251
|
[]
|
|
245
252
|
);
|
|
246
253
|
|
|
247
|
-
let borderColor = theme.border
|
|
254
|
+
let borderColor = theme.field.border;
|
|
248
255
|
if (disabled) {
|
|
249
|
-
borderColor = theme.
|
|
256
|
+
borderColor = theme.field.borderDisabled;
|
|
250
257
|
} else if (errorText) {
|
|
251
|
-
borderColor = theme.
|
|
258
|
+
borderColor = theme.field.borderError;
|
|
252
259
|
}
|
|
253
260
|
|
|
254
261
|
if (isAndroid) {
|
|
@@ -299,7 +306,7 @@ export const HeightField: FC<HeightFieldProps> = ({
|
|
|
299
306
|
<View
|
|
300
307
|
style={{
|
|
301
308
|
alignItems: "center",
|
|
302
|
-
backgroundColor: disabled ? theme.
|
|
309
|
+
backgroundColor: disabled ? theme.field.backgroundDisabled : theme.field.background,
|
|
303
310
|
borderColor,
|
|
304
311
|
borderRadius: 4,
|
|
305
312
|
borderWidth: 1,
|
package/src/Hyperlink.tsx
CHANGED
|
@@ -178,9 +178,12 @@ export const Hyperlink = (props: HyperlinkProps) => {
|
|
|
178
178
|
urlObject.protocol = urlObject.protocol?.toLowerCase() ?? "";
|
|
179
179
|
const normalizedURL = mdurl.format(urlObject);
|
|
180
180
|
|
|
181
|
-
void Linking.canOpenURL(normalizedURL).then(
|
|
182
|
-
(supported)
|
|
183
|
-
|
|
181
|
+
void Linking.canOpenURL(normalizedURL).then((supported) => {
|
|
182
|
+
if (supported) {
|
|
183
|
+
return Linking.openURL(normalizedURL);
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
});
|
|
184
187
|
};
|
|
185
188
|
|
|
186
189
|
const onPress = handleLink || props.onPress;
|
package/src/Icon.test.tsx
CHANGED
|
@@ -25,7 +25,7 @@ describe("Icon", () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it("renders with different colors", () => {
|
|
28
|
-
const colors = ["primary", "
|
|
28
|
+
const colors = ["primary", "secondaryDark", "accent", "inverted", "error"] as const;
|
|
29
29
|
colors.forEach((color) => {
|
|
30
30
|
const {toJSON} = renderWithTheme(<Icon color={color} iconName="star" />);
|
|
31
31
|
expect(toJSON()).toMatchSnapshot();
|
|
@@ -53,7 +53,7 @@ describe("Icon", () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it("renders different icon names", () => {
|
|
56
|
-
const icons = ["check", "x", "star", "heart", "user", "
|
|
56
|
+
const icons = ["check", "x", "star", "heart", "user", "magnifying-glass"] as const;
|
|
57
57
|
icons.forEach((iconName) => {
|
|
58
58
|
const {toJSON} = renderWithTheme(<Icon iconName={iconName} />);
|
|
59
59
|
expect(toJSON()).toMatchSnapshot();
|
package/src/Image.test.tsx
CHANGED
|
@@ -51,7 +51,7 @@ describe("Image", () => {
|
|
|
51
51
|
|
|
52
52
|
it("renders with background color", () => {
|
|
53
53
|
const {toJSON} = renderWithTheme(
|
|
54
|
-
<Image color="
|
|
54
|
+
<Image color="secondaryDark" naturalWidth={200} src="https://example.com/image.jpg" />
|
|
55
55
|
);
|
|
56
56
|
expect(toJSON()).toMatchSnapshot();
|
|
57
57
|
});
|
package/src/Link.test.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import {describe, expect, it, mock, spyOn} from "bun:test";
|
|
|
2
2
|
import {fireEvent} from "@testing-library/react-native";
|
|
3
3
|
import {Linking} from "react-native";
|
|
4
4
|
|
|
5
|
+
import type {LinkProps} from "./Common";
|
|
5
6
|
import {Link} from "./Link";
|
|
6
7
|
import {renderWithTheme} from "./test-utils";
|
|
7
8
|
|
|
@@ -25,7 +26,7 @@ describe("Link", () => {
|
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
it("opens URL when href is provided and pressed", () => {
|
|
28
|
-
const openURLSpy = spyOn(Linking, "openURL").mockImplementation(() => Promise.resolve(
|
|
29
|
+
const openURLSpy = spyOn(Linking, "openURL").mockImplementation(() => Promise.resolve());
|
|
29
30
|
|
|
30
31
|
const {getByText} = renderWithTheme(<Link href="https://example.com" text="External Link" />);
|
|
31
32
|
|
|
@@ -37,11 +38,15 @@ describe("Link", () => {
|
|
|
37
38
|
|
|
38
39
|
it("prefers onClick over href when both are provided", () => {
|
|
39
40
|
const handleClick = mock(() => {});
|
|
40
|
-
const openURLSpy = spyOn(Linking, "openURL").mockImplementation(() => Promise.resolve(
|
|
41
|
+
const openURLSpy = spyOn(Linking, "openURL").mockImplementation(() => Promise.resolve());
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// LinkProps forbids href with onClick; untyped callers can still pass both.
|
|
44
|
+
const bothActionProps = {
|
|
45
|
+
href: "https://example.com",
|
|
46
|
+
onClick: handleClick,
|
|
47
|
+
text: "Both",
|
|
48
|
+
} as unknown as LinkProps;
|
|
49
|
+
const {getByText} = renderWithTheme(<Link {...bothActionProps} />);
|
|
45
50
|
|
|
46
51
|
fireEvent.press(getByText("Both"));
|
|
47
52
|
expect(handleClick).toHaveBeenCalled();
|
|
@@ -53,7 +58,9 @@ describe("Link", () => {
|
|
|
53
58
|
it("logs error when neither href nor onClick provided", () => {
|
|
54
59
|
const consoleErrorSpy = spyOn(console, "error").mockImplementation(() => {});
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
// LinkProps requires href or onClick; untyped callers can still omit both.
|
|
62
|
+
const noActionProps = {text: "No action"} as unknown as LinkProps;
|
|
63
|
+
renderWithTheme(<Link {...noActionProps} />);
|
|
57
64
|
|
|
58
65
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
59
66
|
"Link component requires either href or onClick prop"
|