@ohif/ui-next 3.14.0-beta.11 → 3.14.0-beta.111
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/dist/ohif-ui-next.css +6 -6
- package/dist/ohif-ui-next.umd.js +4 -1838
- package/package.json +31 -14
- package/src/__mocks__/fileMock.js +7 -0
- package/src/assets/fonts.css +50 -0
- package/src/assets/styles.css +55 -0
- package/src/assets/woff2/latin.woff2 +0 -0
- package/src/components/Accordion/Accordion.tsx +70 -0
- package/src/components/Accordion/index.ts +3 -0
- package/src/components/AllInOneMenu/BackItem.tsx +32 -0
- package/src/components/AllInOneMenu/DividerItem.tsx +11 -0
- package/src/components/AllInOneMenu/HeaderItem.tsx +15 -0
- package/src/components/AllInOneMenu/IconMenu.tsx +83 -0
- package/src/components/AllInOneMenu/Item.tsx +51 -0
- package/src/components/AllInOneMenu/ItemPanel.tsx +38 -0
- package/src/components/AllInOneMenu/Menu.tsx +231 -0
- package/src/components/AllInOneMenu/PanelSelector.tsx +32 -0
- package/src/components/AllInOneMenu/SubMenu.tsx +36 -0
- package/src/components/AllInOneMenu/index.ts +42 -0
- package/src/components/BackgroundColorSelect/BackgroundColorSelect.tsx +38 -0
- package/src/components/BackgroundColorSelect/index.tsx +1 -0
- package/src/components/Badge/Badge.tsx +38 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/Button/Button.tsx +65 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Calendar/Calendar.tsx +258 -0
- package/src/components/Calendar/index.tsx +3 -0
- package/src/components/Card/Card.tsx +83 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +27 -0
- package/src/components/Checkbox/index.tsx +3 -0
- package/src/components/CinePlayer/CinePlayer.tsx +187 -0
- package/src/components/CinePlayer/index.ts +5 -0
- package/src/components/Clipboard/Clipboard.tsx +58 -0
- package/src/components/Clipboard/index.tsx +3 -0
- package/src/components/ColorCircle.tsx +12 -0
- package/src/components/Combobox/Combobox.tsx +66 -0
- package/src/components/Combobox/index.ts +3 -0
- package/src/components/Command/Command.tsx +149 -0
- package/src/components/Command/index.ts +23 -0
- package/src/components/ContextMenu/ContextMenu.tsx +202 -0
- package/src/components/ContextMenu/index.ts +35 -0
- package/src/components/ContextMenuViewport/ContextMenuViewport.tsx +47 -0
- package/src/components/ContextMenuViewport/index.ts +1 -0
- package/src/components/DataRow/DataRow.tsx +532 -0
- package/src/components/DataRow/index.ts +1 -0
- package/src/components/DataRow/types.ts +31 -0
- package/src/components/DataTable/ActionOverlayCell.tsx +153 -0
- package/src/components/DataTable/ColumnHeader.tsx +70 -0
- package/src/components/DataTable/DataTable.tsx +532 -0
- package/src/components/DataTable/FilterRow.tsx +52 -0
- package/src/components/DataTable/Pagination.tsx +78 -0
- package/src/components/DataTable/Title.tsx +5 -0
- package/src/components/DataTable/Toolbar.tsx +5 -0
- package/src/components/DataTable/ViewOptions.tsx +86 -0
- package/src/components/DataTable/context.tsx +21 -0
- package/src/components/DataTable/index.ts +5 -0
- package/src/components/DataTable/types.ts +27 -0
- package/src/components/DataTable/useResponsiveColumns.tsx +346 -0
- package/src/components/DateRange/DateRange.tsx +163 -0
- package/src/components/DateRange/index.ts +3 -0
- package/src/components/Dialog/Dialog.tsx +201 -0
- package/src/components/Dialog/index.ts +25 -0
- package/src/components/Dialog/useDraggable.ts +108 -0
- package/src/components/DisplaySetMessageListTooltip/DisplaySetMessageListTooltip.tsx +64 -0
- package/src/components/DisplaySetMessageListTooltip/index.ts +3 -0
- package/src/components/DoubleSlider/DoubleSlider.test.ts +232 -0
- package/src/components/DoubleSlider/DoubleSlider.tsx +211 -0
- package/src/components/DoubleSlider/index.tsx +3 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +213 -0
- package/src/components/DropdownMenu/index.ts +35 -0
- package/src/components/Errorboundary/ErrorBoundary.tsx +345 -0
- package/src/components/Errorboundary/index.tsx +3 -0
- package/src/components/FooterAction/FooterAction.tsx +115 -0
- package/src/components/FooterAction/index.tsx +3 -0
- package/src/components/Header/Header.tsx +140 -0
- package/src/components/Header/index.js +2 -0
- package/src/components/HoverCard/HoverCard.tsx +30 -0
- package/src/components/HoverCard/index.ts +1 -0
- package/src/components/Icons/Icons.tsx +852 -0
- package/src/components/Icons/Sources/ActionNewDialog.tsx +64 -0
- package/src/components/Icons/Sources/Actions.tsx +47 -0
- package/src/components/Icons/Sources/Add.tsx +51 -0
- package/src/components/Icons/Sources/Alert.tsx +32 -0
- package/src/components/Icons/Sources/AlertOutline.tsx +30 -0
- package/src/components/Icons/Sources/ArrowLeftBold.tsx +49 -0
- package/src/components/Icons/Sources/ArrowRight.tsx +25 -0
- package/src/components/Icons/Sources/Cancel.tsx +37 -0
- package/src/components/Icons/Sources/CheckBoxChecked.tsx +39 -0
- package/src/components/Icons/Sources/CheckBoxUnChecked.tsx +25 -0
- package/src/components/Icons/Sources/Checked.tsx +23 -0
- package/src/components/Icons/Sources/ChevronClosed.tsx +40 -0
- package/src/components/Icons/Sources/ChevronLeft.tsx +28 -0
- package/src/components/Icons/Sources/ChevronOpen.tsx +38 -0
- package/src/components/Icons/Sources/Clear.tsx +34 -0
- package/src/components/Icons/Sources/Clipboard.tsx +15 -0
- package/src/components/Icons/Sources/Close.tsx +28 -0
- package/src/components/Icons/Sources/CloudSettings.tsx +34 -0
- package/src/components/Icons/Sources/Code.tsx +7 -0
- package/src/components/Icons/Sources/ColorChange.tsx +100 -0
- package/src/components/Icons/Sources/ContentNext.tsx +35 -0
- package/src/components/Icons/Sources/ContentPrev.tsx +35 -0
- package/src/components/Icons/Sources/Controls.tsx +99 -0
- package/src/components/Icons/Sources/Copy.tsx +44 -0
- package/src/components/Icons/Sources/Database.tsx +33 -0
- package/src/components/Icons/Sources/Delete.tsx +58 -0
- package/src/components/Icons/Sources/DicomTagBrowser.tsx +79 -0
- package/src/components/Icons/Sources/DisplayFillAndOutline.tsx +49 -0
- package/src/components/Icons/Sources/DisplayFillOnly.tsx +40 -0
- package/src/components/Icons/Sources/DisplayOutlineOnly.tsx +40 -0
- package/src/components/Icons/Sources/Download.tsx +75 -0
- package/src/components/Icons/Sources/Export.tsx +53 -0
- package/src/components/Icons/Sources/ExternalLink.tsx +26 -0
- package/src/components/Icons/Sources/EyeHidden.tsx +32 -0
- package/src/components/Icons/Sources/EyeVisible.tsx +28 -0
- package/src/components/Icons/Sources/FeedbackComplete.tsx +35 -0
- package/src/components/Icons/Sources/GearSettings.tsx +59 -0
- package/src/components/Icons/Sources/GroupLayers.tsx +33 -0
- package/src/components/Icons/Sources/Helpers.tsx +398 -0
- package/src/components/Icons/Sources/Hide.tsx +45 -0
- package/src/components/Icons/Sources/IconColorLUT.tsx +103 -0
- package/src/components/Icons/Sources/IconMPR.tsx +55 -0
- package/src/components/Icons/Sources/IconTransferring.tsx +25 -0
- package/src/components/Icons/Sources/IllustrationNotFound.tsx +102 -0
- package/src/components/Icons/Sources/Info.tsx +55 -0
- package/src/components/Icons/Sources/InfoLink.tsx +23 -0
- package/src/components/Icons/Sources/InfoSeries.tsx +52 -0
- package/src/components/Icons/Sources/InvestigationalUse.tsx +82 -0
- package/src/components/Icons/Sources/JumpToSlice.tsx +69 -0
- package/src/components/Icons/Sources/LaunchArrow.tsx +34 -0
- package/src/components/Icons/Sources/LaunchInfo.tsx +38 -0
- package/src/components/Icons/Sources/LayerBackground.tsx +28 -0
- package/src/components/Icons/Sources/LayerForeground.tsx +34 -0
- package/src/components/Icons/Sources/LayerSegmentation.tsx +20 -0
- package/src/components/Icons/Sources/Layout.tsx +433 -0
- package/src/components/Icons/Sources/Link.tsx +58 -0
- package/src/components/Icons/Sources/ListView.tsx +79 -0
- package/src/components/Icons/Sources/LoadingOHIFMark.tsx +21 -0
- package/src/components/Icons/Sources/LoadingSpinner.tsx +49 -0
- package/src/components/Icons/Sources/Lock.tsx +35 -0
- package/src/components/Icons/Sources/Magnifier.tsx +37 -0
- package/src/components/Icons/Sources/Minus.tsx +40 -0
- package/src/components/Icons/Sources/MissingIcon.tsx +6 -0
- package/src/components/Icons/Sources/More.tsx +53 -0
- package/src/components/Icons/Sources/MultiplePatients.tsx +76 -0
- package/src/components/Icons/Sources/NavigationPanelReveal.tsx +25 -0
- package/src/components/Icons/Sources/NotificationInfo.tsx +33 -0
- package/src/components/Icons/Sources/NotificationWarning.tsx +44 -0
- package/src/components/Icons/Sources/OHIFLogo.tsx +72 -0
- package/src/components/Icons/Sources/OHIFLogoColorDarkBackground.tsx +78 -0
- package/src/components/Icons/Sources/OHIFLogoHorizontal.tsx +139 -0
- package/src/components/Icons/Sources/Opacity.tsx +106 -0
- package/src/components/Icons/Sources/OrientationSwitch.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchA.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchC.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchR.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchS.tsx +41 -0
- package/src/components/Icons/Sources/PanelRight.tsx +29 -0
- package/src/components/Icons/Sources/Patient.tsx +58 -0
- package/src/components/Icons/Sources/PatientStudyList.tsx +62 -0
- package/src/components/Icons/Sources/Pause.tsx +26 -0
- package/src/components/Icons/Sources/Pencil.tsx +16 -0
- package/src/components/Icons/Sources/Pin.tsx +50 -0
- package/src/components/Icons/Sources/PinFill.tsx +51 -0
- package/src/components/Icons/Sources/Play.tsx +25 -0
- package/src/components/Icons/Sources/Plus.tsx +29 -0
- package/src/components/Icons/Sources/PowerOff.tsx +19 -0
- package/src/components/Icons/Sources/Redo.tsx +51 -0
- package/src/components/Icons/Sources/Refresh.tsx +42 -0
- package/src/components/Icons/Sources/Rename.tsx +50 -0
- package/src/components/Icons/Sources/Search.tsx +35 -0
- package/src/components/Icons/Sources/SegActions.tsx +594 -0
- package/src/components/Icons/Sources/Series.tsx +47 -0
- package/src/components/Icons/Sources/SeriesPlaceholder.tsx +40 -0
- package/src/components/Icons/Sources/Settings.tsx +105 -0
- package/src/components/Icons/Sources/SettingsStudyList.tsx +28 -0
- package/src/components/Icons/Sources/Show.tsx +67 -0
- package/src/components/Icons/Sources/SidePanelCloseLeft.tsx +75 -0
- package/src/components/Icons/Sources/SidePanelCloseRight.tsx +74 -0
- package/src/components/Icons/Sources/SocialGithub.tsx +39 -0
- package/src/components/Icons/Sources/Sorting.tsx +39 -0
- package/src/components/Icons/Sources/SortingAscending.tsx +28 -0
- package/src/components/Icons/Sources/SortingDescending.tsx +26 -0
- package/src/components/Icons/Sources/SortingNew.tsx +20 -0
- package/src/components/Icons/Sources/SortingNewAscending.tsx +35 -0
- package/src/components/Icons/Sources/SortingNewDescending.tsx +35 -0
- package/src/components/Icons/Sources/StatusAlert.tsx +36 -0
- package/src/components/Icons/Sources/StatusError.tsx +57 -0
- package/src/components/Icons/Sources/StatusLocked.tsx +35 -0
- package/src/components/Icons/Sources/StatusSuccess.tsx +45 -0
- package/src/components/Icons/Sources/StatusTracking.tsx +37 -0
- package/src/components/Icons/Sources/StatusUntracked.tsx +30 -0
- package/src/components/Icons/Sources/StatusWarning.tsx +58 -0
- package/src/components/Icons/Sources/Tab4D.tsx +54 -0
- package/src/components/Icons/Sources/TabContours.tsx +63 -0
- package/src/components/Icons/Sources/TabLinear.tsx +47 -0
- package/src/components/Icons/Sources/TabPatientInfo.tsx +33 -0
- package/src/components/Icons/Sources/TabRoiThreshold.tsx +38 -0
- package/src/components/Icons/Sources/TabSegmentation.tsx +38 -0
- package/src/components/Icons/Sources/TabStudies.tsx +62 -0
- package/src/components/Icons/Sources/Threshold.tsx +38 -0
- package/src/components/Icons/Sources/ThumbnailView.tsx +67 -0
- package/src/components/Icons/Sources/Tools.tsx +3659 -0
- package/src/components/Icons/Sources/Trash.tsx +17 -0
- package/src/components/Icons/Sources/Undo.tsx +51 -0
- package/src/components/Icons/Sources/Upload.tsx +29 -0
- package/src/components/Icons/Sources/ViewportViews.tsx +45 -0
- package/src/components/Icons/Sources/ViewportWindowLevel.tsx +58 -0
- package/src/components/Icons/Sources/WindowLevelAdvanced.tsx +30 -0
- package/src/components/Icons/index.ts +4 -0
- package/src/components/Icons/types.ts +3 -0
- package/src/components/Input/Input.tsx +25 -0
- package/src/components/Input/index.tsx +3 -0
- package/src/components/InputFilter/InputFilter.tsx +200 -0
- package/src/components/InputFilter/index.ts +2 -0
- package/src/components/InputMultiSelect/InputMultiSelect.tsx +370 -0
- package/src/components/InputMultiSelect/index.ts +1 -0
- package/src/components/InputNumber/InputNumber.tsx +439 -0
- package/src/components/InputNumber/index.ts +3 -0
- package/src/components/InvestigationalUseDialog/InvestigationalUseDialog.tsx +98 -0
- package/src/components/InvestigationalUseDialog/index.ts +3 -0
- package/src/components/Label/Label.tsx +24 -0
- package/src/components/Label/index.tsx +3 -0
- package/src/components/Labelling/LabellingFlow.tsx +92 -0
- package/src/components/Labelling/index.ts +2 -0
- package/src/components/LayoutSelector/LayoutSelector.tsx +345 -0
- package/src/components/LayoutSelector/index.ts +4 -0
- package/src/components/LineChart/LineChart.css +40 -0
- package/src/components/LineChart/LineChart.tsx +101 -0
- package/src/components/LineChart/d3LineChart/chart.ts +365 -0
- package/src/components/LineChart/d3LineChart/events.ts +149 -0
- package/src/components/LineChart/d3LineChart/index.ts +3 -0
- package/src/components/LineChart/d3LineChart/lineChart.ts +272 -0
- package/src/components/LineChart/index.ts +1 -0
- package/src/components/LoadingIndicatorProgress/LoadingIndicatorProgress.tsx +29 -0
- package/src/components/LoadingIndicatorProgress/index.ts +2 -0
- package/src/components/LoadingIndicatorTotalPercent/LoadingIndicatorTotalPercent.tsx +49 -0
- package/src/components/LoadingIndicatorTotalPercent/index.ts +2 -0
- package/src/components/MeasurementTable/MeasurementTable.tsx +144 -0
- package/src/components/MeasurementTable/index.js +3 -0
- package/src/components/Modal/Modal.tsx +44 -0
- package/src/components/NavBar/NavBar.tsx +32 -0
- package/src/components/NavBar/index.js +2 -0
- package/src/components/Numeric/Numeric.test.ts +124 -0
- package/src/components/Numeric/Numeric.tsx +576 -0
- package/src/components/Numeric/index.ts +3 -0
- package/src/components/OHIFDialogs/InputDialog.tsx +287 -0
- package/src/components/OHIFDialogs/PresetDialog.tsx +106 -0
- package/src/components/OHIFDialogs/index.ts +2 -0
- package/src/components/OHIFModals/AboutModal.tsx +114 -0
- package/src/components/OHIFModals/AppearanceModal.tsx +38 -0
- package/src/components/OHIFModals/ImageModal.tsx +251 -0
- package/src/components/OHIFModals/UserPreferencesModal.tsx +229 -0
- package/src/components/OHIFModals/index.ts +4 -0
- package/src/components/OHIFPanels/WindowLevel.tsx +162 -0
- package/src/components/OHIFPanels/WindowLevelHistogram.tsx +237 -0
- package/src/components/OHIFPanels/index.ts +3 -0
- package/src/components/OHIFPanels/types.ts +41 -0
- package/src/components/OHIFToolSettings/RowDoubleRange.tsx +67 -0
- package/src/components/OHIFToolSettings/RowInputRange.tsx +65 -0
- package/src/components/OHIFToolSettings/RowSegmentedControl.tsx +77 -0
- package/src/components/OHIFToolSettings/ToolSettings.tsx +253 -0
- package/src/components/OHIFToolSettings/index.ts +1 -0
- package/src/components/OHIFToolbox/ToolboxUI.tsx +104 -0
- package/src/components/OHIFToolbox/index.ts +1 -0
- package/src/components/Onboarding/Onboarding.css +48 -0
- package/src/components/Onboarding/Onboarding.tsx +58 -0
- package/src/components/Onboarding/index.ts +3 -0
- package/src/components/Onboarding/utilities.ts +91 -0
- package/src/components/PanelSection/PanelSection.tsx +70 -0
- package/src/components/PanelSection/index.ts +2 -0
- package/src/components/Popover/Popover.tsx +35 -0
- package/src/components/Popover/index.ts +3 -0
- package/src/components/ProgressDropdown/ProgressDiscreteBar.tsx +24 -0
- package/src/components/ProgressDropdown/ProgressDropdown.tsx +158 -0
- package/src/components/ProgressDropdown/ProgressItem.tsx +27 -0
- package/src/components/ProgressDropdown/ProgressItemDetail.tsx +89 -0
- package/src/components/ProgressDropdown/index.ts +1 -0
- package/src/components/ProgressDropdown/types.ts +9 -0
- package/src/components/ProgressLoadingBar/ProgressLoadingBar.css +26 -0
- package/src/components/ProgressLoadingBar/ProgressLoadingBar.tsx +32 -0
- package/src/components/ProgressLoadingBar/index.ts +2 -0
- package/src/components/Resizable/Resizable.tsx +43 -0
- package/src/components/Resizable/index.ts +3 -0
- package/src/components/ScrollArea/ScrollArea.tsx +127 -0
- package/src/components/ScrollArea/index.tsx +3 -0
- package/src/components/SegmentationTable/AddSegmentRow.tsx +78 -0
- package/src/components/SegmentationTable/AddSegmentationRow.tsx +56 -0
- package/src/components/SegmentationTable/SegmentStatistics.tsx +104 -0
- package/src/components/SegmentationTable/SegmentationCollapsed.tsx +211 -0
- package/src/components/SegmentationTable/SegmentationExpanded.tsx +173 -0
- package/src/components/SegmentationTable/SegmentationHeader.tsx +58 -0
- package/src/components/SegmentationTable/SegmentationLabel.tsx +27 -0
- package/src/components/SegmentationTable/SegmentationSegments.tsx +206 -0
- package/src/components/SegmentationTable/SegmentationTable.tsx +169 -0
- package/src/components/SegmentationTable/SegmentationTableConfig.tsx +194 -0
- package/src/components/SegmentationTable/contexts/SegmentStatisticsContext.tsx +45 -0
- package/src/components/SegmentationTable/contexts/SegmentationExpandedContext.tsx +45 -0
- package/src/components/SegmentationTable/contexts/SegmentationTableContext.tsx +148 -0
- package/src/components/SegmentationTable/contexts/index.ts +16 -0
- package/src/components/SegmentationTable/index.ts +27 -0
- package/src/components/Select/Select.tsx +167 -0
- package/src/components/Select/index.tsx +40 -0
- package/src/components/Separator/Separator.tsx +32 -0
- package/src/components/Separator/index.ts +3 -0
- package/src/components/Separator/index.tsx +3 -0
- package/src/components/SidePanel/SidePanel.tsx +479 -0
- package/src/components/SidePanel/index.ts +2 -0
- package/src/components/Slider/Slider.tsx +24 -0
- package/src/components/Slider/index.tsx +3 -0
- package/src/components/SmartScrollbar/SmartScrollbar.tsx +349 -0
- package/src/components/SmartScrollbar/SmartScrollbarEndpoints.tsx +82 -0
- package/src/components/SmartScrollbar/SmartScrollbarFill.tsx +54 -0
- package/src/components/SmartScrollbar/SmartScrollbarIndicator.tsx +59 -0
- package/src/components/SmartScrollbar/SmartScrollbarTrack.tsx +104 -0
- package/src/components/SmartScrollbar/defaultSmartScrollbarIndicatorConfig.tsx +48 -0
- package/src/components/SmartScrollbar/index.ts +11 -0
- package/src/components/SmartScrollbar/useByteArray.ts +146 -0
- package/src/components/SmartScrollbar/utils.test.ts +124 -0
- package/src/components/SmartScrollbar/utils.ts +168 -0
- package/src/components/Sonner/Sonner.tsx +31 -0
- package/src/components/Sonner/index.ts +4 -0
- package/src/components/StudyBrowser/StudyBrowser.tsx +89 -0
- package/src/components/StudyBrowser/index.ts +2 -0
- package/src/components/StudyBrowserSort/StudyBrowserSort.tsx +87 -0
- package/src/components/StudyBrowserSort/index.ts +3 -0
- package/src/components/StudyBrowserViewOptions/StudyBrowserViewOptions.tsx +50 -0
- package/src/components/StudyBrowserViewOptions/index.ts +3 -0
- package/src/components/StudyItem/StudyItem.tsx +100 -0
- package/src/components/StudyItem/index.ts +2 -0
- package/src/components/StudyList/columns/defaultColumns.tsx +258 -0
- package/src/components/StudyList/components/ActionCell.tsx +19 -0
- package/src/components/StudyList/components/Layout.tsx +206 -0
- package/src/components/StudyList/components/PreviewContainer.tsx +45 -0
- package/src/components/StudyList/components/PreviewContent.tsx +186 -0
- package/src/components/StudyList/components/PreviewHeader.tsx +5 -0
- package/src/components/StudyList/components/PreviewPatientSummary.tsx +224 -0
- package/src/components/StudyList/components/PreviewSeriesList.tsx +64 -0
- package/src/components/StudyList/components/PreviewToggleButton.tsx +69 -0
- package/src/components/StudyList/components/SettingsPopover.tsx +214 -0
- package/src/components/StudyList/components/Table.tsx +247 -0
- package/src/components/StudyList/components/WorkflowMenu.tsx +72 -0
- package/src/components/StudyList/components/WorkflowsProvider.tsx +169 -0
- package/src/components/StudyList/hooks/useDefaultWorkflow.ts +60 -0
- package/src/components/StudyList/index.ts +52 -0
- package/src/components/StudyList/types/types.ts +42 -0
- package/src/components/StudyList/utils/tokenizeModalities.ts +6 -0
- package/src/components/StudySummary/StudySummary.tsx +27 -0
- package/src/components/StudySummary/index.tsx +3 -0
- package/src/components/Switch/Switch.tsx +28 -0
- package/src/components/Switch/index.tsx +3 -0
- package/src/components/Table/Table.tsx +134 -0
- package/src/components/Table/index.ts +11 -0
- package/src/components/Tabs/Tabs.tsx +56 -0
- package/src/components/Tabs/index.ts +3 -0
- package/src/components/Tabs/index.tsx +3 -0
- package/src/components/ThemeWrapper/ThemeWrapper.tsx +5 -0
- package/src/components/ThemeWrapper/index.ts +1 -0
- package/src/components/Thumbnail/Thumbnail.test.ts +71 -0
- package/src/components/Thumbnail/Thumbnail.tsx +351 -0
- package/src/components/Thumbnail/index.ts +2 -0
- package/src/components/ThumbnailList/ThumbnailList.tsx +94 -0
- package/src/components/ThumbnailList/index.ts +2 -0
- package/src/components/Toggle/Toggle.tsx +45 -0
- package/src/components/Toggle/index.ts +3 -0
- package/src/components/Toggle/index.tsx +3 -0
- package/src/components/ToggleGroup/ToggleGroup.tsx +63 -0
- package/src/components/ToggleGroup/index.ts +3 -0
- package/src/components/ToolButton/ToolButton.tsx +134 -0
- package/src/components/ToolButton/ToolButtonList.tsx +243 -0
- package/src/components/ToolButton/index.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +34 -0
- package/src/components/Tooltip/index.ts +3 -0
- package/src/components/Viewport/ImageScrollbar.module.css +89 -0
- package/src/components/Viewport/ImageScrollbar.tsx +71 -0
- package/src/components/Viewport/PatientInfo.tsx +126 -0
- package/src/components/Viewport/ViewportActionArrows.tsx +36 -0
- package/src/components/Viewport/ViewportActionBar.tsx +107 -0
- package/src/components/Viewport/ViewportActionButton.tsx +25 -0
- package/src/components/Viewport/ViewportActionCorners.tsx +171 -0
- package/src/components/Viewport/ViewportGrid.tsx +24 -0
- package/src/components/Viewport/ViewportOverlay.css +32 -0
- package/src/components/Viewport/ViewportOverlay.tsx +54 -0
- package/src/components/Viewport/ViewportPane.tsx +82 -0
- package/src/components/Viewport/index.ts +9 -0
- package/src/components/ViewportDialog/ViewportDialog.tsx +128 -0
- package/src/components/ViewportDialog/index.ts +2 -0
- package/src/components/index.ts +330 -0
- package/src/contextProviders/ActiveThemeProvider.tsx +204 -0
- package/src/contextProviders/CineProvider.tsx +98 -0
- package/src/contextProviders/DialogProvider.tsx +103 -0
- package/src/contextProviders/DragAndDropProvider.tsx +37 -0
- package/src/contextProviders/IconPresentationProvider.tsx +88 -0
- package/src/contextProviders/ImageViewerProvider.tsx +15 -0
- package/src/contextProviders/ManagedDialog.tsx +176 -0
- package/src/contextProviders/ModalProvider.tsx +102 -0
- package/src/contextProviders/NotificationProvider.tsx +246 -0
- package/src/contextProviders/UserAuthenticationProvider.tsx +118 -0
- package/src/contextProviders/ViewportDialogProvider.tsx +42 -0
- package/src/contextProviders/ViewportGridProvider.tsx +556 -0
- package/src/contextProviders/index.ts +26 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useDynamicMaxHeight.ts +105 -0
- package/src/hooks/useSessionStorage.test.js +103 -0
- package/src/hooks/useSessionStorage.tsx +71 -0
- package/src/index.ts +7 -0
- package/src/lib/utils.ts +6 -0
- package/src/tailwind.css +266 -0
- package/src/themes/arctic.json +31 -0
- package/src/themes/deep.json +31 -0
- package/src/themes/index.ts +16 -0
- package/src/themes/midnight.json +31 -0
- package/src/themes/orchid.json +31 -0
- package/src/themes/slate.json +31 -0
- package/src/themes/themes.css +206 -0
- package/src/themes/verdant.json +31 -0
- package/src/types/ActionCorners.ts +18 -0
- package/src/types/AppTypes.ts +24 -0
- package/src/types/ContextMenuItem.ts +9 -0
- package/src/types/Predicate.ts +1 -0
- package/src/types/ThumbnailType.ts +3 -0
- package/src/types/ViewportActionCornersTypes.ts +13 -0
- package/src/types/global.d.ts +4 -0
- package/src/types/index.ts +21 -0
- package/src/utils/formatDICOMDate.test.ts +61 -0
- package/src/utils/formatDICOMDate.ts +65 -0
- package/src/utils/formatDICOMTime.test.ts +62 -0
- package/src/utils/formatDICOMTime.ts +49 -0
- package/src/utils/getToggledClassName.tsx +5 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/parseStudyDateTimestamp.test.ts +47 -0
- package/src/utils/parseStudyDateTimestamp.ts +27 -0
- package/src/utils/roundNumber.ts +43 -0
- package/tailwind.config.js +120 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Input } from '../Input/Input';
|
|
4
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../Select/Select';
|
|
5
|
+
import { Switch } from '../Switch/Switch';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
|
|
8
|
+
interface ImageModalProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Main ImageModal container. By default, we do not force any
|
|
15
|
+
* layout here. We'll use a "Body" subcomponent for the main area
|
|
16
|
+
* that sets up a flex row with a 70/30 split.
|
|
17
|
+
*/
|
|
18
|
+
export function ImageModal({ children, className }: ImageModalProps) {
|
|
19
|
+
return <div className={cn(className)}>{children}</div>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* -------------------------------------------------------------------------- */
|
|
23
|
+
/* Body subcomponent */
|
|
24
|
+
|
|
25
|
+
interface ImageBodyProps {
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
function ImageBody({ children, className }: ImageBodyProps) {
|
|
30
|
+
return <div className={cn('flex flex-col sm:flex-row', className)}>{children}</div>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* -------------------------------------------------------------------------- */
|
|
34
|
+
/* ImageVisual subcomponent */
|
|
35
|
+
|
|
36
|
+
interface ImageVisualProps {
|
|
37
|
+
className?: string;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
function ImageVisual({ children, className }: ImageVisualProps) {
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
className={cn(
|
|
44
|
+
'flex-1 items-center justify-center rounded-2xl bg-background/80 p-4 sm:flex-[7]',
|
|
45
|
+
'flex', // ensure the container is a flex box
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
>
|
|
49
|
+
<div className="h-[512px] w-[512px] overflow-auto">{children}</div>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* -------------------------------------------------------------------------- */
|
|
55
|
+
/* ImageOptions subcomponent */
|
|
56
|
+
|
|
57
|
+
interface ImageOptionsProps {
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
function ImageOptions({ children, className }: ImageOptionsProps) {
|
|
62
|
+
return <div className={cn('flex-1 space-y-5 p-4 sm:flex-[3]', className)}>{children}</div>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* -------------------------------------------------------------------------- */
|
|
66
|
+
/* Filename subcomponent */
|
|
67
|
+
|
|
68
|
+
interface FilenameProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children'> {
|
|
69
|
+
children: React.ReactNode;
|
|
70
|
+
className?: string;
|
|
71
|
+
/** Handler is optional. If not provided, default to a no‐op. */
|
|
72
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function Filename({ children, className, value, onChange, ...props }: FilenameProps) {
|
|
76
|
+
return (
|
|
77
|
+
<div className={cn('text-foreground space-y-1', className)}>
|
|
78
|
+
<label className="block text-base">{children}</label>
|
|
79
|
+
<Input
|
|
80
|
+
{...props}
|
|
81
|
+
className={cn('w-full', className)}
|
|
82
|
+
value={value}
|
|
83
|
+
onChange={onChange ?? (() => {})}
|
|
84
|
+
/>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* -------------------------------------------------------------------------- */
|
|
90
|
+
/* Filetype subcomponent */
|
|
91
|
+
|
|
92
|
+
interface FiletypeProps {
|
|
93
|
+
selected: string;
|
|
94
|
+
/** Handler is optional. If not provided, we do nothing. */
|
|
95
|
+
onSelect?: (val: string) => void;
|
|
96
|
+
className?: string;
|
|
97
|
+
/** Array of file type options */
|
|
98
|
+
options?: Array<{ value: string; label: string }>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function Filetype({ selected, onSelect, className, options = [] }: FiletypeProps) {
|
|
102
|
+
const defaultOptions = [
|
|
103
|
+
{ value: 'jpg', label: 'JPG' },
|
|
104
|
+
{ value: 'png', label: 'PNG' },
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
const fileTypeOptions = options.length ? options : defaultOptions;
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Select
|
|
111
|
+
value={selected}
|
|
112
|
+
onValueChange={val => onSelect?.(val)}
|
|
113
|
+
>
|
|
114
|
+
<SelectTrigger
|
|
115
|
+
aria-label="File type"
|
|
116
|
+
className={cn('w-[5.5rem] sm:w-24', className)}
|
|
117
|
+
>
|
|
118
|
+
<SelectValue />
|
|
119
|
+
</SelectTrigger>
|
|
120
|
+
<SelectContent>
|
|
121
|
+
{fileTypeOptions.map(option => (
|
|
122
|
+
<SelectItem
|
|
123
|
+
key={option.value}
|
|
124
|
+
value={option.value}
|
|
125
|
+
>
|
|
126
|
+
{option.label}
|
|
127
|
+
</SelectItem>
|
|
128
|
+
))}
|
|
129
|
+
</SelectContent>
|
|
130
|
+
</Select>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* -------------------------------------------------------------------------- */
|
|
135
|
+
/* ImageSize subcomponent */
|
|
136
|
+
|
|
137
|
+
interface ImageSizeProps {
|
|
138
|
+
children: React.ReactNode;
|
|
139
|
+
width: string;
|
|
140
|
+
height: string;
|
|
141
|
+
/** Handlers optional. If not provided, default no‐op. */
|
|
142
|
+
onWidthChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
143
|
+
onHeightChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
144
|
+
className?: string;
|
|
145
|
+
maxWidth?: string;
|
|
146
|
+
maxHeight?: string;
|
|
147
|
+
/** Optional translation namespace. Defaults to 'CaptureViewportModal'. */
|
|
148
|
+
translationNamespace?: string;
|
|
149
|
+
/** Optional labels/placeholders to override translations */
|
|
150
|
+
widthLabel?: string;
|
|
151
|
+
heightLabel?: string;
|
|
152
|
+
widthPlaceholder?: string;
|
|
153
|
+
heightPlaceholder?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function ImageSize({
|
|
157
|
+
children,
|
|
158
|
+
width,
|
|
159
|
+
height,
|
|
160
|
+
onWidthChange,
|
|
161
|
+
onHeightChange,
|
|
162
|
+
className,
|
|
163
|
+
maxWidth,
|
|
164
|
+
maxHeight,
|
|
165
|
+
translationNamespace = 'CaptureViewportModal',
|
|
166
|
+
widthLabel,
|
|
167
|
+
heightLabel,
|
|
168
|
+
widthPlaceholder,
|
|
169
|
+
heightPlaceholder,
|
|
170
|
+
}: ImageSizeProps) {
|
|
171
|
+
const { t } = useTranslation(translationNamespace);
|
|
172
|
+
|
|
173
|
+
// Use translations as defaults, but allow props to override
|
|
174
|
+
const finalWidthLabel = widthLabel ?? t('Width', { defaultValue: 'Width' });
|
|
175
|
+
const finalHeightLabel = heightLabel ?? t('Height', { defaultValue: 'Height' });
|
|
176
|
+
const finalWidthPlaceholder = widthPlaceholder ?? t('Width', { defaultValue: 'Width' });
|
|
177
|
+
const finalHeightPlaceholder = heightPlaceholder ?? t('Height', { defaultValue: 'Height' });
|
|
178
|
+
return (
|
|
179
|
+
<div className={cn('text-foreground space-y-1', className)}>
|
|
180
|
+
<label className="block text-base">{children}</label>
|
|
181
|
+
|
|
182
|
+
{/* Flex container for width/height inputs */}
|
|
183
|
+
<div className="flex items-center space-x-4">
|
|
184
|
+
{/* Width group */}
|
|
185
|
+
<div className="flex items-center space-x-2">
|
|
186
|
+
<span className="text-foreground text-base">{finalWidthLabel}</span>
|
|
187
|
+
<Input
|
|
188
|
+
value={width}
|
|
189
|
+
onChange={onWidthChange ?? (() => {})}
|
|
190
|
+
placeholder={finalWidthPlaceholder}
|
|
191
|
+
className="w-20"
|
|
192
|
+
max={maxWidth}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
{/* Height/Length group */}
|
|
197
|
+
<div className="text-foreground flex items-center space-x-2 text-base">
|
|
198
|
+
<span className="text-foreground text-base">{finalHeightLabel}</span>
|
|
199
|
+
<Input
|
|
200
|
+
value={height}
|
|
201
|
+
onChange={onHeightChange ?? (() => {})}
|
|
202
|
+
placeholder={finalHeightPlaceholder}
|
|
203
|
+
className="w-20"
|
|
204
|
+
max={maxHeight}
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/* -------------------------------------------------------------------------- */
|
|
213
|
+
/* SwitchOption subcomponent */
|
|
214
|
+
|
|
215
|
+
interface SwitchOptionProps {
|
|
216
|
+
children: React.ReactNode;
|
|
217
|
+
checked?: boolean;
|
|
218
|
+
defaultChecked?: boolean;
|
|
219
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
220
|
+
className?: string;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function SwitchOption({
|
|
224
|
+
children,
|
|
225
|
+
checked,
|
|
226
|
+
defaultChecked,
|
|
227
|
+
onCheckedChange,
|
|
228
|
+
className,
|
|
229
|
+
}: SwitchOptionProps) {
|
|
230
|
+
return (
|
|
231
|
+
<div className={cn('text-foreground flex items-center space-x-2', className)}>
|
|
232
|
+
<Switch
|
|
233
|
+
checked={checked}
|
|
234
|
+
defaultChecked={defaultChecked}
|
|
235
|
+
onCheckedChange={val => onCheckedChange?.(val)}
|
|
236
|
+
/>
|
|
237
|
+
<span className="text-base">{children}</span>
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* -------------------------------------------------------------------------- */
|
|
243
|
+
/* Attach subcomponents onto the main ImageModal function. */
|
|
244
|
+
|
|
245
|
+
ImageModal.Body = ImageBody;
|
|
246
|
+
ImageModal.ImageVisual = ImageVisual;
|
|
247
|
+
ImageModal.ImageOptions = ImageOptions;
|
|
248
|
+
ImageModal.Filename = Filename;
|
|
249
|
+
ImageModal.Filetype = Filetype;
|
|
250
|
+
ImageModal.ImageSize = ImageSize;
|
|
251
|
+
ImageModal.SwitchOption = SwitchOption;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TFunction } from 'i18next';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Label } from '../Label';
|
|
5
|
+
import { Input } from '../Input';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
|
|
8
|
+
const HOTKEY_TOKEN_TRANSLATIONS: Record<
|
|
9
|
+
string,
|
|
10
|
+
{
|
|
11
|
+
i18nKey: string;
|
|
12
|
+
defaultValue: string;
|
|
13
|
+
}
|
|
14
|
+
> = {
|
|
15
|
+
ctrl: { i18nKey: 'HotkeyKeys.ctrl', defaultValue: 'Ctrl' },
|
|
16
|
+
control: { i18nKey: 'HotkeyKeys.ctrl', defaultValue: 'Ctrl' },
|
|
17
|
+
shift: { i18nKey: 'HotkeyKeys.shift', defaultValue: 'Shift' },
|
|
18
|
+
alt: { i18nKey: 'HotkeyKeys.alt', defaultValue: 'Alt' },
|
|
19
|
+
option: { i18nKey: 'HotkeyKeys.option', defaultValue: 'Option' },
|
|
20
|
+
meta: { i18nKey: 'HotkeyKeys.meta', defaultValue: 'Cmd' },
|
|
21
|
+
command: { i18nKey: 'HotkeyKeys.meta', defaultValue: 'Cmd' },
|
|
22
|
+
cmd: { i18nKey: 'HotkeyKeys.meta', defaultValue: 'Cmd' },
|
|
23
|
+
enter: { i18nKey: 'HotkeyKeys.enter', defaultValue: 'Enter' },
|
|
24
|
+
return: { i18nKey: 'HotkeyKeys.enter', defaultValue: 'Enter' },
|
|
25
|
+
esc: { i18nKey: 'HotkeyKeys.esc', defaultValue: 'Esc' },
|
|
26
|
+
escape: { i18nKey: 'HotkeyKeys.esc', defaultValue: 'Esc' },
|
|
27
|
+
space: { i18nKey: 'HotkeyKeys.space', defaultValue: 'Space' },
|
|
28
|
+
spacebar: { i18nKey: 'HotkeyKeys.space', defaultValue: 'Space' },
|
|
29
|
+
tab: { i18nKey: 'HotkeyKeys.tab', defaultValue: 'Tab' },
|
|
30
|
+
backspace: { i18nKey: 'HotkeyKeys.backspace', defaultValue: 'Backspace' },
|
|
31
|
+
delete: { i18nKey: 'HotkeyKeys.delete', defaultValue: 'Delete' },
|
|
32
|
+
del: { i18nKey: 'HotkeyKeys.delete', defaultValue: 'Delete' },
|
|
33
|
+
insert: { i18nKey: 'HotkeyKeys.insert', defaultValue: 'Insert' },
|
|
34
|
+
ins: { i18nKey: 'HotkeyKeys.insert', defaultValue: 'Insert' },
|
|
35
|
+
home: { i18nKey: 'HotkeyKeys.home', defaultValue: 'Home' },
|
|
36
|
+
end: { i18nKey: 'HotkeyKeys.end', defaultValue: 'End' },
|
|
37
|
+
pageup: { i18nKey: 'HotkeyKeys.pageup', defaultValue: 'Page Up' },
|
|
38
|
+
pagedown: { i18nKey: 'HotkeyKeys.pagedown', defaultValue: 'Page Down' },
|
|
39
|
+
up: { i18nKey: 'HotkeyKeys.up', defaultValue: 'Up Arrow' },
|
|
40
|
+
down: { i18nKey: 'HotkeyKeys.down', defaultValue: 'Down Arrow' },
|
|
41
|
+
left: { i18nKey: 'HotkeyKeys.left', defaultValue: 'Left Arrow' },
|
|
42
|
+
right: { i18nKey: 'HotkeyKeys.right', defaultValue: 'Right Arrow' },
|
|
43
|
+
capslock: { i18nKey: 'HotkeyKeys.capslock', defaultValue: 'Caps Lock' },
|
|
44
|
+
plus: { i18nKey: 'HotkeyKeys.plus', defaultValue: 'Plus' },
|
|
45
|
+
minus: { i18nKey: 'HotkeyKeys.minus', defaultValue: 'Minus' },
|
|
46
|
+
comma: { i18nKey: 'HotkeyKeys.comma', defaultValue: 'Comma' },
|
|
47
|
+
period: { i18nKey: 'HotkeyKeys.period', defaultValue: 'Period' },
|
|
48
|
+
slash: { i18nKey: 'HotkeyKeys.slash', defaultValue: 'Slash' },
|
|
49
|
+
backslash: { i18nKey: 'HotkeyKeys.backslash', defaultValue: 'Backslash' },
|
|
50
|
+
semicolon: { i18nKey: 'HotkeyKeys.semicolon', defaultValue: 'Semicolon' },
|
|
51
|
+
quote: { i18nKey: 'HotkeyKeys.quote', defaultValue: 'Quote' },
|
|
52
|
+
apostrophe: { i18nKey: 'HotkeyKeys.quote', defaultValue: 'Quote' },
|
|
53
|
+
backquote: { i18nKey: 'HotkeyKeys.backquote', defaultValue: 'Backtick' },
|
|
54
|
+
tilde: { i18nKey: 'HotkeyKeys.backquote', defaultValue: 'Backtick' },
|
|
55
|
+
bracketleft: { i18nKey: 'HotkeyKeys.bracketleft', defaultValue: 'Left Bracket' },
|
|
56
|
+
bracketright: { i18nKey: 'HotkeyKeys.bracketright', defaultValue: 'Right Bracket' },
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const formatFallbackToken = (token: string) => {
|
|
60
|
+
if (!token) {
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (/^f\d{1,2}$/i.test(token)) {
|
|
65
|
+
return token.toUpperCase();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (token.length === 1) {
|
|
69
|
+
return token.toUpperCase();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return token.charAt(0).toUpperCase() + token.slice(1);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const normalizeHotkeyValue = (value?: string | string[]) => {
|
|
76
|
+
if (!value) {
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (Array.isArray(value)) {
|
|
81
|
+
return value.join('+');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return value;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const translateHotkeyValue = (value: string | string[] | undefined, t: TFunction) => {
|
|
88
|
+
const normalizedValue = normalizeHotkeyValue(value);
|
|
89
|
+
if (!normalizedValue) {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return normalizedValue
|
|
94
|
+
.split('+')
|
|
95
|
+
.map(rawToken => {
|
|
96
|
+
const trimmed = rawToken.trim();
|
|
97
|
+
if (!trimmed) {
|
|
98
|
+
return '';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const lower = trimmed.toLowerCase();
|
|
102
|
+
const config = HOTKEY_TOKEN_TRANSLATIONS[lower];
|
|
103
|
+
if (config) {
|
|
104
|
+
return t(config.i18nKey, { defaultValue: config.defaultValue });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return formatFallbackToken(trimmed);
|
|
108
|
+
})
|
|
109
|
+
.join('+');
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
interface UserPreferencesModalProps {
|
|
113
|
+
children: React.ReactNode;
|
|
114
|
+
className?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function UserPreferencesModal({ children, className }: UserPreferencesModalProps) {
|
|
118
|
+
return (
|
|
119
|
+
<div className={cn('flex max-h-[80vh] w-full max-w-4xl flex-col overflow-hidden', className)}>
|
|
120
|
+
{children}
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Body
|
|
126
|
+
* Automatically wraps content in a scrollable area.
|
|
127
|
+
*/
|
|
128
|
+
interface BodyProps {
|
|
129
|
+
children: React.ReactNode;
|
|
130
|
+
className?: string;
|
|
131
|
+
}
|
|
132
|
+
function Body({ children, className }: BodyProps) {
|
|
133
|
+
return (
|
|
134
|
+
<div className={cn('flex-1 overflow-y-auto', className)}>
|
|
135
|
+
<div className={cn('mt-1 mb-4 flex flex-col space-y-4', className)}>{children}</div>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Subheading
|
|
141
|
+
* Section labels
|
|
142
|
+
*/
|
|
143
|
+
interface SubHeadingProps {
|
|
144
|
+
children: React.ReactNode;
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
function SubHeading({ children, className }: SubHeadingProps) {
|
|
148
|
+
return <span className={cn('text-muted-foreground text-lg', className)}>{children}</span>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** Responsive 3-column grid for hotkeys, etc. */
|
|
152
|
+
interface HotkeysGridProps {
|
|
153
|
+
children: React.ReactNode;
|
|
154
|
+
className?: string;
|
|
155
|
+
}
|
|
156
|
+
function HotkeysGrid({ children, className }: HotkeysGridProps) {
|
|
157
|
+
return (
|
|
158
|
+
<div className={cn('grid grid-cols-1 gap-3 gap-x-16 md:grid-cols-2 lg:grid-cols-3', className)}>
|
|
159
|
+
{children}
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** A single hotkey row: label + input */
|
|
165
|
+
interface HotkeyProps {
|
|
166
|
+
label: string;
|
|
167
|
+
placeholder?: string;
|
|
168
|
+
className?: string;
|
|
169
|
+
value?: string;
|
|
170
|
+
onChange?: (value: string) => void;
|
|
171
|
+
hotkeys?: {
|
|
172
|
+
record: (callback: (sequence: string[]) => void) => void;
|
|
173
|
+
pause: () => void;
|
|
174
|
+
unpause: () => void;
|
|
175
|
+
startRecording: () => void;
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function Hotkey({ label, placeholder, className, value, onChange, hotkeys }: HotkeyProps) {
|
|
180
|
+
const [isRecording, setIsRecording] = React.useState(false);
|
|
181
|
+
const { t } = useTranslation('UserPreferencesModal');
|
|
182
|
+
const translatedValue = translateHotkeyValue(value, t);
|
|
183
|
+
const translatedPlaceholder = translateHotkeyValue(placeholder, t);
|
|
184
|
+
|
|
185
|
+
const onInputKeyDown = (event: React.KeyboardEvent) => {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
hotkeys?.record((sequence: string[]) => {
|
|
188
|
+
const keys = sequence.join('+');
|
|
189
|
+
hotkeys?.unpause();
|
|
190
|
+
setIsRecording(false);
|
|
191
|
+
onChange?.(keys);
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const onFocus = () => {
|
|
196
|
+
setIsRecording(true);
|
|
197
|
+
hotkeys?.pause();
|
|
198
|
+
hotkeys?.startRecording();
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const onBlur = () => {
|
|
202
|
+
setIsRecording(false);
|
|
203
|
+
hotkeys?.unpause();
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<div className={cn('flex items-start justify-between gap-2', className)}>
|
|
208
|
+
<Label className="flex-1 whitespace-normal break-words text-sm">{label}</Label>
|
|
209
|
+
<Input
|
|
210
|
+
className={cn(
|
|
211
|
+
'w-16 text-center transition-colors',
|
|
212
|
+
isRecording && 'bg-accent text-accent-foreground caret-accent-foreground'
|
|
213
|
+
)}
|
|
214
|
+
placeholder={isRecording ? t('Press keys') : translatedPlaceholder || ''}
|
|
215
|
+
value={isRecording ? normalizeHotkeyValue(value) : translatedValue}
|
|
216
|
+
onKeyDown={onInputKeyDown}
|
|
217
|
+
onFocus={onFocus}
|
|
218
|
+
onBlur={onBlur}
|
|
219
|
+
readOnly={!isRecording}
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Attach subcomponents as static properties for a nicer API */
|
|
226
|
+
UserPreferencesModal.Body = Body;
|
|
227
|
+
UserPreferencesModal.HotkeysGrid = HotkeysGrid;
|
|
228
|
+
UserPreferencesModal.Hotkey = Hotkey;
|
|
229
|
+
UserPreferencesModal.SubHeading = SubHeading;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
2
|
+
import { Numeric } from '../Numeric/Numeric';
|
|
3
|
+
import WindowLevelHistogram from './WindowLevelHistogram';
|
|
4
|
+
import { VOI, VOIRange, Histogram, Colormap } from './types';
|
|
5
|
+
|
|
6
|
+
interface WindowLevelProps {
|
|
7
|
+
title?: string;
|
|
8
|
+
step?: number;
|
|
9
|
+
histogram: Histogram;
|
|
10
|
+
voi: VOI;
|
|
11
|
+
opacity?: number;
|
|
12
|
+
showOpacitySlider?: boolean;
|
|
13
|
+
colormap?: Colormap;
|
|
14
|
+
style?: 'polygon' | 'bars';
|
|
15
|
+
fillColor?: string;
|
|
16
|
+
lineColor?: string;
|
|
17
|
+
containerClassName?: string;
|
|
18
|
+
onVOIChange?: (voi: VOI) => void;
|
|
19
|
+
onOpacityChange?: (opacity: number) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const convertVOItoVOIRange = (voi: VOI): VOIRange => {
|
|
23
|
+
return {
|
|
24
|
+
min: voi.windowCenter - voi.windowWidth / 2,
|
|
25
|
+
max: voi.windowCenter + voi.windowWidth / 2,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const WindowLevel = ({
|
|
30
|
+
title,
|
|
31
|
+
step = 1,
|
|
32
|
+
histogram,
|
|
33
|
+
voi: voiProp,
|
|
34
|
+
opacity: opacityProp = 1,
|
|
35
|
+
showOpacitySlider = false,
|
|
36
|
+
colormap,
|
|
37
|
+
style = 'polygon',
|
|
38
|
+
fillColor = '#3f3f3f',
|
|
39
|
+
lineColor = '#707070',
|
|
40
|
+
containerClassName,
|
|
41
|
+
onVOIChange,
|
|
42
|
+
onOpacityChange,
|
|
43
|
+
}: WindowLevelProps) => {
|
|
44
|
+
// Define range from histogram
|
|
45
|
+
const range = useMemo(
|
|
46
|
+
() => ({
|
|
47
|
+
min: histogram.range.min,
|
|
48
|
+
max: histogram.range.max,
|
|
49
|
+
}),
|
|
50
|
+
[histogram]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// Initialize VOI range from props
|
|
54
|
+
const [voiRange, setVOIRange] = useState<VOIRange>(
|
|
55
|
+
voiProp
|
|
56
|
+
? convertVOItoVOIRange(voiProp)
|
|
57
|
+
: {
|
|
58
|
+
min: range.min,
|
|
59
|
+
max: range.max,
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// Update VOI range when props change
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (voiProp) {
|
|
66
|
+
setVOIRange(convertVOItoVOIRange(voiProp));
|
|
67
|
+
}
|
|
68
|
+
}, [voiProp]);
|
|
69
|
+
|
|
70
|
+
// Handle VOI range changes (from slider)
|
|
71
|
+
const handleVOIRangeChange = (newValues: [number, number]) => {
|
|
72
|
+
const [min, max] = newValues;
|
|
73
|
+
if (min === voiRange.min && max === voiRange.max) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const windowWidth = max - min;
|
|
78
|
+
const windowCenter = min + windowWidth / 2;
|
|
79
|
+
|
|
80
|
+
setVOIRange({
|
|
81
|
+
min,
|
|
82
|
+
max,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (onVOIChange) {
|
|
86
|
+
onVOIChange({ windowWidth, windowCenter });
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Handle opacity changes
|
|
91
|
+
const handleOpacityChange = (value: number) => {
|
|
92
|
+
if (onOpacityChange) {
|
|
93
|
+
onOpacityChange(value);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<div className={`text-foreground max-w-sm p-1 ${containerClassName || ''}`}>
|
|
99
|
+
{title && <div className="text-muted-foreground mb-1 text-sm">{title}</div>}
|
|
100
|
+
|
|
101
|
+
<div className="space-y-2 px-2">
|
|
102
|
+
{/* Range Labels */}
|
|
103
|
+
<div className="text-muted-foreground flex h-4 text-sm">
|
|
104
|
+
<div className="relative h-fit grow">
|
|
105
|
+
<span className="absolute left-0 bottom-px leading-3">{range.min}</span>
|
|
106
|
+
</div>
|
|
107
|
+
<div className="relative h-fit grow text-right">
|
|
108
|
+
<span className="absolute right-0 bottom-px leading-3">{range.max}</span>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
{/* Histogram Visualization */}
|
|
113
|
+
<div className="bg-foreground h-11">
|
|
114
|
+
<WindowLevelHistogram
|
|
115
|
+
range={range}
|
|
116
|
+
voiRange={voiRange}
|
|
117
|
+
histogram={histogram}
|
|
118
|
+
colormap={colormap}
|
|
119
|
+
style={style}
|
|
120
|
+
fillColor={fillColor}
|
|
121
|
+
lineColor={lineColor}
|
|
122
|
+
/>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
{/* Window Level Range Slider */}
|
|
126
|
+
<Numeric.Container
|
|
127
|
+
mode="doubleRange"
|
|
128
|
+
min={range.min}
|
|
129
|
+
max={range.max}
|
|
130
|
+
values={[voiRange.min, voiRange.max]}
|
|
131
|
+
step={step}
|
|
132
|
+
onChange={values => handleVOIRangeChange(values as [number, number])}
|
|
133
|
+
>
|
|
134
|
+
<Numeric.DoubleRange showNumberInputs />
|
|
135
|
+
</Numeric.Container>
|
|
136
|
+
|
|
137
|
+
{/* Opacity Slider (optional) */}
|
|
138
|
+
{showOpacitySlider && (
|
|
139
|
+
<div className="mt-2">
|
|
140
|
+
<div className="flex items-center justify-between gap-2 text-base">
|
|
141
|
+
<div className="text-foreground text-xs">Opacity</div>
|
|
142
|
+
<div className="flex-1">
|
|
143
|
+
<Numeric.Container
|
|
144
|
+
mode="singleRange"
|
|
145
|
+
min={0}
|
|
146
|
+
max={1}
|
|
147
|
+
step={0.05}
|
|
148
|
+
value={opacityProp}
|
|
149
|
+
onChange={value => handleOpacityChange(value as number)}
|
|
150
|
+
>
|
|
151
|
+
<Numeric.SingleRange showNumberInput />
|
|
152
|
+
</Numeric.Container>
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
)}
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export default WindowLevel;
|