@semiont/react-ui 0.5.27 → 0.5.29
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 +3 -3
- package/dist/{PdfAnnotationCanvas.client-EVUPTUWZ.js → PdfAnnotationCanvas.client-LSH3PZPY.js} +32 -5
- package/dist/{ar-OU3DQGC6.js → ar-AZBRADEB.js} +43 -23
- package/dist/{bn-PHWCR6AZ.js → bn-CCEW6AOS.js} +43 -23
- package/dist/{chunk-VXASXU4K.js → chunk-3ZBKCWUZ.js} +1 -1
- package/dist/{chunk-5VDTWRXJ.js → chunk-G4VHL4UA.js} +31 -31
- package/dist/{chunk-PCRRBU7H.js → chunk-SDKFZLEX.js} +43 -23
- package/dist/{cs-NEXYZ62I.js → cs-HXPF2CTE.js} +43 -23
- package/dist/{da-FAT43YCU.js → da-K5NTK7LH.js} +43 -23
- package/dist/{de-KRQ3WBCU.js → de-GMRQEDZI.js} +43 -23
- package/dist/{el-Q4IU3EKC.js → el-EUB4CI4G.js} +43 -23
- package/dist/{en-2KADE7N4.js → en-R5XA26NF.js} +2 -2
- package/dist/{es-2IO3R2MK.js → es-Z32DAZ6W.js} +43 -23
- package/dist/{fa-Q5GOQFXX.js → fa-G7HN6B32.js} +43 -23
- package/dist/{fi-R6NMRWBE.js → fi-3YBLZO7I.js} +43 -23
- package/dist/{fr-QY4D5E6J.js → fr-VUBH7BBS.js} +43 -23
- package/dist/{he-X6Y77XHY.js → he-WQQEY26B.js} +43 -23
- package/dist/{hi-XL7IOEQM.js → hi-HJZ6W4JB.js} +43 -23
- package/dist/{id-QZ4ZZS67.js → id-ZOGZ37MI.js} +43 -23
- package/dist/index.css +279 -74
- package/dist/index.d.ts +318 -393
- package/dist/index.js +2619 -2687
- package/dist/{it-ME2Q7OB6.js → it-DT6UW66F.js} +43 -23
- package/dist/{ja-HX7QASRI.js → ja-RUKQCOLO.js} +43 -23
- package/dist/{ko-EQO5AHAV.js → ko-ZH5ADKZM.js} +43 -23
- package/dist/{ms-UILFSF3I.js → ms-Y2AFPZTU.js} +43 -23
- package/dist/{nl-NNI45PMK.js → nl-OQEWIXNA.js} +43 -23
- package/dist/{no-MAL5F6P6.js → no-KPAYJZWY.js} +43 -23
- package/dist/{pl-4RMY6JAJ.js → pl-WSXK2UUD.js} +43 -23
- package/dist/{pt-VQH2X3QQ.js → pt-NWRJRUCK.js} +43 -23
- package/dist/{ro-XXCQO2OG.js → ro-3CGVMOC6.js} +43 -23
- package/dist/{sv-7Z6EJ6U4.js → sv-HGSEBA7S.js} +43 -23
- package/dist/test-utils.js +16 -7
- package/dist/{th-L3DXXYVQ.js → th-NZ4G352Z.js} +43 -23
- package/dist/{tr-P3DFVLFJ.js → tr-LGGS4DLW.js} +43 -23
- package/dist/{uk-7C5D3PXS.js → uk-AIX536L4.js} +43 -23
- package/dist/{vi-ZLTLEO7P.js → vi-V6CVQZLQ.js} +43 -23
- package/dist/{zh-5FHVWDIN.js → zh-AGKPGI3L.js} +43 -23
- package/package.json +16 -15
- package/src/components/AssistProgress.tsx +36 -2
- package/src/components/CodeMirrorRenderer.tsx +8 -8
- package/src/components/StatusDisplay.tsx +13 -13
- package/src/components/__tests__/AssistProgress.test.tsx +59 -0
- package/src/components/__tests__/StatusDisplay.test.tsx +9 -9
- package/src/components/modals/ComposeStep.tsx +233 -0
- package/src/components/modals/ConfigureGatherStep.tsx +10 -18
- package/src/components/modals/ConfigureGenerationStep.tsx +178 -34
- package/src/components/modals/ConfigureSearchStep.tsx +19 -0
- package/src/components/modals/ContextSummary.tsx +185 -72
- package/src/components/modals/CorpusPane.tsx +75 -0
- package/src/components/modals/DiscardPrompt.tsx +38 -0
- package/src/components/modals/GatherContextStep.tsx +237 -107
- package/src/components/modals/ReferenceWizardModal.tsx +252 -59
- package/src/components/modals/ResourceGenerateModal.tsx +225 -112
- package/src/components/modals/SearchModal.css +337 -101
- package/src/components/modals/SearchResultsStep.tsx +61 -68
- package/src/components/modals/WizardFooter.tsx +7 -1
- package/src/components/modals/__tests__/ComposeStep.test.tsx +152 -0
- package/src/components/modals/__tests__/ConfigureGatherStep.test.tsx +14 -26
- package/src/components/modals/__tests__/ConfigureGenerationStep.test.tsx +206 -8
- package/src/components/modals/__tests__/ConfigureSearchStep.test.tsx +24 -1
- package/src/components/modals/__tests__/GatherContextStep.resource.test.tsx +463 -25
- package/src/components/modals/__tests__/ReferenceWizardModal.test.tsx +442 -39
- package/src/components/modals/__tests__/ResourceGenerateModal.test.tsx +300 -86
- package/src/components/modals/__tests__/SearchResultsStep.test.tsx +61 -0
- package/src/components/modals/__tests__/WizardFooter.test.tsx +116 -9
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +34 -1
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +38 -1
- package/src/components/resource/AnnotateView.tsx +3 -3
- package/src/components/resource/BrowseView.tsx +8 -8
- package/src/components/resource/DownloadFileLink.tsx +1 -1
- package/src/components/resource/ResourceViewer.tsx +4 -4
- package/src/components/resource/__tests__/AnnotateView.embeddable.test.tsx +1 -1
- package/src/components/resource/__tests__/BrowseView.embeddable.test.tsx +1 -1
- package/src/components/resource/__tests__/BrowseView.reference-hover.test.tsx +1 -1
- package/src/components/resource/__tests__/BrowseView.test.tsx +11 -11
- package/src/components/resource/__tests__/download-link.test.tsx +6 -6
- package/src/components/resource/annotate-renderers.tsx +3 -3
- package/src/components/resource/panels/AssistSection.css +35 -0
- package/src/components/resource/panels/ReferenceEntry.tsx +11 -4
- package/src/components/resource/panels/ReferencesPanel.tsx +9 -1
- package/src/components/resource/panels/ResourceInfoPanel.tsx +89 -20
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +7 -2
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +41 -0
- package/src/components/resource/panels/__tests__/ReferencesPanel.observable-flow.test.tsx +1 -1
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +84 -3
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +149 -7
- package/src/features/auth/__tests__/SignInForm.a11y.test.tsx +12 -12
- package/src/features/auth/components/SignInForm.tsx +53 -53
- package/src/features/auth-welcome/state/__tests__/welcome-state-unit.test.ts +2 -2
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +0 -65
- package/src/features/resource-compose/components/ResourceComposePage.tsx +35 -133
- package/src/features/resource-compose/state/__tests__/compose-page-state-unit.test.ts +1 -100
- package/src/features/resource-compose/state/compose-page-state-unit.ts +5 -57
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +1 -1
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +2 -2
- package/src/features/resource-discovery/state/discover-state-unit.ts +1 -1
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +73 -17
- package/src/features/resource-viewer/__tests__/generation-options.test.ts +53 -0
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +148 -83
- package/src/features/resource-viewer/generation-options.ts +29 -0
- package/src/styles/core/forms.css +35 -8
- package/src/styles/features/resource-viewer.css +0 -22
- package/src/styles/features/resource.css +0 -4
- package/src/styles/index.css +0 -1
- package/translations/ar.json +42 -22
- package/translations/bn.json +42 -22
- package/translations/cs.json +42 -22
- package/translations/da.json +42 -22
- package/translations/de.json +42 -22
- package/translations/el.json +42 -22
- package/translations/en.json +42 -22
- package/translations/es.json +42 -22
- package/translations/fa.json +42 -22
- package/translations/fi.json +42 -22
- package/translations/fr.json +42 -22
- package/translations/he.json +42 -22
- package/translations/hi.json +42 -22
- package/translations/id.json +42 -22
- package/translations/it.json +42 -22
- package/translations/ja.json +42 -22
- package/translations/ko.json +42 -22
- package/translations/ms.json +42 -22
- package/translations/nl.json +42 -22
- package/translations/no.json +42 -22
- package/translations/pl.json +42 -22
- package/translations/pt.json +42 -22
- package/translations/ro.json +42 -22
- package/translations/sv.json +42 -22
- package/translations/th.json +42 -22
- package/translations/tr.json +42 -22
- package/translations/uk.json +42 -22
- package/translations/vi.json +42 -22
- package/translations/zh.json +42 -22
- package/dist/PdfAnnotationCanvas.client-EVUPTUWZ.js.map +0 -1
- package/dist/PdfAnnotationCanvas.client-TGDPPGXJ.css.map +0 -1
- package/dist/ar-OU3DQGC6.js.map +0 -1
- package/dist/bn-PHWCR6AZ.js.map +0 -1
- package/dist/chunk-5VDTWRXJ.js.map +0 -1
- package/dist/chunk-BTUG3VJJ.js.map +0 -1
- package/dist/chunk-O23TLLXW.js.map +0 -1
- package/dist/chunk-PCRRBU7H.js.map +0 -1
- package/dist/chunk-QT7LYM72.js.map +0 -1
- package/dist/chunk-VXASXU4K.js.map +0 -1
- package/dist/cs-NEXYZ62I.js.map +0 -1
- package/dist/da-FAT43YCU.js.map +0 -1
- package/dist/de-KRQ3WBCU.js.map +0 -1
- package/dist/el-Q4IU3EKC.js.map +0 -1
- package/dist/en-2KADE7N4.js.map +0 -1
- package/dist/es-2IO3R2MK.js.map +0 -1
- package/dist/fa-Q5GOQFXX.js.map +0 -1
- package/dist/fi-R6NMRWBE.js.map +0 -1
- package/dist/fr-QY4D5E6J.js.map +0 -1
- package/dist/he-X6Y77XHY.js.map +0 -1
- package/dist/hi-XL7IOEQM.js.map +0 -1
- package/dist/id-QZ4ZZS67.js.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integrations/css-modules-helper.js.map +0 -1
- package/dist/integrations/styled-components-theme.js.map +0 -1
- package/dist/it-ME2Q7OB6.js.map +0 -1
- package/dist/ja-HX7QASRI.js.map +0 -1
- package/dist/ko-EQO5AHAV.js.map +0 -1
- package/dist/ms-UILFSF3I.js.map +0 -1
- package/dist/nl-NNI45PMK.js.map +0 -1
- package/dist/no-MAL5F6P6.js.map +0 -1
- package/dist/pl-4RMY6JAJ.js.map +0 -1
- package/dist/pt-VQH2X3QQ.js.map +0 -1
- package/dist/ro-XXCQO2OG.js.map +0 -1
- package/dist/sv-7Z6EJ6U4.js.map +0 -1
- package/dist/test-utils.css.map +0 -1
- package/dist/test-utils.js.map +0 -1
- package/dist/th-L3DXXYVQ.js.map +0 -1
- package/dist/tr-P3DFVLFJ.js.map +0 -1
- package/dist/uk-7C5D3PXS.js.map +0 -1
- package/dist/vi-ZLTLEO7P.js.map +0 -1
- package/dist/zh-5FHVWDIN.js.map +0 -1
- package/src/components/modals/ResourceSearchModal.tsx +0 -224
- package/src/components/modals/__tests__/ResourceSearchModal.test.tsx +0 -163
- package/src/features/admin-exchange/__tests__/AdminExchangePage.test.tsx +0 -137
- package/src/features/admin-exchange/__tests__/ExportCard.test.tsx +0 -41
- package/src/features/admin-exchange/__tests__/ImportCard.test.tsx +0 -148
- package/src/features/admin-exchange/__tests__/ImportProgress.test.tsx +0 -117
- package/src/features/admin-exchange/components/AdminExchangePage.tsx +0 -117
- package/src/features/admin-exchange/components/ExportCard.tsx +0 -35
- package/src/features/admin-exchange/components/ImportCard.tsx +0 -183
- package/src/features/admin-exchange/components/ImportProgress.tsx +0 -80
- package/src/features/admin-exchange/state/__tests__/exchange-state-unit.test.ts +0 -185
- package/src/features/admin-exchange/state/exchange-state-unit.ts +0 -133
- package/src/features/moderation-linked-data/__tests__/LinkedDataPage.test.tsx +0 -118
- package/src/features/moderation-linked-data/components/LinkedDataPage.tsx +0 -118
- package/src/styles/features/exchange.css +0 -374
|
@@ -43,7 +43,7 @@ describe('StatusDisplay', () => {
|
|
|
43
43
|
mockGetStatus.mockResolvedValue({ status: 'healthy', version: '1.2.3' });
|
|
44
44
|
|
|
45
45
|
renderWithProviders(
|
|
46
|
-
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true}
|
|
46
|
+
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true} hasValidGatewayToken={true} />
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
await waitFor(() => {
|
|
@@ -56,7 +56,7 @@ describe('StatusDisplay', () => {
|
|
|
56
56
|
mockGetStatus.mockRejectedValue(new Error('Network error'));
|
|
57
57
|
|
|
58
58
|
renderWithProviders(
|
|
59
|
-
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true}
|
|
59
|
+
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true} hasValidGatewayToken={true} />
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
await waitFor(() => {
|
|
@@ -68,7 +68,7 @@ describe('StatusDisplay', () => {
|
|
|
68
68
|
mockGetStatus.mockRejectedValue(new Error('401 Unauthorized'));
|
|
69
69
|
|
|
70
70
|
renderWithProviders(
|
|
71
|
-
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true}
|
|
71
|
+
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true} hasValidGatewayToken={true} />
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
await waitFor(() => {
|
|
@@ -76,11 +76,11 @@ describe('StatusDisplay', () => {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
it('should show warning for authenticated users missing
|
|
79
|
+
it('should show warning for authenticated users missing gateway token', () => {
|
|
80
80
|
mockGetStatus.mockResolvedValue(undefined);
|
|
81
81
|
|
|
82
82
|
renderWithProviders(
|
|
83
|
-
<StatusDisplay isFullyAuthenticated={false} isAuthenticated={true}
|
|
83
|
+
<StatusDisplay isFullyAuthenticated={false} isAuthenticated={true} hasValidGatewayToken={false} />
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
expect(screen.getByText(/sign out and sign in again to reconnect/i)).toBeInTheDocument();
|
|
@@ -114,18 +114,18 @@ describe('StatusDisplay', () => {
|
|
|
114
114
|
<StatusDisplay isFullyAuthenticated={false} isAuthenticated={false} />
|
|
115
115
|
);
|
|
116
116
|
|
|
117
|
-
expect(screen.getByText('Sign in to view
|
|
117
|
+
expect(screen.getByText('Sign in to view gateway status')).toBeInTheDocument();
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it('should show error hint when there is an error', async () => {
|
|
121
121
|
mockGetStatus.mockRejectedValue(new Error('Connection refused'));
|
|
122
122
|
|
|
123
123
|
renderWithProviders(
|
|
124
|
-
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true}
|
|
124
|
+
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true} hasValidGatewayToken={true} />
|
|
125
125
|
);
|
|
126
126
|
|
|
127
127
|
await waitFor(() => {
|
|
128
|
-
expect(screen.getByText(/Check that the
|
|
128
|
+
expect(screen.getByText(/Check that the gateway server is running/)).toBeInTheDocument();
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
131
|
|
|
@@ -133,7 +133,7 @@ describe('StatusDisplay', () => {
|
|
|
133
133
|
mockGetStatus.mockResolvedValue({ status: 'healthy', version: '1.0.0' });
|
|
134
134
|
|
|
135
135
|
renderWithProviders(
|
|
136
|
-
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true}
|
|
136
|
+
<StatusDisplay isFullyAuthenticated={true} isAuthenticated={true} hasValidGatewayToken={true} />
|
|
137
137
|
);
|
|
138
138
|
|
|
139
139
|
await waitFor(() => {
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { LOCALES, proposeStoragePath } from '@semiont/core';
|
|
5
|
+
import { CodeMirrorRenderer } from '../CodeMirrorRenderer';
|
|
6
|
+
import { WizardFooter } from './WizardFooter';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* COMPOSE-IN-MODAL P1 — the compose strategy's form, as a pure step.
|
|
10
|
+
*
|
|
11
|
+
* The from-reference slice of the compose page, lifted: name, save location,
|
|
12
|
+
* entity types, language, editor. Deliberately none of the page's
|
|
13
|
+
* upload/format/encoding machinery (the modal composes text; uploads stay on
|
|
14
|
+
* the standalone page — plan non-goal). The draft is CONTROLLED by the host
|
|
15
|
+
* (WIZARD-NAVIGATION D3), and the evidence display is the host's job (A3).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export interface ComposeDraft {
|
|
19
|
+
name: string;
|
|
20
|
+
/** Bare working-tree path; the file:// prefix is applied at submit. */
|
|
21
|
+
storagePath: string;
|
|
22
|
+
content: string;
|
|
23
|
+
/** Picked types — consulted only when the reference fixed none (D6). */
|
|
24
|
+
entityTypes: string[];
|
|
25
|
+
language: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ComposeParams {
|
|
29
|
+
name: string;
|
|
30
|
+
/** Full file:// URI. */
|
|
31
|
+
storagePath: string;
|
|
32
|
+
content: string;
|
|
33
|
+
entityTypes: string[];
|
|
34
|
+
language: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ComposeStepProps {
|
|
38
|
+
draft: ComposeDraft;
|
|
39
|
+
onDraftChange: (patch: Partial<ComposeDraft>) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Folder of the resource being composed FROM, so the new file lands beside
|
|
42
|
+
* its source (D11). Compose is always `text/markdown`, so the proposal's
|
|
43
|
+
* extension is fixed.
|
|
44
|
+
*/
|
|
45
|
+
defaultFolder?: string;
|
|
46
|
+
/** Entity types fixed when the reference was created — read-only tags when
|
|
47
|
+
* non-empty (D6): they are not this step's to change. */
|
|
48
|
+
referenceEntityTypes: string[];
|
|
49
|
+
/** Picker vocabulary when the reference fixed none. Owner-supplied, so a
|
|
50
|
+
* failed load cannot surface as an empty vocabulary. */
|
|
51
|
+
entityTypeOptions: string[];
|
|
52
|
+
showLineNumbers: boolean;
|
|
53
|
+
hoverDelayMs: number;
|
|
54
|
+
onBack: () => void;
|
|
55
|
+
/** Create-and-link. Async: the footer pends until it settles; rejection
|
|
56
|
+
* re-enables it (the host surfaces the error — same posture as Link). */
|
|
57
|
+
onCompose: (params: ComposeParams) => Promise<void>;
|
|
58
|
+
translations: {
|
|
59
|
+
resourceTitle: string;
|
|
60
|
+
resourceTitlePlaceholder: string;
|
|
61
|
+
saveLocation: string;
|
|
62
|
+
entityTypes: string;
|
|
63
|
+
language: string;
|
|
64
|
+
contentLabel: string;
|
|
65
|
+
back: string;
|
|
66
|
+
createAndLink: string;
|
|
67
|
+
creatingAndLinking: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function ComposeStep({
|
|
72
|
+
draft,
|
|
73
|
+
onDraftChange,
|
|
74
|
+
defaultFolder = '',
|
|
75
|
+
referenceEntityTypes,
|
|
76
|
+
entityTypeOptions,
|
|
77
|
+
showLineNumbers,
|
|
78
|
+
hoverDelayMs,
|
|
79
|
+
onBack,
|
|
80
|
+
onCompose,
|
|
81
|
+
translations: t,
|
|
82
|
+
}: ComposeStepProps) {
|
|
83
|
+
// D11 — the Save location starts filled and follows the title until the
|
|
84
|
+
// user takes it over; `pathTouched` is derived (see ConfigureGenerationStep),
|
|
85
|
+
// so clearing the field restores the proposal. Compose writes markdown.
|
|
86
|
+
const pathTouched = draft.storagePath !== '';
|
|
87
|
+
const effectivePath = pathTouched
|
|
88
|
+
? draft.storagePath
|
|
89
|
+
: proposeStoragePath(defaultFolder, draft.name, 'text/markdown');
|
|
90
|
+
|
|
91
|
+
const [isCreating, setIsCreating] = useState(false);
|
|
92
|
+
const fixedTypes = referenceEntityTypes.length > 0;
|
|
93
|
+
|
|
94
|
+
const handleSubmit = async (e: React.FormEvent) => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
if (!draft.name.trim() || !effectivePath.trim()) return;
|
|
97
|
+
setIsCreating(true);
|
|
98
|
+
try {
|
|
99
|
+
await onCompose({
|
|
100
|
+
name: draft.name,
|
|
101
|
+
storagePath: `file://${effectivePath}`,
|
|
102
|
+
content: draft.content,
|
|
103
|
+
entityTypes: fixedTypes ? referenceEntityTypes : draft.entityTypes,
|
|
104
|
+
language: draft.language,
|
|
105
|
+
});
|
|
106
|
+
} catch {
|
|
107
|
+
// The rejection's job ends here: it kept the wizard's close from
|
|
108
|
+
// running and the host already surfaced the failure. Letting it
|
|
109
|
+
// escape a React event handler is an unhandled rejection.
|
|
110
|
+
} finally {
|
|
111
|
+
setIsCreating(false);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<form onSubmit={handleSubmit} className="semiont-form">
|
|
117
|
+
{/* Name */}
|
|
118
|
+
<div className="semiont-form__field">
|
|
119
|
+
<label htmlFor="compose-name" className="semiont-form__label">
|
|
120
|
+
{t.resourceTitle}
|
|
121
|
+
</label>
|
|
122
|
+
<input
|
|
123
|
+
id="compose-name"
|
|
124
|
+
type="text"
|
|
125
|
+
value={draft.name}
|
|
126
|
+
onChange={(e) => onDraftChange({ name: e.target.value })}
|
|
127
|
+
placeholder={t.resourceTitlePlaceholder}
|
|
128
|
+
required
|
|
129
|
+
className="semiont-input"
|
|
130
|
+
disabled={isCreating}
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
|
|
134
|
+
{/* Storage URI */}
|
|
135
|
+
<div className="semiont-form__field">
|
|
136
|
+
<label htmlFor="compose-storagePath" className="semiont-form__label">
|
|
137
|
+
{t.saveLocation}
|
|
138
|
+
</label>
|
|
139
|
+
<div className="semiont-input-addon">
|
|
140
|
+
<span className="semiont-input-addon__prefix">file://</span>
|
|
141
|
+
<input
|
|
142
|
+
id="compose-storagePath"
|
|
143
|
+
type="text"
|
|
144
|
+
value={effectivePath}
|
|
145
|
+
onChange={(e) => onDraftChange({ storagePath: e.target.value })}
|
|
146
|
+
placeholder="people/my-resource.md"
|
|
147
|
+
required
|
|
148
|
+
className="semiont-input semiont-input--addon"
|
|
149
|
+
disabled={isCreating}
|
|
150
|
+
/>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
{/* Entity types: fixed at reference creation → tags; otherwise picker */}
|
|
155
|
+
<div className="semiont-form__field">
|
|
156
|
+
<div className="semiont-form__label">{t.entityTypes}</div>
|
|
157
|
+
{fixedTypes ? (
|
|
158
|
+
<div className="semiont-form__entity-type-tags" role="list">
|
|
159
|
+
{referenceEntityTypes.map((type) => (
|
|
160
|
+
<span key={type} role="listitem" className="semiont-form__entity-type-tag">
|
|
161
|
+
{type}
|
|
162
|
+
</span>
|
|
163
|
+
))}
|
|
164
|
+
</div>
|
|
165
|
+
) : (
|
|
166
|
+
<div className="semiont-form__entity-type-buttons" role="group">
|
|
167
|
+
{entityTypeOptions.map((type) => {
|
|
168
|
+
const isSelected = draft.entityTypes.includes(type);
|
|
169
|
+
return (
|
|
170
|
+
<button
|
|
171
|
+
key={type}
|
|
172
|
+
type="button"
|
|
173
|
+
onClick={() => onDraftChange({
|
|
174
|
+
entityTypes: isSelected
|
|
175
|
+
? draft.entityTypes.filter((x) => x !== type)
|
|
176
|
+
: [...draft.entityTypes, type],
|
|
177
|
+
})}
|
|
178
|
+
className="semiont-form__entity-type-button"
|
|
179
|
+
data-selected={isSelected}
|
|
180
|
+
aria-pressed={isSelected}
|
|
181
|
+
disabled={isCreating}
|
|
182
|
+
>
|
|
183
|
+
{type}
|
|
184
|
+
</button>
|
|
185
|
+
);
|
|
186
|
+
})}
|
|
187
|
+
</div>
|
|
188
|
+
)}
|
|
189
|
+
</div>
|
|
190
|
+
|
|
191
|
+
{/* Language */}
|
|
192
|
+
<div className="semiont-form__field">
|
|
193
|
+
<label htmlFor="compose-language" className="semiont-form__label">
|
|
194
|
+
{t.language}
|
|
195
|
+
</label>
|
|
196
|
+
<select
|
|
197
|
+
id="compose-language"
|
|
198
|
+
value={draft.language}
|
|
199
|
+
onChange={(e) => onDraftChange({ language: e.target.value })}
|
|
200
|
+
disabled={isCreating}
|
|
201
|
+
className="semiont-select"
|
|
202
|
+
>
|
|
203
|
+
{LOCALES.map((lang) => (
|
|
204
|
+
<option key={lang.code} value={lang.code}>
|
|
205
|
+
{lang.nativeName}
|
|
206
|
+
</option>
|
|
207
|
+
))}
|
|
208
|
+
</select>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
{/* Content editor */}
|
|
212
|
+
<div className="semiont-form__field semiont-form__editor">
|
|
213
|
+
<label className="semiont-form__label">{t.contentLabel}</label>
|
|
214
|
+
<div className="semiont-form__editor-wrapper" lang={draft.language}>
|
|
215
|
+
<CodeMirrorRenderer
|
|
216
|
+
content={draft.content}
|
|
217
|
+
editable={!isCreating}
|
|
218
|
+
sourceView={true}
|
|
219
|
+
showLineNumbers={showLineNumbers}
|
|
220
|
+
hoverDelayMs={hoverDelayMs}
|
|
221
|
+
onChange={(content: string) => onDraftChange({ content })}
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<WizardFooter
|
|
227
|
+
backLabel={t.back}
|
|
228
|
+
onBack={onBack}
|
|
229
|
+
primary={{ label: t.createAndLink, pendingLabel: t.creatingAndLinking, pending: isCreating, type: 'submit' }}
|
|
230
|
+
/>
|
|
231
|
+
</form>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
|
+
import { WizardFooter } from './WizardFooter';
|
|
4
5
|
|
|
5
6
|
export interface ResourceGatherConfig {
|
|
6
7
|
depth: number;
|
|
@@ -10,16 +11,13 @@ export interface ResourceGatherConfig {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export interface ConfigureGatherStepProps {
|
|
13
|
-
defaults?: Partial<ResourceGatherConfig>;
|
|
14
14
|
onGather: (config: ResourceGatherConfig) => void;
|
|
15
|
-
onCancel: () => void;
|
|
16
15
|
translations: {
|
|
17
16
|
intro: string;
|
|
18
17
|
includeContent: string;
|
|
19
18
|
includeSummary: string;
|
|
20
19
|
depth: string;
|
|
21
20
|
maxResources: string;
|
|
22
|
-
cancel: string;
|
|
23
21
|
gather: string;
|
|
24
22
|
};
|
|
25
23
|
/** Slot for the exclusion multi-select (GENERATE-FROM-BUTTON Phase 4). */
|
|
@@ -29,13 +27,14 @@ export interface ConfigureGatherStepProps {
|
|
|
29
27
|
/**
|
|
30
28
|
* First step of the resource-generate flow: pick the gather options before
|
|
31
29
|
* `gather.resource` runs. The `children` slot hosts the entity-type exclusion
|
|
32
|
-
* multi-select (Phase 4).
|
|
30
|
+
* multi-select (Phase 4). Dismissal is the modal's corner ✕/Esc/backdrop
|
|
31
|
+
* (WIZARD-NAVIGATION D1), so the footer carries the advance alone.
|
|
33
32
|
*/
|
|
34
|
-
export function ConfigureGatherStep({
|
|
35
|
-
const [includeContent, setIncludeContent] = useState(
|
|
36
|
-
const [includeSummary, setIncludeSummary] = useState(
|
|
37
|
-
const [depth, setDepth] = useState(
|
|
38
|
-
const [maxResources, setMaxResources] = useState(
|
|
33
|
+
export function ConfigureGatherStep({ onGather, translations: t, children }: ConfigureGatherStepProps) {
|
|
34
|
+
const [includeContent, setIncludeContent] = useState(true);
|
|
35
|
+
const [includeSummary, setIncludeSummary] = useState(true);
|
|
36
|
+
const [depth, setDepth] = useState(2);
|
|
37
|
+
const [maxResources, setMaxResources] = useState(10);
|
|
39
38
|
|
|
40
39
|
const handleSubmit = (e: React.FormEvent) => {
|
|
41
40
|
e.preventDefault();
|
|
@@ -43,7 +42,7 @@ export function ConfigureGatherStep({ defaults, onGather, onCancel, translations
|
|
|
43
42
|
};
|
|
44
43
|
|
|
45
44
|
return (
|
|
46
|
-
<form onSubmit={handleSubmit} className="semiont-form
|
|
45
|
+
<form onSubmit={handleSubmit} className="semiont-form">
|
|
47
46
|
<p className="semiont-form__helper-text">{t.intro}</p>
|
|
48
47
|
|
|
49
48
|
<div className="semiont-form__checkbox-field">
|
|
@@ -89,14 +88,7 @@ export function ConfigureGatherStep({ defaults, onGather, onCancel, translations
|
|
|
89
88
|
{/* Exclusion multi-select slot (Phase 4) */}
|
|
90
89
|
{children}
|
|
91
90
|
|
|
92
|
-
<
|
|
93
|
-
<button type="button" onClick={onCancel} className="semiont-button--secondary semiont-button--flex">
|
|
94
|
-
✕ {t.cancel}
|
|
95
|
-
</button>
|
|
96
|
-
<button type="submit" className="semiont-button--primary semiont-button--flex">
|
|
97
|
-
✨ {t.gather}
|
|
98
|
-
</button>
|
|
99
|
-
</div>
|
|
91
|
+
<WizardFooter primary={{ label: t.gather, type: 'submit' }} />
|
|
100
92
|
</form>
|
|
101
93
|
);
|
|
102
94
|
}
|