@terreno/ui 57.2.0 → 57.4.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/README.md +17 -8
- package/dist/ActionSheet.d.ts +3 -3
- package/dist/ActionSheet.js +2 -2
- package/dist/ActionSheet.js.map +1 -1
- package/dist/AnnouncementBanner.d.ts +12 -0
- package/dist/AnnouncementBanner.js +61 -0
- package/dist/AnnouncementBanner.js.map +1 -0
- package/dist/AnnouncementNavigator.d.ts +11 -0
- package/dist/AnnouncementNavigator.js +189 -0
- package/dist/AnnouncementNavigator.js.map +1 -0
- package/dist/AnnouncementScreen.d.ts +12 -0
- package/dist/AnnouncementScreen.js +28 -0
- package/dist/AnnouncementScreen.js.map +1 -0
- package/dist/AreaChart.d.ts +5 -0
- package/dist/AreaChart.js +69 -0
- package/dist/AreaChart.js.map +1 -0
- package/dist/BarChart.d.ts +5 -0
- package/dist/BarChart.js +89 -0
- package/dist/BarChart.js.map +1 -0
- package/dist/Box.d.ts +1 -1
- package/dist/Box.js +219 -177
- package/dist/Box.js.map +1 -1
- package/dist/Button.js +116 -35
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +215 -9
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.js +46 -12
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/ConsentNavigator.d.ts +5 -1
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/DashboardGrid.d.ts +4 -0
- package/dist/DashboardGrid.js +38 -0
- package/dist/DashboardGrid.js.map +1 -0
- package/dist/DataTable.d.ts +2 -2
- package/dist/DataTable.js +278 -47
- package/dist/DataTable.js.map +1 -1
- package/dist/DataTableHeaderInfoMarkdown.d.ts +6 -0
- package/dist/DataTableHeaderInfoMarkdown.js +7 -0
- package/dist/DataTableHeaderInfoMarkdown.js.map +1 -0
- package/dist/DonutChart.d.ts +5 -0
- package/dist/DonutChart.js +84 -0
- package/dist/DonutChart.js.map +1 -0
- package/dist/EmojiSelector.d.ts +2 -46
- package/dist/EmojiSelector.js +46 -56
- package/dist/EmojiSelector.js.map +1 -1
- package/dist/Filter.js +12 -2
- package/dist/Filter.js.map +1 -1
- package/dist/GPTChat.d.ts +7 -1
- package/dist/GPTChat.js +28 -15
- package/dist/GPTChat.js.map +1 -1
- package/dist/Heading.d.ts +5 -2
- package/dist/Heading.js +6 -8
- package/dist/Heading.js.map +1 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Icon.d.ts +1 -2
- package/dist/Icon.js +4 -1
- package/dist/Icon.js.map +1 -1
- package/dist/LineChart.d.ts +5 -0
- package/dist/LineChart.js +68 -0
- package/dist/LineChart.js.map +1 -0
- package/dist/MarkdownEmbed.d.ts +6 -0
- package/dist/MarkdownEmbed.js +17 -0
- package/dist/MarkdownEmbed.js.map +1 -0
- package/dist/MarkdownView.d.ts +6 -3
- package/dist/MarkdownView.js +81 -44
- package/dist/MarkdownView.js.map +1 -1
- package/dist/MediaQuery.d.ts +5 -3
- package/dist/MediaQuery.js +9 -40
- package/dist/MediaQuery.js.map +1 -1
- package/dist/Modal.js +12 -10
- package/dist/Modal.js.map +1 -1
- package/dist/ModalSheet.d.ts +5 -1
- package/dist/ModalSheet.js +31 -13
- package/dist/ModalSheet.js.map +1 -1
- package/dist/MultiselectField.js +4 -9
- package/dist/MultiselectField.js.map +1 -1
- package/dist/NotificationBell.d.ts +16 -0
- package/dist/NotificationBell.js +15 -0
- package/dist/NotificationBell.js.map +1 -0
- package/dist/NotificationInbox.d.ts +21 -0
- package/dist/NotificationInbox.js +41 -0
- package/dist/NotificationInbox.js.map +1 -0
- package/dist/NotificationPreferences.d.ts +14 -0
- package/dist/NotificationPreferences.js +32 -0
- package/dist/NotificationPreferences.js.map +1 -0
- package/dist/OpenAPIContext.js +7 -6
- package/dist/OpenAPIContext.js.map +1 -1
- package/dist/Page.js +7 -1
- package/dist/Page.js.map +1 -1
- package/dist/PickerSelect.js +8 -1
- package/dist/PickerSelect.js.map +1 -1
- package/dist/Popover.d.ts +12 -0
- package/dist/Popover.js +37 -0
- package/dist/Popover.js.map +1 -0
- package/dist/PortalHost.js +10 -1
- package/dist/PortalHost.js.map +1 -1
- package/dist/ResponsiveBreakpoint.d.ts +65 -0
- package/dist/ResponsiveBreakpoint.js +111 -0
- package/dist/ResponsiveBreakpoint.js.map +1 -0
- package/dist/SplitPage.d.ts +2 -2
- package/dist/SplitPage.js +7 -12
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts +2 -2
- package/dist/SplitPage.native.js +1 -6
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TapToEdit.js +12 -10
- package/dist/TapToEdit.js.map +1 -1
- package/dist/TerrenoFontProvider.d.ts +7 -0
- package/dist/TerrenoFontProvider.js +27 -0
- package/dist/TerrenoFontProvider.js.map +1 -0
- package/dist/TerrenoProvider.js +4 -2
- package/dist/TerrenoProvider.js.map +1 -1
- package/dist/Text.d.ts +5 -2
- package/dist/Text.js +6 -11
- package/dist/Text.js.map +1 -1
- package/dist/TextField.js +83 -6
- package/dist/TextField.js.map +1 -1
- package/dist/TextFieldNumberActionSheet.js +9 -2
- package/dist/TextFieldNumberActionSheet.js.map +1 -1
- package/dist/Theme.js +10 -8
- package/dist/Theme.js.map +1 -1
- package/dist/ToastNotifications.d.ts +4 -2
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts +4 -3
- package/dist/Tooltip.js +14 -3
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +26 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/WebAddressAutocomplete.js +6 -1
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/announcementBuildVersion.d.ts +6 -0
- package/dist/announcementBuildVersion.js +21 -0
- package/dist/announcementBuildVersion.js.map +1 -0
- package/dist/announcementFrequency.d.ts +42 -0
- package/dist/announcementFrequency.js +163 -0
- package/dist/announcementFrequency.js.map +1 -0
- package/dist/announcementPlatform.d.ts +2 -0
- package/dist/announcementPlatform.js +11 -0
- package/dist/announcementPlatform.js.map +1 -0
- package/dist/charts/ChartFrame.d.ts +12 -0
- package/dist/charts/ChartFrame.js +13 -0
- package/dist/charts/ChartFrame.js.map +1 -0
- package/dist/charts/bars.d.ts +18 -0
- package/dist/charts/bars.js +29 -0
- package/dist/charts/bars.js.map +1 -0
- package/dist/charts/layout.d.ts +47 -0
- package/dist/charts/layout.js +56 -0
- package/dist/charts/layout.js.map +1 -0
- package/dist/charts/paths.d.ts +31 -0
- package/dist/charts/paths.js +52 -0
- package/dist/charts/paths.js.map +1 -0
- package/dist/charts/scales.d.ts +6 -0
- package/dist/charts/scales.js +43 -0
- package/dist/charts/scales.js.map +1 -0
- package/dist/charts/theme.d.ts +9 -0
- package/dist/charts/theme.js +15 -0
- package/dist/charts/theme.js.map +1 -0
- package/dist/charts/types/chartTypes.d.ts +17 -0
- package/dist/charts/types/chartTypes.js +2 -0
- package/dist/charts/types/chartTypes.js.map +1 -0
- package/dist/dashboardGridLayout.d.ts +22 -0
- package/dist/dashboardGridLayout.js +33 -0
- package/dist/dashboardGridLayout.js.map +1 -0
- package/dist/dataTableFilters.d.ts +33 -0
- package/dist/dataTableFilters.js +221 -0
- package/dist/dataTableFilters.js.map +1 -0
- package/dist/dataTableListQuery.d.ts +42 -0
- package/dist/dataTableListQuery.js +161 -0
- package/dist/dataTableListQuery.js.map +1 -0
- package/dist/emojiCategories.d.ts +46 -0
- package/dist/emojiCategories.js +47 -0
- package/dist/emojiCategories.js.map +1 -0
- package/dist/index.d.ts +30 -13
- package/dist/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/dist/lazyBoundaries/createLazyComponentExport.d.ts +6 -0
- package/dist/lazyBoundaries/createLazyComponentExport.js +35 -0
- package/dist/lazyBoundaries/createLazyComponentExport.js.map +1 -0
- package/dist/lazyBoundaries/heavyOptionalExports.d.ts +53 -0
- package/dist/lazyBoundaries/heavyOptionalExports.js +51 -0
- package/dist/lazyBoundaries/heavyOptionalExports.js.map +1 -0
- package/dist/login/LoginScreen.d.ts +1 -0
- package/dist/login/LoginScreen.js +4 -2
- package/dist/login/LoginScreen.js.map +1 -1
- package/dist/login/loginTypes.d.ts +2 -0
- package/dist/markdownEmbeds.d.ts +6 -0
- package/dist/markdownEmbeds.js +59 -0
- package/dist/markdownEmbeds.js.map +1 -0
- package/dist/testing/resolveTestId.js +2 -1
- package/dist/testing/resolveTestId.js.map +1 -1
- package/dist/testing/types.d.ts +3 -0
- package/dist/textFieldOscillationGuard.d.ts +25 -0
- package/dist/textFieldOscillationGuard.js +41 -0
- package/dist/textFieldOscillationGuard.js.map +1 -0
- package/dist/useAcknowledgeAnnouncement.d.ts +71 -0
- package/dist/useAcknowledgeAnnouncement.js +94 -0
- package/dist/useAcknowledgeAnnouncement.js.map +1 -0
- package/dist/useAnnouncements.d.ts +73 -0
- package/dist/useAnnouncements.js +66 -0
- package/dist/useAnnouncements.js.map +1 -0
- package/package.json +46 -18
- package/src/AIRequestExplorer.test.tsx +141 -0
- package/src/ActionSheet.tsx +9 -7
- package/src/AnnouncementBanner.test.tsx +267 -0
- package/src/AnnouncementBanner.tsx +128 -0
- package/src/AnnouncementNavigator.test.tsx +759 -0
- package/src/AnnouncementNavigator.tsx +287 -0
- package/src/AnnouncementScreen.test.tsx +97 -0
- package/src/AnnouncementScreen.tsx +70 -0
- package/src/AreaChart.test.tsx +68 -0
- package/src/AreaChart.tsx +194 -0
- package/src/AttachmentPreview.test.tsx +80 -0
- package/src/BarChart.test.tsx +96 -0
- package/src/BarChart.tsx +208 -0
- package/src/Box.test.tsx +97 -10
- package/src/Box.tsx +263 -200
- package/src/Button.test.tsx +273 -0
- package/src/Button.tsx +163 -50
- package/src/Common.ts +219 -25
- package/src/ConsentFormScreen.markdownGate.test.tsx +129 -0
- package/src/ConsentFormScreen.test.tsx +145 -8
- package/src/ConsentFormScreen.tsx +74 -25
- package/src/ConsentNavigator.test.tsx +55 -0
- package/src/ConsentNavigator.tsx +13 -5
- package/src/DashboardGrid.test.tsx +75 -0
- package/src/DashboardGrid.tsx +69 -0
- package/src/DataTable.test.tsx +296 -1
- package/src/DataTable.tsx +623 -160
- package/src/DataTableHeaderInfoMarkdown.test.tsx +21 -0
- package/src/DataTableHeaderInfoMarkdown.tsx +17 -0
- package/src/DataTableVirtualizationRegression.test.tsx +266 -0
- package/src/DateTimeField.test.tsx +54 -0
- package/src/DonutChart.test.tsx +121 -0
- package/src/DonutChart.tsx +160 -0
- package/src/EmojiSelector.test.tsx +84 -42
- package/src/EmojiSelector.tsx +60 -57
- package/src/Field.test.tsx +18 -0
- package/src/FilePickerButton.test.tsx +167 -0
- package/src/Filter.test.tsx +25 -0
- package/src/Filter.tsx +38 -7
- package/src/FilterAccordion.test.tsx +37 -0
- package/src/FilterBoolean.test.tsx +96 -0
- package/src/FilterSelectMenu.test.tsx +23 -0
- package/src/GPTChat.test.tsx +803 -0
- package/src/GPTChat.tsx +177 -87
- package/src/GPTMemoryModal.test.tsx +67 -0
- package/src/Heading.tsx +8 -14
- package/src/HeightActionSheet.test.tsx +6 -9
- package/src/Hyperlink.tsx +5 -18
- package/src/Icon.tsx +6 -2
- package/src/LineChart.test.tsx +166 -0
- package/src/LineChart.tsx +190 -0
- package/src/MarkdownEditor.test.tsx +134 -0
- package/src/MarkdownEditorField.test.tsx +124 -0
- package/src/MarkdownEmbed.test.tsx +34 -0
- package/src/MarkdownEmbed.tsx +43 -0
- package/src/MarkdownView.test.tsx +112 -11
- package/src/MarkdownView.tsx +197 -150
- package/src/MediaQuery.ts +30 -34
- package/src/Modal.test.tsx +107 -14
- package/src/Modal.tsx +20 -8
- package/src/ModalSheet.test.tsx +121 -9
- package/src/ModalSheet.tsx +46 -11
- package/src/MultiselectField.test.tsx +21 -0
- package/src/MultiselectField.tsx +11 -13
- package/src/NotificationBell.test.tsx +91 -0
- package/src/NotificationBell.tsx +77 -0
- package/src/NotificationInbox.test.tsx +130 -0
- package/src/NotificationInbox.tsx +144 -0
- package/src/NotificationPreferences.test.tsx +25 -0
- package/src/NotificationPreferences.tsx +75 -0
- package/src/OpenAPIContext.tsx +36 -29
- package/src/OpenAPIRenderRegression.test.tsx +200 -0
- package/src/P0RenderRegression.test.tsx +214 -0
- package/src/P1RenderRegression.test.tsx +141 -0
- package/src/P2ButtonRenderRegression.test.tsx +158 -0
- package/src/Page.test.tsx +13 -0
- package/src/Page.tsx +25 -5
- package/src/PickerSelect.test.tsx +38 -0
- package/src/PickerSelect.tsx +7 -0
- package/src/Popover.test.tsx +151 -0
- package/src/Popover.tsx +211 -0
- package/src/PortalHost.tsx +12 -6
- package/src/ResponsiveBreakpoint.test.tsx +184 -0
- package/src/ResponsiveBreakpoint.tsx +195 -0
- package/src/RootImportRegression.test.tsx +82 -0
- package/src/SplitPage.native.tsx +5 -9
- package/src/SplitPage.tsx +16 -19
- package/src/TapToEdit.test.tsx +45 -0
- package/src/TapToEdit.tsx +23 -18
- package/src/TerrenoFontProvider.test.tsx +38 -0
- package/src/TerrenoFontProvider.tsx +50 -0
- package/src/TerrenoProvider.tsx +6 -1
- package/src/Text.tsx +8 -21
- package/src/TextField.test.tsx +421 -0
- package/src/TextField.tsx +121 -4
- package/src/TextFieldNumberActionSheet.test.tsx +100 -0
- package/src/TextFieldNumberActionSheet.tsx +11 -2
- package/src/Theme.test.tsx +27 -0
- package/src/Theme.tsx +15 -10
- package/src/Toast.tsx +1 -1
- package/src/ToastNotifications.tsx +4 -4
- package/src/Tooltip.test.tsx +64 -0
- package/src/Tooltip.tsx +18 -4
- package/src/Unifier.ts +26 -3
- package/src/WebAddressAutocomplete.tsx +6 -2
- package/src/__snapshots__/ActionSheet.test.tsx.snap +0 -36
- package/src/__snapshots__/AddressField.test.tsx.snap +1 -0
- package/src/__snapshots__/AttachmentPreview.test.tsx.snap +225 -0
- package/src/__snapshots__/CustomSelectField.test.tsx.snap +7 -0
- package/src/__snapshots__/DataTable.test.tsx.snap +793 -250
- package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +0 -8
- package/src/__snapshots__/EmojiSelector.test.tsx.snap +35555 -30
- package/src/__snapshots__/Field.test.tsx.snap +29 -0
- package/src/__snapshots__/FilterSelectMenu.test.tsx.snap +1 -0
- package/src/__snapshots__/HeightActionSheet.test.tsx.snap +0 -8
- package/src/__snapshots__/HeightField.test.tsx.snap +0 -20
- package/src/__snapshots__/ModalSheet.test.tsx.snap +4 -1
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +0 -8
- package/src/__snapshots__/Page.test.tsx.snap +13 -1
- package/src/__snapshots__/PickerSelect.test.tsx.snap +7 -0
- package/src/__snapshots__/SelectField.test.tsx.snap +6 -0
- package/src/__snapshots__/TextArea.test.tsx.snap +5 -5
- package/src/__snapshots__/TextField.test.tsx.snap +5 -5
- package/src/__snapshots__/TimezonePicker.test.tsx.snap +6 -0
- package/src/announcementBuildVersion.test.ts +43 -0
- package/src/announcementBuildVersion.ts +21 -0
- package/src/announcementFrequency.test.ts +245 -0
- package/src/announcementFrequency.ts +246 -0
- package/src/announcementPlatform.test.ts +27 -0
- package/src/announcementPlatform.ts +13 -0
- package/src/benchmarks/importGraph.test.ts +71 -0
- package/src/benchmarks/importGraph.ts +136 -0
- package/src/benchmarks/importTiming.test.ts +42 -0
- package/src/benchmarks/importTiming.ts +86 -0
- package/src/bunSetup.ts +174 -32
- package/src/charts/ChartFrame.tsx +67 -0
- package/src/charts/bars.test.ts +56 -0
- package/src/charts/bars.ts +53 -0
- package/src/charts/layout.test.ts +80 -0
- package/src/charts/layout.ts +99 -0
- package/src/charts/paths.test.ts +79 -0
- package/src/charts/paths.ts +100 -0
- package/src/charts/scales.test.ts +59 -0
- package/src/charts/scales.ts +60 -0
- package/src/charts/theme.test.ts +22 -0
- package/src/charts/theme.ts +24 -0
- package/src/charts/types/chartTypes.ts +19 -0
- package/src/dashboardGridLayout.test.ts +90 -0
- package/src/dashboardGridLayout.ts +60 -0
- package/src/dataTableFilters.test.tsx +552 -0
- package/src/dataTableFilters.tsx +441 -0
- package/src/dataTableListQuery.test.ts +220 -0
- package/src/dataTableListQuery.ts +201 -0
- package/src/emojiCategories.test.ts +23 -0
- package/src/emojiCategories.ts +46 -0
- package/src/index.tsx +48 -14
- package/src/lazyBoundaries/createLazyComponentExport.test.tsx +104 -0
- package/src/lazyBoundaries/createLazyComponentExport.tsx +63 -0
- package/src/lazyBoundaries/heavyOptionalExports.test.tsx +33 -0
- package/src/lazyBoundaries/heavyOptionalExports.tsx +134 -0
- package/src/login/LoginScreen.test.tsx +9 -2
- package/src/login/LoginScreen.tsx +6 -2
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +22 -0
- package/src/login/loginTypes.ts +2 -0
- package/src/markdownEmbeds.test.ts +53 -0
- package/src/markdownEmbeds.ts +62 -0
- package/src/pdfHtmlTemplate.test.ts +119 -0
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +22 -0
- package/src/table/TableDate.test.tsx +35 -1
- package/src/table/__snapshots__/TableBadge.test.tsx.snap +1 -0
- package/src/testing/resolveTestId.test.ts +3 -0
- package/src/testing/resolveTestId.ts +1 -0
- package/src/testing/types.ts +3 -0
- package/src/textFieldOscillationGuard.test.ts +63 -0
- package/src/textFieldOscillationGuard.ts +89 -0
- package/src/types/react-native-markdown-display.d.ts +6 -0
- package/src/types/react-native-swiper-flatlist.d.ts +5 -5
- package/src/useAcknowledgeAnnouncement.test.ts +223 -0
- package/src/useAcknowledgeAnnouncement.ts +166 -0
- package/src/useAnnouncements.test.ts +226 -0
- package/src/useAnnouncements.ts +150 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type {AIRequestExplorer as AIRequestExplorerComponent} from "../AIRequestExplorer";
|
|
2
|
+
import type {AiSuggestionBox as AiSuggestionBoxComponent} from "../AiSuggestionBox";
|
|
3
|
+
import type {AreaChart as AreaChartComponent} from "../AreaChart";
|
|
4
|
+
import type {AttachmentPreview as AttachmentPreviewComponent} from "../AttachmentPreview";
|
|
5
|
+
import type {BarChart as BarChartComponent} from "../BarChart";
|
|
6
|
+
import type {ConflictSheet as ConflictSheetComponent} from "../ConflictSheet";
|
|
7
|
+
import type {ConsentFormScreen as ConsentFormScreenComponent} from "../ConsentFormScreen";
|
|
8
|
+
import type {ConsentNavigator as ConsentNavigatorComponent} from "../ConsentNavigator";
|
|
9
|
+
import type {DonutChart as DonutChartComponent} from "../DonutChart";
|
|
10
|
+
import type {DraggableList as DraggableListComponent} from "../DraggableList";
|
|
11
|
+
import type EmojiSelectorComponent from "../EmojiSelector";
|
|
12
|
+
import {Categories} from "../emojiCategories";
|
|
13
|
+
import type {GPTChat as GPTChatComponent} from "../GPTChat";
|
|
14
|
+
import type {GPTMemoryModal as GPTMemoryModalComponent} from "../GPTMemoryModal";
|
|
15
|
+
import type {LineChart as LineChartComponent} from "../LineChart";
|
|
16
|
+
import type {MarkdownEditor as MarkdownEditorComponent} from "../MarkdownEditor";
|
|
17
|
+
import type {MarkdownEditorField as MarkdownEditorFieldComponent} from "../MarkdownEditorField";
|
|
18
|
+
import type {UpgradeRequiredScreen as UpgradeRequiredScreenComponent} from "../UpgradeRequiredScreen";
|
|
19
|
+
import {createLazyComponentExport, createLazyNamedExport} from "./createLazyComponentExport";
|
|
20
|
+
|
|
21
|
+
export const heavyOptionalModuleFactories = {
|
|
22
|
+
AIRequestExplorer: () => import("../AIRequestExplorer"),
|
|
23
|
+
AiSuggestionBox: () => import("../AiSuggestionBox"),
|
|
24
|
+
AreaChart: () => import("../AreaChart"),
|
|
25
|
+
AttachmentPreview: () => import("../AttachmentPreview"),
|
|
26
|
+
BarChart: () => import("../BarChart"),
|
|
27
|
+
ConflictSheet: () => import("../ConflictSheet"),
|
|
28
|
+
ConsentFormScreen: () => import("../ConsentFormScreen"),
|
|
29
|
+
ConsentNavigator: () => import("../ConsentNavigator"),
|
|
30
|
+
DonutChart: () => import("../DonutChart"),
|
|
31
|
+
DraggableList: () => import("../DraggableList"),
|
|
32
|
+
EmojiSelector: () => import("../EmojiSelector"),
|
|
33
|
+
GPTChat: () => import("../GPTChat"),
|
|
34
|
+
GPTMemoryModal: () => import("../GPTMemoryModal"),
|
|
35
|
+
LineChart: () => import("../LineChart"),
|
|
36
|
+
MarkdownEditor: () => import("../MarkdownEditor"),
|
|
37
|
+
MarkdownEditorField: () => import("../MarkdownEditorField"),
|
|
38
|
+
UpgradeRequiredScreen: () => import("../UpgradeRequiredScreen"),
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
const EMOJI_SELECTOR_DEFAULT_PROPS = {
|
|
42
|
+
category: Categories.all,
|
|
43
|
+
columns: 6,
|
|
44
|
+
placeholder: "Search...",
|
|
45
|
+
showHistory: false,
|
|
46
|
+
showSearchBar: true,
|
|
47
|
+
showSectionTitles: true,
|
|
48
|
+
showTabs: true,
|
|
49
|
+
theme: "#007AFF",
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const AIRequestExplorer = createLazyNamedExport(
|
|
53
|
+
heavyOptionalModuleFactories.AIRequestExplorer,
|
|
54
|
+
"AIRequestExplorer"
|
|
55
|
+
) as unknown as typeof AIRequestExplorerComponent;
|
|
56
|
+
|
|
57
|
+
export const AreaChart = createLazyNamedExport(
|
|
58
|
+
heavyOptionalModuleFactories.AreaChart,
|
|
59
|
+
"AreaChart"
|
|
60
|
+
) as unknown as typeof AreaChartComponent;
|
|
61
|
+
|
|
62
|
+
export const AiSuggestionBox = createLazyNamedExport(
|
|
63
|
+
heavyOptionalModuleFactories.AiSuggestionBox,
|
|
64
|
+
"AiSuggestionBox"
|
|
65
|
+
) as unknown as typeof AiSuggestionBoxComponent;
|
|
66
|
+
|
|
67
|
+
export const AttachmentPreview = createLazyNamedExport(
|
|
68
|
+
heavyOptionalModuleFactories.AttachmentPreview,
|
|
69
|
+
"AttachmentPreview"
|
|
70
|
+
) as unknown as typeof AttachmentPreviewComponent;
|
|
71
|
+
|
|
72
|
+
export const BarChart = createLazyNamedExport(
|
|
73
|
+
heavyOptionalModuleFactories.BarChart,
|
|
74
|
+
"BarChart"
|
|
75
|
+
) as unknown as typeof BarChartComponent;
|
|
76
|
+
|
|
77
|
+
export const ConflictSheet = createLazyNamedExport(
|
|
78
|
+
heavyOptionalModuleFactories.ConflictSheet,
|
|
79
|
+
"ConflictSheet"
|
|
80
|
+
) as unknown as typeof ConflictSheetComponent;
|
|
81
|
+
|
|
82
|
+
export const ConsentFormScreen = createLazyNamedExport(
|
|
83
|
+
heavyOptionalModuleFactories.ConsentFormScreen,
|
|
84
|
+
"ConsentFormScreen"
|
|
85
|
+
) as unknown as typeof ConsentFormScreenComponent;
|
|
86
|
+
|
|
87
|
+
export const ConsentNavigator = createLazyNamedExport(
|
|
88
|
+
heavyOptionalModuleFactories.ConsentNavigator,
|
|
89
|
+
"ConsentNavigator"
|
|
90
|
+
) as unknown as typeof ConsentNavigatorComponent;
|
|
91
|
+
|
|
92
|
+
export const DonutChart = createLazyNamedExport(
|
|
93
|
+
heavyOptionalModuleFactories.DonutChart,
|
|
94
|
+
"DonutChart"
|
|
95
|
+
) as unknown as typeof DonutChartComponent;
|
|
96
|
+
|
|
97
|
+
export const DraggableList = createLazyNamedExport(
|
|
98
|
+
heavyOptionalModuleFactories.DraggableList,
|
|
99
|
+
"DraggableList"
|
|
100
|
+
) as unknown as typeof DraggableListComponent;
|
|
101
|
+
|
|
102
|
+
export const EmojiSelector = createLazyComponentExport(heavyOptionalModuleFactories.EmojiSelector, {
|
|
103
|
+
defaultProps: EMOJI_SELECTOR_DEFAULT_PROPS,
|
|
104
|
+
}) as unknown as typeof EmojiSelectorComponent;
|
|
105
|
+
|
|
106
|
+
export const GPTChat = createLazyNamedExport(
|
|
107
|
+
heavyOptionalModuleFactories.GPTChat,
|
|
108
|
+
"GPTChat"
|
|
109
|
+
) as unknown as typeof GPTChatComponent;
|
|
110
|
+
|
|
111
|
+
export const LineChart = createLazyNamedExport(
|
|
112
|
+
heavyOptionalModuleFactories.LineChart,
|
|
113
|
+
"LineChart"
|
|
114
|
+
) as unknown as typeof LineChartComponent;
|
|
115
|
+
|
|
116
|
+
export const GPTMemoryModal = createLazyNamedExport(
|
|
117
|
+
heavyOptionalModuleFactories.GPTMemoryModal,
|
|
118
|
+
"GPTMemoryModal"
|
|
119
|
+
) as unknown as typeof GPTMemoryModalComponent;
|
|
120
|
+
|
|
121
|
+
export const MarkdownEditor = createLazyNamedExport(
|
|
122
|
+
heavyOptionalModuleFactories.MarkdownEditor,
|
|
123
|
+
"MarkdownEditor"
|
|
124
|
+
) as unknown as typeof MarkdownEditorComponent;
|
|
125
|
+
|
|
126
|
+
export const MarkdownEditorField = createLazyNamedExport(
|
|
127
|
+
heavyOptionalModuleFactories.MarkdownEditorField,
|
|
128
|
+
"MarkdownEditorField"
|
|
129
|
+
) as unknown as typeof MarkdownEditorFieldComponent;
|
|
130
|
+
|
|
131
|
+
export const UpgradeRequiredScreen = createLazyNamedExport(
|
|
132
|
+
heavyOptionalModuleFactories.UpgradeRequiredScreen,
|
|
133
|
+
"UpgradeRequiredScreen"
|
|
134
|
+
) as unknown as typeof UpgradeRequiredScreenComponent;
|
|
@@ -60,17 +60,24 @@ describe("LoginScreen", () => {
|
|
|
60
60
|
expect(getByTestId("login-screen-signup-link")).toBeTruthy();
|
|
61
61
|
});
|
|
62
62
|
|
|
63
|
-
it("renders forgot password button when
|
|
63
|
+
it("renders forgot password button when onForgotPassword is provided", () => {
|
|
64
64
|
const {getByTestId} = renderWithTheme(
|
|
65
65
|
<LoginScreen
|
|
66
66
|
fields={defaultFields}
|
|
67
|
-
|
|
67
|
+
onForgotPassword={() => {}}
|
|
68
68
|
onSubmit={mock(() => Promise.resolve())}
|
|
69
69
|
/>
|
|
70
70
|
);
|
|
71
71
|
expect(getByTestId("login-screen-forgot-password")).toBeTruthy();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
it("does not render forgot password without a callback", () => {
|
|
75
|
+
const {queryByTestId} = renderWithTheme(
|
|
76
|
+
<LoginScreen fields={defaultFields} onSubmit={mock(() => Promise.resolve())} />
|
|
77
|
+
);
|
|
78
|
+
expect(queryByTestId("login-screen-forgot-password")).toBeNull();
|
|
79
|
+
});
|
|
80
|
+
|
|
74
81
|
it("renders error message", () => {
|
|
75
82
|
const {getByTestId} = renderWithTheme(
|
|
76
83
|
<LoginScreen
|
|
@@ -29,6 +29,7 @@ import type {LoginScreenProps} from "./loginTypes";
|
|
|
29
29
|
* ]}
|
|
30
30
|
* onSignUpPress={() => router.push("/signup")}
|
|
31
31
|
* onForgotPasswordPress={() => router.push("/forgot-password")}
|
|
32
|
+
// or onForgotPassword={() => router.push("/forgot-password")}
|
|
32
33
|
* />
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
@@ -44,6 +45,7 @@ export const LoginScreen: FC<LoginScreenProps> = ({
|
|
|
44
45
|
onSignUpPress,
|
|
45
46
|
forgotPasswordText = "Forgot password?",
|
|
46
47
|
onForgotPasswordPress,
|
|
48
|
+
onForgotPassword,
|
|
47
49
|
testID = "login-screen",
|
|
48
50
|
}) => {
|
|
49
51
|
const [formValues, setFormValues] = useState<Record<string, string>>(() => {
|
|
@@ -54,6 +56,8 @@ export const LoginScreen: FC<LoginScreenProps> = ({
|
|
|
54
56
|
return initial;
|
|
55
57
|
});
|
|
56
58
|
|
|
59
|
+
const onForgotPasswordAction = onForgotPasswordPress ?? onForgotPassword;
|
|
60
|
+
|
|
57
61
|
const handleFieldChange = useCallback((fieldName: string, value: string) => {
|
|
58
62
|
setFormValues((prev) => ({...prev, [fieldName]: value}));
|
|
59
63
|
}, []);
|
|
@@ -121,11 +125,11 @@ export const LoginScreen: FC<LoginScreenProps> = ({
|
|
|
121
125
|
/>
|
|
122
126
|
</Box>
|
|
123
127
|
|
|
124
|
-
{Boolean(
|
|
128
|
+
{Boolean(onForgotPasswordAction) && (
|
|
125
129
|
<Box alignItems="center" marginTop={2}>
|
|
126
130
|
<Button
|
|
127
131
|
disabled={loading}
|
|
128
|
-
onClick={
|
|
132
|
+
onClick={onForgotPasswordAction!}
|
|
129
133
|
testID={`${testID}-forgot-password`}
|
|
130
134
|
text={forgotPasswordText!}
|
|
131
135
|
variant="muted"
|
|
@@ -224,6 +224,28 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
224
224
|
},
|
|
225
225
|
"type": "TextInput",
|
|
226
226
|
},
|
|
227
|
+
{
|
|
228
|
+
"$$typeof": Symbol(react.test.json),
|
|
229
|
+
"children": null,
|
|
230
|
+
"props": {
|
|
231
|
+
"accessibilityLabel": "Show password",
|
|
232
|
+
"accessibilityRole": "button",
|
|
233
|
+
"accessibilityState": {
|
|
234
|
+
"disabled": true,
|
|
235
|
+
"expanded": false,
|
|
236
|
+
},
|
|
237
|
+
"disabled": true,
|
|
238
|
+
"hitSlop": 8,
|
|
239
|
+
"onPress": [Function],
|
|
240
|
+
"style": {
|
|
241
|
+
"alignItems": "center",
|
|
242
|
+
"marginLeft": 8,
|
|
243
|
+
"width": 20,
|
|
244
|
+
},
|
|
245
|
+
"testID": "login-screen-password-input.visibility-toggle",
|
|
246
|
+
},
|
|
247
|
+
"type": "Pressable",
|
|
248
|
+
},
|
|
227
249
|
],
|
|
228
250
|
"props": {
|
|
229
251
|
"style": {
|
package/src/login/loginTypes.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface LoginScreenProps {
|
|
|
46
46
|
forgotPasswordText?: string;
|
|
47
47
|
/** Callback triggered when the forgot password link is pressed. */
|
|
48
48
|
onForgotPasswordPress?: () => void;
|
|
49
|
+
/** Alias for `onForgotPasswordPress`. */
|
|
50
|
+
onForgotPassword?: () => void;
|
|
49
51
|
/** Test ID for the root element. */
|
|
50
52
|
testID?: string;
|
|
51
53
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {describe, expect, it} from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
isEmbeddableMediaUrl,
|
|
4
|
+
isLoomUrl,
|
|
5
|
+
isYouTubeUrl,
|
|
6
|
+
toLoomEmbedUrl,
|
|
7
|
+
toMediaEmbedUrl,
|
|
8
|
+
toYouTubeEmbedUrl,
|
|
9
|
+
} from "./markdownEmbeds";
|
|
10
|
+
|
|
11
|
+
describe("markdownEmbeds", () => {
|
|
12
|
+
it("detects YouTube URLs", () => {
|
|
13
|
+
expect(isYouTubeUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ")).toBe(true);
|
|
14
|
+
expect(isYouTubeUrl("https://youtu.be/dQw4w9WgXcQ")).toBe(true);
|
|
15
|
+
expect(isYouTubeUrl("https://example.com")).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("detects Loom URLs", () => {
|
|
19
|
+
expect(isLoomUrl("https://www.loom.com/share/abc123def456")).toBe(true);
|
|
20
|
+
expect(isLoomUrl("https://example.com")).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("converts media URLs to embed URLs", () => {
|
|
24
|
+
expect(toYouTubeEmbedUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ")).toBe(
|
|
25
|
+
"https://www.youtube.com/embed/dQw4w9WgXcQ"
|
|
26
|
+
);
|
|
27
|
+
expect(toYouTubeEmbedUrl("https://youtu.be/dQw4w9WgXcQ")).toBe(
|
|
28
|
+
"https://www.youtube.com/embed/dQw4w9WgXcQ"
|
|
29
|
+
);
|
|
30
|
+
expect(toLoomEmbedUrl("https://www.loom.com/share/abc123def456")).toBe(
|
|
31
|
+
"https://www.loom.com/embed/abc123def456"
|
|
32
|
+
);
|
|
33
|
+
expect(toMediaEmbedUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ")).toContain("embed");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("identifies embeddable media URLs", () => {
|
|
37
|
+
expect(isEmbeddableMediaUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ")).toBe(true);
|
|
38
|
+
expect(isEmbeddableMediaUrl("https://www.loom.com/share/abc123def456")).toBe(true);
|
|
39
|
+
expect(isEmbeddableMediaUrl("https://example.com/docs")).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("handles alternate YouTube URL shapes and invalid input", () => {
|
|
43
|
+
expect(toYouTubeEmbedUrl("https://www.youtube.com/embed/dQw4w9WgXcQ")).toBe(
|
|
44
|
+
"https://www.youtube.com/embed/dQw4w9WgXcQ"
|
|
45
|
+
);
|
|
46
|
+
expect(toYouTubeEmbedUrl("https://www.youtube.com/shorts/dQw4w9WgXcQ")).toBe(
|
|
47
|
+
"https://www.youtube.com/embed/dQw4w9WgXcQ"
|
|
48
|
+
);
|
|
49
|
+
expect(toYouTubeEmbedUrl("not-a-url")).toBeNull();
|
|
50
|
+
expect(toLoomEmbedUrl("not-a-url")).toBeNull();
|
|
51
|
+
expect(toMediaEmbedUrl("https://example.com/video")).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const YOUTUBE_HOST_PATTERN = /(?:youtube\.com|youtu\.be)/i;
|
|
2
|
+
const LOOM_HOST_PATTERN = /loom\.com/i;
|
|
3
|
+
|
|
4
|
+
export const isYouTubeUrl = (url: string): boolean => YOUTUBE_HOST_PATTERN.test(url);
|
|
5
|
+
|
|
6
|
+
export const isLoomUrl = (url: string): boolean => LOOM_HOST_PATTERN.test(url);
|
|
7
|
+
|
|
8
|
+
export const isEmbeddableMediaUrl = (url: string): boolean => isYouTubeUrl(url) || isLoomUrl(url);
|
|
9
|
+
|
|
10
|
+
const extractYouTubeId = (url: string): string | null => {
|
|
11
|
+
try {
|
|
12
|
+
const parsed = new URL(url);
|
|
13
|
+
if (parsed.hostname === "youtu.be") {
|
|
14
|
+
return parsed.pathname.replace(/^\//, "") || null;
|
|
15
|
+
}
|
|
16
|
+
if (parsed.pathname.startsWith("/embed/")) {
|
|
17
|
+
return parsed.pathname.split("/")[2] ?? null;
|
|
18
|
+
}
|
|
19
|
+
if (parsed.pathname.startsWith("/shorts/")) {
|
|
20
|
+
return parsed.pathname.split("/")[2] ?? null;
|
|
21
|
+
}
|
|
22
|
+
return parsed.searchParams.get("v");
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const extractLoomId = (url: string): string | null => {
|
|
29
|
+
try {
|
|
30
|
+
const parsed = new URL(url);
|
|
31
|
+
const match = parsed.pathname.match(/\/share\/([^/?#]+)/i);
|
|
32
|
+
return match?.[1] ?? null;
|
|
33
|
+
} catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const toYouTubeEmbedUrl = (url: string): string | null => {
|
|
39
|
+
const videoId = extractYouTubeId(url);
|
|
40
|
+
if (!videoId) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return `https://www.youtube.com/embed/${videoId}`;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const toLoomEmbedUrl = (url: string): string | null => {
|
|
47
|
+
const videoId = extractLoomId(url);
|
|
48
|
+
if (!videoId) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return `https://www.loom.com/embed/${videoId}`;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const toMediaEmbedUrl = (url: string): string | null => {
|
|
55
|
+
if (isYouTubeUrl(url)) {
|
|
56
|
+
return toYouTubeEmbedUrl(url);
|
|
57
|
+
}
|
|
58
|
+
if (isLoomUrl(url)) {
|
|
59
|
+
return toLoomEmbedUrl(url);
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
+
import {Platform} from "react-native";
|
|
3
|
+
|
|
4
|
+
import {buildConsentPdfHtml, type PdfTemplateData, sharePdfFromHtml} from "./pdfHtmlTemplate";
|
|
5
|
+
|
|
6
|
+
const printToFileAsync = mock(() => Promise.resolve({uri: "file:///tmp/consent.pdf"}));
|
|
7
|
+
const shareAsync = mock(() => Promise.resolve());
|
|
8
|
+
|
|
9
|
+
mock.module("expo-print", () => ({printToFileAsync}));
|
|
10
|
+
mock.module("expo-sharing", () => ({shareAsync}));
|
|
11
|
+
|
|
12
|
+
const baseData: PdfTemplateData = {
|
|
13
|
+
fields: [
|
|
14
|
+
{label: "Full Name", value: "Jane <Doe>"},
|
|
15
|
+
{label: "Notes", value: 'Says "hi" & bye'},
|
|
16
|
+
],
|
|
17
|
+
formTitle: "Consent & Release",
|
|
18
|
+
title: "Consent Record",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
describe("buildConsentPdfHtml", () => {
|
|
22
|
+
it("renders the required sections and escapes HTML", () => {
|
|
23
|
+
const html = buildConsentPdfHtml(baseData);
|
|
24
|
+
|
|
25
|
+
expect(html).toStartWith("<!DOCTYPE html>");
|
|
26
|
+
expect(html).toContain("<h1>Consent Record</h1>");
|
|
27
|
+
expect(html).toContain('<div class="form-title">Consent & Release</div>');
|
|
28
|
+
expect(html).toContain('<td class="field-value">Jane <Doe></td>');
|
|
29
|
+
expect(html).toContain('<td class="field-value">Says "hi" & bye</td>');
|
|
30
|
+
expect(html).toContain("<h2>Response Details</h2>");
|
|
31
|
+
expect(html).toMatch(/<span>Generated .+<\/span>/);
|
|
32
|
+
|
|
33
|
+
expect(html).not.toContain("<h2>User Information</h2>");
|
|
34
|
+
expect(html).not.toContain("<h2>Checkbox Responses</h2>");
|
|
35
|
+
expect(html).not.toContain("<h2>Audit Trail</h2>");
|
|
36
|
+
expect(html).not.toContain("<h2>Signature</h2>");
|
|
37
|
+
expect(html).not.toContain("<h2>Content Snapshot</h2>");
|
|
38
|
+
expect(html).not.toContain("Response ID:");
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("renders user info, checkboxes, audit trail, signature, snapshot and response id", () => {
|
|
42
|
+
const html = buildConsentPdfHtml({
|
|
43
|
+
...baseData,
|
|
44
|
+
auditTrail: [{label: "Signed At", value: "2025-01-01"}],
|
|
45
|
+
checkboxes: [
|
|
46
|
+
{checked: true, label: "I agree"},
|
|
47
|
+
{checked: false, label: "Send me <updates>"},
|
|
48
|
+
],
|
|
49
|
+
contentSnapshot: "Line one <b>bold</b>",
|
|
50
|
+
responseId: "resp_123",
|
|
51
|
+
signature: 'data:image/png;base64,abc"def',
|
|
52
|
+
userInfo: {email: "jane@example.com", name: "Jane Doe", userId: "user_1"},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
expect(html).toContain("<h2>User Information</h2>");
|
|
56
|
+
expect(html).toContain('<td class="field-label">User ID:</td>');
|
|
57
|
+
expect(html).toContain('<td class="field-value">user_1</td>');
|
|
58
|
+
expect(html).toContain('<td class="field-value">Jane Doe</td>');
|
|
59
|
+
expect(html).toContain('<td class="field-value">jane@example.com</td>');
|
|
60
|
+
|
|
61
|
+
expect(html).toContain("<h2>Checkbox Responses</h2>");
|
|
62
|
+
expect(html).toContain('<div class="checkbox-row">☑ I agree</div>');
|
|
63
|
+
expect(html).toContain('<div class="checkbox-row">☐ Send me <updates></div>');
|
|
64
|
+
|
|
65
|
+
expect(html).toContain("<h2>Audit Trail</h2>");
|
|
66
|
+
expect(html).toContain('<td class="field-label">Signed At</td>');
|
|
67
|
+
|
|
68
|
+
expect(html).toContain("<h2>Signature</h2>");
|
|
69
|
+
expect(html).toContain(
|
|
70
|
+
'<img src="data:image/png;base64,abc"def" class="signature-img" />'
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
expect(html).toContain("<h2>Content Snapshot</h2>");
|
|
74
|
+
expect(html).toContain('<div class="content-snapshot">Line one <b>bold</b></div>');
|
|
75
|
+
|
|
76
|
+
expect(html).toContain("<span>Response ID: resp_123</span>");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("omits optional user info rows that are not provided", () => {
|
|
80
|
+
const html = buildConsentPdfHtml({...baseData, userInfo: {userId: "user_2"}});
|
|
81
|
+
|
|
82
|
+
expect(html).toContain('<td class="field-value">user_2</td>');
|
|
83
|
+
expect(html).not.toContain('<td class="field-label">Name:</td>');
|
|
84
|
+
expect(html).not.toContain('<td class="field-label">Email:</td>');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("treats empty checkbox and audit trail lists as absent sections", () => {
|
|
88
|
+
const html = buildConsentPdfHtml({...baseData, auditTrail: [], checkboxes: []});
|
|
89
|
+
|
|
90
|
+
expect(html).not.toContain("<h2>Checkbox Responses</h2>");
|
|
91
|
+
expect(html).not.toContain("<h2>Audit Trail</h2>");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("sharePdfFromHtml", () => {
|
|
96
|
+
it("throws on web", async () => {
|
|
97
|
+
const originalOS = Platform.OS;
|
|
98
|
+
Platform.OS = "web";
|
|
99
|
+
try {
|
|
100
|
+
await expect(sharePdfFromHtml({filename: "consent.pdf", html: "<p>hi</p>"})).rejects.toThrow(
|
|
101
|
+
"sharePdfFromHtml is only supported on mobile platforms"
|
|
102
|
+
);
|
|
103
|
+
} finally {
|
|
104
|
+
Platform.OS = originalOS;
|
|
105
|
+
}
|
|
106
|
+
expect(printToFileAsync).not.toHaveBeenCalled();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("prints to a file and shares it on native", async () => {
|
|
110
|
+
await sharePdfFromHtml({filename: "consent.pdf", html: "<p>hi</p>"});
|
|
111
|
+
|
|
112
|
+
expect(printToFileAsync).toHaveBeenCalledWith({html: "<p>hi</p>"});
|
|
113
|
+
expect(shareAsync).toHaveBeenCalledWith("file:///tmp/consent.pdf", {
|
|
114
|
+
dialogTitle: "consent.pdf",
|
|
115
|
+
mimeType: "application/pdf",
|
|
116
|
+
UTI: "com.adobe.pdf",
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -330,6 +330,28 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
330
330
|
},
|
|
331
331
|
"type": "TextInput",
|
|
332
332
|
},
|
|
333
|
+
{
|
|
334
|
+
"$$typeof": Symbol(react.test.json),
|
|
335
|
+
"children": null,
|
|
336
|
+
"props": {
|
|
337
|
+
"accessibilityLabel": "Show password",
|
|
338
|
+
"accessibilityRole": "button",
|
|
339
|
+
"accessibilityState": {
|
|
340
|
+
"disabled": true,
|
|
341
|
+
"expanded": false,
|
|
342
|
+
},
|
|
343
|
+
"disabled": true,
|
|
344
|
+
"hitSlop": 8,
|
|
345
|
+
"onPress": [Function],
|
|
346
|
+
"style": {
|
|
347
|
+
"alignItems": "center",
|
|
348
|
+
"marginLeft": 8,
|
|
349
|
+
"width": 20,
|
|
350
|
+
},
|
|
351
|
+
"testID": "signup-screen-password-input.visibility-toggle",
|
|
352
|
+
},
|
|
353
|
+
"type": "Pressable",
|
|
354
|
+
},
|
|
333
355
|
],
|
|
334
356
|
"props": {
|
|
335
357
|
"style": {
|
|
@@ -1,9 +1,43 @@
|
|
|
1
|
-
import {describe, expect, it} from "bun:test";
|
|
1
|
+
import {afterEach, describe, expect, it} from "bun:test";
|
|
2
2
|
import {render} from "@testing-library/react-native";
|
|
3
|
+
import {DateTime, Settings} from "luxon";
|
|
3
4
|
|
|
4
5
|
import {TableDate} from "./TableDate";
|
|
5
6
|
|
|
6
7
|
describe("TableDate", () => {
|
|
8
|
+
const freezeNow = (iso: string): void => {
|
|
9
|
+
const millis = DateTime.fromISO(iso).toMillis();
|
|
10
|
+
Settings.now = () => millis;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
Settings.now = () => Date.now();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("pluralizes years, months, and days in the annotation", () => {
|
|
18
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
19
|
+
const {getByText} = render(<TableDate annotated value="2022-03-15T12:00:00.000Z" />);
|
|
20
|
+
expect(getByText("03/15/2022 (2 Years 3 Mos 5 Days)")).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("uses singular labels for exactly one year, month, and day", () => {
|
|
24
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
25
|
+
const {getByText} = render(<TableDate annotated value="2023-05-19T12:00:00.000Z" />);
|
|
26
|
+
expect(getByText("05/19/2023 (1 Year 1 Mo 1 Day)")).toBeTruthy();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("omits zero units from the annotation", () => {
|
|
30
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
31
|
+
const {getByText} = render(<TableDate annotated value="2024-06-10T12:00:00.000Z" />);
|
|
32
|
+
expect(getByText("06/10/2024 (10 Days)")).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("renders an empty annotation for today's date", () => {
|
|
36
|
+
freezeNow("2024-06-20T12:00:00.000Z");
|
|
37
|
+
const {getByText} = render(<TableDate annotated value="2024-06-20T12:00:00.000Z" />);
|
|
38
|
+
expect(getByText("06/20/2024 ()")).toBeTruthy();
|
|
39
|
+
});
|
|
40
|
+
|
|
7
41
|
it("renders correctly with ISO string date", () => {
|
|
8
42
|
const {toJSON} = render(<TableDate value="2024-01-15T12:00:00.000Z" />);
|
|
9
43
|
expect(toJSON()).toMatchSnapshot();
|
|
@@ -69,6 +69,7 @@ describe("resolveFieldTestIDs", () => {
|
|
|
69
69
|
helper: "signup.email.helper",
|
|
70
70
|
input: "signup.email",
|
|
71
71
|
label: "signup.email.label",
|
|
72
|
+
visibilityToggle: "signup.email.visibility-toggle",
|
|
72
73
|
});
|
|
73
74
|
});
|
|
74
75
|
|
|
@@ -77,12 +78,14 @@ describe("resolveFieldTestIDs", () => {
|
|
|
77
78
|
resolveFieldTestIDs("signup.email", {
|
|
78
79
|
input: "custom-input",
|
|
79
80
|
label: "custom-label",
|
|
81
|
+
visibilityToggle: "custom-toggle",
|
|
80
82
|
})
|
|
81
83
|
).toEqual({
|
|
82
84
|
error: "signup.email.error",
|
|
83
85
|
helper: "signup.email.helper",
|
|
84
86
|
input: "custom-input",
|
|
85
87
|
label: "custom-label",
|
|
88
|
+
visibilityToggle: "custom-toggle",
|
|
86
89
|
});
|
|
87
90
|
});
|
|
88
91
|
});
|
|
@@ -62,6 +62,7 @@ export const resolveFieldTestIDs = (
|
|
|
62
62
|
helper: testIDs?.helper ?? resolveTestID(baseTestID, "helper"),
|
|
63
63
|
input: testIDs?.input ?? baseTestID,
|
|
64
64
|
label: testIDs?.label ?? resolveTestID(baseTestID, "label"),
|
|
65
|
+
visibilityToggle: testIDs?.visibilityToggle ?? resolveTestID(baseTestID, "visibility-toggle"),
|
|
65
66
|
};
|
|
66
67
|
};
|
|
67
68
|
|
package/src/testing/types.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface FieldTestIDs {
|
|
|
10
10
|
input?: string;
|
|
11
11
|
error?: string;
|
|
12
12
|
helper?: string;
|
|
13
|
+
/** Show/hide control on password fields. */
|
|
14
|
+
visibilityToggle?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/** Sub-element test ids for Modal. */
|
|
@@ -42,6 +44,7 @@ export interface ResolvedFieldTestIDs {
|
|
|
42
44
|
input?: string;
|
|
43
45
|
error?: string;
|
|
44
46
|
helper?: string;
|
|
47
|
+
visibilityToggle?: string;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
export interface ResolvedModalTestIDs {
|