@xynolog/react-ui 0.0.0-stage → 0.8.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/LICENSE +201 -0
- package/README.md +379 -2
- package/dist/PdfAnnotationCanvas.client-S64VRLUN.css +193 -0
- package/dist/PdfAnnotationCanvas.client-V7R4NXFO.js +799 -0
- package/dist/ar-AIV7P4FL.js +594 -0
- package/dist/bn-J2OR57PB.js +594 -0
- package/dist/chunk-4L3TYOIV.js +172 -0
- package/dist/chunk-BM76QBIO.js +594 -0
- package/dist/chunk-D2O46PZQ.js +240 -0
- package/dist/chunk-O23TLLXW.js +42 -0
- package/dist/chunk-WGTUIB6C.js +304 -0
- package/dist/cs-JNEAMHFB.js +594 -0
- package/dist/da-UY5ZRVTZ.js +594 -0
- package/dist/de-EETVXC42.js +594 -0
- package/dist/el-S5YKDMTL.js +594 -0
- package/dist/en-3YQWF45H.js +61 -0
- package/dist/es-GHA7S27R.js +594 -0
- package/dist/fa-JTR3GF6I.js +594 -0
- package/dist/fi-CQZ7BW57.js +594 -0
- package/dist/fr-OJH2WIY7.js +594 -0
- package/dist/he-2DBXWA2V.js +594 -0
- package/dist/hi-NZP7B55I.js +594 -0
- package/dist/id-4KXFKWOI.js +594 -0
- package/dist/index.css +4134 -0
- package/dist/index.d.ts +4040 -0
- package/dist/index.js +29638 -0
- package/dist/it-XBMYGKKY.js +594 -0
- package/dist/ja-OVHZS3EH.js +594 -0
- package/dist/ko-NW2MVM5L.js +594 -0
- package/dist/ms-RXLPBZLK.js +594 -0
- package/dist/nl-77CTBEDA.js +594 -0
- package/dist/no-RAPO56SE.js +594 -0
- package/dist/pl-XCFXZCTT.js +594 -0
- package/dist/pt-EMBE27IS.js +594 -0
- package/dist/ro-M7QLJBYN.js +594 -0
- package/dist/sv-ST6CITQY.js +594 -0
- package/dist/test-utils.css +112 -0
- package/dist/test-utils.d.ts +126 -0
- package/dist/test-utils.js +13119 -0
- package/dist/th-EEQGL3G7.js +594 -0
- package/dist/tr-5FYHZQKD.js +594 -0
- package/dist/uk-VTWDC467.js +594 -0
- package/dist/vi-ISBKJ66X.js +594 -0
- package/dist/zh-2AW2N66Z.js +594 -0
- package/package.json +129 -4
- package/src/components/Button/Button.tsx +188 -0
- package/src/components/Button/__tests__/Button.test.tsx +449 -0
- package/src/components/CodeMirrorRenderer.tsx +536 -0
- package/src/components/DelegateProgress.tsx +308 -0
- package/src/components/ErrorBoundary.tsx +174 -0
- package/src/components/ItemFoundLog.tsx +42 -0
- package/src/components/LiveRegion.tsx +261 -0
- package/src/components/ProtectedErrorBoundary.css +121 -0
- package/src/components/ProtectedErrorBoundary.tsx +114 -0
- package/src/components/ResizeHandle.tsx +167 -0
- package/src/components/ResourceTagsInline.tsx +120 -0
- package/src/components/SessionExpiryBanner.css +67 -0
- package/src/components/SessionExpiryBanner.tsx +74 -0
- package/src/components/SessionTimer.tsx +17 -0
- package/src/components/StatusDisplay.css +439 -0
- package/src/components/StatusDisplay.tsx +131 -0
- package/src/components/Toast.css +136 -0
- package/src/components/Toast.tsx +217 -0
- package/src/components/Toolbar.tsx +194 -0
- package/src/components/UserMenuSkeleton.tsx +13 -0
- package/src/components/__tests__/DelegateProgress.denominator.test.tsx +102 -0
- package/src/components/__tests__/DelegateProgress.test.tsx +649 -0
- package/src/components/__tests__/ErrorBoundary.test.tsx +565 -0
- package/src/components/__tests__/LiveRegion.a11y.test.tsx +258 -0
- package/src/components/__tests__/LiveRegion.hooks.test.tsx +140 -0
- package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +225 -0
- package/src/components/__tests__/ResizeHandle.test.tsx +159 -0
- package/src/components/__tests__/ResourceTagsInline.test.tsx +325 -0
- package/src/components/__tests__/SessionExpiryBanner.test.tsx +124 -0
- package/src/components/__tests__/SessionTimer.test.tsx +199 -0
- package/src/components/__tests__/StatusDisplay.test.tsx +179 -0
- package/src/components/__tests__/Toast.test.tsx +96 -0
- package/src/components/__tests__/Toolbar.test.tsx +111 -0
- package/src/components/__tests__/UserMenuSkeleton.test.tsx +182 -0
- package/src/components/annotation/AnchoredTextNotice.tsx +36 -0
- package/src/components/annotation/AnnotateToolbar.tsx +531 -0
- package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +127 -0
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +304 -0
- package/src/components/annotation/annotation-entries.css +138 -0
- package/src/components/annotation/annotations.css +93 -0
- package/src/components/annotation/references.css +300 -0
- package/src/components/annotation-popups/JsonLdView.tsx +127 -0
- package/src/components/annotation-popups/SharedPopupElements.tsx +131 -0
- package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +432 -0
- package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +297 -0
- package/src/components/branding/Branding.css +129 -0
- package/src/components/branding/XynologBranding.tsx +41 -0
- package/src/components/branding/__tests__/XynologBranding.test.tsx +383 -0
- package/src/components/error-states/ResourceErrorState.tsx +30 -0
- package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +102 -0
- package/src/components/error-states/errors.css +34 -0
- package/src/components/image-annotation/AnnotationOverlay.tsx +307 -0
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +514 -0
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +169 -0
- package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +83 -0
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +228 -0
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +204 -0
- package/src/components/layout/Header.css +99 -0
- package/src/components/layout/LeftSidebar.css +115 -0
- package/src/components/layout/LeftSidebar.tsx +150 -0
- package/src/components/layout/PageLayout.tsx +49 -0
- package/src/components/layout/ResizeHandle.css +110 -0
- package/src/components/layout/SkipLinks.css +84 -0
- package/src/components/layout/SkipLinks.tsx +36 -0
- package/src/components/layout/UnifiedHeader.tsx +151 -0
- package/src/components/layout/__tests__/LeftSidebar.test.tsx +426 -0
- package/src/components/layout/__tests__/PageLayout.test.tsx +311 -0
- package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +218 -0
- package/src/components/layout/__tests__/UnifiedHeader.test.tsx +555 -0
- package/src/components/loading-states/ComposeLoadingState.tsx +19 -0
- package/src/components/loading-states/ResourceLoadingState.tsx +13 -0
- package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +37 -0
- package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +31 -0
- package/src/components/loading-states/loading.css +42 -0
- package/src/components/modals/ComposeStep.tsx +245 -0
- package/src/components/modals/ConfigureGatherStep.tsx +110 -0
- package/src/components/modals/ConfigureGenerationStep.tsx +458 -0
- package/src/components/modals/ConfigureSearchStep.tsx +124 -0
- package/src/components/modals/ContextSummary.tsx +317 -0
- package/src/components/modals/CorpusPane.tsx +96 -0
- package/src/components/modals/DiscardPrompt.tsx +44 -0
- package/src/components/modals/GatherContextStep.tsx +480 -0
- package/src/components/modals/KbIdentityConflictModal.tsx +122 -0
- package/src/components/modals/KeyboardShortcutsHelpModal.tsx +238 -0
- package/src/components/modals/PermissionDeniedModal.tsx +207 -0
- package/src/components/modals/ReferenceWizardModal.tsx +656 -0
- package/src/components/modals/ResourceGenerateModal.tsx +457 -0
- package/src/components/modals/SearchModal.css +1019 -0
- package/src/components/modals/SearchModal.tsx +334 -0
- package/src/components/modals/SearchResultsStep.tsx +117 -0
- package/src/components/modals/SessionEndedModal.tsx +148 -0
- package/src/components/modals/WizardFooter.tsx +72 -0
- package/src/components/modals/__tests__/ComposeStep.test.tsx +187 -0
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +92 -0
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +574 -0
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +124 -0
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +702 -0
- package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +102 -0
- package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +115 -0
- package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +218 -0
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +936 -0
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +532 -0
- package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +95 -0
- package/src/components/modals/__tests__/SearchModal.basic.test.tsx +84 -0
- package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +162 -0
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +237 -0
- package/src/components/modals/__tests__/SearchModal.translations.test.tsx +91 -0
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +95 -0
- package/src/components/modals/__tests__/SessionEndedModal.test.tsx +171 -0
- package/src/components/modals/__tests__/WizardFooter.test.tsx +446 -0
- package/src/components/modals/__tests__/search-modal-harness.ts +82 -0
- package/src/components/modals/modals.css +655 -0
- package/src/components/navigation/CollapsibleResourceNavigation.css +10 -0
- package/src/components/navigation/CollapsibleResourceNavigation.tsx +364 -0
- package/src/components/navigation/NavigationMenu.css +59 -0
- package/src/components/navigation/NavigationMenu.tsx +66 -0
- package/src/components/navigation/NavigationTabs.css +466 -0
- package/src/components/navigation/ObservableLink.tsx +90 -0
- package/src/components/navigation/SimpleNavigation.css +9 -0
- package/src/components/navigation/SimpleNavigation.tsx +169 -0
- package/src/components/navigation/SortableResourceTab.tsx +122 -0
- package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +302 -0
- package/src/components/navigation/__tests__/NavigationMenu.test.tsx +399 -0
- package/src/components/navigation/__tests__/ObservableLink.test.tsx +85 -0
- package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +193 -0
- package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +421 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +10 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.css +288 -0
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +632 -0
- package/src/components/pdf-annotation/PdfPageView.tsx +527 -0
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +295 -0
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +166 -0
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +1719 -0
- package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +61 -0
- package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +110 -0
- package/src/components/pdf-annotation/estimate-slot-height.ts +31 -0
- package/src/components/pdf-annotation/rects-for-page.ts +50 -0
- package/src/components/resource/AnnotateView.tsx +373 -0
- package/src/components/resource/AnnotationHistory.tsx +169 -0
- package/src/components/resource/BrowseView.tsx +440 -0
- package/src/components/resource/DownloadFileLink.tsx +53 -0
- package/src/components/resource/HistoryEvent.tsx +186 -0
- package/src/components/resource/ResourceViewer.tsx +617 -0
- package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +482 -0
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +78 -0
- package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +147 -0
- package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +143 -0
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +257 -0
- package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +123 -0
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +76 -0
- package/src/components/resource/__tests__/BrowseView.links.test.tsx +84 -0
- package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +165 -0
- package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +200 -0
- package/src/components/resource/__tests__/BrowseView.registry.test.tsx +57 -0
- package/src/components/resource/__tests__/BrowseView.test.tsx +915 -0
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +571 -0
- package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +103 -0
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +250 -0
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +262 -0
- package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +166 -0
- package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +112 -0
- package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +207 -0
- package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +274 -0
- package/src/components/resource/__tests__/annotation-interactions.test.tsx +116 -0
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +183 -0
- package/src/components/resource/__tests__/browse-renderers.test.tsx +47 -0
- package/src/components/resource/__tests__/download-link.test.tsx +171 -0
- package/src/components/resource/__tests__/event-formatting.test.ts +379 -0
- package/src/components/resource/__tests__/inline-embedding.test.tsx +133 -0
- package/src/components/resource/__tests__/media-completeness.test.tsx +144 -0
- package/src/components/resource/annotate-renderers.tsx +186 -0
- package/src/components/resource/browse-renderers.tsx +133 -0
- package/src/components/resource/event-formatting.ts +393 -0
- package/src/components/resource/panels/AssessmentEntry.tsx +127 -0
- package/src/components/resource/panels/AssessmentPanel.tsx +309 -0
- package/src/components/resource/panels/CollaborationPanel.css +184 -0
- package/src/components/resource/panels/CollaborationPanel.tsx +228 -0
- package/src/components/resource/panels/CommentEntry.tsx +242 -0
- package/src/components/resource/panels/CommentsPanel.tsx +320 -0
- package/src/components/resource/panels/DelegateSection.css +330 -0
- package/src/components/resource/panels/DelegateSection.tsx +282 -0
- package/src/components/resource/panels/DelegateShell.tsx +134 -0
- package/src/components/resource/panels/HighlightEntry.tsx +83 -0
- package/src/components/resource/panels/HighlightPanel.tsx +212 -0
- package/src/components/resource/panels/JsonLdPanel.css +37 -0
- package/src/components/resource/panels/JsonLdPanel.tsx +119 -0
- package/src/components/resource/panels/PanelHeader.tsx +22 -0
- package/src/components/resource/panels/ReferenceEntry.tsx +232 -0
- package/src/components/resource/panels/ReferencesPanel.css +108 -0
- package/src/components/resource/panels/ReferencesPanel.tsx +626 -0
- package/src/components/resource/panels/ResourceInfoPanel.css +183 -0
- package/src/components/resource/panels/ResourceInfoPanel.tsx +433 -0
- package/src/components/resource/panels/StatisticsPanel.css +127 -0
- package/src/components/resource/panels/StatisticsPanel.tsx +145 -0
- package/src/components/resource/panels/TagEntry.tsx +87 -0
- package/src/components/resource/panels/TaggingPanel.tsx +554 -0
- package/src/components/resource/panels/UnifiedAnnotationsPanel.css +129 -0
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +384 -0
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +292 -0
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +685 -0
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +685 -0
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +750 -0
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +877 -0
- package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +623 -0
- package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +212 -0
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +236 -0
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +506 -0
- package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +132 -0
- package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +230 -0
- package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +54 -0
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +578 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +193 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +193 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +1080 -0
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +812 -0
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +106 -0
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +329 -0
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +250 -0
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +772 -0
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +207 -0
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +89 -0
- package/src/components/resource/panels/__tests__/agent-label.test.ts +136 -0
- package/src/components/resource/panels/agent-label.ts +35 -0
- package/src/components/settings/SettingsPanel.css +92 -0
- package/src/components/settings/SettingsPanel.tsx +251 -0
- package/src/components/settings/__tests__/SettingsPanel.test.tsx +260 -0
- package/src/components/toolbar/Toolbar.css +245 -0
- package/src/components/viewers/ImageViewer.tsx +18 -0
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +57 -0
- package/src/components/viewers/index.ts +1 -0
- package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +181 -0
- package/src/features/auth/auth.css +120 -0
- package/src/features/auth/components/AuthErrorDisplay.tsx +89 -0
- package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +387 -0
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +161 -0
- package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +183 -0
- package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +73 -0
- package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +422 -0
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +117 -0
- package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +481 -0
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +161 -0
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +600 -0
- package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +256 -0
- package/src/features/resource-compose/components/ResourceComposePage.tsx +809 -0
- package/src/features/resource-compose/components/UploadProgressBar.tsx +125 -0
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +195 -0
- package/src/features/resource-compose/state/compose-page-state-unit.ts +187 -0
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +338 -0
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +449 -0
- package/src/features/resource-discovery/components/ResourceCard.tsx +80 -0
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +330 -0
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +477 -0
- package/src/features/resource-discovery/state/discover-state-unit.ts +162 -0
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +260 -0
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +570 -0
- package/src/features/resource-viewer/__tests__/generation-params.test.ts +49 -0
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +1058 -0
- package/src/features/resource-viewer/generation-params.ts +23 -0
- package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +77 -0
- package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +38 -0
- package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +178 -0
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +505 -0
- package/src/features/resource-viewer/state/resource-loader-state-unit.ts +93 -0
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +156 -0
- package/src/styles/base/reset.css +105 -0
- package/src/styles/base/utilities.css +35 -0
- package/src/styles/core/badges.css +17 -0
- package/src/styles/core/buttons.css +772 -0
- package/src/styles/core/checkboxes.css +85 -0
- package/src/styles/core/forms.css +237 -0
- package/src/styles/core/index.css +43 -0
- package/src/styles/core/indicators.css +24 -0
- package/src/styles/core/inputs.css +164 -0
- package/src/styles/core/progress.css +85 -0
- package/src/styles/core/selects.css +119 -0
- package/src/styles/core/sliders.css +180 -0
- package/src/styles/core/tags.css +86 -0
- package/src/styles/core/textareas.css +104 -0
- package/src/styles/core/toggles.css +82 -0
- package/src/styles/features/compose.css +341 -0
- package/src/styles/features/entity-tags.css +140 -0
- package/src/styles/features/recent-docs.css +97 -0
- package/src/styles/features/resource-discovery.css +349 -0
- package/src/styles/features/resource-viewer.css +609 -0
- package/src/styles/features/resource.css +483 -0
- package/src/styles/features/schemas.css +222 -0
- package/src/styles/index.css +84 -0
- package/src/styles/layout/layout.css +28 -0
- package/src/styles/motivations/motivation-assessment.css +179 -0
- package/src/styles/motivations/motivation-comment.css +164 -0
- package/src/styles/motivations/motivation-highlight.css +132 -0
- package/src/styles/motivations/motivation-reference.css +167 -0
- package/src/styles/motivations/motivation-tag.css +182 -0
- package/src/styles/panels/history-panel.css +212 -0
- package/src/styles/panels/user-panel.css +21 -0
- package/src/styles/patterns/cards.css +26 -0
- package/src/styles/patterns/panel-helpers.css +32 -0
- package/src/styles/patterns/panels-base.css +272 -0
- package/src/styles/utilities/contrast.css +280 -0
- package/src/styles/utilities/focus-extended.css +276 -0
- package/src/styles/utilities/focus.css +41 -0
- package/src/styles/utilities/motion-overrides.css +286 -0
- package/src/styles/utilities/motion.css +184 -0
- package/src/styles/utilities/semantic-indicators.css +254 -0
- package/src/styles/variables.css +410 -0
- package/translations/ar.json +534 -0
- package/translations/bn.json +534 -0
- package/translations/cs.json +534 -0
- package/translations/da.json +534 -0
- package/translations/de.json +534 -0
- package/translations/el.json +534 -0
- package/translations/en.json +534 -0
- package/translations/es.json +534 -0
- package/translations/fa.json +534 -0
- package/translations/fi.json +534 -0
- package/translations/fr.json +534 -0
- package/translations/he.json +534 -0
- package/translations/hi.json +534 -0
- package/translations/id.json +534 -0
- package/translations/it.json +534 -0
- package/translations/ja.json +534 -0
- package/translations/ko.json +534 -0
- package/translations/ms.json +534 -0
- package/translations/nl.json +534 -0
- package/translations/no.json +534 -0
- package/translations/pl.json +534 -0
- package/translations/pt.json +534 -0
- package/translations/ro.json +534 -0
- package/translations/sv.json +534 -0
- package/translations/th.json +534 -0
- package/translations/tr.json +534 -0
- package/translations/uk.json +534 -0
- package/translations/vi.json +534 -0
- package/translations/zh.json +534 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
4
|
+
import { readyValue } from '@xynolog/sdk';
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogPanel,
|
|
8
|
+
Transition,
|
|
9
|
+
TransitionChild,
|
|
10
|
+
} from '@headlessui/react';
|
|
11
|
+
import { map } from 'rxjs/operators';
|
|
12
|
+
import { SEARCH_DEBOUNCE_MS, getResourceId } from '@xynolog/core';
|
|
13
|
+
import { createSearchPipeline } from '@xynolog/sdk';
|
|
14
|
+
import { useSearchAnnouncements } from '../../hooks/useSearchAnnouncements';
|
|
15
|
+
import { useXynolog } from '../../session/XynologProvider';
|
|
16
|
+
import { useObservable } from '../../hooks/useObservable';
|
|
17
|
+
import './SearchModal.css';
|
|
18
|
+
|
|
19
|
+
const SEARCH_LIMIT = 5;
|
|
20
|
+
|
|
21
|
+
export interface SearchModalProps {
|
|
22
|
+
isOpen: boolean;
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
onNavigate: (type: 'resource' | 'entity', id: string) => void;
|
|
25
|
+
/** Every string the modal shows; it has none of its own. */
|
|
26
|
+
translations: {
|
|
27
|
+
/** The dialog's name and its search box's, as assistive technology says them. */
|
|
28
|
+
title: string;
|
|
29
|
+
placeholder: string;
|
|
30
|
+
searching: string;
|
|
31
|
+
noResults: string;
|
|
32
|
+
startTyping: string;
|
|
33
|
+
navigate: string;
|
|
34
|
+
select: string;
|
|
35
|
+
close: string;
|
|
36
|
+
enter: string;
|
|
37
|
+
esc: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface SearchResult {
|
|
42
|
+
type: 'resource' | 'entity';
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
entityType?: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function SearchModal({
|
|
50
|
+
isOpen,
|
|
51
|
+
onClose,
|
|
52
|
+
onNavigate,
|
|
53
|
+
translations,
|
|
54
|
+
}: SearchModalProps) {
|
|
55
|
+
const { announceSearchResults, announceSearching } = useSearchAnnouncements();
|
|
56
|
+
const xynolog = useObservable(useXynolog().activeSession$)?.client;
|
|
57
|
+
// Pipeline factory captures `xynolog` once via useState; if xynolog is
|
|
58
|
+
// still loading at first render the captured value would be undefined.
|
|
59
|
+
// Route through a ref so the fetch closure reads the latest client.
|
|
60
|
+
const xynologRef = useRef(xynolog);
|
|
61
|
+
xynologRef.current = xynolog;
|
|
62
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
63
|
+
|
|
64
|
+
// ── Search pipeline ─────────────────────────────────────────────────────
|
|
65
|
+
// The fetch closure maps ResourceDescriptor → SearchResult inside the
|
|
66
|
+
// map operator. The helper handles debounce, switchMap, and loading state.
|
|
67
|
+
const [pipeline] = useState(() =>
|
|
68
|
+
createSearchPipeline<SearchResult>(
|
|
69
|
+
(q) =>
|
|
70
|
+
xynologRef.current!.match.resources(q, { limit: SEARCH_LIMIT }).pipe(
|
|
71
|
+
map((st) => {
|
|
72
|
+
const resources = readyValue(st)?.resources;
|
|
73
|
+
if (resources === undefined) return undefined;
|
|
74
|
+
return resources
|
|
75
|
+
.map((resource): SearchResult | null => {
|
|
76
|
+
const id = getResourceId(resource);
|
|
77
|
+
if (!id) return null;
|
|
78
|
+
return {
|
|
79
|
+
type: 'resource',
|
|
80
|
+
id,
|
|
81
|
+
name: resource.name,
|
|
82
|
+
description: resource.description?.substring(0, 150),
|
|
83
|
+
};
|
|
84
|
+
})
|
|
85
|
+
.filter((r): r is SearchResult => r !== null);
|
|
86
|
+
}),
|
|
87
|
+
),
|
|
88
|
+
{ debounceMs: SEARCH_DEBOUNCE_MS },
|
|
89
|
+
),
|
|
90
|
+
);
|
|
91
|
+
useEffect(() => () => pipeline.dispose(), [pipeline]);
|
|
92
|
+
|
|
93
|
+
const query = useObservable(pipeline.query$) ?? '';
|
|
94
|
+
const searchState = useObservable(pipeline.state$);
|
|
95
|
+
const results = searchState?.results ?? [];
|
|
96
|
+
const loading = searchState?.isSearching ?? false;
|
|
97
|
+
|
|
98
|
+
// Reset query and selection when modal opens.
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (isOpen) {
|
|
101
|
+
pipeline.setQuery('');
|
|
102
|
+
setSelectedIndex(0);
|
|
103
|
+
}
|
|
104
|
+
}, [isOpen, pipeline]);
|
|
105
|
+
|
|
106
|
+
// Reset selection cursor when results change.
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
setSelectedIndex(0);
|
|
109
|
+
}, [results.length]);
|
|
110
|
+
|
|
111
|
+
// Accessibility announcements for search lifecycle.
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (!query.trim()) return;
|
|
114
|
+
if (loading) {
|
|
115
|
+
announceSearching();
|
|
116
|
+
} else {
|
|
117
|
+
announceSearchResults(results.length, query);
|
|
118
|
+
}
|
|
119
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
+
}, [loading, results.length]);
|
|
121
|
+
|
|
122
|
+
// Handle keyboard navigation
|
|
123
|
+
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
124
|
+
if (e.key === 'ArrowDown') {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
setSelectedIndex((prev) => (prev + 1) % Math.max(1, results.length));
|
|
127
|
+
} else if (e.key === 'ArrowUp') {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
setSelectedIndex(
|
|
130
|
+
(prev) =>
|
|
131
|
+
(prev - 1 + Math.max(1, results.length)) %
|
|
132
|
+
Math.max(1, results.length),
|
|
133
|
+
);
|
|
134
|
+
} else if (e.key === 'Enter' && results[selectedIndex]) {
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
navigateToResult(results[selectedIndex]);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const navigateToResult = (result: SearchResult) => {
|
|
141
|
+
onClose();
|
|
142
|
+
onNavigate(result.type, result.id);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<Transition appear show={isOpen}>
|
|
147
|
+
<Dialog
|
|
148
|
+
as="div"
|
|
149
|
+
className="xynolog-search-modal"
|
|
150
|
+
onClose={onClose}
|
|
151
|
+
aria-label={translations.title}
|
|
152
|
+
>
|
|
153
|
+
{/* Backdrop */}
|
|
154
|
+
<TransitionChild
|
|
155
|
+
enter="ease-out duration-200"
|
|
156
|
+
enterFrom="opacity-0"
|
|
157
|
+
enterTo="opacity-100"
|
|
158
|
+
leave="ease-in duration-150"
|
|
159
|
+
leaveFrom="opacity-100"
|
|
160
|
+
leaveTo="opacity-0"
|
|
161
|
+
>
|
|
162
|
+
<div className="xynolog-search-modal__backdrop" />
|
|
163
|
+
</TransitionChild>
|
|
164
|
+
|
|
165
|
+
{/* Modal */}
|
|
166
|
+
<div className="xynolog-search-modal__wrapper">
|
|
167
|
+
<div className="xynolog-search-modal__centering">
|
|
168
|
+
<TransitionChild
|
|
169
|
+
enter="ease-out duration-200"
|
|
170
|
+
enterFrom="opacity-0 scale-95"
|
|
171
|
+
enterTo="opacity-100 scale-100"
|
|
172
|
+
leave="ease-in duration-150"
|
|
173
|
+
leaveFrom="opacity-100 scale-100"
|
|
174
|
+
leaveTo="opacity-0 scale-95"
|
|
175
|
+
>
|
|
176
|
+
<DialogPanel className="xynolog-search-modal__panel">
|
|
177
|
+
{/* Search Input */}
|
|
178
|
+
<div className="xynolog-search-modal__input-container">
|
|
179
|
+
<div className="xynolog-search-modal__search-icon-wrapper">
|
|
180
|
+
<svg
|
|
181
|
+
className="xynolog-search-modal__search-icon"
|
|
182
|
+
fill="none"
|
|
183
|
+
stroke="currentColor"
|
|
184
|
+
viewBox="0 0 24 24"
|
|
185
|
+
>
|
|
186
|
+
<path
|
|
187
|
+
strokeLinecap="round"
|
|
188
|
+
strokeLinejoin="round"
|
|
189
|
+
strokeWidth={2}
|
|
190
|
+
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
191
|
+
/>
|
|
192
|
+
</svg>
|
|
193
|
+
</div>
|
|
194
|
+
<input
|
|
195
|
+
type="text"
|
|
196
|
+
value={query}
|
|
197
|
+
onChange={(e) => pipeline.setQuery(e.target.value)}
|
|
198
|
+
onKeyDown={handleKeyDown}
|
|
199
|
+
aria-label={translations.title}
|
|
200
|
+
placeholder={translations.placeholder}
|
|
201
|
+
className="xynolog-search-modal__input"
|
|
202
|
+
autoFocus
|
|
203
|
+
/>
|
|
204
|
+
<div className="xynolog-search-modal__esc-wrapper">
|
|
205
|
+
<kbd className="xynolog-search-modal__kbd">
|
|
206
|
+
{translations.esc}
|
|
207
|
+
</kbd>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
{/* Results */}
|
|
212
|
+
<div className="xynolog-search-modal__results">
|
|
213
|
+
{loading && (
|
|
214
|
+
<div className="xynolog-search-modal__empty">
|
|
215
|
+
{translations.searching}
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
|
|
219
|
+
{!loading && query && results.length === 0 && (
|
|
220
|
+
<div className="xynolog-search-modal__empty">
|
|
221
|
+
{translations.noResults} "{query}"
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{!loading && results.length > 0 && (
|
|
226
|
+
<div className="xynolog-search-modal__results-list">
|
|
227
|
+
{results.map((result, index) => (
|
|
228
|
+
<button
|
|
229
|
+
key={`${result.type}-${result.id}`}
|
|
230
|
+
onClick={() => navigateToResult(result)}
|
|
231
|
+
onMouseEnter={() => setSelectedIndex(index)}
|
|
232
|
+
className={`xynolog-search-modal__result ${
|
|
233
|
+
index === selectedIndex
|
|
234
|
+
? 'xynolog-search-modal__result--selected'
|
|
235
|
+
: ''
|
|
236
|
+
}`}
|
|
237
|
+
>
|
|
238
|
+
<div className="xynolog-search-modal__result-icon-wrapper">
|
|
239
|
+
{result.type === 'resource' ? (
|
|
240
|
+
<svg
|
|
241
|
+
className="xynolog-search-modal__result-icon xynolog-search-modal__result-icon--resource"
|
|
242
|
+
fill="none"
|
|
243
|
+
stroke="currentColor"
|
|
244
|
+
viewBox="0 0 24 24"
|
|
245
|
+
>
|
|
246
|
+
<path
|
|
247
|
+
strokeLinecap="round"
|
|
248
|
+
strokeLinejoin="round"
|
|
249
|
+
strokeWidth={2}
|
|
250
|
+
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
251
|
+
/>
|
|
252
|
+
</svg>
|
|
253
|
+
) : (
|
|
254
|
+
<svg
|
|
255
|
+
className="xynolog-search-modal__result-icon xynolog-search-modal__result-icon--entity"
|
|
256
|
+
fill="none"
|
|
257
|
+
stroke="currentColor"
|
|
258
|
+
viewBox="0 0 24 24"
|
|
259
|
+
>
|
|
260
|
+
<path
|
|
261
|
+
strokeLinecap="round"
|
|
262
|
+
strokeLinejoin="round"
|
|
263
|
+
strokeWidth={2}
|
|
264
|
+
d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"
|
|
265
|
+
/>
|
|
266
|
+
</svg>
|
|
267
|
+
)}
|
|
268
|
+
</div>
|
|
269
|
+
<div className="xynolog-search-modal__result-content">
|
|
270
|
+
<div className="xynolog-search-modal__result-header">
|
|
271
|
+
<span className="xynolog-search-modal__result-name">
|
|
272
|
+
{result.name}
|
|
273
|
+
</span>
|
|
274
|
+
{result.type === 'entity' &&
|
|
275
|
+
result.entityType && (
|
|
276
|
+
<span className="xynolog-search-modal__result-badge">
|
|
277
|
+
{result.entityType}
|
|
278
|
+
</span>
|
|
279
|
+
)}
|
|
280
|
+
</div>
|
|
281
|
+
{result.description && (
|
|
282
|
+
<p className="xynolog-search-modal__result-description">
|
|
283
|
+
{result.description}
|
|
284
|
+
</p>
|
|
285
|
+
)}
|
|
286
|
+
</div>
|
|
287
|
+
{index === selectedIndex && (
|
|
288
|
+
<div className="xynolog-search-modal__result-action">
|
|
289
|
+
<kbd className="xynolog-search-modal__kbd">
|
|
290
|
+
{translations.enter}
|
|
291
|
+
</kbd>
|
|
292
|
+
</div>
|
|
293
|
+
)}
|
|
294
|
+
</button>
|
|
295
|
+
))}
|
|
296
|
+
</div>
|
|
297
|
+
)}
|
|
298
|
+
|
|
299
|
+
{!loading && !query && (
|
|
300
|
+
<div className="xynolog-search-modal__help">
|
|
301
|
+
<div className="xynolog-search-modal__help-text">
|
|
302
|
+
{translations.startTyping}
|
|
303
|
+
</div>
|
|
304
|
+
<div className="xynolog-search-modal__shortcuts">
|
|
305
|
+
<div className="xynolog-search-modal__shortcut">
|
|
306
|
+
<kbd className="xynolog-search-modal__kbd xynolog-search-modal__kbd--small">
|
|
307
|
+
↑↓
|
|
308
|
+
</kbd>
|
|
309
|
+
{translations.navigate}
|
|
310
|
+
</div>
|
|
311
|
+
<div className="xynolog-search-modal__shortcut">
|
|
312
|
+
<kbd className="xynolog-search-modal__kbd xynolog-search-modal__kbd--small">
|
|
313
|
+
{translations.enter}
|
|
314
|
+
</kbd>
|
|
315
|
+
{translations.select}
|
|
316
|
+
</div>
|
|
317
|
+
<div className="xynolog-search-modal__shortcut">
|
|
318
|
+
<kbd className="xynolog-search-modal__kbd xynolog-search-modal__kbd--small">
|
|
319
|
+
{translations.esc}
|
|
320
|
+
</kbd>
|
|
321
|
+
{translations.close}
|
|
322
|
+
</div>
|
|
323
|
+
</div>
|
|
324
|
+
</div>
|
|
325
|
+
)}
|
|
326
|
+
</div>
|
|
327
|
+
</DialogPanel>
|
|
328
|
+
</TransitionChild>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</Dialog>
|
|
332
|
+
</Transition>
|
|
333
|
+
);
|
|
334
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { WizardFooter } from './WizardFooter';
|
|
3
|
+
|
|
4
|
+
import type { ResourceDescriptor, ResourceId } from '@xynolog/core';
|
|
5
|
+
|
|
6
|
+
export type ScoredResult = ResourceDescriptor & {
|
|
7
|
+
score?: number;
|
|
8
|
+
matchReason?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Pure RESULTS: ranked rows with scores and Link buttons.
|
|
13
|
+
* The evidence display is the HOST's job — the wizard stacks the full
|
|
14
|
+
* display-only GatherContextStep (with the collapsed strategy band) above
|
|
15
|
+
* this step, the same grammar as the configure steps.
|
|
16
|
+
*/
|
|
17
|
+
export interface SearchResultsStepProps {
|
|
18
|
+
results: ScoredResult[];
|
|
19
|
+
onLink: (resourceId: ResourceId) => void;
|
|
20
|
+
onBack: () => void;
|
|
21
|
+
translations: {
|
|
22
|
+
noResults: string;
|
|
23
|
+
link: string;
|
|
24
|
+
back: string;
|
|
25
|
+
score: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function SearchResultsStep({
|
|
30
|
+
results,
|
|
31
|
+
onLink,
|
|
32
|
+
onBack,
|
|
33
|
+
translations: t,
|
|
34
|
+
}: SearchResultsStepProps) {
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<div className="xynolog-search-results">
|
|
38
|
+
{results.length === 0 ? (
|
|
39
|
+
<div
|
|
40
|
+
className="xynolog-modal__empty-state"
|
|
41
|
+
style={{ textAlign: 'center', padding: '2rem 0' }}
|
|
42
|
+
>
|
|
43
|
+
{t.noResults}
|
|
44
|
+
</div>
|
|
45
|
+
) : (
|
|
46
|
+
results.map((result) => {
|
|
47
|
+
const id = result['@id'];
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
key={id}
|
|
51
|
+
style={{
|
|
52
|
+
padding: '0.75rem',
|
|
53
|
+
borderBottom: '1px solid var(--xynolog-border-primary)',
|
|
54
|
+
display: 'flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
justifyContent: 'space-between',
|
|
57
|
+
gap: '0.75rem',
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<div style={{ flex: 1, minWidth: 0 }}>
|
|
61
|
+
<div
|
|
62
|
+
style={{
|
|
63
|
+
fontWeight: 500,
|
|
64
|
+
color: 'var(--xynolog-text-primary)',
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{result.name}
|
|
68
|
+
</div>
|
|
69
|
+
{result.description && (
|
|
70
|
+
<div
|
|
71
|
+
style={{
|
|
72
|
+
fontSize: 'var(--xynolog-text-sm)',
|
|
73
|
+
color: 'var(--xynolog-text-secondary)',
|
|
74
|
+
marginTop: '0.25rem',
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
textOverflow: 'ellipsis',
|
|
77
|
+
whiteSpace: 'nowrap',
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
{result.description}
|
|
81
|
+
</div>
|
|
82
|
+
)}
|
|
83
|
+
<div
|
|
84
|
+
style={{
|
|
85
|
+
fontSize: 'var(--xynolog-text-xs)',
|
|
86
|
+
color: 'var(--xynolog-text-tertiary)',
|
|
87
|
+
marginTop: '0.25rem',
|
|
88
|
+
display: 'flex',
|
|
89
|
+
gap: '0.5rem',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{result.score !== undefined && (
|
|
93
|
+
<span>
|
|
94
|
+
{t.score}: {result.score}
|
|
95
|
+
</span>
|
|
96
|
+
)}
|
|
97
|
+
{result.matchReason && <span>{result.matchReason}</span>}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
<button
|
|
101
|
+
type="button"
|
|
102
|
+
onClick={() => onLink(id)}
|
|
103
|
+
className="xynolog-button--primary"
|
|
104
|
+
style={{ flexShrink: 0 }}
|
|
105
|
+
>
|
|
106
|
+
🔗 {t.link}
|
|
107
|
+
</button>
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
})
|
|
111
|
+
)}
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<WizardFooter backLabel={t.back} onBack={onBack} />
|
|
115
|
+
</>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogPanel,
|
|
6
|
+
DialogTitle,
|
|
7
|
+
Transition,
|
|
8
|
+
TransitionChild,
|
|
9
|
+
} from '@headlessui/react';
|
|
10
|
+
import type { SessionEndReason } from '@xynolog/sdk';
|
|
11
|
+
import { useXynolog } from '../../session/XynologProvider';
|
|
12
|
+
import { useObservable } from '../../hooks/useObservable';
|
|
13
|
+
import { useTranslations } from '../../contexts/TranslationContext';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* What a person is told of why their session ended. A switch with no
|
|
17
|
+
* default: a reason added to the SDK does not compile here until it has a
|
|
18
|
+
* sentence.
|
|
19
|
+
*/
|
|
20
|
+
function whyEnded(
|
|
21
|
+
reason: SessionEndReason,
|
|
22
|
+
t: (key: string) => string,
|
|
23
|
+
): string {
|
|
24
|
+
switch (reason) {
|
|
25
|
+
case 'expired':
|
|
26
|
+
return t('expired');
|
|
27
|
+
case 'refused':
|
|
28
|
+
return t('refused');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Modal that surfaces when the active KB's session has ended: it expired,
|
|
34
|
+
* or the knowledge base did not accept the sign-in. The notice's reason
|
|
35
|
+
* says which; the title is true of either. Every word is the person's
|
|
36
|
+
* language: the notice carries a reason, never a sentence.
|
|
37
|
+
*
|
|
38
|
+
* Reads `sessionEnded$` from the active `SessionSignals`.
|
|
39
|
+
* When the user dismisses the modal, the signals instance clears the
|
|
40
|
+
* flag. Modal state lives on signals (not the session itself) so
|
|
41
|
+
* headless sessions (workers/CLIs) don't carry dead observables.
|
|
42
|
+
*/
|
|
43
|
+
export function SessionEndedModal() {
|
|
44
|
+
const t = useTranslations('SessionEndedModal');
|
|
45
|
+
const signals = useObservable(useXynolog().activeSignals$);
|
|
46
|
+
const sessionEnded = useObservable(signals?.sessionEnded$) ?? null;
|
|
47
|
+
const acknowledgeSessionEnded = () => signals?.acknowledgeSessionEnded();
|
|
48
|
+
const showModal = sessionEnded !== null;
|
|
49
|
+
|
|
50
|
+
const handleSignIn = () => {
|
|
51
|
+
acknowledgeSessionEnded();
|
|
52
|
+
window.location.href = `/auth/connect?callbackUrl=${encodeURIComponent(window.location.pathname)}`;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const handleClose = () => {
|
|
56
|
+
acknowledgeSessionEnded();
|
|
57
|
+
window.location.href = '/';
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Transition appear show={showModal}>
|
|
62
|
+
<Dialog as="div" className="xynolog-modal" onClose={handleClose}>
|
|
63
|
+
<TransitionChild
|
|
64
|
+
enter="ease-out duration-200"
|
|
65
|
+
enterFrom="opacity-0"
|
|
66
|
+
enterTo="opacity-100"
|
|
67
|
+
leave="ease-in duration-150"
|
|
68
|
+
leaveFrom="opacity-100"
|
|
69
|
+
leaveTo="opacity-0"
|
|
70
|
+
>
|
|
71
|
+
<div className="xynolog-modal__backdrop" />
|
|
72
|
+
</TransitionChild>
|
|
73
|
+
|
|
74
|
+
<div className="xynolog-modal__container">
|
|
75
|
+
<div className="xynolog-modal__wrapper">
|
|
76
|
+
<TransitionChild
|
|
77
|
+
enter="ease-out duration-200"
|
|
78
|
+
enterFrom="opacity-0 scale-95"
|
|
79
|
+
enterTo="opacity-100 scale-100"
|
|
80
|
+
leave="ease-in duration-150"
|
|
81
|
+
leaveFrom="opacity-100 scale-100"
|
|
82
|
+
leaveTo="opacity-0 scale-95"
|
|
83
|
+
>
|
|
84
|
+
<DialogPanel className="xynolog-modal__panel xynolog-modal__panel--medium">
|
|
85
|
+
<div className="xynolog-modal__icon-wrapper">
|
|
86
|
+
<div
|
|
87
|
+
className="xynolog-modal__icon"
|
|
88
|
+
style={{
|
|
89
|
+
background:
|
|
90
|
+
'linear-gradient(to bottom right, var(--xynolog-color-red-100, #fee2e2), var(--xynolog-color-red-300, #fca5a5))',
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<svg
|
|
94
|
+
style={{
|
|
95
|
+
width: '1.5rem',
|
|
96
|
+
height: '1.5rem',
|
|
97
|
+
color: 'var(--xynolog-color-red-600, #dc2626)',
|
|
98
|
+
}}
|
|
99
|
+
fill="none"
|
|
100
|
+
stroke="currentColor"
|
|
101
|
+
viewBox="0 0 24 24"
|
|
102
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
+
>
|
|
104
|
+
<path
|
|
105
|
+
strokeLinecap="round"
|
|
106
|
+
strokeLinejoin="round"
|
|
107
|
+
strokeWidth={2}
|
|
108
|
+
d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
109
|
+
/>
|
|
110
|
+
</svg>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
<div className="xynolog-modal__content">
|
|
115
|
+
<DialogTitle className="xynolog-modal__title xynolog-modal__title--centered">
|
|
116
|
+
{t('title')}
|
|
117
|
+
</DialogTitle>
|
|
118
|
+
{sessionEnded && (
|
|
119
|
+
<p className="xynolog-modal__description">
|
|
120
|
+
{whyEnded(sessionEnded.reason, t)}
|
|
121
|
+
</p>
|
|
122
|
+
)}
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<div className="xynolog-modal__actions">
|
|
126
|
+
<button
|
|
127
|
+
type="button"
|
|
128
|
+
onClick={handleClose}
|
|
129
|
+
className="xynolog-button--secondary xynolog-button--flex"
|
|
130
|
+
>
|
|
131
|
+
{t('goHome')}
|
|
132
|
+
</button>
|
|
133
|
+
<button
|
|
134
|
+
type="button"
|
|
135
|
+
onClick={handleSignIn}
|
|
136
|
+
className="xynolog-button--primary xynolog-button--flex"
|
|
137
|
+
>
|
|
138
|
+
{t('signInAgain')}
|
|
139
|
+
</button>
|
|
140
|
+
</div>
|
|
141
|
+
</DialogPanel>
|
|
142
|
+
</TransitionChild>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</Dialog>
|
|
146
|
+
</Transition>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The one wizard footer: the only place the Back-and-primary markup exists.
|
|
5
|
+
*
|
|
6
|
+
* Hand-built per step, the footers diverge: a `✕ Cancel` duplicating the corner
|
|
7
|
+
* control on some, no footer at all on another, and every button stretched to equal
|
|
8
|
+
* width so "leave" reads as a peer of "do the thing".
|
|
9
|
+
*
|
|
10
|
+
* The grammar:
|
|
11
|
+
* • Dismissal is NOT here. The corner ✕, Esc and the backdrop are the way out, and
|
|
12
|
+
* they are the same on every step including the one with no footer.
|
|
13
|
+
* • Retreat is chrome: quiet, left, no emoji.
|
|
14
|
+
* • Advance is the decision: filled, right, one verb.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface WizardFooterPrimary {
|
|
18
|
+
label: string;
|
|
19
|
+
/** Shown while `pending`; falls back to `label`. */
|
|
20
|
+
pendingLabel?: string;
|
|
21
|
+
pending?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The action's PRECONDITION is not met yet (e.g. the review step waiting on
|
|
24
|
+
* gather). Unlike `pending` — the action itself running — this disables only
|
|
25
|
+
* the primary: retreat must stay live while a precondition loads.
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
type: 'submit' | 'button';
|
|
29
|
+
onClick?: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface WizardFooterProps {
|
|
33
|
+
/** Omit both to render no retreat — correct on the first step. */
|
|
34
|
+
backLabel?: string;
|
|
35
|
+
onBack?: () => void;
|
|
36
|
+
/** Omit on steps whose action lives elsewhere (search results links per row). */
|
|
37
|
+
primary?: WizardFooterPrimary;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function WizardFooter({
|
|
41
|
+
backLabel,
|
|
42
|
+
onBack,
|
|
43
|
+
primary,
|
|
44
|
+
}: WizardFooterProps) {
|
|
45
|
+
const pending = primary?.pending ?? false;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className="xynolog-modal__actions xynolog-modal__actions--wizard">
|
|
49
|
+
{onBack && backLabel && (
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
onClick={onBack}
|
|
53
|
+
className="xynolog-button--secondary xynolog-wizard-footer__back"
|
|
54
|
+
disabled={pending}
|
|
55
|
+
>
|
|
56
|
+
◀ {backLabel}
|
|
57
|
+
</button>
|
|
58
|
+
)}
|
|
59
|
+
{primary && (
|
|
60
|
+
<button
|
|
61
|
+
type={primary.type}
|
|
62
|
+
{...(primary.onClick ? { onClick: primary.onClick } : {})}
|
|
63
|
+
className="xynolog-button--primary"
|
|
64
|
+
disabled={pending || (primary.disabled ?? false)}
|
|
65
|
+
data-pending={pending ? 'true' : 'false'}
|
|
66
|
+
>
|
|
67
|
+
{pending ? (primary.pendingLabel ?? primary.label) : primary.label}
|
|
68
|
+
</button>
|
|
69
|
+
)}
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|