@dungle-scrubs/admin-ui-soft 0.0.0-stage → 0.0.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 +133 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { toIsoDate } from "../../lib/iso-date.js";
|
|
2
|
+
import { addDays, startOfMonth, startOfYear, subDays, subMonths } from "date-fns";
|
|
3
|
+
//#region src/compositions/date-range-picker/date-range-options.ts
|
|
4
|
+
/** The preset name of a range picked or adjusted on the calendar. */
|
|
5
|
+
const CUSTOM_DATE_RANGE_PRESET = "custom";
|
|
6
|
+
/** "Last N days": today-(N-1) through today. */
|
|
7
|
+
function lastDays(days) {
|
|
8
|
+
return (today) => ({
|
|
9
|
+
from: toIsoDate(subDays(today, days - 1)),
|
|
10
|
+
to: toIsoDate(today)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
const DEFAULT_DATE_RANGE_OPTIONS = [
|
|
14
|
+
{
|
|
15
|
+
label: "Last 7 Days",
|
|
16
|
+
value: "7d",
|
|
17
|
+
requiredDays: 7,
|
|
18
|
+
resolve: lastDays(7)
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Last 30 Days",
|
|
22
|
+
value: "30d",
|
|
23
|
+
requiredDays: 30,
|
|
24
|
+
resolve: lastDays(30)
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Last 90 Days",
|
|
28
|
+
value: "90d",
|
|
29
|
+
requiredDays: 90,
|
|
30
|
+
resolve: lastDays(90)
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "This Month",
|
|
34
|
+
value: "month",
|
|
35
|
+
requiredDays: 31,
|
|
36
|
+
resolve: (today) => ({
|
|
37
|
+
from: toIsoDate(startOfMonth(today)),
|
|
38
|
+
to: toIsoDate(today)
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: "This Year",
|
|
43
|
+
value: "year",
|
|
44
|
+
requiredDays: 365,
|
|
45
|
+
resolve: (today) => ({
|
|
46
|
+
from: toIsoDate(startOfYear(today)),
|
|
47
|
+
to: toIsoDate(today)
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "Last 12 Months",
|
|
52
|
+
value: "12m",
|
|
53
|
+
requiredDays: 365,
|
|
54
|
+
resolve: (today) => ({
|
|
55
|
+
from: toIsoDate(addDays(subMonths(today, 12), 1)),
|
|
56
|
+
to: toIsoDate(today)
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
//#endregion
|
|
61
|
+
export { CUSTOM_DATE_RANGE_PRESET, DEFAULT_DATE_RANGE_OPTIONS };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DateRangeOption, DateRangeValue } from "./date-range-options.js";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
//#region src/compositions/date-range-picker/date-range-picker.d.ts
|
|
4
|
+
export interface DateRangePickerProps {
|
|
5
|
+
/** The committed range. */
|
|
6
|
+
value: DateRangeValue;
|
|
7
|
+
/**
|
|
8
|
+
* Called once per confirm with a resolved `{ preset, from, to }`: the
|
|
9
|
+
* preset's value when the range is untouched since that preset was chosen,
|
|
10
|
+
* "custom" otherwise.
|
|
11
|
+
*/
|
|
12
|
+
onChange: (value: DateRangeValue) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Preset rows, in order. Defaults to `DEFAULT_DATE_RANGE_OPTIONS`. Pass a
|
|
15
|
+
* stable array (a module constant or a memoized value): a new array on every
|
|
16
|
+
* render re-renders the open calendar with each parent render.
|
|
17
|
+
*/
|
|
18
|
+
options?: ReadonlyArray<DateRangeOption>;
|
|
19
|
+
/**
|
|
20
|
+
* How many days back from today the picker reaches. Calendar days before
|
|
21
|
+
* today minus `maxRangeDays` are disabled, and so are presets whose
|
|
22
|
+
* `requiredDays` exceed it. Omitted or non-finite means no limit. Days after
|
|
23
|
+
* today are always disabled.
|
|
24
|
+
*/
|
|
25
|
+
maxRangeDays?: number;
|
|
26
|
+
/** Called when a disabled preset is pressed, for example to explain the limit. */
|
|
27
|
+
onDisabledSelect?: (option: DateRangeOption) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Id prefix: the popover gets `${id}-popover`. Defaults to a per-instance
|
|
30
|
+
* generated prefix, so pickers on one page never share an id.
|
|
31
|
+
*/
|
|
32
|
+
id?: string;
|
|
33
|
+
/** Accessible name of the activator and the popover. */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Confirm button text. Only this button commits. */
|
|
36
|
+
applyLabel?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One activator opening one 280 px popover: the preset rows on top, a
|
|
40
|
+
* divider, then a one-month range calendar with the draft summary and the
|
|
41
|
+
* confirm button beneath it. Presets and day clicks only edit a draft; the
|
|
42
|
+
* confirm button commits it and closes the popover.
|
|
43
|
+
*
|
|
44
|
+
* The draft survives closing the popover without confirming (Escape or an
|
|
45
|
+
* outside click), and resets only when the committed value changes. The
|
|
46
|
+
* calendar opens on, and resyncs to, the draft's end month. The popover caps
|
|
47
|
+
* its height to the viewport space it is given: the presets and calendar
|
|
48
|
+
* scroll, and the summary and confirm button stay in view.
|
|
49
|
+
*
|
|
50
|
+
* Deferred: a filter-field variant (the reference's DateRangeField, with an
|
|
51
|
+
* empty "Any dates" state for an unset filter). It is not ported; this picker
|
|
52
|
+
* always holds a range.
|
|
53
|
+
*/
|
|
54
|
+
export declare function DateRangePicker({ value, onChange, options, maxRangeDays, onDisabledSelect, id, label, applyLabel }: DateRangePickerProps): React.JSX.Element;
|
|
55
|
+
//#endregion
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { Button } from "../../components/ui/button.js";
|
|
2
|
+
import { Calendar } from "../../components/ui/calendar.js";
|
|
3
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../components/ui/popover.js";
|
|
4
|
+
import { clampIsoDate, formatDayWithYear, formatShortDay, parseIsoDate, toIsoDate } from "../../lib/iso-date.js";
|
|
5
|
+
import { CUSTOM_DATE_RANGE_PRESET, DEFAULT_DATE_RANGE_OPTIONS } from "./date-range-options.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { cn } from "cn";
|
|
9
|
+
import { CalendarIcon, CheckIcon, LockIcon } from "lucide-react";
|
|
10
|
+
import { getDefaultClassNames } from "react-day-picker";
|
|
11
|
+
import { max, min, startOfMonth, subDays } from "date-fns";
|
|
12
|
+
import { useBoolean, useMemoizedFn } from "ahooks";
|
|
13
|
+
//#region src/compositions/date-range-picker/date-range-picker.tsx
|
|
14
|
+
/**
|
|
15
|
+
* The activator text: the preset's label, or "MMM d - MMM d" for a custom
|
|
16
|
+
* range ("MMM d" alone for a one-day range).
|
|
17
|
+
*/
|
|
18
|
+
function activatorLabel(value, options) {
|
|
19
|
+
if (value.preset === "custom") {
|
|
20
|
+
if (!value.from || !value.to) return "Custom range";
|
|
21
|
+
return value.from === value.to ? formatShortDay(value.from) : `${formatShortDay(value.from)} - ${formatShortDay(value.to)}`;
|
|
22
|
+
}
|
|
23
|
+
return options.find((o) => o.value === value.preset)?.label ?? "Date range";
|
|
24
|
+
}
|
|
25
|
+
function basisOf(value) {
|
|
26
|
+
return `${value.preset}|${value.from}|${value.to}`;
|
|
27
|
+
}
|
|
28
|
+
/** The month a range opens on: its end month, the most recent side. */
|
|
29
|
+
function monthOf(from, to, today) {
|
|
30
|
+
return startOfMonth(parseIsoDate(to) ?? parseIsoDate(from) ?? today);
|
|
31
|
+
}
|
|
32
|
+
/** A fresh draft for a committed value, clamped to today like every draft path. */
|
|
33
|
+
function draftOf(value) {
|
|
34
|
+
const now = /* @__PURE__ */ new Date();
|
|
35
|
+
const today = toIsoDate(now);
|
|
36
|
+
const from = clampIsoDate(value.from, today);
|
|
37
|
+
const to = clampIsoDate(value.to, today);
|
|
38
|
+
return {
|
|
39
|
+
basis: basisOf(value),
|
|
40
|
+
pending: null,
|
|
41
|
+
from,
|
|
42
|
+
to,
|
|
43
|
+
month: monthOf(from, to, now)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The calendar selection after a day click. A click with no start, or on a
|
|
48
|
+
* complete range, starts a new range there; with a start picked, it completes
|
|
49
|
+
* the range, swapping the ends when the click falls before the start.
|
|
50
|
+
* Clicking the start again makes a one-day range.
|
|
51
|
+
*/
|
|
52
|
+
function nextSelection(draft, day) {
|
|
53
|
+
if (!draft.from || draft.to) return {
|
|
54
|
+
from: day,
|
|
55
|
+
to: ""
|
|
56
|
+
};
|
|
57
|
+
return day < draft.from ? {
|
|
58
|
+
from: day,
|
|
59
|
+
to: draft.from
|
|
60
|
+
} : {
|
|
61
|
+
from: draft.from,
|
|
62
|
+
to: day
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The preset a confirmed range commits as: the pending preset when the range
|
|
67
|
+
* is still its range; with no preset pressed, the committed preset when the
|
|
68
|
+
* range is still the committed one; "custom" otherwise.
|
|
69
|
+
*/
|
|
70
|
+
function committedPreset(draft, committed) {
|
|
71
|
+
const { pending, from, to } = draft;
|
|
72
|
+
if (pending) return from === pending.from && to === pending.to ? pending.preset : CUSTOM_DATE_RANGE_PRESET;
|
|
73
|
+
return from === committed.from && to === committed.to ? committed.preset : CUSTOM_DATE_RANGE_PRESET;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One activator opening one 280 px popover: the preset rows on top, a
|
|
77
|
+
* divider, then a one-month range calendar with the draft summary and the
|
|
78
|
+
* confirm button beneath it. Presets and day clicks only edit a draft; the
|
|
79
|
+
* confirm button commits it and closes the popover.
|
|
80
|
+
*
|
|
81
|
+
* The draft survives closing the popover without confirming (Escape or an
|
|
82
|
+
* outside click), and resets only when the committed value changes. The
|
|
83
|
+
* calendar opens on, and resyncs to, the draft's end month. The popover caps
|
|
84
|
+
* its height to the viewport space it is given: the presets and calendar
|
|
85
|
+
* scroll, and the summary and confirm button stay in view.
|
|
86
|
+
*
|
|
87
|
+
* Deferred: a filter-field variant (the reference's DateRangeField, with an
|
|
88
|
+
* empty "Any dates" state for an unset filter). It is not ported; this picker
|
|
89
|
+
* always holds a range.
|
|
90
|
+
*/
|
|
91
|
+
function DateRangePicker({ value, onChange, options = DEFAULT_DATE_RANGE_OPTIONS, maxRangeDays, onDisabledSelect, id, label = "Date range", applyLabel = "OK" }) {
|
|
92
|
+
const [open, { set: setOpen, setFalse: close }] = useBoolean(false);
|
|
93
|
+
const autoId = React.useId();
|
|
94
|
+
const popoverId = `${id ?? `date-range-${autoId}`}-popover`;
|
|
95
|
+
const triggerText = activatorLabel(value, options);
|
|
96
|
+
const [storedDraft, setDraft] = React.useState(() => draftOf(value));
|
|
97
|
+
let draft = storedDraft;
|
|
98
|
+
if (draft.basis !== basisOf(value)) {
|
|
99
|
+
draft = draftOf(value);
|
|
100
|
+
setDraft(draft);
|
|
101
|
+
}
|
|
102
|
+
const commit = useMemoizedFn((next) => {
|
|
103
|
+
setDraft(draftOf(value));
|
|
104
|
+
onChange(next);
|
|
105
|
+
close();
|
|
106
|
+
});
|
|
107
|
+
const reportDisabled = useMemoizedFn((option) => onDisabledSelect?.(option));
|
|
108
|
+
const popupRef = React.useRef(null);
|
|
109
|
+
const focusSelectedPreset = (openType) => openType === "keyboard" ? popupRef.current?.querySelector("[data-slot=\"date-range-picker-preset\"][aria-checked=\"true\"]") ?? true : popupRef.current ?? true;
|
|
110
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
111
|
+
open,
|
|
112
|
+
onOpenChange: (next) => setOpen(next),
|
|
113
|
+
children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
114
|
+
render: /* @__PURE__ */ jsx(Button, { variant: "outline" }),
|
|
115
|
+
"aria-label": `${label}: ${triggerText}`,
|
|
116
|
+
"data-slot": "date-range-picker-trigger",
|
|
117
|
+
children: [/* @__PURE__ */ jsx(CalendarIcon, {
|
|
118
|
+
"data-icon": "inline-start",
|
|
119
|
+
"aria-hidden": "true"
|
|
120
|
+
}), triggerText]
|
|
121
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
122
|
+
ref: popupRef,
|
|
123
|
+
id: popoverId,
|
|
124
|
+
"aria-label": label,
|
|
125
|
+
align: "start",
|
|
126
|
+
collisionAvoidance: POPOVER_COLLISION_AVOIDANCE,
|
|
127
|
+
initialFocus: focusSelectedPreset,
|
|
128
|
+
onKeyDown: enterPresetsFromPopup,
|
|
129
|
+
className: "max-h-(--available-height) w-[280px] max-w-[calc(100vw-1rem)] gap-0 overflow-hidden p-0",
|
|
130
|
+
children: /* @__PURE__ */ jsx(DateRangePanel, {
|
|
131
|
+
draft,
|
|
132
|
+
setDraft,
|
|
133
|
+
preset: value.preset,
|
|
134
|
+
from: value.from,
|
|
135
|
+
to: value.to,
|
|
136
|
+
options,
|
|
137
|
+
maxRangeDays,
|
|
138
|
+
onDisabledSelect: reportDisabled,
|
|
139
|
+
applyLabel,
|
|
140
|
+
onCommit: commit
|
|
141
|
+
})
|
|
142
|
+
})]
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const POPOVER_COLLISION_AVOIDANCE = {
|
|
146
|
+
side: "flip",
|
|
147
|
+
align: "flip",
|
|
148
|
+
fallbackAxisSide: "none"
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Whether the element is scrolled short of its end, hiding content below.
|
|
152
|
+
* Re-measured on scroll and whenever the element or one of its children
|
|
153
|
+
* resizes (the popover's height cap, a five- or six-week month).
|
|
154
|
+
*/
|
|
155
|
+
function useClippedBelow(ref) {
|
|
156
|
+
const [clipped, setClipped] = React.useState(false);
|
|
157
|
+
React.useEffect(() => {
|
|
158
|
+
const element = ref.current;
|
|
159
|
+
if (!element) return;
|
|
160
|
+
const measure = () => setClipped(element.scrollTop + element.clientHeight < element.scrollHeight - 1);
|
|
161
|
+
const observer = new ResizeObserver(measure);
|
|
162
|
+
observer.observe(element);
|
|
163
|
+
for (const child of Array.from(element.children)) observer.observe(child);
|
|
164
|
+
element.addEventListener("scroll", measure, { passive: true });
|
|
165
|
+
return () => {
|
|
166
|
+
observer.disconnect();
|
|
167
|
+
element.removeEventListener("scroll", measure);
|
|
168
|
+
};
|
|
169
|
+
}, [ref]);
|
|
170
|
+
return clipped;
|
|
171
|
+
}
|
|
172
|
+
/** The footer line: the draft range, with one date for a one-day range. */
|
|
173
|
+
function draftSummary(from, to) {
|
|
174
|
+
if (!from) return "No date range selected";
|
|
175
|
+
if (!to) return `${formatDayWithYear(from)} - Select end date`;
|
|
176
|
+
return from === to ? formatDayWithYear(from) : `${formatDayWithYear(from)} - ${formatDayWithYear(to)}`;
|
|
177
|
+
}
|
|
178
|
+
function hasLimit(maxRangeDays) {
|
|
179
|
+
return maxRangeDays !== void 0 && Number.isFinite(maxRangeDays);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The popover's content. The calendar is fed only by the draft, never by the
|
|
183
|
+
* committed value, so a parent re-render cannot wipe a half-picked range or
|
|
184
|
+
* snap the month back.
|
|
185
|
+
*
|
|
186
|
+
* Memoized on content: the vendored Calendar declares its day button inline,
|
|
187
|
+
* so every Calendar render remounts each day button. Without the memo, a
|
|
188
|
+
* parent that re-renders on its own (a polling query, a clock) would replace
|
|
189
|
+
* the button under the pointer between mousedown and click, and the click
|
|
190
|
+
* would be lost.
|
|
191
|
+
*/
|
|
192
|
+
const DateRangePanel = React.memo(function DateRangePanel({ draft, setDraft, preset, from, to, options, maxRangeDays, onDisabledSelect, applyLabel, onCommit }) {
|
|
193
|
+
const [now] = React.useState(() => /* @__PURE__ */ new Date());
|
|
194
|
+
const today = toIsoDate(now);
|
|
195
|
+
const limited = hasLimit(maxRangeDays);
|
|
196
|
+
const windowStart = limited ? subDays(now, Math.max(0, maxRangeDays)) : void 0;
|
|
197
|
+
const disabledDays = [{ after: now }];
|
|
198
|
+
if (windowStart) disabledDays.push({ before: windowStart });
|
|
199
|
+
const currentMonth = startOfMonth(now);
|
|
200
|
+
const navStart = windowStart ? startOfMonth(windowStart) : void 0;
|
|
201
|
+
const shownMonth = navStart ? max([min([draft.month, currentMonth]), navStart]) : min([draft.month, currentMonth]);
|
|
202
|
+
const navComponents = navButtonsFor(navStart !== void 0 && shownMonth.getTime() <= navStart.getTime(), shownMonth.getTime() >= currentMonth.getTime());
|
|
203
|
+
const isPresetDisabled = (option) => limited && option.requiredDays > maxRangeDays;
|
|
204
|
+
const selectedPreset = draft.pending?.preset ?? preset;
|
|
205
|
+
const pickPreset = (option) => {
|
|
206
|
+
if (isPresetDisabled(option)) {
|
|
207
|
+
onDisabledSelect(option);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const range = option.resolve(now);
|
|
211
|
+
const nextFrom = clampIsoDate(range.from, today);
|
|
212
|
+
const nextTo = clampIsoDate(range.to, today);
|
|
213
|
+
setDraft((current) => ({
|
|
214
|
+
...current,
|
|
215
|
+
pending: {
|
|
216
|
+
preset: option.value,
|
|
217
|
+
...range
|
|
218
|
+
},
|
|
219
|
+
from: nextFrom,
|
|
220
|
+
to: nextTo,
|
|
221
|
+
month: monthOf(nextFrom, nextTo, now)
|
|
222
|
+
}));
|
|
223
|
+
};
|
|
224
|
+
const complete = Boolean(draft.from && draft.to);
|
|
225
|
+
const commit = () => {
|
|
226
|
+
if (!complete) return;
|
|
227
|
+
onCommit({
|
|
228
|
+
preset: committedPreset(draft, {
|
|
229
|
+
preset,
|
|
230
|
+
from,
|
|
231
|
+
to
|
|
232
|
+
}),
|
|
233
|
+
from: draft.from,
|
|
234
|
+
to: draft.to
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
const bodyRef = React.useRef(null);
|
|
238
|
+
const fromDate = parseIsoDate(draft.from);
|
|
239
|
+
const summary = draftSummary(draft.from, draft.to);
|
|
240
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
241
|
+
"data-slot": "date-range-picker",
|
|
242
|
+
className: "flex min-h-0 flex-col",
|
|
243
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
244
|
+
ref: bodyRef,
|
|
245
|
+
"data-slot": "date-range-picker-body",
|
|
246
|
+
className: "flex min-h-0 flex-col overflow-y-auto overscroll-contain",
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsx("div", {
|
|
249
|
+
role: "menu",
|
|
250
|
+
"aria-label": "Presets",
|
|
251
|
+
"data-slot": "date-range-picker-presets",
|
|
252
|
+
onKeyDown: moveRowFocus,
|
|
253
|
+
className: "flex flex-col px-1 pt-1",
|
|
254
|
+
children: options.map((option) => /* @__PURE__ */ jsx(PresetRow, {
|
|
255
|
+
label: option.label,
|
|
256
|
+
selected: selectedPreset === option.value,
|
|
257
|
+
disabled: isPresetDisabled(option),
|
|
258
|
+
onClick: () => pickPreset(option)
|
|
259
|
+
}, option.value))
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ jsx("div", {
|
|
262
|
+
"aria-hidden": "true",
|
|
263
|
+
className: "my-1 h-px shrink-0 bg-border"
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ jsx("div", {
|
|
266
|
+
className: "flex shrink-0 justify-center px-0.5 pt-1 pb-0.5",
|
|
267
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
268
|
+
mode: "range",
|
|
269
|
+
selected: fromDate ? {
|
|
270
|
+
from: fromDate,
|
|
271
|
+
to: parseIsoDate(draft.to)
|
|
272
|
+
} : void 0,
|
|
273
|
+
onSelect: (_range, day) => setDraft((current) => ({
|
|
274
|
+
...current,
|
|
275
|
+
...nextSelection(current, toIsoDate(day))
|
|
276
|
+
})),
|
|
277
|
+
month: shownMonth,
|
|
278
|
+
onMonthChange: (month) => setDraft((current) => ({
|
|
279
|
+
...current,
|
|
280
|
+
month
|
|
281
|
+
})),
|
|
282
|
+
disabled: disabledDays,
|
|
283
|
+
components: navComponents,
|
|
284
|
+
classNames: CALENDAR_CLASS_NAMES,
|
|
285
|
+
className: "[--cell-size:--spacing(8)]"
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
}), /* @__PURE__ */ jsx(DateRangeFooter, {
|
|
290
|
+
bodyRef,
|
|
291
|
+
summary,
|
|
292
|
+
complete,
|
|
293
|
+
applyLabel,
|
|
294
|
+
onConfirm: commit
|
|
295
|
+
})]
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
/** A month nav button at a bound: shown disabled, as react-day-picker draws one. */
|
|
299
|
+
function BoundNavButton({ onClick: _onClick, ...props }) {
|
|
300
|
+
return /* @__PURE__ */ jsx("button", {
|
|
301
|
+
...props,
|
|
302
|
+
"aria-disabled": true,
|
|
303
|
+
tabIndex: -1
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
const AT_BOTH_BOUNDS = {
|
|
307
|
+
PreviousMonthButton: BoundNavButton,
|
|
308
|
+
NextMonthButton: BoundNavButton
|
|
309
|
+
};
|
|
310
|
+
const AT_FIRST_MONTH = { PreviousMonthButton: BoundNavButton };
|
|
311
|
+
const AT_LAST_MONTH = { NextMonthButton: BoundNavButton };
|
|
312
|
+
/** Stable component overrides for the nav buttons, per bound reached. */
|
|
313
|
+
function navButtonsFor(atFirst, atLast) {
|
|
314
|
+
if (atFirst && atLast) return AT_BOTH_BOUNDS;
|
|
315
|
+
if (atFirst) return AT_FIRST_MONTH;
|
|
316
|
+
if (atLast) return AT_LAST_MONTH;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Day classes merged over the vendored Calendar's: a disabled day inside the
|
|
320
|
+
* range (the part of a committed range beyond `maxRangeDays`) keeps the full
|
|
321
|
+
* range fill, so the band reads as one piece up to the solid range end, and
|
|
322
|
+
* only its number fades. The range the footer names stays visible.
|
|
323
|
+
*/
|
|
324
|
+
const CALENDAR_CLASS_NAMES = { disabled: cn("text-muted-foreground opacity-50 has-[>button[data-range-middle=true]]:opacity-100 [&>button[data-range-middle=true]]:text-muted-foreground/70 [&>button[data-range-middle=true]]:opacity-100", getDefaultClassNames().disabled) };
|
|
325
|
+
const ROW_KEYS = {
|
|
326
|
+
ArrowDown: (index, count) => (index + 1) % count,
|
|
327
|
+
ArrowUp: (index, count) => (index - 1 + count) % count,
|
|
328
|
+
Home: () => 0,
|
|
329
|
+
End: (_index, count) => count - 1
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* After a pointer open the popup itself holds focus; the first arrow, Home or
|
|
333
|
+
* End key moves it onto the selected preset (or the first one).
|
|
334
|
+
*/
|
|
335
|
+
function enterPresetsFromPopup(event) {
|
|
336
|
+
if (event.target !== event.currentTarget || !ROW_KEYS[event.key]) return;
|
|
337
|
+
const target = event.currentTarget.querySelector("[data-slot=\"date-range-picker-preset\"][aria-checked=\"true\"]") ?? event.currentTarget.querySelector("[data-slot=\"date-range-picker-preset\"]");
|
|
338
|
+
if (!target) return;
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
target.focus();
|
|
341
|
+
}
|
|
342
|
+
/** Arrow, Home and End keys move focus between the preset rows, wrapping. */
|
|
343
|
+
function moveRowFocus(event) {
|
|
344
|
+
const move = ROW_KEYS[event.key];
|
|
345
|
+
if (!move) return;
|
|
346
|
+
const rows = Array.from(event.currentTarget.querySelectorAll("[data-slot=\"date-range-picker-preset\"]"));
|
|
347
|
+
const index = rows.indexOf(event.target);
|
|
348
|
+
if (index === -1 || rows.length === 0) return;
|
|
349
|
+
event.preventDefault();
|
|
350
|
+
rows[move(index, rows.length)]?.focus();
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* The draft summary beside the confirm button. Its own component, so measuring
|
|
354
|
+
* the body re-renders only the footer: a panel render remounts every day
|
|
355
|
+
* button (see DateRangePanel).
|
|
356
|
+
*/
|
|
357
|
+
function DateRangeFooter({ bodyRef, summary, complete, applyLabel, onConfirm }) {
|
|
358
|
+
const clipped = useClippedBelow(bodyRef);
|
|
359
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
360
|
+
"data-slot": "date-range-picker-footer",
|
|
361
|
+
"data-clipped": clipped || void 0,
|
|
362
|
+
className: "flex shrink-0 items-center justify-between gap-3 border-t border-transparent px-3 pt-1.5 pb-3 data-clipped:border-border",
|
|
363
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
364
|
+
"aria-live": "polite",
|
|
365
|
+
"data-slot": "date-range-picker-summary",
|
|
366
|
+
className: "min-w-0 text-xs/snug text-muted-foreground",
|
|
367
|
+
children: summary
|
|
368
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
369
|
+
className: "shrink-0",
|
|
370
|
+
disabled: !complete,
|
|
371
|
+
onClick: onConfirm,
|
|
372
|
+
children: applyLabel
|
|
373
|
+
})]
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* One preset row: a 20 px gutter holding the check when selected, then the
|
|
378
|
+
* label. A disabled row shows a lock in the gutter, or after the label when
|
|
379
|
+
* the gutter holds the check.
|
|
380
|
+
*/
|
|
381
|
+
function PresetRow({ label, selected, disabled, onClick }) {
|
|
382
|
+
const lock = /* @__PURE__ */ jsx(LockIcon, {
|
|
383
|
+
"aria-hidden": "true",
|
|
384
|
+
"data-slot": "date-range-picker-preset-lock",
|
|
385
|
+
className: "size-3.5 justify-self-center text-muted-foreground"
|
|
386
|
+
});
|
|
387
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
388
|
+
type: "button",
|
|
389
|
+
role: "menuitemradio",
|
|
390
|
+
"aria-checked": selected,
|
|
391
|
+
"aria-disabled": disabled || void 0,
|
|
392
|
+
"data-slot": "date-range-picker-preset",
|
|
393
|
+
onClick,
|
|
394
|
+
className: cn("grid w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-xs/snug outline-none", disabled && selected ? "grid-cols-[20px_minmax(0,1fr)_14px]" : "grid-cols-[20px_minmax(0,1fr)]", disabled ? "cursor-default focus-visible:bg-muted/60" : "cursor-pointer hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground", disabled && !selected ? "text-muted-foreground" : "text-foreground", selected && "font-semibold"),
|
|
395
|
+
children: [
|
|
396
|
+
selected ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
397
|
+
"aria-hidden": "true",
|
|
398
|
+
className: "size-3.5 justify-self-center"
|
|
399
|
+
}) : disabled ? lock : /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
400
|
+
/* @__PURE__ */ jsx("span", {
|
|
401
|
+
className: "min-w-0",
|
|
402
|
+
children: label
|
|
403
|
+
}),
|
|
404
|
+
disabled && selected ? lock : null
|
|
405
|
+
]
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
//#endregion
|
|
409
|
+
export { DateRangePicker };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/compositions/decision-queue/decision-queue.d.ts
|
|
3
|
+
export type DecisionQueueTone = "default" | "secondary" | "outline" | "ghost" | "destructive";
|
|
4
|
+
export interface DecisionQueueItem {
|
|
5
|
+
id: string;
|
|
6
|
+
/** The item's headline. It is also the item's accessible name. */
|
|
7
|
+
primary: React.ReactNode;
|
|
8
|
+
/** A supporting line under the headline. */
|
|
9
|
+
secondary?: React.ReactNode;
|
|
10
|
+
/** Small trailing detail, such as a date or a count. */
|
|
11
|
+
meta?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export interface DecisionQueueGroup {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Total item count when only part of the group is loaded. Invalid counts use items.length. */
|
|
18
|
+
count?: number;
|
|
19
|
+
/** Non-interactive header content. MUST NOT contain interactive elements: it sits inside a button. */
|
|
20
|
+
badges?: React.ReactNode;
|
|
21
|
+
/** Interactive header content, rendered outside the collapse toggle. */
|
|
22
|
+
headerAction?: React.ReactNode;
|
|
23
|
+
/** Offer group-level decisions when the queue enables bulk controls. Defaults to true. */
|
|
24
|
+
bulk?: boolean;
|
|
25
|
+
items: readonly DecisionQueueItem[];
|
|
26
|
+
}
|
|
27
|
+
export interface DecisionQueueConsequenceContext {
|
|
28
|
+
/** How many items the decision applies to. */
|
|
29
|
+
count: number;
|
|
30
|
+
/** The group the items belong to. */
|
|
31
|
+
group: DecisionQueueGroup;
|
|
32
|
+
}
|
|
33
|
+
export interface DecisionQueueDecision<TDecision extends string = string> {
|
|
34
|
+
/** The verdict passed to `onDecide`, and the value `keymap` maps keys to. */
|
|
35
|
+
key: TDecision;
|
|
36
|
+
label: string;
|
|
37
|
+
/** Offer this decision as a group-level control. Defaults to true; row controls and keys remain available. */
|
|
38
|
+
bulk?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Button style. Defaults to `outline`; a destructive decision then gets
|
|
41
|
+
* destructive text, so the decision group stays one continuous outline.
|
|
42
|
+
*/
|
|
43
|
+
tone?: DecisionQueueTone;
|
|
44
|
+
/** A destructive decision opens ConfirmAction before `onDecide` runs. */
|
|
45
|
+
destructive?: boolean;
|
|
46
|
+
/** Plain text naming what happens, shown in the confirmation. */
|
|
47
|
+
consequence?: (context: DecisionQueueConsequenceContext) => string;
|
|
48
|
+
}
|
|
49
|
+
export interface DecisionQueueDecisionError {
|
|
50
|
+
/** The items whose decision failed. */
|
|
51
|
+
itemIds: readonly string[];
|
|
52
|
+
/** Plain-text error, for example the server's message. */
|
|
53
|
+
message: string;
|
|
54
|
+
}
|
|
55
|
+
export interface DecisionQueueProps<TDecision extends string = string> {
|
|
56
|
+
groups: readonly DecisionQueueGroup[];
|
|
57
|
+
/** The allowed verdicts, in display order. */
|
|
58
|
+
decisions: readonly DecisionQueueDecision<TDecision>[];
|
|
59
|
+
/** Runs a decision. Destructive and bulk decisions run only after confirmation. */
|
|
60
|
+
onDecide: (itemIds: string[], decision: TDecision) => void;
|
|
61
|
+
/** Offer group-level decisions that apply to every item in a group. */
|
|
62
|
+
bulk?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Groups that start collapsed (uncontrolled): `true` for every group, or the
|
|
65
|
+
* ids of the groups to collapse. Read once, on mount. A group that first
|
|
66
|
+
* appears later follows the same rule. By default every group starts
|
|
67
|
+
* expanded. A collapsed group still shows its title, item count and
|
|
68
|
+
* group-level decisions.
|
|
69
|
+
*/
|
|
70
|
+
defaultCollapsed?: boolean | readonly string[];
|
|
71
|
+
/**
|
|
72
|
+
* Keyboard key (`KeyboardEvent.key`) to decision. A mapped key wins over the
|
|
73
|
+
* built-in `j`/`k` navigation letters; the arrow keys always navigate. While
|
|
74
|
+
* the confirmation is open, mapped keys pressed in it go no further than
|
|
75
|
+
* the queue, so window listeners never see them.
|
|
76
|
+
*/
|
|
77
|
+
keymap?: Readonly<Record<string, TDecision>>;
|
|
78
|
+
/** Whether an item's mutation is in flight. Its controls are disabled meanwhile. */
|
|
79
|
+
isPending?: (itemId: string) => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* The last failed decision (FAILED). It shows in the failed items' group,
|
|
82
|
+
* and on the items, until the owner dismisses it. The queue never retries.
|
|
83
|
+
*/
|
|
84
|
+
decisionError?: DecisionQueueDecisionError | null;
|
|
85
|
+
/** The owner dismissed `decisionError` (FAILED to IDLE). Clear it here. */
|
|
86
|
+
onDismissDecisionError?: () => void;
|
|
87
|
+
/** The item the triage cursor is on (controlled). Group headers do not change it. */
|
|
88
|
+
focusedId?: string | null;
|
|
89
|
+
/** The item the triage cursor starts on (uncontrolled). */
|
|
90
|
+
defaultFocusedId?: string | null;
|
|
91
|
+
onFocusChange?: (itemId: string | null) => void;
|
|
92
|
+
/** Accessible name of the queue. */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** Show placeholder rows while the first load is in flight. */
|
|
95
|
+
isLoading?: boolean;
|
|
96
|
+
/** Plain-text load error, shown above the groups. */
|
|
97
|
+
error?: string;
|
|
98
|
+
/** Text shown when there is nothing to decide. */
|
|
99
|
+
emptyLabel?: string;
|
|
100
|
+
className?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Grouped items for per-item or bulk decisions, operable entirely from the
|
|
104
|
+
* keyboard: `j`/`k` or the arrow keys move the cursor across group headers and
|
|
105
|
+
* items, Enter on a group header expands or collapses it, and `keymap` keys
|
|
106
|
+
* decide. Keys are ignored while focus is in a text field. Destructive and
|
|
107
|
+
* bulk decisions go through ConfirmAction first. A failed decision shows its
|
|
108
|
+
* error in the queue until the owner dismisses it. In a queue narrower than
|
|
109
|
+
* 32rem (a phone) each item stacks, its decisions span its width at touch
|
|
110
|
+
* size, and the key hints are hidden; on a touch screen they are hidden at
|
|
111
|
+
* any width.
|
|
112
|
+
*/
|
|
113
|
+
export declare function DecisionQueue<TDecision extends string = string>(props: DecisionQueueProps<TDecision>): React.JSX.Element;
|
|
114
|
+
//#endregion
|