@kortix/ui 0.15.11 → 0.16.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/dist/_vendor/kortix-shared.js +478 -179
- package/dist/_vendor/shared/my-kortix-agent.d.ts +5 -3
- package/dist/_vendor/shared/session/attachment-tile.d.ts +8 -0
- package/dist/_vendor/shared/workspace-settings.d.ts +3 -0
- package/dist/access/access/copy-row.d.ts +7 -1
- package/dist/access/access/copy-row.js +2 -2
- package/dist/animated-copy-icon.js +2 -1
- package/dist/browser/sandbox-browser-chrome.d.ts +2 -1
- package/dist/browser/sandbox-browser-chrome.js +1 -1
- package/dist/customize/agents/agent-cover-card.d.ts +1 -1
- package/dist/customize/agents/agent-cover-card.js +10 -2
- package/dist/customize/agents/agent-filter.js +3 -1
- package/dist/customize/agents/agent-overview.d.ts +10 -0
- package/dist/customize/agents/agent-overview.js +5 -4
- package/dist/customize/agents/agent-page-chrome.d.ts +5 -6
- package/dist/customize/agents/agent-page-chrome.js +16 -13
- package/dist/customize/agents/agent-page.js +6 -28
- package/dist/customize/agents/agent-tabs.d.ts +1 -0
- package/dist/customize/agents/agent-tabs.js +1 -0
- package/dist/customize/agents/agents-page.js +3 -3
- package/dist/customize/agents/create-agent-modal.d.ts +9 -0
- package/dist/customize/agents/create-agent-modal.js +21 -3
- package/dist/customize/agents/use-default-agent.js +2 -2
- package/dist/customize/connectors/connector-identity.d.ts +11 -2
- package/dist/customize/connectors/connector-identity.js +16 -4
- package/dist/customize/connectors/connectors-page.js +10 -6
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/install/install-dialog.d.ts +2 -0
- package/dist/customize/connectors/install/install-dialog.js +6 -1
- package/dist/customize/connectors/use-agent-access.d.ts +1 -0
- package/dist/customize/evals/eval-compare-view.d.ts +10 -0
- package/dist/customize/evals/eval-compare-view.js +68 -0
- package/dist/customize/evals/eval-dataset-view.d.ts +20 -0
- package/dist/customize/evals/eval-dataset-view.js +81 -0
- package/dist/customize/evals/eval-datasets-page.d.ts +25 -0
- package/dist/customize/evals/eval-datasets-page.js +91 -0
- package/dist/customize/evals/eval-job-view.d.ts +12 -0
- package/dist/customize/evals/eval-job-view.js +360 -0
- package/dist/customize/evals/eval-jobs-page.d.ts +4 -0
- package/dist/customize/evals/eval-jobs-page.js +69 -0
- package/dist/customize/evals/eval-meta.d.ts +97 -0
- package/dist/customize/evals/eval-meta.js +228 -0
- package/dist/customize/evals/eval-task-view.d.ts +13 -0
- package/dist/customize/evals/eval-task-view.js +123 -0
- package/dist/customize/evals/eval-tasks-page.d.ts +8 -0
- package/dist/customize/evals/eval-tasks-page.js +56 -0
- package/dist/customize/evals/eval-ui.d.ts +97 -0
- package/dist/customize/evals/eval-ui.js +153 -0
- package/dist/customize/evals/evals-page.d.ts +10 -0
- package/dist/customize/evals/evals-page.js +56 -0
- package/dist/customize/evals/run-eval-modal.d.ts +28 -0
- package/dist/customize/evals/run-eval-modal.js +167 -0
- package/dist/customize/project-settings/project-admin-sections.d.ts +3 -2
- package/dist/customize/project-settings/project-admin-sections.js +6 -1
- package/dist/customize/providers/provider-connect.d.ts +13 -0
- package/dist/customize/providers/provider-connect.js +29 -5
- package/dist/customize/providers/provider-sheet.js +5 -4
- package/dist/customize/sections/view/gateway/gateway-overview.d.ts +5 -0
- package/dist/customize/sections/view/gateway/gateway-overview.js +32 -6
- package/dist/customize/sections/view/gateway/routing-parts.d.ts +6 -0
- package/dist/customize/sections/view/gateway/routing-parts.js +21 -13
- package/dist/customize/sections/view/git-view.d.ts +19 -1
- package/dist/customize/sections/view/git-view.js +7 -3
- package/dist/customize/sections/view/manifest-issue-list.d.ts +16 -0
- package/dist/customize/sections/view/manifest-issue-list.js +41 -0
- package/dist/customize/sections/view/manifest-issues-row.d.ts +24 -0
- package/dist/customize/sections/view/manifest-issues-row.js +39 -0
- package/dist/customize/sections/view/sandbox-provider-coverage.d.ts +7 -1
- package/dist/customize/sections/view/sandbox-provider-coverage.js +7 -5
- package/dist/customize/sections/view/secrets-view.d.ts +13 -0
- package/dist/customize/sections/view/secrets-view.js +10 -6
- package/dist/customize/sections/view/subscription-usage.d.ts +2 -7
- package/dist/customize/sections/view/subscription-usage.js +4 -8
- package/dist/customize/settings/settings-tab-header.js +12 -3
- package/dist/customize/settings/tabs/experimental-tab.d.ts +16 -5
- package/dist/customize/settings/tabs/experimental-tab.js +36 -11
- package/dist/customize/settings/tabs/general-tab.js +1 -1
- package/dist/customize/settings/tabs/sandbox-tab.d.ts +10 -0
- package/dist/customize/settings/tabs/sandbox-tab.js +27 -4
- package/dist/customize/settings/tabs/snapshots-tab.d.ts +31 -0
- package/dist/customize/settings/tabs/snapshots-tab.js +61 -5
- package/dist/customize/settings/tabs/workspace-keys.js +6 -3
- package/dist/customize/shared/capability-page-shell.js +9 -1
- package/dist/customize/shared/catalog/catalog-card.d.ts +1 -1
- package/dist/customize/shared/catalog/catalog-card.js +15 -5
- package/dist/customize/shared/customize-tab-bar.js +1 -1
- package/dist/customize/shared/new-entity-menu.d.ts +1 -1
- package/dist/customize/shared/new-entity-menu.js +38 -1
- package/dist/customize/triggers/runtime-triggers.d.ts +4 -0
- package/dist/customize/triggers/runtime-triggers.js +21 -2
- package/dist/customize/triggers/schedule/post-to-field.js +2 -2
- package/dist/customize/triggers/schedule-view.js +2 -1
- package/dist/files/project/components/drive-explorer.js +33 -70
- package/dist/files/project/components/drive-grid-view.d.ts +2 -31
- package/dist/files/project/components/drive-grid-view.js +12 -22
- package/dist/files/project/components/drive-list-view.d.ts +3 -30
- package/dist/files/project/components/drive-list-view.js +8 -18
- package/dist/files/project/components/drive-selection-bar.d.ts +4 -5
- package/dist/files/project/components/drive-selection-bar.js +13 -20
- package/dist/files/project/components/explorer-listing.d.ts +48 -0
- package/dist/files/project/components/explorer-listing.js +64 -0
- package/dist/files/project/components/file-explorer-page.js +7 -204
- package/dist/files/project/components/file-thumbnail.js +3 -1
- package/dist/files/project/components/manifest-issue-mark.d.ts +9 -0
- package/dist/files/project/components/manifest-issue-mark.js +26 -0
- package/dist/files/project/hooks/use-change-requests.d.ts +10 -0
- package/dist/files/project/hooks/use-change-requests.js +17 -0
- package/dist/files/project/manifest-annotations.d.ts +16 -0
- package/dist/files/project/manifest-annotations.js +19 -0
- package/dist/files/project/store/version-store.d.ts +1 -1
- package/dist/files/project/upload-batch.d.ts +20 -0
- package/dist/files/project/upload-batch.js +20 -0
- package/dist/files/runtime/hooks/use-binary-blob.js +3 -2
- package/dist/files/runtime/hooks/use-file-content.js +3 -2
- package/dist/files/runtime/hooks/use-file-list.js +1 -2
- package/dist/files/runtime/hooks/use-file-mutations.js +69 -6
- package/dist/files/runtime/hooks/use-file-refresh.d.ts +4 -0
- package/dist/files/runtime/hooks/use-file-refresh.js +6 -0
- package/dist/files/tree/components/file-tree-item.js +1 -4
- package/dist/files/viewer/file-annotations.d.ts +18 -0
- package/dist/files/viewer/file-annotations.js +21 -0
- package/dist/files/viewer/file-content-renderer.js +1 -1
- package/dist/files/viewer/file-viewer.js +2 -1
- package/dist/files/viewer/index.d.ts +1 -0
- package/dist/files/viewer/index.js +1 -0
- package/dist/files/viewer/use-file-content-state.js +8 -1
- package/dist/i18n/en.d.ts +495 -46
- package/dist/i18n/en.js +536 -87
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +0 -4
- package/dist/icons/caret-right-solid.d.ts +11 -0
- package/dist/icons/caret-right-solid.js +15 -0
- package/dist/internal/auth/auth-art.d.ts +12 -0
- package/dist/internal/auth/auth-art.js +118 -0
- package/dist/internal/auth/auth-card-shell.d.ts +14 -10
- package/dist/internal/auth/auth-card-shell.js +20 -31
- package/dist/internal/auth/auth-consent.d.ts +3 -1
- package/dist/internal/auth/auth-consent.js +2 -2
- package/dist/internal/auth/auth-primitives.d.ts +26 -1
- package/dist/internal/auth/auth-primitives.js +37 -8
- package/dist/internal/connector-logo/connector-logo.d.ts +2 -1
- package/dist/internal/connector-logo/connector-logo.js +11 -2
- package/dist/internal/files/file-read-retry.d.ts +18 -2
- package/dist/internal/files/file-read-retry.js +42 -4
- package/dist/internal/hooks/projects/use-new-project-session.js +5 -10
- package/dist/internal/hooks/use-auto-scroll-physics.d.ts +1 -1
- package/dist/internal/hooks/use-auto-scroll-physics.js +2 -10
- package/dist/internal/hooks/use-reduced-motion.d.ts +4 -0
- package/dist/internal/hooks/use-reduced-motion.js +12 -0
- package/dist/internal/hooks/use-save-shortcut.d.ts +8 -0
- package/dist/internal/hooks/use-save-shortcut.js +28 -0
- package/dist/internal/layout/connect-mcp-modal.d.ts +1 -1
- package/dist/internal/layout/connect-mcp-modal.js +9 -4
- package/dist/internal/layout/panel-chrome.d.ts +28 -0
- package/dist/internal/layout/panel-chrome.js +27 -0
- package/dist/internal/layout/project-page-header.js +5 -1
- package/dist/internal/lib/browser-noise/rules/webview.js +16 -0
- package/dist/internal/lib/manifest-health.d.ts +25 -1
- package/dist/internal/lib/manifest-health.js +56 -0
- package/dist/internal/lib/project-preamble.js +1 -1
- package/dist/internal/lib/web-notifications.d.ts +1 -1
- package/dist/internal/lib/web-notifications.js +3 -0
- package/dist/internal/notifications/notification-inbox.js +2 -1
- package/dist/internal/notifications/notification-rows.d.ts +1 -1
- package/dist/internal/notifications/notification-rows.js +15 -1
- package/dist/internal/selection/selection-bar.d.ts +2 -8
- package/dist/internal/selection/selection-bar.js +15 -38
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +9 -1
- package/dist/internal/stores/user-preferences-store.js +2 -0
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.js +28 -1
- package/dist/lib/dotmatrix-hooks.d.ts +1 -0
- package/dist/lib/dotmatrix-hooks.js +3 -13
- package/dist/lib/reduced-motion.d.ts +10 -0
- package/dist/lib/reduced-motion.js +104 -0
- package/dist/lib/routes.d.ts +9 -0
- package/dist/lib/routes.js +7 -4
- package/dist/markdown/artifact-link.d.ts +11 -0
- package/dist/markdown/artifact-link.js +62 -0
- package/dist/markdown/code/index.d.ts +1 -1
- package/dist/markdown/code/index.js +1 -1
- package/dist/markdown/code/inline-code.d.ts +1 -1
- package/dist/markdown/code/inline-code.js +1 -1
- package/dist/markdown/genui/components/map-canvas.js +2 -1
- package/dist/markdown/index.d.ts +3 -1
- package/dist/markdown/index.js +2 -1
- package/dist/markdown/{code/inline-chip.js → inline-chip.js} +2 -2
- package/dist/markdown/inline-code-text.d.ts +34 -0
- package/dist/markdown/inline-code-text.js +68 -0
- package/dist/markdown/setup-links/approval-decision.js +3 -3
- package/dist/markdown/soft-breaks.d.ts +21 -0
- package/dist/markdown/soft-breaks.js +33 -0
- package/dist/markdown/unified-markdown.d.ts +9 -1
- package/dist/markdown/unified-markdown.js +31 -9
- package/dist/primitives/action-bar.d.ts +50 -0
- package/dist/primitives/action-bar.js +87 -0
- package/dist/primitives/calendar.js +4 -2
- package/dist/primitives/inline-meta.js +2 -2
- package/dist/primitives/kortix-loader.js +2 -1
- package/dist/primitives/modal.d.ts +1 -1
- package/dist/primitives/paper-wallpaper-shaders.d.ts +1 -0
- package/dist/primitives/paper-wallpaper-shaders.js +6 -0
- package/dist/primitives/resizable.d.ts +1 -1
- package/dist/primitives/resize-seam.d.ts +3 -2
- package/dist/primitives/resize-seam.js +4 -3
- package/dist/primitives/settings-section-header.d.ts +30 -1
- package/dist/primitives/settings-section-header.js +37 -0
- package/dist/primitives/sliding-tab-indicator.js +2 -1
- package/dist/primitives/switch.js +15 -8
- package/dist/primitives/text-shimmer.js +6 -0
- package/dist/primitives/toast-clearance.d.ts +52 -0
- package/dist/primitives/toast-clearance.js +116 -0
- package/dist/primitives/toast.d.ts +3 -1
- package/dist/primitives/toast.js +2 -0
- package/dist/primitives/typed-title.js +1 -1
- package/dist/primitives/wallpaper-shaders.js +1 -1
- package/dist/session/actions/project-session-list-helpers.d.ts +16 -0
- package/dist/session/actions/project-session-list-helpers.js +18 -0
- package/dist/session/agents/agent-model.d.ts +1 -0
- package/dist/session/agents/agent-model.js +2 -1
- package/dist/session/agents/agent-strip.js +10 -4
- package/dist/session/agents/workflow-run-controls.d.ts +27 -4
- package/dist/session/agents/workflow-run-controls.js +63 -10
- package/dist/session/composer/ComposerCard.js +3 -0
- package/dist/session/composer/agent-selector.js +6 -4
- package/dist/session/composer/animated-placeholder.js +2 -1
- package/dist/session/composer/attachment-tile.d.ts +2 -2
- package/dist/session/composer/attachment-tile.js +25 -3
- package/dist/session/composer/composer-agent-access.d.ts +10 -1
- package/dist/session/composer/composer-agent-access.js +18 -4
- package/dist/session/composer/composer-chat-input.js +7 -2
- package/dist/session/composer/composer.d.ts +2 -2
- package/dist/session/composer/composer.js +7 -6
- package/dist/session/composer/hooks/use-file-search.d.ts +12 -2
- package/dist/session/composer/hooks/use-file-search.js +71 -7
- package/dist/session/composer/menus/menu-items.js +6 -2
- package/dist/session/composer/menus/menu-shell.d.ts +3 -1
- package/dist/session/composer/menus/menu-shell.js +2 -2
- package/dist/session/composer/menus/slash-menu.d.ts +7 -0
- package/dist/session/composer/menus/slash-menu.js +48 -1
- package/dist/session/composer/use-instant-session-send.js +7 -1
- package/dist/session/header/session-reminders-indicator.js +3 -2
- package/dist/session/header/session-site-header.js +24 -6
- package/dist/session/media/sandbox-url-detector.js +1 -1
- package/dist/session/models/model-connection-gate.js +2 -1
- package/dist/session/models/model-selector.js +1 -1
- package/dist/session/models/subscription-switcher.d.ts +7 -0
- package/dist/session/models/subscription-switcher.js +52 -10
- package/dist/session/models/subscription-windows.d.ts +2 -0
- package/dist/session/models/subscription-windows.js +2 -0
- package/dist/session/outcomes/session-outcomes-provider.js +14 -7
- package/dist/session/panel/action-panel.js +8 -19
- package/dist/session/panel/easy/app-preview.d.ts +4 -1
- package/dist/session/panel/easy/app-preview.js +95 -33
- package/dist/session/panel/easy/apps-card.js +6 -11
- package/dist/session/panel/easy/change-requests-card.js +1 -1
- package/dist/session/panel/easy/changes-card.d.ts +14 -0
- package/dist/session/panel/easy/changes-card.js +60 -0
- package/dist/session/panel/easy/context-card.d.ts +5 -1
- package/dist/session/panel/easy/context-card.js +13 -28
- package/dist/session/panel/easy/context-meter.d.ts +18 -0
- package/dist/session/panel/easy/context-meter.js +73 -0
- package/dist/session/panel/easy/detail-view.d.ts +1 -1
- package/dist/session/panel/easy/detail-view.js +24 -21
- package/dist/session/panel/easy/easy-panel.js +7 -5
- package/dist/session/panel/easy/file-preview.js +3 -1
- package/dist/session/panel/easy/frame-history.d.ts +91 -0
- package/dist/session/panel/easy/frame-history.js +198 -0
- package/dist/session/panel/easy/outputs-card.d.ts +10 -0
- package/dist/session/panel/easy/outputs-card.js +28 -31
- package/dist/session/panel/easy/panel-card.d.ts +1 -3
- package/dist/session/panel/easy/panel-card.js +24 -8
- package/dist/session/panel/easy/plan-card.js +2 -2
- package/dist/session/panel/easy/step-icon.d.ts +4 -1
- package/dist/session/panel/easy/step-icon.js +2 -2
- package/dist/session/panel/session-action-panel-column.d.ts +5 -0
- package/dist/session/panel/session-action-panel-column.js +198 -101
- package/dist/session/panel/session-desktop.js +5 -1
- package/dist/session/panel/session-diff-viewer.d.ts +3 -1
- package/dist/session/panel/session-diff-viewer.js +7 -4
- package/dist/session/panel/session-panel-provider.js +29 -5
- package/dist/session/panel/shared/derive-panels.js +64 -4
- package/dist/session/status/session-busy-indicator.js +2 -1
- package/dist/session/status/session-error-banner.js +1 -1
- package/dist/session/thread/chat-minimap.js +2 -1
- package/dist/session/thread/session-body.js +4 -1
- package/dist/session/thread/session-chat.js +18 -3
- package/dist/session/thread/session-turn-meta-rows.d.ts +13 -5
- package/dist/session/thread/session-turn-meta-rows.js +33 -5
- package/dist/session/thread/transcript.d.ts +1 -2
- package/dist/session/thread/transcript.js +26 -24
- package/dist/session/thread/typing-indicator.d.ts +2 -2
- package/dist/session/thread/typing-indicator.js +10 -3
- package/dist/session/tool/tools/session-spawn-tool.js +3 -3
- package/dist/session/tool/tools/workflow-run-card.d.ts +11 -1
- package/dist/session/tool/tools/workflow-run-card.js +31 -7
- package/dist/session/tool/tools/workflow-run-cost.d.ts +29 -0
- package/dist/session/tool/tools/workflow-run-cost.js +75 -0
- package/dist/session/tool/tools/workflow-tool.d.ts +1 -1
- package/dist/session/tool/tools/workflow-tool.js +40 -15
- package/dist/session/turn/peer-message-row.js +1 -1
- package/dist/session/turn/queued-prompt-bubbles.d.ts +3 -2
- package/dist/session/turn/queued-prompt-bubbles.js +1 -1
- package/dist/session/turn/throttled-markdown.js +1 -1
- package/dist/styles/theme.css +68 -0
- package/dist/styles.css +1 -1
- package/dist/terminal/pty-terminal.js +1 -1
- package/dist/terminal/session-terminal-connect-bar.js +2 -1
- package/dist/test-utils/intl.d.ts +495 -46
- package/dist/workspace/admin/project-admin-dashboard.js +21 -7
- package/dist/workspace/admin/settings-search-landing.js +2 -1
- package/dist/workspace/calendar/calendar-dates.d.ts +31 -0
- package/dist/workspace/calendar/calendar-dates.js +64 -0
- package/dist/workspace/calendar/calendar-new-item.d.ts +11 -0
- package/dist/workspace/calendar/calendar-new-item.js +47 -0
- package/dist/workspace/calendar/calendar-page.d.ts +3 -0
- package/dist/workspace/calendar/calendar-page.js +177 -0
- package/dist/workspace/calendar/calendar-panel.d.ts +13 -0
- package/dist/workspace/calendar/calendar-panel.js +103 -0
- package/dist/workspace/calendar/calendar-people.d.ts +52 -0
- package/dist/workspace/calendar/calendar-people.js +117 -0
- package/dist/workspace/calendar/calendar-scheduled.d.ts +29 -0
- package/dist/workspace/calendar/calendar-scheduled.js +118 -0
- package/dist/workspace/calendar/calendar-views.d.ts +32 -0
- package/dist/workspace/calendar/calendar-views.js +124 -0
- package/dist/workspace/calendar/calendar-when.d.ts +14 -0
- package/dist/workspace/calendar/calendar-when.js +81 -0
- package/dist/workspace/calendar/mention-textarea.d.ts +19 -0
- package/dist/workspace/calendar/mention-textarea.js +84 -0
- package/dist/workspace/home/access-requests-bell.js +2 -1
- package/dist/workspace/inbox/workspace-inbox.d.ts +1 -1
- package/dist/workspace/inbox/workspace-inbox.js +1 -1
- package/dist/workspace/layout/project-files-view.js +2 -1
- package/dist/workspace/memory/memory-page-list.js +1 -1
- package/dist/workspace/new/workspace-handoff.js +2 -1
- package/dist/workspace/projects/modal/project-icon-field.js +2 -1
- package/dist/workspace/session-workspace.js +13 -12
- package/dist/workspace/setup/setup-steps.d.ts +43 -0
- package/dist/workspace/setup/setup-steps.js +38 -0
- package/dist/workspace/setup/workspace-setup-page.d.ts +10 -0
- package/dist/workspace/setup/workspace-setup-page.js +124 -0
- package/dist/workspace/sidebar/footer/project-artifacts-nav.js +5 -1
- package/dist/workspace/sidebar/footer/project-calendar-nav.d.ts +8 -0
- package/dist/workspace/sidebar/footer/project-calendar-nav.js +31 -0
- package/dist/workspace/sidebar/footer/project-chrome-nav.d.ts +14 -6
- package/dist/workspace/sidebar/footer/project-chrome-nav.js +37 -25
- package/dist/workspace/sidebar/footer/project-computer-nav.d.ts +17 -9
- package/dist/workspace/sidebar/footer/project-computer-nav.js +36 -26
- package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +7 -7
- package/dist/workspace/sidebar/footer/project-download-app-nav.js +25 -13
- package/dist/workspace/sidebar/footer/project-inbox-nav.d.ts +8 -0
- package/dist/workspace/sidebar/footer/project-inbox-nav.js +29 -0
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +3 -13
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +6 -48
- package/dist/workspace/sidebar/footer/project-mcp-nav.d.ts +7 -7
- package/dist/workspace/sidebar/footer/project-mcp-nav.js +31 -13
- package/dist/workspace/sidebar/footer/project-phone-app-nav.d.ts +10 -0
- package/dist/workspace/sidebar/footer/project-phone-app-nav.js +61 -0
- package/dist/workspace/sidebar/footer/project-promo-cards.d.ts +21 -0
- package/dist/workspace/sidebar/footer/project-promo-cards.js +33 -0
- package/dist/workspace/sidebar/footer/promo-card.d.ts +41 -0
- package/dist/workspace/sidebar/footer/promo-card.js +47 -0
- package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
- package/dist/workspace/sidebar/project-nav-items.js +12 -4
- package/dist/workspace/sidebar/project-session-list.js +58 -26
- package/dist/workspace/sidebar/project-sidebar.js +2 -5
- package/dist/workspace/sidebar/project-spaces-nav.js +2 -1
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +24 -0
- package/dist/workspace/sidebar/session-brief-hover-card.js +4 -3
- package/dist/workspace/sidebar/session-group-sections.d.ts +26 -7
- package/dist/workspace/sidebar/session-group-sections.js +121 -41
- package/dist/workspace/sidebar/sidebar-drill.js +6 -0
- package/dist/workspace/sidebar/sidebar-more-group.js +3 -2
- package/dist/workspace/sidebar/use-workspace-list.d.ts +7 -0
- package/dist/workspace/sidebar/use-workspace-list.js +11 -1
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.d.ts +14 -0
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +46 -2
- package/dist/workspace/space/space-tab-panels.js +1 -1
- package/dist/workspace/spaces/space-timeline.js +2 -2
- package/package.json +67 -10
- package/skills/kortix-ui/SKILL.md +2 -2
- package/skills/kortix-ui/references/modules.md +5 -3
- package/dist/session/thread/turn-share.d.ts +0 -16
- package/dist/session/thread/turn-share.js +0 -161
- package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +0 -11
- package/dist/workspace/sidebar/footer/promo-nav-row.js +0 -7
- /package/dist/markdown/{code/inline-chip.d.ts → inline-chip.d.ts} +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { CalendarAuthor, CalendarParticipant, CalendarPeople, CalendarPerson } from '@kortix/sdk';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export interface CalendarDirectory {
|
|
4
|
+
people: CalendarPerson[];
|
|
5
|
+
agents: string[];
|
|
6
|
+
person(userId: string): CalendarPerson | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function useCalendarDirectory(projectId: string): CalendarDirectory;
|
|
9
|
+
export declare function directoryOf(data: CalendarPeople | undefined): CalendarDirectory;
|
|
10
|
+
export declare function personName(person: CalendarPerson | undefined, fallback: string): string;
|
|
11
|
+
/** One participant's face: a person's avatar or an agent's mark, with a hover hint naming them. */
|
|
12
|
+
export declare function ParticipantMark({ who, directory, size, ring, }: {
|
|
13
|
+
who: CalendarParticipant | CalendarAuthor;
|
|
14
|
+
directory: CalendarDirectory;
|
|
15
|
+
size?: 'xs' | 'sm';
|
|
16
|
+
ring?: boolean;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
18
|
+
/** Everyone on an item as one overlapping group: up to `max` faces, then "+N". Nothing when nobody is on it. */
|
|
19
|
+
export declare function Participants({ people, directory, size, max, }: {
|
|
20
|
+
people: readonly CalendarParticipant[];
|
|
21
|
+
directory: CalendarDirectory;
|
|
22
|
+
size?: 'xs' | 'sm';
|
|
23
|
+
max?: number;
|
|
24
|
+
}): import("react").JSX.Element | null;
|
|
25
|
+
/** The names of the people on an item: "Ana Lima, Kortix +2". */
|
|
26
|
+
export declare function participantNames(people: readonly CalendarParticipant[], directory: CalendarDirectory, unknown: string, max?: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Who is on an item, as a chip: the stacked faces and names, or "People".
|
|
29
|
+
* It opens one searchable list (the agent picker's `CommandPopover`): People,
|
|
30
|
+
* then Agents. A row toggles that participant; the list stays open.
|
|
31
|
+
*/
|
|
32
|
+
export declare function PeoplePicker({ value, directory, onChange, }: {
|
|
33
|
+
value: readonly CalendarParticipant[];
|
|
34
|
+
directory: CalendarDirectory;
|
|
35
|
+
onChange: (people: CalendarParticipant[]) => void;
|
|
36
|
+
}): import("react").JSX.Element;
|
|
37
|
+
/** A person or an agent as one line: avatar and name. */
|
|
38
|
+
export declare function Who({ who, directory, unknown, }: {
|
|
39
|
+
who: CalendarParticipant | CalendarAuthor;
|
|
40
|
+
directory: CalendarDirectory;
|
|
41
|
+
/** The name of a person who left the workspace. */
|
|
42
|
+
unknown: string;
|
|
43
|
+
}): import("react").JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Text with each @mention of a known person marked, the way chat apps do: a
|
|
46
|
+
* mention of the viewer in yellow, of anyone else in blue. Only people are
|
|
47
|
+
* marked: they are who a mention notifies. Line breaks kept.
|
|
48
|
+
*/
|
|
49
|
+
export declare function MentionText({ text, directory }: {
|
|
50
|
+
text: string;
|
|
51
|
+
directory: CalendarDirectory;
|
|
52
|
+
}): ReactNode;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useWorkspaceCalendarPeople } from '@kortix/sdk/react';
|
|
4
|
+
import { agentDisplayName } from '../../_vendor/kortix-shared.js';
|
|
5
|
+
import { CheckIcon, UsersThreeIcon } from '@phosphor-icons/react';
|
|
6
|
+
import { Fragment, useState } from 'react';
|
|
7
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
8
|
+
import { AgentMark } from '../../internal/components/agent-mark.js';
|
|
9
|
+
import { cn } from '../../lib/utils.js';
|
|
10
|
+
import { AvatarGroup, AvatarGroupCount } from '../../primitives/avatar.js';
|
|
11
|
+
import { Button } from '../../primitives/button.js';
|
|
12
|
+
import { CommandGroup, CommandInput, CommandItem, CommandList, CommandPopover, CommandPopoverContent, CommandPopoverTrigger, } from '../../primitives/command.js';
|
|
13
|
+
import { UserAvatar } from '../../primitives/user-avatar.js';
|
|
14
|
+
import { useUiViewerId } from '../../providers/ui-provider.js';
|
|
15
|
+
export function useCalendarDirectory(projectId) {
|
|
16
|
+
const query = useWorkspaceCalendarPeople(projectId);
|
|
17
|
+
return directoryOf(query.data);
|
|
18
|
+
}
|
|
19
|
+
export function directoryOf(data) {
|
|
20
|
+
const people = data?.people ?? [];
|
|
21
|
+
const byId = new Map(people.map((p) => [p.user_id, p]));
|
|
22
|
+
return { people, agents: (data?.agents ?? []).map((a) => a.name), person: (id) => byId.get(id) };
|
|
23
|
+
}
|
|
24
|
+
export function personName(person, fallback) {
|
|
25
|
+
return person?.name?.trim() || person?.email?.split('@')[0] || fallback;
|
|
26
|
+
}
|
|
27
|
+
/** Avatar tile edge per size, in px: `UserAvatar` xs is size-5 (18.4px), sm is size-6 (22px). The agent tile matches it. */
|
|
28
|
+
const AGENT_TILE = { xs: 18, sm: 22 };
|
|
29
|
+
/** One participant's face: a person's avatar or an agent's mark, with a hover hint naming them. */
|
|
30
|
+
export function ParticipantMark({ who, directory, size = 'xs', ring = false, }) {
|
|
31
|
+
const t = useTranslations('calendar');
|
|
32
|
+
if (who.kind === 'agent') {
|
|
33
|
+
return _jsx(AgentMark, { slug: who.agent, size: 14, tile: AGENT_TILE[size], label: agentDisplayName(who.agent), className: cn(ring && 'ring-background relative ring-2') });
|
|
34
|
+
}
|
|
35
|
+
const person = directory.person(who.user_id);
|
|
36
|
+
const name = personName(person, t('formerMember'));
|
|
37
|
+
return (_jsx(UserAvatar, { email: person?.email ?? '', name: person?.name ?? name, avatarUrl: person?.avatar_url, colorKey: who.user_id, size: size, hint: name, ring: ring }));
|
|
38
|
+
}
|
|
39
|
+
/** Everyone on an item as one overlapping group: up to `max` faces, then "+N". Nothing when nobody is on it. */
|
|
40
|
+
export function Participants({ people, directory, size = 'xs', max = 3, }) {
|
|
41
|
+
if (people.length === 0)
|
|
42
|
+
return null;
|
|
43
|
+
const shown = people.slice(0, max);
|
|
44
|
+
const rest = people.length - shown.length;
|
|
45
|
+
return (_jsxs(AvatarGroup, { className: "-space-x-1.5", children: [shown.map((who) => (_jsx(ParticipantMark, { who: who, directory: directory, size: size, ring: true }, who.kind === 'agent' ? `a:${who.agent}` : `u:${who.user_id}`))), rest > 0 ? (
|
|
46
|
+
// The count chip takes the avatars' own size (the primitive sizes it for sm/lg groups only).
|
|
47
|
+
_jsxs(AvatarGroupCount, { className: cn('text-xs tabular-nums', size === 'xs' ? 'size-5' : 'size-6'), children: ["+", rest] })) : null] }));
|
|
48
|
+
}
|
|
49
|
+
/** The names of the people on an item: "Ana Lima, Kortix +2". */
|
|
50
|
+
export function participantNames(people, directory, unknown, max = 2) {
|
|
51
|
+
const names = people.map((who) => (who.kind === 'agent' ? agentDisplayName(who.agent) : personName(directory.person(who.user_id), unknown)));
|
|
52
|
+
return names.length > max ? `${names.slice(0, max).join(', ')} +${names.length - max}` : names.join(', ');
|
|
53
|
+
}
|
|
54
|
+
const sameParticipant = (a, b) => a.kind === 'person' ? b.kind === 'person' && a.user_id === b.user_id : b.kind === 'agent' && a.agent === b.agent;
|
|
55
|
+
/** A search field shows only once the list is longer than this. */
|
|
56
|
+
const SEARCH_FROM = 8;
|
|
57
|
+
/**
|
|
58
|
+
* Who is on an item, as a chip: the stacked faces and names, or "People".
|
|
59
|
+
* It opens one searchable list (the agent picker's `CommandPopover`): People,
|
|
60
|
+
* then Agents. A row toggles that participant; the list stays open.
|
|
61
|
+
*/
|
|
62
|
+
export function PeoplePicker({ value, directory, onChange, }) {
|
|
63
|
+
const t = useTranslations('calendar');
|
|
64
|
+
const [open, setOpen] = useState(false);
|
|
65
|
+
const [search, setSearch] = useState('');
|
|
66
|
+
const query = search.trim().toLowerCase();
|
|
67
|
+
const matches = (text) => !query || text.toLowerCase().includes(query);
|
|
68
|
+
const people = directory.people.filter((p) => matches(`${p.name ?? ''} ${p.email ?? ''} ${p.handle}`));
|
|
69
|
+
const agents = directory.agents.filter((a) => matches(`${a} ${agentDisplayName(a)}`));
|
|
70
|
+
const toggle = (who) => onChange(value.some((v) => sameParticipant(v, who)) ? value.filter((v) => !sameParticipant(v, who)) : [...value, who]);
|
|
71
|
+
const row = (who, label, key) => {
|
|
72
|
+
const on = value.some((v) => sameParticipant(v, who));
|
|
73
|
+
return (_jsxs(CommandItem, { value: key, className: "gap-2", onSelect: () => toggle(who), children: [_jsx(ParticipantMark, { who: who, directory: directory }), _jsx("span", { className: "text-foreground min-w-0 flex-1 truncate text-sm", children: label }), on ? _jsx(CheckIcon, { className: "text-foreground size-4 shrink-0", "aria-hidden": true }) : null] }, key));
|
|
74
|
+
};
|
|
75
|
+
return (_jsxs(CommandPopover, { open: open, onOpenChange: (next) => {
|
|
76
|
+
setOpen(next);
|
|
77
|
+
if (!next)
|
|
78
|
+
setSearch('');
|
|
79
|
+
}, modal: false, children: [_jsx(CommandPopoverTrigger, { children: _jsx(Button, { type: "button", variant: "outline", size: "xs", className: cn('max-w-full font-normal', value.length === 0 && 'text-muted-foreground'), children: value.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Participants, { people: value, directory: directory }), _jsx("span", { className: "truncate", children: participantNames(value, directory, t('formerMember')) })] })) : (_jsxs(_Fragment, { children: [_jsx(UsersThreeIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }), t('people')] })) }) }), _jsxs(CommandPopoverContent, { side: "bottom", align: "start", className: "w-[min(320px,calc(100vw-1.5rem))]", children: [_jsx("div", { className: directory.people.length + directory.agents.length > SEARCH_FROM ? undefined : 'sr-only', children: _jsx(CommandInput, { compact: true, placeholder: t('searchPeople'), value: search, onValueChange: setSearch }) }), _jsxs(CommandList, { className: "max-h-80", children: [people.length > 0 ? (_jsx(CommandGroup, { heading: t('people'), children: people.map((p) => row({ kind: 'person', user_id: p.user_id }, personName(p, p.handle), `u:${p.user_id}`)) })) : null, agents.length > 0 ? (_jsx(CommandGroup, { heading: t('agents'), children: agents.map((a) => row({ kind: 'agent', agent: a }, agentDisplayName(a), `a:${a}`)) })) : null] })] })] }));
|
|
80
|
+
}
|
|
81
|
+
/** A person or an agent as one line: avatar and name. */
|
|
82
|
+
export function Who({ who, directory, unknown, }) {
|
|
83
|
+
if (who.kind === 'agent') {
|
|
84
|
+
const name = agentDisplayName(who.agent);
|
|
85
|
+
return (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [_jsx(AgentMark, { slug: who.agent, size: 14, label: name }), _jsx("span", { className: "truncate", children: name })] }));
|
|
86
|
+
}
|
|
87
|
+
const person = directory.person(who.user_id);
|
|
88
|
+
const name = personName(person, unknown);
|
|
89
|
+
return (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [_jsx(UserAvatar, { email: person?.email ?? '', name: person?.name ?? name, avatarUrl: person?.avatar_url, colorKey: who.user_id, size: "xs" }), _jsx("span", { className: "truncate", children: name })] }));
|
|
90
|
+
}
|
|
91
|
+
/** Every token a person can be @mentioned by: handle, email, email local part, name slug. */
|
|
92
|
+
function mentionTokensOf(people) {
|
|
93
|
+
const out = new Set();
|
|
94
|
+
for (const p of people) {
|
|
95
|
+
out.add(p.handle.toLowerCase());
|
|
96
|
+
if (p.email) {
|
|
97
|
+
out.add(p.email.toLowerCase());
|
|
98
|
+
out.add(p.email.split('@')[0].toLowerCase());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Text with each @mention of a known person marked, the way chat apps do: a
|
|
105
|
+
* mention of the viewer in yellow, of anyone else in blue. Only people are
|
|
106
|
+
* marked: they are who a mention notifies. Line breaks kept.
|
|
107
|
+
*/
|
|
108
|
+
export function MentionText({ text, directory }) {
|
|
109
|
+
const viewer = directory.person(useUiViewerId() ?? '');
|
|
110
|
+
const mine = mentionTokensOf(viewer ? [viewer] : []);
|
|
111
|
+
const known = mentionTokensOf(directory.people);
|
|
112
|
+
const parts = text.split(/((?:^|(?<=[^\w@]))@[a-z0-9][a-z0-9._+-]{1,63}(?:@[a-z0-9.-]+[a-z0-9])?)/gi);
|
|
113
|
+
return (_jsx(_Fragment, { children: parts.map((part, i) => {
|
|
114
|
+
const token = part.startsWith('@') ? part.slice(1).toLowerCase().replace(/[._+-]+$/, '') : null;
|
|
115
|
+
return token && known.has(token) ? (_jsx("span", { className: cn('text-foreground rounded-sm px-0.5 font-medium', mine.has(token) ? 'bg-kortix-yellow/15' : 'bg-kortix-blue/15'), children: part }, i)) : (_jsx(Fragment, { children: part }, i));
|
|
116
|
+
}) }));
|
|
117
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { UnifiedTrigger, UnifiedTriggerList } from '@kortix/sdk';
|
|
2
|
+
export interface ScheduledFire {
|
|
3
|
+
/** `<trigger id>:<day>`. */
|
|
4
|
+
id: string;
|
|
5
|
+
trigger: UnifiedTrigger;
|
|
6
|
+
/** Local day, `YYYY-MM-DD`. */
|
|
7
|
+
day: string;
|
|
8
|
+
/** The first fire of that day (ISO). */
|
|
9
|
+
at: string;
|
|
10
|
+
/** Fires that day, counted up to {@link FIRES_PER_DAY_CAP}. */
|
|
11
|
+
count: number;
|
|
12
|
+
capped: boolean;
|
|
13
|
+
/** The trigger's last run, not a planned fire. */
|
|
14
|
+
past: boolean;
|
|
15
|
+
/** The last run failed. */
|
|
16
|
+
failed: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Fires counted per trigger per day before the day reads "100+ runs". */
|
|
19
|
+
export declare const FIRES_PER_DAY_CAP = 100;
|
|
20
|
+
/** `15m`, `4h`, `1h30m`, `2d` as seconds; null when it cannot be read. */
|
|
21
|
+
export declare function everySeconds(every: string | null | undefined): number | null;
|
|
22
|
+
/**
|
|
23
|
+
* Every scheduled entry in `[from, to)`: one per active schedule trigger per
|
|
24
|
+
* day. Nothing while the workspace's or the account's automations are paused.
|
|
25
|
+
*/
|
|
26
|
+
export declare function scheduledFires(list: UnifiedTriggerList | undefined, range: {
|
|
27
|
+
from: Date;
|
|
28
|
+
to: Date;
|
|
29
|
+
}, now: Date): ScheduledFire[];
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Cron } from 'croner';
|
|
2
|
+
import { dayKey } from './calendar-dates.js';
|
|
3
|
+
/** Fires counted per trigger per day before the day reads "100+ runs". */
|
|
4
|
+
export const FIRES_PER_DAY_CAP = 100;
|
|
5
|
+
const UNIT_SECONDS = { s: 1, m: 60, h: 3_600, d: 86_400, w: 604_800 };
|
|
6
|
+
/** `15m`, `4h`, `1h30m`, `2d` as seconds; null when it cannot be read. */
|
|
7
|
+
export function everySeconds(every) {
|
|
8
|
+
if (!every)
|
|
9
|
+
return null;
|
|
10
|
+
const parts = [...every.trim().toLowerCase().matchAll(/(\d+)\s*([smhdw])/g)];
|
|
11
|
+
if (parts.length === 0 || parts.map((p) => p[0]).join('') !== every.trim().toLowerCase().replace(/\s+/g, ''))
|
|
12
|
+
return null;
|
|
13
|
+
const total = parts.reduce((sum, p) => sum + Number(p[1]) * UNIT_SECONDS[p[2]], 0);
|
|
14
|
+
return total > 0 ? total : null;
|
|
15
|
+
}
|
|
16
|
+
/** The fire instants of one trigger in `[from, to)`, at most `FIRES_PER_DAY_CAP + 1` per local day. */
|
|
17
|
+
function upcomingFires(trigger, from, to) {
|
|
18
|
+
const source = trigger.source;
|
|
19
|
+
if (source.at) {
|
|
20
|
+
const at = new Date(source.at);
|
|
21
|
+
return at >= from && at < to ? [at] : [];
|
|
22
|
+
}
|
|
23
|
+
const out = [];
|
|
24
|
+
const perDay = new Map();
|
|
25
|
+
const take = (at) => {
|
|
26
|
+
const key = dayKey(at);
|
|
27
|
+
const n = (perDay.get(key) ?? 0) + 1;
|
|
28
|
+
perDay.set(key, n);
|
|
29
|
+
if (n <= FIRES_PER_DAY_CAP + 1)
|
|
30
|
+
out.push(at);
|
|
31
|
+
return n > FIRES_PER_DAY_CAP;
|
|
32
|
+
};
|
|
33
|
+
const period = everySeconds(source.every);
|
|
34
|
+
if (period) {
|
|
35
|
+
let at = trigger.next_fire_at ? new Date(trigger.next_fire_at) : from;
|
|
36
|
+
if (at < from)
|
|
37
|
+
at = new Date(at.getTime() + Math.ceil((from.getTime() - at.getTime()) / (period * 1000)) * period * 1000);
|
|
38
|
+
while (at < to) {
|
|
39
|
+
// A full day: skip to the first fire of the next local day.
|
|
40
|
+
if (take(at)) {
|
|
41
|
+
const next = new Date(at.getFullYear(), at.getMonth(), at.getDate() + 1);
|
|
42
|
+
at = new Date(at.getTime() + Math.ceil((next.getTime() - at.getTime()) / (period * 1000)) * period * 1000);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
at = new Date(at.getTime() + period * 1000);
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
if (!source.cron)
|
|
50
|
+
return out;
|
|
51
|
+
let cron;
|
|
52
|
+
try {
|
|
53
|
+
cron = new Cron(source.cron, { paused: true, timezone: source.timezone || 'UTC' });
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
let cursor = cron.nextRun(new Date(from.getTime() - 1));
|
|
59
|
+
while (cursor && cursor < to) {
|
|
60
|
+
if (take(cursor)) {
|
|
61
|
+
const nextDay = new Date(cursor.getFullYear(), cursor.getMonth(), cursor.getDate() + 1);
|
|
62
|
+
cursor = cron.nextRun(new Date(nextDay.getTime() - 1));
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
cursor = cron.nextRun(cursor);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Every scheduled entry in `[from, to)`: one per active schedule trigger per
|
|
71
|
+
* day. Nothing while the workspace's or the account's automations are paused.
|
|
72
|
+
*/
|
|
73
|
+
export function scheduledFires(list, range, now) {
|
|
74
|
+
if (!list || list.triggers_paused || list.account_automations_paused)
|
|
75
|
+
return [];
|
|
76
|
+
const out = [];
|
|
77
|
+
for (const trigger of list.triggers) {
|
|
78
|
+
if (trigger.source.type !== 'schedule')
|
|
79
|
+
continue;
|
|
80
|
+
const byDay = new Map();
|
|
81
|
+
if (trigger.state === 'active') {
|
|
82
|
+
const start = range.from > now ? range.from : now;
|
|
83
|
+
for (const at of upcomingFires(trigger, start, range.to)) {
|
|
84
|
+
const key = dayKey(at);
|
|
85
|
+
byDay.set(key, [...(byDay.get(key) ?? []), at]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
for (const [day, fires] of byDay) {
|
|
89
|
+
out.push({
|
|
90
|
+
id: `${trigger.id}:${day}`,
|
|
91
|
+
trigger,
|
|
92
|
+
day,
|
|
93
|
+
at: fires[0].toISOString(),
|
|
94
|
+
count: Math.min(fires.length, FIRES_PER_DAY_CAP),
|
|
95
|
+
capped: fires.length > FIRES_PER_DAY_CAP,
|
|
96
|
+
past: false,
|
|
97
|
+
failed: false,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const last = trigger.last_fired_at ? new Date(trigger.last_fired_at) : null;
|
|
101
|
+
if (last && last >= range.from && last < range.to && last <= now) {
|
|
102
|
+
const day = dayKey(last);
|
|
103
|
+
if (!byDay.has(day)) {
|
|
104
|
+
out.push({
|
|
105
|
+
id: `${trigger.id}:${day}`,
|
|
106
|
+
trigger,
|
|
107
|
+
day,
|
|
108
|
+
at: last.toISOString(),
|
|
109
|
+
count: 1,
|
|
110
|
+
capped: false,
|
|
111
|
+
past: true,
|
|
112
|
+
failed: trigger.last_status === 'failed' || trigger.last_status === 'error',
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return out.sort((a, b) => a.at.localeCompare(b.at));
|
|
118
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CalendarItem } from '@kortix/sdk';
|
|
2
|
+
import { type CalendarDirectory } from './calendar-people.js';
|
|
3
|
+
import type { ScheduledFire } from './calendar-scheduled.js';
|
|
4
|
+
export declare const UNDATED = "undated";
|
|
5
|
+
export type CalendarSelection = {
|
|
6
|
+
kind: 'item';
|
|
7
|
+
id: string;
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'fire';
|
|
10
|
+
id: string;
|
|
11
|
+
} | null;
|
|
12
|
+
interface ViewProps {
|
|
13
|
+
items: CalendarItem[];
|
|
14
|
+
fires: ScheduledFire[];
|
|
15
|
+
directory: CalendarDirectory;
|
|
16
|
+
selection: CalendarSelection;
|
|
17
|
+
now: Date;
|
|
18
|
+
onOpenItem: (id: string) => void;
|
|
19
|
+
onOpenFire: (id: string) => void;
|
|
20
|
+
/** An item dropped on a day key, or on {@link UNDATED}. */
|
|
21
|
+
onMove: (item: CalendarItem, day: string) => void;
|
|
22
|
+
/** "+" on a day: a new item on that day. */
|
|
23
|
+
onAdd: (day: string | null) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function WeekView(props: ViewProps & {
|
|
26
|
+
start: Date;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
export declare function MonthView(props: ViewProps & {
|
|
29
|
+
anchor: Date;
|
|
30
|
+
onShowDay: (day: Date) => void;
|
|
31
|
+
}): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ArrowsClockwiseIcon, ChatCircleIcon, CheckIcon, LightningIcon, PlusIcon } from '@phosphor-icons/react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { useLocale, useTranslations } from '../../i18n/index.js';
|
|
6
|
+
import { cn } from '../../lib/utils.js';
|
|
7
|
+
import { dayKey, isOverdue, itemDayKey, monthWeeks, weekDays } from './calendar-dates.js';
|
|
8
|
+
import { Participants } from './calendar-people.js';
|
|
9
|
+
export const UNDATED = 'undated';
|
|
10
|
+
/** Drag state shared by the drop zones of one view. */
|
|
11
|
+
function useDrop(items, onMove) {
|
|
12
|
+
const [over, setOver] = useState('');
|
|
13
|
+
const zone = (day) => ({
|
|
14
|
+
'data-over': over === day || undefined,
|
|
15
|
+
onDragOver: (event) => {
|
|
16
|
+
if (!event.dataTransfer.types.includes('application/x-kortix-calendar-item'))
|
|
17
|
+
return;
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
event.dataTransfer.dropEffect = 'move';
|
|
20
|
+
setOver(day);
|
|
21
|
+
},
|
|
22
|
+
onDragLeave: () => setOver((current) => (current === day ? '' : current)),
|
|
23
|
+
onDrop: (event) => {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
setOver('');
|
|
26
|
+
const id = event.dataTransfer.getData('application/x-kortix-calendar-item');
|
|
27
|
+
const item = items.find((candidate) => candidate.item_id === id);
|
|
28
|
+
if (item && (itemDayKey(item) ?? UNDATED) !== day)
|
|
29
|
+
onMove(item, day);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return zone;
|
|
33
|
+
}
|
|
34
|
+
const draggable = (item) => ({
|
|
35
|
+
draggable: true,
|
|
36
|
+
onDragStart: (event) => {
|
|
37
|
+
event.dataTransfer.setData('application/x-kortix-calendar-item', item.item_id);
|
|
38
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
/** The dot before an item in the month grid: done (green), overdue (orange), else neutral. */
|
|
42
|
+
function ItemDot({ item, now }) {
|
|
43
|
+
const tone = item.status === 'done' ? 'bg-kortix-green' : isOverdue(item, now) ? 'bg-kortix-orange' : 'bg-muted-foreground';
|
|
44
|
+
return _jsx("span", { "aria-hidden": true, className: cn('size-1.5 shrink-0 rounded-full', tone) });
|
|
45
|
+
}
|
|
46
|
+
function useTimeLabel() {
|
|
47
|
+
const locale = useLocale();
|
|
48
|
+
const t = useTranslations('calendar');
|
|
49
|
+
const clock = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' });
|
|
50
|
+
return (item) => {
|
|
51
|
+
if (!item.starts_at)
|
|
52
|
+
return t('noDate');
|
|
53
|
+
if (item.all_day)
|
|
54
|
+
return t('allDay');
|
|
55
|
+
const start = clock.format(new Date(item.starts_at));
|
|
56
|
+
return item.ends_at ? `${start} – ${clock.format(new Date(item.ends_at))}` : start;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function ItemCard({ item, selected, directory, now, onOpen }) {
|
|
60
|
+
const t = useTranslations('calendar');
|
|
61
|
+
const when = useTimeLabel();
|
|
62
|
+
// No status word: a done item has a check and a struck title, an overdue one says so, else the time. Undated items sit under "No date" already.
|
|
63
|
+
const done = item.status === 'done';
|
|
64
|
+
const overdue = !done && isOverdue(item, now);
|
|
65
|
+
const lead = overdue ? t('overdue') : item.starts_at ? when(item) : null;
|
|
66
|
+
return (_jsxs("button", { type: "button", "aria-pressed": selected, title: item.title, onClick: onOpen, ...draggable(item), className: cn('bg-muted text-foreground hover:bg-hover duration-fast flex size-full min-h-20 cursor-pointer flex-col justify-between gap-3 rounded-md p-3 text-left transition-colors', 'focus-visible:ring-ring outline-none focus-visible:ring-2 aria-pressed:bg-active'), children: [_jsx("span", { className: cn('line-clamp-2 text-sm font-medium wrap-anywhere', done && 'text-muted-foreground line-through'), children: item.title }), _jsxs("span", { className: "text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs whitespace-nowrap", children: [done ? _jsx(CheckIcon, { weight: "bold", className: "text-kortix-green size-3.5 shrink-0", "aria-label": t('status.done') }) : null, lead ? _jsx("span", { className: cn('truncate tabular-nums', overdue && 'text-kortix-orange'), children: lead }) : null, item.comment_count > 0 ? (_jsxs("span", { className: "inline-flex items-center gap-0.5 tabular-nums", children: [_jsx(ChatCircleIcon, { className: "size-3.5", "aria-label": t('comments', { count: item.comment_count }) }), item.comment_count] })) : null, item.people.length > 0 ? (_jsx("span", { className: "ml-auto", children: _jsx(Participants, { people: item.people, directory: directory }) })) : null] })] }));
|
|
67
|
+
}
|
|
68
|
+
function FireCard({ fire, selected, onOpen }) {
|
|
69
|
+
const t = useTranslations('calendar');
|
|
70
|
+
const locale = useLocale();
|
|
71
|
+
const clock = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' });
|
|
72
|
+
const loop = fire.trigger.target.kind === 'session';
|
|
73
|
+
const Glyph = loop ? ArrowsClockwiseIcon : LightningIcon;
|
|
74
|
+
const lead = fire.count > 1 ? t('runs', { count: fire.count, capped: fire.capped ? 'yes' : 'no' }) : clock.format(new Date(fire.at));
|
|
75
|
+
return (_jsxs("button", { type: "button", "aria-pressed": selected, title: fire.trigger.name ?? fire.trigger.id, onClick: onOpen, className: cn('bg-background text-foreground hover:bg-hover duration-fast border-border flex size-full min-h-20 cursor-pointer flex-col justify-between gap-3 rounded-md border p-3 text-left transition-colors', 'focus-visible:ring-ring outline-none focus-visible:ring-2 aria-pressed:bg-active'), children: [_jsx("span", { className: "line-clamp-2 text-sm font-medium wrap-anywhere", children: fire.trigger.name || fire.trigger.id }), _jsxs("span", { className: "text-muted-foreground flex min-w-0 items-center gap-1.5 text-xs whitespace-nowrap", children: [_jsx(Glyph, { className: cn('size-3.5 shrink-0', fire.failed && 'text-kortix-red'), "aria-hidden": true }), _jsx("span", { className: "truncate tabular-nums", children: fire.past ? (fire.failed ? t('lastRunFailed') : t('lastRun')) : lead }), _jsx("span", { className: "ml-auto truncate", children: loop ? t('loop') : t('trigger') })] })] }));
|
|
76
|
+
}
|
|
77
|
+
function Entries({ items, fires, props }) {
|
|
78
|
+
return (_jsxs("ul", { className: "flex min-w-0 gap-2 overflow-x-auto p-0.5", children: [items.map((item) => (_jsx("li", { className: "w-60 shrink-0", children: _jsx(ItemCard, { item: item, directory: props.directory, now: props.now, selected: props.selection?.kind === 'item' && props.selection.id === item.item_id, onOpen: () => props.onOpenItem(item.item_id) }) }, item.item_id))), fires.map((fire) => (_jsx("li", { className: "w-60 shrink-0", children: _jsx(FireCard, { fire: fire, selected: props.selection?.kind === 'fire' && props.selection.id === fire.id, onOpen: () => props.onOpenFire(fire.id) }) }, fire.id)))] }));
|
|
79
|
+
}
|
|
80
|
+
function AddButton({ label, onClick }) {
|
|
81
|
+
return (_jsx("button", { type: "button", "aria-label": label, title: label, onClick: onClick, className: "text-muted-foreground hover:bg-hover hover:text-foreground duration-fast focus-visible:ring-ring ml-auto inline-flex size-6 items-center justify-center rounded-sm opacity-0 transition-colors outline-none group-hover/day:opacity-100 focus-visible:opacity-100 focus-visible:ring-2", children: _jsx(PlusIcon, { className: "size-3.5" }) }));
|
|
82
|
+
}
|
|
83
|
+
function byTime(a, b) {
|
|
84
|
+
if (a.all_day !== b.all_day)
|
|
85
|
+
return a.all_day ? -1 : 1;
|
|
86
|
+
return (a.starts_at ?? '').localeCompare(b.starts_at ?? '');
|
|
87
|
+
}
|
|
88
|
+
export function WeekView(props) {
|
|
89
|
+
const t = useTranslations('calendar');
|
|
90
|
+
const locale = useLocale();
|
|
91
|
+
const zone = useDrop(props.items, props.onMove);
|
|
92
|
+
const today = dayKey(props.now);
|
|
93
|
+
const undated = props.items.filter((item) => !item.starts_at);
|
|
94
|
+
const weekday = new Intl.DateTimeFormat(locale, { weekday: 'short' });
|
|
95
|
+
const full = new Intl.DateTimeFormat(locale, { weekday: 'long', month: 'long', day: 'numeric' });
|
|
96
|
+
return (_jsxs("div", { className: "@container flex flex-col px-4 pb-10 md:px-6", children: [_jsxs("section", { "aria-label": t('noDate'), ...zone(UNDATED), className: "group/day border-border grid gap-2 border-b py-3 data-over:bg-hover @md:grid-cols-[6rem_minmax(0,1fr)] @md:gap-4", children: [_jsxs("header", { className: "flex h-7 items-center gap-1.5", children: [_jsx("span", { className: "text-muted-foreground text-sm", children: t('noDate') }), undated.length > 0 ? _jsx("span", { className: "text-muted-foreground text-xs tabular-nums", children: undated.length }) : null, _jsx(AddButton, { label: t('addOn', { day: t('noDate') }), onClick: () => props.onAdd(null) })] }), undated.length > 0 ? _jsx(Entries, { items: undated, fires: [], props: props }) : _jsx("p", { className: "text-muted-foreground self-center text-xs", children: t('noDateHint') })] }), weekDays(props.start).map((day) => {
|
|
97
|
+
const key = dayKey(day);
|
|
98
|
+
const items = props.items.filter((item) => itemDayKey(item) === key).sort(byTime);
|
|
99
|
+
const fires = props.fires.filter((fire) => fire.day === key);
|
|
100
|
+
const empty = items.length === 0 && fires.length === 0;
|
|
101
|
+
return (_jsxs("section", { "aria-label": full.format(day), ...zone(key), className: cn('group/day border-border grid gap-2 border-b py-3 last:border-b-0 data-over:bg-hover @md:grid-cols-[6rem_minmax(0,1fr)] @md:gap-4', empty && 'py-1.5'), children: [_jsxs("header", { className: "flex h-7 items-center gap-1.5", children: [_jsx("span", { className: "text-muted-foreground text-sm", children: weekday.format(day) }), _jsx("span", { className: cn('inline-flex h-6 min-w-6 items-center justify-center rounded-full px-1 text-sm font-medium tabular-nums', key === today && 'bg-foreground text-background'), "aria-current": key === today ? 'date' : undefined, children: day.getDate() }), _jsx(AddButton, { label: t('addOn', { day: full.format(day) }), onClick: () => props.onAdd(key) })] }), empty ? _jsx("span", {}) : _jsx(Entries, { items: items, fires: fires, props: props })] }, key));
|
|
102
|
+
})] }));
|
|
103
|
+
}
|
|
104
|
+
const MONTH_CELL_ENTRIES = 3;
|
|
105
|
+
export function MonthView(props) {
|
|
106
|
+
const t = useTranslations('calendar');
|
|
107
|
+
const locale = useLocale();
|
|
108
|
+
const zone = useDrop(props.items, props.onMove);
|
|
109
|
+
const today = dayKey(props.now);
|
|
110
|
+
const weeks = monthWeeks(props.anchor);
|
|
111
|
+
const weekday = new Intl.DateTimeFormat(locale, { weekday: 'short' });
|
|
112
|
+
const label = new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric' });
|
|
113
|
+
return (_jsxs("div", { className: "grid min-h-full grid-cols-7 auto-rows-[minmax(7rem,1fr)] grid-rows-[auto]", role: "grid", "aria-label": t('month'), children: [weeks[0].map((day) => (_jsx("span", { role: "columnheader", className: "text-muted-foreground border-border border-r border-b px-3 py-2 text-xs [&:nth-child(7n)]:border-r-0", children: weekday.format(day) }, day.getDay()))), weeks.flat().map((day) => {
|
|
114
|
+
const key = dayKey(day);
|
|
115
|
+
const items = props.items.filter((item) => itemDayKey(item) === key).sort(byTime);
|
|
116
|
+
const fires = props.fires.filter((fire) => fire.day === key);
|
|
117
|
+
const entries = [
|
|
118
|
+
...items.map((item) => ({ key: item.item_id, item, fire: null })),
|
|
119
|
+
...fires.map((fire) => ({ key: fire.id, item: null, fire })),
|
|
120
|
+
];
|
|
121
|
+
const outside = day.getMonth() !== props.anchor.getMonth();
|
|
122
|
+
return (_jsxs("div", { role: "gridcell", "aria-label": t('dayEntries', { day: label.format(day), count: entries.length }), ...zone(key), className: "border-border flex min-w-0 flex-col gap-1 border-r border-b p-1.5 data-over:bg-hover [&:nth-child(7n)]:border-r-0", children: [_jsx("button", { type: "button", onClick: () => props.onShowDay(day), "aria-label": t('showWeekOf', { day: label.format(day) }), className: cn('hover:bg-hover duration-fast inline-flex h-6 min-w-6 items-center justify-center self-start rounded-full px-1 text-sm tabular-nums transition-colors', outside && 'text-muted-foreground', key === today && 'bg-foreground text-background hover:bg-foreground'), children: day.getDate() }), _jsxs("ul", { className: "flex min-w-0 flex-col gap-0.5", children: [entries.slice(0, MONTH_CELL_ENTRIES).map((entry) => (_jsx("li", { children: entry.item ? (_jsxs("button", { type: "button", ...draggable(entry.item), "aria-pressed": props.selection?.kind === 'item' && props.selection.id === entry.item.item_id, onClick: () => props.onOpenItem(entry.item.item_id), className: "hover:bg-hover duration-fast aria-pressed:bg-active flex h-6 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 text-left text-xs transition-colors", children: [_jsx(ItemDot, { item: entry.item, now: props.now }), _jsx("span", { className: cn('truncate', outside && 'text-muted-foreground', entry.item.status === 'done' && 'line-through'), children: entry.item.title })] })) : (_jsxs("button", { type: "button", "aria-pressed": props.selection?.kind === 'fire' && props.selection.id === entry.fire.id, onClick: () => props.onOpenFire(entry.fire.id), className: "text-muted-foreground hover:bg-hover duration-fast aria-pressed:bg-active flex h-6 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 text-left text-xs transition-colors", children: [_jsx(LightningIcon, { className: cn('size-3 shrink-0', entry.fire.failed && 'text-kortix-red'), "aria-hidden": true }), _jsx("span", { className: "truncate", children: entry.fire.trigger.name || entry.fire.trigger.id })] })) }, entry.key))), entries.length > MONTH_CELL_ENTRIES ? (_jsx("li", { children: _jsx("button", { type: "button", onClick: () => props.onShowDay(day), className: "text-muted-foreground hover:text-foreground px-1.5 text-xs tabular-nums", children: t('more', { count: entries.length - MONTH_CELL_ENTRIES }) }) })) : null] })] }, key));
|
|
123
|
+
})] }));
|
|
124
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface WhenValue {
|
|
2
|
+
starts_at: string | null;
|
|
3
|
+
ends_at: string | null;
|
|
4
|
+
all_day: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const NO_DATE: WhenValue;
|
|
7
|
+
/** The value for a day: all day, or from `start` to an optional `end` (local `HH:MM`). An end not after the start is dropped. */
|
|
8
|
+
export declare function whenOn(day: Date, allDay: boolean, start: string, end?: string): WhenValue;
|
|
9
|
+
/** "Thu, Nov 19", "Thu, Nov 19, 3:00 PM" or "Thu, Nov 19, 3:00 PM – 4:00 PM". */
|
|
10
|
+
export declare function whenLabel(value: WhenValue, locale: string, noDate: string): string;
|
|
11
|
+
export declare function WhenPicker({ value, onChange }: {
|
|
12
|
+
value: WhenValue;
|
|
13
|
+
onChange: (value: WhenValue) => void;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// When an item happens, as one chip: "No date", "Thu, Nov 19",
|
|
4
|
+
// "Thu, Nov 19, 3:00 PM" or "Thu, Nov 19, 3:00 – 4:00 PM". It opens the Kortix
|
|
5
|
+
// `Calendar` in a popover (the access dialog's ExpiryPicker pattern) with an
|
|
6
|
+
// All day switch, a start and an optional end time, and Remove date. The New
|
|
7
|
+
// item dialog and the side panel use this one control.
|
|
8
|
+
import { CalendarBlankIcon } from '@phosphor-icons/react';
|
|
9
|
+
import { useState } from 'react';
|
|
10
|
+
import { useLocale, useTranslations } from '../../i18n/index.js';
|
|
11
|
+
import { cn } from '../../lib/utils.js';
|
|
12
|
+
import { Button } from '../../primitives/button.js';
|
|
13
|
+
import { Calendar } from '../../primitives/calendar.js';
|
|
14
|
+
import { Input } from '../../primitives/input.js';
|
|
15
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../primitives/popover.js';
|
|
16
|
+
import { Switch } from '../../primitives/switch.js';
|
|
17
|
+
import { dayKey, parseDayKey } from './calendar-dates.js';
|
|
18
|
+
export const NO_DATE = { starts_at: null, ends_at: null, all_day: false };
|
|
19
|
+
const pad = (n) => String(n).padStart(2, '0');
|
|
20
|
+
const DEFAULT_TIME = '09:00';
|
|
21
|
+
/** The day an item sits on (an all-day item keeps its written date), or undefined with no date. */
|
|
22
|
+
function dayOf(value) {
|
|
23
|
+
if (!value.starts_at)
|
|
24
|
+
return undefined;
|
|
25
|
+
return value.all_day ? parseDayKey(value.starts_at.slice(0, 10)) : new Date(value.starts_at);
|
|
26
|
+
}
|
|
27
|
+
/** `HH:MM` in the viewer's zone, or '' when there is none. */
|
|
28
|
+
function clockOf(iso) {
|
|
29
|
+
if (!iso)
|
|
30
|
+
return '';
|
|
31
|
+
const at = new Date(iso);
|
|
32
|
+
return `${pad(at.getHours())}:${pad(at.getMinutes())}`;
|
|
33
|
+
}
|
|
34
|
+
/** The value for a day: all day, or from `start` to an optional `end` (local `HH:MM`). An end not after the start is dropped. */
|
|
35
|
+
export function whenOn(day, allDay, start, end = '') {
|
|
36
|
+
if (allDay)
|
|
37
|
+
return { starts_at: `${dayKey(day)}T00:00:00.000Z`, ends_at: null, all_day: true };
|
|
38
|
+
const at = (clock) => {
|
|
39
|
+
const [h, m] = clock.split(':').map(Number);
|
|
40
|
+
return new Date(day.getFullYear(), day.getMonth(), day.getDate(), h ?? 9, m ?? 0);
|
|
41
|
+
};
|
|
42
|
+
const startsAt = at(start || DEFAULT_TIME);
|
|
43
|
+
const endsAt = end ? at(end) : null;
|
|
44
|
+
return {
|
|
45
|
+
starts_at: startsAt.toISOString(),
|
|
46
|
+
ends_at: endsAt && endsAt > startsAt ? endsAt.toISOString() : null,
|
|
47
|
+
all_day: false,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** "Thu, Nov 19", "Thu, Nov 19, 3:00 PM" or "Thu, Nov 19, 3:00 PM – 4:00 PM". */
|
|
51
|
+
export function whenLabel(value, locale, noDate) {
|
|
52
|
+
const day = dayOf(value);
|
|
53
|
+
if (!day)
|
|
54
|
+
return noDate;
|
|
55
|
+
const dayLabel = new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric' }).format(day);
|
|
56
|
+
if (value.all_day)
|
|
57
|
+
return dayLabel;
|
|
58
|
+
const clock = new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' });
|
|
59
|
+
const start = clock.format(day);
|
|
60
|
+
return value.ends_at ? `${dayLabel}, ${start} – ${clock.format(new Date(value.ends_at))}` : `${dayLabel}, ${start}`;
|
|
61
|
+
}
|
|
62
|
+
export function WhenPicker({ value, onChange }) {
|
|
63
|
+
const t = useTranslations('calendar');
|
|
64
|
+
const locale = useLocale();
|
|
65
|
+
const [open, setOpen] = useState(false);
|
|
66
|
+
const day = dayOf(value);
|
|
67
|
+
const start = value.all_day ? DEFAULT_TIME : clockOf(value.starts_at) || DEFAULT_TIME;
|
|
68
|
+
const end = value.all_day ? '' : clockOf(value.ends_at);
|
|
69
|
+
const label = whenLabel(value, locale, t('noDate'));
|
|
70
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", size: "xs", "aria-label": `${t('when')}: ${label}`, className: cn('font-normal', !day && 'text-muted-foreground'), children: [_jsx(CalendarBlankIcon, { className: "size-3.5 shrink-0", "aria-hidden": true }), _jsx("span", { className: "tabular-nums", children: label })] }) }), _jsxs(PopoverContent, { align: "start", className: "w-auto p-0", children: [_jsx(Calendar, { mode: "single", selected: day, defaultMonth: day, onSelect: (picked) => {
|
|
71
|
+
if (!picked)
|
|
72
|
+
return;
|
|
73
|
+
// A first pick is a date only; a moved item keeps all day or its times.
|
|
74
|
+
onChange(whenOn(picked, day ? value.all_day : true, start, end));
|
|
75
|
+
if (!day || value.all_day)
|
|
76
|
+
setOpen(false);
|
|
77
|
+
} }), day ? (_jsxs("div", { className: "flex flex-col gap-2 border-t px-3 py-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("label", { className: "text-muted-foreground flex items-center gap-2 text-xs", children: [_jsx(Switch, { checked: value.all_day, "aria-label": t('allDay'), onCheckedChange: (allDay) => onChange(whenOn(day, allDay, start, end)) }), t('allDay')] }), _jsx(Button, { type: "button", variant: "ghost", size: "xs", className: "ml-auto", onClick: () => {
|
|
78
|
+
onChange(NO_DATE);
|
|
79
|
+
setOpen(false);
|
|
80
|
+
}, children: t('clearDate') })] }), value.all_day ? null : (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Input, { type: "time", size: "xs", "aria-label": t('startTime'), value: start, className: "w-auto", onChange: (event) => event.target.value && onChange(whenOn(day, false, event.target.value, end)) }), _jsx("span", { className: "text-muted-foreground text-xs", children: "\u2013" }), _jsx(Input, { type: "time", size: "xs", "aria-label": t('endTime'), value: end, className: "w-auto", onChange: (event) => onChange(whenOn(day, false, start, event.target.value)) })] }))] })) : null] })] }));
|
|
81
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CalendarDirectory } from './calendar-people.js';
|
|
2
|
+
/** The `@query` the caret is in, or null. */
|
|
3
|
+
export declare function mentionQueryAt(text: string, caret: number): {
|
|
4
|
+
start: number;
|
|
5
|
+
query: string;
|
|
6
|
+
} | null;
|
|
7
|
+
export declare function MentionTextarea({ value, onChange, directory, onSubmit, onBlur, placeholder, minHeight, className, autoFocus, ariaLabel, }: {
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
directory: CalendarDirectory;
|
|
11
|
+
/** Cmd/Ctrl+Enter. */
|
|
12
|
+
onSubmit?: () => void;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
minHeight?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
ariaLabel: string;
|
|
19
|
+
}): import("react").JSX.Element;
|