@semiont/react-ui 0.2.34 → 0.2.35-build.101
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 +1 -0
- package/dist/index.d.mts +109 -45
- package/dist/index.mjs +705 -758
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/CodeMirrorRenderer.tsx +73 -65
- package/src/components/resource/AnnotateView.tsx +9 -6
- package/src/components/resource/BrowseView.tsx +62 -52
- package/src/components/resource/ResourceViewer.tsx +6 -6
- package/src/components/resource/__tests__/BrowseView.test.tsx +8 -9
- package/src/features/admin-devops/components/AdminDevOpsPage.tsx +2 -1
- package/src/features/admin-security/components/AdminSecurityPage.tsx +2 -1
- package/src/features/admin-users/components/AdminUsersPage.tsx +2 -1
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +2 -1
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +2 -1
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +2 -1
- package/src/features/resource-compose/components/ResourceComposePage.tsx +2 -1
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +2 -1
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +19 -17
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ScaleIcon,
|
|
12
12
|
LightBulbIcon
|
|
13
13
|
} from '@heroicons/react/24/outline';
|
|
14
|
+
import { COMMON_PANELS, type ToolbarPanelType } from '../../../hooks/usePanelNavigation';
|
|
14
15
|
import type { TagSchema } from '@semiont/react-ui';
|
|
15
16
|
|
|
16
17
|
export interface TagSchemasPageProps {
|
|
@@ -68,7 +69,7 @@ export function TagSchemasPage({
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
return (
|
|
71
|
-
<div className={`semiont-page${activePanel ? ' semiont-page--panel-open' : ''}`}>
|
|
72
|
+
<div className={`semiont-page${activePanel && COMMON_PANELS.includes(activePanel as ToolbarPanelType) ? ' semiont-page--panel-open' : ''}`}>
|
|
72
73
|
{/* Main Content Area */}
|
|
73
74
|
<div className="semiont-page__content">
|
|
74
75
|
{/* Page Title */}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import React, { useState, useEffect } from 'react';
|
|
10
10
|
import type { components } from '@semiont/core';
|
|
11
11
|
import { isImageMimeType, isPdfMimeType, LOCALES } from '@semiont/api-client';
|
|
12
|
+
import { COMMON_PANELS, type ToolbarPanelType } from '../../../hooks/usePanelNavigation';
|
|
12
13
|
import { buttonStyles } from '../../../lib/button-styles';
|
|
13
14
|
import { CodeMirrorRenderer } from '../../../components/CodeMirrorRenderer';
|
|
14
15
|
import { useFormAnnouncements } from '../../../components/LiveRegion';
|
|
@@ -254,7 +255,7 @@ export function ResourceComposePage({
|
|
|
254
255
|
const isReferenceCompletion = mode === 'reference';
|
|
255
256
|
|
|
256
257
|
return (
|
|
257
|
-
<div className={`semiont-page${activePanel ? ' semiont-page--panel-open' : ''}`}>
|
|
258
|
+
<div className={`semiont-page${activePanel && COMMON_PANELS.includes(activePanel as ToolbarPanelType) ? ' semiont-page--panel-open' : ''}`}>
|
|
258
259
|
{/* Main Content Area */}
|
|
259
260
|
<div className="semiont-page__content semiont-page__compose">
|
|
260
261
|
{/* Page Title */}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import React, { useState, useCallback, useRef } from 'react';
|
|
9
9
|
import type { components } from '@semiont/core';
|
|
10
10
|
import { getResourceId } from '@semiont/api-client';
|
|
11
|
+
import { COMMON_PANELS, type ToolbarPanelType } from '../../../hooks/usePanelNavigation';
|
|
11
12
|
import { useRovingTabIndex } from '../../../hooks/useRovingTabIndex';
|
|
12
13
|
import { Toolbar } from '../../../components/Toolbar';
|
|
13
14
|
import { ResourceCard } from './ResourceCard';
|
|
@@ -129,7 +130,7 @@ export function ResourceDiscoveryPage({
|
|
|
129
130
|
const showNoResultsWarning = hasSearchQuery && !hasSearchResults && !isSearching;
|
|
130
131
|
|
|
131
132
|
return (
|
|
132
|
-
<div className={`semiont-page${activePanel ? ' semiont-page--panel-open' : ''}`}>
|
|
133
|
+
<div className={`semiont-page${activePanel && COMMON_PANELS.includes(activePanel as ToolbarPanelType) ? ' semiont-page--panel-open' : ''}`}>
|
|
133
134
|
{/* Main Content Area */}
|
|
134
135
|
<div className="semiont-page__content">
|
|
135
136
|
{/* Page Header */}
|
|
@@ -414,26 +414,28 @@ export function ResourceViewerPage({
|
|
|
414
414
|
return false;
|
|
415
415
|
});
|
|
416
416
|
|
|
417
|
-
// Group annotations by type using static ANNOTATORS
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
result[key as keyof typeof result]
|
|
417
|
+
// Group annotations by type using static ANNOTATORS (memoized to avoid re-grouping on unrelated re-renders)
|
|
418
|
+
const groups = useMemo(() => {
|
|
419
|
+
const result = {
|
|
420
|
+
highlights: [] as Annotation[],
|
|
421
|
+
references: [] as Annotation[],
|
|
422
|
+
assessments: [] as Annotation[],
|
|
423
|
+
comments: [] as Annotation[],
|
|
424
|
+
tags: [] as Annotation[]
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
for (const ann of annotations) {
|
|
428
|
+
const annotator = Object.values(ANNOTATORS).find(a => a.matchesAnnotation(ann));
|
|
429
|
+
if (annotator) {
|
|
430
|
+
const key = annotator.internalType + 's'; // highlight -> highlights
|
|
431
|
+
if (result[key as keyof typeof result]) {
|
|
432
|
+
result[key as keyof typeof result].push(ann);
|
|
433
|
+
}
|
|
432
434
|
}
|
|
433
435
|
}
|
|
434
|
-
}
|
|
435
436
|
|
|
436
|
-
|
|
437
|
+
return result;
|
|
438
|
+
}, [annotations]);
|
|
437
439
|
|
|
438
440
|
// Combine resource with content
|
|
439
441
|
const resourceWithContent = { ...resource, content };
|