@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
|
@@ -1,48 +1,161 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview AIMessage component.
|
|
3
3
|
* @module components/AI/AIMessage
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* AIMessage: one assistant turn. An article with the assistant avatar, the response content
|
|
6
|
+
* (delegated to AIResponseRenderer, or the legacy `children`) and a footer with the timestamp
|
|
7
|
+
* and the actions. It does not detect block types, stream or hold business logic.
|
|
8
|
+
*
|
|
9
|
+
* Layout (G-11, ADR-05 (7), ADR-04 (6)):
|
|
10
|
+
*
|
|
11
|
+
* ```text
|
|
12
|
+
* [avatar] | content (response or children)
|
|
13
|
+
* | attachments <- `attachments` slot (sources, related questions)
|
|
14
|
+
* | [badges] [timestamp] [actions] <- footer: `badges` slot at its start (then the
|
|
15
|
+
* | golden badge once added); the actions
|
|
16
|
+
* | group holds Copy, the thumbs (or the
|
|
17
|
+
* | `feedbackControl` slot), Share, Download,
|
|
18
|
+
* | Regenerate, Add to golden dataset, then the
|
|
19
|
+
* | app's `actions`
|
|
20
|
+
* | (a failed Regenerate's or golden-dataset add's alert)
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Every slot is optional and renders nothing when unused; with no slot the DOM is the same as
|
|
24
|
+
* before 2.13.0. With a slot, the content column gets an inner `container-type: inline-size`
|
|
25
|
+
* wrapper (ADR-11 (5)) and below the `compact` container width the badges take their own row;
|
|
26
|
+
* the footer always wraps (no overflow menu).
|
|
27
|
+
*
|
|
28
|
+
* Block props (`renderBlock`, `blockRenderers`, `onBlockEvent`, `readOnly`, `onActionError`,
|
|
29
|
+
* `streaming`, `headingOffset`) are passed to AIResponseRenderer. AIMessage never reads
|
|
30
|
+
* `response.metadata`: a host (ChatThread) maps it to badges.
|
|
31
31
|
*
|
|
32
32
|
* @example
|
|
33
33
|
* ```tsx
|
|
34
34
|
* import { AIMessage } from '@trinityui/design-system';
|
|
35
35
|
*
|
|
36
|
-
* <AIMessage
|
|
36
|
+
* <AIMessage
|
|
37
|
+
* response={response}
|
|
38
|
+
* timestamp="10:42"
|
|
39
|
+
* onRegenerate={regenerate}
|
|
40
|
+
* badges={<AIConfidenceBadge level="high" />}
|
|
41
|
+
* attachments={<AISourcesPanel sources={sources} />}
|
|
42
|
+
* goldenDataset={{ canAdd: user.isDataScientist, onAdd: ({ messageId }) => addToGolden(messageId) }}
|
|
43
|
+
* actions={[{ id: 'flag', label: 'Flag for review', icon: 'flag', onClick: flag }]}
|
|
44
|
+
* />
|
|
37
45
|
* ```
|
|
38
46
|
*/
|
|
39
47
|
import React from 'react';
|
|
40
48
|
import { SxProps, Theme } from '@mui/material';
|
|
49
|
+
import { type TrinitySlotProps } from '../shared/rootProps';
|
|
50
|
+
import type { AIBlockRendererMap } from './blockRendererContext';
|
|
51
|
+
import type { IconName } from '../Icon';
|
|
41
52
|
import { type AIResponse, type AIResponseBlock } from './types';
|
|
53
|
+
import type { AIActionErrorContext, AIBlockEvent, AIFeedbackRating } from './types/hitl';
|
|
42
54
|
/**
|
|
43
|
-
*
|
|
55
|
+
* An app action in AIMessage's footer (G-11), such as 'Add to golden dataset'. It is data:
|
|
56
|
+
* AIMessage renders it as an icon button after the built-in actions, with the same markup,
|
|
57
|
+
* focus ring and target size. `AIActions` / `AISuggestedAction` are something else: follow-up
|
|
58
|
+
* suggestions shown in the conversation.
|
|
59
|
+
*
|
|
60
|
+
* - `label` is the button's name and its tooltip (one string, ADR-13 (3)).
|
|
61
|
+
* - `hidden` removes the action (for example, a role that may not use it).
|
|
62
|
+
* - `disabled` makes it `aria-disabled` (it keeps focus); `disabledReason` describes it
|
|
63
|
+
* (`aria-describedby`) and shows in the tooltip.
|
|
64
|
+
* - `pressed` makes it a toggle (`aria-pressed`).
|
|
65
|
+
* - `onClick` may return a promise: while it runs the action is `aria-busy` and ignores clicks; a
|
|
66
|
+
* rejection calls AIMessage's `onActionError` with `{ source: 'action', actionId: id }`.
|
|
67
|
+
*
|
|
68
|
+
* @since 2.13.0
|
|
69
|
+
*/
|
|
70
|
+
export interface AIMessageAction {
|
|
71
|
+
/** Stable id: the React key and the `actionId` of a failure. */
|
|
72
|
+
id: string;
|
|
73
|
+
/** The accessible name and the tooltip. */
|
|
74
|
+
label: string;
|
|
75
|
+
/** The glyph, an Icon name. Without one, the generic action glyph (`'zap'`) shows. */
|
|
76
|
+
icon?: IconName | (string & {});
|
|
77
|
+
/** Runs the action. A returned promise drives the pending state (ADR-07). */
|
|
78
|
+
onClick: (event: React.MouseEvent) => void | Promise<void>;
|
|
79
|
+
/** Unavailable: `aria-disabled`, clicks do nothing. */
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
/** Why it is unavailable; describes the button and shows in the tooltip. Implies `disabled`. */
|
|
82
|
+
disabledReason?: string;
|
|
83
|
+
/** Not rendered. */
|
|
84
|
+
hidden?: boolean;
|
|
85
|
+
/** A toggle's state: `aria-pressed`. Leave it out for an action that is not a toggle. */
|
|
86
|
+
pressed?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* What `goldenDataset.onAdd` receives: the message being added (GA-01).
|
|
90
|
+
*
|
|
91
|
+
* @since 2.13.0
|
|
44
92
|
*/
|
|
45
|
-
export interface
|
|
93
|
+
export interface AIMessageGoldenDatasetContext {
|
|
94
|
+
/** The message's id: `messageId`, else `response.id`. */
|
|
95
|
+
messageId?: string;
|
|
96
|
+
/** The message's response, when it renders one (not the `children` API). */
|
|
97
|
+
response?: AIResponse;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* AIMessage's built-in 'Add to golden dataset' action (GA-01, the owner's HITL spec: verified
|
|
101
|
+
* interactions enter the golden dataset through a permission-gated control).
|
|
102
|
+
*
|
|
103
|
+
* **Permission.** The action renders only when `canAdd` is true. The app decides who may add
|
|
104
|
+
* (for example, users with the data scientist role) and passes the result; the design system
|
|
105
|
+
* never decides roles. Without `canAdd` nothing renders, not even a disabled button.
|
|
106
|
+
*
|
|
107
|
+
* **States.** Idle: an icon button ('award', the golden badge's glyph) named and titled 'Add to
|
|
108
|
+
* golden dataset' (`ai.message.addToGolden`), a toggle (`aria-pressed="false"`). Pending: while
|
|
109
|
+
* the promise `onAdd` returns runs, `aria-busy` and `aria-disabled`, focus stays, and a second
|
|
110
|
+
* press does not call `onAdd` again (ADR-07). Added: pressed, `aria-disabled` and described by
|
|
111
|
+
* 'Added to golden dataset' (`ai.message.addedToGolden`), which is announced once, politely; the
|
|
112
|
+
* message shows the golden AIVerificationBadge with that label after its `badges`. Failed: "Couldn't
|
|
113
|
+
* add to the golden dataset" with Try again below the footer (announced once), and the error
|
|
114
|
+
* reaches `onActionError` with `{ source: 'action', actionId: 'golden' }`. While the message
|
|
115
|
+
* streams the action is unavailable, with the reason.
|
|
116
|
+
*
|
|
117
|
+
* **State ownership.** `added` controls the added state; without it AIMessage keeps its own,
|
|
118
|
+
* starting at `defaultAdded`, and sets it when `onAdd` resolves. The golden badge shows whenever
|
|
119
|
+
* the message is added, also to a user who may not add (the action is then not rendered).
|
|
120
|
+
*
|
|
121
|
+
* Each settled add reports `{ type: 'golden', action: 'add', success, messageId }` through
|
|
122
|
+
* AIConfigProvider's `onInteraction` (content-free).
|
|
123
|
+
*
|
|
124
|
+
* @since 2.13.0
|
|
125
|
+
*/
|
|
126
|
+
export interface AIMessageGoldenDataset {
|
|
127
|
+
/** Whether the current user may add this message: the app's permission check (for example the data scientist role). */
|
|
128
|
+
canAdd: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Adds the message to the golden dataset. Return your request's promise: it drives the pending
|
|
131
|
+
* state, its resolution the added state and its rejection the inline error.
|
|
132
|
+
*/
|
|
133
|
+
onAdd: (context: AIMessageGoldenDatasetContext) => void | Promise<void>;
|
|
134
|
+
/** Whether the message is in the golden dataset, controlled. */
|
|
135
|
+
added?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The initial added state when `added` is not controlled.
|
|
138
|
+
* @default false
|
|
139
|
+
*/
|
|
140
|
+
defaultAdded?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Shows the golden AIVerificationBadge ('Added to golden dataset') on an added message. Turn it
|
|
143
|
+
* off when the message's badges already show its golden state.
|
|
144
|
+
* @default true
|
|
145
|
+
*/
|
|
146
|
+
showBadge?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @internal — not part of the public API; see ADR-02. Where AIMessage's content column starts,
|
|
150
|
+
* from the message's inline start: the avatar column (AI_AVATAR_SIZE_PX.small) plus the gap
|
|
151
|
+
* (`aiSpacing.md`, in theme units, ADR-20). ChatThread aligns thread-level related questions and
|
|
152
|
+
* suggested actions to it (G-13).
|
|
153
|
+
*/
|
|
154
|
+
export declare function getMessageContentInset(theme: Theme): string;
|
|
155
|
+
/**
|
|
156
|
+
* AIMessage's own props. The root `<div>`'s HTML attributes are the rest (ADR-04 (3)).
|
|
157
|
+
*/
|
|
158
|
+
interface AIMessageOwnProps {
|
|
46
159
|
/**
|
|
47
160
|
* AIResponse object to render (preferred API)
|
|
48
161
|
* When provided, AIResponseRenderer is used automatically
|
|
@@ -55,7 +168,19 @@ export interface AIMessageProps {
|
|
|
55
168
|
children?: React.ReactNode;
|
|
56
169
|
/** Timestamp display */
|
|
57
170
|
timestamp?: string;
|
|
58
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* The message's id, carried by the interaction events this message reports through
|
|
173
|
+
* AIConfigProvider's `onInteraction` (copy, retry and the thumbs' feedback), so an application
|
|
174
|
+
* can join them with a later message send (G-26). Falls back to `response.id`. ChatThread
|
|
175
|
+
* passes each message's `id`.
|
|
176
|
+
* @since 2.13.0
|
|
177
|
+
*/
|
|
178
|
+
messageId?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Replaces the default AI avatar (a 32px AIAvatar). Make a custom avatar fill the 32px avatar
|
|
181
|
+
* column: thread-level items (related questions, suggested actions) align to the content
|
|
182
|
+
* column after it.
|
|
183
|
+
*/
|
|
59
184
|
avatar?: React.ReactNode;
|
|
60
185
|
/** Show copy button */
|
|
61
186
|
showCopy?: boolean;
|
|
@@ -65,29 +190,199 @@ export interface AIMessageProps {
|
|
|
65
190
|
showShare?: boolean;
|
|
66
191
|
/** Show download button */
|
|
67
192
|
showDownload?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Called with the copied text. With `copyBehavior` `'auto'` (the default), passing it makes
|
|
195
|
+
* Copy callback-only, as before 2.13.0; `'both'` calls it after the clipboard write settles.
|
|
196
|
+
* A `() => void` handler still fits. Not the DOM `onCopy` clipboard event: the root does not
|
|
197
|
+
* take that one (ADR-04 (3)).
|
|
198
|
+
*/
|
|
199
|
+
onCopy?: (text: string) => void;
|
|
200
|
+
/**
|
|
201
|
+
* What Copy does (ADR-13 (2)):
|
|
202
|
+
* - `'auto'`: with `onCopy`, calls it only; without, writes the text to the clipboard and
|
|
203
|
+
* announces 'Copied' or "Couldn't copy".
|
|
204
|
+
* - `'clipboard'`: always writes (and announces); `onCopy` is not called.
|
|
205
|
+
* - `'callback'`: only calls `onCopy(text)`; nothing is written.
|
|
206
|
+
* - `'both'`: writes, then calls `onCopy(text)` once the write settles.
|
|
207
|
+
* @default 'auto'
|
|
208
|
+
* @since 2.13.0
|
|
209
|
+
*/
|
|
210
|
+
copyBehavior?: 'auto' | 'clipboard' | 'callback' | 'both';
|
|
211
|
+
/**
|
|
212
|
+
* The text Copy uses. Without it: the response as plain text (markdown removed, query blocks
|
|
213
|
+
* fenced), or for the `children` API the text of the `[data-copy-root]` element inside the
|
|
214
|
+
* content (else the whole content), without `aria-hidden` and visually hidden parts.
|
|
215
|
+
* @since 2.13.0
|
|
216
|
+
*/
|
|
217
|
+
copyText?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Called with the new rating when a thumb is pressed: `true` for good, `false` for poor.
|
|
220
|
+
* Pressing the pressed thumb again clears the rating and does not call it (see
|
|
221
|
+
* `onFeedbackChange`).
|
|
222
|
+
*/
|
|
71
223
|
onFeedback?: (positive: boolean) => void;
|
|
224
|
+
/**
|
|
225
|
+
* The rating, controlled: `'positive'`, `'negative'` or `null` (none). The thumbs show it
|
|
226
|
+
* pressed (`aria-pressed`) and change only when the parent passes a new value.
|
|
227
|
+
* @since 2.13.0
|
|
228
|
+
*/
|
|
229
|
+
feedback?: AIFeedbackRating | null;
|
|
230
|
+
/**
|
|
231
|
+
* The initial rating when `feedback` is not controlled.
|
|
232
|
+
* @default null
|
|
233
|
+
* @since 2.13.0
|
|
234
|
+
*/
|
|
235
|
+
defaultFeedback?: AIFeedbackRating | null;
|
|
236
|
+
/**
|
|
237
|
+
* Called with every rating change, `null` when the pressed thumb is pressed again. Runs after
|
|
238
|
+
* `onFeedback`.
|
|
239
|
+
* @since 2.13.0
|
|
240
|
+
*/
|
|
241
|
+
onFeedbackChange?: (value: AIFeedbackRating | null) => void;
|
|
72
242
|
/** Share callback */
|
|
73
243
|
onShare?: () => void;
|
|
74
244
|
/** Download callback */
|
|
75
245
|
onDownload?: () => void;
|
|
76
246
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
247
|
+
* Regenerates the response. When passed, the footer shows a Regenerate action. It may return a
|
|
248
|
+
* promise: while it runs, Regenerate is `aria-disabled` and `aria-busy` and keeps focus; a
|
|
249
|
+
* rejection shows "Couldn't regenerate the response" with a "Try again" button below the footer
|
|
250
|
+
* and calls `onActionError`.
|
|
251
|
+
* @since 2.13.0
|
|
252
|
+
*/
|
|
253
|
+
onRegenerate?: () => void | Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* The built-in 'Add to golden dataset' action (GA-01), shown only when `canAdd` is true: the app
|
|
256
|
+
* decides who may add, the design system never decides roles. See {@link AIMessageGoldenDataset}.
|
|
257
|
+
* @since 2.13.0
|
|
258
|
+
*/
|
|
259
|
+
goldenDataset?: AIMessageGoldenDataset;
|
|
260
|
+
/**
|
|
261
|
+
* Called when an action fails: Regenerate (`{ source: 'action', actionId: 'regenerate' }`), the
|
|
262
|
+
* clipboard write of Copy (`actionId: 'copy'`), Add to golden dataset (`actionId: 'golden'`), an
|
|
263
|
+
* app action (`actionId` is its `id`) or an action inside a block (passed to
|
|
264
|
+
* `AIResponseRenderer`, `{ source: 'block', blockId }`).
|
|
265
|
+
* Without it, the error goes to `globalThis.reportError`.
|
|
266
|
+
* @since 2.13.0
|
|
267
|
+
*/
|
|
268
|
+
onActionError?: (error: unknown, context: AIActionErrorContext) => void;
|
|
269
|
+
/**
|
|
270
|
+
* Whether this message is still being streamed in. While it streams, the article is
|
|
271
|
+
* `aria-busy` and, per `liveRegion`, the content is a polite live region. Set it to false (the
|
|
272
|
+
* default) for complete and historical messages. While streaming, Copy and Regenerate are
|
|
273
|
+
* unavailable (aria-disabled, with the reason as their description). Streaming with no content
|
|
274
|
+
* yet (no response block with content, and no children or an empty string) shows a decorative
|
|
275
|
+
* AIShimmer placeholder (`aria-hidden`, never announced; ADR-08 (3)), so a host can render a
|
|
276
|
+
* typing entry as `<AIMessage streaming />`.
|
|
81
277
|
*/
|
|
82
278
|
streaming?: boolean;
|
|
83
279
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
280
|
+
* How the streaming content is announced (G-06, ADR-19):
|
|
281
|
+
* - `'auto'`: standalone, the content is `aria-live="polite"` while `streaming`; inside a
|
|
282
|
+
* ChatThread it is never live, because the thread's log reads the message and announces
|
|
283
|
+
* 'Response ready' when it completes.
|
|
284
|
+
* - `'polite'`: the content is `aria-live="polite"` while `streaming`, also inside a thread.
|
|
285
|
+
* - `'off'`: the content is never live.
|
|
286
|
+
* When the message is not streaming, the content has no `aria-live` attribute.
|
|
287
|
+
* @default 'auto'
|
|
288
|
+
* @since 2.13.0
|
|
289
|
+
*/
|
|
290
|
+
liveRegion?: 'auto' | 'off' | 'polite';
|
|
291
|
+
/**
|
|
292
|
+
* Moves the response's markdown headings down by this many levels, passed to
|
|
293
|
+
* AIResponseRenderer. Default: 1 inside a ChatThread, 0 standalone.
|
|
294
|
+
* @since 2.13.0
|
|
295
|
+
*/
|
|
296
|
+
headingOffset?: 0 | 1 | 2 | 3 | 4 | 5;
|
|
297
|
+
/**
|
|
298
|
+
* Renders any block first, passed to `AIResponseRenderer` (step 1 of its resolution order):
|
|
299
|
+
* return a node to render the block, `null` to skip it, or `undefined` to fall through to the
|
|
300
|
+
* block renderers and the built-in text renderer. Ignored with the `children` API.
|
|
301
|
+
* @since 2.13.0
|
|
302
|
+
*/
|
|
303
|
+
renderBlock?: (block: AIResponseBlock) => React.ReactNode | null | undefined;
|
|
304
|
+
/**
|
|
305
|
+
* @deprecated Use `renderBlock`, which takes the same function. Removed in v3.0. Passing it
|
|
306
|
+
* logs one development warning; `renderBlock` wins when both are passed.
|
|
87
307
|
*/
|
|
88
308
|
onRenderBlock?: (block: AIResponseBlock) => React.ReactNode | undefined;
|
|
89
|
-
/**
|
|
309
|
+
/**
|
|
310
|
+
* Block renderers by block type, passed to `AIResponseRenderer` (step 2 of its resolution
|
|
311
|
+
* order). Keep the object stable (module scope or `useMemo`). Ignored with the `children` API.
|
|
312
|
+
* @since 2.13.0
|
|
313
|
+
*/
|
|
314
|
+
blockRenderers?: AIBlockRendererMap;
|
|
315
|
+
/**
|
|
316
|
+
* Called with what the user did in an interactive block, passed to `AIResponseRenderer`. A
|
|
317
|
+
* returned promise drives the block's pending state, and its rejection the block's error.
|
|
318
|
+
* @since 2.13.0
|
|
319
|
+
*/
|
|
320
|
+
onBlockEvent?: (event: AIBlockEvent) => void | Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* The response is history: block renderers show content and recorded answers without
|
|
323
|
+
* controls. Passed to `AIResponseRenderer`.
|
|
324
|
+
* @default false
|
|
325
|
+
* @since 2.13.0
|
|
326
|
+
*/
|
|
327
|
+
readOnly?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* Non-interactive content at the footer's start, before the timestamp: AIConfidenceBadge,
|
|
330
|
+
* AIVerificationBadge. Keep it non-interactive; put actions in `actions`.
|
|
331
|
+
* @since 2.13.0
|
|
332
|
+
*/
|
|
333
|
+
badges?: React.ReactNode;
|
|
334
|
+
/**
|
|
335
|
+
* Replaces the built-in thumbs, for example with a detailed AIFeedbackControl (G-OD1). It
|
|
336
|
+
* renders in the thumbs' place in the actions group, also when `showFeedback` is false. Not to
|
|
337
|
+
* be confused with `slotProps.feedbackControl`, which styles the built-in thumbs.
|
|
338
|
+
* @since 2.13.0
|
|
339
|
+
*/
|
|
340
|
+
feedbackControl?: React.ReactNode;
|
|
341
|
+
/**
|
|
342
|
+
* Content below the response, inside the content column (aligned with the text, not the
|
|
343
|
+
* avatar): AISourcesPanel, AIRelatedQuestions, AIChainOfThought reasoning. A message with only
|
|
344
|
+
* attachments renders.
|
|
345
|
+
* @since 2.13.0
|
|
346
|
+
*/
|
|
347
|
+
attachments?: React.ReactNode;
|
|
348
|
+
/**
|
|
349
|
+
* App actions after the built-in ones, in the same actions group (see {@link AIMessageAction}).
|
|
350
|
+
* @since 2.13.0
|
|
351
|
+
*/
|
|
352
|
+
actions?: AIMessageAction[];
|
|
353
|
+
/** Added to the root's own class names. @since 2.13.0 */
|
|
354
|
+
className?: string;
|
|
355
|
+
/** Custom sx props, applied after the root's own styles (object, array or function form). */
|
|
90
356
|
sx?: SxProps<Theme>;
|
|
357
|
+
/**
|
|
358
|
+
* Props for the parts (ADR-04 (6)): `avatar` (the avatar column), `content` (the response
|
|
359
|
+
* content; its live attributes stay the component's), `footer` (the timestamp and
|
|
360
|
+
* actions row), `feedbackControl` (the root of the built-in thumbs, an AIFeedbackControl
|
|
361
|
+
* in simple mode; its group role stays its own), `badges` (the box around `badges`),
|
|
362
|
+
* `actions` (the actions group; its group role stays its own) and `attachments` (the box
|
|
363
|
+
* around `attachments`).
|
|
364
|
+
* @since 2.13.0
|
|
365
|
+
*/
|
|
366
|
+
slotProps?: {
|
|
367
|
+
avatar?: TrinitySlotProps<HTMLDivElement>;
|
|
368
|
+
content?: TrinitySlotProps<HTMLDivElement>;
|
|
369
|
+
footer?: TrinitySlotProps<HTMLDivElement>;
|
|
370
|
+
feedbackControl?: TrinitySlotProps<HTMLDivElement>;
|
|
371
|
+
badges?: TrinitySlotProps<HTMLDivElement>;
|
|
372
|
+
actions?: TrinitySlotProps<HTMLDivElement>;
|
|
373
|
+
attachments?: TrinitySlotProps<HTMLDivElement>;
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Props for AIMessage component: its own props plus the root `<div>`'s HTML attributes
|
|
378
|
+
* (`data-*`, `aria-*`, `id`, event handlers), spread on the root. `role`, `aria-live`,
|
|
379
|
+
* `aria-busy`, `aria-relevant`, `aria-atomic` and `aria-modal` stay the component's (ADR-04).
|
|
380
|
+
*
|
|
381
|
+
* The root is an article (`role="article"`, G-06) named 'Assistant response', or 'Assistant
|
|
382
|
+
* response, <timestamp>' when a timestamp shows (`ai.message.assistantResponse`,
|
|
383
|
+
* `assistantResponseAt`); a consumer `aria-label` replaces the name.
|
|
384
|
+
*/
|
|
385
|
+
export interface AIMessageProps extends AIMessageOwnProps, Omit<React.HTMLAttributes<HTMLDivElement>, keyof AIMessageOwnProps | 'color'> {
|
|
91
386
|
}
|
|
92
387
|
/**
|
|
93
388
|
* AIMessage - Visual wrapper for AI responses.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIMessage.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIMessage.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"AIMessage.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIMessage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO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E,KAAK,CAAC,SAAS,CAAC;IACzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;;OAGG;IACH,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6FAA6F;IAC7F,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE;QACV,MAAM,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC1C,eAAe,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACnD,MAAM,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC1C,OAAO,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAC3C,WAAW,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;KAChD,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cACf,SAAQ,iBAAiB,EACvB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAAC;CAAG;AAoGpF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,uFAodpB,CAAC;AAEH,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview AIPlanReview: the plan the AI proposes before it runs a query, for the user to
|
|
3
|
+
* review, correct and confirm (master-plan G-18, G-43+; requirements R1-R10).
|
|
4
|
+
* @module components/AI/AIPlanReview
|
|
5
|
+
*
|
|
6
|
+
* A thin composition (BEHAVIOR_CONTRACT section 2) of AIContainer (without its title), StepList,
|
|
7
|
+
* StepStatusMarker, MetaChip, InlineEditableText, Disclosure and KeyValueList (D blocks),
|
|
8
|
+
* AIConfidenceBadge and the embedded AIClarificationPrompt (F molecules), Modal (C), and B's
|
|
9
|
+
* `useAsyncAction`, `useFocusOnReplace`, `useDisclosure` and `AsyncOutcomeAlert`, and G-12's
|
|
10
|
+
* `useBlockReadyAnnouncement`.
|
|
11
|
+
* The keyboard and focus model is keyboard-models.md, "G flow (b): AIPlanReview inline and dialog".
|
|
12
|
+
*
|
|
13
|
+
* - **Steps.** An ordered list (StepList, `marker="number"`): the ordinal is visible and hidden
|
|
14
|
+
* from assistive technology, the `<ol>` exposes the position. Each step's meta holds
|
|
15
|
+
* StepStatusMarker's icon plus the status as visible text (G-43+, ADR-33), so the ordinal, the
|
|
16
|
+
* icon and the text all show. Chips read 'Metric: …', 'Field: …', 'Period: …' and one per
|
|
17
|
+
* filter, from `ai.planReview` functions (nothing is concatenated). AIConfidenceBadge shows
|
|
18
|
+
* each step's confidence against `thresholds`, else the provider's.
|
|
19
|
+
* - **Edit.** A step with `editable: true` has an 'Edit' button named 'Edit step N' (the name
|
|
20
|
+
* starts with the visible label, WCAG 2.5.3) and described by the step text. It opens
|
|
21
|
+
* InlineEditableText: Enter commits through `onStepEdit` (pending, failure and focus return
|
|
22
|
+
* are the block's), Escape discards, an empty step is invalid.
|
|
23
|
+
* - **Clarifications.** A step's `clarification` renders an embedded AIClarificationPrompt. Its
|
|
24
|
+
* answers are `clarificationAnswers` (controlled) or `defaultClarificationAnswers`.
|
|
25
|
+
* `onClarificationChange(stepId, answer)` fires when an answer is committed: a single choice
|
|
26
|
+
* on change; several choices or typed text when focus leaves the question. It fires at most
|
|
27
|
+
* once per distinct answer.
|
|
28
|
+
* - **Low confidence (G-43+).** The backend rule in the hitl.ts header: a step below the medium
|
|
29
|
+
* threshold carries `clarification: { reason: 'low-confidence' }`. A development warning names
|
|
30
|
+
* a below-threshold step without one; it still never blocks Confirm.
|
|
31
|
+
* - **Gating (deadlock-free).** A step blocks Confirm only when the user can resolve it: an
|
|
32
|
+
* unanswered clarification on a 'needs-input' step (answer it), or a 'needs-input' step with
|
|
33
|
+
* `editable: true` and no clarification (edit it). Streaming, a 'replanning' plan and a
|
|
34
|
+
* 'replanning' step block too, and clear when the data arrives. Low confidence alone shows a
|
|
35
|
+
* warning (the `confidence.low` role, text plus icon) and never blocks. A 'needs-input' step
|
|
36
|
+
* with nothing to resolve does not block; a development warning names the data problem.
|
|
37
|
+
* Confirm is `aria-disabled`, never `disabled`, with the visible reason linked through
|
|
38
|
+
* `aria-describedby`.
|
|
39
|
+
* - **Replans (G-02).** Edited step ids accumulate per `plan.id` across revisions, so
|
|
40
|
+
* `AIPlanConfirmEvent.edited` counts edits made before a replan. Edit drafts and clarification
|
|
41
|
+
* drafts reset on a new `(plan.id, revision)`. If the focused control leaves the document with a
|
|
42
|
+
* replan, focus goes to the step's edit button, else to the heading (`useFocusOnReplace`).
|
|
43
|
+
* - **Confirm and cancel** run through `useAsyncAction`. Confirm pending: `aria-busy`, focus
|
|
44
|
+
* stays. Success: the resolved summary (`tabIndex -1`) replaces the controls and takes focus.
|
|
45
|
+
* Failure: AsyncOutcomeAlert (no live role of its own) with Try again; focus stays on Confirm.
|
|
46
|
+
* Cancel success: the plan reads 'Plan cancelled.' and focus goes to the heading.
|
|
47
|
+
* - **States.** `streaming`: placeholder rows and every control `aria-disabled`, no announcement;
|
|
48
|
+
* when streaming ends the plan announces "Plan's ready — needs your confirmation" once.
|
|
49
|
+
* `readOnly` (the review queue and history): no controls. Plan status 'replanning',
|
|
50
|
+
* 'superseded' and 'cancelled' are read-only with text and an icon; 'confirmed' and 'running'
|
|
51
|
+
* show the resolved summary.
|
|
52
|
+
* - **Dialog presentation.** A card with the heading, the step count and a 'Review plan'
|
|
53
|
+
* trigger (`useDisclosure` popup) that opens Modal with `pendingClosePolicy="block"`: Escape,
|
|
54
|
+
* the backdrop and the close button do nothing while the confirm is pending. Closing returns
|
|
55
|
+
* focus to the trigger; after a confirm the summary replaces the trigger and takes focus.
|
|
56
|
+
* - **Design.** Resolver colors only (ADR-26), logical properties, a container-query wrapper
|
|
57
|
+
* inside the root (the footer stacks below the `compact` container width; the ref stays on the
|
|
58
|
+
* root), 24px targets, forced-colors outlines, placeholders still under reduced motion.
|
|
59
|
+
* - **Telemetry (G-26).** `AIPlanInteraction` for step_edit, confirm, cancel and clarify: ids,
|
|
60
|
+
* counts and flags only, never the step text or the answer.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* <AIPlanReview
|
|
65
|
+
* plan={plan}
|
|
66
|
+
* onStepEdit={(stepId, text) => api.editStep(plan.id, stepId, text)}
|
|
67
|
+
* onClarificationChange={(stepId, answer) => api.clarify(plan.id, stepId, answer)}
|
|
68
|
+
* onConfirm={({ plan, edited }) => api.run(plan, { edited })}
|
|
69
|
+
* onCancel={() => api.cancel(plan.id)}
|
|
70
|
+
* />
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
import * as React from 'react';
|
|
74
|
+
import { type SxProps, type Theme } from '@mui/material/styles';
|
|
75
|
+
import { type OpenChangeReason } from '../../hooks/useDisclosure';
|
|
76
|
+
import { type HeadingLevel } from '../shared/headingLevel';
|
|
77
|
+
import { type TrinitySlotProps } from '../shared/rootProps';
|
|
78
|
+
import type { AIActionErrorContext, AIClarificationAnswer, AIConfidenceThresholds, AIPlan } from './types/hitl';
|
|
79
|
+
/**
|
|
80
|
+
* Why the dialog presentation opened or closed: `useDisclosure`'s reasons ('trigger' for the
|
|
81
|
+
* 'Review plan' trigger and the dialog's close button, 'escape', 'clickAway' for the backdrop,
|
|
82
|
+
* 'programmatic'), plus 'confirmed' and 'cancelled' when a confirm or a cancel closes it.
|
|
83
|
+
*
|
|
84
|
+
* @since 2.13.0
|
|
85
|
+
*/
|
|
86
|
+
export type AIPlanReviewOpenChangeReason = OpenChangeReason | 'confirmed' | 'cancelled';
|
|
87
|
+
/**
|
|
88
|
+
* What `onConfirm` receives: the plan as confirmed, with the user's step edits applied, and what
|
|
89
|
+
* the user changed. AIPlanReview's own callback type; the block event `plan.confirm` carries the
|
|
90
|
+
* same fields.
|
|
91
|
+
*
|
|
92
|
+
* @since 2.13.0
|
|
93
|
+
*/
|
|
94
|
+
export interface AIPlanConfirmEvent {
|
|
95
|
+
/** The plan as confirmed: edited steps carry the new text and status 'edited'. */
|
|
96
|
+
plan: AIPlan;
|
|
97
|
+
/** Whether any step of the plan was edited, across its revisions. */
|
|
98
|
+
edited: boolean;
|
|
99
|
+
/** Ids of the edited steps, across the plan's revisions; empty when none was. */
|
|
100
|
+
editedStepIds: string[];
|
|
101
|
+
/** The answers to the steps' clarifications, by step id; empty when there are none. */
|
|
102
|
+
clarificationAnswers: Record<string, AIClarificationAnswer>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Props of {@link AIPlanReview}. The rest props reach the root `<div>`.
|
|
106
|
+
*
|
|
107
|
+
* @since 2.13.0
|
|
108
|
+
*/
|
|
109
|
+
export interface AIPlanReviewProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'title' | 'onChange' | 'defaultValue'> {
|
|
110
|
+
/** The plan to review. Replanning keeps `id` and increments `revision`. */
|
|
111
|
+
plan: AIPlan;
|
|
112
|
+
/**
|
|
113
|
+
* `'inline'` shows the plan in place; `'dialog'` shows a card that opens the plan in a dialog.
|
|
114
|
+
* @default 'inline'
|
|
115
|
+
*/
|
|
116
|
+
presentation?: 'inline' | 'dialog';
|
|
117
|
+
/** The dialog presentation's open state, controlled. */
|
|
118
|
+
open?: boolean;
|
|
119
|
+
/** The dialog presentation's first open state, uncontrolled. @default false */
|
|
120
|
+
defaultOpen?: boolean;
|
|
121
|
+
/** Called when the dialog presentation asks to open or close. */
|
|
122
|
+
onOpenChange?(open: boolean, reason: AIPlanReviewOpenChangeReason, event?: React.SyntheticEvent | Event): void;
|
|
123
|
+
/** No controls: for the review queue and history. */
|
|
124
|
+
readOnly?: boolean;
|
|
125
|
+
/** The plan is still streaming: placeholder rows and every control unavailable. */
|
|
126
|
+
streaming?: boolean;
|
|
127
|
+
/** Replaces the resolved summary after a confirm (`ai.planReview.resolved`). */
|
|
128
|
+
summary?: React.ReactNode;
|
|
129
|
+
/** The steps' clarification answers by step id, controlled. */
|
|
130
|
+
clarificationAnswers?: Record<string, AIClarificationAnswer>;
|
|
131
|
+
/** The first clarification answers by step id, uncontrolled. */
|
|
132
|
+
defaultClarificationAnswers?: Record<string, AIClarificationAnswer>;
|
|
133
|
+
/** Called when the user commits an answer to a step's clarification. */
|
|
134
|
+
onClarificationChange?(stepId: string, answer: AIClarificationAnswer): void;
|
|
135
|
+
/** Saves a step's new text. A returned promise shows the pending state, and its rejection the error. */
|
|
136
|
+
onStepEdit?(stepId: string, text: string): void | Promise<void>;
|
|
137
|
+
/** Confirms the plan. A returned promise shows the pending state, and its rejection the error. */
|
|
138
|
+
onConfirm?(event: AIPlanConfirmEvent): void | Promise<void>;
|
|
139
|
+
/** Cancels the plan. A returned promise shows the pending state, and its rejection the error. */
|
|
140
|
+
onCancel?(): void | Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Called with the error of a failed confirm (`source: 'confirm'`), step edit or cancel
|
|
143
|
+
* (`source: 'block'` with `blockId`, else `'action'` with `actionId` 'step-edit' or 'cancel').
|
|
144
|
+
*/
|
|
145
|
+
onActionError?(error: unknown, context: AIActionErrorContext): void;
|
|
146
|
+
/** Confidence bands for the steps; else the provider's, else the defaults. */
|
|
147
|
+
thresholds?: Partial<AIConfidenceThresholds>;
|
|
148
|
+
/** Opens the details disclosure (the steps' confidence rationale) on mount. @default false */
|
|
149
|
+
detailsDefaultExpanded?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Heading level of the plan's heading (inline) or the card's heading (dialog).
|
|
152
|
+
* @default 3
|
|
153
|
+
*/
|
|
154
|
+
headingLevel?: HeadingLevel;
|
|
155
|
+
/** @default 'medium' */
|
|
156
|
+
size?: 'small' | 'medium';
|
|
157
|
+
/** Replaces the confirm button's text (`ai.planReview.confirm`). */
|
|
158
|
+
confirmLabel?: string;
|
|
159
|
+
/** Replaces the cancel button's text (`ai.planReview.cancel`). */
|
|
160
|
+
cancelLabel?: string;
|
|
161
|
+
/** Replaces the note above the buttons (`ai.planReview.gatingNote`). */
|
|
162
|
+
gatingNote?: string;
|
|
163
|
+
/** Id of the response block that holds the plan, reported in telemetry and error contexts. */
|
|
164
|
+
blockId?: string;
|
|
165
|
+
className?: string;
|
|
166
|
+
sx?: SxProps<Theme>;
|
|
167
|
+
slotProps?: {
|
|
168
|
+
/** The heading row: the heading, the revision and the question. */
|
|
169
|
+
header?: TrinitySlotProps<HTMLDivElement>;
|
|
170
|
+
/** The steps' list (`<ol>`). */
|
|
171
|
+
steps?: TrinitySlotProps<HTMLOListElement>;
|
|
172
|
+
/** Every step (`<li>`). */
|
|
173
|
+
step?: TrinitySlotProps<HTMLLIElement>;
|
|
174
|
+
/** The row with the reason, the note and the buttons. */
|
|
175
|
+
footer?: TrinitySlotProps<HTMLDivElement>;
|
|
176
|
+
/** The details disclosure. */
|
|
177
|
+
details?: TrinitySlotProps<HTMLDivElement>;
|
|
178
|
+
/** The dialog surface in the dialog presentation. */
|
|
179
|
+
dialog?: TrinitySlotProps<HTMLDivElement>;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The plan the AI proposes before it answers: steps with status, confidence and chips, inline
|
|
184
|
+
* edit, embedded clarifications, deadlock-free gating, and an async confirm. See the module notes.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```tsx
|
|
188
|
+
* <AIPlanReview plan={plan} onConfirm={({ plan }) => runPlan(plan)} />
|
|
189
|
+
* ```
|
|
190
|
+
*
|
|
191
|
+
* @since 2.13.0
|
|
192
|
+
*/
|
|
193
|
+
export declare const AIPlanReview: React.ForwardRefExoticComponent<AIPlanReviewProps & React.RefAttributes<HTMLDivElement>>;
|
|
194
|
+
//# sourceMappingURL=AIPlanReview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIPlanReview.d.ts","sourceRoot":"","sources":["../../../src/components/AI/AIPlanReview.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAY,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAK1E,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAcjF,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAG7E,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AASnF,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,MAAM,EAGP,MAAM,cAAc,CAAC;AAItB;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,kFAAkF;IAClF,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;IAChB,iFAAiF;IACjF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uFAAuF;IACvF,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CAC7D;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IACpI,2EA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