@xynolog/react-ui 0.8.0 → 0.8.1
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/README.md +26 -46
- package/package.json +12 -9
- package/src/components/Button/Button.tsx +0 -188
- package/src/components/Button/__tests__/Button.test.tsx +0 -449
- package/src/components/CodeMirrorRenderer.tsx +0 -536
- package/src/components/DelegateProgress.tsx +0 -308
- package/src/components/ErrorBoundary.tsx +0 -174
- package/src/components/ItemFoundLog.tsx +0 -42
- package/src/components/LiveRegion.tsx +0 -261
- package/src/components/ProtectedErrorBoundary.tsx +0 -114
- package/src/components/ResizeHandle.tsx +0 -167
- package/src/components/ResourceTagsInline.tsx +0 -120
- package/src/components/SessionExpiryBanner.tsx +0 -74
- package/src/components/SessionTimer.tsx +0 -17
- package/src/components/StatusDisplay.tsx +0 -131
- package/src/components/Toast.tsx +0 -217
- package/src/components/Toolbar.tsx +0 -194
- package/src/components/UserMenuSkeleton.tsx +0 -13
- package/src/components/__tests__/DelegateProgress.denominator.test.tsx +0 -102
- package/src/components/__tests__/DelegateProgress.test.tsx +0 -649
- package/src/components/__tests__/ErrorBoundary.test.tsx +0 -565
- package/src/components/__tests__/LiveRegion.a11y.test.tsx +0 -258
- package/src/components/__tests__/LiveRegion.hooks.test.tsx +0 -140
- package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +0 -225
- package/src/components/__tests__/ResizeHandle.test.tsx +0 -159
- package/src/components/__tests__/ResourceTagsInline.test.tsx +0 -325
- package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -124
- package/src/components/__tests__/SessionTimer.test.tsx +0 -199
- package/src/components/__tests__/StatusDisplay.test.tsx +0 -179
- package/src/components/__tests__/Toast.test.tsx +0 -96
- package/src/components/__tests__/Toolbar.test.tsx +0 -111
- package/src/components/__tests__/UserMenuSkeleton.test.tsx +0 -182
- package/src/components/annotation/AnchoredTextNotice.tsx +0 -36
- package/src/components/annotation/AnnotateToolbar.tsx +0 -531
- package/src/components/annotation/__tests__/AnnotateToolbar.display.test.tsx +0 -127
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +0 -304
- package/src/components/annotation-popups/JsonLdView.tsx +0 -127
- package/src/components/annotation-popups/SharedPopupElements.tsx +0 -131
- package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +0 -432
- package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -297
- package/src/components/branding/XynologBranding.tsx +0 -41
- package/src/components/branding/__tests__/XynologBranding.test.tsx +0 -383
- package/src/components/error-states/ResourceErrorState.tsx +0 -30
- package/src/components/error-states/__tests__/ResourceErrorState.test.tsx +0 -102
- package/src/components/image-annotation/AnnotationOverlay.tsx +0 -307
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +0 -514
- package/src/components/image-annotation/__tests__/AnnotationOverlay.click.test.tsx +0 -169
- package/src/components/image-annotation/__tests__/AnnotationOverlay.hover.test.tsx +0 -83
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.annotate-gate.test.tsx +0 -228
- package/src/components/image-annotation/__tests__/SvgDrawingCanvas.click.test.tsx +0 -204
- package/src/components/layout/LeftSidebar.tsx +0 -150
- package/src/components/layout/PageLayout.tsx +0 -49
- package/src/components/layout/SkipLinks.tsx +0 -36
- package/src/components/layout/UnifiedHeader.tsx +0 -151
- package/src/components/layout/__tests__/LeftSidebar.test.tsx +0 -426
- package/src/components/layout/__tests__/PageLayout.test.tsx +0 -311
- package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +0 -218
- package/src/components/layout/__tests__/UnifiedHeader.test.tsx +0 -555
- package/src/components/loading-states/ComposeLoadingState.tsx +0 -19
- package/src/components/loading-states/ResourceLoadingState.tsx +0 -13
- package/src/components/loading-states/__tests__/ComposeLoadingState.test.tsx +0 -37
- package/src/components/loading-states/__tests__/ResourceLoadingState.test.tsx +0 -31
- package/src/components/modals/ComposeStep.tsx +0 -245
- package/src/components/modals/ConfigureGatherStep.tsx +0 -110
- package/src/components/modals/ConfigureGenerationStep.tsx +0 -458
- package/src/components/modals/ConfigureSearchStep.tsx +0 -124
- package/src/components/modals/ContextSummary.tsx +0 -317
- package/src/components/modals/CorpusPane.tsx +0 -96
- package/src/components/modals/DiscardPrompt.tsx +0 -44
- package/src/components/modals/GatherContextStep.tsx +0 -480
- package/src/components/modals/KbIdentityConflictModal.tsx +0 -122
- package/src/components/modals/KeyboardShortcutsHelpModal.tsx +0 -238
- package/src/components/modals/PermissionDeniedModal.tsx +0 -207
- package/src/components/modals/ReferenceWizardModal.tsx +0 -656
- package/src/components/modals/ResourceGenerateModal.tsx +0 -457
- package/src/components/modals/SearchModal.tsx +0 -334
- package/src/components/modals/SearchResultsStep.tsx +0 -117
- package/src/components/modals/SessionEndedModal.tsx +0 -148
- package/src/components/modals/WizardFooter.tsx +0 -72
- package/src/components/modals/__tests__/ComposeStep.test.tsx +0 -187
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +0 -92
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +0 -574
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +0 -124
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +0 -702
- package/src/components/modals/__tests__/KbIdentityConflictModal.test.tsx +0 -102
- package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -115
- package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +0 -218
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +0 -936
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +0 -532
- package/src/components/modals/__tests__/SearchModal.accessibility.test.tsx +0 -95
- package/src/components/modals/__tests__/SearchModal.basic.test.tsx +0 -84
- package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -162
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +0 -237
- package/src/components/modals/__tests__/SearchModal.translations.test.tsx +0 -91
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +0 -95
- package/src/components/modals/__tests__/SessionEndedModal.test.tsx +0 -171
- package/src/components/modals/__tests__/WizardFooter.test.tsx +0 -446
- package/src/components/modals/__tests__/search-modal-harness.ts +0 -82
- package/src/components/navigation/CollapsibleResourceNavigation.tsx +0 -364
- package/src/components/navigation/NavigationMenu.tsx +0 -66
- package/src/components/navigation/ObservableLink.tsx +0 -90
- package/src/components/navigation/SimpleNavigation.tsx +0 -169
- package/src/components/navigation/SortableResourceTab.tsx +0 -122
- package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +0 -302
- package/src/components/navigation/__tests__/NavigationMenu.test.tsx +0 -399
- package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -85
- package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +0 -193
- package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -421
- package/src/components/pdf-annotation/PdfAnnotationCanvas.client.tsx +0 -10
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +0 -632
- package/src/components/pdf-annotation/PdfPageView.tsx +0 -527
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.annotate-gate.test.tsx +0 -295
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.pixels-before-anchoring.test.tsx +0 -166
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +0 -1719
- package/src/components/pdf-annotation/__tests__/estimate-slot-height.test.ts +0 -61
- package/src/components/pdf-annotation/__tests__/rects-for-page.test.ts +0 -110
- package/src/components/pdf-annotation/estimate-slot-height.ts +0 -31
- package/src/components/pdf-annotation/rects-for-page.ts +0 -50
- package/src/components/resource/AnnotateView.tsx +0 -373
- package/src/components/resource/AnnotationHistory.tsx +0 -169
- package/src/components/resource/BrowseView.tsx +0 -440
- package/src/components/resource/DownloadFileLink.tsx +0 -53
- package/src/components/resource/HistoryEvent.tsx +0 -186
- package/src/components/resource/ResourceViewer.tsx +0 -617
- package/src/components/resource/__tests__/AnnotateView.code-point-offsets.test.tsx +0 -482
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +0 -78
- package/src/components/resource/__tests__/AnnotateView.focus.test.tsx +0 -147
- package/src/components/resource/__tests__/AnnotateView.registry.test.tsx +0 -143
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -257
- package/src/components/resource/__tests__/BrowseView.code-point-offsets.test.tsx +0 -123
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +0 -76
- package/src/components/resource/__tests__/BrowseView.links.test.tsx +0 -84
- package/src/components/resource/__tests__/BrowseView.overlay-async.test.tsx +0 -165
- package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +0 -200
- package/src/components/resource/__tests__/BrowseView.registry.test.tsx +0 -57
- package/src/components/resource/__tests__/BrowseView.test.tsx +0 -915
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -571
- package/src/components/resource/__tests__/ResourceViewer.delete-failure.test.tsx +0 -103
- package/src/components/resource/__tests__/ResourceViewer.embeddable.test.tsx +0 -250
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +0 -262
- package/src/components/resource/__tests__/ResourceViewer.multi-mount-invalidation.test.tsx +0 -166
- package/src/components/resource/__tests__/ResourceViewer.registry.test.tsx +0 -112
- package/src/components/resource/__tests__/ResourceViewer.toolbar-opt-out.test.tsx +0 -207
- package/src/components/resource/__tests__/ResourceViewer.toolbar-prefs.test.tsx +0 -274
- package/src/components/resource/__tests__/annotation-interactions.test.tsx +0 -116
- package/src/components/resource/__tests__/browse-renderers.dispatch.test.tsx +0 -183
- package/src/components/resource/__tests__/browse-renderers.test.tsx +0 -47
- package/src/components/resource/__tests__/download-link.test.tsx +0 -171
- package/src/components/resource/__tests__/event-formatting.test.ts +0 -379
- package/src/components/resource/__tests__/inline-embedding.test.tsx +0 -133
- package/src/components/resource/__tests__/media-completeness.test.tsx +0 -144
- package/src/components/resource/annotate-renderers.tsx +0 -186
- package/src/components/resource/browse-renderers.tsx +0 -133
- package/src/components/resource/event-formatting.ts +0 -393
- package/src/components/resource/panels/AssessmentEntry.tsx +0 -127
- package/src/components/resource/panels/AssessmentPanel.tsx +0 -309
- package/src/components/resource/panels/CollaborationPanel.tsx +0 -228
- package/src/components/resource/panels/CommentEntry.tsx +0 -242
- package/src/components/resource/panels/CommentsPanel.tsx +0 -320
- package/src/components/resource/panels/DelegateSection.tsx +0 -282
- package/src/components/resource/panels/DelegateShell.tsx +0 -134
- package/src/components/resource/panels/HighlightEntry.tsx +0 -83
- package/src/components/resource/panels/HighlightPanel.tsx +0 -212
- package/src/components/resource/panels/JsonLdPanel.tsx +0 -119
- package/src/components/resource/panels/PanelHeader.tsx +0 -22
- package/src/components/resource/panels/ReferenceEntry.tsx +0 -232
- package/src/components/resource/panels/ReferencesPanel.tsx +0 -626
- package/src/components/resource/panels/ResourceInfoPanel.tsx +0 -433
- package/src/components/resource/panels/StatisticsPanel.tsx +0 -145
- package/src/components/resource/panels/TagEntry.tsx +0 -87
- package/src/components/resource/panels/TaggingPanel.tsx +0 -554
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +0 -384
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +0 -292
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +0 -685
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -685
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +0 -750
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +0 -877
- package/src/components/resource/panels/__tests__/DelegateSection.test.tsx +0 -623
- package/src/components/resource/panels/__tests__/DelegateShell.test.tsx +0 -212
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +0 -236
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +0 -506
- package/src/components/resource/panels/__tests__/HighlightPanel.out-of-order.test.tsx +0 -132
- package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +0 -230
- package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -54
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +0 -578
- package/src/components/resource/panels/__tests__/ReferencesPanel.headless.test.tsx +0 -193
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +0 -193
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +0 -1080
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +0 -812
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.text-layer.test.tsx +0 -106
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +0 -329
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +0 -250
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +0 -772
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.delegated-job.test.tsx +0 -207
- package/src/components/resource/panels/__tests__/UnifiedAnnotationsPanel.failure.test.tsx +0 -89
- package/src/components/resource/panels/__tests__/agent-label.test.ts +0 -136
- package/src/components/resource/panels/agent-label.ts +0 -35
- package/src/components/settings/SettingsPanel.tsx +0 -251
- package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -260
- package/src/components/viewers/ImageViewer.tsx +0 -18
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -57
- package/src/components/viewers/index.ts +0 -1
- package/src/features/auth/__tests__/AuthErrorDisplay.test.tsx +0 -181
- package/src/features/auth/components/AuthErrorDisplay.tsx +0 -89
- package/src/features/moderate-entity-tags/__tests__/EntityTagsPage.test.tsx +0 -387
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +0 -161
- package/src/features/moderate-entity-tags/state/__tests__/entity-tags-state-unit.test.ts +0 -183
- package/src/features/moderate-entity-tags/state/entity-tags-state-unit.ts +0 -73
- package/src/features/moderate-recent/__tests__/RecentDocumentsPage.test.tsx +0 -422
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +0 -117
- package/src/features/moderate-tag-schemas/__tests__/TagSchemasPage.test.tsx +0 -481
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +0 -161
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -600
- package/src/features/resource-compose/__tests__/UploadProgressBar.test.tsx +0 -256
- package/src/features/resource-compose/components/ResourceComposePage.tsx +0 -809
- package/src/features/resource-compose/components/UploadProgressBar.tsx +0 -125
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +0 -195
- package/src/features/resource-compose/state/compose-page-state-unit.ts +0 -187
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -338
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +0 -449
- package/src/features/resource-discovery/components/ResourceCard.tsx +0 -80
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +0 -330
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +0 -477
- package/src/features/resource-discovery/state/discover-state-unit.ts +0 -162
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.content-loading.test.tsx +0 -260
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +0 -570
- package/src/features/resource-viewer/__tests__/generation-params.test.ts +0 -49
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +0 -1058
- package/src/features/resource-viewer/generation-params.ts +0 -23
- package/src/features/resource-viewer/hooks/__tests__/useResourceViewedReport.test.tsx +0 -77
- package/src/features/resource-viewer/hooks/useResourceViewedReport.ts +0 -38
- package/src/features/resource-viewer/state/__tests__/resource-loader-state-unit.test.ts +0 -178
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +0 -505
- package/src/features/resource-viewer/state/resource-loader-state-unit.ts +0 -93
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +0 -156
|
@@ -1,334 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
}
|