@trinityui/design-system 2.11.1 → 2.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/CHANGELOG.md +2155 -0
- package/CONTRIBUTING.md +180 -69
- package/LICENSE +21 -0
- package/MIGRATION.md +505 -28
- package/README.md +281 -120
- package/dist/IllustratedMessage.js +546 -1341
- package/dist/accessibility.d.ts +596 -18
- package/dist/accessibility.d.ts.map +1 -1
- package/dist/accessibility.js +458 -0
- package/dist/app-shell.js +18458 -10385
- package/dist/assets/index.d.ts +1 -1
- package/dist/charts.js +8507 -6059
- package/dist/color-contrast.d.ts +35 -0
- package/dist/color-contrast.d.ts.map +1 -0
- package/dist/commonjs-helpers.js +8 -0
- package/dist/component-color-references.d.ts +175 -0
- package/dist/component-color-references.d.ts.map +1 -0
- package/dist/components/AI/AIActions.d.ts +72 -12
- package/dist/components/AI/AIActions.d.ts.map +1 -1
- package/dist/components/AI/AIAvatar.d.ts +31 -3
- package/dist/components/AI/AIAvatar.d.ts.map +1 -1
- package/dist/components/AI/AIChainOfThought.d.ts +159 -77
- package/dist/components/AI/AIChainOfThought.d.ts.map +1 -1
- package/dist/components/AI/AIChainOfThought.types.d.ts +292 -40
- package/dist/components/AI/AIChainOfThought.types.d.ts.map +1 -1
- package/dist/components/AI/AIChainOfThought.utils.d.ts +25 -7
- package/dist/components/AI/AIChainOfThought.utils.d.ts.map +1 -1
- package/dist/components/AI/AIChat.d.ts +12 -0
- package/dist/components/AI/AIChat.d.ts.map +1 -1
- package/dist/components/AI/AIChatWelcome.d.ts +254 -0
- package/dist/components/AI/AIChatWelcome.d.ts.map +1 -0
- package/dist/components/AI/AIClarificationPrompt.d.ts +134 -0
- package/dist/components/AI/AIClarificationPrompt.d.ts.map +1 -0
- package/dist/components/AI/AIConfidenceBadge.d.ts +117 -0
- package/dist/components/AI/AIConfidenceBadge.d.ts.map +1 -0
- package/dist/components/AI/AIConfigContext.d.ts +100 -0
- package/dist/components/AI/AIConfigContext.d.ts.map +1 -0
- package/dist/components/AI/AIConfigProvider.d.ts +66 -0
- package/dist/components/AI/AIConfigProvider.d.ts.map +1 -0
- package/dist/components/AI/AIContainer.d.ts +80 -11
- package/dist/components/AI/AIContainer.d.ts.map +1 -1
- package/dist/components/AI/AIExplainability.d.ts +39 -5
- package/dist/components/AI/AIExplainability.d.ts.map +1 -1
- package/dist/components/AI/AIFeedbackControl.d.ts +113 -0
- package/dist/components/AI/AIFeedbackControl.d.ts.map +1 -0
- package/dist/components/AI/AIFeedbackForm.d.ts +117 -0
- package/dist/components/AI/AIFeedbackForm.d.ts.map +1 -0
- package/dist/components/AI/AIFeedbackHostContext.d.ts +16 -0
- package/dist/components/AI/AIFeedbackHostContext.d.ts.map +1 -0
- package/dist/components/AI/AILabel.d.ts +39 -6
- package/dist/components/AI/AILabel.d.ts.map +1 -1
- package/dist/components/AI/AIMessage.d.ts +337 -42
- package/dist/components/AI/AIMessage.d.ts.map +1 -1
- package/dist/components/AI/AIPlanReview.d.ts +194 -0
- package/dist/components/AI/AIPlanReview.d.ts.map +1 -0
- package/dist/components/AI/AIQueryDisclosure.d.ts +119 -0
- package/dist/components/AI/AIQueryDisclosure.d.ts.map +1 -0
- package/dist/components/AI/AIRelatedQuestions.d.ts +50 -11
- package/dist/components/AI/AIRelatedQuestions.d.ts.map +1 -1
- package/dist/components/AI/AIResponseRenderer.d.ts +133 -21
- package/dist/components/AI/AIResponseRenderer.d.ts.map +1 -1
- package/dist/components/AI/AIResponseSourcesContext.d.ts +83 -0
- package/dist/components/AI/AIResponseSourcesContext.d.ts.map +1 -0
- package/dist/components/AI/AIReviewItem.d.ts +142 -0
- package/dist/components/AI/AIReviewItem.d.ts.map +1 -0
- package/dist/components/AI/AISourceChip.d.ts +135 -0
- package/dist/components/AI/AISourceChip.d.ts.map +1 -0
- package/dist/components/AI/AISources.d.ts +81 -11
- package/dist/components/AI/AISources.d.ts.map +1 -1
- package/dist/components/AI/AISourcesPanel.d.ts +43 -7
- package/dist/components/AI/AISourcesPanel.d.ts.map +1 -1
- package/dist/components/AI/AITextBlock.d.ts +104 -16
- package/dist/components/AI/AITextBlock.d.ts.map +1 -1
- package/dist/components/AI/AITextBlock.parser.d.ts +153 -0
- package/dist/components/AI/AITextBlock.parser.d.ts.map +1 -0
- package/dist/components/AI/AIVerificationBadge.d.ts +94 -0
- package/dist/components/AI/AIVerificationBadge.d.ts.map +1 -0
- package/dist/components/AI/AIVisuals.d.ts +92 -23
- package/dist/components/AI/AIVisuals.d.ts.map +1 -1
- package/dist/components/AI/AIVoiceInput.d.ts +42 -11
- package/dist/components/AI/AIVoiceInput.d.ts.map +1 -1
- package/dist/components/AI/AIVoiceMode.d.ts +16 -2
- package/dist/components/AI/AIVoiceMode.d.ts.map +1 -1
- package/dist/components/AI/BlockErrorBoundary.d.ts +77 -0
- package/dist/components/AI/BlockErrorBoundary.d.ts.map +1 -0
- package/dist/components/AI/ChatHeader.d.ts +41 -4
- package/dist/components/AI/ChatHeader.d.ts.map +1 -1
- package/dist/components/AI/ChatHistoryList.d.ts +25 -12
- package/dist/components/AI/ChatHistoryList.d.ts.map +1 -1
- package/dist/components/AI/ChatThread.d.ts +263 -13
- package/dist/components/AI/ChatThread.d.ts.map +1 -1
- package/dist/components/AI/InThreadContext.d.ts +14 -0
- package/dist/components/AI/InThreadContext.d.ts.map +1 -0
- package/dist/components/AI/InsightEngine.d.ts +270 -46
- package/dist/components/AI/InsightEngine.d.ts.map +1 -1
- package/dist/components/AI/InsightEngineInput.d.ts +47 -4
- package/dist/components/AI/InsightEngineInput.d.ts.map +1 -1
- package/dist/components/AI/MessageActionButton.d.ts +72 -0
- package/dist/components/AI/MessageActionButton.d.ts.map +1 -0
- package/dist/components/AI/QueryInput.d.ts.map +1 -1
- package/dist/components/AI/UserAvatar.d.ts +50 -4
- package/dist/components/AI/UserAvatar.d.ts.map +1 -1
- package/dist/components/AI/UserMessage.d.ts +32 -3
- package/dist/components/AI/UserMessage.d.ts.map +1 -1
- package/dist/components/AI/blockRendererContext.d.ts +64 -0
- package/dist/components/AI/blockRendererContext.d.ts.map +1 -0
- package/dist/components/AI/hitlBlockRenderers.d.ts +48 -0
- package/dist/components/AI/hitlBlockRenderers.d.ts.map +1 -0
- package/dist/components/AI/index.d.ts +23 -6
- package/dist/components/AI/index.d.ts.map +1 -1
- package/dist/components/AI/moleculeBlockRenderers.d.ts +15 -0
- package/dist/components/AI/moleculeBlockRenderers.d.ts.map +1 -0
- package/dist/components/AI/planReviewBlockRenderer.d.ts +8 -0
- package/dist/components/AI/planReviewBlockRenderer.d.ts.map +1 -0
- package/dist/components/AI/strings/defaults.d.ts +31 -0
- package/dist/components/AI/strings/defaults.d.ts.map +1 -0
- package/dist/components/AI/tokens.d.ts +185 -20
- package/dist/components/AI/tokens.d.ts.map +1 -1
- package/dist/components/AI/types/hitl.d.ts +2294 -0
- package/dist/components/AI/types/hitl.d.ts.map +1 -0
- package/dist/components/AI/types/index.d.ts +2 -1
- package/dist/components/AI/types/index.d.ts.map +1 -1
- package/dist/components/AI/types/response.d.ts +428 -40
- package/dist/components/AI/types/response.d.ts.map +1 -1
- package/dist/components/AI/useBlockSources.d.ts +67 -0
- package/dist/components/AI/useBlockSources.d.ts.map +1 -0
- package/dist/components/AI/useBrowserVoiceMode.d.ts +31 -2
- package/dist/components/AI/useBrowserVoiceMode.d.ts.map +1 -1
- package/dist/components/AI/useWelcomeComposerHandoff.d.ts +30 -0
- package/dist/components/AI/useWelcomeComposerHandoff.d.ts.map +1 -0
- package/dist/components/AI/utils/alphaIndex.d.ts +19 -0
- package/dist/components/AI/utils/alphaIndex.d.ts.map +1 -0
- package/dist/components/AI/utils/blockReady.d.ts +54 -0
- package/dist/components/AI/utils/blockReady.d.ts.map +1 -0
- package/dist/components/AI/utils/blocks.d.ts +28 -0
- package/dist/components/AI/utils/blocks.d.ts.map +1 -0
- package/dist/components/AI/utils/confidence.d.ts +182 -0
- package/dist/components/AI/utils/confidence.d.ts.map +1 -0
- package/dist/components/AI/utils/filters.d.ts +31 -0
- package/dist/components/AI/utils/filters.d.ts.map +1 -0
- package/dist/components/AI/utils/responseText.d.ts +8 -0
- package/dist/components/AI/utils/responseText.d.ts.map +1 -0
- package/dist/components/AI/utils/sources.d.ts +110 -0
- package/dist/components/AI/utils/sources.d.ts.map +1 -0
- package/dist/components/AIDigestCard/AIDigestCard.d.ts.map +1 -1
- package/dist/components/AIDigestCard/types.d.ts +42 -5
- package/dist/components/AIDigestCard/types.d.ts.map +1 -1
- package/dist/components/AppLayout/AIFab.d.ts +33 -6
- package/dist/components/AppLayout/AIFab.d.ts.map +1 -1
- package/dist/components/AppLayout/AIFabLayout.deprecated.d.ts.map +1 -1
- package/dist/components/AppLayout/AppLayout.d.ts +135 -7
- package/dist/components/AppLayout/AppLayout.d.ts.map +1 -1
- package/dist/components/AppLayout/InsightEnginePanel.d.ts +315 -21
- package/dist/components/AppLayout/InsightEnginePanel.d.ts.map +1 -1
- package/dist/components/AppLayout/ResizablePanel.d.ts +145 -8
- package/dist/components/AppLayout/ResizablePanel.d.ts.map +1 -1
- package/dist/components/AppLayout/ThreadHistorySidebar.d.ts +6 -0
- package/dist/components/AppLayout/ThreadHistorySidebar.d.ts.map +1 -1
- package/dist/components/AppLayout/index.d.ts +3 -3
- package/dist/components/AppLayout/index.d.ts.map +1 -1
- package/dist/components/AppLayout/insightEnginePanel.demo.d.ts +32 -0
- package/dist/components/AppLayout/insightEnginePanel.demo.d.ts.map +1 -0
- package/dist/components/AppLayout/panelPropsPath.d.ts +26 -0
- package/dist/components/AppLayout/panelPropsPath.d.ts.map +1 -0
- package/dist/components/AppLayout/panelResizeTransition.d.ts +49 -0
- package/dist/components/AppLayout/panelResizeTransition.d.ts.map +1 -0
- package/dist/components/AppLayout/toChatThreadMessage.d.ts +40 -0
- package/dist/components/AppLayout/toChatThreadMessage.d.ts.map +1 -0
- package/dist/components/AssessmentDrawer/AssessmentDrawer.d.ts +5 -1
- package/dist/components/AssessmentDrawer/AssessmentDrawer.d.ts.map +1 -1
- package/dist/components/AuditDrawer/AuditDrawer.d.ts +4 -3
- package/dist/components/AuditDrawer/AuditDrawer.d.ts.map +1 -1
- package/dist/components/AuditDrawer/index.d.ts +1 -1
- package/dist/components/AuditDrawer/index.d.ts.map +1 -1
- package/dist/components/AuditDrawer/types.d.ts +39 -5
- package/dist/components/AuditDrawer/types.d.ts.map +1 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +6 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/BulkActionDock/BulkActionDock.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +10 -2
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Charts/AreaChart.d.ts.map +1 -1
- package/dist/components/Charts/BarChart.d.ts.map +1 -1
- package/dist/components/Charts/ChartWrapper.d.ts.map +1 -1
- package/dist/components/Charts/ComposedChart.d.ts.map +1 -1
- package/dist/components/Charts/CustomLegend.d.ts +11 -2
- package/dist/components/Charts/CustomLegend.d.ts.map +1 -1
- package/dist/components/Charts/LineChart.d.ts.map +1 -1
- package/dist/components/Charts/PieChart.d.ts.map +1 -1
- package/dist/components/Charts/RadialChart.d.ts.map +1 -1
- package/dist/components/Charts/ScatterChart.d.ts.map +1 -1
- package/dist/components/Charts/Sparkline.d.ts.map +1 -1
- package/dist/components/Charts/gaugeGeometry.d.ts +35 -0
- package/dist/components/Charts/gaugeGeometry.d.ts.map +1 -0
- package/dist/components/Charts/highcharts.d.ts +23 -0
- package/dist/components/Charts/highcharts.d.ts.map +1 -0
- package/dist/components/Charts/highchartsUtils.d.ts +101 -6
- package/dist/components/Charts/highchartsUtils.d.ts.map +1 -1
- package/dist/components/Charts/index.d.ts +1 -1
- package/dist/components/Charts/index.d.ts.map +1 -1
- package/dist/components/Charts/tokens.d.ts +21 -0
- package/dist/components/Charts/tokens.d.ts.map +1 -1
- package/dist/components/Charts/types.d.ts +7 -7
- package/dist/components/Charts/types.d.ts.map +1 -1
- package/dist/components/ChipsInput/ChipsInput.d.ts.map +1 -1
- package/dist/components/ChoiceChips/ChoiceChips.d.ts +106 -0
- package/dist/components/ChoiceChips/ChoiceChips.d.ts.map +1 -0
- package/dist/components/ClearableTextField/ClearableTextField.d.ts +23 -2
- package/dist/components/ClearableTextField/ClearableTextField.d.ts.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.ts +80 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts.map +1 -0
- package/dist/components/Combobox/Combobox.d.ts +3 -2
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.d.ts +54 -3
- package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/components/CommandPalette/index.d.ts +1 -1
- package/dist/components/CommandPalette/index.d.ts.map +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +80 -0
- package/dist/components/CopyButton/CopyButton.d.ts.map +1 -0
- package/dist/components/DataCard/DataCard.d.ts +11 -1
- package/dist/components/DataCard/DataCard.d.ts.map +1 -1
- package/dist/components/DataTable/CellRenderers.d.ts +8 -11
- package/dist/components/DataTable/CellRenderers.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +1 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/InlineAddRow.d.ts.map +1 -1
- package/dist/components/DataTable/columnContext.d.ts +8 -0
- package/dist/components/DataTable/columnContext.d.ts.map +1 -0
- package/dist/components/DataTable/index.d.ts +2 -2
- package/dist/components/DataTable/index.d.ts.map +1 -1
- package/dist/components/DataTable/labels.d.ts +13 -0
- package/dist/components/DataTable/labels.d.ts.map +1 -0
- package/dist/components/DataTable/types.d.ts +34 -0
- package/dist/components/DataTable/types.d.ts.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/DetailsPopover/DetailsPopover.d.ts +185 -0
- package/dist/components/DetailsPopover/DetailsPopover.d.ts.map +1 -0
- package/dist/components/DiffViewer/DiffViewer.d.ts +3 -2
- package/dist/components/DiffViewer/DiffViewer.d.ts.map +1 -1
- package/dist/components/Disclosure/Disclosure.d.ts +83 -0
- package/dist/components/Disclosure/Disclosure.d.ts.map +1 -0
- package/dist/components/DockLayout/DockLayout.d.ts +58 -0
- package/dist/components/DockLayout/DockLayout.d.ts.map +1 -1
- package/dist/components/DockLayout/index.d.ts +1 -1
- package/dist/components/DockLayout/index.d.ts.map +1 -1
- package/dist/components/DocumentCard/DocumentCard.d.ts +5 -1
- package/dist/components/DocumentCard/DocumentCard.d.ts.map +1 -1
- package/dist/components/EntityDetailPanel/EntityDetailPanel.d.ts +6 -2
- package/dist/components/EntityDetailPanel/EntityDetailPanel.d.ts.map +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +141 -6
- package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/components/FileUpload/index.d.ts +1 -1
- package/dist/components/FileUpload/index.d.ts.map +1 -1
- package/dist/components/FilterBar/FilterBar.d.ts +27 -1
- package/dist/components/FilterBar/FilterBar.d.ts.map +1 -1
- package/dist/components/FilterBar/index.d.ts +1 -1
- package/dist/components/FilterBar/index.d.ts.map +1 -1
- package/dist/components/FlowAutoLayout/useFlowAutoLayout.d.ts.map +1 -1
- package/dist/components/GanttView/GanttView.d.ts +24 -0
- package/dist/components/GanttView/GanttView.d.ts.map +1 -1
- package/dist/components/GanttView/types.d.ts +33 -7
- package/dist/components/GanttView/types.d.ts.map +1 -1
- package/dist/components/GaugeCard/GaugeCard.d.ts +4 -3
- package/dist/components/GaugeCard/GaugeCard.d.ts.map +1 -1
- package/dist/components/GaugeCard/geometry.d.ts +59 -0
- package/dist/components/GaugeCard/geometry.d.ts.map +1 -0
- package/dist/components/GeoStatusMap/GeoStatusMap.d.ts.map +1 -1
- package/dist/components/GeoStatusMap/types.d.ts +8 -5
- package/dist/components/GeoStatusMap/types.d.ts.map +1 -1
- package/dist/components/GoToTop/GoToTop.d.ts +1 -1
- package/dist/components/GoToTop/GoToTop.d.ts.map +1 -1
- package/dist/components/HierarchicalDrillDown/HierarchicalDrillDown.d.ts.map +1 -1
- package/dist/components/HistoricalDataIndicator/HistoricalDataIndicator.d.ts.map +1 -1
- package/dist/components/HtmlToMui/HtmlToMui.d.ts.map +1 -1
- package/dist/components/Icon.d.ts +567 -10
- package/dist/components/Icon.d.ts.map +1 -1
- package/dist/components/IllustratedMessage.d.ts +52 -3
- package/dist/components/IllustratedMessage.d.ts.map +1 -1
- package/dist/components/InlineEditableText/InlineEditableText.d.ts +117 -0
- package/dist/components/InlineEditableText/InlineEditableText.d.ts.map +1 -0
- package/dist/components/InsightCard/InsightCard.d.ts.map +1 -1
- package/dist/components/InsightCard/types.d.ts +10 -3
- package/dist/components/InsightCard/types.d.ts.map +1 -1
- package/dist/components/KeyValueList/KeyValueList.d.ts +94 -0
- package/dist/components/KeyValueList/KeyValueList.d.ts.map +1 -0
- package/dist/components/LandingPage/FeatureCard.d.ts +4 -0
- package/dist/components/LandingPage/FeatureCard.d.ts.map +1 -1
- package/dist/components/LandingPage/LandingPage.d.ts +43 -4
- package/dist/components/LandingPage/LandingPage.d.ts.map +1 -1
- package/dist/components/LandingPage/heroTone.d.ts +54 -0
- package/dist/components/LandingPage/heroTone.d.ts.map +1 -0
- package/dist/components/MentionsInput/MentionsInput.d.ts.map +1 -1
- package/dist/components/MetaChip/MetaChip.d.ts +113 -0
- package/dist/components/MetaChip/MetaChip.d.ts.map +1 -0
- package/dist/components/Modal/Modal.d.ts +222 -20
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.d.ts.map +1 -1
- package/dist/components/OrgChart/OrgChart.d.ts +5 -0
- package/dist/components/OrgChart/OrgChart.d.ts.map +1 -1
- package/dist/components/OrgChart/types.d.ts +31 -7
- package/dist/components/OrgChart/types.d.ts.map +1 -1
- package/dist/components/OverflowTooltip/OverflowTooltip.d.ts +1 -1
- package/dist/components/OverflowTooltip/OverflowTooltip.d.ts.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/components/PageTOC/PageTOC.d.ts +2 -1
- package/dist/components/PageTOC/PageTOC.d.ts.map +1 -1
- package/dist/components/Popper/Popper.d.ts +80 -9
- package/dist/components/Popper/Popper.d.ts.map +1 -1
- package/dist/components/Popper/index.d.ts +1 -1
- package/dist/components/Popper/index.d.ts.map +1 -1
- package/dist/components/PredictiveTextInput/PredictiveTextInput.d.ts +5 -1
- package/dist/components/PredictiveTextInput/PredictiveTextInput.d.ts.map +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +49 -0
- package/dist/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/components/SearchInput/index.d.ts +1 -1
- package/dist/components/SearchInput/index.d.ts.map +1 -1
- package/dist/components/SimpleTable/SimpleTable.d.ts +11 -2
- package/dist/components/SimpleTable/SimpleTable.d.ts.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +2 -1
- package/dist/components/SplitPane/SplitPane.d.ts.map +1 -1
- package/dist/components/StatusHero/StatusHero.d.ts.map +1 -1
- package/dist/components/StatusIndicator/Badge.d.ts +6 -1
- package/dist/components/StatusIndicator/Badge.d.ts.map +1 -1
- package/dist/components/StatusIndicator/Chip.d.ts +3 -1
- package/dist/components/StatusIndicator/Chip.d.ts.map +1 -1
- package/dist/components/StatusIndicator/Indicators.d.ts +5 -1
- package/dist/components/StatusIndicator/Indicators.d.ts.map +1 -1
- package/dist/components/StatusIndicator/Legend.d.ts.map +1 -1
- package/dist/components/StatusIndicator/StatusIndicator.d.ts +98 -4
- package/dist/components/StatusIndicator/StatusIndicator.d.ts.map +1 -1
- package/dist/components/StatusIndicator/index.d.ts +2 -2
- package/dist/components/StatusIndicator/index.d.ts.map +1 -1
- package/dist/components/StatusIndicator/types.d.ts +48 -1
- package/dist/components/StatusIndicator/types.d.ts.map +1 -1
- package/dist/components/StepList/StepList.d.ts +80 -0
- package/dist/components/StepList/StepList.d.ts.map +1 -0
- package/dist/components/StepList/StepStatusMarker.d.ts +39 -0
- package/dist/components/StepList/StepStatusMarker.d.ts.map +1 -0
- package/dist/components/StepList/stepStatus.d.ts +30 -0
- package/dist/components/StepList/stepStatus.d.ts.map +1 -0
- package/dist/components/SystemBanner/SystemBanner.d.ts.map +1 -1
- package/dist/components/Timeline/Timeline.d.ts +57 -3
- package/dist/components/Timeline/Timeline.d.ts.map +1 -1
- package/dist/components/Timeline/index.d.ts +1 -1
- package/dist/components/Timeline/index.d.ts.map +1 -1
- package/dist/components/Timeline/timelineLabels.d.ts +70 -0
- package/dist/components/Timeline/timelineLabels.d.ts.map +1 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/TopNavHeader.d.ts +6 -0
- package/dist/components/TopNavHeader.d.ts.map +1 -1
- package/dist/components/TopNavWithSidebar.d.ts +49 -1
- package/dist/components/TopNavWithSidebar.d.ts.map +1 -1
- package/dist/components/Tour/Tour.d.ts +18 -1
- package/dist/components/Tour/Tour.d.ts.map +1 -1
- package/dist/components/TransferList/TransferList.d.ts +123 -4
- package/dist/components/TransferList/TransferList.d.ts.map +1 -1
- package/dist/components/TransferList/index.d.ts +1 -1
- package/dist/components/TransferList/index.d.ts.map +1 -1
- package/dist/components/TreeView/TreeView.d.ts +97 -8
- package/dist/components/TreeView/TreeView.d.ts.map +1 -1
- package/dist/components/TreeView/index.d.ts +1 -1
- package/dist/components/TreeView/index.d.ts.map +1 -1
- package/dist/components/TrinityLoader.d.ts.map +1 -1
- package/dist/components/icons/featherExtensions.d.ts +55 -0
- package/dist/components/icons/featherExtensions.d.ts.map +1 -0
- package/dist/components/icons/materialExtensions.d.ts +20 -0
- package/dist/components/icons/materialExtensions.d.ts.map +1 -0
- package/dist/components/internal/index.d.ts +87 -0
- package/dist/components/internal/index.d.ts.map +1 -1
- package/dist/components/navigation/MenuListWithHeading.d.ts +33 -0
- package/dist/components/navigation/MenuListWithHeading.d.ts.map +1 -0
- package/dist/components/navigation/clientSelectorLabels.d.ts +13 -0
- package/dist/components/navigation/clientSelectorLabels.d.ts.map +1 -0
- package/dist/components/navigation/components.d.ts +6 -0
- package/dist/components/navigation/components.d.ts.map +1 -1
- package/dist/components/shared/AsyncOutcomeAlert.d.ts +91 -0
- package/dist/components/shared/AsyncOutcomeAlert.d.ts.map +1 -0
- package/dist/components/shared/TrinityIconSvg.d.ts.map +1 -1
- package/dist/components/shared/TrinityLogoSvg.d.ts.map +1 -1
- package/dist/components/shared/bidi.d.ts +44 -0
- package/dist/components/shared/bidi.d.ts.map +1 -0
- package/dist/components/shared/bidiText.d.ts +25 -0
- package/dist/components/shared/bidiText.d.ts.map +1 -0
- package/dist/components/shared/containerQueries.d.ts +73 -0
- package/dist/components/shared/containerQueries.d.ts.map +1 -0
- package/dist/components/shared/createStringsContext.d.ts +69 -0
- package/dist/components/shared/createStringsContext.d.ts.map +1 -0
- package/dist/components/shared/direction.d.ts +46 -0
- package/dist/components/shared/direction.d.ts.map +1 -0
- package/dist/components/shared/focusTrap.d.ts +36 -0
- package/dist/components/shared/focusTrap.d.ts.map +1 -0
- package/dist/components/shared/getInitials.d.ts +29 -0
- package/dist/components/shared/getInitials.d.ts.map +1 -0
- package/dist/components/shared/headingLevel.d.ts +69 -0
- package/dist/components/shared/headingLevel.d.ts.map +1 -0
- package/dist/components/shared/mergeSlotProps.d.ts +50 -0
- package/dist/components/shared/mergeSlotProps.d.ts.map +1 -0
- package/dist/components/shared/mergeSx.d.ts +26 -0
- package/dist/components/shared/mergeSx.d.ts.map +1 -0
- package/dist/components/shared/motion.d.ts +110 -0
- package/dist/components/shared/motion.d.ts.map +1 -0
- package/dist/components/shared/occurrenceKeys.d.ts +23 -0
- package/dist/components/shared/occurrenceKeys.d.ts.map +1 -0
- package/dist/components/shared/primaryAction.d.ts +89 -0
- package/dist/components/shared/primaryAction.d.ts.map +1 -0
- package/dist/components/shared/resizeKeyboard.d.ts +68 -0
- package/dist/components/shared/resizeKeyboard.d.ts.map +1 -0
- package/dist/components/shared/rootProps.d.ts +117 -0
- package/dist/components/shared/rootProps.d.ts.map +1 -0
- package/dist/components/shared/safeContent.d.ts +9 -2
- package/dist/components/shared/safeContent.d.ts.map +1 -1
- package/dist/components/shared/targetSize.d.ts +64 -0
- package/dist/components/shared/targetSize.d.ts.map +1 -0
- package/dist/components/shared/useContainerInlineSize.d.ts +43 -0
- package/dist/components/shared/useContainerInlineSize.d.ts.map +1 -0
- package/dist/components/shared/useCopyAction.d.ts +35 -0
- package/dist/components/shared/useCopyAction.d.ts.map +1 -0
- package/dist/components/shared/useOverflow.d.ts +44 -0
- package/dist/components/shared/useOverflow.d.ts.map +1 -0
- package/dist/components/shared/useResizable.d.ts +106 -7
- package/dist/components/shared/useResizable.d.ts.map +1 -1
- package/dist/components/shared/warnDeprecated.d.ts +89 -15
- package/dist/components/shared/warnDeprecated.d.ts.map +1 -1
- package/dist/components/shared/zIndexRoles.d.ts +62 -0
- package/dist/components/shared/zIndexRoles.d.ts.map +1 -0
- package/dist/components/templates/AIReviewQueue/AIReviewQueueTemplate.d.ts +213 -0
- package/dist/components/templates/AIReviewQueue/AIReviewQueueTemplate.d.ts.map +1 -0
- package/dist/components/templates/AIReviewQueue/index.d.ts +2 -0
- package/dist/components/templates/AIReviewQueue/index.d.ts.map +1 -0
- package/dist/components/templates/Auth/AuthTemplate.d.ts.map +1 -1
- package/dist/components/templates/Auth/types.d.ts +4 -1
- package/dist/components/templates/Auth/types.d.ts.map +1 -1
- package/dist/components/templates/Catalog/CatalogTemplate.d.ts.map +1 -1
- package/dist/components/templates/ConnectorWizard/ConnectorWizardTemplate.d.ts.map +1 -1
- package/dist/components/templates/InsightsCenter/InsightsCenterTemplate.d.ts.map +1 -1
- package/dist/components/templates/IntegrationDetail/IntegrationDetailTemplate.d.ts.map +1 -1
- package/dist/components/templates/ListDetail/ListDetailTemplate.d.ts +168 -10
- package/dist/components/templates/ListDetail/ListDetailTemplate.d.ts.map +1 -1
- package/dist/components/templates/ListDetail/index.d.ts +1 -1
- package/dist/components/templates/ListDetail/index.d.ts.map +1 -1
- package/dist/components/templates/ListDetail/listDetailLabels.d.ts +106 -0
- package/dist/components/templates/ListDetail/listDetailLabels.d.ts.map +1 -0
- package/dist/components/templates/Onboarding/OnboardingTemplate.d.ts.map +1 -1
- package/dist/components/templates/Settings/SettingsTemplate.d.ts +0 -3
- package/dist/components/templates/Settings/SettingsTemplate.d.ts.map +1 -1
- package/dist/components/templates/Wizard/WizardTemplate.d.ts +4 -1
- package/dist/components/templates/Wizard/WizardTemplate.d.ts.map +1 -1
- package/dist/components/templates/index.d.ts +2 -1
- package/dist/components/templates/index.d.ts.map +1 -1
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +1 -0
- package/dist/data-table2.js +13522 -13465
- package/dist/data.js +213 -194
- package/dist/elk.bundled.js +47371 -0
- package/dist/essentials.d.ts +3 -3
- package/dist/essentials.d.ts.map +1 -1
- package/dist/essentials.js +179 -147
- package/dist/focus-on-replace.js +49 -0
- package/dist/form.d.ts +26 -4
- package/dist/form.d.ts.map +1 -1
- package/dist/forms.js +575 -483
- package/dist/foundation.js +3704 -0
- package/dist/hooks/storageStore.d.ts +51 -0
- package/dist/hooks/storageStore.d.ts.map +1 -0
- package/dist/hooks/useAsyncAction.d.ts +65 -0
- package/dist/hooks/useAsyncAction.d.ts.map +1 -0
- package/dist/hooks/useDisclosure.d.ts +190 -0
- package/dist/hooks/useDisclosure.d.ts.map +1 -0
- package/dist/hooks/useFocusOnReplace.d.ts +95 -0
- package/dist/hooks/useFocusOnReplace.d.ts.map +1 -0
- package/dist/hooks/useTrinityPalette.d.ts +38 -40
- package/dist/hooks/useTrinityPalette.d.ts.map +1 -1
- package/dist/hooks.d.ts +44 -6
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +301 -0
- package/dist/index.d.ts +71 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13923 -60619
- package/dist/patterns/AICopilotPattern/AICopilotPattern.d.ts +203 -0
- package/dist/patterns/AICopilotPattern/AICopilotPattern.d.ts.map +1 -0
- package/dist/patterns/AICopilotPattern/index.d.ts +3 -0
- package/dist/patterns/AICopilotPattern/index.d.ts.map +1 -0
- package/dist/patterns/index.d.ts +15 -0
- package/dist/patterns/index.d.ts.map +1 -0
- package/dist/presets/analytics.d.ts +8 -1
- package/dist/presets/analytics.d.ts.map +1 -1
- package/dist/presets/crm.d.ts +8 -1
- package/dist/presets/crm.d.ts.map +1 -1
- package/dist/presets/index.d.ts +1 -1
- package/dist/presets/portal.d.ts +8 -1
- package/dist/presets/portal.d.ts.map +1 -1
- package/dist/safe-content.js +69 -69
- package/dist/theme-augmentation.d.ts +388 -0
- package/dist/theme-augmentation.d.ts.map +1 -0
- package/dist/theme.d.ts +116 -30
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +891 -436
- package/dist/token-color.d.ts +14 -0
- package/dist/token-color.d.ts.map +1 -0
- package/dist/token-merge.d.ts +56 -0
- package/dist/token-merge.d.ts.map +1 -0
- package/dist/token-serialization.d.ts +65 -0
- package/dist/token-serialization.d.ts.map +1 -0
- package/dist/tokens.d.ts +882 -13
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +21 -19
- package/dist/trinity.css +1077 -414
- package/package.json +111 -90
- package/dist/components/index.d.ts +0 -145
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/shared.d.ts +0 -92
- package/dist/components/shared.d.ts.map +0 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview AIQueryDisclosure: the query behind an AI answer, shown on demand (master-plan F-14).
|
|
3
|
+
* @module components/AI/AIQueryDisclosure
|
|
4
|
+
*
|
|
5
|
+
* A thin composition of the shared blocks (no local reimplementation):
|
|
6
|
+
*
|
|
7
|
+
* - **Trigger.** D's Disclosure (useDisclosure's inline mode): a `<button type="button">` with
|
|
8
|
+
* `aria-expanded` and `aria-controls`. The label is constant ('Query', or 'SQL query' through
|
|
9
|
+
* `titleWithLanguage`); `aria-expanded` carries the state and the label never toggles (APG).
|
|
10
|
+
* No heading by default (ADR-19); `headingLevel` wraps the trigger in one.
|
|
11
|
+
* - **Code.** D's CodeBlock: `<pre dir="ltr"><code>`, so the query never mirrors in a
|
|
12
|
+
* right-to-left page. While it scrolls it is a focusable group named `codeLabel` (axe
|
|
13
|
+
* scrollable-region-focusable). The code area scrolls past `maxHeight`
|
|
14
|
+
* (default `theme.spacing(40)`).
|
|
15
|
+
* - **Copy.** D's CopyButton after the code (Tab reaches the code, then the button): the copy goes
|
|
16
|
+
* through `useClipboard` (useCopyAction); 'Query copied' or 'Copy failed' is announced once.
|
|
17
|
+
* `onCopy(query)` runs after a successful write, and `AICopyInteraction { success }` is
|
|
18
|
+
* reported to AIConfigProvider either way.
|
|
19
|
+
* - **Metadata.** D's KeyValueList (inline tiles): rows, duration (Intl.NumberFormat, unit
|
|
20
|
+
* 'second'), dataset, dialect and executed-at (`useFormatAsOf`: the provider's time zone, else
|
|
21
|
+
* 'UTC' while hydrating, so server and client agree). An inner container query stacks the
|
|
22
|
+
* tiles below the 'compact' container width (E-19).
|
|
23
|
+
* - **Streaming.** A Skeleton replaces the code; the trigger is `aria-disabled` and described by
|
|
24
|
+
* the visible reason ('The query is still being generated'). Nothing is announced.
|
|
25
|
+
* - **Empty.** An empty query that is not streaming renders nothing, with one development warning
|
|
26
|
+
* from an effect (ADR-30).
|
|
27
|
+
* - **Reveal.** With `metadata.queryId` inside a response (AIResponseSourcesProvider, F-08), the
|
|
28
|
+
* view registers `{ reveal }`: a source chip's 'Show query' opens it and, after the open
|
|
29
|
+
* commit, moves focus to its trigger.
|
|
30
|
+
* - **Naming.** `expanded`, `defaultExpanded` and `onExpandedChange(expanded, event?)` follow the
|
|
31
|
+
* AI family (AISourcesPanel) with the ADR-04 (9) event argument; they map onto useDisclosure's
|
|
32
|
+
* open state (the NAMING exception, F-20).
|
|
33
|
+
* - **Telemetry.** `AIQueryViewInteraction` on expand and collapse; never the query text.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* import { AIQueryDisclosure } from '@trinityui/design-system';
|
|
38
|
+
*
|
|
39
|
+
* <AIQueryDisclosure
|
|
40
|
+
* query="SELECT region, SUM(net) FROM revenue GROUP BY region"
|
|
41
|
+
* language="SQL"
|
|
42
|
+
* metadata={{ rowCount: 4, durationMs: 845, dataset: 'finance.revenue' }}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
import * as React from 'react';
|
|
47
|
+
import { type SxProps, type Theme } from '@mui/material/styles';
|
|
48
|
+
import type { HeadingLevel } from '../shared/headingLevel';
|
|
49
|
+
import { type TrinitySlotProps } from '../shared/rootProps';
|
|
50
|
+
import type { AIQueryMetadata } from './types/hitl';
|
|
51
|
+
/**
|
|
52
|
+
* AIQueryDisclosure's own props.
|
|
53
|
+
*
|
|
54
|
+
* @since 2.13.0
|
|
55
|
+
*/
|
|
56
|
+
export interface AIQueryDisclosureOwnProps {
|
|
57
|
+
/** The query text, as it ran. An empty query renders nothing unless `streaming`. */
|
|
58
|
+
query: string;
|
|
59
|
+
/**
|
|
60
|
+
* The query language as shown, for example 'SQL'. The trigger reads 'SQL query' and the
|
|
61
|
+
* scrolling code area is named 'SQL query text'.
|
|
62
|
+
*/
|
|
63
|
+
language?: string;
|
|
64
|
+
/** The trigger label. It never changes with the state. @default 'Query' (or `titleWithLanguage`) */
|
|
65
|
+
title?: string;
|
|
66
|
+
/** Facts about the run: row count, duration, dataset, dialect, when it ran, and its `queryId`. */
|
|
67
|
+
metadata?: AIQueryMetadata;
|
|
68
|
+
/** Controlled expansion. */
|
|
69
|
+
expanded?: boolean;
|
|
70
|
+
/** Initial expansion when uncontrolled. @default false */
|
|
71
|
+
defaultExpanded?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Called with the requested expansion and, when the user caused it, the event. A reveal from a
|
|
74
|
+
* source chip's 'Show query' has no event.
|
|
75
|
+
*/
|
|
76
|
+
onExpandedChange?: (expanded: boolean, event?: React.SyntheticEvent) => void;
|
|
77
|
+
/** The code area scrolls vertically beyond this height. @default theme.spacing(40) */
|
|
78
|
+
maxHeight?: number | string;
|
|
79
|
+
/**
|
|
80
|
+
* The query is still being generated: a Skeleton replaces the code and the trigger is
|
|
81
|
+
* `aria-disabled` with its visible reason. Adapters map a block's `status` onto it.
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
streaming?: boolean;
|
|
85
|
+
/** Called with the query after it was written to the clipboard. */
|
|
86
|
+
onCopy?: (query: string) => void | Promise<void>;
|
|
87
|
+
/** Id of the response block that holds the query, reported with the interactions. */
|
|
88
|
+
blockId?: string;
|
|
89
|
+
/** Wraps the trigger in a heading of this level. No heading by default (ADR-19). */
|
|
90
|
+
headingLevel?: HeadingLevel;
|
|
91
|
+
className?: string;
|
|
92
|
+
sx?: SxProps<Theme>;
|
|
93
|
+
/**
|
|
94
|
+
* Props for the parts (ADR-04 (6)): `trigger` (the disclosure button), `panel` (the region it
|
|
95
|
+
* shows), `code` (the `<pre>`), `metadata` (the `<dl>`) and `copyButton`.
|
|
96
|
+
*/
|
|
97
|
+
slotProps?: {
|
|
98
|
+
trigger?: TrinitySlotProps<HTMLButtonElement>;
|
|
99
|
+
panel?: TrinitySlotProps<HTMLDivElement>;
|
|
100
|
+
code?: TrinitySlotProps<HTMLPreElement>;
|
|
101
|
+
metadata?: TrinitySlotProps<HTMLDListElement>;
|
|
102
|
+
copyButton?: TrinitySlotProps<HTMLButtonElement>;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Props of {@link AIQueryDisclosure}: its own props plus the root `<div>`'s HTML attributes
|
|
107
|
+
* (ADR-04).
|
|
108
|
+
*
|
|
109
|
+
* @since 2.13.0
|
|
110
|
+
*/
|
|
111
|
+
export type AIQueryDisclosureProps = AIQueryDisclosureOwnProps & Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'title' | keyof AIQueryDisclosureOwnProps>;
|
|
112
|
+
/**
|
|
113
|
+
* The query behind an AI answer, shown on demand: a disclosure with the query as left-to-right
|
|
114
|
+
* code, a copy button and the run's metadata. See the module notes.
|
|
115
|
+
*
|
|
116
|
+
* @since 2.13.0
|
|
117
|
+
*/
|
|
118
|
+
export declare const AIQueryDisclosure: React.ForwardRefExoticComponent<AIQueryDisclosureOwnProps & Omit<React.HTMLAttributes<HTMLDivElement>, "color" | keyof AIQueryDisclosureOwnProps> & React.RefAttributes<HTMLDivElement>>;
|
|
119
|
+
//# sourceMappingURL=AIQueryDisclosure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIQueryDisclosure.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIQueryDisclosure.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAS1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI1E,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,cAAc,CAAC;AAK/D;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oGAAoG;IACpG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;IAC7E,sFAAsF;IACtF,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,mEAAmE;IACnE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oFAAoF;IACpF,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAC9C,KAAK,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACxC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;QAC9C,UAAU,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;KAClD,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,yBAAyB,GAC5D,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,yBAAyB,CAAC,CAAC;AA4ClG;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,0LAgK5B,CAAC"}
|
|
@@ -2,28 +2,56 @@
|
|
|
2
2
|
* @fileoverview AIRelatedQuestions component.
|
|
3
3
|
* @module components/AI/AIRelatedQuestions
|
|
4
4
|
* AI Related Questions Component
|
|
5
|
-
* Collapsible panel displaying related/follow-up questions with filled background surface
|
|
5
|
+
* Collapsible panel displaying related/follow-up questions with filled background surface.
|
|
6
|
+
* A question is a string or an {@link AIRelatedQuestion}; a verified one shows the
|
|
7
|
+
* AIVerificationBadge ('Verified', glyph and text) after its text (G-24a).
|
|
6
8
|
*
|
|
7
9
|
* @example
|
|
8
10
|
* ```tsx
|
|
9
11
|
* import { AIRelatedQuestions } from '@trinityui/design-system';
|
|
10
12
|
*
|
|
11
13
|
* <AIRelatedQuestions
|
|
12
|
-
* questions=
|
|
14
|
+
* questions={['Compare by region', { id: 'q4', text: 'Project Q4', verified: true }]}
|
|
15
|
+
* onQuestionSelect={(question, index) => ask(question.text)}
|
|
13
16
|
* />
|
|
14
17
|
* ```
|
|
15
18
|
*/
|
|
16
19
|
import React from 'react';
|
|
17
20
|
import { SxProps, Theme } from '@mui/material';
|
|
21
|
+
import { type TrinityRootProps } from '../shared/rootProps';
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
23
|
+
* One related question, when it carries more than its text (G-24a).
|
|
24
|
+
* @since 2.13.0
|
|
20
25
|
*/
|
|
21
|
-
export interface
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/**
|
|
26
|
+
export interface AIRelatedQuestion {
|
|
27
|
+
/** A stable id, used as the list key. Without one the key is the text and its occurrence. */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** The question: shown, and passed to `onQuestionClick`. */
|
|
30
|
+
text: string;
|
|
31
|
+
/**
|
|
32
|
+
* A pre-checked suggestion (R15): the verification badge ('Verified', a glyph and the word,
|
|
33
|
+
* never colour alone) follows the text and is part of the button's name.
|
|
34
|
+
*/
|
|
35
|
+
verified?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* AIRelatedQuestions' own props.
|
|
39
|
+
*/
|
|
40
|
+
export interface AIRelatedQuestionsOwnProps {
|
|
41
|
+
/**
|
|
42
|
+
* List of related questions: strings, or {@link AIRelatedQuestion} objects (since 2.13.0)
|
|
43
|
+
* for an id and the verified flag. Both can be mixed.
|
|
44
|
+
*/
|
|
45
|
+
questions: Array<string | AIRelatedQuestion>;
|
|
46
|
+
/** Callback when a question is clicked: the question's text. */
|
|
25
47
|
onQuestionClick?: (question: string) => void;
|
|
26
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Callback when a question is clicked: the question (a string is passed as `{ text }`) and its
|
|
50
|
+
* index. Fires alongside `onQuestionClick`.
|
|
51
|
+
* @since 2.13.0
|
|
52
|
+
*/
|
|
53
|
+
onQuestionSelect?: (question: AIRelatedQuestion, index: number) => void;
|
|
54
|
+
/** Panel title. Default: the `ai.relatedQuestions.title` string ('Related questions'). */
|
|
27
55
|
title?: string;
|
|
28
56
|
/** Whether panel is initially expanded */
|
|
29
57
|
defaultExpanded?: boolean;
|
|
@@ -31,15 +59,26 @@ export interface AIRelatedQuestionsProps {
|
|
|
31
59
|
expanded?: boolean;
|
|
32
60
|
/** Callback when expanded state changes */
|
|
33
61
|
onExpandedChange?: (expanded: boolean) => void;
|
|
34
|
-
/** Empty state title when no questions */
|
|
62
|
+
/** Empty state title when no questions. Default: `ai.relatedQuestions.emptyTitle`. */
|
|
35
63
|
emptyTitle?: string;
|
|
36
|
-
/** Empty state description */
|
|
64
|
+
/** Empty state description. Default: `ai.relatedQuestions.emptyDescription`. */
|
|
37
65
|
emptyDescription?: string;
|
|
38
66
|
/** Show empty state instead of hiding */
|
|
39
67
|
showEmpty?: boolean;
|
|
40
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Added to the root's own class names.
|
|
70
|
+
* @since 2.13.0
|
|
71
|
+
*/
|
|
72
|
+
className?: string;
|
|
73
|
+
/** Custom sx props, applied after the panel's own styles (object, array or function). */
|
|
41
74
|
sx?: SxProps<Theme>;
|
|
42
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Props for AIRelatedQuestions: its own props, plus the HTML attributes of its root `div`
|
|
78
|
+
* (`id`, `data-*`, `aria-*`), which reach the root (ADR-04, WI-40).
|
|
79
|
+
*/
|
|
80
|
+
export interface AIRelatedQuestionsProps extends AIRelatedQuestionsOwnProps, TrinityRootProps<HTMLDivElement, AIRelatedQuestionsOwnProps> {
|
|
81
|
+
}
|
|
43
82
|
/**
|
|
44
83
|
* AI Related Questions - Collapsible panel with clickable follow-up questions
|
|
45
84
|
* Features:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIRelatedQuestions.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIRelatedQuestions.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AIRelatedQuestions.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIRelatedQuestions.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAUL,OAAO,EACP,KAAK,EACN,MAAM,eAAe,CAAC;AAQvB,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAO1E;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,6FAA6F;IAC7F,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC,CAAC;IAC7C,gEAAgE;IAChE,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxE,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,yCAAyC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B,EAAE,gBAAgB,CAAC,cAAc,EAAE,0BAA0B,CAAC;CAAG;AAM5I;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,gGA4M9B,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -5,48 +5,160 @@
|
|
|
5
5
|
* Iterates over `AIResponse.blocks` and dispatches each block to a renderer.
|
|
6
6
|
* Pure rendering — no layout wrapper, no business logic, no AIMessage chrome.
|
|
7
7
|
*
|
|
8
|
-
* **
|
|
9
|
-
*
|
|
8
|
+
* **Resolution order** (ADR-05 (2)), for each block, the first step that answers wins:
|
|
9
|
+
* 1. `renderBlock(block)`: a node renders, `null` skips the block, `undefined` falls through
|
|
10
|
+
* (`onRenderBlock` is its deprecated alias; `renderBlock` wins when both are passed);
|
|
11
|
+
* 2. `blockRenderers[block.type]`: a block renderer component (`null` skips the block);
|
|
12
|
+
* 3. the renderers a host provides (ChatThread and the other organisms; `null` skips the block);
|
|
13
|
+
* 4. the built-in renderer: `text` blocks render through `AITextBlock`;
|
|
14
|
+
* 5. nothing: the block is skipped, with one development warning per block type.
|
|
10
15
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* type is not `text`, the block is skipped with a console warning.
|
|
16
|
+
* Table, chart, image, form and actions blocks are consumer-rendered. The interactive blocks
|
|
17
|
+
* (query, clarification, plan-review) render through block renderers, which receive
|
|
18
|
+
* `onBlockEvent`, `readOnly` and `onActionError`.
|
|
15
19
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
+
* **Ids.** A block id comes from the model, so it is data, never a DOM id: each block's root
|
|
21
|
+
* carries `data-block-id={block.id}` and the DOM id `getBlockDomId(idPrefix, block.id)` (G-OD12).
|
|
22
|
+
* Equal ids inside one response still get their own React keys and DOM ids.
|
|
23
|
+
*
|
|
24
|
+
* **Sources.** The renderer provides the response's `sources` to its blocks, so a consumer table
|
|
25
|
+
* or chart renderer reads a cell's or point's sources with `useBlockSources(block.id)` (F-08).
|
|
26
|
+
* Text blocks with `citations: true` render their `[^id]` markers as source chips numbered by
|
|
27
|
+
* `response.sources` (F-13, G-37+). While `streaming`, a marker that names no source yet is
|
|
28
|
+
* hidden instead of shown as written; when the response completes the markers resolve in place.
|
|
29
|
+
*
|
|
30
|
+
* **Headings.** `headingOffset` moves markdown headings down (`#` becomes h2 with 1). It defaults
|
|
31
|
+
* to 1 inside a ChatThread, so a response's `#` is never the page's h1 there, and to 0 standalone.
|
|
32
|
+
*
|
|
33
|
+
* **Error** (G-34, G-OD8): `response.error` renders after the blocks as an inline error Alert
|
|
34
|
+
* titled 'This response failed' (`ai.responseRenderer.errorTitle`), with `error.message` as plain
|
|
35
|
+
* text. The Alert has no live role: standalone, the renderer announces the title and message
|
|
36
|
+
* once, assertively, through `useAnnounce`; inside a thread (InThreadContext) it announces
|
|
37
|
+
* nothing, because the thread's log reads the added content. Retry belongs to AIMessage's footer.
|
|
38
|
+
*
|
|
39
|
+
* **Isolation** (G-39+): each block renders inside its own error boundary. A block whose renderer
|
|
40
|
+
* throws shows 'This part of the response is unavailable' (`ai.responseRenderer.blockUnavailable`)
|
|
41
|
+
* in its place, read-only and not live, and `onBlockError` reports it; the other blocks and
|
|
42
|
+
* messages keep rendering. A text block whose `content` is not a string shows the same state.
|
|
43
|
+
*
|
|
44
|
+
* **Diagnostics** (development only, once each, from effects): a block type with no renderer, an
|
|
45
|
+
* interactive block without an id, repeated block ids, and a renderer whose identity changes on
|
|
46
|
+
* three commits in a row (define renderers at module scope or memoize them).
|
|
20
47
|
*
|
|
21
48
|
* @example
|
|
22
49
|
* ```tsx
|
|
23
50
|
* <AIResponseRenderer
|
|
24
51
|
* response={response}
|
|
25
|
-
*
|
|
52
|
+
* renderBlock={(block) => {
|
|
26
53
|
* if (block.type === 'chart') return <MyChart data={block.data} />;
|
|
27
|
-
* if (block.type === '
|
|
28
|
-
* return
|
|
54
|
+
* if (block.type === 'image') return null; // skip the block
|
|
55
|
+
* return undefined; // fall through to blockRenderers and the built-in text renderer
|
|
29
56
|
* }}
|
|
30
57
|
* />
|
|
58
|
+
*
|
|
59
|
+
* const blockRenderers = {
|
|
60
|
+
* table: ({ block, id }) => <MyTable id={id} data-block-id={block.id} rows={block.rows} />,
|
|
61
|
+
* } satisfies AIResponseRendererProps['blockRenderers'];
|
|
62
|
+
*
|
|
63
|
+
* <AIResponseRenderer response={response} blockRenderers={blockRenderers} />
|
|
31
64
|
* ```
|
|
32
65
|
*/
|
|
33
66
|
import React from 'react';
|
|
34
|
-
import {
|
|
67
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
68
|
+
import { type AIResponse, type AIResponseBlock } from './types/response';
|
|
69
|
+
import type { AIActionErrorContext, AIBlockEvent } from './types/hitl';
|
|
70
|
+
import { type AIBlockRendererMap } from './blockRendererContext';
|
|
35
71
|
/**
|
|
36
|
-
* Props for AIResponseRenderer component
|
|
72
|
+
* Props for AIResponseRenderer component: its own props plus the root `<div>`'s HTML
|
|
73
|
+
* attributes (ADR-04). The renderer owns no root attribute, so `className`, `id`, `data-*` and
|
|
74
|
+
* `aria-*` all reach the root.
|
|
37
75
|
*/
|
|
38
|
-
export interface AIResponseRendererProps {
|
|
76
|
+
export interface AIResponseRendererProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'> {
|
|
39
77
|
/** The AIResponse object to render */
|
|
40
78
|
response: AIResponse;
|
|
41
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Gap between blocks. A number is pixels (`blockGap={12}` is 12px); omit it to use theme
|
|
81
|
+
* spacing, `theme.spacing(aiSpacing.sm)` (8px in the default theme), which follows the theme's
|
|
82
|
+
* spacing and its presets. Values below 2 or with a fraction log a development warning: they
|
|
83
|
+
* are usually theme spacing units passed as pixels.
|
|
84
|
+
*/
|
|
42
85
|
blockGap?: number;
|
|
43
86
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
87
|
+
* Renders any block first (step 1 of the resolution order), text blocks included. Called for
|
|
88
|
+
* every block. Return a node to render it, `null` to skip it, or `undefined` to fall through to
|
|
89
|
+
* `blockRenderers`, a host's renderers and the built-in text renderer.
|
|
90
|
+
*
|
|
91
|
+
* @since 2.13.0
|
|
92
|
+
*/
|
|
93
|
+
renderBlock?: (block: AIResponseBlock) => React.ReactNode | null | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Use `renderBlock`, which takes the same function (or `blockRenderers` for one
|
|
96
|
+
* component per block type). Removed in v3.0. Passing it logs one development warning;
|
|
97
|
+
* `renderBlock` wins when both are passed.
|
|
48
98
|
*/
|
|
49
99
|
onRenderBlock?: (block: AIResponseBlock) => React.ReactNode | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Block renderers by block type (step 2 of the resolution order). Each receives
|
|
102
|
+
* `AIBlockRendererProps` for its own block type. An entry wins over a renderer a host provides;
|
|
103
|
+
* `null` skips that block type. Keep the object and its components stable (module scope or
|
|
104
|
+
* `useMemo`).
|
|
105
|
+
*
|
|
106
|
+
* @since 2.13.0
|
|
107
|
+
*/
|
|
108
|
+
blockRenderers?: AIBlockRendererMap;
|
|
109
|
+
/**
|
|
110
|
+
* Called with what the user did in an interactive block (`AIBlockEvent`). A returned promise
|
|
111
|
+
* drives the block's pending state, and its rejection the block's error.
|
|
112
|
+
*
|
|
113
|
+
* @since 2.13.0
|
|
114
|
+
*/
|
|
115
|
+
onBlockEvent?: (event: AIBlockEvent) => void | Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* The response is history: block renderers show content and recorded answers without controls.
|
|
118
|
+
* @default false
|
|
119
|
+
* @since 2.13.0
|
|
120
|
+
*/
|
|
121
|
+
readOnly?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Called when an action inside a block fails, with `{ source: 'block', blockId }`.
|
|
124
|
+
*
|
|
125
|
+
* @since 2.13.0
|
|
126
|
+
*/
|
|
127
|
+
onActionError?: (error: unknown, context: AIActionErrorContext) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Called when a block fails to render: its renderer threw, so the block shows a read-only
|
|
130
|
+
* 'unavailable' state while the other blocks keep rendering. Receives the error and the block's
|
|
131
|
+
* `id` and `type`.
|
|
132
|
+
*
|
|
133
|
+
* @since 2.13.0
|
|
134
|
+
*/
|
|
135
|
+
onBlockError?: (error: unknown, context: {
|
|
136
|
+
blockId?: string;
|
|
137
|
+
type: string;
|
|
138
|
+
}) => void;
|
|
139
|
+
/**
|
|
140
|
+
* Prefix of the blocks' DOM ids (`getBlockDomId(idPrefix, block.id)`). Defaults to the root's
|
|
141
|
+
* `id`, which is generated when you pass none.
|
|
142
|
+
*
|
|
143
|
+
* @since 2.13.0
|
|
144
|
+
*/
|
|
145
|
+
idPrefix?: string;
|
|
146
|
+
/**
|
|
147
|
+
* The response is still streaming in: a citation marker that names no source yet is hidden
|
|
148
|
+
* (it may be cut off or its source may not have arrived), not shown as written.
|
|
149
|
+
* @default false
|
|
150
|
+
* @since 2.13.0
|
|
151
|
+
*/
|
|
152
|
+
streaming?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Moves the markdown headings of text blocks down by this many levels (clamped at h6). Default:
|
|
155
|
+
* 1 inside a ChatThread (InThreadContext), so `#` renders as h2 under the page's h1; 0
|
|
156
|
+
* standalone.
|
|
157
|
+
* @since 2.13.0
|
|
158
|
+
*/
|
|
159
|
+
headingOffset?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
160
|
+
/** Styles for the root, applied after the renderer's own (object, function or array). */
|
|
161
|
+
sx?: SxProps<Theme>;
|
|
50
162
|
}
|
|
51
163
|
/**
|
|
52
164
|
* AIResponseRenderer - Iterates over AIResponse blocks and dispatches each
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIResponseRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIResponseRenderer.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AIResponseRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIResponseRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAQvE,OAAO,EAAyC,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAcxG;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClG,sCAAsC;IACtC,QAAQ,EAAE,UAAU,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7E;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACxE;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACxE;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACrF;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,yFAAyF;IACzF,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACrB;AA+HD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,gGAuF9B,CAAC;AAmIF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Context, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { AIResponseSource } from './types/response';
|
|
3
|
+
/** The key of a table cell: block id, row (rowKey value or 0-based index) and column key. */
|
|
4
|
+
export declare function cellKey(blockId: string, row: string | number, column: string): string;
|
|
5
|
+
/** The key of a chart point: block id, series `dataKey` and 0-based data index. */
|
|
6
|
+
export declare function pointKey(blockId: string, series: string, index: number): string;
|
|
7
|
+
/** The lookups of one `sources` array. Built once per array identity. */
|
|
8
|
+
export interface ResponseSourcesIndex {
|
|
9
|
+
/** The sources, as given. */
|
|
10
|
+
readonly sources: readonly AIResponseSource[];
|
|
11
|
+
/** Source id to its 1-based number. The first occurrence of a repeated id wins. */
|
|
12
|
+
readonly numberById: ReadonlyMap<string, number>;
|
|
13
|
+
/** Block id to the sources that list it in `blockIds`, in `sources` order. */
|
|
14
|
+
readonly byBlock: ReadonlyMap<string, readonly AIResponseSource[]>;
|
|
15
|
+
/** `cellKey(...)` to the sources whose `cellRefs` name that cell, in `sources` order. */
|
|
16
|
+
readonly byCell: ReadonlyMap<string, readonly AIResponseSource[]>;
|
|
17
|
+
/** `pointKey(...)` to the sources whose `pointRefs` name that point, in `sources` order. */
|
|
18
|
+
readonly byPoint: ReadonlyMap<string, readonly AIResponseSource[]>;
|
|
19
|
+
}
|
|
20
|
+
/** Builds every lookup in one pass over the sources and their refs (no rescans later). */
|
|
21
|
+
export declare function indexResponseSources(sources: readonly AIResponseSource[]): ResponseSourcesIndex;
|
|
22
|
+
/** What a query view registers: how to open itself and move focus to its trigger. */
|
|
23
|
+
export interface QueryRegistration {
|
|
24
|
+
reveal: () => void;
|
|
25
|
+
}
|
|
26
|
+
/** The registry of query views by `queryId`. One per provider, created once. */
|
|
27
|
+
export interface QueryRegistry {
|
|
28
|
+
/** Registers a query view. Returns the function that unregisters it (only that registration). */
|
|
29
|
+
registerQuery(queryId: string, registration: QueryRegistration): () => void;
|
|
30
|
+
/** Reveals the query with `queryId`. `false` when no view registered it. */
|
|
31
|
+
revealQuery(queryId: string): boolean;
|
|
32
|
+
/** Whether a view registered `queryId`. Read it through `useIsQueryRegistered` to re-render on changes. */
|
|
33
|
+
isQueryRegistered(queryId: string): boolean;
|
|
34
|
+
/** Subscribes to registrations and unregistrations (`useSyncExternalStore`). */
|
|
35
|
+
subscribe(listener: () => void): () => void;
|
|
36
|
+
}
|
|
37
|
+
/** Creates an empty query registry. */
|
|
38
|
+
export declare function createQueryRegistry(): QueryRegistry;
|
|
39
|
+
/** What `useResponseSources` returns inside a provider. Stable while `sources` and `unresolvedCitations` stay the same. */
|
|
40
|
+
export interface ResponseSourcesContextValue extends QueryRegistry {
|
|
41
|
+
/** The indexed sources. */
|
|
42
|
+
readonly index: ResponseSourcesIndex;
|
|
43
|
+
/** How text blocks render a citation marker that names no source: as written, or not at all (while streaming). */
|
|
44
|
+
readonly unresolvedCitations: 'literal' | 'hide';
|
|
45
|
+
/** The 1-based number of a source, `undefined` for an unknown id. */
|
|
46
|
+
getSourceNumber(sourceId: string): number | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The context behind `useResponseSources`. Created with `@__PURE__` and no other module-level
|
|
50
|
+
* statement, so bundles that never mount the provider drop it (OD-A3).
|
|
51
|
+
*
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
export declare const AIResponseSourcesContext: Context<ResponseSourcesContextValue | null>;
|
|
55
|
+
/** Props of {@link AIResponseSourcesProvider}. */
|
|
56
|
+
export interface AIResponseSourcesProviderProps {
|
|
57
|
+
/** The response's sources. Keep the array's identity while it does not change; append while streaming. */
|
|
58
|
+
sources?: readonly AIResponseSource[];
|
|
59
|
+
/** How text blocks render a citation marker that names no source. Default `'literal'`; G passes `'hide'` while streaming. */
|
|
60
|
+
unresolvedCitations?: 'literal' | 'hide';
|
|
61
|
+
children?: ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Provides a response's sources, their lookups and the query registry to the blocks inside it.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare function AIResponseSourcesProvider({ sources, unresolvedCitations, children }: AIResponseSourcesProviderProps): ReactElement;
|
|
69
|
+
/**
|
|
70
|
+
* The nearest response's sources, lookups and query registry; `null` outside an
|
|
71
|
+
* `AIResponseSourcesProvider`.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export declare function useResponseSources(): ResponseSourcesContextValue | null;
|
|
76
|
+
/**
|
|
77
|
+
* Whether a query view registered `queryId` in the nearest provider; re-renders when that
|
|
78
|
+
* changes. `false` outside a provider, during server rendering and for an undefined id.
|
|
79
|
+
*
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export declare function useIsQueryRegistered(queryId: string | undefined): boolean;
|
|
83
|
+
//# sourceMappingURL=AIResponseSourcesContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIResponseSourcesContext.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIResponseSourcesContext.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AASzD,6FAA6F;AAC7F,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAErF;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/E;AAED,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,6BAA6B;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC9C,mFAAmF;IACnF,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjD,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC,CAAC;IACnE,yFAAyF;IACzF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC,CAAC;IAClE,4FAA4F;IAC5F,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,gBAAgB,EAAE,CAAC,CAAC;CACpE;AAQD,0FAA0F;AAC1F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,oBAAoB,CAY/F;AAMD,qFAAqF;AACrF,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,iGAAiG;IACjG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAAC;IAC5E,4EAA4E;IAC5E,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,2GAA2G;IAC3G,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,gFAAgF;IAChF,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC7C;AAED,uCAAuC;AACvC,wBAAgB,mBAAmB,IAAI,aAAa,CA8BnD;AAMD,2HAA2H;AAC3H,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,kHAAkH;IAClH,QAAQ,CAAC,mBAAmB,EAAE,SAAS,GAAG,MAAM,CAAC;IACjD,qEAAqE;IACrE,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACvD;AAQD;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAGhF,CAAC;AAEF,kDAAkD;AAClD,MAAM,WAAW,8BAA8B;IAC7C,0GAA0G;IAC1G,OAAO,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACtC,6HAA6H;IAC7H,mBAAmB,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAaD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,OAAoB,EAAE,mBAA+B,EAAE,QAAQ,EAAE,EAAE,8BAA8B,GAAG,YAAY,CA6B3J;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,2BAA2B,GAAG,IAAI,CAEvE;AAKD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKzE"}
|