@trinityui/design-system 2.11.0 → 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 +2209 -0
- package/CONTRIBUTING.md +180 -69
- package/LICENSE +21 -0
- package/MIGRATION.md +523 -21
- 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 +17230 -9097
- 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 +192 -72
- package/dist/components/AI/AIChainOfThought.d.ts.map +1 -1
- package/dist/components/AI/AIChainOfThought.types.d.ts +296 -34
- 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 +91 -13
- 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 +107 -17
- 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 +52 -5
- 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 +32 -2
- 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/SandboxedIframeRenderer/SandboxedIframeRenderer.d.ts +48 -4
- package/dist/components/SandboxedIframeRenderer/SandboxedIframeRenderer.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 +136 -0
- package/dist/components/shared/safeContent.d.ts.map +1 -0
- 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 +792 -0
- 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,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Internal storage store: an external store over localStorage or sessionStorage
|
|
3
|
+
* for `useSyncExternalStore` (B-55, ADR-35-R6, ADR-27 (1)).
|
|
4
|
+
* @module hooks/storageStore
|
|
5
|
+
*
|
|
6
|
+
* @internal Not part of the public API (ADR-02, ADR-35). It is not re-exported from
|
|
7
|
+
* `src/hooks.ts`, `src/index.ts` or any other entry; `useLocalStorage` and components import it
|
|
8
|
+
* from this file directly.
|
|
9
|
+
*
|
|
10
|
+
* Why a store: reading `window.localStorage` while rendering makes the server render (no storage)
|
|
11
|
+
* and the hydration render disagree. `useSyncExternalStore` renders the server snapshot during
|
|
12
|
+
* hydration and the client snapshot straight after it, and a client-only mount reads the client
|
|
13
|
+
* snapshot on its first render.
|
|
14
|
+
*
|
|
15
|
+
* The rules:
|
|
16
|
+
* - There is one store per storage area and key: `createStorageStore` returns the same object
|
|
17
|
+
* for the same pair, so every caller shares the snapshot cache and the listeners. A write
|
|
18
|
+
* through one caller re-renders every other caller in the same tab.
|
|
19
|
+
* - `getSnapshot` returns the parsed JSON value, or `undefined` when nothing usable is stored:
|
|
20
|
+
* no item, the storage is unavailable, or the text is not JSON (warned once per text). The
|
|
21
|
+
* result is cached by the raw text, so the reference stays the same until the text changes.
|
|
22
|
+
* - `getServerSnapshot` is always `undefined`: the server has no storage. Callers map
|
|
23
|
+
* `undefined` to their initial value.
|
|
24
|
+
* - Other tabs reach it through the window `storage` event, including `clear()` (key `null`).
|
|
25
|
+
* - When a write fails (quota, a blocked storage), the value still changes for this page: the
|
|
26
|
+
* store keeps the text in memory until the next successful write or storage event, and warns.
|
|
27
|
+
*/
|
|
28
|
+
/** @internal The browser storage a store reads. */
|
|
29
|
+
export type StorageArea = 'local' | 'session';
|
|
30
|
+
/** @internal The store `createStorageStore` returns; the shape `useSyncExternalStore` needs. */
|
|
31
|
+
export interface StorageStore<T> {
|
|
32
|
+
/** Adds a listener for writes from this tab and from other tabs. Returns the unsubscribe. */
|
|
33
|
+
subscribe: (onChange: () => void) => () => void;
|
|
34
|
+
/** The parsed value, or `undefined` when nothing usable is stored. Stable until the text changes. */
|
|
35
|
+
getSnapshot: () => T | undefined;
|
|
36
|
+
/** Always `undefined`: the server has no storage. */
|
|
37
|
+
getServerSnapshot: () => T | undefined;
|
|
38
|
+
/** Stores the value as JSON and notifies every listener of this key. */
|
|
39
|
+
set: (value: T) => void;
|
|
40
|
+
/** Removes the key and notifies every listener of this key. */
|
|
41
|
+
remove: () => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @internal Returns the store for `key` in the given storage area (one per pair). Safe to call
|
|
45
|
+
* during render and on the server: nothing touches storage until a method runs.
|
|
46
|
+
*
|
|
47
|
+
* @param key - The storage key.
|
|
48
|
+
* @param area - `'local'` for localStorage, `'session'` for sessionStorage.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createStorageStore<T>(key: string, area: StorageArea): StorageStore<T>;
|
|
51
|
+
//# sourceMappingURL=storageStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageStore.d.ts","sourceRoot":"","sources":["../../src/hooks/storageStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,mDAAmD;AACnD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9C,gGAAgG;AAChG,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,6FAA6F;IAC7F,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;IAChD,qGAAqG;IACrG,WAAW,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACjC,qDAAqD;IACrD,iBAAiB,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACvC,wEAAwE;IACxE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACxB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAwFD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAiDrF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an async action is: not run yet (or reset), running, done, or failed.
|
|
3
|
+
* @since 2.13.0
|
|
4
|
+
*/
|
|
5
|
+
export type AsyncActionStatus = 'idle' | 'pending' | 'success' | 'error';
|
|
6
|
+
/**
|
|
7
|
+
* What `run` resolves to. It never rejects.
|
|
8
|
+
* @since 2.13.0
|
|
9
|
+
*/
|
|
10
|
+
export type AsyncActionResult = {
|
|
11
|
+
status: 'success';
|
|
12
|
+
} | {
|
|
13
|
+
status: 'error';
|
|
14
|
+
error: unknown;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Options of {@link useAsyncAction}.
|
|
18
|
+
* @since 2.13.0
|
|
19
|
+
*/
|
|
20
|
+
export interface UseAsyncActionOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Called with the error when the action throws or rejects. Without it, the error is reported
|
|
23
|
+
* through `globalThis.reportError` (or re-thrown from a microtask).
|
|
24
|
+
*/
|
|
25
|
+
onError?(error: unknown): void;
|
|
26
|
+
/**
|
|
27
|
+
* Messages announced to screen readers through `useAnnounce`: `pending` and `success` politely,
|
|
28
|
+
* `error` assertively. Each is optional; nothing is announced without one. Use your own strings.
|
|
29
|
+
*/
|
|
30
|
+
announce?: {
|
|
31
|
+
pending?: string;
|
|
32
|
+
success?: string;
|
|
33
|
+
error?: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Return value of {@link useAsyncAction}.
|
|
38
|
+
* @since 2.13.0
|
|
39
|
+
*/
|
|
40
|
+
export interface UseAsyncActionReturn<A extends unknown[]> {
|
|
41
|
+
/**
|
|
42
|
+
* Runs the action. While a run is pending, returns that run's promise without calling `fn`
|
|
43
|
+
* again. Resolves to the result; never rejects. Stable identity.
|
|
44
|
+
*/
|
|
45
|
+
run(...args: A): Promise<AsyncActionResult>;
|
|
46
|
+
/** Where the latest run is. */
|
|
47
|
+
status: AsyncActionStatus;
|
|
48
|
+
/** The latest run's error while `status` is 'error'; otherwise `undefined`. */
|
|
49
|
+
error: unknown;
|
|
50
|
+
/**
|
|
51
|
+
* Back to 'idle' with no error. A run still in flight keeps going but no longer changes
|
|
52
|
+
* `status`; its outcome is still reported and announced. Stable identity.
|
|
53
|
+
*/
|
|
54
|
+
reset(): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Runs an asynchronous action with a pending state, a never-rejecting result, error reporting and
|
|
58
|
+
* announcements (ADR-07). See the module notes.
|
|
59
|
+
*
|
|
60
|
+
* @param fn - The action. May return nothing, a promise or any thenable.
|
|
61
|
+
* @param options - Error handler and announcement strings.
|
|
62
|
+
* @since 2.13.0
|
|
63
|
+
*/
|
|
64
|
+
export declare function useAsyncAction<A extends unknown[]>(fn?: (...args: A) => void | PromiseLike<void>, options?: UseAsyncActionOptions): UseAsyncActionReturn<A>;
|
|
65
|
+
//# sourceMappingURL=useAsyncAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAsyncAction.d.ts","sourceRoot":"","sources":["../../src/hooks/useAsyncAction.ts"],"names":[],"mappings":"AA4CA;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5F;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACnE;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,OAAO,EAAE;IACvD;;;OAGG;IACH,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5C,+BAA+B;IAC/B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,+EAA+E;IAC/E,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAqBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,OAAO,EAAE,EAChD,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,EAC7C,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CAAC,CAAC,CAAC,CA8EzB"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview useDisclosure: state, ids and ARIA wiring for expand/collapse triggers and popup
|
|
3
|
+
* triggers (B-05, ADR-35 (2) with ADR-35-R1/R2, ADR-15 (2) with ADR-15-R1).
|
|
4
|
+
* @module hooks/useDisclosure
|
|
5
|
+
*
|
|
6
|
+
* Re-exported from `src/hooks.ts` and the package root (ADR-35-R8).
|
|
7
|
+
*
|
|
8
|
+
* Two modes:
|
|
9
|
+
* - `inline` (default): a trigger that shows and hides a panel next to it. The trigger gets
|
|
10
|
+
* `aria-expanded`, and `aria-controls` while the panel is in the document.
|
|
11
|
+
* - `popup`: a trigger that opens an MUI overlay (Menu, Popover, Dialog, a Popper listbox). The
|
|
12
|
+
* trigger gets `aria-haspopup` (the popup's role), `aria-expanded`, and `aria-controls` only
|
|
13
|
+
* while the popup is open, so the reference never points at nothing.
|
|
14
|
+
*
|
|
15
|
+
* State comes from MUI `useControlled`: pass `open` to control it, or `defaultOpen`. Every change
|
|
16
|
+
* calls `onOpenChange(open, reason, event)`; in controlled mode the value waits for the parent.
|
|
17
|
+
* Ids come from `useId` (`options.id` overrides); the panel id is `${triggerId}-panel`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const details = useDisclosure();
|
|
22
|
+
* <Button {...details.getTriggerProps()}>Details</Button>
|
|
23
|
+
* <Collapse in={details.open}>
|
|
24
|
+
* <div {...details.getPanelProps({ role: 'region' })}>…</div>
|
|
25
|
+
* </Collapse>
|
|
26
|
+
*
|
|
27
|
+
* const actions = useDisclosure({ mode: 'popup', popupRole: 'menu' });
|
|
28
|
+
* <Button {...actions.getTriggerProps()}>Actions</Button>
|
|
29
|
+
* <Menu {...actions.getPopupProps()}>
|
|
30
|
+
* <MenuItem onClick={() => actions.setOpen(false)}>Rename</MenuItem>
|
|
31
|
+
* </Menu>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
import * as React from 'react';
|
|
35
|
+
/**
|
|
36
|
+
* Why an open state changed. Shared by every open-state callback in Trinity: components add
|
|
37
|
+
* literals of their own (for example 'hover' or 'action') but never rename these.
|
|
38
|
+
* - `trigger`: the user activated the trigger;
|
|
39
|
+
* - `escape`: Escape closed the popup;
|
|
40
|
+
* - `clickAway`: a click outside, or focus leaving the popup (MUI Menu's Tab), closed it;
|
|
41
|
+
* - `programmatic`: code called `setOpen` without a reason.
|
|
42
|
+
* @since 2.13.0
|
|
43
|
+
*/
|
|
44
|
+
export type OpenChangeReason = 'trigger' | 'escape' | 'clickAway' | 'programmatic';
|
|
45
|
+
/**
|
|
46
|
+
* The reasons `useDisclosure` reports. An alias of {@link OpenChangeReason}.
|
|
47
|
+
* @since 2.13.0
|
|
48
|
+
*/
|
|
49
|
+
export type DisclosureChangeReason = OpenChangeReason;
|
|
50
|
+
/**
|
|
51
|
+
* `inline` for a panel shown next to its trigger, `popup` for an overlay.
|
|
52
|
+
* @since 2.13.0
|
|
53
|
+
*/
|
|
54
|
+
export type DisclosureMode = 'inline' | 'popup';
|
|
55
|
+
/**
|
|
56
|
+
* The role of the popup a `popup`-mode trigger opens; it becomes the trigger's `aria-haspopup`.
|
|
57
|
+
* @since 2.13.0
|
|
58
|
+
*/
|
|
59
|
+
export type DisclosurePopupRole = 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid';
|
|
60
|
+
/**
|
|
61
|
+
* Options of {@link useDisclosure}.
|
|
62
|
+
* @since 2.13.0
|
|
63
|
+
*/
|
|
64
|
+
export interface UseDisclosureOptions {
|
|
65
|
+
/**
|
|
66
|
+
* `inline` for a panel next to the trigger, `popup` for an overlay.
|
|
67
|
+
* @default 'inline'
|
|
68
|
+
*/
|
|
69
|
+
mode?: DisclosureMode;
|
|
70
|
+
/** Controlled open state. Leave it undefined (for the component's lifetime) for uncontrolled use. */
|
|
71
|
+
open?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Initial open state when uncontrolled.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
defaultOpen?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Called on every requested change, in both modes, with the reason and the event when there is
|
|
79
|
+
* one. In controlled mode, update `open` here.
|
|
80
|
+
*/
|
|
81
|
+
onOpenChange?: (open: boolean, reason: OpenChangeReason, event?: React.SyntheticEvent | Event) => void;
|
|
82
|
+
/**
|
|
83
|
+
* The trigger's id. The panel's id is `${id}-panel`.
|
|
84
|
+
* @default an id from `React.useId()`
|
|
85
|
+
*/
|
|
86
|
+
id?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The popup's role in `popup` mode (the trigger's `aria-haspopup`).
|
|
89
|
+
* @default 'dialog'
|
|
90
|
+
*/
|
|
91
|
+
popupRole?: DisclosurePopupRole;
|
|
92
|
+
/** When true, activating the trigger does not toggle. `setOpen` still works. */
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* `inline` mode: whether the panel stays in the document while closed (hidden by a Collapse, for
|
|
96
|
+
* example). When false, `aria-controls` is set only while open. A development warning fires when
|
|
97
|
+
* `aria-controls` points at an element that is not in the document.
|
|
98
|
+
* @default true
|
|
99
|
+
*/
|
|
100
|
+
panelMountedWhenClosed?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/** The trigger props `getTriggerProps` merges with its own: the user's click handler and ref. */
|
|
103
|
+
type TriggerUserProps = {
|
|
104
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
105
|
+
ref?: React.Ref<HTMLElement>;
|
|
106
|
+
};
|
|
107
|
+
/** The panel props `getPanelProps` reads: the panel's role and an optional label source. */
|
|
108
|
+
type PanelUserProps = {
|
|
109
|
+
role?: React.AriaRole;
|
|
110
|
+
labelledBy?: string;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Props `getTriggerProps` adds to the trigger.
|
|
114
|
+
* @since 2.13.0
|
|
115
|
+
*/
|
|
116
|
+
export interface DisclosureTriggerProps {
|
|
117
|
+
id: string;
|
|
118
|
+
'aria-expanded': boolean;
|
|
119
|
+
'aria-controls'?: string;
|
|
120
|
+
'aria-haspopup'?: DisclosurePopupRole;
|
|
121
|
+
onClick: React.MouseEventHandler<HTMLElement>;
|
|
122
|
+
ref: React.RefCallback<HTMLElement>;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Props `getPanelProps` adds to the panel.
|
|
126
|
+
* @since 2.13.0
|
|
127
|
+
*/
|
|
128
|
+
export interface DisclosurePanelProps {
|
|
129
|
+
id: string;
|
|
130
|
+
'aria-labelledby'?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Props `getPopupProps` returns for an MUI Menu, Popover or Dialog.
|
|
134
|
+
* @since 2.13.0
|
|
135
|
+
*/
|
|
136
|
+
export interface DisclosurePopupProps {
|
|
137
|
+
id: string;
|
|
138
|
+
open: boolean;
|
|
139
|
+
anchorEl: HTMLElement | null;
|
|
140
|
+
onClose: (event: object, reason: 'backdropClick' | 'escapeKeyDown' | 'tabKeyDown') => void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Return value of {@link useDisclosure}.
|
|
144
|
+
* @since 2.13.0
|
|
145
|
+
*/
|
|
146
|
+
export interface UseDisclosureReturn {
|
|
147
|
+
/** Whether the panel or popup is open. */
|
|
148
|
+
open: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Requests a change. Calls `onOpenChange` (when the value differs) and, when uncontrolled,
|
|
151
|
+
* changes the state.
|
|
152
|
+
* @param reason - @default 'programmatic'
|
|
153
|
+
*/
|
|
154
|
+
setOpen: (open: boolean, reason?: OpenChangeReason, event?: React.SyntheticEvent | Event) => void;
|
|
155
|
+
/** Requests the opposite state, with reason 'trigger'. */
|
|
156
|
+
toggle: (event?: React.SyntheticEvent) => void;
|
|
157
|
+
/** The trigger's id. */
|
|
158
|
+
triggerId: string;
|
|
159
|
+
/** The panel's id: `${triggerId}-panel`. */
|
|
160
|
+
panelId: string;
|
|
161
|
+
/** The trigger element once mounted (the popup's anchor). */
|
|
162
|
+
anchorEl: HTMLElement | null;
|
|
163
|
+
/**
|
|
164
|
+
* Props for the trigger. The user's `onClick` runs first; calling `event.preventDefault()` in it
|
|
165
|
+
* skips the toggle. The user's `ref` receives the element too.
|
|
166
|
+
*/
|
|
167
|
+
getTriggerProps: <P extends TriggerUserProps>(userProps?: P) => Omit<P, keyof DisclosureTriggerProps> & DisclosureTriggerProps;
|
|
168
|
+
/**
|
|
169
|
+
* Props for the panel. `aria-labelledby` (the trigger, or `labelledBy` when given) is added only
|
|
170
|
+
* when `role` is a role that can be named, such as 'region', 'dialog', 'group', 'menu' or
|
|
171
|
+
* 'listbox'; a generic panel gets no name (axe aria-prohibited-attr).
|
|
172
|
+
*/
|
|
173
|
+
getPanelProps: <P extends PanelUserProps>(userProps?: P) => Omit<P, 'labelledBy'> & DisclosurePanelProps;
|
|
174
|
+
/**
|
|
175
|
+
* Props for an MUI Menu, Popover or Dialog in `popup` mode. MUI's close reasons map to 'escape'
|
|
176
|
+
* (escapeKeyDown) and 'clickAway' (backdropClick, tabKeyDown). MUI returns focus to the trigger.
|
|
177
|
+
*/
|
|
178
|
+
getPopupProps: () => DisclosurePopupProps;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* State, ids and ARIA wiring for an expand/collapse trigger (`inline`) or a popup trigger
|
|
182
|
+
* (`popup`). See the module notes.
|
|
183
|
+
*
|
|
184
|
+
* @param options - See {@link UseDisclosureOptions}.
|
|
185
|
+
* @returns See {@link UseDisclosureReturn}.
|
|
186
|
+
* @since 2.13.0
|
|
187
|
+
*/
|
|
188
|
+
export declare function useDisclosure(options?: UseDisclosureOptions): UseDisclosureReturn;
|
|
189
|
+
export {};
|
|
190
|
+
//# sourceMappingURL=useDisclosure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDisclosure.d.ts","sourceRoot":"","sources":["../../src/hooks/useDisclosure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,cAAc,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,qGAAqG;IACrG,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAG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the focused control was removed or disabled
|
|
4
|
+
* (B-08, ADR-31, step 3 toolkit T3).
|
|
5
|
+
* @module hooks/useFocusOnReplace
|
|
6
|
+
*
|
|
7
|
+
* @internal Not part of the public API (ADR-02, ADR-35). It is deliberately not
|
|
8
|
+
* re-exported from `src/hooks.ts`, `src/accessibility.tsx`, `src/index.ts` or
|
|
9
|
+
* any other entry. Components import it from this file directly.
|
|
10
|
+
*
|
|
11
|
+
* The problem it solves: a control that unmounts or disables itself while it
|
|
12
|
+
* has focus (an "Expand" button that disappears once its subtree is shown, a
|
|
13
|
+
* clear button that unmounts once the field is empty, a "Move" button that
|
|
14
|
+
* disables itself) drops keyboard focus to `<body>` (WCAG 2.4.3).
|
|
15
|
+
*
|
|
16
|
+
* The rule: focus moves only when it was lost. After each commit while a
|
|
17
|
+
* request is pending, the hook looks at the focused element:
|
|
18
|
+
* - focus is on `<body>` (or nothing) and the trigger (the element focused when
|
|
19
|
+
* `focusAfterCommit()` was called) is gone, disabled, inert or hidden, or no
|
|
20
|
+
* trigger was focused: focus is lost, so it moves to the target, else to
|
|
21
|
+
* the fallback;
|
|
22
|
+
* - focus is still on the trigger and the trigger is disconnected, disabled,
|
|
23
|
+
* inert or hidden (jsdom and some browsers keep focus there): lost, same as
|
|
24
|
+
* above;
|
|
25
|
+
* - focus is still on the live trigger: nothing moves and the request stays
|
|
26
|
+
* pending, so an asynchronous replacement (for example an `onExpand` that
|
|
27
|
+
* loads data first) is handled by a later commit;
|
|
28
|
+
* - focus is on any other element (the user or the consumer moved it), or on
|
|
29
|
+
* `<body>` while the trigger is still live (the user clicked away): the
|
|
30
|
+
* request is dropped and nothing moves. Focus is never stolen.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const { targetRef, focusAfterCommit } = useFocusOnReplace<HTMLButtonElement>();
|
|
35
|
+
* <ButtonBase ref={targetRef}>{node.title}</ButtonBase>
|
|
36
|
+
* {collapsed && (
|
|
37
|
+
* <Tooltip title="Expand subtree">
|
|
38
|
+
* <IconButton aria-label="Expand subtree" onClick={() => { focusAfterCommit(); onExpand(node); }}>
|
|
39
|
+
* <ChevronRight aria-hidden />
|
|
40
|
+
* </IconButton>
|
|
41
|
+
* </Tooltip>
|
|
42
|
+
* )}
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
import * as React from 'react';
|
|
46
|
+
/**
|
|
47
|
+
* @internal Where focus goes after the commit: a ref, or a getter that is
|
|
48
|
+
* called after the commit, so it can return an element the same commit created
|
|
49
|
+
* (for example the first row moved into another list).
|
|
50
|
+
*/
|
|
51
|
+
export type FocusOnReplaceTarget = React.RefObject<HTMLElement | null> | (() => HTMLElement | null | undefined);
|
|
52
|
+
/** @internal Options of {@link useFocusOnReplace}. */
|
|
53
|
+
export interface UseFocusOnReplaceOptions {
|
|
54
|
+
/**
|
|
55
|
+
* Default replacement target, used when `focusAfterCommit()` is called
|
|
56
|
+
* without one. A ref, or a getter called after the commit.
|
|
57
|
+
* @default the returned `targetRef`
|
|
58
|
+
*/
|
|
59
|
+
target?: FocusOnReplaceTarget;
|
|
60
|
+
/**
|
|
61
|
+
* Tried when the target is missing, disconnected or does not take focus
|
|
62
|
+
* (disabled, hidden, not focusable). A ref, or a getter called after the
|
|
63
|
+
* commit. When neither resolves, a development-only warning is logged and
|
|
64
|
+
* focus stays where the browser put it.
|
|
65
|
+
*/
|
|
66
|
+
fallbackRef?: FocusOnReplaceTarget;
|
|
67
|
+
}
|
|
68
|
+
/** @internal Return value of {@link useFocusOnReplace}. */
|
|
69
|
+
export interface UseFocusOnReplaceResult<T extends HTMLElement = HTMLElement> {
|
|
70
|
+
/**
|
|
71
|
+
* Ref for the replacement element. It is the default target when neither
|
|
72
|
+
* `options.target` nor a per-call target is given.
|
|
73
|
+
*/
|
|
74
|
+
targetRef: React.RefObject<T | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Call from the event handler (or effect) that is about to remove, disable or
|
|
77
|
+
* replace the focused control, before or after the state update; never during
|
|
78
|
+
* render. Records the focused element as the trigger, schedules a commit of the
|
|
79
|
+
* host component, and moves focus to the target after the first commit in which
|
|
80
|
+
* focus was lost (see the module notes). Stable identity across renders.
|
|
81
|
+
*
|
|
82
|
+
* @param target - Replacement target for this call only (a ref or a getter).
|
|
83
|
+
* Overrides `options.target` and `targetRef`.
|
|
84
|
+
*/
|
|
85
|
+
focusAfterCommit: (target?: FocusOnReplaceTarget) => void;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @internal Moves focus to a replacement target after React commits, but only
|
|
89
|
+
* when focus was lost (B-08, ADR-31). Not exported from any entry.
|
|
90
|
+
*
|
|
91
|
+
* @param options - Optional default target and fallback.
|
|
92
|
+
* @returns `targetRef` for the default target and a stable `focusAfterCommit`.
|
|
93
|
+
*/
|
|
94
|
+
export declare function useFocusOnReplace<T extends HTMLElement = HTMLElement>(options?: UseFocusOnReplaceOptions): UseFocusOnReplaceResult<T>;
|
|
95
|
+
//# sourceMappingURL=useFocusOnReplace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusOnReplace.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusOnReplace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,GACnC,CAAC,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAE3C,sDAAsD;AACtD,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC;AAED,2DAA2D;AAC3D,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC1E;;;OAGG;IACH,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC;;;;;;;;;OASG;IACH,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC3D;AA+CD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EACnE,OAAO,GAAE,wBAA6B,GACrC,uBAAuB,CAAC,CAAC,CAAC,CA6D5B"}
|
|
@@ -1,54 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Trinity
|
|
2
|
+
* Trinity palette resolver (ADR-26 (3), ADR-03-R4, master plan E-06).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `getTrinityPalette(theme)` and `useTrinityPalette()` always return a complete
|
|
5
|
+
* {@link ResolvedTrinityPalette}. Under a Trinity theme they return its `palette.trinity`
|
|
6
|
+
* groups. Under any other MUI theme (plain `createTheme()`, a consumer theme with a partial
|
|
7
|
+
* `palette.trinity`) the missing groups come from a fallback derived from the MUI palette with
|
|
8
|
+
* contrast-safe pairs. The fallback is a supported mode, so nothing is logged.
|
|
9
|
+
*
|
|
10
|
+
* Components read Trinity roles only through these two functions (ADR-03).
|
|
7
11
|
*/
|
|
8
|
-
import { Theme } from '@mui/material';
|
|
12
|
+
import { type Theme } from '@mui/material/styles';
|
|
13
|
+
import type { ResolvedTrinityPalette } from '../theme-augmentation';
|
|
14
|
+
export type { ResolvedTrinityPalette, TrinityPalette, TrinityStatusColor, TrinityInteractive, TrinityBorder, } from '../theme-augmentation';
|
|
9
15
|
/**
|
|
10
|
-
* Trinity palette
|
|
16
|
+
* Get the complete Trinity palette of a theme, for use outside React components and inside
|
|
17
|
+
* `(theme) => …` sx callbacks. Cached per theme object.
|
|
18
|
+
*
|
|
19
|
+
* - Under a Trinity theme, every group is `theme.palette.trinity`'s own group; `ai` adds the
|
|
20
|
+
* derived `gradient` strings.
|
|
21
|
+
* - Under any other theme, missing groups (or keys) come from a fallback derived from the MUI
|
|
22
|
+
* palette: status text from `palette[x].dark` (light) or `.light` (dark), adjusted to 4.5:1
|
|
23
|
+
* on the paper; backgrounds `alpha(main, 0.12)`; AI roles from `palette.primary` and
|
|
24
|
+
* `palette.secondary` (the avatar fill runs from secondary to primary, the progress colour is the
|
|
25
|
+
* success text, the canvas fill is a faint primary and secondary tint); confidence and
|
|
26
|
+
* verification from the status fallback; surfaces, overlays and states from
|
|
27
|
+
* `palette.background`, `palette.action` and the status mains; the indicator group from the
|
|
28
|
+
* status `dark` shades, grey[700], primary and secondary; the favorite role from the warning
|
|
29
|
+
* status text.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Box sx={(theme) => ({ color: getTrinityPalette(theme).ai.primary })} />
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @since 2.13.0
|
|
11
37
|
*/
|
|
12
|
-
export
|
|
13
|
-
text: string;
|
|
14
|
-
background: string;
|
|
15
|
-
border: string;
|
|
16
|
-
}
|
|
17
|
-
export interface TrinityInteractive {
|
|
18
|
-
default: string;
|
|
19
|
-
hover: string;
|
|
20
|
-
active: string;
|
|
21
|
-
disabled: string;
|
|
22
|
-
focus: string;
|
|
23
|
-
}
|
|
24
|
-
export interface TrinityBorder {
|
|
25
|
-
default: string;
|
|
26
|
-
subtle: string;
|
|
27
|
-
strong: string;
|
|
28
|
-
}
|
|
29
|
-
export interface TrinityPalette {
|
|
30
|
-
interactive: TrinityInteractive;
|
|
31
|
-
status: {
|
|
32
|
-
success: TrinityStatusColor;
|
|
33
|
-
warning: TrinityStatusColor;
|
|
34
|
-
error: TrinityStatusColor;
|
|
35
|
-
info: TrinityStatusColor;
|
|
36
|
-
};
|
|
37
|
-
border: TrinityBorder;
|
|
38
|
-
}
|
|
38
|
+
export declare function getTrinityPalette(theme: Theme): ResolvedTrinityPalette;
|
|
39
39
|
/**
|
|
40
|
-
* Hook to access Trinity's semantic colors from the theme
|
|
41
|
-
*
|
|
40
|
+
* Hook to access Trinity's semantic colors from the theme: the complete palette of the current
|
|
41
|
+
* theme (see {@link getTrinityPalette}). Mode-aware, and complete under any MUI theme.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* ```tsx
|
|
45
45
|
* const trinity = useTrinityPalette();
|
|
46
46
|
* <Box color={trinity.status.success.text} />
|
|
47
47
|
* ```
|
|
48
|
+
*
|
|
49
|
+
* @since 2.13.0
|
|
48
50
|
*/
|
|
49
|
-
export declare function useTrinityPalette():
|
|
50
|
-
/**
|
|
51
|
-
* Get Trinity palette from a theme object (for use outside React components)
|
|
52
|
-
*/
|
|
53
|
-
export declare function getTrinityPalette(theme: Theme): TrinityPalette;
|
|
51
|
+
export declare function useTrinityPalette(): ResolvedTrinityPalette;
|
|
54
52
|
//# sourceMappingURL=useTrinityPalette.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTrinityPalette.d.ts","sourceRoot":"","sources":["../../src/hooks/useTrinityPalette.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"useTrinityPalette.d.ts","sourceRoot":"","sources":["../../src/hooks/useTrinityPalette.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAoC,KAAK,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAWpF,OAAO,KAAK,EACV,sBAAsB,EAKvB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EACV,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,uBAAuB,CAAC;AAoM/B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,sBAAsB,CA4BtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,IAAI,sBAAsB,CAE1D"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -34,16 +34,36 @@ export declare function useDebounce<T>(value: T, delay: number): T;
|
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
export declare function useDebouncedCallback<T extends (...args: unknown[]) => unknown>(callback: T, delay: number): (...args: Parameters<T>) => void;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Options of {@link useClipboard}.
|
|
39
|
+
* @since 2.13.0
|
|
40
|
+
*/
|
|
41
|
+
export interface UseClipboardOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Duration to show success state in ms
|
|
44
|
+
* @default 2000
|
|
45
|
+
*/
|
|
39
46
|
successDuration?: number;
|
|
40
47
|
/** Callback on successful copy */
|
|
41
48
|
onSuccess?: (text: string) => void;
|
|
42
49
|
/** Callback on error */
|
|
43
50
|
onError?: (error: Error) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Messages read to screen readers through `useAnnounce` (the nearest `LiveRegionProvider`, else
|
|
53
|
+
* the document regions): `success` politely after a copy, `error` assertively after a failure.
|
|
54
|
+
* Each is optional; nothing is announced without one. Use your own strings.
|
|
55
|
+
*/
|
|
56
|
+
announce?: {
|
|
57
|
+
success?: string;
|
|
58
|
+
error?: string;
|
|
59
|
+
};
|
|
44
60
|
}
|
|
45
|
-
|
|
46
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Return value of {@link useClipboard}.
|
|
63
|
+
* @since 2.13.0
|
|
64
|
+
*/
|
|
65
|
+
export interface UseClipboardReturn {
|
|
66
|
+
/** Copy text to clipboard. Resolves to `true` on success and `false` when the copy fails. */
|
|
47
67
|
copy: (text: string) => Promise<boolean>;
|
|
48
68
|
/** Whether last copy was successful */
|
|
49
69
|
copied: boolean;
|
|
@@ -55,12 +75,18 @@ interface UseClipboardReturn {
|
|
|
55
75
|
/**
|
|
56
76
|
* Hook for copying text to clipboard with feedback.
|
|
57
77
|
*
|
|
78
|
+
* `copy(text)` resolves to `false` instead of rejecting when the copy fails; `error` then holds the
|
|
79
|
+
* reason. Without the Clipboard API (an insecure context, an old browser) the error says so:
|
|
80
|
+
* "Clipboard unavailable: …". With `announce` strings, the outcome is read to screen readers, so
|
|
81
|
+
* the "Copied" feedback is not visual only (BEHAVIOR_CONTRACT §2). `copy` and `reset` keep one
|
|
82
|
+
* identity, and the success timer is cleared on unmount.
|
|
83
|
+
*
|
|
58
84
|
* @param options - Configuration options
|
|
59
85
|
* @returns Clipboard utilities
|
|
60
86
|
*
|
|
61
87
|
* @example
|
|
62
88
|
* ```tsx
|
|
63
|
-
* const { copy, copied
|
|
89
|
+
* const { copy, copied } = useClipboard({ announce: { success: 'Copied', error: 'Copy failed' } });
|
|
64
90
|
*
|
|
65
91
|
* <Button onClick={() => copy('Hello World!')}>
|
|
66
92
|
* {copied ? 'Copied!' : 'Copy'}
|
|
@@ -72,6 +98,14 @@ type SetValue<T> = T | ((prevValue: T) => T);
|
|
|
72
98
|
/**
|
|
73
99
|
* Hook for persisting state in localStorage.
|
|
74
100
|
*
|
|
101
|
+
* Hydration-safe (ADR-27): the server render and the hydration render use `initialValue`, and the
|
|
102
|
+
* stored value follows in the render straight after hydration. A client-only mount reads the stored
|
|
103
|
+
* value on its first render. Every hook on the same key in the tab shows the same value, and writes
|
|
104
|
+
* from other tabs arrive through the `storage` event. A missing key, an unavailable storage or text
|
|
105
|
+
* that is not JSON gives `initialValue`. Functional updates start from the latest stored value, so
|
|
106
|
+
* several in one handler all apply. When storage refuses a write (quota, blocked storage), the value
|
|
107
|
+
* still changes for this page and a warning is logged.
|
|
108
|
+
*
|
|
75
109
|
* @param key - localStorage key
|
|
76
110
|
* @param initialValue - Initial value if key doesn't exist
|
|
77
111
|
* @returns [value, setValue, removeValue]
|
|
@@ -212,6 +246,10 @@ export declare function useKeyPress(targetKey: string, handler?: (event: Keyboar
|
|
|
212
246
|
* ```
|
|
213
247
|
*/
|
|
214
248
|
export declare function useInterval(callback: () => void, delay: number | null): void;
|
|
249
|
+
export { useDisclosure } from './hooks/useDisclosure';
|
|
250
|
+
export type { OpenChangeReason, DisclosureChangeReason, DisclosureMode, DisclosurePopupRole, UseDisclosureOptions, UseDisclosureReturn, DisclosureTriggerProps, DisclosurePanelProps, DisclosurePopupProps, } from './hooks/useDisclosure';
|
|
251
|
+
export { useAsyncAction } from './hooks/useAsyncAction';
|
|
252
|
+
export type { AsyncActionStatus, AsyncActionResult, UseAsyncActionOptions, UseAsyncActionReturn, } from './hooks/useAsyncAction';
|
|
215
253
|
export { useTrinityPalette, getTrinityPalette } from './hooks/useTrinityPalette';
|
|
216
|
-
export type { TrinityPalette, TrinityStatusColor, TrinityInteractive, TrinityBorder } from './
|
|
254
|
+
export type { ResolvedTrinityPalette, TrinityPalette, TrinityStatusColor, TrinityInteractive, TrinityBorder, } from './theme-augmentation';
|
|
217
255
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAczD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAC5E,QAAQ,EAAE,CAAC,EACX,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CA6BlC;AAMD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,eAAe,CAAC,E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