@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
package/src/Common.ts
CHANGED
|
@@ -493,8 +493,17 @@ export interface FilterProps extends WithTestID {
|
|
|
493
493
|
children: React.ReactNode;
|
|
494
494
|
/** Trigger button label. */
|
|
495
495
|
label?: string;
|
|
496
|
+
/** Accessible name when the visible trigger label is empty or abbreviated. */
|
|
497
|
+
triggerAccessibilityLabel?: string;
|
|
496
498
|
/** Trigger button icon. Defaults to the built-in `bars-filter` glyph. */
|
|
497
499
|
iconName?: IconName;
|
|
500
|
+
/**
|
|
501
|
+
* Render the trigger as a compact `IconButton` instead of a labeled button.
|
|
502
|
+
* Use for dense chrome such as table column headers. `label` is ignored.
|
|
503
|
+
*/
|
|
504
|
+
iconOnly?: boolean;
|
|
505
|
+
/** Trigger size when `iconOnly` is set. Defaults to `sm`. */
|
|
506
|
+
triggerSize?: "sm" | "default";
|
|
498
507
|
/** Controlled open state. Omit to use `defaultOpen`. */
|
|
499
508
|
isOpen?: boolean;
|
|
500
509
|
/** Initial open state when uncontrolled. */
|
|
@@ -637,15 +646,14 @@ export interface BoxPropsBase extends WithTestID {
|
|
|
637
646
|
lgColumn?: UnsignedUpTo12;
|
|
638
647
|
dangerouslySetInlineStyle?: {
|
|
639
648
|
__style: {
|
|
640
|
-
|
|
641
|
-
// biome-ignore lint/suspicious/noExplicitAny: escape hatch for arbitrary inline style values that users may need to set
|
|
642
|
-
[key: string]: any;
|
|
649
|
+
[key: string]: unknown;
|
|
643
650
|
};
|
|
644
651
|
};
|
|
645
652
|
direction?: "row" | "column";
|
|
646
653
|
smDirection?: "row" | "column";
|
|
647
654
|
mdDirection?: "row" | "column";
|
|
648
655
|
lgDirection?: "row" | "column";
|
|
656
|
+
xlDirection?: "row" | "column";
|
|
649
657
|
display?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
650
658
|
smDisplay?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
651
659
|
mdDisplay?: "none" | "flex" | "block" | "inlineBlock" | "visuallyHidden";
|
|
@@ -936,6 +944,13 @@ export interface AiSuggestionProps {
|
|
|
936
944
|
export interface TextFieldProps extends BaseFieldProps, HelperTextProps, ErrorTextProps {
|
|
937
945
|
type?: "email" | "password" | "phoneNumber" | "search" | "text" | "url";
|
|
938
946
|
|
|
947
|
+
/**
|
|
948
|
+
* Renders the show/hide eye control on `type="password"`. Set to `false` for fields where
|
|
949
|
+
* revealing the value is not acceptable, such as a shared or on-camera screen.
|
|
950
|
+
* @default true
|
|
951
|
+
*/
|
|
952
|
+
showVisibilityToggle?: boolean;
|
|
953
|
+
|
|
939
954
|
autoComplete?: "current-password" | "on" | "off" | "username";
|
|
940
955
|
returnKeyType?: "done" | "go" | "next" | "search" | "send";
|
|
941
956
|
|
|
@@ -1121,7 +1136,11 @@ export interface LayoutChangeEvent {
|
|
|
1121
1136
|
};
|
|
1122
1137
|
}
|
|
1123
1138
|
|
|
1124
|
-
export interface
|
|
1139
|
+
export interface SplitPageListItem {
|
|
1140
|
+
id: string;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
export interface SplitPageProps<TItem extends SplitPageListItem = SplitPageListItem> {
|
|
1125
1144
|
/**
|
|
1126
1145
|
* can accept either one React Child or any array of ReactChild. If this is not provided,
|
|
1127
1146
|
* renderContent must return one or many ReactChild.
|
|
@@ -1141,21 +1160,15 @@ export interface SplitPageProps {
|
|
|
1141
1160
|
loading?: boolean;
|
|
1142
1161
|
color?: SurfaceColor;
|
|
1143
1162
|
keyboardOffset?: number;
|
|
1144
|
-
|
|
1145
|
-
// biome-ignore lint/suspicious/noExplicitAny: ListRenderItemInfo generic type depends on the consumer's data shape
|
|
1146
|
-
renderListViewItem: (itemInfo: ListRenderItemInfo<any>) => ReactElement | null;
|
|
1163
|
+
renderListViewItem: (itemInfo: ListRenderItemInfo<TItem>) => ReactElement | null;
|
|
1147
1164
|
renderListViewHeader?: () => ReactElement | null;
|
|
1148
1165
|
renderContent?: (index?: number) => ReactElement | ReactElement[] | null;
|
|
1149
|
-
|
|
1150
|
-
// biome-ignore lint/suspicious/noExplicitAny: list data type varies by consumer's data model
|
|
1151
|
-
listViewData: any[];
|
|
1166
|
+
listViewData: TItem[];
|
|
1152
1167
|
listViewExtraData?: unknown;
|
|
1153
1168
|
listViewWidth?: number;
|
|
1154
1169
|
listViewMaxWidth?: number;
|
|
1155
1170
|
renderChild?: () => ReactChild;
|
|
1156
|
-
|
|
1157
|
-
// biome-ignore lint/suspicious/noExplicitAny: callback value type varies by consumer's data model
|
|
1158
|
-
onSelectionChange?: (value?: any) => void | Promise<void>;
|
|
1171
|
+
onSelectionChange?: (value?: ListRenderItemInfo<TItem>) => void | Promise<void>;
|
|
1159
1172
|
}
|
|
1160
1173
|
|
|
1161
1174
|
export type PermissionKind =
|
|
@@ -1708,6 +1721,91 @@ export interface ThumbsUpDownFeedbackProps extends WithTestID {
|
|
|
1708
1721
|
value?: ThumbsUpDownFeedbackValue;
|
|
1709
1722
|
}
|
|
1710
1723
|
|
|
1724
|
+
export type PopoverStatus = "loading" | "loaded" | "error";
|
|
1725
|
+
|
|
1726
|
+
export interface PopoverProps extends WithTestID {
|
|
1727
|
+
/**
|
|
1728
|
+
* The body of the document, rendered under the header when status is "loaded". Use this for
|
|
1729
|
+
* rich content; prefer `text` for a plain summary.
|
|
1730
|
+
*/
|
|
1731
|
+
children?: React.ReactNode;
|
|
1732
|
+
/**
|
|
1733
|
+
* Supporting copy shown under the error title.
|
|
1734
|
+
* @default "Something went wrong while loading this document. Check your connection and try again."
|
|
1735
|
+
*/
|
|
1736
|
+
errorText?: string;
|
|
1737
|
+
/**
|
|
1738
|
+
* Title shown in the error state.
|
|
1739
|
+
* @default "Couldn't load this document"
|
|
1740
|
+
*/
|
|
1741
|
+
errorTitle?: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* The currently selected feedback on the document. Only shown when `onFeedbackChange` is set.
|
|
1744
|
+
*/
|
|
1745
|
+
feedback?: ThumbsUpDownFeedbackValue;
|
|
1746
|
+
/**
|
|
1747
|
+
* Height of the popover. The popover is the same height in every status: the body scrolls when
|
|
1748
|
+
* it overflows, and the spinner and error message are centered in the remaining space.
|
|
1749
|
+
* @default 480
|
|
1750
|
+
*/
|
|
1751
|
+
height?: NumberOrPercentage;
|
|
1752
|
+
/**
|
|
1753
|
+
* Header text shown while the document is loading.
|
|
1754
|
+
* @default "Loading document..."
|
|
1755
|
+
*/
|
|
1756
|
+
loadingText?: string;
|
|
1757
|
+
/**
|
|
1758
|
+
* Called when the close button is pressed.
|
|
1759
|
+
*/
|
|
1760
|
+
onClose: () => void | Promise<void>;
|
|
1761
|
+
/**
|
|
1762
|
+
* Called with the newly selected feedback, or undefined when the current value is deselected.
|
|
1763
|
+
* When omitted, the thumbs up/down controls are hidden.
|
|
1764
|
+
*/
|
|
1765
|
+
onFeedbackChange?: (value?: ThumbsUpDownFeedbackValue) => void | Promise<void>;
|
|
1766
|
+
/**
|
|
1767
|
+
* Called when the "Open" action is pressed. When omitted, the action is hidden.
|
|
1768
|
+
*/
|
|
1769
|
+
onOpen?: () => void | Promise<void>;
|
|
1770
|
+
/**
|
|
1771
|
+
* Called when the "Try again" button is pressed in the error state. When omitted, the button
|
|
1772
|
+
* is hidden.
|
|
1773
|
+
*/
|
|
1774
|
+
onRetry?: () => void | Promise<void>;
|
|
1775
|
+
/**
|
|
1776
|
+
* Text of the action that opens the full document.
|
|
1777
|
+
* @default "Open"
|
|
1778
|
+
*/
|
|
1779
|
+
openText?: string;
|
|
1780
|
+
/**
|
|
1781
|
+
* Text of the button that retries loading in the error state.
|
|
1782
|
+
* @default "Try again"
|
|
1783
|
+
*/
|
|
1784
|
+
retryText?: string;
|
|
1785
|
+
/**
|
|
1786
|
+
* The state of the document being previewed.
|
|
1787
|
+
* @default "loaded"
|
|
1788
|
+
*/
|
|
1789
|
+
status?: PopoverStatus;
|
|
1790
|
+
/**
|
|
1791
|
+
* Secondary header line, usually the document's date.
|
|
1792
|
+
*/
|
|
1793
|
+
subtitle?: string;
|
|
1794
|
+
/**
|
|
1795
|
+
* A plain text summary of the document, rendered when no `children` are provided.
|
|
1796
|
+
*/
|
|
1797
|
+
text?: string;
|
|
1798
|
+
/**
|
|
1799
|
+
* The document's title, shown in the header when status is "loaded".
|
|
1800
|
+
*/
|
|
1801
|
+
title?: string;
|
|
1802
|
+
/**
|
|
1803
|
+
* Width of the popover.
|
|
1804
|
+
* @default 480
|
|
1805
|
+
*/
|
|
1806
|
+
width?: NumberOrPercentage;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1711
1809
|
export interface SelectBadgeProps {
|
|
1712
1810
|
/**
|
|
1713
1811
|
* When status is "custom", determines the badge's background color.
|
|
@@ -1810,6 +1908,8 @@ export interface BodyProps {
|
|
|
1810
1908
|
export type ButtonPressAnimation = "scale" | "opacity" | "none";
|
|
1811
1909
|
|
|
1812
1910
|
export interface ButtonProps extends WithTestID {
|
|
1911
|
+
/** Accessible name. Defaults to `text`. */
|
|
1912
|
+
accessibilityLabel?: string;
|
|
1813
1913
|
/**
|
|
1814
1914
|
* The text content of the confirmation modal.
|
|
1815
1915
|
* @default "Are you sure you want to continue?"
|
|
@@ -1874,6 +1974,12 @@ export interface ButtonProps extends WithTestID {
|
|
|
1874
1974
|
* @default "default"
|
|
1875
1975
|
*/
|
|
1876
1976
|
size?: "default" | "sm";
|
|
1977
|
+
/**
|
|
1978
|
+
* Controls the button's interaction state. Use Default for standard button appearance
|
|
1979
|
+
* and Active to indicate a selected or currently engaged state.
|
|
1980
|
+
* @default "default"
|
|
1981
|
+
*/
|
|
1982
|
+
state?: "default" | "active";
|
|
1877
1983
|
/**
|
|
1878
1984
|
* The type of the button, which determines its style.
|
|
1879
1985
|
* @default "primary"
|
|
@@ -2077,24 +2183,31 @@ export interface HeightActionSheetProps {
|
|
|
2077
2183
|
title?: string;
|
|
2078
2184
|
}
|
|
2079
2185
|
|
|
2186
|
+
export interface LinkifyMatch {
|
|
2187
|
+
index: number;
|
|
2188
|
+
lastIndex: number;
|
|
2189
|
+
raw: string;
|
|
2190
|
+
schema: string;
|
|
2191
|
+
text: string;
|
|
2192
|
+
url: string;
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
export interface LinkifyItLike {
|
|
2196
|
+
pretest: (text: string) => boolean;
|
|
2197
|
+
test: (text: string) => boolean;
|
|
2198
|
+
match: (text: string) => LinkifyMatch[] | null;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2080
2201
|
export interface HyperlinkProps {
|
|
2081
2202
|
linkDefault?: boolean;
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
linkify?: any;
|
|
2085
|
-
// noExplicitAny: StyleProp's generic is heterogeneous (TextStyle | ViewStyle) for link contexts
|
|
2086
|
-
// biome-ignore lint/suspicious/noExplicitAny: StyleProp's generic is heterogeneous (TextStyle | ViewStyle) for link contexts
|
|
2087
|
-
linkStyle?: StyleProp<any>;
|
|
2203
|
+
linkify?: LinkifyItLike;
|
|
2204
|
+
linkStyle?: StyleProp<TextStyle>;
|
|
2088
2205
|
linkText?: string | ((url: string) => string);
|
|
2089
2206
|
onPress?: (url: string) => void;
|
|
2090
2207
|
onLongPress?: (url: string, text: string) => void;
|
|
2091
|
-
|
|
2092
|
-
// biome-ignore lint/suspicious/noExplicitAny: returned view props are spread onto a heterogeneous View; consumers pass arbitrary props
|
|
2093
|
-
injectViewProps?: (url: string) => any;
|
|
2208
|
+
injectViewProps?: (url: string) => Record<string, unknown>;
|
|
2094
2209
|
children?: React.ReactNode;
|
|
2095
|
-
|
|
2096
|
-
// biome-ignore lint/suspicious/noExplicitAny: StyleProp's generic is heterogeneous for the container which holds mixed Text/View children
|
|
2097
|
-
style?: StyleProp<any>;
|
|
2210
|
+
style?: StyleProp<ViewStyle | TextStyle>;
|
|
2098
2211
|
}
|
|
2099
2212
|
|
|
2100
2213
|
export interface IconButtonProps extends WithTestID {
|
|
@@ -2283,6 +2396,8 @@ export interface PageProps extends WithTestID {
|
|
|
2283
2396
|
display?: "flex" | "none" | "block" | "inlineBlock";
|
|
2284
2397
|
title?: string;
|
|
2285
2398
|
backButton?: boolean;
|
|
2399
|
+
/** When set, invoked instead of `router.back()` for the header back arrow. */
|
|
2400
|
+
onBack?: () => void;
|
|
2286
2401
|
closeButton?: boolean;
|
|
2287
2402
|
direction?: "row" | "column";
|
|
2288
2403
|
padding?: UnsignedUpTo12;
|
|
@@ -2528,6 +2643,35 @@ export interface PaginationProps extends WithTestID {
|
|
|
2528
2643
|
totalPages: number;
|
|
2529
2644
|
}
|
|
2530
2645
|
|
|
2646
|
+
export interface LineChartProps extends WithTestID {
|
|
2647
|
+
/** Summary announced for the whole chart. */
|
|
2648
|
+
accessibilityLabel?: string;
|
|
2649
|
+
/** Single series of labeled numeric points. */
|
|
2650
|
+
data: Array<{color?: string; label: string; value: number}>;
|
|
2651
|
+
/** Copy shown when `data` is empty. */
|
|
2652
|
+
emptyText?: string;
|
|
2653
|
+
/** Formats the numeric value in tooltips. */
|
|
2654
|
+
formatValue?: (value: number) => string;
|
|
2655
|
+
/** Plot height in pixels. */
|
|
2656
|
+
height?: number;
|
|
2657
|
+
/** Series name shown under the plot. */
|
|
2658
|
+
legendLabel?: string;
|
|
2659
|
+
/** When true, shows a spinner instead of the plot. */
|
|
2660
|
+
loading?: boolean;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
export interface AreaChartProps extends LineChartProps {}
|
|
2664
|
+
export interface BarChartProps extends LineChartProps {}
|
|
2665
|
+
|
|
2666
|
+
export interface DonutChartProps extends LineChartProps {}
|
|
2667
|
+
|
|
2668
|
+
export interface DashboardGridProps extends WithTestID {
|
|
2669
|
+
children?: React.ReactNode;
|
|
2670
|
+
/** Column counts by breakpoint. Defaults to `{sm: 1, md: 2, lg: 3}`. */
|
|
2671
|
+
columns?: {lg: number; md: number; sm: number};
|
|
2672
|
+
gap?: UnsignedUpTo12;
|
|
2673
|
+
}
|
|
2674
|
+
|
|
2531
2675
|
/**
|
|
2532
2676
|
* Data Table
|
|
2533
2677
|
*/
|
|
@@ -2541,6 +2685,33 @@ export type DataTableCustomComponentMap = Record<
|
|
|
2541
2685
|
string,
|
|
2542
2686
|
React.ComponentType<{column: DataTableColumn; cellData: DataTableCellData}>
|
|
2543
2687
|
>;
|
|
2688
|
+
|
|
2689
|
+
export interface DataTableColumnFilterChoiceOption {
|
|
2690
|
+
label: string;
|
|
2691
|
+
value: string;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
export interface DataTableColumnFilterRenderArgs {
|
|
2695
|
+
field: string;
|
|
2696
|
+
onChange: (value: unknown) => void;
|
|
2697
|
+
value: unknown;
|
|
2698
|
+
}
|
|
2699
|
+
|
|
2700
|
+
export interface DataTableColumnFilter {
|
|
2701
|
+
field: string;
|
|
2702
|
+
kind: "text" | "boolean" | "numberRange" | "dateRange" | "choice";
|
|
2703
|
+
label?: string;
|
|
2704
|
+
/** When true, choice filters include an Empty option for null/unset field values. */
|
|
2705
|
+
allowEmpty?: boolean;
|
|
2706
|
+
options?: DataTableColumnFilterChoiceOption[];
|
|
2707
|
+
renderFilter?: (args: DataTableColumnFilterRenderArgs) => React.ReactNode;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
export interface DataTableQueryParams {
|
|
2711
|
+
[field: string]: unknown;
|
|
2712
|
+
$or?: Array<Record<string, unknown>>;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2544
2715
|
export interface DataTableColumn {
|
|
2545
2716
|
title: string;
|
|
2546
2717
|
columnType: "text" | "number" | "date" | "boolean" | string;
|
|
@@ -2548,12 +2719,17 @@ export interface DataTableColumn {
|
|
|
2548
2719
|
highlight?: SurfaceColor;
|
|
2549
2720
|
sortable?: boolean;
|
|
2550
2721
|
infoModalText?: string;
|
|
2722
|
+
filter?: DataTableColumnFilter;
|
|
2551
2723
|
}
|
|
2552
2724
|
|
|
2553
2725
|
export interface DataTableProps extends WithTestID {
|
|
2554
2726
|
testIDs?: DataTableTestIDs;
|
|
2555
2727
|
data: DataTableCellData[][];
|
|
2556
2728
|
columns: DataTableColumn[];
|
|
2729
|
+
/** Filter definitions that are not attached to a visible column. */
|
|
2730
|
+
additionalFilters?: DataTableColumnFilter[];
|
|
2731
|
+
/** Content shown below the header when `data` is empty. */
|
|
2732
|
+
emptyContent?: React.ReactNode;
|
|
2557
2733
|
alternateRowBackground?: boolean;
|
|
2558
2734
|
totalPages?: number;
|
|
2559
2735
|
page?: number;
|
|
@@ -2582,6 +2758,16 @@ export interface DataTableProps extends WithTestID {
|
|
|
2582
2758
|
* Returns a stable key for row test ids. Defaults to row index when omitted.
|
|
2583
2759
|
*/
|
|
2584
2760
|
getRowTestID?: (row: DataTableCellData[], rowIndex: number) => string | number;
|
|
2761
|
+
/** Toolbar search string (controlled). Omit with `searchFields` to hide search. */
|
|
2762
|
+
search?: string;
|
|
2763
|
+
/** Fields included in generic `$or` search params. */
|
|
2764
|
+
searchFields?: string[];
|
|
2765
|
+
onSearchChange?: (search: string) => void;
|
|
2766
|
+
/** Controlled column filter draft/applied values keyed by field (and `field_gte` / `field_lte`). */
|
|
2767
|
+
filterValues?: Record<string, unknown>;
|
|
2768
|
+
onFilterValuesChange?: (next: Record<string, unknown>) => void;
|
|
2769
|
+
/** Fires when debounced search or applied filters change. Excludes page, limit, and sort. */
|
|
2770
|
+
onQueryChange?: (params: DataTableQueryParams) => void;
|
|
2585
2771
|
}
|
|
2586
2772
|
|
|
2587
2773
|
export interface DataTableCellProps {
|
|
@@ -2836,6 +3022,14 @@ export type TapToEditProps =
|
|
|
2836
3022
|
});
|
|
2837
3023
|
|
|
2838
3024
|
export interface BaseTapToEditProps extends Omit<FieldProps, "onChange" | "value"> {
|
|
3025
|
+
/**
|
|
3026
|
+
* Root test id. Forwards to the Field input and suffixes action controls for e2e:
|
|
3027
|
+
* `{testID}.edit-clickable`, `{testID}.cancel`, `{testID}.clear`, `{testID}.save`.
|
|
3028
|
+
* The edit control is a pressable Box (`-clickable` is appended by Box).
|
|
3029
|
+
* Cancel/Clear/Save only render when the user opened edit from inside the
|
|
3030
|
+
* component, not when `isEditing` is true.
|
|
3031
|
+
*/
|
|
3032
|
+
testID?: string;
|
|
2839
3033
|
title: string;
|
|
2840
3034
|
// noExplicitAny: value type varies across TapToEdit field types (text, number, date, etc.)
|
|
2841
3035
|
// biome-ignore lint/suspicious/noExplicitAny: value type varies across TapToEdit field types (text, number, date, etc.)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {describe, it, mock} from "bun:test";
|
|
2
|
+
import {join} from "node:path";
|
|
3
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
4
|
+
import {assert} from "chai";
|
|
5
|
+
import type React from "react";
|
|
6
|
+
|
|
7
|
+
const ISOLATED_RUN_ENV = "TERRENO_CONSENT_MARKDOWN_GATE_ISOLATED";
|
|
8
|
+
const isIsolatedRun = process.env[ISOLATED_RUN_ENV] === "true";
|
|
9
|
+
|
|
10
|
+
const form = {
|
|
11
|
+
active: true,
|
|
12
|
+
agreeButtonText: "I agree",
|
|
13
|
+
allowDecline: false,
|
|
14
|
+
captureSignature: false,
|
|
15
|
+
checkboxes: [],
|
|
16
|
+
content: {en: "Consent body"},
|
|
17
|
+
declineButtonText: "Decline",
|
|
18
|
+
defaultLocale: "en",
|
|
19
|
+
id: "consent-1",
|
|
20
|
+
order: 0,
|
|
21
|
+
required: true,
|
|
22
|
+
requireScrollToBottom: true,
|
|
23
|
+
slug: "consent",
|
|
24
|
+
title: "Consent",
|
|
25
|
+
type: "tos" as const,
|
|
26
|
+
version: 1,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (isIsolatedRun) {
|
|
30
|
+
let markdownOnLoad: (() => void) | undefined;
|
|
31
|
+
let markdownRenderCount = 0;
|
|
32
|
+
|
|
33
|
+
mock.module("./MarkdownView", () => ({
|
|
34
|
+
MarkdownView: ({children, onLoad}: {children?: React.ReactNode; onLoad?: () => void}) => {
|
|
35
|
+
markdownRenderCount += 1;
|
|
36
|
+
markdownOnLoad = onLoad;
|
|
37
|
+
return <>{children}</>;
|
|
38
|
+
},
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const [{ConsentFormScreen}, {renderWithTheme}] = await Promise.all([
|
|
42
|
+
import("./ConsentFormScreen"),
|
|
43
|
+
import("./test-utils"),
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
describe("ConsentFormScreen markdown load gate isolated behavior", () => {
|
|
47
|
+
it("ignores layout, content-size, and scroll events until markdown loads", () => {
|
|
48
|
+
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
49
|
+
<ConsentFormScreen form={form} locale="en" onAgree={() => {}} />
|
|
50
|
+
);
|
|
51
|
+
const scroll = getByTestId("consent-form-scroll-view");
|
|
52
|
+
|
|
53
|
+
assert.equal(markdownRenderCount, 1);
|
|
54
|
+
assert.isFunction(markdownOnLoad);
|
|
55
|
+
|
|
56
|
+
act(() => {
|
|
57
|
+
fireEvent(scroll, "contentSizeChange", 0, 400);
|
|
58
|
+
});
|
|
59
|
+
assert.isOk(getByTestId("consent-form-scroll-hint"));
|
|
60
|
+
|
|
61
|
+
act(() => {
|
|
62
|
+
fireEvent(scroll, "layout", {nativeEvent: {layout: {height: 500}}});
|
|
63
|
+
});
|
|
64
|
+
assert.isOk(getByTestId("consent-form-scroll-hint"));
|
|
65
|
+
|
|
66
|
+
act(() => {
|
|
67
|
+
fireEvent(scroll, "contentSizeChange", 0, 400);
|
|
68
|
+
});
|
|
69
|
+
assert.isOk(getByTestId("consent-form-scroll-hint"));
|
|
70
|
+
|
|
71
|
+
act(() => {
|
|
72
|
+
fireEvent(scroll, "scroll", {
|
|
73
|
+
nativeEvent: {
|
|
74
|
+
contentOffset: {y: 0},
|
|
75
|
+
contentSize: {height: 100},
|
|
76
|
+
layoutMeasurement: {height: 500},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
assert.isOk(getByTestId("consent-form-scroll-hint"));
|
|
81
|
+
|
|
82
|
+
act(() => {
|
|
83
|
+
markdownOnLoad?.();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
act(() => {
|
|
87
|
+
fireEvent(scroll, "contentSizeChange", 0, 400);
|
|
88
|
+
});
|
|
89
|
+
assert.isNull(queryByTestId("consent-form-scroll-hint"));
|
|
90
|
+
|
|
91
|
+
act(() => {
|
|
92
|
+
fireEvent(scroll, "contentSizeChange", 0, 2000);
|
|
93
|
+
});
|
|
94
|
+
assert.isOk(getByTestId("consent-form-scroll-hint"));
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
const {MarkdownView: RealMarkdownViewBefore} = await import("./MarkdownView");
|
|
99
|
+
|
|
100
|
+
describe("ConsentFormScreen markdown load gate", () => {
|
|
101
|
+
it("runs deterministic pre-load checks without leaking its MarkdownView mock", async () => {
|
|
102
|
+
const child = Bun.spawn(
|
|
103
|
+
[
|
|
104
|
+
process.execPath,
|
|
105
|
+
"test",
|
|
106
|
+
"--preload",
|
|
107
|
+
join(import.meta.dir, "bunSetup.ts"),
|
|
108
|
+
import.meta.path,
|
|
109
|
+
],
|
|
110
|
+
{
|
|
111
|
+
cwd: join(import.meta.dir, ".."),
|
|
112
|
+
env: {...process.env, [ISOLATED_RUN_ENV]: "true"},
|
|
113
|
+
stderr: "pipe",
|
|
114
|
+
stdout: "pipe",
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
const [exitCode, stdout, stderr] = await Promise.all([
|
|
118
|
+
child.exited,
|
|
119
|
+
new Response(child.stdout).text(),
|
|
120
|
+
new Response(child.stderr).text(),
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
assert.equal(exitCode, 0, `${stdout}\n${stderr}`);
|
|
124
|
+
|
|
125
|
+
const {MarkdownView: RealMarkdownViewAfter} = await import("./MarkdownView");
|
|
126
|
+
assert.strictEqual(RealMarkdownViewAfter, RealMarkdownViewBefore);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
-
import {act, fireEvent} from "@testing-library/react-native";
|
|
1
|
+
import {afterEach, describe, expect, it, mock} from "bun:test";
|
|
2
|
+
import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
|
|
3
|
+
import {assert} from "chai";
|
|
4
|
+
import {Platform} from "react-native";
|
|
3
5
|
|
|
4
6
|
import {ConsentFormScreen} from "./ConsentFormScreen";
|
|
5
7
|
import {SignatureField} from "./SignatureField";
|
|
8
|
+
import {ThemeProvider} from "./Theme";
|
|
6
9
|
import {renderWithTheme} from "./test-utils";
|
|
7
10
|
import type {ConsentFormPublic} from "./useConsentForms";
|
|
8
11
|
|
|
@@ -25,6 +28,12 @@ const baseForm: ConsentFormPublic = {
|
|
|
25
28
|
version: 1,
|
|
26
29
|
};
|
|
27
30
|
|
|
31
|
+
const waitForConsentMarkdown = async (getByText: (text: string) => unknown): Promise<void> => {
|
|
32
|
+
await waitFor(() => {
|
|
33
|
+
expect(getByText("Consent body")).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
28
37
|
describe("ConsentFormScreen", () => {
|
|
29
38
|
it("renders with default state and a locale fallback", () => {
|
|
30
39
|
const onAgree = mock(() => {});
|
|
@@ -274,13 +283,13 @@ describe("ConsentFormScreen", () => {
|
|
|
274
283
|
});
|
|
275
284
|
});
|
|
276
285
|
|
|
277
|
-
it("auto-satisfies scroll requirement when content fits the viewport via contentSizeChange", () => {
|
|
286
|
+
it("auto-satisfies scroll requirement when content fits the viewport via contentSizeChange", async () => {
|
|
278
287
|
const form = {...baseForm, requireScrollToBottom: true};
|
|
279
|
-
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
288
|
+
const {getByTestId, getByText, queryByTestId} = renderWithTheme(
|
|
280
289
|
<ConsentFormScreen form={form} locale="en" onAgree={() => {}} />
|
|
281
290
|
);
|
|
291
|
+
await waitForConsentMarkdown(getByText);
|
|
282
292
|
const scroll = getByTestId("consent-form-scroll-view");
|
|
283
|
-
// First set the layout height, then content size smaller than layout
|
|
284
293
|
act(() => {
|
|
285
294
|
fireEvent(scroll, "layout", {nativeEvent: {layout: {height: 500}}});
|
|
286
295
|
});
|
|
@@ -290,13 +299,13 @@ describe("ConsentFormScreen", () => {
|
|
|
290
299
|
expect(queryByTestId("consent-form-scroll-hint")).toBeNull();
|
|
291
300
|
});
|
|
292
301
|
|
|
293
|
-
it("auto-satisfies scroll requirement when content fits the viewport via layout", () => {
|
|
302
|
+
it("auto-satisfies scroll requirement when content fits the viewport via layout", async () => {
|
|
294
303
|
const form = {...baseForm, requireScrollToBottom: true};
|
|
295
|
-
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
304
|
+
const {getByTestId, getByText, queryByTestId} = renderWithTheme(
|
|
296
305
|
<ConsentFormScreen form={form} locale="en" onAgree={() => {}} />
|
|
297
306
|
);
|
|
307
|
+
await waitForConsentMarkdown(getByText);
|
|
298
308
|
const scroll = getByTestId("consent-form-scroll-view");
|
|
299
|
-
// First set the content size, then layout height larger than content
|
|
300
309
|
act(() => {
|
|
301
310
|
fireEvent(scroll, "contentSizeChange", 0, 300);
|
|
302
311
|
});
|
|
@@ -306,6 +315,57 @@ describe("ConsentFormScreen", () => {
|
|
|
306
315
|
expect(queryByTestId("consent-form-scroll-hint")).toBeNull();
|
|
307
316
|
});
|
|
308
317
|
|
|
318
|
+
it("re-requires scroll when lazy content grows past the viewport", async () => {
|
|
319
|
+
const form = {...baseForm, requireScrollToBottom: true};
|
|
320
|
+
const {getByTestId, getByText, queryByTestId} = renderWithTheme(
|
|
321
|
+
<ConsentFormScreen form={form} locale="en" onAgree={() => {}} />
|
|
322
|
+
);
|
|
323
|
+
await waitForConsentMarkdown(getByText);
|
|
324
|
+
const scroll = getByTestId("consent-form-scroll-view");
|
|
325
|
+
act(() => {
|
|
326
|
+
fireEvent(scroll, "layout", {nativeEvent: {layout: {height: 500}}});
|
|
327
|
+
});
|
|
328
|
+
act(() => {
|
|
329
|
+
fireEvent(scroll, "contentSizeChange", 0, 80);
|
|
330
|
+
});
|
|
331
|
+
expect(queryByTestId("consent-form-scroll-hint")).toBeNull();
|
|
332
|
+
act(() => {
|
|
333
|
+
fireEvent(scroll, "contentSizeChange", 0, 2000);
|
|
334
|
+
});
|
|
335
|
+
expect(getByTestId("consent-form-scroll-hint")).toBeTruthy();
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
it("keeps a completed scroll when content shrinks after the in-list hint unmounts", async () => {
|
|
339
|
+
const form = {...baseForm, requireScrollToBottom: true};
|
|
340
|
+
const {getByTestId, getByText, queryByTestId} = renderWithTheme(
|
|
341
|
+
<ConsentFormScreen form={form} locale="en" onAgree={() => {}} />
|
|
342
|
+
);
|
|
343
|
+
await waitForConsentMarkdown(getByText);
|
|
344
|
+
const scroll = getByTestId("consent-form-scroll-view");
|
|
345
|
+
act(() => {
|
|
346
|
+
fireEvent(scroll, "layout", {nativeEvent: {layout: {height: 500}}});
|
|
347
|
+
});
|
|
348
|
+
act(() => {
|
|
349
|
+
fireEvent(scroll, "contentSizeChange", 0, 2000);
|
|
350
|
+
});
|
|
351
|
+
expect(getByTestId("consent-form-scroll-hint")).toBeTruthy();
|
|
352
|
+
act(() => {
|
|
353
|
+
fireEvent(scroll, "scroll", {
|
|
354
|
+
nativeEvent: {
|
|
355
|
+
contentOffset: {y: 1480},
|
|
356
|
+
contentSize: {height: 2000},
|
|
357
|
+
layoutMeasurement: {height: 500},
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
expect(queryByTestId("consent-form-scroll-hint")).toBeNull();
|
|
362
|
+
act(() => {
|
|
363
|
+
fireEvent(scroll, "contentSizeChange", 0, 1900);
|
|
364
|
+
});
|
|
365
|
+
expect(queryByTestId("consent-form-scroll-hint")).toBeNull();
|
|
366
|
+
expect(getByTestId("consent-form-agree-button")).toBeTruthy();
|
|
367
|
+
});
|
|
368
|
+
|
|
309
369
|
it("handleScroll returns early when already scrolled to bottom", () => {
|
|
310
370
|
const form = {...baseForm, requireScrollToBottom: false};
|
|
311
371
|
const {getByTestId} = renderWithTheme(
|
|
@@ -394,3 +454,80 @@ describe("ConsentFormScreen", () => {
|
|
|
394
454
|
expect(sig).toBeTruthy();
|
|
395
455
|
});
|
|
396
456
|
});
|
|
457
|
+
|
|
458
|
+
describe("ConsentFormScreen web scroll measurement", () => {
|
|
459
|
+
const originalOS = Platform.OS;
|
|
460
|
+
const originalRequestAnimationFrame = globalThis.requestAnimationFrame;
|
|
461
|
+
let frames: FrameRequestCallback[] = [];
|
|
462
|
+
|
|
463
|
+
const renderOnWeb = (scrollNode: {clientHeight?: number; scrollHeight?: number} | null) => {
|
|
464
|
+
Platform.OS = "web";
|
|
465
|
+
frames = [];
|
|
466
|
+
globalThis.requestAnimationFrame = ((callback: FrameRequestCallback): number => {
|
|
467
|
+
frames.push(callback);
|
|
468
|
+
return frames.length;
|
|
469
|
+
}) as typeof globalThis.requestAnimationFrame;
|
|
470
|
+
|
|
471
|
+
return render(
|
|
472
|
+
<ConsentFormScreen
|
|
473
|
+
form={{...baseForm, requireScrollToBottom: true}}
|
|
474
|
+
locale="en"
|
|
475
|
+
onAgree={() => {}}
|
|
476
|
+
/>,
|
|
477
|
+
{
|
|
478
|
+
createNodeMock: () => ({getScrollableNode: () => scrollNode}),
|
|
479
|
+
wrapper: ThemeProvider,
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
const flushFrames = (): void => {
|
|
485
|
+
act(() => {
|
|
486
|
+
for (const frame of frames.splice(0)) {
|
|
487
|
+
frame(0);
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
afterEach(() => {
|
|
493
|
+
Platform.OS = originalOS;
|
|
494
|
+
globalThis.requestAnimationFrame = originalRequestAnimationFrame;
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
it("unlocks the gate when the loaded content fits the viewport", async () => {
|
|
498
|
+
const {getByText, queryByTestId} = renderOnWeb({clientHeight: 500, scrollHeight: 200});
|
|
499
|
+
await waitForConsentMarkdown(getByText);
|
|
500
|
+
|
|
501
|
+
flushFrames();
|
|
502
|
+
|
|
503
|
+
assert.isNull(queryByTestId("consent-form-scroll-hint"));
|
|
504
|
+
assert.isNull(queryByTestId("consent-footer-scroll-hint"));
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it("keeps the gate when the loaded content overflows the viewport", async () => {
|
|
508
|
+
const {getByTestId, getByText} = renderOnWeb({clientHeight: 200, scrollHeight: 900});
|
|
509
|
+
await waitForConsentMarkdown(getByText);
|
|
510
|
+
|
|
511
|
+
flushFrames();
|
|
512
|
+
|
|
513
|
+
assert.isNotNull(getByTestId("consent-form-scroll-hint"));
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
it("keeps the gate when the scroll node has no measurements", async () => {
|
|
517
|
+
const {getByTestId, getByText} = renderOnWeb({});
|
|
518
|
+
await waitForConsentMarkdown(getByText);
|
|
519
|
+
|
|
520
|
+
flushFrames();
|
|
521
|
+
|
|
522
|
+
assert.isNotNull(getByTestId("consent-form-scroll-hint"));
|
|
523
|
+
});
|
|
524
|
+
|
|
525
|
+
it("keeps the gate when the scroll view has no node", async () => {
|
|
526
|
+
const {getByTestId, getByText} = renderOnWeb(null);
|
|
527
|
+
await waitForConsentMarkdown(getByText);
|
|
528
|
+
|
|
529
|
+
flushFrames();
|
|
530
|
+
|
|
531
|
+
assert.isNotNull(getByTestId("consent-form-scroll-hint"));
|
|
532
|
+
});
|
|
533
|
+
});
|