@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/GPTChat.tsx
CHANGED
|
@@ -115,6 +115,12 @@ export interface GPTChatProps {
|
|
|
115
115
|
onSubmit: (prompt: string) => void;
|
|
116
116
|
onUpdateTitle?: (id: string, title: string) => void;
|
|
117
117
|
selectedModel?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Optional consumer-owned character for an empty chat. Terreno does not ship a
|
|
120
|
+
* default mascot — pass an image, icon, Lottie view, or any React node. Hidden
|
|
121
|
+
* once `currentMessages` is non-empty.
|
|
122
|
+
*/
|
|
123
|
+
mascot?: React.ReactNode;
|
|
118
124
|
suggestedPrompts?: string[];
|
|
119
125
|
systemMemory?: string;
|
|
120
126
|
testID?: string;
|
|
@@ -584,12 +590,128 @@ const AssistantActions = ({
|
|
|
584
590
|
);
|
|
585
591
|
};
|
|
586
592
|
|
|
593
|
+
const EmptyChatHero = ({
|
|
594
|
+
handleSuggestedPrompt,
|
|
595
|
+
isStreaming,
|
|
596
|
+
mascot,
|
|
597
|
+
suggestedPrompts,
|
|
598
|
+
viewportHeight,
|
|
599
|
+
}: {
|
|
600
|
+
handleSuggestedPrompt: (prompt: string) => void;
|
|
601
|
+
isStreaming: boolean;
|
|
602
|
+
mascot?: React.ReactNode;
|
|
603
|
+
suggestedPrompts?: string[];
|
|
604
|
+
viewportHeight: number;
|
|
605
|
+
}): React.ReactElement | null => {
|
|
606
|
+
const hasSuggestedPrompts = Boolean(suggestedPrompts && suggestedPrompts.length > 0);
|
|
607
|
+
if (!mascot && !hasSuggestedPrompts && !isStreaming) {
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
return (
|
|
611
|
+
<Box
|
|
612
|
+
alignItems="center"
|
|
613
|
+
flex="grow"
|
|
614
|
+
justifyContent="center"
|
|
615
|
+
padding={4}
|
|
616
|
+
testID="gpt-empty-state"
|
|
617
|
+
{...(viewportHeight > 0 ? {minHeight: viewportHeight} : {})}
|
|
618
|
+
>
|
|
619
|
+
<Box alignItems="center" gap={5} maxWidth={640} width="100%">
|
|
620
|
+
{mascot ? (
|
|
621
|
+
<Box alignItems="center" testID="gpt-mascot">
|
|
622
|
+
{mascot}
|
|
623
|
+
</Box>
|
|
624
|
+
) : null}
|
|
625
|
+
{hasSuggestedPrompts ? (
|
|
626
|
+
<Box alignItems="center" gap={3} width="100%">
|
|
627
|
+
<Text color="secondaryDark" size="sm">
|
|
628
|
+
Try asking...
|
|
629
|
+
</Text>
|
|
630
|
+
<Box direction="row" gap={2} justifyContent="center" wrap={true}>
|
|
631
|
+
{suggestedPrompts?.map((prompt) => (
|
|
632
|
+
<Box
|
|
633
|
+
accessibilityHint="Send this suggested prompt"
|
|
634
|
+
accessibilityLabel={prompt}
|
|
635
|
+
border="default"
|
|
636
|
+
key={prompt}
|
|
637
|
+
onClick={() => handleSuggestedPrompt(prompt)}
|
|
638
|
+
paddingX={3}
|
|
639
|
+
paddingY={2}
|
|
640
|
+
rounding="lg"
|
|
641
|
+
>
|
|
642
|
+
<Text size="sm">{prompt}</Text>
|
|
643
|
+
</Box>
|
|
644
|
+
))}
|
|
645
|
+
</Box>
|
|
646
|
+
</Box>
|
|
647
|
+
) : null}
|
|
648
|
+
</Box>
|
|
649
|
+
<StreamingIndicator isStreaming={isStreaming} />
|
|
650
|
+
</Box>
|
|
651
|
+
);
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
const MessageList = ({
|
|
655
|
+
currentMessages,
|
|
656
|
+
handleCopyMessage,
|
|
657
|
+
onRateFeedback,
|
|
658
|
+
}: {
|
|
659
|
+
currentMessages: GPTChatMessage[];
|
|
660
|
+
handleCopyMessage: (text: string) => void;
|
|
661
|
+
onRateFeedback?: (promptIndex: number, rating: "up" | "down" | null) => void;
|
|
662
|
+
}): React.ReactElement => {
|
|
663
|
+
return (
|
|
664
|
+
<>
|
|
665
|
+
{currentMessages.map((message, index) => {
|
|
666
|
+
if (message.role === "tool-call" && message.toolCall) {
|
|
667
|
+
return (
|
|
668
|
+
<Box alignItems="start" key={`msg-${index}`} maxWidth="80%">
|
|
669
|
+
<ToolCallCard toolCall={message.toolCall} />
|
|
670
|
+
</Box>
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
if (message.role === "tool-result" && message.toolResult) {
|
|
674
|
+
return (
|
|
675
|
+
<Box alignItems="start" key={`msg-${index}`} maxWidth="80%">
|
|
676
|
+
<ToolResultCard toolResult={message.toolResult} />
|
|
677
|
+
</Box>
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
const hasImages = message.contentParts?.some((p) => p.type === "image");
|
|
682
|
+
return (
|
|
683
|
+
<Box alignItems={message.role === "user" ? "end" : "start"} key={`msg-${index}`}>
|
|
684
|
+
<Box
|
|
685
|
+
color={message.role === "user" ? "primary" : "neutralLight"}
|
|
686
|
+
maxWidth={hasImages ? "90%" : "80%"}
|
|
687
|
+
padding={3}
|
|
688
|
+
rounding="lg"
|
|
689
|
+
>
|
|
690
|
+
<ContentPartsPreview
|
|
691
|
+
hasContent={Boolean(message.content)}
|
|
692
|
+
parts={message.contentParts}
|
|
693
|
+
/>
|
|
694
|
+
<MessageText content={message.content} role={message.role} />
|
|
695
|
+
<AssistantActions
|
|
696
|
+
handleCopyMessage={handleCopyMessage}
|
|
697
|
+
index={index}
|
|
698
|
+
message={message}
|
|
699
|
+
onRateFeedback={onRateFeedback}
|
|
700
|
+
/>
|
|
701
|
+
</Box>
|
|
702
|
+
</Box>
|
|
703
|
+
);
|
|
704
|
+
})}
|
|
705
|
+
</>
|
|
706
|
+
);
|
|
707
|
+
};
|
|
708
|
+
|
|
587
709
|
const StreamingIndicator = ({isStreaming}: {isStreaming: boolean}): React.ReactElement | null => {
|
|
588
710
|
if (!isStreaming) {
|
|
589
711
|
return null;
|
|
590
712
|
}
|
|
591
713
|
return (
|
|
592
|
-
<Box alignItems="start" padding={2}>
|
|
714
|
+
<Box alignItems="start" padding={2} testID="gpt-streaming-indicator">
|
|
593
715
|
<Spinner size="sm" />
|
|
594
716
|
</Box>
|
|
595
717
|
);
|
|
@@ -758,6 +880,7 @@ export const GPTChat = ({
|
|
|
758
880
|
onSubmit,
|
|
759
881
|
onUpdateTitle,
|
|
760
882
|
selectedModel,
|
|
883
|
+
mascot,
|
|
761
884
|
suggestedPrompts,
|
|
762
885
|
systemMemory,
|
|
763
886
|
testID,
|
|
@@ -770,6 +893,7 @@ export const GPTChat = ({
|
|
|
770
893
|
const contentHeightRef = useRef(0);
|
|
771
894
|
const scrollOffsetRef = useRef(0);
|
|
772
895
|
const viewportHeightRef = useRef(0);
|
|
896
|
+
const [viewportHeight, setViewportHeight] = useState(0);
|
|
773
897
|
const [isApiKeyModalVisible, setIsApiKeyModalVisible] = useState(false);
|
|
774
898
|
const [isToolsModalVisible, setIsToolsModalVisible] = useState(false);
|
|
775
899
|
const [apiKeyDraft, setApiKeyDraft] = useState(geminiApiKey ?? "");
|
|
@@ -851,7 +975,9 @@ export const GPTChat = ({
|
|
|
851
975
|
|
|
852
976
|
const handleViewportLayout = useCallback(
|
|
853
977
|
(event: {nativeEvent: {layout: {height: number; width: number; x: number; y: number}}}) => {
|
|
854
|
-
|
|
978
|
+
const nextHeight = event.nativeEvent.layout.height;
|
|
979
|
+
viewportHeightRef.current = nextHeight;
|
|
980
|
+
setViewportHeight(nextHeight);
|
|
855
981
|
},
|
|
856
982
|
[]
|
|
857
983
|
);
|
|
@@ -916,6 +1042,8 @@ export const GPTChat = ({
|
|
|
916
1042
|
setIsApiKeyModalVisible(false);
|
|
917
1043
|
}, [apiKeyDraft, onGeminiApiKeyChange]);
|
|
918
1044
|
|
|
1045
|
+
const isEmptyChat = currentMessages.length === 0;
|
|
1046
|
+
|
|
919
1047
|
return (
|
|
920
1048
|
<Box direction="row" flex="grow" testID={testID}>
|
|
921
1049
|
{/* Sidebar */}
|
|
@@ -990,73 +1118,27 @@ export const GPTChat = ({
|
|
|
990
1118
|
{/* Chat Panel */}
|
|
991
1119
|
<Box direction="column" flex="grow" padding={4}>
|
|
992
1120
|
{/* Messages */}
|
|
993
|
-
<Box flex="grow" marginBottom={3} onLayout={handleViewportLayout}>
|
|
1121
|
+
<Box flex="grow" marginBottom={3} onLayout={handleViewportLayout} testID="gpt-viewport">
|
|
994
1122
|
<Box flex="grow" gap={3} onScroll={handleScroll} scroll={true} scrollRef={scrollViewRef}>
|
|
995
|
-
<Box gap={3} onLayout={handleContentLayout}>
|
|
996
|
-
{
|
|
997
|
-
<
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
</Box>
|
|
1014
|
-
))}
|
|
1015
|
-
</Box>
|
|
1016
|
-
</Box>
|
|
1123
|
+
<Box flex="grow" gap={3} onLayout={handleContentLayout} testID="gpt-messages">
|
|
1124
|
+
{isEmptyChat ? (
|
|
1125
|
+
<EmptyChatHero
|
|
1126
|
+
handleSuggestedPrompt={handleSuggestedPrompt}
|
|
1127
|
+
isStreaming={isStreaming}
|
|
1128
|
+
mascot={mascot}
|
|
1129
|
+
suggestedPrompts={suggestedPrompts}
|
|
1130
|
+
viewportHeight={viewportHeight}
|
|
1131
|
+
/>
|
|
1132
|
+
) : (
|
|
1133
|
+
<>
|
|
1134
|
+
<MessageList
|
|
1135
|
+
currentMessages={currentMessages}
|
|
1136
|
+
handleCopyMessage={handleCopyMessage}
|
|
1137
|
+
onRateFeedback={onRateFeedback}
|
|
1138
|
+
/>
|
|
1139
|
+
<StreamingIndicator isStreaming={isStreaming} />
|
|
1140
|
+
</>
|
|
1017
1141
|
)}
|
|
1018
|
-
{currentMessages.map((message, index) => {
|
|
1019
|
-
// Tool call/result messages
|
|
1020
|
-
if (message.role === "tool-call" && message.toolCall) {
|
|
1021
|
-
return (
|
|
1022
|
-
<Box alignItems="start" key={`msg-${index}`} maxWidth="80%">
|
|
1023
|
-
<ToolCallCard toolCall={message.toolCall} />
|
|
1024
|
-
</Box>
|
|
1025
|
-
);
|
|
1026
|
-
}
|
|
1027
|
-
if (message.role === "tool-result" && message.toolResult) {
|
|
1028
|
-
return (
|
|
1029
|
-
<Box alignItems="start" key={`msg-${index}`} maxWidth="80%">
|
|
1030
|
-
<ToolResultCard toolResult={message.toolResult} />
|
|
1031
|
-
</Box>
|
|
1032
|
-
);
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
const hasImages = message.contentParts?.some((p) => p.type === "image");
|
|
1036
|
-
return (
|
|
1037
|
-
<Box alignItems={message.role === "user" ? "end" : "start"} key={`msg-${index}`}>
|
|
1038
|
-
<Box
|
|
1039
|
-
color={message.role === "user" ? "primary" : "neutralLight"}
|
|
1040
|
-
maxWidth={hasImages ? "90%" : "80%"}
|
|
1041
|
-
padding={3}
|
|
1042
|
-
rounding="lg"
|
|
1043
|
-
>
|
|
1044
|
-
<ContentPartsPreview
|
|
1045
|
-
hasContent={Boolean(message.content)}
|
|
1046
|
-
parts={message.contentParts}
|
|
1047
|
-
/>
|
|
1048
|
-
<MessageText content={message.content} role={message.role} />
|
|
1049
|
-
<AssistantActions
|
|
1050
|
-
handleCopyMessage={handleCopyMessage}
|
|
1051
|
-
index={index}
|
|
1052
|
-
message={message}
|
|
1053
|
-
onRateFeedback={onRateFeedback}
|
|
1054
|
-
/>
|
|
1055
|
-
</Box>
|
|
1056
|
-
</Box>
|
|
1057
|
-
);
|
|
1058
|
-
})}
|
|
1059
|
-
<StreamingIndicator isStreaming={isStreaming} />
|
|
1060
1142
|
</Box>
|
|
1061
1143
|
</Box>
|
|
1062
1144
|
</Box>
|
|
@@ -1065,21 +1147,27 @@ export const GPTChat = ({
|
|
|
1065
1147
|
<AttachmentSection attachments={attachments} onRemoveAttachment={onRemoveAttachment} />
|
|
1066
1148
|
|
|
1067
1149
|
{/* Input */}
|
|
1068
|
-
<Box
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1150
|
+
<Box direction="row" gap={2} testID="gpt-composer">
|
|
1151
|
+
{onAttachFiles ? (
|
|
1152
|
+
<Box justifyContent="center" testID="gpt-composer-attach">
|
|
1153
|
+
<AttachButton
|
|
1154
|
+
handleFilesSelected={handleFilesSelected}
|
|
1155
|
+
isStreaming={isStreaming}
|
|
1156
|
+
onAttachFiles={onAttachFiles}
|
|
1157
|
+
/>
|
|
1158
|
+
</Box>
|
|
1159
|
+
) : null}
|
|
1074
1160
|
{mcpTools && mcpTools.length > 0 && (
|
|
1075
|
-
<
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1161
|
+
<Box justifyContent="center" testID="gpt-composer-tools">
|
|
1162
|
+
<IconButton
|
|
1163
|
+
accessibilityLabel="Show available tools"
|
|
1164
|
+
iconName="hammer"
|
|
1165
|
+
onClick={() => setIsToolsModalVisible(true)}
|
|
1166
|
+
testID="gpt-tools-button"
|
|
1167
|
+
/>
|
|
1168
|
+
</Box>
|
|
1081
1169
|
)}
|
|
1082
|
-
<Box flex="grow">
|
|
1170
|
+
<Box flex="grow" justifyContent="center">
|
|
1083
1171
|
<TextArea
|
|
1084
1172
|
blurOnSubmit={false}
|
|
1085
1173
|
disabled={isStreaming}
|
|
@@ -1090,13 +1178,15 @@ export const GPTChat = ({
|
|
|
1090
1178
|
value={inputValue}
|
|
1091
1179
|
/>
|
|
1092
1180
|
</Box>
|
|
1093
|
-
<
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1181
|
+
<Box justifyContent="center" testID="gpt-composer-send">
|
|
1182
|
+
<Button
|
|
1183
|
+
disabled={!inputValue.trim() || isStreaming}
|
|
1184
|
+
iconName="paper-plane"
|
|
1185
|
+
onClick={handleSubmit}
|
|
1186
|
+
testID="gpt-submit"
|
|
1187
|
+
text="Send"
|
|
1188
|
+
/>
|
|
1189
|
+
</Box>
|
|
1100
1190
|
</Box>
|
|
1101
1191
|
</Box>
|
|
1102
1192
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {describe, it, mock} from "bun:test";
|
|
2
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
3
|
+
import {assert} from "chai";
|
|
4
|
+
import React from "react";
|
|
5
|
+
|
|
6
|
+
import {GPTMemoryModal} from "./GPTMemoryModal";
|
|
7
|
+
import {renderWithTheme} from "./test-utils";
|
|
8
|
+
|
|
9
|
+
// Button presses run through an async haptic call, so state updates land in a microtask after
|
|
10
|
+
// the event.
|
|
11
|
+
const press = async (element: Parameters<typeof fireEvent.press>[0]): Promise<void> => {
|
|
12
|
+
await act(async () => {
|
|
13
|
+
fireEvent.press(element);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe("GPTMemoryModal", () => {
|
|
18
|
+
it("renders the title, subtitle, and the current memory", () => {
|
|
19
|
+
const {getByText, getByTestId, getByPlaceholderText} = renderWithTheme(
|
|
20
|
+
<GPTMemoryModal memory="Be concise." onDismiss={() => {}} onSave={() => {}} visible />
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
assert.isOk(getByText("System Memory"));
|
|
24
|
+
assert.isOk(getByText("Customize the system prompt for your AI assistant."));
|
|
25
|
+
assert.isOk(getByPlaceholderText("Enter system instructions..."));
|
|
26
|
+
assert.equal(getByTestId("gpt-memory-textarea").props.value, "Be concise.");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("saves the edited memory and dismisses", async () => {
|
|
30
|
+
const onSave = mock((_memory: string) => {});
|
|
31
|
+
const onDismiss = mock(() => {});
|
|
32
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
33
|
+
<GPTMemoryModal memory="Old" onDismiss={onDismiss} onSave={onSave} visible />
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
fireEvent.changeText(getByTestId("gpt-memory-textarea"), "New instructions");
|
|
37
|
+
assert.equal(getByTestId("gpt-memory-textarea").props.value, "New instructions");
|
|
38
|
+
|
|
39
|
+
await press(getByText("Save"));
|
|
40
|
+
|
|
41
|
+
assert.equal(onSave.mock.calls.length, 1);
|
|
42
|
+
assert.deepEqual(onSave.mock.calls[0], ["New instructions"]);
|
|
43
|
+
assert.equal(onDismiss.mock.calls.length, 1);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("cancels without saving", async () => {
|
|
47
|
+
const onSave = mock((_memory: string) => {});
|
|
48
|
+
const onDismiss = mock(() => {});
|
|
49
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
50
|
+
<GPTMemoryModal memory="Old" onDismiss={onDismiss} onSave={onSave} visible />
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
fireEvent.changeText(getByTestId("gpt-memory-textarea"), "Discarded");
|
|
54
|
+
await press(getByText("Cancel"));
|
|
55
|
+
|
|
56
|
+
assert.equal(onSave.mock.calls.length, 0);
|
|
57
|
+
assert.equal(onDismiss.mock.calls.length, 1);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("renders nothing visible when not visible", () => {
|
|
61
|
+
const {queryByText} = renderWithTheme(
|
|
62
|
+
<GPTMemoryModal memory="" onDismiss={() => {}} onSave={() => {}} visible={false} />
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
assert.isNull(queryByText("System Memory"));
|
|
66
|
+
});
|
|
67
|
+
});
|
package/src/Heading.tsx
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
TitilliumWeb_600SemiBold,
|
|
3
|
-
TitilliumWeb_700Bold,
|
|
4
|
-
useFonts,
|
|
5
|
-
} from "@expo-google-fonts/titillium-web";
|
|
6
|
-
import type React from "react";
|
|
1
|
+
import React from "react";
|
|
7
2
|
import {Text as NativeText, Platform, type StyleProp, type TextStyle} from "react-native";
|
|
8
3
|
|
|
9
4
|
import type {HeadingProps} from "./Common";
|
|
5
|
+
import {useTerrenoFontsLoaded} from "./TerrenoFontProvider";
|
|
10
6
|
import {useTheme} from "./Theme";
|
|
11
7
|
|
|
12
8
|
const fontSizeAndWeightWeb = {
|
|
@@ -27,7 +23,7 @@ const fontSizeAndWeighMobile = {
|
|
|
27
23
|
|
|
28
24
|
const fontSizes = Platform.OS === "web" ? fontSizeAndWeightWeb : fontSizeAndWeighMobile;
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
const HeadingComponent = ({
|
|
31
27
|
align,
|
|
32
28
|
children,
|
|
33
29
|
color = "primary",
|
|
@@ -35,13 +31,7 @@ export const Heading = ({
|
|
|
35
31
|
testID,
|
|
36
32
|
}: HeadingProps): React.ReactElement => {
|
|
37
33
|
const {theme} = useTheme();
|
|
38
|
-
|
|
39
|
-
// TODO: make fonts part of theme.
|
|
40
|
-
useFonts({
|
|
41
|
-
heading: TitilliumWeb_600SemiBold,
|
|
42
|
-
"heading-bold": TitilliumWeb_700Bold,
|
|
43
|
-
"heading-semibold": TitilliumWeb_600SemiBold,
|
|
44
|
-
});
|
|
34
|
+
useTerrenoFontsLoaded();
|
|
45
35
|
|
|
46
36
|
const style: StyleProp<TextStyle> = {};
|
|
47
37
|
|
|
@@ -64,3 +54,7 @@ export const Heading = ({
|
|
|
64
54
|
</NativeText>
|
|
65
55
|
);
|
|
66
56
|
};
|
|
57
|
+
|
|
58
|
+
HeadingComponent.displayName = "Heading";
|
|
59
|
+
|
|
60
|
+
export const Heading = React.memo(HeadingComponent);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
-
import {act, render} from "@testing-library/react-native";
|
|
2
|
+
import {act, fireEvent, render} from "@testing-library/react-native";
|
|
3
3
|
import React, {createRef} from "react";
|
|
4
4
|
|
|
5
5
|
import type {ActionSheet} from "./ActionSheet";
|
|
6
|
-
import {Button} from "./Button";
|
|
7
6
|
import {HeightActionSheet} from "./HeightActionSheet";
|
|
8
7
|
import {ThemeProvider} from "./Theme";
|
|
9
8
|
|
|
@@ -88,18 +87,16 @@ describe("HeightActionSheet", () => {
|
|
|
88
87
|
expect(handleChange).toHaveBeenCalled();
|
|
89
88
|
});
|
|
90
89
|
|
|
91
|
-
it("
|
|
90
|
+
it("handles the Done button press", async () => {
|
|
92
91
|
const actionSheetRef = createRef<ActionSheet>();
|
|
93
|
-
const {
|
|
92
|
+
const {getByText} = render(
|
|
94
93
|
<ThemeProvider>
|
|
95
94
|
<HeightActionSheet actionSheetRef={actionSheetRef} onChange={() => {}} value="60" />
|
|
96
95
|
</ThemeProvider>
|
|
97
96
|
);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
act(() => {
|
|
102
|
-
doneBtn!.props.onClick();
|
|
97
|
+
await act(async () => {
|
|
98
|
+
fireEvent.press(getByText("Done"));
|
|
99
|
+
await Promise.resolve();
|
|
103
100
|
});
|
|
104
101
|
});
|
|
105
102
|
});
|
package/src/Hyperlink.tsx
CHANGED
|
@@ -38,22 +38,7 @@ import * as mdurl from "mdurl";
|
|
|
38
38
|
import React from "react";
|
|
39
39
|
import {Linking, Platform, type StyleProp, Text, type TextStyle, View} from "react-native";
|
|
40
40
|
|
|
41
|
-
import type {HyperlinkProps} from "./Common";
|
|
42
|
-
|
|
43
|
-
interface LinkifyMatch {
|
|
44
|
-
index: number;
|
|
45
|
-
lastIndex: number;
|
|
46
|
-
raw: string;
|
|
47
|
-
schema: string;
|
|
48
|
-
text: string;
|
|
49
|
-
url: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface LinkifyItLike {
|
|
53
|
-
pretest: (text: string) => boolean;
|
|
54
|
-
test: (text: string) => boolean;
|
|
55
|
-
match: (text: string) => LinkifyMatch[] | null;
|
|
56
|
-
}
|
|
41
|
+
import type {HyperlinkProps, LinkifyItLike, LinkifyMatch} from "./Common";
|
|
57
42
|
|
|
58
43
|
const linkifyLib: LinkifyItLike = require("linkify-it")();
|
|
59
44
|
|
|
@@ -70,7 +55,7 @@ class HyperlinkComponent extends React.Component<HyperlinkProps> {
|
|
|
70
55
|
return typeof (component.props as {children?: unknown}).children !== "string";
|
|
71
56
|
};
|
|
72
57
|
|
|
73
|
-
linkify = (component: React.ReactElement<{children: string; style?:
|
|
58
|
+
linkify = (component: React.ReactElement<{children: string; style?: StyleProp<TextStyle>}>) => {
|
|
74
59
|
const linkifyIt = this.props.linkify || linkifyLib;
|
|
75
60
|
|
|
76
61
|
if (!linkifyIt.pretest(component.props.children) || !linkifyIt.test(component.props.children))
|
|
@@ -158,7 +143,9 @@ class HyperlinkComponent extends React.Component<HyperlinkProps> {
|
|
|
158
143
|
</Text>
|
|
159
144
|
);
|
|
160
145
|
if (displayName === "Text" && !this.isTextNested(child as React.ReactElement))
|
|
161
|
-
return this.linkify(
|
|
146
|
+
return this.linkify(
|
|
147
|
+
child as React.ReactElement<{children: string; style?: StyleProp<TextStyle>}>
|
|
148
|
+
);
|
|
162
149
|
return this.parse(child as React.ReactElement);
|
|
163
150
|
})
|
|
164
151
|
);
|
package/src/Icon.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
|
|
2
|
-
import type
|
|
2
|
+
import {type FC, memo} from "react";
|
|
3
3
|
|
|
4
4
|
import {type IconProps, iconSizeToNumber} from "./Common";
|
|
5
5
|
import {useCustomIcon} from "./IconRegistry";
|
|
6
6
|
import {useTheme} from "./Theme";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const IconComponent: FC<IconProps> = ({
|
|
9
9
|
color = "primary",
|
|
10
10
|
size = "md",
|
|
11
11
|
iconName,
|
|
@@ -39,3 +39,7 @@ export const Icon: FC<IconProps> = ({
|
|
|
39
39
|
/>
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
|
+
|
|
43
|
+
IconComponent.displayName = "Icon";
|
|
44
|
+
|
|
45
|
+
export const Icon = memo(IconComponent);
|