dbf-mirador 4.2.3
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 +203 -0
- package/README.md +133 -0
- package/dist/CommentSharp-B0J_-jEq.js +325 -0
- package/dist/CommentSharp-B0J_-jEq.js.map +1 -0
- package/dist/FailedImageContext-aQXnWSHN.js +318 -0
- package/dist/FailedImageContext-aQXnWSHN.js.map +1 -0
- package/dist/PluginHook-CFw_6P5c.js +54 -0
- package/dist/PluginHook-CFw_6P5c.js.map +1 -0
- package/dist/WindowCanvasNavigationControls-CUX723BQ.js +242 -0
- package/dist/WindowCanvasNavigationControls-CUX723BQ.js.map +1 -0
- package/dist/action-types-DjIbTE-A.js +74 -0
- package/dist/action-types-DjIbTE-A.js.map +1 -0
- package/dist/canvas-C8oHvXFN.js +41 -0
- package/dist/canvas-C8oHvXFN.js.map +1 -0
- package/dist/canvases-gRqhr-IH.js +3154 -0
- package/dist/canvases-gRqhr-IH.js.map +1 -0
- package/dist/createSvgIcon-Cwt8YPfm.js +2 -0
- package/dist/getters-COus7Mvg.js +2066 -0
- package/dist/getters-COus7Mvg.js.map +1 -0
- package/dist/index.module-CbBRf_R8.js +403 -0
- package/dist/index.module-CbBRf_R8.js.map +1 -0
- package/dist/mirador.es.js +39600 -0
- package/dist/mirador.es.js.map +1 -0
- package/dist/mirador.min.js +334 -0
- package/dist/mirador.min.js.map +1 -0
- package/dist/react-error-boundary.esm-B_pT-oCS.js +67 -0
- package/dist/react-error-boundary.esm-B_pT-oCS.js.map +1 -0
- package/dist/visuallyHidden-DmYvwNdU.js +98 -0
- package/dist/visuallyHidden-DmYvwNdU.js.map +1 -0
- package/dist/window-zelwU7wz.js +138 -0
- package/dist/window-zelwU7wz.js.map +1 -0
- package/package.json +138 -0
- package/src/components/AccessTokenSender.jsx +34 -0
- package/src/components/AnnotationSettings.jsx +31 -0
- package/src/components/AnnotationsOverlay.jsx +328 -0
- package/src/components/App.jsx +34 -0
- package/src/components/AppProviders.jsx +129 -0
- package/src/components/AttributionPanel.jsx +78 -0
- package/src/components/AudioViewer.jsx +39 -0
- package/src/components/BackgroundPluginArea.jsx +9 -0
- package/src/components/Branding.jsx +33 -0
- package/src/components/CanvasAnnotations.jsx +125 -0
- package/src/components/CanvasInfo.jsx +46 -0
- package/src/components/CanvasLayers.jsx +367 -0
- package/src/components/ChangeThemeDialog.jsx +65 -0
- package/src/components/CollapsibleSection.jsx +53 -0
- package/src/components/CollectionDialog.jsx +236 -0
- package/src/components/CollectionInfo.jsx +48 -0
- package/src/components/CompanionArea.jsx +140 -0
- package/src/components/CompanionWindow.jsx +228 -0
- package/src/components/CompanionWindowFactory.jsx +38 -0
- package/src/components/CompanionWindowSection.jsx +11 -0
- package/src/components/CustomPanel.jsx +22 -0
- package/src/components/ErrorContent.jsx +65 -0
- package/src/components/ErrorDialog.jsx +47 -0
- package/src/components/FullScreenButton.jsx +47 -0
- package/src/components/GalleryView.jsx +36 -0
- package/src/components/GalleryViewThumbnail.jsx +160 -0
- package/src/components/IIIFAuthentication.jsx +144 -0
- package/src/components/IIIFDropTarget.jsx +168 -0
- package/src/components/IIIFIFrameCommunication.jsx +45 -0
- package/src/components/IIIFResourceLabel.jsx +26 -0
- package/src/components/IIIFThumbnail.jsx +214 -0
- package/src/components/ImageFailureMessage.jsx +42 -0
- package/src/components/LabelValueMetadata.jsx +46 -0
- package/src/components/LanguageSettings.jsx +46 -0
- package/src/components/LayersPanel.jsx +24 -0
- package/src/components/LocalePicker.jsx +56 -0
- package/src/components/ManifestForm.jsx +79 -0
- package/src/components/ManifestInfo.jsx +67 -0
- package/src/components/ManifestListItem.jsx +209 -0
- package/src/components/ManifestListItemError.jsx +53 -0
- package/src/components/ManifestRelatedLinks.jsx +154 -0
- package/src/components/MinimalWindow.jsx +104 -0
- package/src/components/MiradorMenuButton.jsx +71 -0
- package/src/components/MosaicRenderPreview.jsx +16 -0
- package/src/components/NestedMenu.jsx +42 -0
- package/src/components/NewBrowserWindow.jsx +34 -0
- package/src/components/OpenSeadragonComponent.jsx +258 -0
- package/src/components/OpenSeadragonTileSource.jsx +105 -0
- package/src/components/OpenSeadragonViewer.jsx +161 -0
- package/src/components/PluginHook.jsx +27 -0
- package/src/components/PrimaryWindow.jsx +115 -0
- package/src/components/SanitizedHtml.jsx +37 -0
- package/src/components/ScrollIndicatedDialogContent.jsx +60 -0
- package/src/components/ScrollTo.jsx +61 -0
- package/src/components/SearchHit.jsx +220 -0
- package/src/components/SearchPanel.jsx +80 -0
- package/src/components/SearchPanelControls.jsx +174 -0
- package/src/components/SearchPanelNavigation.jsx +84 -0
- package/src/components/SearchResults.jsx +138 -0
- package/src/components/SelectCollection.jsx +44 -0
- package/src/components/SidebarIndexItem.jsx +11 -0
- package/src/components/SidebarIndexList.jsx +73 -0
- package/src/components/SidebarIndexTableOfContents.jsx +170 -0
- package/src/components/SidebarIndexThumbnail.jsx +22 -0
- package/src/components/TextViewer.jsx +37 -0
- package/src/components/ThumbnailCanvasGrouping.jsx +122 -0
- package/src/components/ThumbnailNavigation.jsx +231 -0
- package/src/components/VideoViewer.jsx +35 -0
- package/src/components/ViewerInfo.jsx +55 -0
- package/src/components/ViewerNavigation.jsx +72 -0
- package/src/components/Window.jsx +150 -0
- package/src/components/WindowAuthenticationBar.jsx +176 -0
- package/src/components/WindowCanvasNavigationControls.jsx +91 -0
- package/src/components/WindowList.jsx +71 -0
- package/src/components/WindowListButton.jsx +57 -0
- package/src/components/WindowSideBar.jsx +48 -0
- package/src/components/WindowSideBarAnnotationsPanel.jsx +51 -0
- package/src/components/WindowSideBarButtons.jsx +151 -0
- package/src/components/WindowSideBarCanvasPanel.jsx +165 -0
- package/src/components/WindowSideBarCollectionPanel.jsx +179 -0
- package/src/components/WindowSideBarInfoPanel.jsx +67 -0
- package/src/components/WindowThumbnailSettings.jsx +130 -0
- package/src/components/WindowTopBar.jsx +125 -0
- package/src/components/WindowTopBarPluginArea.jsx +8 -0
- package/src/components/WindowTopBarPluginMenu.jsx +78 -0
- package/src/components/WindowTopBarTitle.jsx +73 -0
- package/src/components/WindowTopMenu.jsx +81 -0
- package/src/components/WindowTopMenuButton.jsx +49 -0
- package/src/components/WindowViewSettings.jsx +95 -0
- package/src/components/WindowViewer.jsx +26 -0
- package/src/components/Workspace.jsx +124 -0
- package/src/components/WorkspaceAdd.jsx +221 -0
- package/src/components/WorkspaceAddButton.jsx +73 -0
- package/src/components/WorkspaceArea.jsx +66 -0
- package/src/components/WorkspaceControlPanel.jsx +85 -0
- package/src/components/WorkspaceControlPanelButtons.jsx +20 -0
- package/src/components/WorkspaceDialog.jsx +11 -0
- package/src/components/WorkspaceElastic.jsx +88 -0
- package/src/components/WorkspaceElasticWindow.jsx +79 -0
- package/src/components/WorkspaceExport.jsx +99 -0
- package/src/components/WorkspaceImport.jsx +89 -0
- package/src/components/WorkspaceMenu.jsx +126 -0
- package/src/components/WorkspaceMenuButton.jsx +42 -0
- package/src/components/WorkspaceMosaic.jsx +149 -0
- package/src/components/WorkspaceOptionsButton.jsx +35 -0
- package/src/components/WorkspaceOptionsMenu.jsx +112 -0
- package/src/components/WorkspaceSelectionDialog.jsx +165 -0
- package/src/components/ZoomControls.jsx +57 -0
- package/src/components/icons/BookViewIcon.jsx +14 -0
- package/src/components/icons/CanvasIndexIcon.jsx +14 -0
- package/src/components/icons/GalleryViewIcon.jsx +17 -0
- package/src/components/icons/MiradorIcon.jsx +14 -0
- package/src/components/icons/RestoreZoomIcon.jsx +15 -0
- package/src/components/icons/ThumbnailNavigationBottomIcon.jsx +15 -0
- package/src/components/icons/ThumbnailNavigationRightIcon.jsx +16 -0
- package/src/components/icons/WindowMaxIcon.jsx +15 -0
- package/src/components/icons/WindowMinIcon.jsx +15 -0
- package/src/components/icons/WindowOptionsIcon.jsx +16 -0
- package/src/components/icons/WorkspaceTypeElasticIcon.jsx +157 -0
- package/src/components/icons/WorkspaceTypeMosaicIcon.jsx +162 -0
- package/src/components/icons/index.js +27 -0
- package/src/components/index.js +108 -0
- package/src/config/css-ns.js +10 -0
- package/src/config/index.js +2 -0
- package/src/config/settings.js +607 -0
- package/src/containers/AnnotationSettings.js +27 -0
- package/src/containers/AnnotationsOverlay.js +51 -0
- package/src/containers/AppProviders.js +20 -0
- package/src/containers/AttributionPanel.js +20 -0
- package/src/containers/AudioViewer.js +16 -0
- package/src/containers/BackgroundPluginArea.js +4 -0
- package/src/containers/Branding.js +4 -0
- package/src/containers/CanvasAnnotations.js +32 -0
- package/src/containers/CanvasInfo.js +20 -0
- package/src/containers/CanvasLayers.js +25 -0
- package/src/containers/ChangeThemeDialog.js +29 -0
- package/src/containers/CollapsibleSection.js +3 -0
- package/src/containers/CollectionDialog.js +48 -0
- package/src/containers/CollectionInfo.js +29 -0
- package/src/containers/CompanionArea.js +22 -0
- package/src/containers/CompanionWindow.js +40 -0
- package/src/containers/CompanionWindowFactory.js +23 -0
- package/src/containers/CustomPanel.js +13 -0
- package/src/containers/ErrorContent.js +20 -0
- package/src/containers/ErrorDialog.js +28 -0
- package/src/containers/FullScreenButton.js +22 -0
- package/src/containers/GalleryView.js +23 -0
- package/src/containers/GalleryViewThumbnail.js +51 -0
- package/src/containers/IIIFAuthentication.js +86 -0
- package/src/containers/IIIFThumbnail.js +17 -0
- package/src/containers/LabelValueMetadata.js +14 -0
- package/src/containers/LanguageSettings.js +26 -0
- package/src/containers/LayersPanel.js +16 -0
- package/src/containers/LocalePicker.js +3 -0
- package/src/containers/ManifestForm.js +16 -0
- package/src/containers/ManifestInfo.js +29 -0
- package/src/containers/ManifestListItem.js +52 -0
- package/src/containers/ManifestListItemError.js +15 -0
- package/src/containers/ManifestRelatedLinks.js +28 -0
- package/src/containers/MinimalWindow.js +25 -0
- package/src/containers/MiradorMenuButton.js +7 -0
- package/src/containers/MosaicRenderPreview.js +14 -0
- package/src/containers/OpenSeadragonViewer.js +59 -0
- package/src/containers/PrimaryWindow.js +27 -0
- package/src/containers/SanitizedHtml.js +3 -0
- package/src/containers/ScrollIndicatedDialogContent.js +3 -0
- package/src/containers/SearchHit.js +71 -0
- package/src/containers/SearchPanel.js +23 -0
- package/src/containers/SearchPanelControls.js +36 -0
- package/src/containers/SearchPanelNavigation.js +39 -0
- package/src/containers/SearchResults.js +38 -0
- package/src/containers/SelectCollection.js +24 -0
- package/src/containers/SidebarIndexItem.js +8 -0
- package/src/containers/SidebarIndexList.js +28 -0
- package/src/containers/SidebarIndexTableOfContents.js +31 -0
- package/src/containers/SidebarIndexThumbnail.js +18 -0
- package/src/containers/TextViewer.js +19 -0
- package/src/containers/ThumbnailCanvasGrouping.js +29 -0
- package/src/containers/ThumbnailNavigation.js +48 -0
- package/src/containers/VideoViewer.js +16 -0
- package/src/containers/ViewerInfo.js +30 -0
- package/src/containers/ViewerNavigation.js +31 -0
- package/src/containers/Window.js +45 -0
- package/src/containers/WindowAuthenticationBar.js +7 -0
- package/src/containers/WindowCanvasNavigationControls.js +15 -0
- package/src/containers/WindowList.js +30 -0
- package/src/containers/WindowListButton.js +15 -0
- package/src/containers/WindowSideBar.js +20 -0
- package/src/containers/WindowSideBarAnnotationsPanel.js +23 -0
- package/src/containers/WindowSideBarButtons.js +75 -0
- package/src/containers/WindowSideBarCanvasPanel.js +50 -0
- package/src/containers/WindowSideBarCollectionPanel.js +48 -0
- package/src/containers/WindowSideBarInfoPanel.js +35 -0
- package/src/containers/WindowThumbnailSettings.js +31 -0
- package/src/containers/WindowTopBar.js +39 -0
- package/src/containers/WindowTopBarPluginArea.js +8 -0
- package/src/containers/WindowTopBarPluginMenu.js +7 -0
- package/src/containers/WindowTopBarTitle.js +17 -0
- package/src/containers/WindowTopMenu.js +28 -0
- package/src/containers/WindowTopMenuButton.js +7 -0
- package/src/containers/WindowViewSettings.js +30 -0
- package/src/containers/WindowViewer.js +10 -0
- package/src/containers/Workspace.js +36 -0
- package/src/containers/WorkspaceAdd.js +27 -0
- package/src/containers/WorkspaceAddButton.js +30 -0
- package/src/containers/WorkspaceArea.js +21 -0
- package/src/containers/WorkspaceControlPanel.js +10 -0
- package/src/containers/WorkspaceControlPanelButtons.js +7 -0
- package/src/containers/WorkspaceElastic.js +41 -0
- package/src/containers/WorkspaceElasticWindow.js +36 -0
- package/src/containers/WorkspaceExport.js +18 -0
- package/src/containers/WorkspaceImport.js +19 -0
- package/src/containers/WorkspaceMenu.js +30 -0
- package/src/containers/WorkspaceMenuButton.js +10 -0
- package/src/containers/WorkspaceMosaic.js +32 -0
- package/src/containers/WorkspaceOptionsButton.js +7 -0
- package/src/containers/WorkspaceOptionsMenu.js +3 -0
- package/src/containers/WorkspaceSelectionDialog.js +26 -0
- package/src/containers/ZoomControls.js +26 -0
- package/src/containers/index.js +94 -0
- package/src/contexts/FailedImageContext.js +8 -0
- package/src/contexts/FailedImageProvider.jsx +34 -0
- package/src/contexts/FullScreenContext.js +5 -0
- package/src/contexts/LocaleContext.js +5 -0
- package/src/contexts/OpenSeadragonViewerContext.js +5 -0
- package/src/contexts/WorkspaceContext.js +5 -0
- package/src/contexts/index.js +4 -0
- package/src/extend/PluginContext.js +5 -0
- package/src/extend/PluginProvider.jsx +22 -0
- package/src/extend/index.js +9 -0
- package/src/extend/pluginMapping.js +44 -0
- package/src/extend/pluginPreprocessing.js +45 -0
- package/src/extend/pluginValidation.js +58 -0
- package/src/extend/usePlugins.js +13 -0
- package/src/extend/withPlugins.jsx +46 -0
- package/src/hooks/index.js +4 -0
- package/src/hooks/useCanvasWorldService.js +10 -0
- package/src/hooks/useThumbnailService.js +8 -0
- package/src/i18n.js +71 -0
- package/src/index.js +18 -0
- package/src/init.js +20 -0
- package/src/lib/AnnotationFactory.js +23 -0
- package/src/lib/AnnotationItem.js +123 -0
- package/src/lib/AnnotationList.js +31 -0
- package/src/lib/AnnotationPage.js +41 -0
- package/src/lib/AnnotationResource.js +122 -0
- package/src/lib/CanvasAnnotationDisplay.js +148 -0
- package/src/lib/CanvasGroupings.js +55 -0
- package/src/lib/CanvasWorld.js +214 -0
- package/src/lib/CompanionWindowRegistry.js +23 -0
- package/src/lib/FullScreenHandle.jsx +76 -0
- package/src/lib/MiradorCanvas.js +211 -0
- package/src/lib/MiradorManifest.js +44 -0
- package/src/lib/MiradorViewer.jsx +53 -0
- package/src/lib/MosaicLayout.js +77 -0
- package/src/lib/OpenSeadragonCanvasOverlay.js +114 -0
- package/src/lib/ThumbnailFactory.js +310 -0
- package/src/lib/TruncatedHit.js +34 -0
- package/src/lib/asArray.js +11 -0
- package/src/lib/htmlRules.js +28 -0
- package/src/lib/iiif.js +12 -0
- package/src/lib/index.js +23 -0
- package/src/lib/readImageMetadata.js +21 -0
- package/src/lib/svgShapesToPath.js +49 -0
- package/src/locales/README.md +60 -0
- package/src/locales/ar/translation.json +141 -0
- package/src/locales/bg/translation.json +164 -0
- package/src/locales/de/translation.json +169 -0
- package/src/locales/en/translation.json +170 -0
- package/src/locales/et/translation.json +164 -0
- package/src/locales/fa/translation.json +164 -0
- package/src/locales/fr/translation.json +158 -0
- package/src/locales/hr/translation.json +164 -0
- package/src/locales/hu/translation.json +166 -0
- package/src/locales/it/translation.json +162 -0
- package/src/locales/ja/translation.json +156 -0
- package/src/locales/kr/translation.json +162 -0
- package/src/locales/lt/translation.json +153 -0
- package/src/locales/nbNo/translation.json +162 -0
- package/src/locales/nl/translation.json +139 -0
- package/src/locales/pl/translation.json +162 -0
- package/src/locales/ptBr/translation.json +133 -0
- package/src/locales/sr/translation.json +155 -0
- package/src/locales/sv/translation.json +157 -0
- package/src/locales/ta/translation.json +167 -0
- package/src/locales/vi/translation.json +156 -0
- package/src/locales/zhCn/translation.json +163 -0
- package/src/locales/zhTw/translation.json +163 -0
- package/src/plugins/OSDReferences.js +15 -0
- package/src/plugins/index.js +1 -0
- package/src/state/actions/action-types.js +76 -0
- package/src/state/actions/annotation.js +123 -0
- package/src/state/actions/auth.js +109 -0
- package/src/state/actions/canvas.js +65 -0
- package/src/state/actions/catalog.js +22 -0
- package/src/state/actions/companionWindow.js +107 -0
- package/src/state/actions/config.js +49 -0
- package/src/state/actions/elasticLayout.js +10 -0
- package/src/state/actions/errors.js +22 -0
- package/src/state/actions/index.js +19 -0
- package/src/state/actions/infoResponse.js +90 -0
- package/src/state/actions/layers.js +14 -0
- package/src/state/actions/manifest.js +65 -0
- package/src/state/actions/search.js +97 -0
- package/src/state/actions/window.js +209 -0
- package/src/state/actions/workspace.js +84 -0
- package/src/state/createPluggableStore.js +24 -0
- package/src/state/createStore.js +33 -0
- package/src/state/index.js +21 -0
- package/src/state/reducers/accessTokens.js +59 -0
- package/src/state/reducers/annotations.js +48 -0
- package/src/state/reducers/auth.js +43 -0
- package/src/state/reducers/catalog.js +30 -0
- package/src/state/reducers/companionWindows.js +49 -0
- package/src/state/reducers/config.js +39 -0
- package/src/state/reducers/elasticLayout.js +29 -0
- package/src/state/reducers/errors.js +51 -0
- package/src/state/reducers/index.js +15 -0
- package/src/state/reducers/infoResponses.js +61 -0
- package/src/state/reducers/layers.js +23 -0
- package/src/state/reducers/manifests.js +52 -0
- package/src/state/reducers/rootReducer.js +44 -0
- package/src/state/reducers/search.js +145 -0
- package/src/state/reducers/utils.js +45 -0
- package/src/state/reducers/viewers.js +42 -0
- package/src/state/reducers/windows.js +185 -0
- package/src/state/reducers/workspace.js +111 -0
- package/src/state/sagas/annotations.js +48 -0
- package/src/state/sagas/app.js +56 -0
- package/src/state/sagas/auth.js +151 -0
- package/src/state/sagas/iiif.js +233 -0
- package/src/state/sagas/index.js +30 -0
- package/src/state/sagas/windows.js +293 -0
- package/src/state/selectors/annotations.js +138 -0
- package/src/state/selectors/auth.js +100 -0
- package/src/state/selectors/canvases.js +260 -0
- package/src/state/selectors/companionWindows.js +182 -0
- package/src/state/selectors/config.js +100 -0
- package/src/state/selectors/getters.js +90 -0
- package/src/state/selectors/index.js +17 -0
- package/src/state/selectors/layers.js +79 -0
- package/src/state/selectors/manifests.js +433 -0
- package/src/state/selectors/ranges.js +147 -0
- package/src/state/selectors/searches.js +249 -0
- package/src/state/selectors/sequences.js +134 -0
- package/src/state/selectors/thumbnails.js +28 -0
- package/src/state/selectors/utils.js +18 -0
- package/src/state/selectors/viewer.js +19 -0
- package/src/state/selectors/windows.js +98 -0
- package/src/state/selectors/workspace.js +52 -0
- package/src/state/selectors/wrappers.js +15 -0
- package/src/styles/react-mosaic-component.js +288 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
3
|
+
import IIIFThumbnail from '../containers/IIIFThumbnail';
|
|
4
|
+
|
|
5
|
+
/** */
|
|
6
|
+
export function SidebarIndexThumbnail({ canvas, height = undefined, label, width = undefined }) {
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<div style={{ minWidth: 50 }}>
|
|
10
|
+
<IIIFThumbnail label={label} resource={canvas} maxHeight={height} maxWidth={width} />
|
|
11
|
+
</div>
|
|
12
|
+
<Typography>{label}</Typography>
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
SidebarIndexThumbnail.propTypes = {
|
|
18
|
+
canvas: PropTypes.object.isRequired,
|
|
19
|
+
height: PropTypes.number,
|
|
20
|
+
label: PropTypes.string.isRequired,
|
|
21
|
+
width: PropTypes.number,
|
|
22
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { styled } from '@mui/material/styles';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import WindowCanvasNavigationControls from '../containers/WindowCanvasNavigationControls';
|
|
4
|
+
|
|
5
|
+
const StyledContainer = styled('div')(() => ({
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
display: 'flex',
|
|
8
|
+
width: '100%',
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const StyledText = styled('div')(() => ({
|
|
12
|
+
maxHeight: '100%',
|
|
13
|
+
width: '100%',
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Simple divs with canvas navigation, which should mimic v3 fallthrough to WindowViewer
|
|
18
|
+
* with non-image resources and provide a target for plugin overrides with minimal disruption.
|
|
19
|
+
*/
|
|
20
|
+
export function TextViewer({ textOptions = {}, textResources = [], windowId }) {
|
|
21
|
+
return (
|
|
22
|
+
<StyledContainer>
|
|
23
|
+
<StyledText {...textOptions}>
|
|
24
|
+
{textResources.map((text) => (
|
|
25
|
+
<source key={text.id} src={text.id} type={text.getFormat()} />
|
|
26
|
+
))}
|
|
27
|
+
<WindowCanvasNavigationControls windowId={windowId} />
|
|
28
|
+
</StyledText>
|
|
29
|
+
</StyledContainer>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
TextViewer.propTypes = {
|
|
34
|
+
textOptions: PropTypes.object,
|
|
35
|
+
textResources: PropTypes.arrayOf(PropTypes.object),
|
|
36
|
+
windowId: PropTypes.string.isRequired,
|
|
37
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import IIIFThumbnail from '../containers/IIIFThumbnail';
|
|
6
|
+
import ns from '../config/css-ns';
|
|
7
|
+
|
|
8
|
+
const StyledCanvas = styled('div')(({ theme }) => ({
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
color: theme.palette.common.white,
|
|
11
|
+
cursor: 'pointer',
|
|
12
|
+
display: 'inline-block',
|
|
13
|
+
whiteSpace: 'nowrap',
|
|
14
|
+
}));
|
|
15
|
+
/** */
|
|
16
|
+
export class ThumbnailCanvasGrouping extends PureComponent {
|
|
17
|
+
/** */
|
|
18
|
+
constructor(props) {
|
|
19
|
+
super(props);
|
|
20
|
+
this.setCanvas = this.setCanvas.bind(this);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** */
|
|
24
|
+
setCanvas(e) {
|
|
25
|
+
const { setCanvas } = this.props;
|
|
26
|
+
setCanvas(e.currentTarget.dataset.canvasId);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether the current index is the rendered canvas, providing
|
|
31
|
+
* a useful class.
|
|
32
|
+
*/
|
|
33
|
+
currentCanvasClass(canvasIndices) {
|
|
34
|
+
const { index } = this.props;
|
|
35
|
+
if (canvasIndices.includes(index)) return 'current-canvas-grouping';
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** */
|
|
40
|
+
render() {
|
|
41
|
+
const { index, columnIndex, style, canvasGroupings, position, currentCanvasId, showThumbnailLabels } = this.props;
|
|
42
|
+
// For Grid (horizontal), use columnIndex; for List (vertical), use index
|
|
43
|
+
const itemIndex = columnIndex !== undefined ? columnIndex : index;
|
|
44
|
+
const currentGroupings = canvasGroupings[itemIndex];
|
|
45
|
+
const SPACING = 12;
|
|
46
|
+
|
|
47
|
+
const isSelected = currentGroupings.map((canvas) => canvas.id).includes(currentCanvasId);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div
|
|
51
|
+
style={{
|
|
52
|
+
...style,
|
|
53
|
+
boxSizing: 'border-box',
|
|
54
|
+
height: Number.isInteger(style.height) ? style.height - SPACING : null,
|
|
55
|
+
left: Number.isInteger(style.left) ? style.left + SPACING / 2 : null,
|
|
56
|
+
padding: SPACING / 2,
|
|
57
|
+
top: Number.isInteger(style.top) ? style.top + SPACING / 2 : null,
|
|
58
|
+
width: Number.isInteger(style.width) ? style.width - SPACING : null,
|
|
59
|
+
}}
|
|
60
|
+
className={ns('thumbnail-nav-container')}
|
|
61
|
+
role="gridcell"
|
|
62
|
+
aria-selected={isSelected}
|
|
63
|
+
aria-colindex={itemIndex + 1}
|
|
64
|
+
>
|
|
65
|
+
<StyledCanvas
|
|
66
|
+
role="button"
|
|
67
|
+
data-canvas-id={currentGroupings[0].id}
|
|
68
|
+
data-canvas-index={currentGroupings[0].index}
|
|
69
|
+
onClick={this.setCanvas}
|
|
70
|
+
tabIndex={-1}
|
|
71
|
+
sx={(theme) => ({
|
|
72
|
+
'&:not(:hover)': {
|
|
73
|
+
outline: isSelected ? `2px solid ${theme.palette.primary.main}` : 0,
|
|
74
|
+
...(isSelected && {
|
|
75
|
+
outlineOffset: '3px',
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
'&:hover': {
|
|
79
|
+
outline: isSelected ? `2px solid ${theme.palette.primary.main}` : `2px solid ${theme.palette.action.hover}`,
|
|
80
|
+
outlineOffset: isSelected ? '3px' : '-2px',
|
|
81
|
+
},
|
|
82
|
+
height: position === 'far-right' ? 'auto' : `${style.height}px`,
|
|
83
|
+
width: position === 'far-bottom' ? 'auto' : `${style.width}px`,
|
|
84
|
+
})}
|
|
85
|
+
className={classNames(
|
|
86
|
+
ns([
|
|
87
|
+
'thumbnail-nav-canvas',
|
|
88
|
+
`thumbnail-nav-canvas-${itemIndex}`,
|
|
89
|
+
this.currentCanvasClass(currentGroupings.map((canvas) => canvas.index)),
|
|
90
|
+
]),
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
{currentGroupings.map((canvas, i) => (
|
|
94
|
+
<IIIFThumbnail
|
|
95
|
+
key={canvas.id}
|
|
96
|
+
resource={canvas}
|
|
97
|
+
labelled={showThumbnailLabels}
|
|
98
|
+
maxHeight={position === 'far-right' ? style.height - SPACING : style.height}
|
|
99
|
+
variant="inside"
|
|
100
|
+
/>
|
|
101
|
+
))}
|
|
102
|
+
</StyledCanvas>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
ThumbnailCanvasGrouping.propTypes = {
|
|
109
|
+
canvasGroupings: PropTypes.array.isRequired,
|
|
110
|
+
columnIndex: PropTypes.number,
|
|
111
|
+
currentCanvasId: PropTypes.string.isRequired,
|
|
112
|
+
index: PropTypes.number,
|
|
113
|
+
position: PropTypes.string.isRequired,
|
|
114
|
+
setCanvas: PropTypes.func.isRequired,
|
|
115
|
+
showThumbnailLabels: PropTypes.bool.isRequired,
|
|
116
|
+
style: PropTypes.object.isRequired,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
ThumbnailCanvasGrouping.defaultProps = {
|
|
120
|
+
columnIndex: undefined,
|
|
121
|
+
index: undefined,
|
|
122
|
+
};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { useCallback, useRef, useEffect } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Paper from '@mui/material/Paper';
|
|
4
|
+
import { List, Grid } from 'react-window';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { useCanvasWorldService } from '../hooks';
|
|
8
|
+
import ThumbnailCanvasGrouping from '../containers/ThumbnailCanvasGrouping';
|
|
9
|
+
import ns from '../config/css-ns';
|
|
10
|
+
/**
|
|
11
|
+
*/
|
|
12
|
+
export function ThumbnailNavigation({
|
|
13
|
+
canvasGroupings,
|
|
14
|
+
canvasIndex,
|
|
15
|
+
hasNextCanvas = false,
|
|
16
|
+
hasPreviousCanvas = false,
|
|
17
|
+
position,
|
|
18
|
+
setNextCanvas = () => {},
|
|
19
|
+
setPreviousCanvas = () => {},
|
|
20
|
+
thumbnailNavigation,
|
|
21
|
+
view = undefined,
|
|
22
|
+
viewingDirection = '',
|
|
23
|
+
windowId,
|
|
24
|
+
}) {
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const scrollbarSize = 6;
|
|
27
|
+
const spacing = 12; // 2 * (2px margin + 2px border + 2px padding)
|
|
28
|
+
const gridRef = useRef();
|
|
29
|
+
const previousView = useRef(view);
|
|
30
|
+
const canvasWorlds = useCanvasWorldService();
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (previousView.current !== view && position !== 'off') {
|
|
34
|
+
previousView.current = view;
|
|
35
|
+
// Note: resetAfterIndex is not available in react-window v2 List API
|
|
36
|
+
// The list will re-render automatically when rowHeight function changes
|
|
37
|
+
}
|
|
38
|
+
}, [view, position]);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
let index = canvasIndex;
|
|
42
|
+
if (view === 'book') index = Math.ceil(index / 2);
|
|
43
|
+
// Only scroll if the index is valid
|
|
44
|
+
if (gridRef.current && index >= 0 && index < canvasGroupings.length) {
|
|
45
|
+
// For horizontal Grid, scroll to column; for vertical List, scroll to row
|
|
46
|
+
if (position === 'far-bottom') {
|
|
47
|
+
// react-window Grid API in v2
|
|
48
|
+
gridRef.current.scrollToCell({
|
|
49
|
+
columnIndex: index,
|
|
50
|
+
rowIndex: 0,
|
|
51
|
+
columnAlign: 'center',
|
|
52
|
+
rowAlign: 'center',
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
// react-window List API in v2
|
|
56
|
+
gridRef.current.scrollToRow({ index, align: 'center' });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [canvasIndex, view, canvasGroupings.length, position]);
|
|
60
|
+
|
|
61
|
+
// Prevent loss of focus when navigating thumbnails
|
|
62
|
+
const paperRef = useRef(null);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (paperRef.current && document.activeElement !== paperRef.current) {
|
|
66
|
+
// This effect runs on mount too (not just keyboard navigation)
|
|
67
|
+
// Without preventScroll, the browser scrolls this element into view
|
|
68
|
+
// Inside an iframe embed, that scrolls the whole outer page down to the viewer
|
|
69
|
+
paperRef.current.focus({ preventScroll: true });
|
|
70
|
+
}
|
|
71
|
+
}, [canvasIndex]);
|
|
72
|
+
|
|
73
|
+
/** */
|
|
74
|
+
const handleKeyDown = (e) => {
|
|
75
|
+
let nextKey = 'ArrowRight';
|
|
76
|
+
let previousKey = 'ArrowLeft';
|
|
77
|
+
if (position === 'far-right') {
|
|
78
|
+
nextKey = 'ArrowDown';
|
|
79
|
+
previousKey = 'ArrowUp';
|
|
80
|
+
}
|
|
81
|
+
switch (e.key) {
|
|
82
|
+
case nextKey:
|
|
83
|
+
nextCanvas();
|
|
84
|
+
break;
|
|
85
|
+
case previousKey:
|
|
86
|
+
previousCanvas();
|
|
87
|
+
break;
|
|
88
|
+
default:
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* When on bottom, column width
|
|
95
|
+
*/
|
|
96
|
+
const calculateScaledWidth = (index) => {
|
|
97
|
+
const canvases = canvasGroupings[index];
|
|
98
|
+
if (!canvases) return thumbnailNavigation.width + spacing;
|
|
99
|
+
|
|
100
|
+
const world = canvasWorlds.get(canvases);
|
|
101
|
+
const bounds = world.worldBounds();
|
|
102
|
+
// calculate the correct canvas width based on the height + aspect ratio.
|
|
103
|
+
const availableHeight = thumbnailNavigation.height - spacing - scrollbarSize;
|
|
104
|
+
const calc = Math.ceil((availableHeight * bounds[2]) / bounds[3]);
|
|
105
|
+
|
|
106
|
+
if (!Number.isInteger(calc)) return thumbnailNavigation.width + spacing;
|
|
107
|
+
return calc + spacing;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* When on right, row height
|
|
112
|
+
*/
|
|
113
|
+
const calculateScaledHeight = (index) => {
|
|
114
|
+
const canvases = canvasGroupings[index];
|
|
115
|
+
if (!canvases) return thumbnailNavigation.height + spacing;
|
|
116
|
+
|
|
117
|
+
const world = canvasWorlds.get(canvases);
|
|
118
|
+
const bounds = world.worldBounds();
|
|
119
|
+
|
|
120
|
+
// calculate the correct canvas height based on the aspect ratio + width.
|
|
121
|
+
const availableWidth = thumbnailNavigation.width - spacing - scrollbarSize;
|
|
122
|
+
const calc = Math.ceil((availableWidth * canvases.length * bounds[3]) / bounds[2]);
|
|
123
|
+
|
|
124
|
+
if (!Number.isInteger(calc)) return thumbnailNavigation.height + spacing;
|
|
125
|
+
// Guard against incredibly small thumbnails
|
|
126
|
+
return Math.max(calc, Math.round(thumbnailNavigation.height / 3)) + spacing;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/** */
|
|
130
|
+
const style = useCallback(() => {
|
|
131
|
+
const width = view === 'book' ? thumbnailNavigation.width * 2 : thumbnailNavigation.width;
|
|
132
|
+
|
|
133
|
+
switch (position) {
|
|
134
|
+
case 'far-right':
|
|
135
|
+
return {
|
|
136
|
+
width: `${width}px`,
|
|
137
|
+
};
|
|
138
|
+
// Default case bottom
|
|
139
|
+
default:
|
|
140
|
+
return {
|
|
141
|
+
width: '100%',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
}, [position, thumbnailNavigation, view]);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
*/
|
|
148
|
+
const nextCanvas = () => {
|
|
149
|
+
if (hasNextCanvas) setNextCanvas();
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
*/
|
|
154
|
+
const previousCanvas = () => {
|
|
155
|
+
if (hasPreviousCanvas) setPreviousCanvas();
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
if (position === 'off') {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
const htmlDir = viewingDirection === 'right-to-left' ? 'rtl' : 'ltr';
|
|
162
|
+
const itemData = {
|
|
163
|
+
canvasGroupings,
|
|
164
|
+
position,
|
|
165
|
+
windowId,
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<Paper
|
|
170
|
+
className={classNames(ns('thumb-navigation'))}
|
|
171
|
+
sx={{
|
|
172
|
+
'&:focus': {
|
|
173
|
+
boxShadow: 0,
|
|
174
|
+
outline: 0,
|
|
175
|
+
},
|
|
176
|
+
scrollbarGutter: 'stable',
|
|
177
|
+
}}
|
|
178
|
+
aria-label={t('thumbnailNavigation')}
|
|
179
|
+
square
|
|
180
|
+
elevation={0}
|
|
181
|
+
style={style()}
|
|
182
|
+
tabIndex={0}
|
|
183
|
+
onKeyDown={handleKeyDown}
|
|
184
|
+
ref={paperRef}
|
|
185
|
+
>
|
|
186
|
+
{canvasGroupings.length > 0 && position === 'far-bottom' && (
|
|
187
|
+
<Grid
|
|
188
|
+
columnCount={canvasGroupings.length}
|
|
189
|
+
columnWidth={calculateScaledWidth}
|
|
190
|
+
rowCount={1}
|
|
191
|
+
rowHeight={thumbnailNavigation.height - spacing - scrollbarSize}
|
|
192
|
+
style={{
|
|
193
|
+
direction: htmlDir === 'rtl' ? 'rtl' : 'ltr',
|
|
194
|
+
height: thumbnailNavigation.height,
|
|
195
|
+
}}
|
|
196
|
+
cellProps={itemData}
|
|
197
|
+
gridRef={gridRef}
|
|
198
|
+
cellComponent={ThumbnailCanvasGrouping}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
{canvasGroupings.length > 0 && position === 'far-right' && (
|
|
202
|
+
<List
|
|
203
|
+
defaultHeight={100}
|
|
204
|
+
rowCount={canvasGroupings.length}
|
|
205
|
+
rowHeight={calculateScaledHeight}
|
|
206
|
+
style={{
|
|
207
|
+
paddingBottom: spacing,
|
|
208
|
+
direction: htmlDir === 'rtl' ? 'rtl' : 'ltr',
|
|
209
|
+
}}
|
|
210
|
+
rowProps={itemData}
|
|
211
|
+
listRef={gridRef}
|
|
212
|
+
rowComponent={ThumbnailCanvasGrouping}
|
|
213
|
+
/>
|
|
214
|
+
)}
|
|
215
|
+
</Paper>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
ThumbnailNavigation.propTypes = {
|
|
220
|
+
canvasGroupings: PropTypes.array.isRequired,
|
|
221
|
+
canvasIndex: PropTypes.number.isRequired,
|
|
222
|
+
hasNextCanvas: PropTypes.bool,
|
|
223
|
+
hasPreviousCanvas: PropTypes.bool,
|
|
224
|
+
position: PropTypes.string.isRequired,
|
|
225
|
+
setNextCanvas: PropTypes.func,
|
|
226
|
+
setPreviousCanvas: PropTypes.func,
|
|
227
|
+
thumbnailNavigation: PropTypes.object.isRequired,
|
|
228
|
+
view: PropTypes.string,
|
|
229
|
+
viewingDirection: PropTypes.string,
|
|
230
|
+
windowId: PropTypes.string.isRequired,
|
|
231
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
|
|
4
|
+
const StyledContainer = styled('div')(() => ({
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
width: '100%',
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
const StyledVideo = styled('video')(() => ({
|
|
11
|
+
maxHeight: '100%',
|
|
12
|
+
width: '100%',
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
/** */
|
|
16
|
+
export function VideoViewer({ captions = [], videoOptions = {}, videoResources = [] }) {
|
|
17
|
+
return (
|
|
18
|
+
<StyledContainer>
|
|
19
|
+
<StyledVideo {...videoOptions}>
|
|
20
|
+
{videoResources.map((video) => (
|
|
21
|
+
<source key={video.io} src={video.id} type={video.getFormat()} />
|
|
22
|
+
))}
|
|
23
|
+
{captions.map((caption) => (
|
|
24
|
+
<track key={caption.id} src={caption.id} label={caption.getDefaultLabel()} srcLang={caption.getProperty('language')} />
|
|
25
|
+
))}
|
|
26
|
+
</StyledVideo>
|
|
27
|
+
</StyledContainer>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
VideoViewer.propTypes = {
|
|
32
|
+
captions: PropTypes.arrayOf(PropTypes.object),
|
|
33
|
+
videoOptions: PropTypes.object,
|
|
34
|
+
videoResources: PropTypes.arrayOf(PropTypes.object),
|
|
35
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Typography from '@mui/material/Typography';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import ns from '../config/css-ns';
|
|
7
|
+
|
|
8
|
+
const StyledOsdInfo = styled('div')(({ theme }) => ({
|
|
9
|
+
overflow: 'hidden',
|
|
10
|
+
boxSizing: 'border-box',
|
|
11
|
+
paddingBottom: 0.5,
|
|
12
|
+
paddingLeft: theme.spacing(2),
|
|
13
|
+
paddingRight: theme.spacing(2),
|
|
14
|
+
textOverflow: 'ellipsis',
|
|
15
|
+
unicodeBidi: 'plaintext',
|
|
16
|
+
whiteSpace: 'nowrap',
|
|
17
|
+
width: '100%',
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export function ViewerInfo({ canvasCount, canvasIndex, canvasLabel = undefined }) {
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
return (
|
|
26
|
+
<StyledOsdInfo className={classNames(ns('osd-info'))}>
|
|
27
|
+
<Typography
|
|
28
|
+
variant="caption"
|
|
29
|
+
className={ns('canvas-count')}
|
|
30
|
+
role="status"
|
|
31
|
+
sx={{
|
|
32
|
+
display: 'inline',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{t('pagination', { current: canvasIndex + 1, total: canvasCount })}
|
|
36
|
+
</Typography>
|
|
37
|
+
<Typography
|
|
38
|
+
variant="caption"
|
|
39
|
+
className={ns('canvas-label')}
|
|
40
|
+
role="status"
|
|
41
|
+
sx={{
|
|
42
|
+
display: 'inline',
|
|
43
|
+
}}
|
|
44
|
+
>
|
|
45
|
+
{canvasLabel && ` • ${canvasLabel}`}
|
|
46
|
+
</Typography>
|
|
47
|
+
</StyledOsdInfo>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ViewerInfo.propTypes = {
|
|
52
|
+
canvasCount: PropTypes.number.isRequired,
|
|
53
|
+
canvasIndex: PropTypes.number.isRequired,
|
|
54
|
+
canvasLabel: PropTypes.string,
|
|
55
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import NavigationIcon from '@mui/icons-material/PlayCircleOutlineSharp';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import MiradorMenuButton from '../containers/MiradorMenuButton';
|
|
6
|
+
import ns from '../config/css-ns';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*/
|
|
10
|
+
export function ViewerNavigation({
|
|
11
|
+
hasNextCanvas = false,
|
|
12
|
+
hasPreviousCanvas = false,
|
|
13
|
+
setNextCanvas = () => {},
|
|
14
|
+
setPreviousCanvas = () => {},
|
|
15
|
+
viewingDirection = '',
|
|
16
|
+
}) {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
let htmlDir = 'ltr';
|
|
19
|
+
let previousIconStyle;
|
|
20
|
+
let nextIconStyle;
|
|
21
|
+
switch (viewingDirection) {
|
|
22
|
+
case 'top-to-bottom':
|
|
23
|
+
previousIconStyle = { transform: 'rotate(270deg)' };
|
|
24
|
+
nextIconStyle = { transform: 'rotate(90deg)' };
|
|
25
|
+
break;
|
|
26
|
+
case 'bottom-to-top':
|
|
27
|
+
previousIconStyle = { transform: 'rotate(90deg)' };
|
|
28
|
+
nextIconStyle = { transform: 'rotate(270deg)' };
|
|
29
|
+
break;
|
|
30
|
+
case 'right-to-left':
|
|
31
|
+
htmlDir = 'rtl';
|
|
32
|
+
previousIconStyle = {};
|
|
33
|
+
nextIconStyle = { transform: 'rotate(180deg)' };
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
previousIconStyle = { transform: 'rotate(180deg)' };
|
|
37
|
+
nextIconStyle = {};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div className={classNames(ns('osd-navigation'))} dir={htmlDir}>
|
|
42
|
+
<MiradorMenuButton
|
|
43
|
+
aria-label={t('previousCanvas')}
|
|
44
|
+
className={ns('previous-canvas-button')}
|
|
45
|
+
disabled={!hasPreviousCanvas}
|
|
46
|
+
onClick={() => {
|
|
47
|
+
hasPreviousCanvas && setPreviousCanvas();
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<NavigationIcon style={previousIconStyle} />
|
|
51
|
+
</MiradorMenuButton>
|
|
52
|
+
<MiradorMenuButton
|
|
53
|
+
aria-label={t('nextCanvas')}
|
|
54
|
+
className={ns('next-canvas-button')}
|
|
55
|
+
disabled={!hasNextCanvas}
|
|
56
|
+
onClick={() => {
|
|
57
|
+
hasNextCanvas && setNextCanvas();
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<NavigationIcon style={nextIconStyle} />
|
|
61
|
+
</MiradorMenuButton>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
ViewerNavigation.propTypes = {
|
|
67
|
+
hasNextCanvas: PropTypes.bool,
|
|
68
|
+
hasPreviousCanvas: PropTypes.bool,
|
|
69
|
+
setNextCanvas: PropTypes.func,
|
|
70
|
+
setPreviousCanvas: PropTypes.func,
|
|
71
|
+
viewingDirection: PropTypes.string,
|
|
72
|
+
};
|