@dungle-scrubs/admin-ui-soft 0.0.0-stage → 0.1.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/GUIDE.md +110 -0
- package/LICENSE +21 -0
- package/README.md +36 -2
- package/THIRD-PARTY-NOTICES.md +25 -0
- package/UPSTREAM-VENDORED-CHANGES.md +317 -0
- package/VENDORED-CHANGES.md +60 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/ai/compositions/agent-console/agent-console.d.ts +109 -0
- package/dist/ai/compositions/agent-console/agent-console.js +644 -0
- package/dist/ai/compositions/attention-feed/attention-feed.d.ts +127 -0
- package/dist/ai/compositions/attention-feed/attention-feed.js +626 -0
- package/dist/ai/compositions/conversation-browser/conversation-browser.d.ts +126 -0
- package/dist/ai/compositions/conversation-browser/conversation-browser.js +364 -0
- package/dist/ai/compositions/redaction-marker/redaction-marker.d.ts +42 -0
- package/dist/ai/compositions/redaction-marker/redaction-marker.js +202 -0
- package/dist/ai/compositions/run-inspector/json-view.js +164 -0
- package/dist/ai/compositions/run-inspector/run-inspector.d.ts +66 -0
- package/dist/ai/compositions/run-inspector/run-inspector.js +703 -0
- package/dist/ai/compositions/run-inspector/run-model.js +155 -0
- package/dist/ai/compositions/tool-approval/json-args.js +54 -0
- package/dist/ai/compositions/tool-approval/tool-approval.d.ts +57 -0
- package/dist/ai/compositions/tool-approval/tool-approval.js +331 -0
- package/dist/ai/compositions/tool-call-row/tool-call-row.js +74 -0
- package/dist/ai/compositions/transcript-viewer/to-thread-messages.js +65 -0
- package/dist/ai/compositions/transcript-viewer/transcript-viewer.d.ts +63 -0
- package/dist/ai/compositions/transcript-viewer/transcript-viewer.js +471 -0
- package/dist/ai/compositions/usage-meter/usage-format.js +107 -0
- package/dist/ai/compositions/usage-meter/usage-meter.d.ts +32 -0
- package/dist/ai/compositions/usage-meter/usage-meter.js +258 -0
- package/dist/ai/testing/mock-clock.d.ts +31 -0
- package/dist/ai/testing/mock-clock.js +66 -0
- package/dist/ai/testing/mock-reply.d.ts +70 -0
- package/dist/ai/testing/mock-reply.js +100 -0
- package/dist/ai/testing/mock-runtime.d.ts +86 -0
- package/dist/ai/testing/mock-runtime.js +384 -0
- package/dist/ai/types.d.ts +323 -0
- package/dist/ai.css +1088 -0
- package/dist/ai.d.ts +160 -0
- package/dist/ai.js +158 -0
- package/dist/components/assistant-ui/elements/activity-graph.d.ts +14 -0
- package/dist/components/assistant-ui/elements/activity-graph.js +69 -0
- package/dist/components/assistant-ui/elements/agent-card.d.ts +21 -0
- package/dist/components/assistant-ui/elements/agent-card.js +75 -0
- package/dist/components/assistant-ui/elements/agent-handoff.d.ts +13 -0
- package/dist/components/assistant-ui/elements/agent-handoff.js +47 -0
- package/dist/components/assistant-ui/elements/agent-plan.d.ts +16 -0
- package/dist/components/assistant-ui/elements/agent-plan.js +93 -0
- package/dist/components/assistant-ui/elements/agent-status.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/agent-status.aui.js +161 -0
- package/dist/components/assistant-ui/elements/agent-status.d.ts +17 -0
- package/dist/components/assistant-ui/elements/agent-status.js +47 -0
- package/dist/components/assistant-ui/elements/approval-card.d.ts +31 -0
- package/dist/components/assistant-ui/elements/approval-card.js +99 -0
- package/dist/components/assistant-ui/elements/artifact-card.d.ts +12 -0
- package/dist/components/assistant-ui/elements/artifact-card.js +47 -0
- package/dist/components/assistant-ui/elements/assistant-modal.aui.d.ts +7 -0
- package/dist/components/assistant-ui/elements/assistant-modal.aui.js +276 -0
- package/dist/components/assistant-ui/elements/assistant-sidebar.aui.d.ts +7 -0
- package/dist/components/assistant-ui/elements/assistant-sidebar.aui.js +18 -0
- package/dist/components/assistant-ui/elements/attachment.aui.d.ts +9 -0
- package/dist/components/assistant-ui/elements/attachment.aui.js +143 -0
- package/dist/components/assistant-ui/elements/background-inbox.d.ts +18 -0
- package/dist/components/assistant-ui/elements/background-inbox.js +65 -0
- package/dist/components/assistant-ui/elements/canvas-split.d.ts +25 -0
- package/dist/components/assistant-ui/elements/canvas-split.js +106 -0
- package/dist/components/assistant-ui/elements/chart.d.ts +19 -0
- package/dist/components/assistant-ui/elements/chart.js +105 -0
- package/dist/components/assistant-ui/elements/chat-panel.d.ts +15 -0
- package/dist/components/assistant-ui/elements/chat-panel.js +82 -0
- package/dist/components/assistant-ui/elements/checkpoint-history.d.ts +17 -0
- package/dist/components/assistant-ui/elements/checkpoint-history.js +60 -0
- package/dist/components/assistant-ui/elements/code-diff.d.ts +18 -0
- package/dist/components/assistant-ui/elements/code-diff.js +89 -0
- package/dist/components/assistant-ui/elements/code-runner.d.ts +15 -0
- package/dist/components/assistant-ui/elements/code-runner.js +108 -0
- package/dist/components/assistant-ui/elements/command-palette.d.ts +20 -0
- package/dist/components/assistant-ui/elements/command-palette.js +129 -0
- package/dist/components/assistant-ui/elements/comparison-card.d.ts +18 -0
- package/dist/components/assistant-ui/elements/comparison-card.js +58 -0
- package/dist/components/assistant-ui/elements/composer-trigger-popover.aui.d.ts +51 -0
- package/dist/components/assistant-ui/elements/composer-trigger-popover.aui.js +104 -0
- package/dist/components/assistant-ui/elements/composer.d.ts +91 -0
- package/dist/components/assistant-ui/elements/composer.js +416 -0
- package/dist/components/assistant-ui/elements/computer-use.d.ts +19 -0
- package/dist/components/assistant-ui/elements/computer-use.js +84 -0
- package/dist/components/assistant-ui/elements/confidence-marker.d.ts +20 -0
- package/dist/components/assistant-ui/elements/confidence-marker.js +58 -0
- package/dist/components/assistant-ui/elements/connection-state.d.ts +13 -0
- package/dist/components/assistant-ui/elements/connection-state.js +59 -0
- package/dist/components/assistant-ui/elements/context-breakdown.d.ts +15 -0
- package/dist/components/assistant-ui/elements/context-breakdown.js +91 -0
- package/dist/components/assistant-ui/elements/context-display.aui.d.ts +25 -0
- package/dist/components/assistant-ui/elements/context-display.aui.js +26 -0
- package/dist/components/assistant-ui/elements/context-display.d.ts +43 -0
- package/dist/components/assistant-ui/elements/context-display.js +300 -0
- package/dist/components/assistant-ui/elements/conversation-map.aui.d.ts +9 -0
- package/dist/components/assistant-ui/elements/conversation-map.aui.js +177 -0
- package/dist/components/assistant-ui/elements/conversation-map.d.ts +19 -0
- package/dist/components/assistant-ui/elements/conversation-map.js +84 -0
- package/dist/components/assistant-ui/elements/conversation-search.d.ts +20 -0
- package/dist/components/assistant-ui/elements/conversation-search.js +75 -0
- package/dist/components/assistant-ui/elements/cost-meter.d.ts +19 -0
- package/dist/components/assistant-ui/elements/cost-meter.js +76 -0
- package/dist/components/assistant-ui/elements/data-table.d.ts +72 -0
- package/dist/components/assistant-ui/elements/data-table.js +368 -0
- package/dist/components/assistant-ui/elements/day-separator.d.ts +16 -0
- package/dist/components/assistant-ui/elements/day-separator.js +44 -0
- package/dist/components/assistant-ui/elements/diagram.d.ts +15 -0
- package/dist/components/assistant-ui/elements/diagram.js +65 -0
- package/dist/components/assistant-ui/elements/directive-text.aui.d.ts +11 -0
- package/dist/components/assistant-ui/elements/directive-text.aui.js +18 -0
- package/dist/components/assistant-ui/elements/directive-text.d.ts +32 -0
- package/dist/components/assistant-ui/elements/directive-text.js +35 -0
- package/dist/components/assistant-ui/elements/document-reference.d.ts +17 -0
- package/dist/components/assistant-ui/elements/document-reference.js +62 -0
- package/dist/components/assistant-ui/elements/draft-restore.d.ts +12 -0
- package/dist/components/assistant-ui/elements/draft-restore.js +43 -0
- package/dist/components/assistant-ui/elements/edit-message.d.ts +15 -0
- package/dist/components/assistant-ui/elements/edit-message.js +63 -0
- package/dist/components/assistant-ui/elements/elicitation-form.d.ts +23 -0
- package/dist/components/assistant-ui/elements/elicitation-form.js +112 -0
- package/dist/components/assistant-ui/elements/empty-state.d.ts +16 -0
- package/dist/components/assistant-ui/elements/empty-state.js +71 -0
- package/dist/components/assistant-ui/elements/error-state.d.ts +13 -0
- package/dist/components/assistant-ui/elements/error-state.js +52 -0
- package/dist/components/assistant-ui/elements/feedback-dialog.d.ts +15 -0
- package/dist/components/assistant-ui/elements/feedback-dialog.js +77 -0
- package/dist/components/assistant-ui/elements/file-tree.d.ts +20 -0
- package/dist/components/assistant-ui/elements/file-tree.js +74 -0
- package/dist/components/assistant-ui/elements/file.d.ts +52 -0
- package/dist/components/assistant-ui/elements/file.js +222 -0
- package/dist/components/assistant-ui/elements/flow-graph.d.ts +23 -0
- package/dist/components/assistant-ui/elements/flow-graph.js +72 -0
- package/dist/components/assistant-ui/elements/follow-up-suggestions.aui.d.ts +7 -0
- package/dist/components/assistant-ui/elements/follow-up-suggestions.aui.js +30 -0
- package/dist/components/assistant-ui/elements/generative-ui.d.ts +8 -0
- package/dist/components/assistant-ui/elements/generative-ui.js +27 -0
- package/dist/components/assistant-ui/elements/geo-map.d.ts +29 -0
- package/dist/components/assistant-ui/elements/geo-map.js +190 -0
- package/dist/components/assistant-ui/elements/guardrail-notice.d.ts +15 -0
- package/dist/components/assistant-ui/elements/guardrail-notice.js +59 -0
- package/dist/components/assistant-ui/elements/heat-graph.d.ts +9 -0
- package/dist/components/assistant-ui/elements/heat-graph.js +90 -0
- package/dist/components/assistant-ui/elements/image-gallery.d.ts +22 -0
- package/dist/components/assistant-ui/elements/image-gallery.js +192 -0
- package/dist/components/assistant-ui/elements/image-generation.d.ts +11 -0
- package/dist/components/assistant-ui/elements/image-generation.js +64 -0
- package/dist/components/assistant-ui/elements/image.d.ts +59 -0
- package/dist/components/assistant-ui/elements/image.js +416 -0
- package/dist/components/assistant-ui/elements/inline-citation.d.ts +23 -0
- package/dist/components/assistant-ui/elements/inline-citation.js +90 -0
- package/dist/components/assistant-ui/elements/job-progress.d.ts +25 -0
- package/dist/components/assistant-ui/elements/job-progress.js +102 -0
- package/dist/components/assistant-ui/elements/launcher-bubble.d.ts +15 -0
- package/dist/components/assistant-ui/elements/launcher-bubble.js +71 -0
- package/dist/components/assistant-ui/elements/link-preview.d.ts +17 -0
- package/dist/components/assistant-ui/elements/link-preview.js +77 -0
- package/dist/components/assistant-ui/elements/loading-state.d.ts +13 -0
- package/dist/components/assistant-ui/elements/loading-state.js +33 -0
- package/dist/components/assistant-ui/elements/logos.d.ts +10 -0
- package/dist/components/assistant-ui/elements/logos.js +63 -0
- package/dist/components/assistant-ui/elements/map-answer.d.ts +19 -0
- package/dist/components/assistant-ui/elements/map-answer.js +120 -0
- package/dist/components/assistant-ui/elements/markdown-text.d.ts +11 -0
- package/dist/components/assistant-ui/elements/markdown-text.js +152 -0
- package/dist/components/assistant-ui/elements/math-block.d.ts +25 -0
- package/dist/components/assistant-ui/elements/math-block.js +60 -0
- package/dist/components/assistant-ui/elements/mcp-config.aui.d.ts +28 -0
- package/dist/components/assistant-ui/elements/mcp-config.aui.js +380 -0
- package/dist/components/assistant-ui/elements/mcp-server-panel.d.ts +20 -0
- package/dist/components/assistant-ui/elements/mcp-server-panel.js +114 -0
- package/dist/components/assistant-ui/elements/media-player.d.ts +21 -0
- package/dist/components/assistant-ui/elements/media-player.js +302 -0
- package/dist/components/assistant-ui/elements/memory-chips.d.ts +16 -0
- package/dist/components/assistant-ui/elements/memory-chips.js +44 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.aui.d.ts +14 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.aui.js +43 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.d.ts +20 -0
- package/dist/components/assistant-ui/elements/mermaid-diagram.js +258 -0
- package/dist/components/assistant-ui/elements/message-actions.d.ts +17 -0
- package/dist/components/assistant-ui/elements/message-actions.js +57 -0
- package/dist/components/assistant-ui/elements/message-attachment.d.ts +18 -0
- package/dist/components/assistant-ui/elements/message-attachment.js +58 -0
- package/dist/components/assistant-ui/elements/message-branches.d.ts +12 -0
- package/dist/components/assistant-ui/elements/message-branches.js +55 -0
- package/dist/components/assistant-ui/elements/message-pair.d.ts +16 -0
- package/dist/components/assistant-ui/elements/message-pair.js +63 -0
- package/dist/components/assistant-ui/elements/message-queue.d.ts +15 -0
- package/dist/components/assistant-ui/elements/message-queue.js +70 -0
- package/dist/components/assistant-ui/elements/message-timing.aui.d.ts +30 -0
- package/dist/components/assistant-ui/elements/message-timing.aui.js +98 -0
- package/dist/components/assistant-ui/elements/message-timing.d.ts +14 -0
- package/dist/components/assistant-ui/elements/message-timing.js +26 -0
- package/dist/components/assistant-ui/elements/mobile-composer.d.ts +18 -0
- package/dist/components/assistant-ui/elements/mobile-composer.js +76 -0
- package/dist/components/assistant-ui/elements/model-picker.d.ts +19 -0
- package/dist/components/assistant-ui/elements/model-picker.js +68 -0
- package/dist/components/assistant-ui/elements/model-selector.aui.d.ts +23 -0
- package/dist/components/assistant-ui/elements/model-selector.aui.js +79 -0
- package/dist/components/assistant-ui/elements/model-selector.d.ts +130 -0
- package/dist/components/assistant-ui/elements/model-selector.js +399 -0
- package/dist/components/assistant-ui/elements/number-ticker.d.ts +10 -0
- package/dist/components/assistant-ui/elements/number-ticker.js +41 -0
- package/dist/components/assistant-ui/elements/onboarding.d.ts +17 -0
- package/dist/components/assistant-ui/elements/onboarding.js +69 -0
- package/dist/components/assistant-ui/elements/option-list.d.ts +39 -0
- package/dist/components/assistant-ui/elements/option-list.js +176 -0
- package/dist/components/assistant-ui/elements/permission-grant.d.ts +14 -0
- package/dist/components/assistant-ui/elements/permission-grant.js +84 -0
- package/dist/components/assistant-ui/elements/prompt-library.d.ts +20 -0
- package/dist/components/assistant-ui/elements/prompt-library.js +121 -0
- package/dist/components/assistant-ui/elements/question-flow.d.ts +24 -0
- package/dist/components/assistant-ui/elements/question-flow.js +180 -0
- package/dist/components/assistant-ui/elements/quota-banner.d.ts +14 -0
- package/dist/components/assistant-ui/elements/quota-banner.js +68 -0
- package/dist/components/assistant-ui/elements/quote-reply.d.ts +20 -0
- package/dist/components/assistant-ui/elements/quote-reply.js +66 -0
- package/dist/components/assistant-ui/elements/quote.aui.d.ts +61 -0
- package/dist/components/assistant-ui/elements/quote.aui.js +170 -0
- package/dist/components/assistant-ui/elements/read-aloud.d.ts +16 -0
- package/dist/components/assistant-ui/elements/read-aloud.js +66 -0
- package/dist/components/assistant-ui/elements/reasoning-effort.d.ts +17 -0
- package/dist/components/assistant-ui/elements/reasoning-effort.js +67 -0
- package/dist/components/assistant-ui/elements/reasoning-panel.d.ts +20 -0
- package/dist/components/assistant-ui/elements/reasoning-panel.js +60 -0
- package/dist/components/assistant-ui/elements/reasoning.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/reasoning.aui.js +70 -0
- package/dist/components/assistant-ui/elements/reasoning.d.ts +38 -0
- package/dist/components/assistant-ui/elements/reasoning.js +194 -0
- package/dist/components/assistant-ui/elements/recommendation-card.d.ts +16 -0
- package/dist/components/assistant-ui/elements/recommendation-card.js +65 -0
- package/dist/components/assistant-ui/elements/regenerate-menu.d.ts +18 -0
- package/dist/components/assistant-ui/elements/regenerate-menu.js +46 -0
- package/dist/components/assistant-ui/elements/research-report.d.ts +19 -0
- package/dist/components/assistant-ui/elements/research-report.js +63 -0
- package/dist/components/assistant-ui/elements/retrieval-chunks.d.ts +19 -0
- package/dist/components/assistant-ui/elements/retrieval-chunks.js +86 -0
- package/dist/components/assistant-ui/elements/reviewable-diff.d.ts +21 -0
- package/dist/components/assistant-ui/elements/reviewable-diff.js +104 -0
- package/dist/components/assistant-ui/elements/schedule-card.d.ts +19 -0
- package/dist/components/assistant-ui/elements/schedule-card.js +80 -0
- package/dist/components/assistant-ui/elements/score-breakdown.d.ts +19 -0
- package/dist/components/assistant-ui/elements/score-breakdown.js +107 -0
- package/dist/components/assistant-ui/elements/scroll-anchor.d.ts +15 -0
- package/dist/components/assistant-ui/elements/scroll-anchor.js +104 -0
- package/dist/components/assistant-ui/elements/settings-panel.d.ts +23 -0
- package/dist/components/assistant-ui/elements/settings-panel.js +108 -0
- package/dist/components/assistant-ui/elements/shared-conversation.d.ts +18 -0
- package/dist/components/assistant-ui/elements/shared-conversation.js +56 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.aui.d.ts +29 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.aui.js +31 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.d.ts +26 -0
- package/dist/components/assistant-ui/elements/shiki-highlighter.js +49 -0
- package/dist/components/assistant-ui/elements/sources.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/sources.aui.js +121 -0
- package/dist/components/assistant-ui/elements/sources.d.ts +21 -0
- package/dist/components/assistant-ui/elements/sources.js +109 -0
- package/dist/components/assistant-ui/elements/speaker-identity.d.ts +17 -0
- package/dist/components/assistant-ui/elements/speaker-identity.js +45 -0
- package/dist/components/assistant-ui/elements/spec-sheet.d.ts +17 -0
- package/dist/components/assistant-ui/elements/spec-sheet.js +39 -0
- package/dist/components/assistant-ui/elements/stopped-run.d.ts +12 -0
- package/dist/components/assistant-ui/elements/stopped-run.js +44 -0
- package/dist/components/assistant-ui/elements/streaming-text.d.ts +15 -0
- package/dist/components/assistant-ui/elements/streaming-text.js +45 -0
- package/dist/components/assistant-ui/elements/subagent-list.d.ts +17 -0
- package/dist/components/assistant-ui/elements/subagent-list.js +74 -0
- package/dist/components/assistant-ui/elements/suggestions.d.ts +14 -0
- package/dist/components/assistant-ui/elements/suggestions.js +25 -0
- package/dist/components/assistant-ui/elements/surfaces.d.ts +42 -0
- package/dist/components/assistant-ui/elements/surfaces.js +87 -0
- package/dist/components/assistant-ui/elements/syntax-highlighter.d.ts +7 -0
- package/dist/components/assistant-ui/elements/syntax-highlighter.js +41 -0
- package/dist/components/assistant-ui/elements/task-card.aui.d.ts +24 -0
- package/dist/components/assistant-ui/elements/task-card.aui.js +136 -0
- package/dist/components/assistant-ui/elements/task-card.d.ts +22 -0
- package/dist/components/assistant-ui/elements/task-card.js +104 -0
- package/dist/components/assistant-ui/elements/terminal-block.d.ts +27 -0
- package/dist/components/assistant-ui/elements/terminal-block.js +266 -0
- package/dist/components/assistant-ui/elements/thinking-indicator.d.ts +10 -0
- package/dist/components/assistant-ui/elements/thinking-indicator.js +30 -0
- package/dist/components/assistant-ui/elements/thread-list.aui.d.ts +39 -0
- package/dist/components/assistant-ui/elements/thread-list.aui.js +331 -0
- package/dist/components/assistant-ui/elements/thread-list.d.ts +19 -0
- package/dist/components/assistant-ui/elements/thread-list.js +72 -0
- package/dist/components/assistant-ui/elements/thread-search.d.ts +20 -0
- package/dist/components/assistant-ui/elements/thread-search.js +94 -0
- package/dist/components/assistant-ui/elements/thread.aui.d.ts +36 -0
- package/dist/components/assistant-ui/elements/thread.aui.js +625 -0
- package/dist/components/assistant-ui/elements/threadlist-sidebar.aui.d.ts +19 -0
- package/dist/components/assistant-ui/elements/threadlist-sidebar.aui.js +75 -0
- package/dist/components/assistant-ui/elements/timeline.d.ts +18 -0
- package/dist/components/assistant-ui/elements/timeline.js +40 -0
- package/dist/components/assistant-ui/elements/todo-list.d.ts +21 -0
- package/dist/components/assistant-ui/elements/todo-list.js +100 -0
- package/dist/components/assistant-ui/elements/tool-call.d.ts +17 -0
- package/dist/components/assistant-ui/elements/tool-call.js +70 -0
- package/dist/components/assistant-ui/elements/tool-error.d.ts +16 -0
- package/dist/components/assistant-ui/elements/tool-error.js +62 -0
- package/dist/components/assistant-ui/elements/tool-fallback.aui.d.ts +44 -0
- package/dist/components/assistant-ui/elements/tool-fallback.aui.js +542 -0
- package/dist/components/assistant-ui/elements/tool-group.aui.d.ts +37 -0
- package/dist/components/assistant-ui/elements/tool-group.aui.js +104 -0
- package/dist/components/assistant-ui/elements/tool-group.d.ts +20 -0
- package/dist/components/assistant-ui/elements/tool-group.js +71 -0
- package/dist/components/assistant-ui/elements/tool-timeline.d.ts +44 -0
- package/dist/components/assistant-ui/elements/tool-timeline.js +109 -0
- package/dist/components/assistant-ui/elements/tooltip-icon-button.d.ts +12 -0
- package/dist/components/assistant-ui/elements/tooltip-icon-button.js +30 -0
- package/dist/components/assistant-ui/elements/trace-waterfall.d.ts +33 -0
- package/dist/components/assistant-ui/elements/trace-waterfall.js +102 -0
- package/dist/components/assistant-ui/elements/typing-indicator.d.ts +9 -0
- package/dist/components/assistant-ui/elements/typing-indicator.js +45 -0
- package/dist/components/assistant-ui/elements/voice-conversation.aui.d.ts +11 -0
- package/dist/components/assistant-ui/elements/voice-conversation.aui.js +54 -0
- package/dist/components/assistant-ui/elements/voice-conversation.d.ts +21 -0
- package/dist/components/assistant-ui/elements/voice-conversation.js +110 -0
- package/dist/components/assistant-ui/elements/voice.aui.d.ts +22 -0
- package/dist/components/assistant-ui/elements/voice.aui.js +100 -0
- package/dist/components/assistant-ui/elements/voice.d.ts +15 -0
- package/dist/components/assistant-ui/elements/voice.js +400 -0
- package/dist/components/assistant-ui/elements/web-preview.d.ts +18 -0
- package/dist/components/assistant-ui/elements/web-preview.js +61 -0
- package/dist/components/assistant-ui/elements/web-search.d.ts +17 -0
- package/dist/components/assistant-ui/elements/web-search.js +54 -0
- package/dist/components/assistant-ui/utils/href.d.ts +13 -0
- package/dist/components/assistant-ui/utils/href.js +39 -0
- package/dist/components/assistant-ui/utils/range.d.ts +22 -0
- package/dist/components/assistant-ui/utils/range.js +48 -0
- package/dist/components/assistant-ui/utils/task.d.ts +14 -0
- package/dist/components/assistant-ui/utils/task.js +75 -0
- package/dist/components/icons/github.js +13 -0
- package/dist/components/theme-provider.d.ts +16 -0
- package/dist/components/theme-provider.js +116 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.js +53 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert-dialog.js +93 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +42 -0
- package/dist/components/ui/aspect-ratio.d.ts +6 -0
- package/dist/components/ui/aspect-ratio.js +13 -0
- package/dist/components/ui/attachment.d.ts +25 -0
- package/dist/components/ui/attachment.js +103 -0
- package/dist/components/ui/avatar.d.ts +13 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/badge.d.ts +14 -0
- package/dist/components/ui/badge.js +30 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.js +71 -0
- package/dist/components/ui/bubble.d.ts +18 -0
- package/dist/components/ui/bubble.js +72 -0
- package/dist/components/ui/button-group.d.ts +12 -0
- package/dist/components/ui/button-group.js +41 -0
- package/dist/components/ui/button.d.ts +19 -0
- package/dist/components/ui/button.js +71 -0
- package/dist/components/ui/calendar.d.ts +12 -0
- package/dist/components/ui/calendar.js +108 -0
- package/dist/components/ui/card.d.ts +13 -0
- package/dist/components/ui/card.js +55 -0
- package/dist/components/ui/carousel.d.ts +30 -0
- package/dist/components/ui/carousel.js +131 -0
- package/dist/components/ui/chart.d.ts +46 -0
- package/dist/components/ui/chart.js +148 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.js +20 -0
- package/dist/components/ui/collapsible.d.ts +7 -0
- package/dist/components/ui/collapsible.js +23 -0
- package/dist/components/ui/combobox.d.ts +26 -0
- package/dist/components/ui/combobox.js +161 -0
- package/dist/components/ui/command.d.ts +21 -0
- package/dist/components/ui/command.js +87 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +132 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dialog.js +91 -0
- package/dist/components/ui/diff-viewer.d.ts +100 -0
- package/dist/components/ui/diff-viewer.js +461 -0
- package/dist/components/ui/direction.d.ts +2 -0
- package/dist/components/ui/direction.js +2 -0
- package/dist/components/ui/dot-matrix.d.ts +150 -0
- package/dist/components/ui/dot-matrix.js +248 -0
- package/dist/components/ui/drawer.d.ts +18 -0
- package/dist/components/ui/drawer.js +123 -0
- package/dist/components/ui/dropdown-menu.d.ts +31 -0
- package/dist/components/ui/dropdown-menu.js +136 -0
- package/dist/components/ui/empty.d.ts +13 -0
- package/dist/components/ui/empty.js +59 -0
- package/dist/components/ui/field.d.ts +26 -0
- package/dist/components/ui/field.js +109 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.js +36 -0
- package/dist/components/ui/input-group.d.ts +20 -0
- package/dist/components/ui/input-group.js +77 -0
- package/dist/components/ui/input-otp.d.ts +13 -0
- package/dist/components/ui/input-otp.js +46 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/item.d.ts +24 -0
- package/dist/components/ui/item.js +120 -0
- package/dist/components/ui/kbd.d.ts +5 -0
- package/dist/components/ui/kbd.js +19 -0
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.js +12 -0
- package/dist/components/ui/marker.d.ts +12 -0
- package/dist/components/ui/marker.js +42 -0
- package/dist/components/ui/menubar.d.ts +31 -0
- package/dist/components/ui/menubar.js +135 -0
- package/dist/components/ui/message-scroller.d.ts +12 -0
- package/dist/components/ui/message-scroller.js +59 -0
- package/dist/components/ui/message.d.ts +12 -0
- package/dist/components/ui/message.js +48 -0
- package/dist/components/ui/native-select.d.ts +10 -0
- package/dist/components/ui/native-select.js +37 -0
- package/dist/components/ui/navigation-menu.d.ts +13 -0
- package/dist/components/ui/navigation-menu.js +82 -0
- package/dist/components/ui/number-roll.d.ts +21 -0
- package/dist/components/ui/number-roll.js +269 -0
- package/dist/components/ui/pagination.d.ts +19 -0
- package/dist/components/ui/pagination.js +79 -0
- package/dist/components/ui/popover.d.ts +11 -0
- package/dist/components/ui/popover.js +54 -0
- package/dist/components/ui/progress.d.ts +9 -0
- package/dist/components/ui/progress.js +44 -0
- package/dist/components/ui/questionnaire.d.ts +21 -0
- package/dist/components/ui/questionnaire.js +169 -0
- package/dist/components/ui/radio-group.d.ts +7 -0
- package/dist/components/ui/radio-group.js +26 -0
- package/dist/components/ui/resizable.d.ts +9 -0
- package/dist/components/ui/resizable.js +28 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.js +35 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +96 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.js +14 -0
- package/dist/components/ui/sheet.d.ts +16 -0
- package/dist/components/ui/sheet.js +87 -0
- package/dist/components/ui/sidebar.d.ts +65 -0
- package/dist/components/ui/sidebar.js +386 -0
- package/dist/components/ui/skeleton.d.ts +4 -0
- package/dist/components/ui/skeleton.js +12 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/slider.js +33 -0
- package/dist/components/ui/spinner.d.ts +4 -0
- package/dist/components/ui/spinner.js +15 -0
- package/dist/components/ui/switch.d.ts +7 -0
- package/dist/components/ui/switch.js +19 -0
- package/dist/components/ui/table.d.ts +12 -0
- package/dist/components/ui/table.js +65 -0
- package/dist/components/ui/tabs.d.ts +12 -0
- package/dist/components/ui/tabs.js +45 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/toast.d.ts +18 -0
- package/dist/components/ui/toast.js +121 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.js +51 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/toggle.js +35 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.js +43 -0
- package/dist/compositions/app-rail/app-rail.d.ts +19 -0
- package/dist/compositions/app-rail/app-rail.js +58 -0
- package/dist/compositions/app-shell/app-shell.d.ts +56 -0
- package/dist/compositions/app-shell/app-shell.js +143 -0
- package/dist/compositions/app-shell/theme-toggle.d.ts +10 -0
- package/dist/compositions/app-shell/theme-toggle.js +65 -0
- package/dist/compositions/confirm-action/confirm-action.d.ts +48 -0
- package/dist/compositions/confirm-action/confirm-action.js +48 -0
- package/dist/compositions/data-table/data-table-state.d.ts +23 -0
- package/dist/compositions/data-table/data-table-state.js +46 -0
- package/dist/compositions/data-table/data-table.d.ts +185 -0
- package/dist/compositions/data-table/data-table.js +615 -0
- package/dist/compositions/date-range-picker/date-range-options.d.ts +28 -0
- package/dist/compositions/date-range-picker/date-range-options.js +61 -0
- package/dist/compositions/date-range-picker/date-range-picker.d.ts +55 -0
- package/dist/compositions/date-range-picker/date-range-picker.js +409 -0
- package/dist/compositions/decision-queue/decision-queue.d.ts +114 -0
- package/dist/compositions/decision-queue/decision-queue.js +478 -0
- package/dist/compositions/event-feed/event-feed.d.ts +59 -0
- package/dist/compositions/event-feed/event-feed.js +105 -0
- package/dist/compositions/feedback.d.ts +20 -0
- package/dist/compositions/feedback.js +49 -0
- package/dist/compositions/fields.d.ts +64 -0
- package/dist/compositions/fields.js +293 -0
- package/dist/compositions/form-kit/form-context.d.ts +10 -0
- package/dist/compositions/form-kit/form-context.js +12 -0
- package/dist/compositions/form-kit/form-fields.d.ts +95 -0
- package/dist/compositions/form-kit/form-fields.js +233 -0
- package/dist/compositions/form-kit/form-kit.d.ts +128 -0
- package/dist/compositions/form-kit/form-kit.js +119 -0
- package/dist/compositions/inspector/inspector.d.ts +53 -0
- package/dist/compositions/inspector/inspector.js +80 -0
- package/dist/compositions/layout.d.ts +36 -0
- package/dist/compositions/layout.js +86 -0
- package/dist/compositions/state-blocks/state-blocks.d.ts +42 -0
- package/dist/compositions/state-blocks/state-blocks.js +81 -0
- package/dist/compositions/status-panel/status-panel.d.ts +94 -0
- package/dist/compositions/status-panel/status-panel.js +189 -0
- package/dist/fonts/InterVariable.woff2 +0 -0
- package/dist/fonts/inter.css +15 -0
- package/dist/hooks/use-attachment-src.js +35 -0
- package/dist/hooks/use-copy-to-clipboard.js +34 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +102 -0
- package/dist/lib/context-level.js +7 -0
- package/dist/lib/elapsed.js +61 -0
- package/dist/lib/iso-date.js +30 -0
- package/dist/lib/motion-loop.js +41 -0
- package/dist/lib/pointer.js +14 -0
- package/dist/lib/status-tone.d.ts +7 -0
- package/dist/lib/status-tone.js +55 -0
- package/dist/lib/triage-keys.js +229 -0
- package/dist/lib/utils.js +2 -0
- package/dist/motion/alert-toast/alert-toast.d.ts +51 -0
- package/dist/motion/alert-toast/alert-toast.js +226 -0
- package/dist/motion/branch-menu/branch-menu.d.ts +47 -0
- package/dist/motion/branch-menu/branch-menu.js +287 -0
- package/dist/motion/check-item/check-item.d.ts +24 -0
- package/dist/motion/check-item/check-item.js +110 -0
- package/dist/motion/dial/dial.d.ts +39 -0
- package/dist/motion/dial/dial.js +290 -0
- package/dist/motion/dictation-button/dictation-button.d.ts +45 -0
- package/dist/motion/dictation-button/dictation-button.js +232 -0
- package/dist/motion/hold-button/hold-button.d.ts +37 -0
- package/dist/motion/hold-button/hold-button.js +192 -0
- package/dist/motion/masonry-grid/masonry-grid.d.ts +42 -0
- package/dist/motion/masonry-grid/masonry-grid.js +145 -0
- package/dist/motion/prompt-composer/prompt-composer.d.ts +90 -0
- package/dist/motion/prompt-composer/prompt-composer.js +374 -0
- package/dist/motion/scrub-select/scrub-select.d.ts +33 -0
- package/dist/motion/scrub-select/scrub-select.js +346 -0
- package/dist/motion/spotlight-grid/spotlight-grid.d.ts +40 -0
- package/dist/motion/spotlight-grid/spotlight-grid.js +171 -0
- package/dist/motion/star-rating/star-rating.d.ts +32 -0
- package/dist/motion/star-rating/star-rating.js +191 -0
- package/dist/motion/status-glyph/status-glyph.d.ts +28 -0
- package/dist/motion/status-glyph/status-glyph.js +171 -0
- package/dist/motion/stepper/stepper.d.ts +56 -0
- package/dist/motion/stepper/stepper.js +211 -0
- package/dist/motion/swipe-row/swipe-row.d.ts +52 -0
- package/dist/motion/swipe-row/swipe-row.js +208 -0
- package/dist/motion/thinking-trace/thinking-trace.d.ts +32 -0
- package/dist/motion/thinking-trace/thinking-trace.js +186 -0
- package/dist/motion/tool-call-chip/tool-call-chip.d.ts +36 -0
- package/dist/motion/tool-call-chip/tool-call-chip.js +135 -0
- package/dist/motion/working-indicator/working-indicator.d.ts +38 -0
- package/dist/motion/working-indicator/working-indicator.js +171 -0
- package/dist/styles.css +828 -0
- package/dist/tokens.css +230 -0
- package/licenses/Inter-OFL.txt +92 -0
- package/licenses/assistant-ui-MIT.txt +21 -0
- package/licenses/shadcn-MIT.md +21 -0
- package/package.json +131 -3
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { Alert, AlertAction, AlertDescription, AlertTitle } from "../../components/ui/alert.js";
|
|
2
|
+
import { Spinner } from "../../components/ui/spinner.js";
|
|
3
|
+
import { Button } from "../../components/ui/button.js";
|
|
4
|
+
import { Badge } from "../../components/ui/badge.js";
|
|
5
|
+
import { ButtonGroup } from "../../components/ui/button-group.js";
|
|
6
|
+
import { Card, CardContent, CardHeader } from "../../components/ui/card.js";
|
|
7
|
+
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../../components/ui/empty.js";
|
|
8
|
+
import { Item, ItemActions, ItemContent, ItemDescription, ItemTitle } from "../../components/ui/item.js";
|
|
9
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
10
|
+
import { ConfirmAction } from "../confirm-action/confirm-action.js";
|
|
11
|
+
import { TRIAGE_TARGET_ATTRIBUTE, TriageKbd, TriageKeyHints, triageShortcuts, useTriageKeyboard } from "../../lib/triage-keys.js";
|
|
12
|
+
import * as React from "react";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { cn } from "cn";
|
|
15
|
+
import { AlertCircleIcon, ChevronRightIcon } from "lucide-react";
|
|
16
|
+
import { useControllableValue, useLatest, useMap } from "ahooks";
|
|
17
|
+
//#region src/compositions/decision-queue/decision-queue.tsx
|
|
18
|
+
const groupKey = (groupId) => `group:${groupId}`;
|
|
19
|
+
const itemKey = (itemId) => `item:${itemId}`;
|
|
20
|
+
function plural(count, noun, localized = false) {
|
|
21
|
+
return `${localized ? count.toLocaleString() : count} ${noun}${count === 1 ? "" : "s"}`;
|
|
22
|
+
}
|
|
23
|
+
function defaultConsequence(label, { count, group }) {
|
|
24
|
+
return `"${label}" will apply to ${plural(count, "item")} in ${group.title}.`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The items a target should fall back to when the one the cursor was on is
|
|
28
|
+
* gone (decided and refetched, or its group collapsed): the first item at or
|
|
29
|
+
* after the old position, else the last item, else any target there.
|
|
30
|
+
*/
|
|
31
|
+
function fallbackIndex(targets, previousIndex) {
|
|
32
|
+
if (targets.length === 0) return -1;
|
|
33
|
+
const start = Math.min(Math.max(previousIndex, 0), targets.length - 1);
|
|
34
|
+
for (let index = start; index < targets.length; index += 1) if (targets[index]?.kind === "item") return index;
|
|
35
|
+
for (let index = start - 1; index >= 0; index -= 1) if (targets[index]?.kind === "item") return index;
|
|
36
|
+
return start;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Grouped items for per-item or bulk decisions, operable entirely from the
|
|
40
|
+
* keyboard: `j`/`k` or the arrow keys move the cursor across group headers and
|
|
41
|
+
* items, Enter on a group header expands or collapses it, and `keymap` keys
|
|
42
|
+
* decide. Keys are ignored while focus is in a text field. Destructive and
|
|
43
|
+
* bulk decisions go through ConfirmAction first. A failed decision shows its
|
|
44
|
+
* error in the queue until the owner dismisses it. In a queue narrower than
|
|
45
|
+
* 32rem (a phone) each item stacks, its decisions span its width at touch
|
|
46
|
+
* size, and the key hints are hidden; on a touch screen they are hidden at
|
|
47
|
+
* any width.
|
|
48
|
+
*/
|
|
49
|
+
function DecisionQueue(props) {
|
|
50
|
+
const { groups, decisions, onDecide, bulk = false, defaultCollapsed = false, keymap, isPending, decisionError, onDismissDecisionError, label = "Decision queue", isLoading = false, error, emptyLabel = "Nothing to decide", className } = props;
|
|
51
|
+
const baseId = React.useId();
|
|
52
|
+
const lastIndex = React.useRef(0);
|
|
53
|
+
const [focusedItemId, setFocusedItemId] = useControllableValue(props, {
|
|
54
|
+
valuePropName: "focusedId",
|
|
55
|
+
defaultValuePropName: "defaultFocusedId",
|
|
56
|
+
trigger: "onFocusChange",
|
|
57
|
+
defaultValue: null
|
|
58
|
+
});
|
|
59
|
+
const [headerFocus, setHeaderFocus] = React.useState(null);
|
|
60
|
+
const [collapseRule] = React.useState(() => defaultCollapsed === true ? true : new Set(defaultCollapsed || []));
|
|
61
|
+
const [toggled, { set: setToggled }] = useMap();
|
|
62
|
+
const isCollapsed = React.useCallback((groupId) => toggled.get(groupId) ?? (collapseRule === true || collapseRule.has(groupId)), [toggled, collapseRule]);
|
|
63
|
+
const [confirmation, setConfirmation] = React.useState(null);
|
|
64
|
+
const [confirmOpen, setConfirmOpen] = React.useState(false);
|
|
65
|
+
const pending = React.useCallback((itemId) => isPending?.(itemId) ?? false, [isPending]);
|
|
66
|
+
const decisionsByKey = React.useMemo(() => new Map(decisions.map((decision) => [decision.key, decision])), [decisions]);
|
|
67
|
+
const bulkDecisions = React.useMemo(() => decisions.filter((decision) => decision.bulk !== false), [decisions]);
|
|
68
|
+
const shortcutsByDecision = React.useMemo(() => triageShortcuts(keymap, (decision) => decisionsByKey.has(decision)), [keymap, decisionsByKey]);
|
|
69
|
+
const targets = React.useMemo(() => {
|
|
70
|
+
const list = [];
|
|
71
|
+
for (const group of groups) {
|
|
72
|
+
list.push({
|
|
73
|
+
kind: "group",
|
|
74
|
+
key: groupKey(group.id),
|
|
75
|
+
group
|
|
76
|
+
});
|
|
77
|
+
if (isCollapsed(group.id)) continue;
|
|
78
|
+
group.items.forEach((item, index) => {
|
|
79
|
+
list.push({
|
|
80
|
+
kind: "item",
|
|
81
|
+
key: itemKey(item.id),
|
|
82
|
+
group,
|
|
83
|
+
item,
|
|
84
|
+
position: index + 1
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return list;
|
|
89
|
+
}, [groups, isCollapsed]);
|
|
90
|
+
const intendedKey = headerFocus && headerFocus.itemId === focusedItemId ? groupKey(headerFocus.groupId) : focusedItemId != null ? itemKey(focusedItemId) : null;
|
|
91
|
+
let activeIndex = intendedKey ? targets.findIndex((target) => target.key === intendedKey) : -1;
|
|
92
|
+
const intendedMissing = intendedKey !== null && activeIndex === -1;
|
|
93
|
+
if (intendedMissing) activeIndex = fallbackIndex(targets, lastIndex.current);
|
|
94
|
+
else if (activeIndex === -1) {
|
|
95
|
+
activeIndex = targets.findIndex((target) => target.kind === "item");
|
|
96
|
+
if (activeIndex === -1) activeIndex = targets.length > 0 ? 0 : -1;
|
|
97
|
+
}
|
|
98
|
+
const active = activeIndex >= 0 ? targets[activeIndex] : void 0;
|
|
99
|
+
const activeKey = useLatest(active?.key);
|
|
100
|
+
const failedIds = React.useMemo(() => new Set(decisionError?.itemIds ?? []), [decisionError]);
|
|
101
|
+
const failedGroupId = decisionError ? groups.find((group) => group.items.some((item) => failedIds.has(item.id)))?.id ?? null : null;
|
|
102
|
+
const failureId = `${baseId}-decision-error`;
|
|
103
|
+
const describe = React.useCallback((target) => {
|
|
104
|
+
if (target.kind === "item") return `${target.position} of ${target.group.items.length} in ${target.group.title}`;
|
|
105
|
+
return `${target.group.title}, ${plural(target.group.items.length, "item")}`;
|
|
106
|
+
}, []);
|
|
107
|
+
const activate = React.useCallback((target) => {
|
|
108
|
+
if (target.kind === "group") {
|
|
109
|
+
setHeaderFocus({
|
|
110
|
+
groupId: target.group.id,
|
|
111
|
+
itemId: focusedItemId
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
setHeaderFocus(null);
|
|
116
|
+
if (focusedItemId !== target.item.id) setFocusedItemId(target.item.id);
|
|
117
|
+
}, [focusedItemId, setFocusedItemId]);
|
|
118
|
+
const findTarget = (key) => key === null ? void 0 : targets.find((target) => target.key === key);
|
|
119
|
+
const { containerRef, registerTarget, targetElement, targetKeyOf, focusLost, cursorVisible, announcement, announce, handlers } = useTriageKeyboard({
|
|
120
|
+
keymap,
|
|
121
|
+
hasAction: (decision) => decisionsByKey.has(decision),
|
|
122
|
+
activeKey: active?.key ?? null,
|
|
123
|
+
modalOpen: confirmOpen,
|
|
124
|
+
onAction: (key, targetKey) => {
|
|
125
|
+
const decision = decisionsByKey.get(key);
|
|
126
|
+
const target = findTarget(targetKey);
|
|
127
|
+
if (!decision || !target) return;
|
|
128
|
+
if (target.kind === "item") decide([target.item.id], decision, target.group, false);
|
|
129
|
+
else if (bulk && target.group.bulk !== false && decision.bulk !== false) decide(target.group.items.map((item) => item.id), decision, target.group, true);
|
|
130
|
+
},
|
|
131
|
+
onStep: (fromKey, step) => {
|
|
132
|
+
const current = findTarget(fromKey);
|
|
133
|
+
const index = current ? targets.indexOf(current) : -1;
|
|
134
|
+
const next = targets[Math.min(Math.max(index + step, 0), targets.length - 1)];
|
|
135
|
+
if (next) focusTarget(next);
|
|
136
|
+
},
|
|
137
|
+
onOtherKey: (event, element) => {
|
|
138
|
+
if (event.key !== "Enter") return false;
|
|
139
|
+
const target = findTarget(targetKeyOf(element));
|
|
140
|
+
if (target?.kind === "group" && element.getAttribute("data-queue-target") === target.key) {
|
|
141
|
+
toggleGroup(target.group);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
return false;
|
|
145
|
+
},
|
|
146
|
+
onFocusTarget: (key, entered) => {
|
|
147
|
+
const target = findTarget(key);
|
|
148
|
+
if (!target) return;
|
|
149
|
+
activate(target);
|
|
150
|
+
if (entered) announce(describe(target));
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
lastIndex.current = Math.max(activeIndex, 0);
|
|
155
|
+
if (!active) return;
|
|
156
|
+
if (intendedMissing) {
|
|
157
|
+
activate(active);
|
|
158
|
+
announce(describe(active));
|
|
159
|
+
}
|
|
160
|
+
const element = targetElement(active.key);
|
|
161
|
+
if (element && focusLost()) {
|
|
162
|
+
activate(active);
|
|
163
|
+
announce(describe(active));
|
|
164
|
+
element.focus();
|
|
165
|
+
}
|
|
166
|
+
}, [
|
|
167
|
+
activeIndex,
|
|
168
|
+
intendedMissing,
|
|
169
|
+
active,
|
|
170
|
+
activate,
|
|
171
|
+
describe,
|
|
172
|
+
announce,
|
|
173
|
+
targetElement,
|
|
174
|
+
focusLost
|
|
175
|
+
]);
|
|
176
|
+
const focusTarget = (target) => {
|
|
177
|
+
activate(target);
|
|
178
|
+
announce(describe(target));
|
|
179
|
+
targetElement(target.key)?.focus();
|
|
180
|
+
};
|
|
181
|
+
const toggleGroup = (group) => {
|
|
182
|
+
const collapse = !isCollapsed(group.id);
|
|
183
|
+
setToggled(group.id, collapse);
|
|
184
|
+
announce(`${group.title} ${collapse ? "collapsed" : "expanded"}`);
|
|
185
|
+
};
|
|
186
|
+
const decide = (itemIds, decision, group, isBulk) => {
|
|
187
|
+
if (itemIds.length === 0 || itemIds.some(pending)) return;
|
|
188
|
+
if (decision.destructive || isBulk) {
|
|
189
|
+
setConfirmation({
|
|
190
|
+
itemIds,
|
|
191
|
+
decision,
|
|
192
|
+
group,
|
|
193
|
+
bulk: isBulk
|
|
194
|
+
});
|
|
195
|
+
setConfirmOpen(true);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
onDecide(itemIds, decision.key);
|
|
199
|
+
};
|
|
200
|
+
const dismissFailure = () => {
|
|
201
|
+
if (activeKey.current) targetElement(activeKey.current)?.focus();
|
|
202
|
+
onDismissDecisionError?.();
|
|
203
|
+
};
|
|
204
|
+
const failureAlert = (failure) => /* @__PURE__ */ jsxs(Alert, {
|
|
205
|
+
variant: "destructive",
|
|
206
|
+
"data-slot": "decision-queue-decision-error",
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": "true" }),
|
|
209
|
+
/* @__PURE__ */ jsxs(AlertTitle, { children: ["Decision failed for ", plural(failure.itemIds.length, "item")] }),
|
|
210
|
+
/* @__PURE__ */ jsx(AlertDescription, {
|
|
211
|
+
id: failureId,
|
|
212
|
+
children: failure.message
|
|
213
|
+
}),
|
|
214
|
+
onDismissDecisionError ? /* @__PURE__ */ jsx(AlertAction, { children: /* @__PURE__ */ jsx(Button, {
|
|
215
|
+
type: "button",
|
|
216
|
+
size: "xs",
|
|
217
|
+
variant: "outline",
|
|
218
|
+
className: "text-foreground",
|
|
219
|
+
onClick: dismissFailure,
|
|
220
|
+
children: "Dismiss"
|
|
221
|
+
}) }) : null
|
|
222
|
+
]
|
|
223
|
+
});
|
|
224
|
+
const decisionButtons = (group, itemIds, isBulk, disabled, tabbable) => (isBulk ? bulkDecisions : decisions).map((decision) => {
|
|
225
|
+
const shortcuts = shortcutsByDecision.get(decision.key) ?? [];
|
|
226
|
+
return /* @__PURE__ */ jsxs(Button, {
|
|
227
|
+
type: "button",
|
|
228
|
+
size: "sm",
|
|
229
|
+
variant: decision.tone ?? "outline",
|
|
230
|
+
className: cn("pointer-coarse:h-8 @max-lg/decision-queue:h-8", !isBulk && "@max-lg/decision-queue:flex-1", decision.tone === void 0 && decision.destructive && "text-destructive hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/20"),
|
|
231
|
+
disabled,
|
|
232
|
+
tabIndex: tabbable ? 0 : -1,
|
|
233
|
+
"aria-keyshortcuts": shortcuts.length > 0 ? shortcuts.join(" ") : void 0,
|
|
234
|
+
onClick: () => decide(itemIds, decision, group, isBulk),
|
|
235
|
+
children: [isBulk ? `${decision.label} all` : decision.label, !isBulk && shortcuts[0] ? /* @__PURE__ */ jsx(TriageKbd, {
|
|
236
|
+
shortcut: shortcuts[0],
|
|
237
|
+
className: "@max-lg/decision-queue:hidden"
|
|
238
|
+
}) : null]
|
|
239
|
+
}, decision.key);
|
|
240
|
+
});
|
|
241
|
+
const totalItems = groups.reduce((sum, group) => sum + group.items.length, 0);
|
|
242
|
+
const hintId = `${baseId}-hint`;
|
|
243
|
+
const confirmCount = confirmation?.itemIds.length ?? 0;
|
|
244
|
+
const confirmLabel = confirmation?.decision.label ?? "";
|
|
245
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
246
|
+
ref: containerRef,
|
|
247
|
+
"aria-label": label,
|
|
248
|
+
"aria-describedby": hintId,
|
|
249
|
+
"aria-busy": isLoading || void 0,
|
|
250
|
+
"data-slot": "decision-queue",
|
|
251
|
+
className: cn("@container/decision-queue flex w-full flex-col gap-3 text-xs/relaxed", className),
|
|
252
|
+
...handlers,
|
|
253
|
+
children: [
|
|
254
|
+
/* @__PURE__ */ jsx(TriageKeyHints, {
|
|
255
|
+
id: hintId,
|
|
256
|
+
hidden: totalItems === 0,
|
|
257
|
+
"data-slot": "decision-queue-hint",
|
|
258
|
+
keymap,
|
|
259
|
+
className: "@max-lg/decision-queue:hidden",
|
|
260
|
+
hints: [{
|
|
261
|
+
key: "Enter",
|
|
262
|
+
label: "expand or collapse a group"
|
|
263
|
+
}, ...decisions.flatMap((decision) => {
|
|
264
|
+
const shortcut = shortcutsByDecision.get(decision.key)?.[0];
|
|
265
|
+
return shortcut ? [{
|
|
266
|
+
key: shortcut,
|
|
267
|
+
label: decision.label.toLowerCase()
|
|
268
|
+
}] : [];
|
|
269
|
+
})]
|
|
270
|
+
}),
|
|
271
|
+
/* @__PURE__ */ jsx("div", {
|
|
272
|
+
"aria-live": "polite",
|
|
273
|
+
"aria-atomic": "true",
|
|
274
|
+
className: "sr-only",
|
|
275
|
+
children: announcement
|
|
276
|
+
}),
|
|
277
|
+
error ? /* @__PURE__ */ jsxs(Alert, {
|
|
278
|
+
variant: "destructive",
|
|
279
|
+
"data-slot": "decision-queue-error",
|
|
280
|
+
children: [/* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": "true" }), /* @__PURE__ */ jsx(AlertTitle, { children: error })]
|
|
281
|
+
}) : null,
|
|
282
|
+
decisionError && failedGroupId === null ? failureAlert(decisionError) : null,
|
|
283
|
+
isLoading && groups.length === 0 ? /* @__PURE__ */ jsx(Card, {
|
|
284
|
+
size: "sm",
|
|
285
|
+
"data-slot": "decision-queue-loading",
|
|
286
|
+
children: /* @__PURE__ */ jsxs(CardContent, {
|
|
287
|
+
className: "flex flex-col gap-2",
|
|
288
|
+
children: [
|
|
289
|
+
/* @__PURE__ */ jsx("span", {
|
|
290
|
+
className: "sr-only",
|
|
291
|
+
children: "Loading"
|
|
292
|
+
}),
|
|
293
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" }),
|
|
294
|
+
[
|
|
295
|
+
0,
|
|
296
|
+
1,
|
|
297
|
+
2
|
|
298
|
+
].map((row) => /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }, row))
|
|
299
|
+
]
|
|
300
|
+
})
|
|
301
|
+
}) : null,
|
|
302
|
+
!isLoading && totalItems === 0 && !error ? /* @__PURE__ */ jsx(Empty, {
|
|
303
|
+
"data-slot": "decision-queue-empty",
|
|
304
|
+
className: "border",
|
|
305
|
+
children: /* @__PURE__ */ jsxs(EmptyHeader, { children: [/* @__PURE__ */ jsx(EmptyTitle, { children: emptyLabel }), /* @__PURE__ */ jsx(EmptyDescription, { children: "New items appear here as they arrive." })] })
|
|
306
|
+
}) : null,
|
|
307
|
+
totalItems > 0 ? groups.map((group) => {
|
|
308
|
+
const collapsed = isCollapsed(group.id);
|
|
309
|
+
const headerKey = groupKey(group.id);
|
|
310
|
+
const headerActive = active?.key === headerKey;
|
|
311
|
+
const listId = `${baseId}-${group.id}-items`;
|
|
312
|
+
const titleId = `${baseId}-${group.id}-title`;
|
|
313
|
+
const descriptionId = `${baseId}-${group.id}-description`;
|
|
314
|
+
const groupPending = group.items.some((item) => pending(item.id));
|
|
315
|
+
const countOverride = typeof group.count === "number" && Number.isInteger(group.count) && group.count >= 0 ? group.count : void 0;
|
|
316
|
+
const count = countOverride ?? group.items.length;
|
|
317
|
+
const titleRow = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
318
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
319
|
+
"aria-hidden": "true",
|
|
320
|
+
className: cn("size-3.5 shrink-0 text-muted-foreground transition-transform", !collapsed && "rotate-90")
|
|
321
|
+
}),
|
|
322
|
+
/* @__PURE__ */ jsx("span", {
|
|
323
|
+
id: titleId,
|
|
324
|
+
className: cn("truncate font-heading text-sm font-medium", (group.badges || group.headerAction) && "min-w-12"),
|
|
325
|
+
children: group.title
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
328
|
+
variant: "secondary",
|
|
329
|
+
children: countOverride !== void 0 ? count.toLocaleString() : count
|
|
330
|
+
})
|
|
331
|
+
] });
|
|
332
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
333
|
+
size: "sm",
|
|
334
|
+
"data-slot": "decision-queue-group",
|
|
335
|
+
role: "group",
|
|
336
|
+
"aria-labelledby": titleId,
|
|
337
|
+
className: "gap-2",
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ jsxs(CardHeader, {
|
|
340
|
+
"data-slot": "decision-queue-group-header",
|
|
341
|
+
"data-cursor": headerActive && cursorVisible || void 0,
|
|
342
|
+
className: "mx-2 -my-1 flex flex-wrap items-center gap-2 rounded-md px-1 py-1 transition-colors duration-100 data-cursor:bg-muted/50",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ jsxs("button", {
|
|
345
|
+
ref: registerTarget(headerKey),
|
|
346
|
+
type: "button",
|
|
347
|
+
[TRIAGE_TARGET_ATTRIBUTE]: headerKey,
|
|
348
|
+
"data-active": headerActive || void 0,
|
|
349
|
+
tabIndex: headerActive ? 0 : -1,
|
|
350
|
+
"aria-label": `${group.title}, ${plural(count, "item", countOverride !== void 0)}`,
|
|
351
|
+
"aria-describedby": group.description ? descriptionId : void 0,
|
|
352
|
+
"aria-expanded": !collapsed,
|
|
353
|
+
"aria-controls": collapsed ? void 0 : listId,
|
|
354
|
+
onClick: () => toggleGroup(group),
|
|
355
|
+
className: cn("flex min-w-0 grow basis-40 flex-wrap items-center gap-x-1.5 gap-y-0.5 rounded-md px-1 py-0.5 text-left outline-none", !group.badges && "@lg/decision-queue:flex-nowrap", group.headerAction && "@max-lg/decision-queue:basis-0"),
|
|
356
|
+
children: [
|
|
357
|
+
group.badges ? /* @__PURE__ */ jsx("span", {
|
|
358
|
+
className: "flex min-w-0 basis-full items-center gap-x-1.5",
|
|
359
|
+
children: titleRow
|
|
360
|
+
}) : titleRow,
|
|
361
|
+
group.badges ? /* @__PURE__ */ jsx("span", {
|
|
362
|
+
className: "flex min-w-0 basis-full flex-wrap items-center gap-1 pl-5 [&_[data-slot=badge]]:h-auto [&_[data-slot=badge]]:min-h-5 [&_[data-slot=badge]]:max-w-full [&_[data-slot=badge]]:wrap-anywhere [&_[data-slot=badge]]:whitespace-normal",
|
|
363
|
+
children: group.badges
|
|
364
|
+
}) : null,
|
|
365
|
+
group.description ? /* @__PURE__ */ jsx("span", {
|
|
366
|
+
id: descriptionId,
|
|
367
|
+
className: "basis-full pl-5 text-muted-foreground @lg/decision-queue:basis-auto @lg/decision-queue:truncate @lg/decision-queue:pl-0",
|
|
368
|
+
children: group.description
|
|
369
|
+
}) : null
|
|
370
|
+
]
|
|
371
|
+
}),
|
|
372
|
+
group.headerAction ? /* @__PURE__ */ jsx("div", {
|
|
373
|
+
[TRIAGE_TARGET_ATTRIBUTE]: headerKey,
|
|
374
|
+
className: "min-w-0 max-w-full shrink-0 @max-lg/decision-queue:self-start @max-lg/decision-queue:py-0.5",
|
|
375
|
+
children: group.headerAction
|
|
376
|
+
}) : null,
|
|
377
|
+
bulk && group.bulk !== false && bulkDecisions.length > 0 && group.items.length > 0 ? /* @__PURE__ */ jsx(ButtonGroup, {
|
|
378
|
+
"aria-label": `Decide all in ${group.title}`,
|
|
379
|
+
className: cn(group.headerAction && "@max-lg/decision-queue:basis-full"),
|
|
380
|
+
children: decisionButtons(group, group.items.map((item) => item.id), true, groupPending, headerActive)
|
|
381
|
+
}) : null
|
|
382
|
+
]
|
|
383
|
+
}),
|
|
384
|
+
decisionError && failedGroupId === group.id ? /* @__PURE__ */ jsx("div", {
|
|
385
|
+
className: "px-(--card-spacing)",
|
|
386
|
+
children: failureAlert(decisionError)
|
|
387
|
+
}) : null,
|
|
388
|
+
collapsed ? null : /* @__PURE__ */ jsx(CardContent, {
|
|
389
|
+
id: listId,
|
|
390
|
+
children: group.items.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
391
|
+
className: "pl-6 text-muted-foreground",
|
|
392
|
+
children: "No items"
|
|
393
|
+
}) : /* @__PURE__ */ jsx("ul", {
|
|
394
|
+
"aria-labelledby": titleId,
|
|
395
|
+
className: "flex flex-col gap-1",
|
|
396
|
+
children: group.items.map((item) => {
|
|
397
|
+
const key = itemKey(item.id);
|
|
398
|
+
const isActive = active?.key === key;
|
|
399
|
+
const isItemPending = pending(item.id);
|
|
400
|
+
const isFailed = failedIds.has(item.id);
|
|
401
|
+
const primaryId = `${baseId}-${item.id}-primary`;
|
|
402
|
+
const secondaryId = `${baseId}-${item.id}-secondary`;
|
|
403
|
+
const describedBy = [item.secondary ? secondaryId : null, isFailed ? failureId : null].filter(Boolean);
|
|
404
|
+
return /* @__PURE__ */ jsxs(Item, {
|
|
405
|
+
ref: registerTarget(key),
|
|
406
|
+
size: "sm",
|
|
407
|
+
variant: "outline",
|
|
408
|
+
render: /* @__PURE__ */ jsx("li", {}),
|
|
409
|
+
[TRIAGE_TARGET_ATTRIBUTE]: key,
|
|
410
|
+
"data-active": isActive || void 0,
|
|
411
|
+
"data-cursor": isActive && cursorVisible || void 0,
|
|
412
|
+
"data-pending": isItemPending || void 0,
|
|
413
|
+
"data-failed": isFailed || void 0,
|
|
414
|
+
tabIndex: isActive ? 0 : -1,
|
|
415
|
+
"aria-labelledby": primaryId,
|
|
416
|
+
"aria-describedby": describedBy.length > 0 ? describedBy.join(" ") : void 0,
|
|
417
|
+
"aria-busy": isItemPending || void 0,
|
|
418
|
+
className: "focus-visible:ring-0 data-cursor:transition-none data-cursor:border-ring data-cursor:bg-muted/50 data-failed:not-data-cursor:border-destructive/60",
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ jsxs(ItemContent, {
|
|
421
|
+
className: "min-w-40 basis-48",
|
|
422
|
+
children: [/* @__PURE__ */ jsx(ItemTitle, {
|
|
423
|
+
id: primaryId,
|
|
424
|
+
children: item.primary
|
|
425
|
+
}), item.secondary ? /* @__PURE__ */ jsx(ItemDescription, {
|
|
426
|
+
id: secondaryId,
|
|
427
|
+
children: item.secondary
|
|
428
|
+
}) : null]
|
|
429
|
+
}),
|
|
430
|
+
item.meta || isItemPending ? /* @__PURE__ */ jsx("div", {
|
|
431
|
+
className: "shrink-0 basis-full text-muted-foreground @max-lg/decision-queue:-mt-1.5 @lg/decision-queue:basis-auto",
|
|
432
|
+
children: isItemPending ? /* @__PURE__ */ jsx(Spinner, {
|
|
433
|
+
"aria-label": "Pending",
|
|
434
|
+
className: "size-3.5"
|
|
435
|
+
}) : item.meta
|
|
436
|
+
}) : null,
|
|
437
|
+
/* @__PURE__ */ jsx(ItemActions, {
|
|
438
|
+
className: "basis-full @lg/decision-queue:basis-auto",
|
|
439
|
+
children: /* @__PURE__ */ jsx(ButtonGroup, {
|
|
440
|
+
"aria-label": "Decide",
|
|
441
|
+
className: "w-full @lg/decision-queue:w-fit",
|
|
442
|
+
children: decisionButtons(group, [item.id], false, isItemPending, isActive)
|
|
443
|
+
})
|
|
444
|
+
})
|
|
445
|
+
]
|
|
446
|
+
}, item.id);
|
|
447
|
+
})
|
|
448
|
+
})
|
|
449
|
+
})
|
|
450
|
+
]
|
|
451
|
+
}, group.id);
|
|
452
|
+
}) : null,
|
|
453
|
+
/* @__PURE__ */ jsx(ConfirmAction, {
|
|
454
|
+
open: confirmOpen,
|
|
455
|
+
onOpenChange: setConfirmOpen,
|
|
456
|
+
tone: confirmation?.decision.destructive ? "destructive" : "default",
|
|
457
|
+
title: confirmation?.bulk ? `${confirmLabel} all ${plural(confirmCount, "item")} in ${confirmation.group.title}?` : `${confirmLabel} ${plural(confirmCount, "item")}?`,
|
|
458
|
+
consequence: confirmation ? confirmation.decision.consequence?.({
|
|
459
|
+
count: confirmCount,
|
|
460
|
+
group: confirmation.group
|
|
461
|
+
}) ?? defaultConsequence(confirmLabel, {
|
|
462
|
+
count: confirmCount,
|
|
463
|
+
group: confirmation.group
|
|
464
|
+
}) : "",
|
|
465
|
+
confirmLabel: confirmCount > 1 ? `${confirmLabel} ${confirmCount}` : confirmLabel,
|
|
466
|
+
isPending: confirmation?.itemIds.some(pending) ?? false,
|
|
467
|
+
finalFocus: () => activeKey.current && targetElement(activeKey.current) || true,
|
|
468
|
+
onConfirm: () => {
|
|
469
|
+
if (!confirmation) return;
|
|
470
|
+
setConfirmOpen(false);
|
|
471
|
+
onDecide(confirmation.itemIds, confirmation.decision.key);
|
|
472
|
+
}
|
|
473
|
+
})
|
|
474
|
+
]
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
export { DecisionQueue };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { StatusTone } from "../../lib/status-tone.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/compositions/event-feed/event-feed.d.ts
|
|
4
|
+
export type EventFeedTone = StatusTone;
|
|
5
|
+
export interface EventFeedAction {
|
|
6
|
+
/** The button's label, for example "Retry" or "Open". */
|
|
7
|
+
label: string;
|
|
8
|
+
/** While true, the button is disabled and shows a spinner. */
|
|
9
|
+
isPending?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface EventFeedEvent {
|
|
12
|
+
id: string;
|
|
13
|
+
/** When it happened, as the app wants it shown, for example "09:12" or "Yesterday". */
|
|
14
|
+
time: string;
|
|
15
|
+
/** The same moment, machine-readable (ISO 8601), for the `<time>` element. */
|
|
16
|
+
dateTime?: string;
|
|
17
|
+
/** What kind of event it is, shown as a badge, for example "approve" or "gate". */
|
|
18
|
+
kind: string;
|
|
19
|
+
/** One line saying what happened. */
|
|
20
|
+
summary: React.ReactNode;
|
|
21
|
+
/** How the event reads at a glance. Defaults to `neutral`. */
|
|
22
|
+
tone?: EventFeedTone;
|
|
23
|
+
/** Supporting text under the summary. */
|
|
24
|
+
detail?: React.ReactNode;
|
|
25
|
+
/** A follow-up the owner can take from the event. Shown only with `onAction`. */
|
|
26
|
+
action?: EventFeedAction;
|
|
27
|
+
}
|
|
28
|
+
export interface EventFeedProps {
|
|
29
|
+
/** The events, in the order to show them (usually newest first). */
|
|
30
|
+
events: readonly EventFeedEvent[];
|
|
31
|
+
/** Runs an event's `action`. */
|
|
32
|
+
onAction?: (eventId: string) => void;
|
|
33
|
+
/** Text shown when there are no events. */
|
|
34
|
+
emptyLabel?: string;
|
|
35
|
+
/** Accessible name of the feed. */
|
|
36
|
+
label?: string;
|
|
37
|
+
/** Show placeholder rows while the first load is in flight. */
|
|
38
|
+
isLoading?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Plain-text load error. With events on screen they stay visible below it,
|
|
41
|
+
* as the last good data.
|
|
42
|
+
*/
|
|
43
|
+
error?: string;
|
|
44
|
+
/** Offer a retry next to `error`. Retrying is the owner's action. */
|
|
45
|
+
onRetry?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Classes for the root. Give it a height or a maximum height (for example
|
|
48
|
+
* `h-96` or `max-h-96`, or a flex parent that sets one) and the events
|
|
49
|
+
* scroll inside it.
|
|
50
|
+
*/
|
|
51
|
+
className?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A timeline of events (activity, gate events, alerts): each shows its time,
|
|
55
|
+
* kind, summary and tone, with optional detail and a follow-up action. It
|
|
56
|
+
* scrolls inside whatever height the app gives it.
|
|
57
|
+
*/
|
|
58
|
+
export declare function EventFeed({ events, onAction, emptyLabel, label, isLoading, error, onRetry, className }: EventFeedProps): React.JSX.Element;
|
|
59
|
+
//#endregion
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Spinner } from "../../components/ui/spinner.js";
|
|
2
|
+
import { Button } from "../../components/ui/button.js";
|
|
3
|
+
import { Badge } from "../../components/ui/badge.js";
|
|
4
|
+
import { Item, ItemActions, ItemContent, ItemDescription, ItemMedia, ItemTitle } from "../../components/ui/item.js";
|
|
5
|
+
import { ScrollArea } from "../../components/ui/scroll-area.js";
|
|
6
|
+
import { ToneIcon } from "../../lib/status-tone.js";
|
|
7
|
+
import { EmptyState, ErrorState, Loading } from "../state-blocks/state-blocks.js";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { cn } from "cn";
|
|
11
|
+
//#region src/compositions/event-feed/event-feed.tsx
|
|
12
|
+
/**
|
|
13
|
+
* A timeline of events (activity, gate events, alerts): each shows its time,
|
|
14
|
+
* kind, summary and tone, with optional detail and a follow-up action. It
|
|
15
|
+
* scrolls inside whatever height the app gives it.
|
|
16
|
+
*/
|
|
17
|
+
function EventFeed({ events, onAction, emptyLabel = "No events yet", label = "Events", isLoading = false, error, onRetry, className }) {
|
|
18
|
+
const baseId = React.useId();
|
|
19
|
+
const hasEvents = events.length > 0;
|
|
20
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
21
|
+
"aria-label": label,
|
|
22
|
+
"aria-busy": isLoading || void 0,
|
|
23
|
+
"data-slot": "event-feed",
|
|
24
|
+
className: cn("@container/event-feed flex min-h-0 w-full flex-col gap-3 text-xs/relaxed", className),
|
|
25
|
+
children: [
|
|
26
|
+
error ? /* @__PURE__ */ jsx(ErrorState, {
|
|
27
|
+
title: error,
|
|
28
|
+
description: hasEvents ? "Showing the last events loaded." : void 0,
|
|
29
|
+
onRetry
|
|
30
|
+
}) : null,
|
|
31
|
+
isLoading && !hasEvents ? /* @__PURE__ */ jsx(Loading, { label: `Loading ${label.toLowerCase()}` }) : null,
|
|
32
|
+
!isLoading && !hasEvents && !error ? /* @__PURE__ */ jsx(EmptyState, { title: emptyLabel }) : null,
|
|
33
|
+
hasEvents ? /* @__PURE__ */ jsx(ScrollArea, {
|
|
34
|
+
"data-slot": "event-feed-scroll",
|
|
35
|
+
className: "group/event-feed-scroll flex min-h-0 flex-1 flex-col rounded-md *:data-[slot=scroll-area-viewport]:min-h-0 *:data-[slot=scroll-area-viewport]:flex-1 *:data-[slot=scroll-area-viewport]:focus-visible:ring-2 *:data-[slot=scroll-area-viewport]:focus-visible:ring-ring/30",
|
|
36
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
37
|
+
"aria-label": label,
|
|
38
|
+
className: "flex flex-col group-data-[has-overflow-y]/event-feed-scroll:pr-3",
|
|
39
|
+
children: events.map((event) => {
|
|
40
|
+
const tone = event.tone ?? "neutral";
|
|
41
|
+
const summaryId = `${baseId}-${event.id}-summary`;
|
|
42
|
+
const action = onAction ? event.action : void 0;
|
|
43
|
+
return /* @__PURE__ */ jsx("li", {
|
|
44
|
+
"data-slot": "event-feed-event",
|
|
45
|
+
"data-tone": tone,
|
|
46
|
+
className: "border-b last:border-b-0",
|
|
47
|
+
children: /* @__PURE__ */ jsxs(Item, {
|
|
48
|
+
size: "sm",
|
|
49
|
+
className: "items-start rounded-none px-1",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(ItemMedia, {
|
|
52
|
+
className: "pt-0.5",
|
|
53
|
+
children: /* @__PURE__ */ jsx(ToneIcon, {
|
|
54
|
+
tone,
|
|
55
|
+
className: "size-3.5"
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsxs(ItemContent, {
|
|
59
|
+
className: "min-w-0 gap-1",
|
|
60
|
+
children: [/* @__PURE__ */ jsx(ItemTitle, {
|
|
61
|
+
id: summaryId,
|
|
62
|
+
className: "line-clamp-none w-auto",
|
|
63
|
+
children: event.summary
|
|
64
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
65
|
+
className: "flex min-w-0 items-start gap-2",
|
|
66
|
+
children: [/* @__PURE__ */ jsx(Badge, {
|
|
67
|
+
variant: tone === "critical" ? "destructive" : "outline",
|
|
68
|
+
children: event.kind
|
|
69
|
+
}), event.detail ? /* @__PURE__ */ jsx(ItemDescription, {
|
|
70
|
+
className: "line-clamp-none min-w-0 flex-1",
|
|
71
|
+
children: event.detail
|
|
72
|
+
}) : null]
|
|
73
|
+
})]
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ jsxs(ItemActions, {
|
|
76
|
+
className: "flex-col items-end gap-1 @lg/event-feed:flex-row-reverse @lg/event-feed:items-center @lg/event-feed:gap-2",
|
|
77
|
+
children: [/* @__PURE__ */ jsx("time", {
|
|
78
|
+
dateTime: event.dateTime,
|
|
79
|
+
className: "text-muted-foreground tabular-nums",
|
|
80
|
+
children: event.time
|
|
81
|
+
}), action ? /* @__PURE__ */ jsxs(Button, {
|
|
82
|
+
type: "button",
|
|
83
|
+
size: "sm",
|
|
84
|
+
variant: "outline",
|
|
85
|
+
className: "@lg/event-feed:-my-0.5",
|
|
86
|
+
disabled: action.isPending,
|
|
87
|
+
"aria-describedby": summaryId,
|
|
88
|
+
onClick: () => onAction?.(event.id),
|
|
89
|
+
children: [action.isPending ? /* @__PURE__ */ jsx(Spinner, {
|
|
90
|
+
"data-icon": "inline-start",
|
|
91
|
+
"aria-hidden": "true"
|
|
92
|
+
}) : null, action.label]
|
|
93
|
+
}) : null]
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
}, event.id);
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
}) : null
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { EventFeed };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Dialog } from "../components/ui/dialog.js";
|
|
2
|
+
import { Badge, Tone } from "../components/ui/badge.js";
|
|
3
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
4
|
+
//#region src/compositions/feedback.d.ts
|
|
5
|
+
export interface BannerProps extends Omit<ComponentProps<"div">, "title"> {
|
|
6
|
+
readonly dismissLabel?: string;
|
|
7
|
+
readonly onDismiss?: () => void;
|
|
8
|
+
readonly title: ReactNode;
|
|
9
|
+
readonly tone?: Tone;
|
|
10
|
+
}
|
|
11
|
+
export declare function Banner({ children, className, dismissLabel, onDismiss, title, tone, ...props }: BannerProps): ReactElement;
|
|
12
|
+
export interface ModalProps extends Pick<ComponentProps<typeof Dialog>, "open" | "onOpenChange" | "defaultOpen"> {
|
|
13
|
+
readonly actions?: ReactNode;
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
readonly description: ReactNode;
|
|
16
|
+
readonly title: ReactNode;
|
|
17
|
+
readonly trigger?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare function Modal({ actions, children, description, title, trigger, ...props }: ModalProps): ReactElement;
|
|
20
|
+
//#endregion
|