@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,615 @@
|
|
|
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 { Checkbox } from "../../components/ui/checkbox.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "../../components/ui/input-group.js";
|
|
6
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../components/ui/dropdown-menu.js";
|
|
7
|
+
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "../../components/ui/empty.js";
|
|
8
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../components/ui/select.js";
|
|
9
|
+
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
10
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../components/ui/table.js";
|
|
11
|
+
import { createDataTableState, updateDataTableState } from "./data-table-state.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, ArrowDownIcon, ArrowUpDownIcon, ArrowUpIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsLeftIcon, ChevronsRightIcon, MoreHorizontalIcon, RotateCwIcon, SearchIcon, SearchXIcon, TableIcon, XIcon } from "lucide-react";
|
|
16
|
+
import { columnFilteringFeature, createColumnHelper, createFilteredRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_equalsString, filterFn_includesString, functionalUpdate, globalFilteringFeature, metaHelper, rowPaginationFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_basic, sortFn_datetime, sortFn_text, tableFeatures, useTable } from "@tanstack/react-table";
|
|
17
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
18
|
+
//#region src/compositions/data-table/data-table.tsx
|
|
19
|
+
const BREAKPOINT_WIDTHS = {
|
|
20
|
+
sm: 640,
|
|
21
|
+
md: 768,
|
|
22
|
+
lg: 1024
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The TanStack Table v9 features every DataTable registers: column filters,
|
|
26
|
+
* global search, sorting, pagination and row selection, with the client row
|
|
27
|
+
* models for each. Build column definitions against this feature set, for
|
|
28
|
+
* example with `createDataTableColumnHelper`.
|
|
29
|
+
*/
|
|
30
|
+
const dataTableFeatures = tableFeatures({
|
|
31
|
+
columnFilteringFeature,
|
|
32
|
+
globalFilteringFeature,
|
|
33
|
+
rowSortingFeature,
|
|
34
|
+
rowPaginationFeature,
|
|
35
|
+
rowSelectionFeature,
|
|
36
|
+
filteredRowModel: createFilteredRowModel(),
|
|
37
|
+
sortedRowModel: createSortedRowModel(),
|
|
38
|
+
paginatedRowModel: createPaginatedRowModel(),
|
|
39
|
+
filterFns: {
|
|
40
|
+
includesString: filterFn_includesString,
|
|
41
|
+
equalsString: filterFn_equalsString
|
|
42
|
+
},
|
|
43
|
+
sortFns: {
|
|
44
|
+
alphanumeric: sortFn_alphanumeric,
|
|
45
|
+
basic: sortFn_basic,
|
|
46
|
+
datetime: sortFn_datetime,
|
|
47
|
+
text: sortFn_text
|
|
48
|
+
},
|
|
49
|
+
columnMeta: metaHelper()
|
|
50
|
+
});
|
|
51
|
+
/** A typed TanStack column helper bound to the DataTable feature set. */
|
|
52
|
+
function createDataTableColumnHelper() {
|
|
53
|
+
return createColumnHelper();
|
|
54
|
+
}
|
|
55
|
+
const DEFAULT_PAGE_SIZE_OPTIONS = [
|
|
56
|
+
10,
|
|
57
|
+
25,
|
|
58
|
+
50,
|
|
59
|
+
100
|
|
60
|
+
];
|
|
61
|
+
const DEFAULT_MAX_HEIGHT = "36rem";
|
|
62
|
+
const ESTIMATED_ROW_HEIGHT = 37;
|
|
63
|
+
const SKELETON_ROWS = 5;
|
|
64
|
+
const SELECT_COLUMN_WIDTH = "2.25rem";
|
|
65
|
+
const ACTIONS_COLUMN_WIDTH = "3rem";
|
|
66
|
+
const AUTO_COLUMN_MIN_WIDTH = "10rem";
|
|
67
|
+
const NO_SELECTION = [];
|
|
68
|
+
function columnLabel(column) {
|
|
69
|
+
const { meta, header } = column.columnDef;
|
|
70
|
+
if (meta?.label) return meta.label;
|
|
71
|
+
if (typeof header === "string") return header;
|
|
72
|
+
return column.id;
|
|
73
|
+
}
|
|
74
|
+
function selectionFromIds(ids) {
|
|
75
|
+
return Object.fromEntries(ids.map((id) => [id, true]));
|
|
76
|
+
}
|
|
77
|
+
function idsFromSelection(selection) {
|
|
78
|
+
return Object.keys(selection).filter((id) => selection[id]);
|
|
79
|
+
}
|
|
80
|
+
const numberFormat = new Intl.NumberFormat();
|
|
81
|
+
/**
|
|
82
|
+
* A table for large, interactive lists: sorting, column filters, global
|
|
83
|
+
* search, paging, row selection and row actions, in client or server mode,
|
|
84
|
+
* with virtualized rows. Built on the shadcn table, TanStack Table v9 and
|
|
85
|
+
* TanStack Virtual.
|
|
86
|
+
*/
|
|
87
|
+
function DataTable(props) {
|
|
88
|
+
const { label, columns, rows, getRowId, getRowLabel, selection, onSelectionChange, rowActions, isLoading = false, error, onRetry, emptyLabel = "No rows yet", emptyDescription, searchable = true, searchPlaceholder = "Search...", pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, maxHeight = DEFAULT_MAX_HEIGHT, className } = props;
|
|
89
|
+
const serverMode = props.mode === "server";
|
|
90
|
+
const paginate = serverMode || props.paginate !== false;
|
|
91
|
+
const [ownState, setOwnState] = React.useState(() => createDataTableState(props.mode === "server" ? void 0 : props.defaultState));
|
|
92
|
+
const state = props.state ?? ownState;
|
|
93
|
+
const stateRef = React.useRef(state);
|
|
94
|
+
stateRef.current = state;
|
|
95
|
+
const controlled = props.state !== void 0;
|
|
96
|
+
const { onStateChange } = props;
|
|
97
|
+
const setSlice = (key, updater) => {
|
|
98
|
+
const previous = stateRef.current;
|
|
99
|
+
const next = updateDataTableState(previous, key, updater);
|
|
100
|
+
if (next === previous) return;
|
|
101
|
+
stateRef.current = next;
|
|
102
|
+
if (!controlled) setOwnState(next);
|
|
103
|
+
onStateChange?.(next);
|
|
104
|
+
};
|
|
105
|
+
const selectable = onSelectionChange !== void 0 || selection !== void 0;
|
|
106
|
+
const [ownSelection, setOwnSelection] = React.useState({});
|
|
107
|
+
const controlledSelection = React.useMemo(() => selection === void 0 ? void 0 : selectionFromIds(selection ?? NO_SELECTION), [selection]);
|
|
108
|
+
const rowSelection = controlledSelection ?? ownSelection;
|
|
109
|
+
const rowSelectionRef = React.useRef(rowSelection);
|
|
110
|
+
rowSelectionRef.current = rowSelection;
|
|
111
|
+
const setRowSelection = (updater) => {
|
|
112
|
+
const next = functionalUpdate(updater, rowSelectionRef.current);
|
|
113
|
+
rowSelectionRef.current = next;
|
|
114
|
+
if (controlledSelection === void 0) setOwnSelection(next);
|
|
115
|
+
onSelectionChange?.(idsFromSelection(next));
|
|
116
|
+
};
|
|
117
|
+
const table = useTable({
|
|
118
|
+
features: dataTableFeatures,
|
|
119
|
+
columns,
|
|
120
|
+
data: rows,
|
|
121
|
+
getRowId: (row) => getRowId(row),
|
|
122
|
+
defaultColumn: { filterFn: "equalsString" },
|
|
123
|
+
globalFilterFn: "includesString",
|
|
124
|
+
state: {
|
|
125
|
+
sorting: state.sorting,
|
|
126
|
+
columnFilters: state.columnFilters,
|
|
127
|
+
globalFilter: state.globalFilter,
|
|
128
|
+
pagination: state.pagination,
|
|
129
|
+
rowSelection
|
|
130
|
+
},
|
|
131
|
+
onSortingChange: (updater) => setSlice("sorting", updater),
|
|
132
|
+
onColumnFiltersChange: (updater) => setSlice("columnFilters", updater),
|
|
133
|
+
onGlobalFilterChange: (updater) => setSlice("globalFilter", updater),
|
|
134
|
+
onPaginationChange: (updater) => setSlice("pagination", updater),
|
|
135
|
+
onRowSelectionChange: setRowSelection,
|
|
136
|
+
autoResetPageIndex: false,
|
|
137
|
+
enableMultiSort: false,
|
|
138
|
+
enableRowSelection: selectable,
|
|
139
|
+
isRowRangeSelectionEvent: (event) => event.shiftKey === true,
|
|
140
|
+
manualSorting: serverMode,
|
|
141
|
+
manualFiltering: serverMode,
|
|
142
|
+
manualPagination: !paginate || serverMode,
|
|
143
|
+
...serverMode ? { rowCount: props.total } : {}
|
|
144
|
+
});
|
|
145
|
+
const scrollRef = React.useRef(null);
|
|
146
|
+
const viewportWidth = useClientWidth(scrollRef);
|
|
147
|
+
const isShown = (column) => {
|
|
148
|
+
const hideBelow = column.columnDef.meta?.hideBelow;
|
|
149
|
+
return !hideBelow || viewportWidth === void 0 || viewportWidth >= BREAKPOINT_WIDTHS[hideBelow];
|
|
150
|
+
};
|
|
151
|
+
const visibleRows = table.getRowModel().rows;
|
|
152
|
+
const rowCount = table.getRowCount();
|
|
153
|
+
const pageOffset = paginate ? state.pagination.pageIndex * state.pagination.pageSize : 0;
|
|
154
|
+
const allLeafColumns = table.getAllLeafColumns();
|
|
155
|
+
const leafColumns = allLeafColumns.filter(isShown);
|
|
156
|
+
const filterColumns = allLeafColumns.filter((column) => column.columnDef.meta?.filter);
|
|
157
|
+
const hasActions = rowActions !== void 0;
|
|
158
|
+
const columnCount = leafColumns.length + (selectable ? 1 : 0) + (hasActions ? 1 : 0);
|
|
159
|
+
const tableMinWidth = `calc(${[
|
|
160
|
+
...selectable ? [SELECT_COLUMN_WIDTH] : [],
|
|
161
|
+
...leafColumns.map((column) => column.columnDef.meta?.width ?? AUTO_COLUMN_MIN_WIDTH),
|
|
162
|
+
...hasActions ? [ACTIONS_COLUMN_WIDTH] : []
|
|
163
|
+
].join(" + ")})`;
|
|
164
|
+
const isFiltered = state.globalFilter !== "" || state.columnFilters.length > 0;
|
|
165
|
+
const selectedCount = idsFromSelection(rowSelection).length;
|
|
166
|
+
const rowLabel = (row, id) => getRowLabel?.(row) ?? id;
|
|
167
|
+
const [overflowsX, setOverflowsX] = React.useState(false);
|
|
168
|
+
React.useLayoutEffect(() => {
|
|
169
|
+
const element = scrollRef.current;
|
|
170
|
+
if (element) setOverflowsX(element.scrollWidth > element.clientWidth + 1);
|
|
171
|
+
});
|
|
172
|
+
const virtualizer = useVirtualizer({
|
|
173
|
+
count: visibleRows.length,
|
|
174
|
+
getScrollElement: () => scrollRef.current,
|
|
175
|
+
estimateSize: () => ESTIMATED_ROW_HEIGHT,
|
|
176
|
+
getItemKey: (index) => visibleRows[index]?.id ?? index,
|
|
177
|
+
overscan: 8
|
|
178
|
+
});
|
|
179
|
+
const { pageIndex } = state.pagination;
|
|
180
|
+
React.useEffect(() => {
|
|
181
|
+
if (pageIndex >= 0) scrollRef.current?.scrollTo({ top: 0 });
|
|
182
|
+
}, [pageIndex]);
|
|
183
|
+
const virtualItems = virtualizer.getVirtualItems();
|
|
184
|
+
const paddingTop = virtualItems[0]?.start ?? 0;
|
|
185
|
+
const paddingBottom = virtualItems.length > 0 ? virtualizer.getTotalSize() - (virtualItems[virtualItems.length - 1]?.end ?? 0) : 0;
|
|
186
|
+
const showSkeleton = isLoading && visibleRows.length === 0 && !error;
|
|
187
|
+
const showBodyError = Boolean(error) && visibleRows.length === 0;
|
|
188
|
+
const showBannerError = Boolean(error) && visibleRows.length > 0;
|
|
189
|
+
const clearFilters = () => {
|
|
190
|
+
setSlice("columnFilters", []);
|
|
191
|
+
setSlice("globalFilter", "");
|
|
192
|
+
};
|
|
193
|
+
const errorRetry = onRetry ? /* @__PURE__ */ jsx(Button, {
|
|
194
|
+
variant: "outline",
|
|
195
|
+
size: "sm",
|
|
196
|
+
onClick: onRetry,
|
|
197
|
+
children: "Retry"
|
|
198
|
+
}) : null;
|
|
199
|
+
let body;
|
|
200
|
+
if (showBodyError) body = /* @__PURE__ */ jsx(StateRow, {
|
|
201
|
+
columnCount,
|
|
202
|
+
children: /* @__PURE__ */ jsxs(Empty, { children: [/* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
203
|
+
/* @__PURE__ */ jsx(EmptyMedia, {
|
|
204
|
+
variant: "icon",
|
|
205
|
+
className: "bg-destructive/10 text-destructive",
|
|
206
|
+
children: /* @__PURE__ */ jsx(AlertCircleIcon, {})
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ jsx(EmptyTitle, { children: "Could not load rows" }),
|
|
209
|
+
/* @__PURE__ */ jsx(EmptyDescription, { children: error })
|
|
210
|
+
] }), errorRetry ? /* @__PURE__ */ jsx(EmptyContent, { children: errorRetry }) : null] })
|
|
211
|
+
});
|
|
212
|
+
else if (showSkeleton) body = Array.from({ length: Math.min(SKELETON_ROWS, state.pagination.pageSize) }, (_, i) => /* @__PURE__ */ jsx(TableRow, {
|
|
213
|
+
"data-slot": "data-table-skeleton-row",
|
|
214
|
+
children: Array.from({ length: columnCount }, (_, j) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full max-w-32" }) }, j))
|
|
215
|
+
}, i));
|
|
216
|
+
else if (visibleRows.length === 0) body = /* @__PURE__ */ jsx(StateRow, {
|
|
217
|
+
columnCount,
|
|
218
|
+
children: isFiltered ? /* @__PURE__ */ jsxs(Empty, { children: [/* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
219
|
+
/* @__PURE__ */ jsx(EmptyMedia, {
|
|
220
|
+
variant: "icon",
|
|
221
|
+
children: /* @__PURE__ */ jsx(SearchXIcon, {})
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ jsx(EmptyTitle, { children: "No matching rows" }),
|
|
224
|
+
/* @__PURE__ */ jsx(EmptyDescription, { children: "Nothing matches the current search and filters." })
|
|
225
|
+
] }), /* @__PURE__ */ jsx(EmptyContent, { children: /* @__PURE__ */ jsx(Button, {
|
|
226
|
+
variant: "outline",
|
|
227
|
+
size: "sm",
|
|
228
|
+
onClick: clearFilters,
|
|
229
|
+
children: "Clear search and filters"
|
|
230
|
+
}) })] }) : /* @__PURE__ */ jsx(Empty, { children: /* @__PURE__ */ jsxs(EmptyHeader, { children: [
|
|
231
|
+
/* @__PURE__ */ jsx(EmptyMedia, {
|
|
232
|
+
variant: "icon",
|
|
233
|
+
children: /* @__PURE__ */ jsx(TableIcon, {})
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsx(EmptyTitle, { children: /* @__PURE__ */ jsx("h3", { children: emptyLabel }) }),
|
|
236
|
+
emptyDescription ? /* @__PURE__ */ jsx(EmptyDescription, { children: emptyDescription }) : null
|
|
237
|
+
] }) })
|
|
238
|
+
});
|
|
239
|
+
else body = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
240
|
+
paddingTop > 0 ? /* @__PURE__ */ jsx(SpacerRow, {
|
|
241
|
+
height: paddingTop,
|
|
242
|
+
columnCount
|
|
243
|
+
}) : null,
|
|
244
|
+
virtualItems.map((item) => {
|
|
245
|
+
const row = visibleRows[item.index];
|
|
246
|
+
if (!row) return null;
|
|
247
|
+
const name = rowLabel(row.original, row.id);
|
|
248
|
+
const selected = row.getIsSelected();
|
|
249
|
+
const actions = rowActions?.(row.original);
|
|
250
|
+
return /* @__PURE__ */ jsxs(TableRow, {
|
|
251
|
+
ref: virtualizer.measureElement,
|
|
252
|
+
"data-index": item.index,
|
|
253
|
+
"data-state": selected ? "selected" : void 0,
|
|
254
|
+
"aria-rowindex": pageOffset + item.index + 2,
|
|
255
|
+
children: [
|
|
256
|
+
selectable ? /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Checkbox, {
|
|
257
|
+
"aria-label": `Select ${name}`,
|
|
258
|
+
checked: selected,
|
|
259
|
+
onCheckedChange: (checked, details) => row.getToggleSelectedHandler()({
|
|
260
|
+
target: { checked },
|
|
261
|
+
shiftKey: details.event.shiftKey
|
|
262
|
+
})
|
|
263
|
+
}) }) : null,
|
|
264
|
+
row.getAllCells().filter((cell) => isShown(cell.column)).map((cell) => /* @__PURE__ */ jsx(TableCell, {
|
|
265
|
+
className: cn("overflow-hidden text-ellipsis", cell.column.columnDef.meta?.align === "end" && "text-right tabular-nums"),
|
|
266
|
+
children: /* @__PURE__ */ jsx(table.FlexRender, { cell })
|
|
267
|
+
}, cell.id)),
|
|
268
|
+
hasActions ? /* @__PURE__ */ jsx(TableCell, {
|
|
269
|
+
className: cn("text-right", STICKY_ACTIONS_CELL),
|
|
270
|
+
children: actions && actions.length > 0 ? /* @__PURE__ */ jsx(RowActionsMenu, {
|
|
271
|
+
name,
|
|
272
|
+
actions
|
|
273
|
+
}) : null
|
|
274
|
+
}) : null
|
|
275
|
+
]
|
|
276
|
+
}, row.id);
|
|
277
|
+
}),
|
|
278
|
+
paddingBottom > 0 ? /* @__PURE__ */ jsx(SpacerRow, {
|
|
279
|
+
height: paddingBottom,
|
|
280
|
+
columnCount
|
|
281
|
+
}) : null
|
|
282
|
+
] });
|
|
283
|
+
const pageCount = Math.max(table.getPageCount(), 1);
|
|
284
|
+
React.useEffect(() => {
|
|
285
|
+
if (!serverMode && paginate && state.pagination.pageIndex >= pageCount) table.setPageIndex(pageCount - 1);
|
|
286
|
+
}, [
|
|
287
|
+
pageCount,
|
|
288
|
+
paginate,
|
|
289
|
+
serverMode,
|
|
290
|
+
state.pagination.pageIndex,
|
|
291
|
+
table
|
|
292
|
+
]);
|
|
293
|
+
const hasRows = visibleRows.length > 0;
|
|
294
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
295
|
+
"data-slot": "data-table",
|
|
296
|
+
className: cn("flex min-w-0 flex-col gap-2", className),
|
|
297
|
+
children: [
|
|
298
|
+
searchable || filterColumns.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
299
|
+
"data-slot": "data-table-toolbar",
|
|
300
|
+
className: "@container/data-table-toolbar flex flex-wrap items-center gap-2",
|
|
301
|
+
children: [
|
|
302
|
+
searchable ? /* @__PURE__ */ jsxs(InputGroup, {
|
|
303
|
+
className: "w-full @min-[640px]/data-table-toolbar:w-64",
|
|
304
|
+
children: [/* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(SearchIcon, {}) }), /* @__PURE__ */ jsx(InputGroupInput, {
|
|
305
|
+
type: "search",
|
|
306
|
+
className: "[&::-webkit-search-cancel-button]:appearance-none",
|
|
307
|
+
"aria-label": `Search ${label}`,
|
|
308
|
+
placeholder: searchPlaceholder,
|
|
309
|
+
value: state.globalFilter,
|
|
310
|
+
onChange: (event) => table.setGlobalFilter(event.target.value)
|
|
311
|
+
})]
|
|
312
|
+
}) : null,
|
|
313
|
+
filterColumns.map((column) => /* @__PURE__ */ jsx(ColumnFilter, { column }, column.id)),
|
|
314
|
+
isFiltered ? /* @__PURE__ */ jsxs(Button, {
|
|
315
|
+
variant: "ghost",
|
|
316
|
+
size: "sm",
|
|
317
|
+
onClick: clearFilters,
|
|
318
|
+
children: [/* @__PURE__ */ jsx(XIcon, { "data-icon": "inline-start" }), "Reset"]
|
|
319
|
+
}) : null
|
|
320
|
+
]
|
|
321
|
+
}) : null,
|
|
322
|
+
showBannerError ? /* @__PURE__ */ jsxs(Alert, {
|
|
323
|
+
variant: "destructive",
|
|
324
|
+
"data-slot": "data-table-error",
|
|
325
|
+
children: [
|
|
326
|
+
/* @__PURE__ */ jsx(AlertCircleIcon, {}),
|
|
327
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Could not refresh rows" }),
|
|
328
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: error }),
|
|
329
|
+
onRetry ? /* @__PURE__ */ jsx(AlertAction, { children: /* @__PURE__ */ jsxs(Button, {
|
|
330
|
+
variant: "outline",
|
|
331
|
+
size: "xs",
|
|
332
|
+
className: "text-foreground",
|
|
333
|
+
onClick: onRetry,
|
|
334
|
+
children: [/* @__PURE__ */ jsx(RotateCwIcon, {}), "Retry"]
|
|
335
|
+
}) }) : null
|
|
336
|
+
]
|
|
337
|
+
}) : null,
|
|
338
|
+
/* @__PURE__ */ jsx("section", {
|
|
339
|
+
ref: scrollRef,
|
|
340
|
+
"aria-label": label,
|
|
341
|
+
"aria-busy": isLoading || void 0,
|
|
342
|
+
tabIndex: 0,
|
|
343
|
+
"data-slot": "data-table-scroll",
|
|
344
|
+
"data-overflow-x": overflowsX && visibleRows.length > 0 || void 0,
|
|
345
|
+
className: "@container/data-table-scroll relative max-h-(--data-table-max-height) overflow-auto rounded-lg border bg-background outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/30 *:data-[slot=table-container]:overflow-visible",
|
|
346
|
+
style: { "--data-table-max-height": maxHeight },
|
|
347
|
+
children: /* @__PURE__ */ jsxs(Table, {
|
|
348
|
+
"aria-label": label,
|
|
349
|
+
"aria-rowcount": rowCount + 1,
|
|
350
|
+
className: "table-fixed",
|
|
351
|
+
style: { minWidth: tableMinWidth },
|
|
352
|
+
children: [
|
|
353
|
+
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
354
|
+
selectable ? /* @__PURE__ */ jsx("col", { className: "w-9" }) : null,
|
|
355
|
+
leafColumns.map((column) => /* @__PURE__ */ jsx("col", { style: { width: column.columnDef.meta?.width } }, column.id)),
|
|
356
|
+
hasActions ? /* @__PURE__ */ jsx("col", { className: "w-12" }) : null
|
|
357
|
+
] }),
|
|
358
|
+
/* @__PURE__ */ jsx(TableHeader, {
|
|
359
|
+
className: "sticky top-0 z-10 bg-background [&_tr]:border-b-0 [&_th]:shadow-[inset_0_-1px_0_var(--color-border)]",
|
|
360
|
+
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs(TableRow, {
|
|
361
|
+
"aria-rowindex": 1,
|
|
362
|
+
className: "hover:bg-transparent",
|
|
363
|
+
children: [
|
|
364
|
+
selectable ? /* @__PURE__ */ jsx(TableHead, { children: /* @__PURE__ */ jsx(Checkbox, {
|
|
365
|
+
"aria-label": "Select all rows on this page",
|
|
366
|
+
className: "data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground data-indeterminate:before:h-0.5 data-indeterminate:before:w-2 data-indeterminate:before:rounded-full data-indeterminate:before:bg-current dark:data-indeterminate:bg-primary data-indeterminate:*:data-[slot=checkbox-indicator]:hidden",
|
|
367
|
+
disabled: !hasRows,
|
|
368
|
+
checked: hasRows && table.getIsAllPageRowsSelected(),
|
|
369
|
+
indeterminate: table.getIsSomePageRowsSelected(),
|
|
370
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked)
|
|
371
|
+
}) }) : null,
|
|
372
|
+
headerGroup.headers.filter((header) => isShown(header.column)).map((header) => {
|
|
373
|
+
const { column } = header;
|
|
374
|
+
const sorted = column.getIsSorted();
|
|
375
|
+
const end = column.columnDef.meta?.align === "end";
|
|
376
|
+
return /* @__PURE__ */ jsx(TableHead, {
|
|
377
|
+
colSpan: header.colSpan,
|
|
378
|
+
"aria-sort": sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : void 0,
|
|
379
|
+
className: cn(end && "text-right"),
|
|
380
|
+
children: header.isPlaceholder ? null : column.getCanSort() ? /* @__PURE__ */ jsxs(Button, {
|
|
381
|
+
variant: "ghost",
|
|
382
|
+
size: "sm",
|
|
383
|
+
className: cn("-mx-2 max-w-[calc(100%+1rem)]", end && "flex-row-reverse"),
|
|
384
|
+
onClick: column.getToggleSortingHandler(),
|
|
385
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
386
|
+
className: "truncate",
|
|
387
|
+
children: /* @__PURE__ */ jsx(table.FlexRender, { header })
|
|
388
|
+
}), sorted === "asc" ? /* @__PURE__ */ jsx(ArrowUpIcon, { "data-icon": end ? "inline-start" : "inline-end" }) : sorted === "desc" ? /* @__PURE__ */ jsx(ArrowDownIcon, { "data-icon": end ? "inline-start" : "inline-end" }) : /* @__PURE__ */ jsx(ArrowUpDownIcon, {
|
|
389
|
+
"data-icon": end ? "inline-start" : "inline-end",
|
|
390
|
+
className: "text-muted-foreground"
|
|
391
|
+
})]
|
|
392
|
+
}) : /* @__PURE__ */ jsx(table.FlexRender, { header })
|
|
393
|
+
}, header.id);
|
|
394
|
+
}),
|
|
395
|
+
hasActions ? /* @__PURE__ */ jsx(TableHead, {
|
|
396
|
+
className: cn("bg-background", STICKY_ACTIONS_CELL, "in-data-[overflow-x=true]:shadow-[inset_1px_0_0_var(--color-border),inset_0_-1px_0_var(--color-border)]!"),
|
|
397
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: "sr-only",
|
|
399
|
+
children: "Actions"
|
|
400
|
+
})
|
|
401
|
+
}) : null
|
|
402
|
+
]
|
|
403
|
+
}, headerGroup.id))
|
|
404
|
+
}),
|
|
405
|
+
/* @__PURE__ */ jsx(TableBody, { children: body })
|
|
406
|
+
]
|
|
407
|
+
})
|
|
408
|
+
}),
|
|
409
|
+
/* @__PURE__ */ jsxs("div", {
|
|
410
|
+
"data-slot": "data-table-footer",
|
|
411
|
+
className: "flex flex-wrap items-center justify-between gap-x-4 gap-y-2 text-xs text-muted-foreground",
|
|
412
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
413
|
+
className: "flex items-center gap-2",
|
|
414
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
415
|
+
"aria-live": "polite",
|
|
416
|
+
className: "tabular-nums",
|
|
417
|
+
children: showSkeleton ? "Loading rows" : selectable && selectedCount > 0 ? selectedCount > rowCount ? `${numberFormat.format(selectedCount)} selected` : `${numberFormat.format(selectedCount)} of ${numberFormat.format(rowCount)} selected` : `${numberFormat.format(rowCount)} ${rowCount === 1 ? "row" : "rows"}`
|
|
418
|
+
}), isLoading && hasRows ? /* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }) : null]
|
|
419
|
+
}), paginate && rowCount > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
420
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
421
|
+
children: [/* @__PURE__ */ jsx(PageSizeSelect, {
|
|
422
|
+
value: state.pagination.pageSize,
|
|
423
|
+
options: pageSizeOptions,
|
|
424
|
+
onChange: (pageSize) => table.setPageSize(pageSize)
|
|
425
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
426
|
+
className: "flex shrink-0 items-center gap-2",
|
|
427
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
428
|
+
className: "tabular-nums",
|
|
429
|
+
children: [
|
|
430
|
+
"Page ",
|
|
431
|
+
numberFormat.format(state.pagination.pageIndex + 1),
|
|
432
|
+
" of",
|
|
433
|
+
" ",
|
|
434
|
+
numberFormat.format(pageCount)
|
|
435
|
+
]
|
|
436
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
437
|
+
className: "flex items-center gap-1",
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ jsx(Button, {
|
|
440
|
+
variant: "outline",
|
|
441
|
+
size: "icon-sm",
|
|
442
|
+
"aria-label": "First page",
|
|
443
|
+
disabled: !table.getCanPreviousPage(),
|
|
444
|
+
onClick: () => table.firstPage(),
|
|
445
|
+
children: /* @__PURE__ */ jsx(ChevronsLeftIcon, {})
|
|
446
|
+
}),
|
|
447
|
+
/* @__PURE__ */ jsx(Button, {
|
|
448
|
+
variant: "outline",
|
|
449
|
+
size: "icon-sm",
|
|
450
|
+
"aria-label": "Previous page",
|
|
451
|
+
disabled: !table.getCanPreviousPage(),
|
|
452
|
+
onClick: () => table.previousPage(),
|
|
453
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ jsx(Button, {
|
|
456
|
+
variant: "outline",
|
|
457
|
+
size: "icon-sm",
|
|
458
|
+
"aria-label": "Next page",
|
|
459
|
+
disabled: !table.getCanNextPage(),
|
|
460
|
+
onClick: () => table.nextPage(),
|
|
461
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
462
|
+
}),
|
|
463
|
+
/* @__PURE__ */ jsx(Button, {
|
|
464
|
+
variant: "outline",
|
|
465
|
+
size: "icon-sm",
|
|
466
|
+
"aria-label": "Last page",
|
|
467
|
+
disabled: !table.getCanNextPage(),
|
|
468
|
+
onClick: () => table.lastPage(),
|
|
469
|
+
children: /* @__PURE__ */ jsx(ChevronsRightIcon, {})
|
|
470
|
+
})
|
|
471
|
+
]
|
|
472
|
+
})]
|
|
473
|
+
})]
|
|
474
|
+
}) : null]
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* A body row holding the empty or error state. The state is pinned to the
|
|
481
|
+
* scroll area's visible width, so on a table wider than the screen it stays
|
|
482
|
+
* centered in view rather than across the full table.
|
|
483
|
+
*/
|
|
484
|
+
function StateRow({ columnCount, children }) {
|
|
485
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
486
|
+
className: "hover:bg-transparent",
|
|
487
|
+
children: /* @__PURE__ */ jsx(TableCell, {
|
|
488
|
+
colSpan: columnCount,
|
|
489
|
+
className: "p-0 whitespace-normal",
|
|
490
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
491
|
+
"data-slot": "data-table-state",
|
|
492
|
+
className: "sticky left-0 w-[100cqw] p-2",
|
|
493
|
+
children
|
|
494
|
+
})
|
|
495
|
+
})
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* The row-actions column sticks to the right edge, so the menu stays in reach
|
|
500
|
+
* while the table scrolls sideways. Its fill tracks the row's hover and
|
|
501
|
+
* selected states, opaque so scrolled cells pass under it. While the table
|
|
502
|
+
* overflows, a rule marks its edge and a short fade in the same fill runs
|
|
503
|
+
* ahead of it, so text passing under the column fades out instead of being
|
|
504
|
+
* cut mid-glyph.
|
|
505
|
+
*/
|
|
506
|
+
const STICKY_ACTIONS_CELL = "sticky right-0 z-[1] [--data-table-sticky-fill:var(--color-background)] bg-(--data-table-sticky-fill) [tr:hover>&]:[--data-table-sticky-fill:color-mix(in_oklab,var(--color-muted)_50%,var(--color-background))] [tr:has([aria-expanded=true])>&]:[--data-table-sticky-fill:color-mix(in_oklab,var(--color-muted)_50%,var(--color-background))] [tr[data-state=selected]>&]:[--data-table-sticky-fill:var(--color-muted)] in-data-[overflow-x=true]:shadow-[inset_1px_0_0_var(--color-border)] in-data-[overflow-x=true]:before:pointer-events-none in-data-[overflow-x=true]:before:absolute in-data-[overflow-x=true]:before:inset-y-0 in-data-[overflow-x=true]:before:right-full in-data-[overflow-x=true]:before:w-6 in-data-[overflow-x=true]:before:bg-linear-to-l in-data-[overflow-x=true]:before:from-(--data-table-sticky-fill) in-data-[overflow-x=true]:before:to-transparent";
|
|
507
|
+
/**
|
|
508
|
+
* The element's client width (inside borders and scrollbar), kept current on
|
|
509
|
+
* resize. Measured in a layout effect rather than with ahooks' useSize, which
|
|
510
|
+
* reports one animation frame late: a phone would first paint the columns
|
|
511
|
+
* that `hideBelow` then removes.
|
|
512
|
+
*/
|
|
513
|
+
function useClientWidth(ref) {
|
|
514
|
+
const [width, setWidth] = React.useState();
|
|
515
|
+
React.useLayoutEffect(() => {
|
|
516
|
+
const element = ref.current;
|
|
517
|
+
if (!element) return;
|
|
518
|
+
const measure = () => setWidth(element.clientWidth);
|
|
519
|
+
measure();
|
|
520
|
+
const observer = new ResizeObserver(measure);
|
|
521
|
+
observer.observe(element);
|
|
522
|
+
return () => observer.disconnect();
|
|
523
|
+
}, [ref]);
|
|
524
|
+
return width;
|
|
525
|
+
}
|
|
526
|
+
/** Stands in for the rows scrolled out of view, so the scrollbar stays true. */
|
|
527
|
+
function SpacerRow({ height, columnCount }) {
|
|
528
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
529
|
+
"aria-hidden": "true",
|
|
530
|
+
"data-slot": "data-table-spacer",
|
|
531
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
532
|
+
colSpan: columnCount,
|
|
533
|
+
style: {
|
|
534
|
+
height,
|
|
535
|
+
padding: 0
|
|
536
|
+
}
|
|
537
|
+
})
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function RowActionsMenu({ name, actions }) {
|
|
541
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
542
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
543
|
+
variant: "ghost",
|
|
544
|
+
size: "icon-sm",
|
|
545
|
+
"aria-label": `Actions for ${name}`
|
|
546
|
+
}),
|
|
547
|
+
children: /* @__PURE__ */ jsx(MoreHorizontalIcon, {})
|
|
548
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
549
|
+
align: "end",
|
|
550
|
+
className: "w-auto",
|
|
551
|
+
children: actions.map((action) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
552
|
+
variant: action.destructive ? "destructive" : "default",
|
|
553
|
+
disabled: action.disabled,
|
|
554
|
+
onClick: () => action.onSelect(),
|
|
555
|
+
children: action.label
|
|
556
|
+
}, action.label))
|
|
557
|
+
})] });
|
|
558
|
+
}
|
|
559
|
+
const ALL = "__all__";
|
|
560
|
+
function ColumnFilter({ column }) {
|
|
561
|
+
const name = columnLabel(column);
|
|
562
|
+
const options = column.columnDef.meta?.filter?.options ?? [];
|
|
563
|
+
const items = [{
|
|
564
|
+
label: "All",
|
|
565
|
+
value: ALL
|
|
566
|
+
}, ...options];
|
|
567
|
+
const current = column.getFilterValue();
|
|
568
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
569
|
+
items,
|
|
570
|
+
value: typeof current === "string" ? current : ALL,
|
|
571
|
+
onValueChange: (next) => column.setFilterValue(next === ALL || next == null ? void 0 : next),
|
|
572
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
573
|
+
"aria-label": `Filter by ${name}`,
|
|
574
|
+
className: "min-w-32 flex-1 @min-[640px]/data-table-toolbar:flex-none",
|
|
575
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
576
|
+
className: "text-muted-foreground",
|
|
577
|
+
children: [name, ":"]
|
|
578
|
+
}), /* @__PURE__ */ jsx(SelectValue, {})]
|
|
579
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
580
|
+
value: item.value,
|
|
581
|
+
children: item.label
|
|
582
|
+
}, item.value)) })]
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
function PageSizeSelect({ value, options, onChange }) {
|
|
586
|
+
const id = React.useId();
|
|
587
|
+
const items = (options.includes(value) ? options : [...options, value].sort((a, b) => a - b)).map((size) => ({
|
|
588
|
+
label: String(size),
|
|
589
|
+
value: size
|
|
590
|
+
}));
|
|
591
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
592
|
+
className: "flex items-center gap-2",
|
|
593
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
594
|
+
id,
|
|
595
|
+
children: "Rows per page"
|
|
596
|
+
}), /* @__PURE__ */ jsxs(Select, {
|
|
597
|
+
items,
|
|
598
|
+
value,
|
|
599
|
+
onValueChange: (next) => {
|
|
600
|
+
if (typeof next === "number") onChange(next);
|
|
601
|
+
},
|
|
602
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
603
|
+
size: "sm",
|
|
604
|
+
"aria-labelledby": id,
|
|
605
|
+
className: "tabular-nums",
|
|
606
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
607
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
608
|
+
value: item.value,
|
|
609
|
+
children: item.label
|
|
610
|
+
}, item.value)) })]
|
|
611
|
+
})]
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
615
|
+
export { DataTable, createDataTableColumnHelper, createDataTableState, dataTableFeatures };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/compositions/date-range-picker/date-range-options.d.ts
|
|
2
|
+
/** The preset name of a range picked or adjusted on the calendar. */
|
|
3
|
+
export declare const CUSTOM_DATE_RANGE_PRESET = "custom";
|
|
4
|
+
/** A committed date range: the preset that produced it, or "custom", plus both ends. */
|
|
5
|
+
export interface DateRangeValue {
|
|
6
|
+
readonly preset: string;
|
|
7
|
+
/** Range start, yyyy-MM-dd (local calendar). */
|
|
8
|
+
readonly from: string;
|
|
9
|
+
/** Range end, yyyy-MM-dd (local calendar), inclusive. */
|
|
10
|
+
readonly to: string;
|
|
11
|
+
}
|
|
12
|
+
/** A labeled resolver that turns "today" into a concrete range. */
|
|
13
|
+
export interface DateRangeShortcut {
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly resolve: (today: Date) => {
|
|
16
|
+
from: string;
|
|
17
|
+
to: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** A named preset: a shortcut with a stable `value` and the span it can need. */
|
|
21
|
+
export interface DateRangeOption extends DateRangeShortcut {
|
|
22
|
+
/** Stable preset name, stored as `DateRangeValue.preset`. Never "custom". */
|
|
23
|
+
readonly value: string;
|
|
24
|
+
/** The longest span, in days, the preset can resolve to. */
|
|
25
|
+
readonly requiredDays: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_DATE_RANGE_OPTIONS: ReadonlyArray<DateRangeOption>;
|
|
28
|
+
//#endregion
|