@ohif/ui-next 3.14.0-beta.12 → 3.14.0-beta.121
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,128 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Icons } from '../Icons';
|
|
6
|
+
|
|
7
|
+
type NotificationAction = {
|
|
8
|
+
id: string;
|
|
9
|
+
text: string;
|
|
10
|
+
value: any;
|
|
11
|
+
type?: 'primary' | 'secondary';
|
|
12
|
+
size?: 'sm' | 'md';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ViewportDialogProps = {
|
|
16
|
+
id: string;
|
|
17
|
+
type: 'error' | 'warning' | 'info' | 'success';
|
|
18
|
+
message: string | React.ReactNode;
|
|
19
|
+
actions: NotificationAction[];
|
|
20
|
+
onSubmit: (e: any) => void;
|
|
21
|
+
onOutsideClick?: () => void;
|
|
22
|
+
onKeyPress?: (e: React.KeyboardEvent) => void;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ViewportDialog: React.FC<ViewportDialogProps> = ({
|
|
26
|
+
id,
|
|
27
|
+
type = 'info',
|
|
28
|
+
message,
|
|
29
|
+
actions,
|
|
30
|
+
onSubmit,
|
|
31
|
+
onOutsideClick = () => {},
|
|
32
|
+
onKeyPress,
|
|
33
|
+
}) => {
|
|
34
|
+
const notificationRef = useRef(null);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const notificationElement = notificationRef.current;
|
|
38
|
+
const handleClick = function (event) {
|
|
39
|
+
const isClickInside = notificationElement.contains(event.target);
|
|
40
|
+
|
|
41
|
+
if (!isClickInside) {
|
|
42
|
+
onOutsideClick();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Both a mouse down and up listeners are desired so as to avoid missing events
|
|
47
|
+
// from elements that have pointer-events:none (e.g. the active viewport).
|
|
48
|
+
document.addEventListener('mousedown', handleClick);
|
|
49
|
+
document.addEventListener('mouseup', handleClick);
|
|
50
|
+
|
|
51
|
+
return () => {
|
|
52
|
+
document.removeEventListener('mousedown', handleClick);
|
|
53
|
+
document.removeEventListener('mouseup', handleClick);
|
|
54
|
+
};
|
|
55
|
+
}, [onOutsideClick]);
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
notificationRef.current.focus();
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
const iconsByType = {
|
|
62
|
+
error: {
|
|
63
|
+
icon: 'info',
|
|
64
|
+
color: 'text-red-700',
|
|
65
|
+
},
|
|
66
|
+
warning: {
|
|
67
|
+
icon: 'notificationwarning-diamond',
|
|
68
|
+
color: 'text-yellow-500',
|
|
69
|
+
},
|
|
70
|
+
info: {
|
|
71
|
+
icon: 'notifications-info',
|
|
72
|
+
color: 'text-primary/60',
|
|
73
|
+
},
|
|
74
|
+
success: {
|
|
75
|
+
icon: 'info',
|
|
76
|
+
color: 'text-green-500',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getIconData = () => {
|
|
81
|
+
return (
|
|
82
|
+
iconsByType[type] || {
|
|
83
|
+
icon: '',
|
|
84
|
+
color: '',
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const { icon, color } = getIconData();
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<div
|
|
93
|
+
ref={notificationRef}
|
|
94
|
+
className="border-input bg-muted mx-1.5 mt-2 flex flex-col rounded-md border p-2 outline-none"
|
|
95
|
+
data-cy={id}
|
|
96
|
+
onKeyDown={onKeyPress}
|
|
97
|
+
tabIndex={0}
|
|
98
|
+
>
|
|
99
|
+
<div className="flex grow items-center">
|
|
100
|
+
<Icons.ByName
|
|
101
|
+
name={icon}
|
|
102
|
+
className={classnames('h-5 w-5', color)}
|
|
103
|
+
/>
|
|
104
|
+
<span className="text-foreground ml-2 text-base">{message}</span>
|
|
105
|
+
</div>
|
|
106
|
+
<div className="mt-2 flex flex-wrap justify-end gap-2">
|
|
107
|
+
{actions?.map((action, index) => {
|
|
108
|
+
return (
|
|
109
|
+
<Button
|
|
110
|
+
name={action.id}
|
|
111
|
+
key={index}
|
|
112
|
+
variant={action.type === 'secondary' ? 'secondary' : 'default'}
|
|
113
|
+
size={action.size === 'sm' ? 'sm' : 'default'}
|
|
114
|
+
onClick={() => {
|
|
115
|
+
onSubmit(action.value);
|
|
116
|
+
}}
|
|
117
|
+
className="min-w-16"
|
|
118
|
+
>
|
|
119
|
+
{action.text}
|
|
120
|
+
</Button>
|
|
121
|
+
);
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default ViewportDialog;
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { Badge, badgeVariants } from './Badge';
|
|
2
|
+
import { Button, buttonVariants } from './Button';
|
|
3
|
+
import {
|
|
4
|
+
SmartScrollbar,
|
|
5
|
+
useSmartScrollbarLayoutContext,
|
|
6
|
+
useSmartScrollbarScrollContext,
|
|
7
|
+
SmartScrollbarTrack,
|
|
8
|
+
SmartScrollbarFill,
|
|
9
|
+
SmartScrollbarIndicator,
|
|
10
|
+
SmartScrollbarEndpoints,
|
|
11
|
+
useByteArray,
|
|
12
|
+
} from './SmartScrollbar';
|
|
13
|
+
import { ThemeWrapper } from './ThemeWrapper';
|
|
14
|
+
import {
|
|
15
|
+
Command,
|
|
16
|
+
CommandDialog,
|
|
17
|
+
CommandInput,
|
|
18
|
+
CommandList,
|
|
19
|
+
CommandEmpty,
|
|
20
|
+
CommandGroup,
|
|
21
|
+
CommandItem,
|
|
22
|
+
CommandShortcut,
|
|
23
|
+
CommandSeparator,
|
|
24
|
+
} from './Command';
|
|
25
|
+
import {
|
|
26
|
+
Dialog,
|
|
27
|
+
DialogPortal,
|
|
28
|
+
DialogOverlay,
|
|
29
|
+
DialogTrigger,
|
|
30
|
+
DialogClose,
|
|
31
|
+
DialogContent,
|
|
32
|
+
DialogHeader,
|
|
33
|
+
DialogFooter,
|
|
34
|
+
DialogTitle,
|
|
35
|
+
DialogDescription,
|
|
36
|
+
} from './Dialog';
|
|
37
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './Select';
|
|
38
|
+
import { Clipboard } from './Clipboard';
|
|
39
|
+
import { Combobox } from './Combobox';
|
|
40
|
+
import { Popover, PopoverContent, PopoverTrigger, PopoverAnchor } from './Popover';
|
|
41
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from './Resizable';
|
|
42
|
+
import { Calendar } from './Calendar';
|
|
43
|
+
import CinePlayer from './CinePlayer';
|
|
44
|
+
import { DatePickerWithRange } from './DateRange';
|
|
45
|
+
import { Separator } from './Separator';
|
|
46
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from './Tabs';
|
|
47
|
+
import { Toggle, toggleVariants } from './Toggle';
|
|
48
|
+
import { ToggleGroup, ToggleGroupItem } from './ToggleGroup';
|
|
49
|
+
import { Input } from './Input';
|
|
50
|
+
import { InputNumber } from './InputNumber';
|
|
51
|
+
import { InputMultiSelect } from './InputMultiSelect';
|
|
52
|
+
import { Label } from './Label';
|
|
53
|
+
import { Switch } from './Switch';
|
|
54
|
+
import { Checkbox } from './Checkbox';
|
|
55
|
+
import { Slider } from './Slider';
|
|
56
|
+
import { ScrollArea, ScrollBar } from './ScrollArea';
|
|
57
|
+
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './Accordion';
|
|
58
|
+
import { Icons } from './Icons';
|
|
59
|
+
import { SidePanel } from './SidePanel';
|
|
60
|
+
import { StudyItem } from './StudyItem';
|
|
61
|
+
import { StudyBrowser } from './StudyBrowser';
|
|
62
|
+
import { StudyBrowserSort } from './StudyBrowserSort';
|
|
63
|
+
import { StudyBrowserViewOptions } from './StudyBrowserViewOptions';
|
|
64
|
+
import { Thumbnail } from './Thumbnail';
|
|
65
|
+
import { ThumbnailList } from './ThumbnailList';
|
|
66
|
+
import { PanelSection } from './PanelSection';
|
|
67
|
+
import { DisplaySetMessageListTooltip } from './DisplaySetMessageListTooltip';
|
|
68
|
+
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from './Tooltip';
|
|
69
|
+
import { ToolboxUI } from './OHIFToolbox';
|
|
70
|
+
import Numeric from './Numeric';
|
|
71
|
+
import { InputDialog, PresetDialog } from './OHIFDialogs';
|
|
72
|
+
import { AboutModal, ImageModal, UserPreferencesModal, AppearanceModal } from './OHIFModals';
|
|
73
|
+
import Modal from './Modal/Modal';
|
|
74
|
+
import { FooterAction } from './FooterAction';
|
|
75
|
+
import { InputFilter } from './InputFilter';
|
|
76
|
+
import { WindowLevel, WindowLevelHistogram } from './OHIFPanels';
|
|
77
|
+
import ProgressDropdown from './ProgressDropdown';
|
|
78
|
+
import LoadingIndicatorProgress from './LoadingIndicatorProgress';
|
|
79
|
+
import LoadingIndicatorTotalPercent from './LoadingIndicatorTotalPercent';
|
|
80
|
+
import ProgressLoadingBar from './ProgressLoadingBar';
|
|
81
|
+
import ViewportDialog from './ViewportDialog';
|
|
82
|
+
import {
|
|
83
|
+
DropdownMenu,
|
|
84
|
+
DropdownMenuTrigger,
|
|
85
|
+
DropdownMenuContent,
|
|
86
|
+
DropdownMenuItem,
|
|
87
|
+
DropdownMenuCheckboxItem,
|
|
88
|
+
DropdownMenuRadioItem,
|
|
89
|
+
DropdownMenuLabel,
|
|
90
|
+
DropdownMenuSeparator,
|
|
91
|
+
DropdownMenuShortcut,
|
|
92
|
+
DropdownMenuGroup,
|
|
93
|
+
DropdownMenuPortal,
|
|
94
|
+
DropdownMenuSub,
|
|
95
|
+
DropdownMenuSubContent,
|
|
96
|
+
DropdownMenuSubTrigger,
|
|
97
|
+
DropdownMenuRadioGroup,
|
|
98
|
+
} from './DropdownMenu';
|
|
99
|
+
import { Onboarding } from './Onboarding';
|
|
100
|
+
import { DoubleSlider } from './DoubleSlider';
|
|
101
|
+
import {
|
|
102
|
+
SegmentationTable,
|
|
103
|
+
useSegmentationTableContext,
|
|
104
|
+
useSegmentationExpanded,
|
|
105
|
+
useSegmentStatistics,
|
|
106
|
+
SegmentationTableProvider,
|
|
107
|
+
} from './SegmentationTable';
|
|
108
|
+
import { Toaster, toast } from './Sonner';
|
|
109
|
+
import { StudySummary } from './StudySummary';
|
|
110
|
+
import { ErrorBoundary } from './Errorboundary';
|
|
111
|
+
import { Header } from './Header';
|
|
112
|
+
import { HoverCard, HoverCardTrigger, HoverCardContent } from './HoverCard';
|
|
113
|
+
import { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './Card';
|
|
114
|
+
import {
|
|
115
|
+
Table,
|
|
116
|
+
TableHeader,
|
|
117
|
+
TableBody,
|
|
118
|
+
TableFooter,
|
|
119
|
+
TableHead,
|
|
120
|
+
TableRow,
|
|
121
|
+
TableCell,
|
|
122
|
+
TableCaption,
|
|
123
|
+
} from './Table';
|
|
124
|
+
import {
|
|
125
|
+
ViewportActionButton,
|
|
126
|
+
PatientInfo,
|
|
127
|
+
ViewportActionBar,
|
|
128
|
+
ViewportActionArrows,
|
|
129
|
+
ViewportPane,
|
|
130
|
+
ViewportActionCorners,
|
|
131
|
+
ViewportActionCornersLocations,
|
|
132
|
+
ViewportOverlay,
|
|
133
|
+
ViewportGrid,
|
|
134
|
+
ImageScrollbar,
|
|
135
|
+
} from './Viewport';
|
|
136
|
+
import {
|
|
137
|
+
ToolButton,
|
|
138
|
+
ToolButtonList,
|
|
139
|
+
ToolButtonListDefault,
|
|
140
|
+
ToolButtonListDropDown,
|
|
141
|
+
ToolButtonListItem,
|
|
142
|
+
ToolButtonListDivider,
|
|
143
|
+
} from './ToolButton';
|
|
144
|
+
import { LayoutSelector } from './LayoutSelector';
|
|
145
|
+
import { ToolSettings } from './OHIFToolSettings';
|
|
146
|
+
import { ContextMenuViewport } from './ContextMenuViewport';
|
|
147
|
+
export * from './DataTable';
|
|
148
|
+
export * from './StudyList';
|
|
149
|
+
export { DataRow } from './DataRow';
|
|
150
|
+
export { MeasurementTable } from './MeasurementTable';
|
|
151
|
+
export * from './ColorCircle';
|
|
152
|
+
export { default as AllInOneMenu } from './AllInOneMenu';
|
|
153
|
+
export * from './AllInOneMenu';
|
|
154
|
+
export { default as LineChart } from './LineChart';
|
|
155
|
+
export { default as InvestigationalUseDialog } from './InvestigationalUseDialog';
|
|
156
|
+
export { default as LabellingFlow } from './Labelling';
|
|
157
|
+
export type { SegmentationTableContextType } from './SegmentationTable';
|
|
158
|
+
|
|
159
|
+
// Segmentation Context Exports
|
|
160
|
+
export {
|
|
161
|
+
useSegmentationTableContext,
|
|
162
|
+
useSegmentationExpanded,
|
|
163
|
+
useSegmentStatistics,
|
|
164
|
+
SegmentationTableProvider,
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export {
|
|
168
|
+
Numeric,
|
|
169
|
+
ErrorBoundary,
|
|
170
|
+
Badge,
|
|
171
|
+
badgeVariants,
|
|
172
|
+
Button,
|
|
173
|
+
buttonVariants,
|
|
174
|
+
ThemeWrapper,
|
|
175
|
+
DoubleSlider,
|
|
176
|
+
Command,
|
|
177
|
+
CommandDialog,
|
|
178
|
+
CommandInput,
|
|
179
|
+
CommandList,
|
|
180
|
+
CommandEmpty,
|
|
181
|
+
CommandGroup,
|
|
182
|
+
CommandItem,
|
|
183
|
+
CommandShortcut,
|
|
184
|
+
CommandSeparator,
|
|
185
|
+
Dialog,
|
|
186
|
+
DialogPortal,
|
|
187
|
+
DialogOverlay,
|
|
188
|
+
DialogTrigger,
|
|
189
|
+
DialogClose,
|
|
190
|
+
DialogContent,
|
|
191
|
+
DialogHeader,
|
|
192
|
+
DialogFooter,
|
|
193
|
+
DialogTitle,
|
|
194
|
+
DialogDescription,
|
|
195
|
+
Combobox,
|
|
196
|
+
Popover,
|
|
197
|
+
PopoverContent,
|
|
198
|
+
PopoverTrigger,
|
|
199
|
+
PopoverAnchor,
|
|
200
|
+
ResizableHandle,
|
|
201
|
+
ResizablePanel,
|
|
202
|
+
ResizablePanelGroup,
|
|
203
|
+
Calendar,
|
|
204
|
+
DatePickerWithRange,
|
|
205
|
+
Input,
|
|
206
|
+
InputNumber,
|
|
207
|
+
InputMultiSelect,
|
|
208
|
+
Label,
|
|
209
|
+
Tabs,
|
|
210
|
+
TabsContent,
|
|
211
|
+
TabsList,
|
|
212
|
+
TabsTrigger,
|
|
213
|
+
Separator,
|
|
214
|
+
Switch,
|
|
215
|
+
Checkbox,
|
|
216
|
+
Toggle,
|
|
217
|
+
toggleVariants,
|
|
218
|
+
Slider,
|
|
219
|
+
ScrollArea,
|
|
220
|
+
ToggleGroup,
|
|
221
|
+
ToggleGroupItem,
|
|
222
|
+
ScrollBar,
|
|
223
|
+
Table,
|
|
224
|
+
TableHeader,
|
|
225
|
+
TableBody,
|
|
226
|
+
TableFooter,
|
|
227
|
+
TableHead,
|
|
228
|
+
TableRow,
|
|
229
|
+
TableCell,
|
|
230
|
+
TableCaption,
|
|
231
|
+
Accordion,
|
|
232
|
+
AccordionContent,
|
|
233
|
+
AccordionItem,
|
|
234
|
+
AccordionTrigger,
|
|
235
|
+
Icons,
|
|
236
|
+
SidePanel,
|
|
237
|
+
StudyItem,
|
|
238
|
+
StudyBrowser,
|
|
239
|
+
StudyBrowserSort,
|
|
240
|
+
StudyBrowserViewOptions,
|
|
241
|
+
Thumbnail,
|
|
242
|
+
ThumbnailList,
|
|
243
|
+
PanelSection,
|
|
244
|
+
DisplaySetMessageListTooltip,
|
|
245
|
+
ToolboxUI,
|
|
246
|
+
DropdownMenu,
|
|
247
|
+
DropdownMenuTrigger,
|
|
248
|
+
DropdownMenuContent,
|
|
249
|
+
DropdownMenuItem,
|
|
250
|
+
DropdownMenuCheckboxItem,
|
|
251
|
+
DropdownMenuRadioItem,
|
|
252
|
+
DropdownMenuLabel,
|
|
253
|
+
DropdownMenuSeparator,
|
|
254
|
+
DropdownMenuShortcut,
|
|
255
|
+
DropdownMenuGroup,
|
|
256
|
+
DropdownMenuPortal,
|
|
257
|
+
DropdownMenuSub,
|
|
258
|
+
DropdownMenuSubContent,
|
|
259
|
+
DropdownMenuSubTrigger,
|
|
260
|
+
DropdownMenuRadioGroup,
|
|
261
|
+
Onboarding,
|
|
262
|
+
Select,
|
|
263
|
+
SelectTrigger,
|
|
264
|
+
SelectContent,
|
|
265
|
+
SelectItem,
|
|
266
|
+
SelectValue,
|
|
267
|
+
Tooltip,
|
|
268
|
+
TooltipTrigger,
|
|
269
|
+
TooltipContent,
|
|
270
|
+
TooltipProvider,
|
|
271
|
+
Toaster,
|
|
272
|
+
toast,
|
|
273
|
+
SegmentationTable,
|
|
274
|
+
StudySummary,
|
|
275
|
+
Header,
|
|
276
|
+
HoverCard,
|
|
277
|
+
HoverCardTrigger,
|
|
278
|
+
HoverCardContent,
|
|
279
|
+
Card,
|
|
280
|
+
CardHeader,
|
|
281
|
+
CardFooter,
|
|
282
|
+
CardTitle,
|
|
283
|
+
CardDescription,
|
|
284
|
+
CardContent,
|
|
285
|
+
ViewportActionButton,
|
|
286
|
+
PatientInfo,
|
|
287
|
+
ViewportActionBar,
|
|
288
|
+
ViewportActionArrows,
|
|
289
|
+
ViewportPane,
|
|
290
|
+
ViewportActionCorners,
|
|
291
|
+
ViewportActionCornersLocations,
|
|
292
|
+
ViewportOverlay,
|
|
293
|
+
ViewportGrid,
|
|
294
|
+
ImageScrollbar,
|
|
295
|
+
Clipboard,
|
|
296
|
+
ToolButton,
|
|
297
|
+
ToolButtonList,
|
|
298
|
+
ToolButtonListDefault,
|
|
299
|
+
ToolButtonListDropDown,
|
|
300
|
+
ToolButtonListItem,
|
|
301
|
+
ToolButtonListDivider,
|
|
302
|
+
InputDialog,
|
|
303
|
+
PresetDialog,
|
|
304
|
+
Modal,
|
|
305
|
+
AboutModal,
|
|
306
|
+
ImageModal,
|
|
307
|
+
UserPreferencesModal,
|
|
308
|
+
AppearanceModal,
|
|
309
|
+
FooterAction,
|
|
310
|
+
ToolSettings,
|
|
311
|
+
InputFilter,
|
|
312
|
+
WindowLevel,
|
|
313
|
+
WindowLevelHistogram,
|
|
314
|
+
ProgressDropdown,
|
|
315
|
+
LoadingIndicatorProgress,
|
|
316
|
+
LoadingIndicatorTotalPercent,
|
|
317
|
+
ProgressLoadingBar,
|
|
318
|
+
ViewportDialog,
|
|
319
|
+
CinePlayer,
|
|
320
|
+
LayoutSelector,
|
|
321
|
+
ContextMenuViewport,
|
|
322
|
+
SmartScrollbar,
|
|
323
|
+
useSmartScrollbarLayoutContext,
|
|
324
|
+
useSmartScrollbarScrollContext,
|
|
325
|
+
SmartScrollbarTrack,
|
|
326
|
+
SmartScrollbarFill,
|
|
327
|
+
SmartScrollbarIndicator,
|
|
328
|
+
SmartScrollbarEndpoints,
|
|
329
|
+
useByteArray,
|
|
330
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import '../themes/themes.css';
|
|
3
|
+
import { themePresets } from '../themes';
|
|
4
|
+
|
|
5
|
+
const STORAGE_KEY_THEME = 'ohif:theme';
|
|
6
|
+
const STORAGE_KEY_CUSTOM_CSS = 'ohif:custom-theme-css';
|
|
7
|
+
const CUSTOM_STYLE_ID = 'ohif-custom-theme';
|
|
8
|
+
const VALID_THEMES = new Set(['default', 'custom', ...themePresets.map(p => p.name)]);
|
|
9
|
+
|
|
10
|
+
type ActiveThemeContextType = {
|
|
11
|
+
activeTheme: string;
|
|
12
|
+
setActiveTheme: (theme: string) => void;
|
|
13
|
+
customCss: string;
|
|
14
|
+
applyCustomTheme: (cssText: string) => boolean;
|
|
15
|
+
clearCustomTheme: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// 'custom' is deliberately not URL-addressable: the CSS behind it lives only in
|
|
19
|
+
// the visitor's own localStorage, so a ?theme=custom link cannot reproduce a look
|
|
20
|
+
// and would only strand the app in a custom state with no CSS behind it.
|
|
21
|
+
function isValidUrlTheme(theme: string | null): theme is string {
|
|
22
|
+
return !!theme && theme !== 'custom' && VALID_THEMES.has(theme);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ActiveThemeContext = React.createContext<ActiveThemeContextType | undefined>(undefined);
|
|
26
|
+
|
|
27
|
+
function removeThemeClasses() {
|
|
28
|
+
const classList = document.body.classList;
|
|
29
|
+
const toRemove: string[] = [];
|
|
30
|
+
classList.forEach(cls => {
|
|
31
|
+
if (cls.startsWith('theme-')) {
|
|
32
|
+
toRemove.push(cls);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
toRemove.forEach(cls => classList.remove(cls));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function removeCustomStyleElement() {
|
|
39
|
+
const style = document.getElementById(CUSTOM_STYLE_ID);
|
|
40
|
+
if (style) {
|
|
41
|
+
style.remove();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function parseCssVars(cssText: string): string[] {
|
|
46
|
+
const vars: string[] = [];
|
|
47
|
+
|
|
48
|
+
// Remove comment spans entirely (text included), then any unterminated tail,
|
|
49
|
+
// so comment contents never bleed into a variable value.
|
|
50
|
+
const stripped = cssText.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\*[\s\S]*$/, '');
|
|
51
|
+
|
|
52
|
+
// Split on newlines AND semicolons so single-line/minified CSS parses too.
|
|
53
|
+
for (const raw of stripped.split(/[\n;]/)) {
|
|
54
|
+
let line = raw.trim();
|
|
55
|
+
|
|
56
|
+
// Tolerate a selector prefix on the same segment, e.g. ":root {" or ".dark{".
|
|
57
|
+
const braceIdx = line.lastIndexOf('{');
|
|
58
|
+
if (braceIdx !== -1) {
|
|
59
|
+
line = line.slice(braceIdx + 1).trim();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const colonIdx = line.indexOf(':');
|
|
63
|
+
if (colonIdx === -1) continue;
|
|
64
|
+
|
|
65
|
+
const name = line.slice(0, colonIdx).trim();
|
|
66
|
+
if (!/^--[a-zA-Z0-9-]+$/.test(name)) continue;
|
|
67
|
+
|
|
68
|
+
const value = line
|
|
69
|
+
.slice(colonIdx + 1)
|
|
70
|
+
.replace(/[{}]/g, '')
|
|
71
|
+
.trim();
|
|
72
|
+
if (!value) continue;
|
|
73
|
+
|
|
74
|
+
// Token values are plain HSL triplets — parentheses are never legitimate,
|
|
75
|
+
// and rejecting them keeps url(...) out of the injected stylesheet even if
|
|
76
|
+
// a future rule ever consumes a token outside hsl().
|
|
77
|
+
if (value.includes('(') || value.includes(')')) continue;
|
|
78
|
+
|
|
79
|
+
vars.push(` ${name}: ${value};`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return vars;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function injectCustomStyles(vars: string[]) {
|
|
86
|
+
const block = vars.join('\n');
|
|
87
|
+
const css = `:root {\n${block}\n}\n.dark {\n${block}\n}`;
|
|
88
|
+
|
|
89
|
+
let style = document.getElementById(CUSTOM_STYLE_ID) as HTMLStyleElement | null;
|
|
90
|
+
if (!style) {
|
|
91
|
+
style = document.createElement('style');
|
|
92
|
+
style.id = CUSTOM_STYLE_ID;
|
|
93
|
+
document.head.appendChild(style);
|
|
94
|
+
}
|
|
95
|
+
style.textContent = css;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function ActiveThemeProvider({ children }: { children: React.ReactNode }) {
|
|
99
|
+
const [activeTheme, setActiveThemeState] = React.useState<string>(() => {
|
|
100
|
+
if (typeof window === 'undefined') return 'default';
|
|
101
|
+
const urlTheme = new URLSearchParams(window.location.search).get('theme');
|
|
102
|
+
if (isValidUrlTheme(urlTheme)) return urlTheme;
|
|
103
|
+
|
|
104
|
+
// Validate the stored value the same way the URL param is validated — a stale
|
|
105
|
+
// key (renamed preset, older build) must not become a theme-* body class.
|
|
106
|
+
const stored = localStorage.getItem(STORAGE_KEY_THEME);
|
|
107
|
+
if (!stored || !VALID_THEMES.has(stored)) return 'default';
|
|
108
|
+
if (stored === 'custom' && !localStorage.getItem(STORAGE_KEY_CUSTOM_CSS)) return 'default';
|
|
109
|
+
return stored;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const [customCss, setCustomCssState] = React.useState<string>(() => {
|
|
113
|
+
if (typeof window === 'undefined') return '';
|
|
114
|
+
return localStorage.getItem(STORAGE_KEY_CUSTOM_CSS) || '';
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const setActiveTheme = React.useCallback((theme: string) => {
|
|
118
|
+
if (!VALID_THEMES.has(theme)) return;
|
|
119
|
+
|
|
120
|
+
setActiveThemeState(theme);
|
|
121
|
+
removeThemeClasses();
|
|
122
|
+
|
|
123
|
+
if (theme !== 'default' && theme !== 'custom') {
|
|
124
|
+
document.body.classList.add(`theme-${theme}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (theme !== 'custom') {
|
|
128
|
+
removeCustomStyleElement();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (theme === 'default') {
|
|
132
|
+
localStorage.removeItem(STORAGE_KEY_THEME);
|
|
133
|
+
} else {
|
|
134
|
+
localStorage.setItem(STORAGE_KEY_THEME, theme);
|
|
135
|
+
}
|
|
136
|
+
}, []);
|
|
137
|
+
|
|
138
|
+
const applyCustomTheme = React.useCallback((cssText: string): boolean => {
|
|
139
|
+
const vars = parseCssVars(cssText);
|
|
140
|
+
if (vars.length === 0) return false;
|
|
141
|
+
|
|
142
|
+
injectCustomStyles(vars);
|
|
143
|
+
|
|
144
|
+
setCustomCssState(cssText);
|
|
145
|
+
localStorage.setItem(STORAGE_KEY_CUSTOM_CSS, cssText);
|
|
146
|
+
|
|
147
|
+
setActiveThemeState('custom');
|
|
148
|
+
removeThemeClasses();
|
|
149
|
+
localStorage.setItem(STORAGE_KEY_THEME, 'custom');
|
|
150
|
+
return true;
|
|
151
|
+
}, []);
|
|
152
|
+
|
|
153
|
+
const clearCustomTheme = React.useCallback(() => {
|
|
154
|
+
removeCustomStyleElement();
|
|
155
|
+
|
|
156
|
+
setCustomCssState('');
|
|
157
|
+
localStorage.removeItem(STORAGE_KEY_CUSTOM_CSS);
|
|
158
|
+
|
|
159
|
+
setActiveThemeState('default');
|
|
160
|
+
removeThemeClasses();
|
|
161
|
+
localStorage.removeItem(STORAGE_KEY_THEME);
|
|
162
|
+
}, []);
|
|
163
|
+
|
|
164
|
+
// Persist URL param override to localStorage
|
|
165
|
+
React.useEffect(() => {
|
|
166
|
+
const urlTheme = new URLSearchParams(window.location.search).get('theme');
|
|
167
|
+
if (isValidUrlTheme(urlTheme)) {
|
|
168
|
+
if (urlTheme === 'default') {
|
|
169
|
+
localStorage.removeItem(STORAGE_KEY_THEME);
|
|
170
|
+
} else {
|
|
171
|
+
localStorage.setItem(STORAGE_KEY_THEME, urlTheme);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, []);
|
|
175
|
+
|
|
176
|
+
// Apply initial theme on mount (including custom theme re-injection on reload)
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
if (activeTheme === 'custom' && customCss) {
|
|
179
|
+
applyCustomTheme(customCss);
|
|
180
|
+
} else if (activeTheme !== 'default') {
|
|
181
|
+
document.body.classList.add(`theme-${activeTheme}`);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return () => {
|
|
185
|
+
removeThemeClasses();
|
|
186
|
+
removeCustomStyleElement();
|
|
187
|
+
};
|
|
188
|
+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
189
|
+
|
|
190
|
+
const value = React.useMemo(
|
|
191
|
+
() => ({ activeTheme, setActiveTheme, customCss, applyCustomTheme, clearCustomTheme }),
|
|
192
|
+
[activeTheme, setActiveTheme, customCss, applyCustomTheme, clearCustomTheme]
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
return <ActiveThemeContext.Provider value={value}>{children}</ActiveThemeContext.Provider>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export function useActiveTheme() {
|
|
199
|
+
const context = React.useContext(ActiveThemeContext);
|
|
200
|
+
if (context === undefined) {
|
|
201
|
+
throw new Error('useActiveTheme must be used within an ActiveThemeProvider');
|
|
202
|
+
}
|
|
203
|
+
return context;
|
|
204
|
+
}
|