stream-chat-react-native-core 9.12.1-beta.1 → 9.13.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/a2ui/package.json +6 -0
- package/lib/commonjs/a11y/a11yUtils.js.map +1 -1
- package/lib/commonjs/a11y/hooks/useResolvedModalAccessibilityProps.js.map +1 -1
- package/lib/commonjs/a2ui/A2UIContexts.js +8 -0
- package/lib/commonjs/a2ui/A2UIContexts.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIInstructions.js +49 -0
- package/lib/commonjs/a2ui/A2UIInstructions.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIPlaceholder.js +37 -0
- package/lib/commonjs/a2ui/A2UIPlaceholder.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIRenderer.js +363 -0
- package/lib/commonjs/a2ui/A2UIRenderer.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIStream.js +91 -0
- package/lib/commonjs/a2ui/A2UIStream.js.map +1 -0
- package/lib/commonjs/a2ui/A2UISurface.js +212 -0
- package/lib/commonjs/a2ui/A2UISurface.js.map +1 -0
- package/lib/commonjs/a2ui/basicCatalog.json +1206 -0
- package/lib/commonjs/a2ui/basicFunctions.js +398 -0
- package/lib/commonjs/a2ui/basicFunctions.js.map +1 -0
- package/lib/commonjs/a2ui/catalogDocument.js +80 -0
- package/lib/commonjs/a2ui/catalogDocument.js.map +1 -0
- package/lib/commonjs/a2ui/catalogs.js +105 -0
- package/lib/commonjs/a2ui/catalogs.js.map +1 -0
- package/lib/commonjs/a2ui/components/DateTimeInput.js +445 -0
- package/lib/commonjs/a2ui/components/DateTimeInput.js.map +1 -0
- package/lib/commonjs/a2ui/components/Media.js +316 -0
- package/lib/commonjs/a2ui/components/Media.js.map +1 -0
- package/lib/commonjs/a2ui/components/basicComponents.js +975 -0
- package/lib/commonjs/a2ui/components/basicComponents.js.map +1 -0
- package/lib/commonjs/a2ui/components/iconPaths.js +66 -0
- package/lib/commonjs/a2ui/components/iconPaths.js.map +1 -0
- package/lib/commonjs/a2ui/components/types.js +4 -0
- package/lib/commonjs/a2ui/components/types.js.map +1 -0
- package/lib/commonjs/a2ui/index.js +70 -0
- package/lib/commonjs/a2ui/index.js.map +1 -0
- package/lib/commonjs/a2ui/instructions.js +268 -0
- package/lib/commonjs/a2ui/instructions.js.map +1 -0
- package/lib/commonjs/a2ui/secrets.js +169 -0
- package/lib/commonjs/a2ui/secrets.js.map +1 -0
- package/lib/commonjs/a2ui/useReplyState.js +35 -0
- package/lib/commonjs/a2ui/useReplyState.js.map +1 -0
- package/lib/commonjs/ai-components/AITypingIndicatorView.js +8 -18
- package/lib/commonjs/ai-components/AITypingIndicatorView.js.map +1 -1
- package/lib/commonjs/ai-components/README.md +55 -3
- package/lib/commonjs/ai-components/StreamingMessageView.js +26 -0
- package/lib/commonjs/ai-components/StreamingMessageView.js.map +1 -1
- package/lib/commonjs/ai-components/charts/components/PieLegend.js +2 -1
- package/lib/commonjs/ai-components/charts/components/PieLegend.js.map +1 -1
- package/lib/commonjs/ai-components/charts/components/VictoryChart.js +7 -2
- package/lib/commonjs/ai-components/charts/components/VictoryChart.js.map +1 -1
- package/lib/commonjs/ai-components/charts/utils/format-time-label.js +15 -0
- package/lib/commonjs/ai-components/charts/utils/format-time-label.js.map +1 -0
- package/lib/commonjs/ai-components/charts/vega-lite/schema.js +17 -2
- package/lib/commonjs/ai-components/charts/vega-lite/schema.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/composer-context.js +13 -6
- package/lib/commonjs/ai-components/contexts/composer-context.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/index.js +11 -0
- package/lib/commonjs/ai-components/contexts/index.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/theme-context.js +33 -2
- package/lib/commonjs/ai-components/contexts/theme-context.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/translation-context.js +29 -0
- package/lib/commonjs/ai-components/contexts/translation-context.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.js +366 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIAgentError.js +13 -0
- package/lib/commonjs/ai-components/conversation/controller/AIAgentError.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationController.js +425 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationExchange.js +89 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationExchange.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/index.js +48 -0
- package/lib/commonjs/ai-components/conversation/controller/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/offers.js +29 -0
- package/lib/commonjs/ai-components/conversation/controller/offers.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/types.js +13 -0
- package/lib/commonjs/ai-components/conversation/controller/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/useAIConversationState.js +8 -0
- package/lib/commonjs/ai-components/conversation/controller/useAIConversationState.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/entries.js +98 -0
- package/lib/commonjs/ai-components/conversation/entries.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/fromStreamMessage.js +66 -0
- package/lib/commonjs/ai-components/conversation/fromStreamMessage.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/index.js +48 -0
- package/lib/commonjs/ai-components/conversation/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/AIChatList.js +224 -0
- package/lib/commonjs/ai-components/conversation/list/AIChatList.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useChatListController.js +78 -0
- package/lib/commonjs/ai-components/conversation/list/useChatListController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useEndInView.js +51 -0
- package/lib/commonjs/ai-components/conversation/list/useEndInView.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useKeyboardOverlap.js +54 -0
- package/lib/commonjs/ai-components/conversation/list/useKeyboardOverlap.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useLoadOlder.js +73 -0
- package/lib/commonjs/ai-components/conversation/list/useLoadOlder.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/usePinnedAnchor.js +84 -0
- package/lib/commonjs/ai-components/conversation/list/usePinnedAnchor.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/types.js +4 -0
- package/lib/commonjs/ai-components/conversation/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js +117 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIAction.js +30 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIAction.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIArguments.js +128 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIArguments.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponent.js +50 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponent.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponentDefinition.js +134 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponentDefinition.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIDocument.js +32 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIDocument.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIEntrance.js +193 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIEntrance.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIErrorBoundary.js +30 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIErrorBoundary.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHelpers.js +54 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHelpers.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHost.js +259 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHost.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIMedia.js +24 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIMedia.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIRenderer.js +10 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIRenderer.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIView.js +57 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIView.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/index.js +181 -0
- package/lib/commonjs/ai-components/generative-ui/index.js.map +1 -0
- package/lib/commonjs/ai-components/icons.js +44 -0
- package/lib/commonjs/ai-components/icons.js.map +1 -0
- package/lib/commonjs/ai-components/index.js +96 -0
- package/lib/commonjs/ai-components/index.js.map +1 -1
- package/lib/commonjs/ai-components/internal/Shimmer.js +36 -0
- package/lib/commonjs/ai-components/internal/Shimmer.js.map +1 -0
- package/lib/commonjs/ai-components/internal/format.js +66 -0
- package/lib/commonjs/ai-components/internal/format.js.map +1 -0
- package/lib/commonjs/ai-components/internal/hooks/useBottomSafeArea.js +12 -0
- package/lib/commonjs/ai-components/internal/hooks/useBottomSafeArea.js.map +1 -0
- package/lib/commonjs/ai-components/internal/icons/AgentIcons.js +74 -0
- package/lib/commonjs/ai-components/internal/icons/AgentIcons.js.map +1 -0
- package/lib/commonjs/ai-components/internal/tokens.js +11 -0
- package/lib/commonjs/ai-components/internal/tokens.js.map +1 -0
- package/lib/commonjs/ai-components/internal/uuid.js +21 -0
- package/lib/commonjs/ai-components/internal/uuid.js.map +1 -0
- package/lib/commonjs/ai-components/markdown/components/CodeBlock.js +4 -2
- package/lib/commonjs/ai-components/markdown/components/CodeBlock.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/components/InlineCode.js +1 -0
- package/lib/commonjs/ai-components/markdown/components/InlineCode.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/components/Text.js +11 -2
- package/lib/commonjs/ai-components/markdown/components/Text.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/styles.js +27 -29
- package/lib/commonjs/ai-components/markdown/styles.js.map +1 -1
- package/lib/commonjs/ai-components/message/AIAssistantMessage.js +63 -0
- package/lib/commonjs/ai-components/message/AIAssistantMessage.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIMessageAttachment.js +189 -0
- package/lib/commonjs/ai-components/message/AIMessageAttachment.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIReplyActions.js +132 -0
- package/lib/commonjs/ai-components/message/AIReplyActions.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIUserMessage.js +104 -0
- package/lib/commonjs/ai-components/message/AIUserMessage.js.map +1 -0
- package/lib/commonjs/ai-components/message/UserMessageMenu.js +150 -0
- package/lib/commonjs/ai-components/message/UserMessageMenu.js.map +1 -0
- package/lib/commonjs/ai-components/message/index.js +48 -0
- package/lib/commonjs/ai-components/message/index.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/ActionButton.js +2 -1
- package/lib/commonjs/ai-components/message-composer/ActionButton.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ActionSheet.js +22 -6
- package/lib/commonjs/ai-components/message-composer/ActionSheet.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/AttachmentButton.js +5 -1
- package/lib/commonjs/ai-components/message-composer/AttachmentButton.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ChatOptions.js +147 -0
- package/lib/commonjs/ai-components/message-composer/ChatOptions.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/ComposerView.js +136 -20
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js +80 -0
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/MediaPreviewList.js +26 -1
- package/lib/commonjs/ai-components/message-composer/MediaPreviewList.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/index.js +11 -0
- package/lib/commonjs/ai-components/message-composer/index.js.map +1 -1
- package/lib/commonjs/ai-components/message-parts/AIMessageParts.js +110 -0
- package/lib/commonjs/ai-components/message-parts/AIMessageParts.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolApproval.js +197 -0
- package/lib/commonjs/ai-components/message-parts/AIToolApproval.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolAuthorization.js +250 -0
- package/lib/commonjs/ai-components/message-parts/AIToolAuthorization.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolCall.js +159 -0
- package/lib/commonjs/ai-components/message-parts/AIToolCall.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/callStates.js +54 -0
- package/lib/commonjs/ai-components/message-parts/callStates.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/index.js +70 -0
- package/lib/commonjs/ai-components/message-parts/index.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/parseMessageParts.js +126 -0
- package/lib/commonjs/ai-components/message-parts/parseMessageParts.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/types.js +2 -0
- package/lib/commonjs/ai-components/message-parts/types.js.map +1 -0
- package/lib/commonjs/ai-components/native-specs/NativeAIAgent.js +7 -0
- package/lib/commonjs/ai-components/native-specs/NativeAIAgent.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/AIReasoning.js +401 -0
- package/lib/commonjs/ai-components/reasoning/AIReasoning.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/index.js +26 -0
- package/lib/commonjs/ai-components/reasoning/index.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/thinkingClock.js +63 -0
- package/lib/commonjs/ai-components/reasoning/thinkingClock.js.map +1 -0
- package/lib/commonjs/ai-components/services/clipboard-service/expo.js +7 -2
- package/lib/commonjs/ai-components/services/clipboard-service/expo.js.map +1 -1
- package/lib/commonjs/ai-components/store/composer/store.js.map +1 -1
- package/lib/commonjs/ai-components/store/composer/useComposerChatOption.js +18 -0
- package/lib/commonjs/ai-components/store/composer/useComposerChatOption.js.map +1 -0
- package/lib/commonjs/ai-components/store/composer/useComposerIsEditing.js +18 -0
- package/lib/commonjs/ai-components/store/composer/useComposerIsEditing.js.map +1 -0
- package/lib/commonjs/ai-components/store/index.js +22 -0
- package/lib/commonjs/ai-components/store/index.js.map +1 -1
- package/lib/commonjs/ai-components/suggestions/AISuggestions.js +66 -0
- package/lib/commonjs/ai-components/suggestions/AISuggestions.js.map +1 -0
- package/lib/commonjs/ai-components/suggestions/index.js +15 -0
- package/lib/commonjs/ai-components/suggestions/index.js.map +1 -0
- package/lib/commonjs/ai-components/syntax-highlighting/utils/flatten-nodes.js +2 -1
- package/lib/commonjs/ai-components/syntax-highlighting/utils/flatten-nodes.js.map +1 -1
- package/lib/commonjs/ai-components/syntax-highlighting/utils/renderer.js +3 -2
- package/lib/commonjs/ai-components/syntax-highlighting/utils/renderer.js.map +1 -1
- package/lib/commonjs/ai-components/theme.js +137 -1
- package/lib/commonjs/ai-components/theme.js.map +1 -1
- package/lib/commonjs/ai-components/tool-calls/AIClientIdentity.js +22 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientIdentity.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientToolRunner.js +109 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientToolRunner.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/AIToolApprover.js +23 -0
- package/lib/commonjs/ai-components/tool-calls/AIToolApprover.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/authSessionAuthorizer.js +88 -0
- package/lib/commonjs/ai-components/tool-calls/authSessionAuthorizer.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/index.js +48 -0
- package/lib/commonjs/ai-components/tool-calls/index.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js.map +1 -1
- package/lib/commonjs/components/Accessibility/useAccessibilityAnnouncer.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/utils/renderText.js.map +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +2 -2
- package/lib/commonjs/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/commonjs/i18n/ar.json +39 -1
- package/lib/commonjs/i18n/en.json +39 -1
- package/lib/commonjs/i18n/es.json +39 -1
- package/lib/commonjs/i18n/fr.json +39 -1
- package/lib/commonjs/i18n/he.json +39 -1
- package/lib/commonjs/i18n/hi.json +39 -1
- package/lib/commonjs/i18n/it.json +39 -1
- package/lib/commonjs/i18n/ja.json +39 -1
- package/lib/commonjs/i18n/ko.json +39 -1
- package/lib/commonjs/i18n/nl.json +39 -1
- package/lib/commonjs/i18n/pt-br.json +39 -1
- package/lib/commonjs/i18n/ru.json +39 -1
- package/lib/commonjs/i18n/tr.json +39 -1
- package/lib/commonjs/mock-builders/a2ui/ohrid.js +84 -0
- package/lib/commonjs/mock-builders/a2ui/ohrid.js.map +1 -0
- package/lib/commonjs/utils/i18n/Streami18n.js +9 -4
- package/lib/commonjs/utils/i18n/Streami18n.js.map +1 -1
- package/lib/commonjs/utils/i18n/utils.js +7 -0
- package/lib/commonjs/utils/i18n/utils.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/a11y/a11yUtils.js.map +1 -1
- package/lib/module/a11y/hooks/useResolvedModalAccessibilityProps.js.map +1 -1
- package/lib/module/a2ui/A2UIContexts.js +8 -0
- package/lib/module/a2ui/A2UIContexts.js.map +1 -0
- package/lib/module/a2ui/A2UIInstructions.js +49 -0
- package/lib/module/a2ui/A2UIInstructions.js.map +1 -0
- package/lib/module/a2ui/A2UIPlaceholder.js +37 -0
- package/lib/module/a2ui/A2UIPlaceholder.js.map +1 -0
- package/lib/module/a2ui/A2UIRenderer.js +363 -0
- package/lib/module/a2ui/A2UIRenderer.js.map +1 -0
- package/lib/module/a2ui/A2UIStream.js +91 -0
- package/lib/module/a2ui/A2UIStream.js.map +1 -0
- package/lib/module/a2ui/A2UISurface.js +212 -0
- package/lib/module/a2ui/A2UISurface.js.map +1 -0
- package/lib/module/a2ui/basicCatalog.json +1206 -0
- package/lib/module/a2ui/basicFunctions.js +398 -0
- package/lib/module/a2ui/basicFunctions.js.map +1 -0
- package/lib/module/a2ui/catalogDocument.js +80 -0
- package/lib/module/a2ui/catalogDocument.js.map +1 -0
- package/lib/module/a2ui/catalogs.js +105 -0
- package/lib/module/a2ui/catalogs.js.map +1 -0
- package/lib/module/a2ui/components/DateTimeInput.js +445 -0
- package/lib/module/a2ui/components/DateTimeInput.js.map +1 -0
- package/lib/module/a2ui/components/Media.js +316 -0
- package/lib/module/a2ui/components/Media.js.map +1 -0
- package/lib/module/a2ui/components/basicComponents.js +975 -0
- package/lib/module/a2ui/components/basicComponents.js.map +1 -0
- package/lib/module/a2ui/components/iconPaths.js +66 -0
- package/lib/module/a2ui/components/iconPaths.js.map +1 -0
- package/lib/module/a2ui/components/types.js +4 -0
- package/lib/module/a2ui/components/types.js.map +1 -0
- package/lib/module/a2ui/index.js +70 -0
- package/lib/module/a2ui/index.js.map +1 -0
- package/lib/module/a2ui/instructions.js +268 -0
- package/lib/module/a2ui/instructions.js.map +1 -0
- package/lib/module/a2ui/secrets.js +169 -0
- package/lib/module/a2ui/secrets.js.map +1 -0
- package/lib/module/a2ui/useReplyState.js +35 -0
- package/lib/module/a2ui/useReplyState.js.map +1 -0
- package/lib/module/ai-components/AITypingIndicatorView.js +8 -18
- package/lib/module/ai-components/AITypingIndicatorView.js.map +1 -1
- package/lib/module/ai-components/README.md +55 -3
- package/lib/module/ai-components/StreamingMessageView.js +26 -0
- package/lib/module/ai-components/StreamingMessageView.js.map +1 -1
- package/lib/module/ai-components/charts/components/PieLegend.js +2 -1
- package/lib/module/ai-components/charts/components/PieLegend.js.map +1 -1
- package/lib/module/ai-components/charts/components/VictoryChart.js +7 -2
- package/lib/module/ai-components/charts/components/VictoryChart.js.map +1 -1
- package/lib/module/ai-components/charts/utils/format-time-label.js +15 -0
- package/lib/module/ai-components/charts/utils/format-time-label.js.map +1 -0
- package/lib/module/ai-components/charts/vega-lite/schema.js +17 -2
- package/lib/module/ai-components/charts/vega-lite/schema.js.map +1 -1
- package/lib/module/ai-components/contexts/composer-context.js +13 -6
- package/lib/module/ai-components/contexts/composer-context.js.map +1 -1
- package/lib/module/ai-components/contexts/index.js +11 -0
- package/lib/module/ai-components/contexts/index.js.map +1 -1
- package/lib/module/ai-components/contexts/theme-context.js +33 -2
- package/lib/module/ai-components/contexts/theme-context.js.map +1 -1
- package/lib/module/ai-components/contexts/translation-context.js +29 -0
- package/lib/module/ai-components/contexts/translation-context.js.map +1 -0
- package/lib/module/ai-components/conversation/AIConversation.js +366 -0
- package/lib/module/ai-components/conversation/AIConversation.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIAgentError.js +13 -0
- package/lib/module/ai-components/conversation/controller/AIAgentError.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIConversationController.js +425 -0
- package/lib/module/ai-components/conversation/controller/AIConversationController.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIConversationExchange.js +89 -0
- package/lib/module/ai-components/conversation/controller/AIConversationExchange.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/index.js +48 -0
- package/lib/module/ai-components/conversation/controller/index.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/offers.js +29 -0
- package/lib/module/ai-components/conversation/controller/offers.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/types.js +13 -0
- package/lib/module/ai-components/conversation/controller/types.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/useAIConversationState.js +8 -0
- package/lib/module/ai-components/conversation/controller/useAIConversationState.js.map +1 -0
- package/lib/module/ai-components/conversation/entries.js +98 -0
- package/lib/module/ai-components/conversation/entries.js.map +1 -0
- package/lib/module/ai-components/conversation/fromStreamMessage.js +66 -0
- package/lib/module/ai-components/conversation/fromStreamMessage.js.map +1 -0
- package/lib/module/ai-components/conversation/index.js +48 -0
- package/lib/module/ai-components/conversation/index.js.map +1 -0
- package/lib/module/ai-components/conversation/list/AIChatList.js +224 -0
- package/lib/module/ai-components/conversation/list/AIChatList.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useChatListController.js +78 -0
- package/lib/module/ai-components/conversation/list/useChatListController.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useEndInView.js +51 -0
- package/lib/module/ai-components/conversation/list/useEndInView.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useKeyboardOverlap.js +54 -0
- package/lib/module/ai-components/conversation/list/useKeyboardOverlap.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useLoadOlder.js +73 -0
- package/lib/module/ai-components/conversation/list/useLoadOlder.js.map +1 -0
- package/lib/module/ai-components/conversation/list/usePinnedAnchor.js +84 -0
- package/lib/module/ai-components/conversation/list/usePinnedAnchor.js.map +1 -0
- package/lib/module/ai-components/conversation/types.js +4 -0
- package/lib/module/ai-components/conversation/types.js.map +1 -0
- package/lib/module/ai-components/conversation/useConversationRows.js +117 -0
- package/lib/module/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIAction.js +30 -0
- package/lib/module/ai-components/generative-ui/AIUIAction.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIArguments.js +128 -0
- package/lib/module/ai-components/generative-ui/AIUIArguments.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIComponent.js +50 -0
- package/lib/module/ai-components/generative-ui/AIUIComponent.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIComponentDefinition.js +134 -0
- package/lib/module/ai-components/generative-ui/AIUIComponentDefinition.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIDocument.js +32 -0
- package/lib/module/ai-components/generative-ui/AIUIDocument.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIEntrance.js +193 -0
- package/lib/module/ai-components/generative-ui/AIUIEntrance.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIErrorBoundary.js +30 -0
- package/lib/module/ai-components/generative-ui/AIUIErrorBoundary.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIHelpers.js +54 -0
- package/lib/module/ai-components/generative-ui/AIUIHelpers.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIHost.js +259 -0
- package/lib/module/ai-components/generative-ui/AIUIHost.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIMedia.js +24 -0
- package/lib/module/ai-components/generative-ui/AIUIMedia.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIRenderer.js +10 -0
- package/lib/module/ai-components/generative-ui/AIUIRenderer.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIView.js +57 -0
- package/lib/module/ai-components/generative-ui/AIUIView.js.map +1 -0
- package/lib/module/ai-components/generative-ui/index.js +181 -0
- package/lib/module/ai-components/generative-ui/index.js.map +1 -0
- package/lib/module/ai-components/icons.js +44 -0
- package/lib/module/ai-components/icons.js.map +1 -0
- package/lib/module/ai-components/index.js +96 -0
- package/lib/module/ai-components/index.js.map +1 -1
- package/lib/module/ai-components/internal/Shimmer.js +36 -0
- package/lib/module/ai-components/internal/Shimmer.js.map +1 -0
- package/lib/module/ai-components/internal/format.js +66 -0
- package/lib/module/ai-components/internal/format.js.map +1 -0
- package/lib/module/ai-components/internal/hooks/useBottomSafeArea.js +12 -0
- package/lib/module/ai-components/internal/hooks/useBottomSafeArea.js.map +1 -0
- package/lib/module/ai-components/internal/icons/AgentIcons.js +74 -0
- package/lib/module/ai-components/internal/icons/AgentIcons.js.map +1 -0
- package/lib/module/ai-components/internal/tokens.js +11 -0
- package/lib/module/ai-components/internal/tokens.js.map +1 -0
- package/lib/module/ai-components/internal/uuid.js +21 -0
- package/lib/module/ai-components/internal/uuid.js.map +1 -0
- package/lib/module/ai-components/markdown/components/CodeBlock.js +4 -2
- package/lib/module/ai-components/markdown/components/CodeBlock.js.map +1 -1
- package/lib/module/ai-components/markdown/components/InlineCode.js +1 -0
- package/lib/module/ai-components/markdown/components/InlineCode.js.map +1 -1
- package/lib/module/ai-components/markdown/components/Text.js +11 -2
- package/lib/module/ai-components/markdown/components/Text.js.map +1 -1
- package/lib/module/ai-components/markdown/styles.js +27 -29
- package/lib/module/ai-components/markdown/styles.js.map +1 -1
- package/lib/module/ai-components/message/AIAssistantMessage.js +63 -0
- package/lib/module/ai-components/message/AIAssistantMessage.js.map +1 -0
- package/lib/module/ai-components/message/AIMessageAttachment.js +189 -0
- package/lib/module/ai-components/message/AIMessageAttachment.js.map +1 -0
- package/lib/module/ai-components/message/AIReplyActions.js +132 -0
- package/lib/module/ai-components/message/AIReplyActions.js.map +1 -0
- package/lib/module/ai-components/message/AIUserMessage.js +104 -0
- package/lib/module/ai-components/message/AIUserMessage.js.map +1 -0
- package/lib/module/ai-components/message/UserMessageMenu.js +150 -0
- package/lib/module/ai-components/message/UserMessageMenu.js.map +1 -0
- package/lib/module/ai-components/message/index.js +48 -0
- package/lib/module/ai-components/message/index.js.map +1 -0
- package/lib/module/ai-components/message-composer/ActionButton.js +2 -1
- package/lib/module/ai-components/message-composer/ActionButton.js.map +1 -1
- package/lib/module/ai-components/message-composer/ActionSheet.js +22 -6
- package/lib/module/ai-components/message-composer/ActionSheet.js.map +1 -1
- package/lib/module/ai-components/message-composer/AttachmentButton.js +5 -1
- package/lib/module/ai-components/message-composer/AttachmentButton.js.map +1 -1
- package/lib/module/ai-components/message-composer/ChatOptions.js +147 -0
- package/lib/module/ai-components/message-composer/ChatOptions.js.map +1 -0
- package/lib/module/ai-components/message-composer/ComposerView.js +136 -20
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/EditingMessageChip.js +80 -0
- package/lib/module/ai-components/message-composer/EditingMessageChip.js.map +1 -0
- package/lib/module/ai-components/message-composer/MediaPreviewList.js +26 -1
- package/lib/module/ai-components/message-composer/MediaPreviewList.js.map +1 -1
- package/lib/module/ai-components/message-composer/index.js +11 -0
- package/lib/module/ai-components/message-composer/index.js.map +1 -1
- package/lib/module/ai-components/message-parts/AIMessageParts.js +110 -0
- package/lib/module/ai-components/message-parts/AIMessageParts.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolApproval.js +197 -0
- package/lib/module/ai-components/message-parts/AIToolApproval.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolAuthorization.js +250 -0
- package/lib/module/ai-components/message-parts/AIToolAuthorization.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolCall.js +159 -0
- package/lib/module/ai-components/message-parts/AIToolCall.js.map +1 -0
- package/lib/module/ai-components/message-parts/callStates.js +54 -0
- package/lib/module/ai-components/message-parts/callStates.js.map +1 -0
- package/lib/module/ai-components/message-parts/index.js +70 -0
- package/lib/module/ai-components/message-parts/index.js.map +1 -0
- package/lib/module/ai-components/message-parts/parseMessageParts.js +126 -0
- package/lib/module/ai-components/message-parts/parseMessageParts.js.map +1 -0
- package/lib/module/ai-components/message-parts/types.js +2 -0
- package/lib/module/ai-components/message-parts/types.js.map +1 -0
- package/lib/module/ai-components/native-specs/NativeAIAgent.js +7 -0
- package/lib/module/ai-components/native-specs/NativeAIAgent.js.map +1 -0
- package/lib/module/ai-components/reasoning/AIReasoning.js +401 -0
- package/lib/module/ai-components/reasoning/AIReasoning.js.map +1 -0
- package/lib/module/ai-components/reasoning/index.js +26 -0
- package/lib/module/ai-components/reasoning/index.js.map +1 -0
- package/lib/module/ai-components/reasoning/thinkingClock.js +63 -0
- package/lib/module/ai-components/reasoning/thinkingClock.js.map +1 -0
- package/lib/module/ai-components/services/clipboard-service/expo.js +7 -2
- package/lib/module/ai-components/services/clipboard-service/expo.js.map +1 -1
- package/lib/module/ai-components/store/composer/store.js.map +1 -1
- package/lib/module/ai-components/store/composer/useComposerChatOption.js +18 -0
- package/lib/module/ai-components/store/composer/useComposerChatOption.js.map +1 -0
- package/lib/module/ai-components/store/composer/useComposerIsEditing.js +18 -0
- package/lib/module/ai-components/store/composer/useComposerIsEditing.js.map +1 -0
- package/lib/module/ai-components/store/index.js +22 -0
- package/lib/module/ai-components/store/index.js.map +1 -1
- package/lib/module/ai-components/suggestions/AISuggestions.js +66 -0
- package/lib/module/ai-components/suggestions/AISuggestions.js.map +1 -0
- package/lib/module/ai-components/suggestions/index.js +15 -0
- package/lib/module/ai-components/suggestions/index.js.map +1 -0
- package/lib/module/ai-components/syntax-highlighting/utils/flatten-nodes.js +2 -1
- package/lib/module/ai-components/syntax-highlighting/utils/flatten-nodes.js.map +1 -1
- package/lib/module/ai-components/syntax-highlighting/utils/renderer.js +3 -2
- package/lib/module/ai-components/syntax-highlighting/utils/renderer.js.map +1 -1
- package/lib/module/ai-components/theme.js +137 -1
- package/lib/module/ai-components/theme.js.map +1 -1
- package/lib/module/ai-components/tool-calls/AIClientIdentity.js +22 -0
- package/lib/module/ai-components/tool-calls/AIClientIdentity.js.map +1 -0
- package/lib/module/ai-components/tool-calls/AIClientToolRunner.js +109 -0
- package/lib/module/ai-components/tool-calls/AIClientToolRunner.js.map +1 -0
- package/lib/module/ai-components/tool-calls/AIToolApprover.js +23 -0
- package/lib/module/ai-components/tool-calls/AIToolApprover.js.map +1 -0
- package/lib/module/ai-components/tool-calls/authSessionAuthorizer.js +88 -0
- package/lib/module/ai-components/tool-calls/authSessionAuthorizer.js.map +1 -0
- package/lib/module/ai-components/tool-calls/index.js +48 -0
- package/lib/module/ai-components/tool-calls/index.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -1
- package/lib/module/components/Accessibility/useAccessibilityAnnouncer.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/utils/renderText.js.map +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +2 -2
- package/lib/module/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/module/i18n/ar.json +39 -1
- package/lib/module/i18n/en.json +39 -1
- package/lib/module/i18n/es.json +39 -1
- package/lib/module/i18n/fr.json +39 -1
- package/lib/module/i18n/he.json +39 -1
- package/lib/module/i18n/hi.json +39 -1
- package/lib/module/i18n/it.json +39 -1
- package/lib/module/i18n/ja.json +39 -1
- package/lib/module/i18n/ko.json +39 -1
- package/lib/module/i18n/nl.json +39 -1
- package/lib/module/i18n/pt-br.json +39 -1
- package/lib/module/i18n/ru.json +39 -1
- package/lib/module/i18n/tr.json +39 -1
- package/lib/module/mock-builders/a2ui/ohrid.js +84 -0
- package/lib/module/mock-builders/a2ui/ohrid.js.map +1 -0
- package/lib/module/utils/i18n/Streami18n.js +9 -4
- package/lib/module/utils/i18n/Streami18n.js.map +1 -1
- package/lib/module/utils/i18n/utils.js +7 -0
- package/lib/module/utils/i18n/utils.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/a11y/a11yUtils.d.ts +0 -1
- package/lib/typescript/a11y/a11yUtils.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useResolvedModalAccessibilityProps.d.ts +2 -3
- package/lib/typescript/a11y/hooks/useResolvedModalAccessibilityProps.d.ts.map +1 -1
- package/lib/typescript/a2ui/A2UIContexts.d.ts +9 -0
- package/lib/typescript/a2ui/A2UIContexts.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIInstructions.d.ts +47 -0
- package/lib/typescript/a2ui/A2UIInstructions.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIPlaceholder.d.ts +4 -0
- package/lib/typescript/a2ui/A2UIPlaceholder.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIRenderer.d.ts +130 -0
- package/lib/typescript/a2ui/A2UIRenderer.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIStream.d.ts +23 -0
- package/lib/typescript/a2ui/A2UIStream.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UISurface.d.ts +19 -0
- package/lib/typescript/a2ui/A2UISurface.d.ts.map +1 -0
- package/lib/typescript/a2ui/basicFunctions.d.ts +10 -0
- package/lib/typescript/a2ui/basicFunctions.d.ts.map +1 -0
- package/lib/typescript/a2ui/catalogDocument.d.ts +56 -0
- package/lib/typescript/a2ui/catalogDocument.d.ts.map +1 -0
- package/lib/typescript/a2ui/catalogs.d.ts +42 -0
- package/lib/typescript/a2ui/catalogs.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/DateTimeInput.d.ts +44 -0
- package/lib/typescript/a2ui/components/DateTimeInput.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/Media.d.ts +27 -0
- package/lib/typescript/a2ui/components/Media.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/basicComponents.d.ts +4 -0
- package/lib/typescript/a2ui/components/basicComponents.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/iconPaths.d.ts +2 -0
- package/lib/typescript/a2ui/components/iconPaths.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/types.d.ts +23 -0
- package/lib/typescript/a2ui/components/types.d.ts.map +1 -0
- package/lib/typescript/a2ui/index.d.ts +8 -0
- package/lib/typescript/a2ui/index.d.ts.map +1 -0
- package/lib/typescript/a2ui/instructions.d.ts +39 -0
- package/lib/typescript/a2ui/instructions.d.ts.map +1 -0
- package/lib/typescript/a2ui/secrets.d.ts +20 -0
- package/lib/typescript/a2ui/secrets.d.ts.map +1 -0
- package/lib/typescript/a2ui/useReplyState.d.ts +4 -0
- package/lib/typescript/a2ui/useReplyState.d.ts.map +1 -0
- package/lib/typescript/ai-components/AITypingIndicatorView.d.ts.map +1 -1
- package/lib/typescript/ai-components/StreamingMessageView.d.ts +4 -1
- package/lib/typescript/ai-components/StreamingMessageView.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/components/PieLegend.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/components/VictoryChart.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/utils/format-time-label.d.ts +7 -0
- package/lib/typescript/ai-components/charts/utils/format-time-label.d.ts.map +1 -0
- package/lib/typescript/ai-components/charts/vega-lite/schema.d.ts +8 -8
- package/lib/typescript/ai-components/charts/vega-lite/schema.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/composer-context.d.ts +3 -0
- package/lib/typescript/ai-components/contexts/composer-context.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/index.d.ts +1 -0
- package/lib/typescript/ai-components/contexts/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/theme-context.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/translation-context.d.ts +19 -0
- package/lib/typescript/ai-components/contexts/translation-context.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/AIConversation.d.ts +130 -0
- package/lib/typescript/ai-components/conversation/AIConversation.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIAgentError.d.ts +10 -0
- package/lib/typescript/ai-components/conversation/controller/AIAgentError.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationController.d.ts +173 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationExchange.d.ts +23 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationExchange.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/index.d.ts +5 -0
- package/lib/typescript/ai-components/conversation/controller/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/offers.d.ts +23 -0
- package/lib/typescript/ai-components/conversation/controller/offers.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/types.d.ts +142 -0
- package/lib/typescript/ai-components/conversation/controller/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/useAIConversationState.d.ts +9 -0
- package/lib/typescript/ai-components/conversation/controller/useAIConversationState.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/entries.d.ts +47 -0
- package/lib/typescript/ai-components/conversation/entries.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/fromStreamMessage.d.ts +25 -0
- package/lib/typescript/ai-components/conversation/fromStreamMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/index.d.ts +6 -0
- package/lib/typescript/ai-components/conversation/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/AIChatList.d.ts +30 -0
- package/lib/typescript/ai-components/conversation/list/AIChatList.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useChatListController.d.ts +45 -0
- package/lib/typescript/ai-components/conversation/list/useChatListController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useEndInView.d.ts +26 -0
- package/lib/typescript/ai-components/conversation/list/useEndInView.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useKeyboardOverlap.d.ts +17 -0
- package/lib/typescript/ai-components/conversation/list/useKeyboardOverlap.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useLoadOlder.d.ts +24 -0
- package/lib/typescript/ai-components/conversation/list/useLoadOlder.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/usePinnedAnchor.d.ts +26 -0
- package/lib/typescript/ai-components/conversation/list/usePinnedAnchor.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/types.d.ts +55 -0
- package/lib/typescript/ai-components/conversation/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts +66 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIAction.d.ts +48 -0
- package/lib/typescript/ai-components/generative-ui/AIUIAction.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIArguments.d.ts +15 -0
- package/lib/typescript/ai-components/generative-ui/AIUIArguments.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponent.d.ts +51 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponent.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponentDefinition.d.ts +84 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponentDefinition.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIDocument.d.ts +50 -0
- package/lib/typescript/ai-components/generative-ui/AIUIDocument.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIEntrance.d.ts +75 -0
- package/lib/typescript/ai-components/generative-ui/AIUIEntrance.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIErrorBoundary.d.ts +26 -0
- package/lib/typescript/ai-components/generative-ui/AIUIErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHelpers.d.ts +23 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHelpers.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHost.d.ts +160 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHost.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIMedia.d.ts +22 -0
- package/lib/typescript/ai-components/generative-ui/AIUIMedia.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIRenderer.d.ts +53 -0
- package/lib/typescript/ai-components/generative-ui/AIUIRenderer.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIView.d.ts +35 -0
- package/lib/typescript/ai-components/generative-ui/AIUIView.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/index.d.ts +11 -0
- package/lib/typescript/ai-components/generative-ui/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/icons.d.ts +66 -0
- package/lib/typescript/ai-components/icons.d.ts.map +1 -0
- package/lib/typescript/ai-components/index.d.ts +8 -0
- package/lib/typescript/ai-components/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/internal/Shimmer.d.ts +14 -0
- package/lib/typescript/ai-components/internal/Shimmer.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/format.d.ts +7 -0
- package/lib/typescript/ai-components/internal/format.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/hooks/useBottomSafeArea.d.ts +3 -0
- package/lib/typescript/ai-components/internal/hooks/useBottomSafeArea.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/icons/AgentIcons.d.ts +31 -0
- package/lib/typescript/ai-components/internal/icons/AgentIcons.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/tokens.d.ts +2 -0
- package/lib/typescript/ai-components/internal/tokens.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/uuid.d.ts +2 -0
- package/lib/typescript/ai-components/internal/uuid.d.ts.map +1 -0
- package/lib/typescript/ai-components/markdown/components/CodeBlock.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/components/InlineCode.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/components/Text.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/styles.d.ts +23 -4
- package/lib/typescript/ai-components/markdown/styles.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/types.d.ts +1 -0
- package/lib/typescript/ai-components/markdown/types.d.ts.map +1 -1
- package/lib/typescript/ai-components/message/AIAssistantMessage.d.ts +40 -0
- package/lib/typescript/ai-components/message/AIAssistantMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIMessageAttachment.d.ts +33 -0
- package/lib/typescript/ai-components/message/AIMessageAttachment.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIReplyActions.d.ts +19 -0
- package/lib/typescript/ai-components/message/AIReplyActions.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIUserMessage.d.ts +17 -0
- package/lib/typescript/ai-components/message/AIUserMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/UserMessageMenu.d.ts +31 -0
- package/lib/typescript/ai-components/message/UserMessageMenu.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/index.d.ts +5 -0
- package/lib/typescript/ai-components/message/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/ActionButton.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ActionSheet.d.ts +2 -2
- package/lib/typescript/ai-components/message-composer/ActionSheet.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/AttachmentButton.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ChatOptions.d.ts +35 -0
- package/lib/typescript/ai-components/message-composer/ChatOptions.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts +34 -3
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/EditingMessageChip.d.ts +7 -0
- package/lib/typescript/ai-components/message-composer/EditingMessageChip.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/MediaPreviewList.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/index.d.ts +1 -0
- package/lib/typescript/ai-components/message-composer/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-parts/AIMessageParts.d.ts +38 -0
- package/lib/typescript/ai-components/message-parts/AIMessageParts.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolApproval.d.ts +38 -0
- package/lib/typescript/ai-components/message-parts/AIToolApproval.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolAuthorization.d.ts +48 -0
- package/lib/typescript/ai-components/message-parts/AIToolAuthorization.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolCall.d.ts +11 -0
- package/lib/typescript/ai-components/message-parts/AIToolCall.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/callStates.d.ts +9 -0
- package/lib/typescript/ai-components/message-parts/callStates.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/index.d.ts +7 -0
- package/lib/typescript/ai-components/message-parts/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/parseMessageParts.d.ts +47 -0
- package/lib/typescript/ai-components/message-parts/parseMessageParts.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/types.d.ts +137 -0
- package/lib/typescript/ai-components/message-parts/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/native-specs/NativeAIAgent.d.ts +22 -0
- package/lib/typescript/ai-components/native-specs/NativeAIAgent.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/AIReasoning.d.ts +63 -0
- package/lib/typescript/ai-components/reasoning/AIReasoning.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/index.d.ts +3 -0
- package/lib/typescript/ai-components/reasoning/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/thinkingClock.d.ts +29 -0
- package/lib/typescript/ai-components/reasoning/thinkingClock.d.ts.map +1 -0
- package/lib/typescript/ai-components/services/clipboard-service/expo.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/composer/store.d.ts +8 -0
- package/lib/typescript/ai-components/store/composer/store.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/composer/useComposerChatOption.d.ts +5 -0
- package/lib/typescript/ai-components/store/composer/useComposerChatOption.d.ts.map +1 -0
- package/lib/typescript/ai-components/store/composer/useComposerIsEditing.d.ts +5 -0
- package/lib/typescript/ai-components/store/composer/useComposerIsEditing.d.ts.map +1 -0
- package/lib/typescript/ai-components/store/index.d.ts +2 -0
- package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/suggestions/AISuggestions.d.ts +13 -0
- package/lib/typescript/ai-components/suggestions/AISuggestions.d.ts.map +1 -0
- package/lib/typescript/ai-components/suggestions/index.d.ts +2 -0
- package/lib/typescript/ai-components/suggestions/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/syntax-highlighting/utils/flatten-nodes.d.ts.map +1 -1
- package/lib/typescript/ai-components/syntax-highlighting/utils/renderer.d.ts +1 -1
- package/lib/typescript/ai-components/syntax-highlighting/utils/renderer.d.ts.map +1 -1
- package/lib/typescript/ai-components/theme.d.ts +200 -0
- package/lib/typescript/ai-components/theme.d.ts.map +1 -1
- package/lib/typescript/ai-components/tool-calls/AIClientIdentity.d.ts +14 -0
- package/lib/typescript/ai-components/tool-calls/AIClientIdentity.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/AIClientToolRunner.d.ts +109 -0
- package/lib/typescript/ai-components/tool-calls/AIClientToolRunner.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/AIToolApprover.d.ts +48 -0
- package/lib/typescript/ai-components/tool-calls/AIToolApprover.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/authSessionAuthorizer.d.ts +57 -0
- package/lib/typescript/ai-components/tool-calls/authSessionAuthorizer.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/index.d.ts +5 -0
- package/lib/typescript/ai-components/tool-calls/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -1
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +1 -1
- package/lib/typescript/components/Accessibility/NotificationAnnouncer.d.ts +5 -5
- package/lib/typescript/components/Accessibility/hooks/useIncomingMessageAnnouncements.d.ts +1 -1
- package/lib/typescript/components/Accessibility/useAccessibilityAnnouncer.d.ts +0 -2
- package/lib/typescript/components/Accessibility/useAccessibilityAnnouncer.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/utils/renderText.d.ts.map +1 -1
- package/lib/typescript/contexts/translationContext/TranslationContext.d.ts +1 -1
- package/lib/typescript/contexts/translationContext/TranslationContext.d.ts.map +1 -1
- package/lib/typescript/i18n/ar.json +39 -1
- package/lib/typescript/i18n/en.json +39 -1
- package/lib/typescript/i18n/es.json +39 -1
- package/lib/typescript/i18n/fr.json +39 -1
- package/lib/typescript/i18n/he.json +39 -1
- package/lib/typescript/i18n/hi.json +39 -1
- package/lib/typescript/i18n/it.json +39 -1
- package/lib/typescript/i18n/ja.json +39 -1
- package/lib/typescript/i18n/ko.json +39 -1
- package/lib/typescript/i18n/nl.json +39 -1
- package/lib/typescript/i18n/pt-br.json +39 -1
- package/lib/typescript/i18n/ru.json +39 -1
- package/lib/typescript/i18n/tr.json +39 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +40 -2
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/utils.d.ts +3 -0
- package/lib/typescript/utils/i18n/utils.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/a11y/a11yUtils.ts +0 -1
- package/src/a11y/hooks/useResolvedModalAccessibilityProps.ts +2 -3
- package/src/a2ui/A2UIContexts.ts +15 -0
- package/src/a2ui/A2UIInstructions.ts +102 -0
- package/src/a2ui/A2UIPlaceholder.tsx +24 -0
- package/src/a2ui/A2UIRenderer.tsx +504 -0
- package/src/a2ui/A2UIStream.ts +105 -0
- package/src/a2ui/A2UISurface.tsx +241 -0
- package/src/a2ui/__tests__/A2UIInstructions.test.ts +233 -0
- package/src/a2ui/__tests__/A2UIRenderer.test.tsx +1514 -0
- package/src/a2ui/__tests__/conformance.test.ts +579 -0
- package/src/a2ui/basicCatalog.json +1206 -0
- package/src/a2ui/basicFunctions.ts +429 -0
- package/src/a2ui/catalogDocument.ts +119 -0
- package/src/a2ui/catalogs.ts +185 -0
- package/src/a2ui/components/DateTimeInput.tsx +381 -0
- package/src/a2ui/components/Media.tsx +278 -0
- package/src/a2ui/components/basicComponents.tsx +832 -0
- package/src/a2ui/components/iconPaths.ts +116 -0
- package/src/a2ui/components/types.ts +24 -0
- package/src/a2ui/index.ts +18 -0
- package/src/a2ui/instructions.ts +341 -0
- package/src/a2ui/secrets.ts +154 -0
- package/src/a2ui/useReplyState.ts +26 -0
- package/src/ai-components/AITypingIndicatorView.tsx +6 -22
- package/src/ai-components/README.md +55 -3
- package/src/ai-components/StreamingMessageView.tsx +27 -3
- package/src/ai-components/__tests__/ComposerView.test.tsx +227 -2
- package/src/ai-components/__tests__/Markdown.test.tsx +13 -0
- package/src/ai-components/__tests__/StreamingMessageView.test.tsx +69 -0
- package/src/ai-components/__tests__/charts.test.ts +75 -0
- package/src/ai-components/__tests__/clientToolRunner.test.ts +239 -0
- package/src/ai-components/__tests__/conversation.test.tsx +705 -0
- package/src/ai-components/__tests__/conversationController.test.ts +1561 -0
- package/src/ai-components/__tests__/conversationExchange.test.ts +187 -0
- package/src/ai-components/__tests__/conversationRows.test.ts +207 -0
- package/src/ai-components/__tests__/conversationUI.test.tsx +586 -0
- package/src/ai-components/__tests__/format.test.ts +32 -0
- package/src/ai-components/__tests__/generativeUI.test.ts +634 -0
- package/src/ai-components/__tests__/keyboard.test.ts +14 -0
- package/src/ai-components/__tests__/messagePartViews.test.tsx +343 -0
- package/src/ai-components/__tests__/messageParts.test.ts +336 -0
- package/src/ai-components/__tests__/messageViews.test.tsx +321 -0
- package/src/ai-components/__tests__/signIn.test.tsx +324 -0
- package/src/ai-components/__tests__/theme.test.tsx +18 -0
- package/src/ai-components/__tests__/translation.test.tsx +85 -0
- package/src/ai-components/__tests__/voiceDriver.test.ts +0 -3
- package/src/ai-components/__tests__/voicePalette.test.ts +1 -1
- package/src/ai-components/charts/components/PieLegend.tsx +2 -1
- package/src/ai-components/charts/components/VictoryChart.tsx +10 -2
- package/src/ai-components/charts/utils/format-time-label.ts +18 -0
- package/src/ai-components/charts/vega-lite/schema.ts +19 -2
- package/src/ai-components/contexts/composer-context.tsx +13 -5
- package/src/ai-components/contexts/index.ts +1 -0
- package/src/ai-components/contexts/theme-context.tsx +19 -4
- package/src/ai-components/contexts/translation-context.tsx +44 -0
- package/src/ai-components/conversation/AIConversation.tsx +590 -0
- package/src/ai-components/conversation/controller/AIAgentError.ts +14 -0
- package/src/ai-components/conversation/controller/AIConversationController.ts +623 -0
- package/src/ai-components/conversation/controller/AIConversationExchange.ts +132 -0
- package/src/ai-components/conversation/controller/index.ts +4 -0
- package/src/ai-components/conversation/controller/offers.ts +43 -0
- package/src/ai-components/conversation/controller/types.ts +154 -0
- package/src/ai-components/conversation/controller/useAIConversationState.ts +21 -0
- package/src/ai-components/conversation/entries.ts +177 -0
- package/src/ai-components/conversation/fromStreamMessage.ts +87 -0
- package/src/ai-components/conversation/index.ts +5 -0
- package/src/ai-components/conversation/list/AIChatList.tsx +227 -0
- package/src/ai-components/conversation/list/useChatListController.ts +91 -0
- package/src/ai-components/conversation/list/useEndInView.ts +61 -0
- package/src/ai-components/conversation/list/useKeyboardOverlap.ts +51 -0
- package/src/ai-components/conversation/list/useLoadOlder.ts +97 -0
- package/src/ai-components/conversation/list/usePinnedAnchor.ts +113 -0
- package/src/ai-components/conversation/types.ts +57 -0
- package/src/ai-components/conversation/useConversationRows.ts +230 -0
- package/src/ai-components/generative-ui/AIUIAction.ts +73 -0
- package/src/ai-components/generative-ui/AIUIArguments.ts +117 -0
- package/src/ai-components/generative-ui/AIUIComponent.tsx +106 -0
- package/src/ai-components/generative-ui/AIUIComponentDefinition.ts +163 -0
- package/src/ai-components/generative-ui/AIUIDocument.ts +77 -0
- package/src/ai-components/generative-ui/AIUIEntrance.tsx +223 -0
- package/src/ai-components/generative-ui/AIUIErrorBoundary.tsx +39 -0
- package/src/ai-components/generative-ui/AIUIHelpers.ts +86 -0
- package/src/ai-components/generative-ui/AIUIHost.ts +358 -0
- package/src/ai-components/generative-ui/AIUIMedia.ts +45 -0
- package/src/ai-components/generative-ui/AIUIRenderer.ts +60 -0
- package/src/ai-components/generative-ui/AIUIView.tsx +87 -0
- package/src/ai-components/generative-ui/index.ts +48 -0
- package/src/ai-components/icons.ts +101 -0
- package/src/ai-components/index.ts +10 -0
- package/src/ai-components/internal/Shimmer.tsx +40 -0
- package/src/ai-components/internal/format.ts +69 -0
- package/src/ai-components/internal/hooks/useBottomSafeArea.ts +6 -0
- package/src/ai-components/internal/icons/AgentIcons.tsx +138 -0
- package/src/ai-components/internal/tokens.ts +4 -0
- package/src/ai-components/internal/uuid.ts +17 -0
- package/src/ai-components/markdown/components/CodeBlock.tsx +13 -2
- package/src/ai-components/markdown/components/InlineCode.tsx +1 -0
- package/src/ai-components/markdown/components/Text.tsx +7 -2
- package/src/ai-components/markdown/styles.ts +29 -27
- package/src/ai-components/markdown/types.ts +1 -0
- package/src/ai-components/message/AIAssistantMessage.tsx +99 -0
- package/src/ai-components/message/AIMessageAttachment.tsx +245 -0
- package/src/ai-components/message/AIReplyActions.tsx +139 -0
- package/src/ai-components/message/AIUserMessage.tsx +121 -0
- package/src/ai-components/message/UserMessageMenu.tsx +149 -0
- package/src/ai-components/message/index.ts +4 -0
- package/src/ai-components/message-composer/ActionButton.tsx +5 -1
- package/src/ai-components/message-composer/ActionSheet.tsx +28 -6
- package/src/ai-components/message-composer/AttachmentButton.tsx +9 -1
- package/src/ai-components/message-composer/ChatOptions.tsx +144 -0
- package/src/ai-components/message-composer/ComposerView.tsx +179 -29
- package/src/ai-components/message-composer/EditingMessageChip.tsx +61 -0
- package/src/ai-components/message-composer/MediaPreviewList.tsx +34 -8
- package/src/ai-components/message-composer/index.ts +1 -0
- package/src/ai-components/message-parts/AIMessageParts.tsx +120 -0
- package/src/ai-components/message-parts/AIToolApproval.tsx +196 -0
- package/src/ai-components/message-parts/AIToolAuthorization.tsx +279 -0
- package/src/ai-components/message-parts/AIToolCall.tsx +117 -0
- package/src/ai-components/message-parts/callStates.ts +44 -0
- package/src/ai-components/message-parts/index.ts +6 -0
- package/src/ai-components/message-parts/parseMessageParts.ts +195 -0
- package/src/ai-components/message-parts/types.ts +157 -0
- package/src/ai-components/native-specs/NativeAIAgent.ts +25 -0
- package/src/ai-components/reasoning/AIReasoning.tsx +509 -0
- package/src/ai-components/reasoning/index.ts +2 -0
- package/src/ai-components/reasoning/thinkingClock.ts +109 -0
- package/src/ai-components/services/clipboard-service/expo.ts +18 -4
- package/src/ai-components/store/composer/store.ts +9 -0
- package/src/ai-components/store/composer/useComposerChatOption.ts +15 -0
- package/src/ai-components/store/composer/useComposerIsEditing.ts +15 -0
- package/src/ai-components/store/index.ts +2 -0
- package/src/ai-components/suggestions/AISuggestions.tsx +73 -0
- package/src/ai-components/suggestions/index.ts +1 -0
- package/src/ai-components/syntax-highlighting/utils/flatten-nodes.ts +2 -1
- package/src/ai-components/syntax-highlighting/utils/renderer.tsx +4 -2
- package/src/ai-components/theme.ts +334 -0
- package/src/ai-components/tool-calls/AIClientIdentity.ts +33 -0
- package/src/ai-components/tool-calls/AIClientToolRunner.ts +200 -0
- package/src/ai-components/tool-calls/AIToolApprover.tsx +60 -0
- package/src/ai-components/tool-calls/authSessionAuthorizer.ts +137 -0
- package/src/ai-components/tool-calls/index.ts +4 -0
- package/src/ai-components/voice-visualization/glowShader.ts +1 -3
- package/src/ai-components/voice-visualization/simplex.ts +1 -1
- package/src/components/Accessibility/NotificationAnnouncer.tsx +5 -5
- package/src/components/Accessibility/hooks/useIncomingMessageAnnouncements.ts +1 -1
- package/src/components/Accessibility/useAccessibilityAnnouncer.ts +0 -2
- package/src/components/Message/MessageItemView/utils/renderText.tsx +1 -2
- package/src/contexts/translationContext/TranslationContext.tsx +2 -2
- package/src/i18n/ar.json +39 -1
- package/src/i18n/en.json +39 -1
- package/src/i18n/es.json +39 -1
- package/src/i18n/fr.json +39 -1
- package/src/i18n/he.json +39 -1
- package/src/i18n/hi.json +39 -1
- package/src/i18n/it.json +39 -1
- package/src/i18n/ja.json +39 -1
- package/src/i18n/ko.json +39 -1
- package/src/i18n/nl.json +39 -1
- package/src/i18n/pt-br.json +39 -1
- package/src/i18n/ru.json +39 -1
- package/src/i18n/tr.json +39 -1
- package/src/mock-builders/a2ui/ohrid.ts +106 -0
- package/src/utils/i18n/Streami18n.ts +4 -1
- package/src/utils/i18n/utils.ts +3 -0
- package/src/version.json +1 -1
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
// The basic catalog's components, drawn natively in the AI components' spacing, radii, type and
|
|
2
|
+
// colors.
|
|
3
|
+
import React, { createContext, useContext, useMemo, useRef } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
type DimensionValue,
|
|
6
|
+
I18nManager,
|
|
7
|
+
Image,
|
|
8
|
+
type ImageStyle,
|
|
9
|
+
type ImageResizeMode,
|
|
10
|
+
Modal as NativeModal,
|
|
11
|
+
PanResponder,
|
|
12
|
+
Pressable,
|
|
13
|
+
ScrollView,
|
|
14
|
+
StyleSheet,
|
|
15
|
+
Text as NativeText,
|
|
16
|
+
TextInput,
|
|
17
|
+
type TextStyle,
|
|
18
|
+
View,
|
|
19
|
+
type ViewStyle,
|
|
20
|
+
} from 'react-native';
|
|
21
|
+
|
|
22
|
+
import Svg, { Path } from 'react-native-svg';
|
|
23
|
+
|
|
24
|
+
import type { ComponentContext } from '@a2ui/web_core';
|
|
25
|
+
|
|
26
|
+
import { DateTimeInputView } from './DateTimeInput';
|
|
27
|
+
import { A2UI_ICON_PATHS } from './iconPaths';
|
|
28
|
+
import { AudioView, VideoView } from './Media';
|
|
29
|
+
|
|
30
|
+
import type { A2UIComponentProps, A2UIComponents } from './types';
|
|
31
|
+
|
|
32
|
+
import { useAITranslation, useTheme } from '../../ai-components/contexts';
|
|
33
|
+
import { isRecord } from '../../ai-components/generative-ui/AIUIHelpers';
|
|
34
|
+
import { primitives } from '../../ai-components/internal/tokens';
|
|
35
|
+
import { Markdown } from '../../ai-components/markdown';
|
|
36
|
+
import { A2UIEngineContext } from '../A2UIContexts';
|
|
37
|
+
import { A2UIAxisContext, A2UIChild, A2UIChildren } from '../A2UISurface';
|
|
38
|
+
import { useReplyState } from '../useReplyState';
|
|
39
|
+
|
|
40
|
+
// Whether a Text is the label of a Button, where it shows as words rather than as Markdown.
|
|
41
|
+
const A2UILabelContext = createContext<TextStyle | undefined>(undefined);
|
|
42
|
+
|
|
43
|
+
const textOf = (value: unknown) =>
|
|
44
|
+
typeof value === 'string' ? value : value === undefined || value === null ? '' : String(value);
|
|
45
|
+
|
|
46
|
+
const stringsOf = (value: unknown) =>
|
|
47
|
+
Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : [];
|
|
48
|
+
|
|
49
|
+
const errorsOf = ({ isValid, validationErrors }: Record<string, unknown>) =>
|
|
50
|
+
isValid === false ? stringsOf(validationErrors) : [];
|
|
51
|
+
|
|
52
|
+
const setterOf = (props: Record<string, unknown>, key: string) => {
|
|
53
|
+
const setter = props[`set${key.charAt(0).toUpperCase()}${key.slice(1)}`];
|
|
54
|
+
return typeof setter === 'function' ? (setter as (value: unknown) => void) : undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// The look of the catalog's parts the app's theme sets.
|
|
58
|
+
const useA2UITheme = () => useTheme().theme.a2ui ?? {};
|
|
59
|
+
|
|
60
|
+
// The catalog's colors: the theme's `a2ui.colors`, over ones from the AI components' own.
|
|
61
|
+
const usePalette = () => {
|
|
62
|
+
const {
|
|
63
|
+
theme: { a2ui, colors },
|
|
64
|
+
} = useTheme();
|
|
65
|
+
const own = a2ui?.colors;
|
|
66
|
+
return useMemo(
|
|
67
|
+
() => ({
|
|
68
|
+
accent: colors.accent_blue,
|
|
69
|
+
border: colors.grey_gainsboro,
|
|
70
|
+
error: colors.accent_red,
|
|
71
|
+
onAccent: colors.white,
|
|
72
|
+
secondaryText: colors.grey,
|
|
73
|
+
subtleSurface: colors.white_smoke,
|
|
74
|
+
surface: colors.white,
|
|
75
|
+
text: colors.black,
|
|
76
|
+
...own,
|
|
77
|
+
}),
|
|
78
|
+
[colors, own],
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// An accent color at `alpha`, for what is selected.
|
|
83
|
+
const tint = (color: string, alpha: number) =>
|
|
84
|
+
/^#[0-9a-f]{6}$/i.test(color)
|
|
85
|
+
? `${color}${Math.round(alpha * 255)
|
|
86
|
+
.toString(16)
|
|
87
|
+
.padStart(2, '0')}`
|
|
88
|
+
: color;
|
|
89
|
+
|
|
90
|
+
// What a part's checks found, under it.
|
|
91
|
+
const Problems = ({ errors }: { errors: string[] }) => {
|
|
92
|
+
const palette = usePalette();
|
|
93
|
+
return errors.length ? (
|
|
94
|
+
<NativeText accessibilityRole='alert' style={[styles.problems, { color: palette.error }]}>
|
|
95
|
+
{errors.join(' ')}
|
|
96
|
+
</NativeText>
|
|
97
|
+
) : null;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const HEADINGS: Record<string, TextStyle> = {
|
|
101
|
+
h1: { fontSize: 28, fontWeight: '700', lineHeight: 34 },
|
|
102
|
+
h2: { fontSize: 22, fontWeight: '700', lineHeight: 28 },
|
|
103
|
+
h3: { fontSize: 20, fontWeight: '600', lineHeight: 25 },
|
|
104
|
+
h4: { fontSize: primitives.typographyFontSizeLg, fontWeight: '700', lineHeight: 23 },
|
|
105
|
+
h5: { fontSize: primitives.typographyFontSizeMd, fontWeight: '600', lineHeight: 21 },
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const Text = ({ props }: A2UIComponentProps) => {
|
|
109
|
+
const theme = useA2UITheme();
|
|
110
|
+
const engine = useContext(A2UIEngineContext);
|
|
111
|
+
const label = useContext(A2UILabelContext);
|
|
112
|
+
const palette = usePalette();
|
|
113
|
+
const text = textOf(props.text);
|
|
114
|
+
const variant = textOf(props.variant);
|
|
115
|
+
if (label) return <NativeText style={label}>{text}</NativeText>;
|
|
116
|
+
if (HEADINGS[variant]) {
|
|
117
|
+
return (
|
|
118
|
+
<NativeText accessibilityRole='header' style={[HEADINGS[variant], { color: palette.text }]}>
|
|
119
|
+
{text}
|
|
120
|
+
</NativeText>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
if (variant === 'caption') {
|
|
124
|
+
return (
|
|
125
|
+
<NativeText style={[styles.caption, { color: palette.secondaryText }, theme.caption]}>
|
|
126
|
+
{text}
|
|
127
|
+
</NativeText>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
return <Markdown onLink={(url) => engine?.host.open(url)}>{text}</Markdown>;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const IMAGE_SIZES: Record<string, ImageStyle> = {
|
|
134
|
+
avatar: { borderRadius: 24, height: 48, width: 48 },
|
|
135
|
+
header: { height: 200, width: '100%' },
|
|
136
|
+
icon: { height: 24, width: 24 },
|
|
137
|
+
largeFeature: { height: 240, width: '100%' },
|
|
138
|
+
mediumFeature: { height: 160, width: '100%' },
|
|
139
|
+
smallFeature: { height: 72, width: 72 },
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const RESIZE_MODES: Record<string, ImageResizeMode> = {
|
|
143
|
+
contain: 'contain',
|
|
144
|
+
cover: 'cover',
|
|
145
|
+
fill: 'stretch',
|
|
146
|
+
none: 'center',
|
|
147
|
+
scaleDown: 'contain',
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// The address to load for a link the agent wrote, as the renderer's `mediaUrl` allows: by
|
|
151
|
+
// default a public web link, never one on the person's network.
|
|
152
|
+
const useMediaSource = (value: unknown) => useContext(A2UIEngineContext)?.mediaSource(value);
|
|
153
|
+
|
|
154
|
+
const ImageComponent = ({ props }: A2UIComponentProps) => {
|
|
155
|
+
const theme = useA2UITheme();
|
|
156
|
+
const palette = usePalette();
|
|
157
|
+
const url = useMediaSource(props.url);
|
|
158
|
+
if (!url) return null;
|
|
159
|
+
const size = IMAGE_SIZES[textOf(props.variant)] ?? IMAGE_SIZES.mediumFeature;
|
|
160
|
+
const description = textOf(props.description);
|
|
161
|
+
return (
|
|
162
|
+
<Image
|
|
163
|
+
accessibilityIgnoresInvertColors
|
|
164
|
+
accessibilityLabel={description || undefined}
|
|
165
|
+
accessible={!!description}
|
|
166
|
+
resizeMode={RESIZE_MODES[textOf(props.fit)] ?? 'cover'}
|
|
167
|
+
source={{ uri: url }}
|
|
168
|
+
style={[styles.image, { backgroundColor: palette.subtleSurface }, size, theme.image]}
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Icons that point somewhere, which a right-to-left layout turns around.
|
|
174
|
+
const MIRRORED_ICONS = new Set(['arrowBack', 'arrowForward', 'help', 'send', 'volumeUp']);
|
|
175
|
+
|
|
176
|
+
// An SVG path the agent writes for an icon of its own: commands and numbers only.
|
|
177
|
+
const SVG_PATH = /^[MmLlHhVvCcSsQqTtAaZz0-9.,\s+-]+$/;
|
|
178
|
+
|
|
179
|
+
const ICON_SIZE = 24;
|
|
180
|
+
|
|
181
|
+
const Icon = ({ props }: A2UIComponentProps) => {
|
|
182
|
+
const engine = useContext(A2UIEngineContext);
|
|
183
|
+
const palette = usePalette();
|
|
184
|
+
const { name } = props;
|
|
185
|
+
// The app's own icon, by the name the agent gives.
|
|
186
|
+
const AppIcon = typeof name === 'string' ? engine?.icons[name] : undefined;
|
|
187
|
+
if (AppIcon) return <AppIcon color={palette.text} size={ICON_SIZE} />;
|
|
188
|
+
const drawn =
|
|
189
|
+
isRecord(name) && typeof name.svgPath === 'string' && SVG_PATH.test(name.svgPath)
|
|
190
|
+
? name.svgPath
|
|
191
|
+
: undefined;
|
|
192
|
+
// A name the catalog doesn't have shows a neutral icon rather than nothing, so the layout
|
|
193
|
+
// around it holds.
|
|
194
|
+
const d =
|
|
195
|
+
drawn ?? (typeof name === 'string' ? A2UI_ICON_PATHS[name] : undefined) ?? A2UI_ICON_PATHS.help;
|
|
196
|
+
const mirrored = I18nManager.isRTL && typeof name === 'string' && MIRRORED_ICONS.has(name);
|
|
197
|
+
return (
|
|
198
|
+
<Svg
|
|
199
|
+
accessibilityElementsHidden
|
|
200
|
+
height={ICON_SIZE}
|
|
201
|
+
importantForAccessibility='no-hide-descendants'
|
|
202
|
+
viewBox='0 0 24 24'
|
|
203
|
+
width={ICON_SIZE}
|
|
204
|
+
>
|
|
205
|
+
<Path d={d} fill={palette.text} transform={mirrored ? 'matrix(-1 0 0 1 24 0)' : undefined} />
|
|
206
|
+
</Svg>
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const Video = ({ props }: A2UIComponentProps) => {
|
|
211
|
+
const palette = usePalette();
|
|
212
|
+
const url = useMediaSource(props.url);
|
|
213
|
+
const poster = useMediaSource(props.posterUrl);
|
|
214
|
+
if (!url) return null;
|
|
215
|
+
return <VideoView palette={palette} posterUrl={poster} url={url} />;
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const AudioPlayer = ({ props }: A2UIComponentProps) => {
|
|
219
|
+
const palette = usePalette();
|
|
220
|
+
const url = useMediaSource(props.url);
|
|
221
|
+
if (!url) return null;
|
|
222
|
+
return (
|
|
223
|
+
<AudioView description={textOf(props.description) || undefined} palette={palette} url={url} />
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const JUSTIFY: Record<string, ViewStyle['justifyContent']> = {
|
|
228
|
+
center: 'center',
|
|
229
|
+
end: 'flex-end',
|
|
230
|
+
spaceAround: 'space-around',
|
|
231
|
+
spaceBetween: 'space-between',
|
|
232
|
+
spaceEvenly: 'space-evenly',
|
|
233
|
+
start: 'flex-start',
|
|
234
|
+
stretch: 'flex-start',
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const ALIGN: Record<string, ViewStyle['alignItems']> = {
|
|
238
|
+
center: 'center',
|
|
239
|
+
end: 'flex-end',
|
|
240
|
+
start: 'flex-start',
|
|
241
|
+
stretch: 'stretch',
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const Flex = ({ direction, props }: A2UIComponentProps & { direction: 'column' | 'row' }) => (
|
|
245
|
+
<A2UIAxisContext.Provider value={direction}>
|
|
246
|
+
<View
|
|
247
|
+
style={[
|
|
248
|
+
styles.flex,
|
|
249
|
+
{
|
|
250
|
+
alignItems: ALIGN[textOf(props.align)] ?? (direction === 'row' ? 'center' : 'stretch'),
|
|
251
|
+
flexDirection: direction,
|
|
252
|
+
justifyContent: JUSTIFY[textOf(props.justify)] ?? 'flex-start',
|
|
253
|
+
},
|
|
254
|
+
]}
|
|
255
|
+
>
|
|
256
|
+
<A2UIChildren nodes={props.children} />
|
|
257
|
+
</View>
|
|
258
|
+
</A2UIAxisContext.Provider>
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
const Row = (props: A2UIComponentProps) => <Flex {...props} direction='row' />;
|
|
262
|
+
const Column = (props: A2UIComponentProps) => <Flex {...props} direction='column' />;
|
|
263
|
+
|
|
264
|
+
const List = ({ props }: A2UIComponentProps) => {
|
|
265
|
+
const horizontal = textOf(props.direction) === 'horizontal';
|
|
266
|
+
const align = ALIGN[textOf(props.align)] ?? 'stretch';
|
|
267
|
+
if (!horizontal) {
|
|
268
|
+
return (
|
|
269
|
+
<View style={[styles.flex, { alignItems: align }]}>
|
|
270
|
+
<A2UIChildren nodes={props.children} />
|
|
271
|
+
</View>
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
return (
|
|
275
|
+
<A2UIAxisContext.Provider value='row'>
|
|
276
|
+
<ScrollView
|
|
277
|
+
contentContainerStyle={[styles.flex, styles.row, { alignItems: align }]}
|
|
278
|
+
horizontal
|
|
279
|
+
showsHorizontalScrollIndicator={false}
|
|
280
|
+
>
|
|
281
|
+
<A2UIChildren nodes={props.children} />
|
|
282
|
+
</ScrollView>
|
|
283
|
+
</A2UIAxisContext.Provider>
|
|
284
|
+
);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const Card = ({ props }: A2UIComponentProps) => {
|
|
288
|
+
const theme = useA2UITheme();
|
|
289
|
+
const palette = usePalette();
|
|
290
|
+
return (
|
|
291
|
+
<View style={[styles.card, { backgroundColor: palette.subtleSurface }, theme.card]}>
|
|
292
|
+
<A2UIChild node={props.child} />
|
|
293
|
+
</View>
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const Tabs = ({ props }: A2UIComponentProps) => {
|
|
298
|
+
const theme = useA2UITheme();
|
|
299
|
+
const palette = usePalette();
|
|
300
|
+
const tabs = Array.isArray(props.tabs) ? props.tabs.filter(isRecord) : [];
|
|
301
|
+
const [selected, setSelected] = useReplyState(0);
|
|
302
|
+
const current = tabs[Math.min(selected, tabs.length - 1)];
|
|
303
|
+
return (
|
|
304
|
+
<View style={styles.flex}>
|
|
305
|
+
<ScrollView
|
|
306
|
+
accessibilityRole='tablist'
|
|
307
|
+
contentContainerStyle={styles.tabs}
|
|
308
|
+
horizontal
|
|
309
|
+
showsHorizontalScrollIndicator={false}
|
|
310
|
+
>
|
|
311
|
+
{tabs.map((tab, index) => {
|
|
312
|
+
const isSelected = tab === current;
|
|
313
|
+
return (
|
|
314
|
+
<Pressable
|
|
315
|
+
accessibilityRole='tab'
|
|
316
|
+
accessibilityState={{ selected: isSelected }}
|
|
317
|
+
key={index}
|
|
318
|
+
onPress={() => setSelected(index)}
|
|
319
|
+
style={[
|
|
320
|
+
styles.capsule,
|
|
321
|
+
{ backgroundColor: isSelected ? tint(palette.accent, 0.15) : 'transparent' },
|
|
322
|
+
theme.tab,
|
|
323
|
+
]}
|
|
324
|
+
>
|
|
325
|
+
<NativeText
|
|
326
|
+
style={[
|
|
327
|
+
styles.capsuleText,
|
|
328
|
+
{ color: isSelected ? palette.accent : palette.secondaryText },
|
|
329
|
+
theme.tabText,
|
|
330
|
+
]}
|
|
331
|
+
>
|
|
332
|
+
{textOf(tab.title)}
|
|
333
|
+
</NativeText>
|
|
334
|
+
</Pressable>
|
|
335
|
+
);
|
|
336
|
+
})}
|
|
337
|
+
</ScrollView>
|
|
338
|
+
{current ? <A2UIChild node={current.child} /> : null}
|
|
339
|
+
</View>
|
|
340
|
+
);
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const Modal = ({ props }: A2UIComponentProps) => {
|
|
344
|
+
const { t } = useAITranslation();
|
|
345
|
+
const palette = usePalette();
|
|
346
|
+
const [open, setOpen] = useReplyState(false);
|
|
347
|
+
return (
|
|
348
|
+
<>
|
|
349
|
+
<Pressable accessibilityRole='button' onPress={() => setOpen(true)}>
|
|
350
|
+
<View pointerEvents='none'>
|
|
351
|
+
<A2UIChild node={props.trigger} />
|
|
352
|
+
</View>
|
|
353
|
+
</Pressable>
|
|
354
|
+
<NativeModal
|
|
355
|
+
animationType='slide'
|
|
356
|
+
onRequestClose={() => setOpen(false)}
|
|
357
|
+
presentationStyle='pageSheet'
|
|
358
|
+
visible={open}
|
|
359
|
+
>
|
|
360
|
+
<View style={[styles.sheet, { backgroundColor: palette.surface }]}>
|
|
361
|
+
<Pressable
|
|
362
|
+
accessibilityRole='button'
|
|
363
|
+
hitSlop={12}
|
|
364
|
+
onPress={() => setOpen(false)}
|
|
365
|
+
style={styles.sheetClose}
|
|
366
|
+
>
|
|
367
|
+
<NativeText style={[styles.buttonText, { color: palette.accent }]}>
|
|
368
|
+
{t('Close')}
|
|
369
|
+
</NativeText>
|
|
370
|
+
</Pressable>
|
|
371
|
+
<ScrollView contentContainerStyle={styles.flex}>
|
|
372
|
+
<A2UIChild node={props.content} />
|
|
373
|
+
</ScrollView>
|
|
374
|
+
</View>
|
|
375
|
+
</NativeModal>
|
|
376
|
+
</>
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const Divider = ({ props }: A2UIComponentProps) => {
|
|
381
|
+
const theme = useA2UITheme();
|
|
382
|
+
const palette = usePalette();
|
|
383
|
+
const vertical = textOf(props.axis) === 'vertical';
|
|
384
|
+
return (
|
|
385
|
+
<View
|
|
386
|
+
style={[
|
|
387
|
+
vertical ? styles.dividerVertical : styles.divider,
|
|
388
|
+
{ backgroundColor: palette.border },
|
|
389
|
+
theme.divider,
|
|
390
|
+
]}
|
|
391
|
+
/>
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
// Whether the component `id` is a borderless Button.
|
|
396
|
+
const isBorderlessButton = (context: ComponentContext, id: unknown) => {
|
|
397
|
+
if (typeof id !== 'string') return false;
|
|
398
|
+
const component = context.surfaceComponents.get(id);
|
|
399
|
+
return component?.type === 'Button' && component.properties.variant === 'borderless';
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Where a borderless Button is among the follow-ups of a Column: `first`, or `after` another
|
|
404
|
+
* borderless Button, which a hairline then parts it from. A borderless Button anywhere else, such
|
|
405
|
+
* as in a Row, is not a follow-up, and reads as a link.
|
|
406
|
+
*/
|
|
407
|
+
const followUpPlaceOf = (context: ComponentContext | undefined): 'first' | 'after' | undefined => {
|
|
408
|
+
if (!context) return undefined;
|
|
409
|
+
const { id } = context.componentModel;
|
|
410
|
+
for (const parent of context.surfaceComponents.values) {
|
|
411
|
+
const { children } = parent.properties;
|
|
412
|
+
if (parent.type !== 'Column' || !Array.isArray(children)) continue;
|
|
413
|
+
const index = children.indexOf(id);
|
|
414
|
+
if (index < 0) continue;
|
|
415
|
+
return index > 0 && isBorderlessButton(context, children[index - 1]) ? 'after' : 'first';
|
|
416
|
+
}
|
|
417
|
+
return undefined;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const Button = ({ node, props }: A2UIComponentProps) => {
|
|
421
|
+
const theme = useA2UITheme();
|
|
422
|
+
const palette = usePalette();
|
|
423
|
+
const variant = textOf(props.variant);
|
|
424
|
+
const errors = errorsOf(props);
|
|
425
|
+
const disabled = props.isValid === false;
|
|
426
|
+
const action = typeof props.action === 'function' ? (props.action as () => unknown) : undefined;
|
|
427
|
+
const look: { container: ViewStyle; text: TextStyle } =
|
|
428
|
+
variant === 'primary'
|
|
429
|
+
? { container: { backgroundColor: palette.accent }, text: { color: palette.onAccent } }
|
|
430
|
+
: variant === 'borderless'
|
|
431
|
+
? { container: styles.borderless, text: { color: palette.accent } }
|
|
432
|
+
: { container: { backgroundColor: palette.subtleSurface }, text: { color: palette.text } };
|
|
433
|
+
const label = useMemo<TextStyle>(
|
|
434
|
+
() => ({ ...styles.buttonText, ...look.text, ...theme.buttonText }),
|
|
435
|
+
[look.text, theme.buttonText],
|
|
436
|
+
);
|
|
437
|
+
// A follow-up is a row of its own across the reply, parted from the one before by a hairline.
|
|
438
|
+
const followUp = variant === 'borderless' ? followUpPlaceOf(node.context) : undefined;
|
|
439
|
+
return (
|
|
440
|
+
<View
|
|
441
|
+
style={[
|
|
442
|
+
styles.field,
|
|
443
|
+
followUp && styles.followUp,
|
|
444
|
+
followUp === 'after' && [styles.followUpAfter, { borderTopColor: palette.border }],
|
|
445
|
+
]}
|
|
446
|
+
>
|
|
447
|
+
<Pressable
|
|
448
|
+
accessibilityRole='button'
|
|
449
|
+
accessibilityState={{ disabled }}
|
|
450
|
+
disabled={disabled || !action}
|
|
451
|
+
onPress={() => void action?.()}
|
|
452
|
+
style={({ pressed }) => [
|
|
453
|
+
styles.button,
|
|
454
|
+
look.container,
|
|
455
|
+
followUp && styles.followUpButton,
|
|
456
|
+
theme.button,
|
|
457
|
+
{ opacity: disabled ? 0.5 : pressed ? 0.7 : 1 },
|
|
458
|
+
]}
|
|
459
|
+
>
|
|
460
|
+
<A2UILabelContext.Provider value={label}>
|
|
461
|
+
<A2UIChild node={props.child} />
|
|
462
|
+
</A2UILabelContext.Provider>
|
|
463
|
+
</Pressable>
|
|
464
|
+
<Problems errors={errors} />
|
|
465
|
+
</View>
|
|
466
|
+
);
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
const FieldLabel = ({ text }: { text: string }) => {
|
|
470
|
+
const theme = useA2UITheme();
|
|
471
|
+
const palette = usePalette();
|
|
472
|
+
return text ? (
|
|
473
|
+
<NativeText style={[styles.label, { color: palette.secondaryText }, theme.label]}>
|
|
474
|
+
{text}
|
|
475
|
+
</NativeText>
|
|
476
|
+
) : null;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
const TextField = ({ props }: A2UIComponentProps) => {
|
|
480
|
+
const theme = useA2UITheme();
|
|
481
|
+
const palette = usePalette();
|
|
482
|
+
const variant = textOf(props.variant);
|
|
483
|
+
const setValue = setterOf(props, 'value');
|
|
484
|
+
const errors = errorsOf(props);
|
|
485
|
+
const label = textOf(props.label);
|
|
486
|
+
return (
|
|
487
|
+
<View style={styles.field}>
|
|
488
|
+
<FieldLabel text={label} />
|
|
489
|
+
<TextInput
|
|
490
|
+
accessibilityLabel={label || undefined}
|
|
491
|
+
editable={!!setValue}
|
|
492
|
+
keyboardType={variant === 'number' ? 'decimal-pad' : 'default'}
|
|
493
|
+
multiline={variant === 'longText'}
|
|
494
|
+
onChangeText={(text) => setValue?.(text)}
|
|
495
|
+
placeholder={textOf(props.placeholder) || undefined}
|
|
496
|
+
placeholderTextColor={palette.secondaryText}
|
|
497
|
+
secureTextEntry={variant === 'obscured'}
|
|
498
|
+
style={[
|
|
499
|
+
styles.input,
|
|
500
|
+
variant === 'longText' && styles.longText,
|
|
501
|
+
{
|
|
502
|
+
backgroundColor: palette.surface,
|
|
503
|
+
borderColor: errors.length ? palette.error : palette.border,
|
|
504
|
+
color: palette.text,
|
|
505
|
+
},
|
|
506
|
+
theme.input,
|
|
507
|
+
]}
|
|
508
|
+
value={textOf(props.value)}
|
|
509
|
+
/>
|
|
510
|
+
<Problems errors={errors} />
|
|
511
|
+
</View>
|
|
512
|
+
);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
const Mark = ({ checked, round }: { checked: boolean; round?: boolean }) => {
|
|
516
|
+
const palette = usePalette();
|
|
517
|
+
return (
|
|
518
|
+
<View
|
|
519
|
+
style={[
|
|
520
|
+
styles.mark,
|
|
521
|
+
round && styles.markRound,
|
|
522
|
+
{
|
|
523
|
+
backgroundColor: checked ? palette.accent : palette.surface,
|
|
524
|
+
borderColor: checked ? palette.accent : palette.border,
|
|
525
|
+
},
|
|
526
|
+
]}
|
|
527
|
+
>
|
|
528
|
+
{checked ? <View style={[styles.markDot, { backgroundColor: palette.onAccent }]} /> : null}
|
|
529
|
+
</View>
|
|
530
|
+
);
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
const CheckBox = ({ props }: A2UIComponentProps) => {
|
|
534
|
+
const palette = usePalette();
|
|
535
|
+
const checked = props.value === true;
|
|
536
|
+
const setValue = setterOf(props, 'value');
|
|
537
|
+
const errors = errorsOf(props);
|
|
538
|
+
return (
|
|
539
|
+
<View style={styles.field}>
|
|
540
|
+
<Pressable
|
|
541
|
+
accessibilityRole='checkbox'
|
|
542
|
+
accessibilityState={{ checked, disabled: !setValue }}
|
|
543
|
+
disabled={!setValue}
|
|
544
|
+
onPress={() => setValue?.(!checked)}
|
|
545
|
+
style={styles.choice}
|
|
546
|
+
>
|
|
547
|
+
<Mark checked={checked} />
|
|
548
|
+
<NativeText style={[styles.choiceText, { color: palette.text }]}>
|
|
549
|
+
{textOf(props.label)}
|
|
550
|
+
</NativeText>
|
|
551
|
+
</Pressable>
|
|
552
|
+
<Problems errors={errors} />
|
|
553
|
+
</View>
|
|
554
|
+
);
|
|
555
|
+
};
|
|
556
|
+
|
|
557
|
+
const ChoicePicker = ({ props }: A2UIComponentProps) => {
|
|
558
|
+
const theme = useA2UITheme();
|
|
559
|
+
const { t } = useAITranslation();
|
|
560
|
+
const palette = usePalette();
|
|
561
|
+
const [filter, setFilter] = useReplyState('');
|
|
562
|
+
const single = textOf(props.variant) !== 'multipleSelection';
|
|
563
|
+
const chips = textOf(props.displayStyle) === 'chips';
|
|
564
|
+
const chosen = stringsOf(props.value);
|
|
565
|
+
const setValue = setterOf(props, 'value');
|
|
566
|
+
const options = (Array.isArray(props.options) ? props.options.filter(isRecord) : [])
|
|
567
|
+
.map((option) => ({ label: textOf(option.label), value: textOf(option.value) }))
|
|
568
|
+
.filter(({ label }) => !filter || label.toLowerCase().includes(filter.toLowerCase()));
|
|
569
|
+
const toggle = (value: string) => {
|
|
570
|
+
if (!setValue) return;
|
|
571
|
+
if (single) setValue(chosen.includes(value) ? [] : [value]);
|
|
572
|
+
else
|
|
573
|
+
setValue(
|
|
574
|
+
chosen.includes(value) ? chosen.filter((item) => item !== value) : [...chosen, value],
|
|
575
|
+
);
|
|
576
|
+
};
|
|
577
|
+
return (
|
|
578
|
+
<View style={styles.field}>
|
|
579
|
+
<FieldLabel text={textOf(props.label)} />
|
|
580
|
+
{props.filterable === true ? (
|
|
581
|
+
<TextInput
|
|
582
|
+
onChangeText={setFilter}
|
|
583
|
+
placeholder={t('Search')}
|
|
584
|
+
placeholderTextColor={palette.secondaryText}
|
|
585
|
+
style={[
|
|
586
|
+
styles.input,
|
|
587
|
+
{ backgroundColor: palette.surface, borderColor: palette.border, color: palette.text },
|
|
588
|
+
theme.input,
|
|
589
|
+
]}
|
|
590
|
+
value={filter}
|
|
591
|
+
/>
|
|
592
|
+
) : null}
|
|
593
|
+
<View style={chips ? styles.chips : styles.flex}>
|
|
594
|
+
{options.map(({ label, value }) => {
|
|
595
|
+
const isChosen = chosen.includes(value);
|
|
596
|
+
return chips ? (
|
|
597
|
+
<Pressable
|
|
598
|
+
accessibilityRole={single ? 'radio' : 'checkbox'}
|
|
599
|
+
accessibilityState={{ checked: isChosen }}
|
|
600
|
+
key={value}
|
|
601
|
+
onPress={() => toggle(value)}
|
|
602
|
+
style={[
|
|
603
|
+
styles.capsule,
|
|
604
|
+
styles.chip,
|
|
605
|
+
{
|
|
606
|
+
backgroundColor: isChosen ? tint(palette.accent, 0.18) : palette.surface,
|
|
607
|
+
borderColor: isChosen ? palette.accent : palette.border,
|
|
608
|
+
},
|
|
609
|
+
theme.chip,
|
|
610
|
+
]}
|
|
611
|
+
>
|
|
612
|
+
<NativeText
|
|
613
|
+
style={[
|
|
614
|
+
styles.capsuleText,
|
|
615
|
+
{ color: isChosen ? palette.accent : palette.text },
|
|
616
|
+
theme.chipText,
|
|
617
|
+
]}
|
|
618
|
+
>
|
|
619
|
+
{label}
|
|
620
|
+
</NativeText>
|
|
621
|
+
</Pressable>
|
|
622
|
+
) : (
|
|
623
|
+
<Pressable
|
|
624
|
+
accessibilityRole={single ? 'radio' : 'checkbox'}
|
|
625
|
+
accessibilityState={{ checked: isChosen }}
|
|
626
|
+
key={value}
|
|
627
|
+
onPress={() => toggle(value)}
|
|
628
|
+
style={styles.choice}
|
|
629
|
+
>
|
|
630
|
+
<Mark checked={isChosen} round={single} />
|
|
631
|
+
<NativeText style={[styles.choiceText, { color: palette.text }]}>{label}</NativeText>
|
|
632
|
+
</Pressable>
|
|
633
|
+
);
|
|
634
|
+
})}
|
|
635
|
+
</View>
|
|
636
|
+
<Problems errors={errorsOf(props)} />
|
|
637
|
+
</View>
|
|
638
|
+
);
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
const Slider = ({ props }: A2UIComponentProps) => {
|
|
642
|
+
const palette = usePalette();
|
|
643
|
+
const min = typeof props.min === 'number' ? props.min : 0;
|
|
644
|
+
const max = typeof props.max === 'number' && props.max > min ? props.max : min + 100;
|
|
645
|
+
const steps = typeof props.steps === 'number' && props.steps > 0 ? props.steps : undefined;
|
|
646
|
+
const value = Math.min(Math.max(typeof props.value === 'number' ? props.value : min, min), max);
|
|
647
|
+
const setValue = setterOf(props, 'value');
|
|
648
|
+
const width = useRef(0);
|
|
649
|
+
const set = useRef(setValue);
|
|
650
|
+
set.current = setValue;
|
|
651
|
+
const valueAt = (x: number) => {
|
|
652
|
+
const share = width.current > 0 ? Math.min(Math.max(x / width.current, 0), 1) : 0;
|
|
653
|
+
const raw = min + share * (max - min);
|
|
654
|
+
if (!steps) return raw;
|
|
655
|
+
const step = (max - min) / steps;
|
|
656
|
+
return min + Math.round((raw - min) / step) * step;
|
|
657
|
+
};
|
|
658
|
+
const valueAtRef = useRef(valueAt);
|
|
659
|
+
valueAtRef.current = valueAt;
|
|
660
|
+
const responder = useMemo(
|
|
661
|
+
() =>
|
|
662
|
+
PanResponder.create({
|
|
663
|
+
onMoveShouldSetPanResponder: () => true,
|
|
664
|
+
onPanResponderGrant: ({ nativeEvent }) =>
|
|
665
|
+
set.current?.(valueAtRef.current(nativeEvent.locationX)),
|
|
666
|
+
onPanResponderMove: ({ nativeEvent }) =>
|
|
667
|
+
set.current?.(valueAtRef.current(nativeEvent.locationX)),
|
|
668
|
+
onPanResponderTerminationRequest: () => false,
|
|
669
|
+
onStartShouldSetPanResponder: () => true,
|
|
670
|
+
}),
|
|
671
|
+
[],
|
|
672
|
+
);
|
|
673
|
+
const share = `${((value - min) / (max - min)) * 100}%` as DimensionValue;
|
|
674
|
+
const step = steps ? (max - min) / steps : (max - min) / 10;
|
|
675
|
+
return (
|
|
676
|
+
<View style={styles.field}>
|
|
677
|
+
<FieldLabel text={textOf(props.label)} />
|
|
678
|
+
<View
|
|
679
|
+
accessibilityActions={[{ name: 'increment' }, { name: 'decrement' }]}
|
|
680
|
+
accessibilityRole='adjustable'
|
|
681
|
+
accessibilityValue={{ max, min, now: value }}
|
|
682
|
+
onAccessibilityAction={({ nativeEvent }) =>
|
|
683
|
+
setValue?.(
|
|
684
|
+
Math.min(
|
|
685
|
+
Math.max(value + (nativeEvent.actionName === 'increment' ? step : -step), min),
|
|
686
|
+
max,
|
|
687
|
+
),
|
|
688
|
+
)
|
|
689
|
+
}
|
|
690
|
+
onLayout={({ nativeEvent }) => {
|
|
691
|
+
width.current = nativeEvent.layout.width;
|
|
692
|
+
}}
|
|
693
|
+
style={styles.slider}
|
|
694
|
+
{...responder.panHandlers}
|
|
695
|
+
>
|
|
696
|
+
<View style={[styles.track, { backgroundColor: palette.border }]}>
|
|
697
|
+
<View style={[styles.trackFill, { backgroundColor: palette.accent, width: share }]} />
|
|
698
|
+
</View>
|
|
699
|
+
<View
|
|
700
|
+
pointerEvents='none'
|
|
701
|
+
style={[
|
|
702
|
+
styles.thumb,
|
|
703
|
+
{ backgroundColor: palette.surface, borderColor: palette.accent, left: share },
|
|
704
|
+
]}
|
|
705
|
+
/>
|
|
706
|
+
</View>
|
|
707
|
+
</View>
|
|
708
|
+
);
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// A2UI's DateTimeInput: the date, the time or both, picked in a sheet.
|
|
712
|
+
const DateTimeInput = ({ props }: A2UIComponentProps) => {
|
|
713
|
+
const theme = useA2UITheme();
|
|
714
|
+
const palette = usePalette();
|
|
715
|
+
const errors = errorsOf(props);
|
|
716
|
+
const label = textOf(props.label);
|
|
717
|
+
// Both are off unless the agent says, which would leave nothing to pick: then it is a date.
|
|
718
|
+
const enableTime = props.enableTime === true;
|
|
719
|
+
const enableDate = props.enableDate === true || !enableTime;
|
|
720
|
+
return (
|
|
721
|
+
<View style={styles.field}>
|
|
722
|
+
<FieldLabel text={label} />
|
|
723
|
+
<DateTimeInputView
|
|
724
|
+
enableDate={enableDate}
|
|
725
|
+
enableTime={enableTime}
|
|
726
|
+
hasError={errors.length > 0}
|
|
727
|
+
inputStyle={theme.input}
|
|
728
|
+
label={label || undefined}
|
|
729
|
+
max={typeof props.max === 'string' ? props.max : undefined}
|
|
730
|
+
min={typeof props.min === 'string' ? props.min : undefined}
|
|
731
|
+
onChange={setterOf(props, 'value')}
|
|
732
|
+
palette={palette}
|
|
733
|
+
value={textOf(props.value)}
|
|
734
|
+
/>
|
|
735
|
+
<Problems errors={errors} />
|
|
736
|
+
</View>
|
|
737
|
+
);
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
/** The views of the basic catalog's components, by their A2UI type. */
|
|
741
|
+
export const A2UI_BASIC_COMPONENTS: A2UIComponents = {
|
|
742
|
+
AudioPlayer,
|
|
743
|
+
Button,
|
|
744
|
+
Card,
|
|
745
|
+
CheckBox,
|
|
746
|
+
ChoicePicker,
|
|
747
|
+
Column,
|
|
748
|
+
DateTimeInput,
|
|
749
|
+
Divider,
|
|
750
|
+
Icon,
|
|
751
|
+
Image: ImageComponent,
|
|
752
|
+
List,
|
|
753
|
+
Modal,
|
|
754
|
+
Row,
|
|
755
|
+
Slider,
|
|
756
|
+
Tabs,
|
|
757
|
+
Text,
|
|
758
|
+
TextField,
|
|
759
|
+
Video,
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
const styles = StyleSheet.create({
|
|
763
|
+
borderless: { paddingHorizontal: 0 },
|
|
764
|
+
followUp: { alignSelf: 'stretch' },
|
|
765
|
+
followUpAfter: { borderTopWidth: StyleSheet.hairlineWidth },
|
|
766
|
+
followUpButton: { alignItems: 'flex-start', alignSelf: 'stretch' },
|
|
767
|
+
button: {
|
|
768
|
+
alignItems: 'center',
|
|
769
|
+
alignSelf: 'flex-start',
|
|
770
|
+
borderRadius: 10,
|
|
771
|
+
paddingHorizontal: primitives.spacingMd,
|
|
772
|
+
paddingVertical: 10,
|
|
773
|
+
},
|
|
774
|
+
buttonText: { fontSize: primitives.typographyFontSizeMd, fontWeight: '600' },
|
|
775
|
+
capsule: {
|
|
776
|
+
borderRadius: 9999,
|
|
777
|
+
paddingHorizontal: primitives.spacingSm,
|
|
778
|
+
paddingVertical: primitives.spacingXs,
|
|
779
|
+
},
|
|
780
|
+
capsuleText: { fontSize: primitives.typographyFontSizeSm, fontWeight: '600' },
|
|
781
|
+
caption: { fontSize: primitives.typographyFontSizeXs },
|
|
782
|
+
card: { borderRadius: primitives.radiusLg, padding: primitives.spacingSm },
|
|
783
|
+
chip: { borderWidth: 1 },
|
|
784
|
+
chips: { flexDirection: 'row', flexWrap: 'wrap', gap: primitives.spacingXs },
|
|
785
|
+
choice: {
|
|
786
|
+
alignItems: 'center',
|
|
787
|
+
flexDirection: 'row',
|
|
788
|
+
gap: primitives.spacingXs,
|
|
789
|
+
paddingVertical: 6,
|
|
790
|
+
},
|
|
791
|
+
choiceText: { flexShrink: 1, fontSize: primitives.typographyFontSizeMd },
|
|
792
|
+
divider: { alignSelf: 'stretch', height: StyleSheet.hairlineWidth },
|
|
793
|
+
dividerVertical: { alignSelf: 'stretch', width: StyleSheet.hairlineWidth },
|
|
794
|
+
field: { gap: primitives.spacingXxs },
|
|
795
|
+
flex: { gap: primitives.spacingXs },
|
|
796
|
+
image: { borderRadius: primitives.radiusMd },
|
|
797
|
+
input: {
|
|
798
|
+
borderRadius: primitives.radiusMd,
|
|
799
|
+
borderWidth: 1,
|
|
800
|
+
fontSize: primitives.typographyFontSizeMd,
|
|
801
|
+
paddingHorizontal: 10,
|
|
802
|
+
paddingVertical: 10,
|
|
803
|
+
},
|
|
804
|
+
label: { fontSize: primitives.typographyFontSizeSm },
|
|
805
|
+
longText: { minHeight: 80, textAlignVertical: 'top' },
|
|
806
|
+
mark: {
|
|
807
|
+
alignItems: 'center',
|
|
808
|
+
borderRadius: 4,
|
|
809
|
+
borderWidth: 1.5,
|
|
810
|
+
height: 20,
|
|
811
|
+
justifyContent: 'center',
|
|
812
|
+
width: 20,
|
|
813
|
+
},
|
|
814
|
+
markDot: { borderRadius: 4, height: 8, width: 8 },
|
|
815
|
+
markRound: { borderRadius: 10 },
|
|
816
|
+
problems: { fontSize: primitives.typographyFontSizeXs },
|
|
817
|
+
row: { flexDirection: 'row' },
|
|
818
|
+
sheet: { flex: 1, padding: primitives.spacingMd },
|
|
819
|
+
sheetClose: { alignSelf: 'flex-end', paddingVertical: primitives.spacingXs },
|
|
820
|
+
slider: { height: 32, justifyContent: 'center' },
|
|
821
|
+
tabs: { gap: primitives.spacingXs, paddingBottom: primitives.spacingXs },
|
|
822
|
+
thumb: {
|
|
823
|
+
borderRadius: 11,
|
|
824
|
+
borderWidth: 2,
|
|
825
|
+
height: 22,
|
|
826
|
+
marginLeft: -11,
|
|
827
|
+
position: 'absolute',
|
|
828
|
+
width: 22,
|
|
829
|
+
},
|
|
830
|
+
track: { borderRadius: 2, height: 4, overflow: 'hidden' },
|
|
831
|
+
trackFill: { height: 4 },
|
|
832
|
+
});
|