@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,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icons } from '../Icons';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useSegmentationTableContext } from './contexts';
|
|
5
|
+
|
|
6
|
+
export const AddSegmentationRow: React.FC<{ children?: React.ReactNode }> = ({
|
|
7
|
+
children = null,
|
|
8
|
+
}) => {
|
|
9
|
+
const { t } = useTranslation('SegmentationPanel');
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
onSegmentationAdd,
|
|
13
|
+
data,
|
|
14
|
+
disableEditing,
|
|
15
|
+
mode,
|
|
16
|
+
disabled,
|
|
17
|
+
segmentationRepresentationTypes,
|
|
18
|
+
} = useSegmentationTableContext('AddSegmentationRow');
|
|
19
|
+
|
|
20
|
+
// Check if we have at least one segmentation of the representation type for the panel this component is contained in.
|
|
21
|
+
const hasRepresentationType =
|
|
22
|
+
(!segmentationRepresentationTypes && data.length > 0) ||
|
|
23
|
+
data.some(info => segmentationRepresentationTypes?.includes(info.representation?.type));
|
|
24
|
+
|
|
25
|
+
if (hasRepresentationType && mode === 'collapsed') {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (disableEditing) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
data-cy="addSegmentation"
|
|
36
|
+
className={`group ${disabled ? 'pointer-events-none cursor-not-allowed opacity-70' : ''}`}
|
|
37
|
+
onClick={() =>
|
|
38
|
+
!disabled &&
|
|
39
|
+
onSegmentationAdd({
|
|
40
|
+
segmentationId: '',
|
|
41
|
+
segmentationRepresentationType: segmentationRepresentationTypes?.[0],
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
<div className="text-primary group-hover:bg-popover flex items-center rounded-[4px] pl-1 group-hover:cursor-pointer">
|
|
47
|
+
<div className="grid h-[28px] w-[28px] place-items-center">
|
|
48
|
+
{disabled ? <Icons.Info /> : <Icons.Add />}
|
|
49
|
+
</div>
|
|
50
|
+
<span className="text-[13px]">
|
|
51
|
+
{t(disabled ? 'Segmentation not supported' : 'Add segmentation')}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SegmentStatisticsProvider, useSegmentStatistics } from './contexts';
|
|
3
|
+
import { roundNumber } from '../../utils';
|
|
4
|
+
|
|
5
|
+
// Default statistics component
|
|
6
|
+
const DefaultStatsList = () => {
|
|
7
|
+
const { namedStats } = useSegmentStatistics('DefaultStatsList');
|
|
8
|
+
|
|
9
|
+
if (!namedStats) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const handleNumber = (value: number) => {
|
|
14
|
+
if (value === null) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (Array.isArray(value)) {
|
|
19
|
+
return value.map(handleNumber).join(', ');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return roundNumber(value);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Sort namedStats entries by order property
|
|
26
|
+
const sortedStats = Object.entries(namedStats)
|
|
27
|
+
.filter(([_, stat]) => stat && stat.value !== null)
|
|
28
|
+
.sort((a, b) => {
|
|
29
|
+
const orderA = a[1]?.order ?? Number.MAX_SAFE_INTEGER;
|
|
30
|
+
const orderB = b[1]?.order ?? Number.MAX_SAFE_INTEGER;
|
|
31
|
+
return orderA - orderB;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div className="space-y-1">
|
|
36
|
+
{sortedStats.map(([key, stat]) => {
|
|
37
|
+
const { label, value, unit } = stat;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
key={key}
|
|
42
|
+
className="flex justify-between"
|
|
43
|
+
>
|
|
44
|
+
<div>{label}</div>
|
|
45
|
+
<div>
|
|
46
|
+
<span className="text-foreground">{handleNumber(value)}</span>{' '}
|
|
47
|
+
<span className="">{unit && unit !== 'none' ? unit : ''}</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
})}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// Root component that serves as the container and context provider
|
|
57
|
+
const SegmentStatisticsRoot = ({ segment, segmentationId, children }) => {
|
|
58
|
+
if (!segment) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<SegmentStatisticsProvider
|
|
64
|
+
segment={segment}
|
|
65
|
+
segmentationId={segmentationId}
|
|
66
|
+
>
|
|
67
|
+
<div className="segment-statistics w-full">{children}</div>
|
|
68
|
+
</SegmentStatisticsProvider>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const SegmentStatisticsTitle = ({ children = null }: { children?: React.ReactNode }) => {
|
|
73
|
+
return <div className="mb-2">{children}</div>;
|
|
74
|
+
};
|
|
75
|
+
const SegmentStatisticsHeader = ({ children = null }: { children?: React.ReactNode }) => {
|
|
76
|
+
const { segment, segmentationId } = useSegmentStatistics('SegmentStatisticsHeader');
|
|
77
|
+
const { segmentIndex } = segment;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div className="mb-3">
|
|
81
|
+
{children &&
|
|
82
|
+
React.cloneElement(children as React.ReactElement<any>, { segmentationId, segmentIndex })}
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const SegmentStatisticsBody = ({ children = null }: { children?: React.ReactNode }) => {
|
|
88
|
+
return <div className="segment-statistics-body">{children || <DefaultStatsList />}</div>;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const SegmentStatisticsFooter = ({ children = null }: { children?: React.ReactNode }) => {
|
|
92
|
+
return <div className="mt-3">{children}</div>;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Create a compound component structure
|
|
96
|
+
const SegmentStatistics = Object.assign(SegmentStatisticsRoot, {
|
|
97
|
+
Title: SegmentStatisticsTitle,
|
|
98
|
+
Header: SegmentStatisticsHeader,
|
|
99
|
+
Body: SegmentStatisticsBody,
|
|
100
|
+
Footer: SegmentStatisticsFooter,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export { SegmentStatistics };
|
|
104
|
+
export { useSegmentStatistics };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PanelSection } from '../PanelSection';
|
|
3
|
+
import {
|
|
4
|
+
useSegmentationTableContext,
|
|
5
|
+
SegmentationExpandedProvider,
|
|
6
|
+
useSegmentationExpanded,
|
|
7
|
+
} from './contexts';
|
|
8
|
+
import { SegmentationLabel } from './SegmentationLabel';
|
|
9
|
+
import { useTranslation } from 'react-i18next';
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
Icons,
|
|
13
|
+
DropdownMenu,
|
|
14
|
+
DropdownMenuTrigger,
|
|
15
|
+
Tooltip,
|
|
16
|
+
TooltipTrigger,
|
|
17
|
+
TooltipContent,
|
|
18
|
+
Select,
|
|
19
|
+
SelectTrigger,
|
|
20
|
+
SelectContent,
|
|
21
|
+
SelectItem,
|
|
22
|
+
SelectValue,
|
|
23
|
+
} from '../../components';
|
|
24
|
+
|
|
25
|
+
// Main header component
|
|
26
|
+
const SegmentationCollapsedHeader = ({ children }: { children: React.ReactNode }) => {
|
|
27
|
+
return (
|
|
28
|
+
<div className="bg-muted flex h-10 w-full items-center space-x-1 rounded-t px-1.5">
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Dropdown menu component - specifically for dropdown menu content
|
|
35
|
+
const SegmentationCollapsedDropdownMenu = ({ children }: { children: React.ReactNode }) => {
|
|
36
|
+
const { segmentationRepresentationTypes } = useSegmentationTableContext(
|
|
37
|
+
'SegmentationCollapsedDropdownMenu'
|
|
38
|
+
);
|
|
39
|
+
const dataCyTypeSuffix = segmentationRepresentationTypes?.[0]
|
|
40
|
+
? `-${segmentationRepresentationTypes[0]}`
|
|
41
|
+
: '';
|
|
42
|
+
return (
|
|
43
|
+
<DropdownMenu>
|
|
44
|
+
<DropdownMenuTrigger asChild>
|
|
45
|
+
<Button
|
|
46
|
+
variant="ghost"
|
|
47
|
+
size="icon"
|
|
48
|
+
data-cy={`segmentation-collapsed-more-btn${dataCyTypeSuffix}`}
|
|
49
|
+
>
|
|
50
|
+
<Icons.More className="h-6 w-6" />
|
|
51
|
+
</Button>
|
|
52
|
+
</DropdownMenuTrigger>
|
|
53
|
+
{children}
|
|
54
|
+
</DropdownMenu>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Selector component - for the segmentation selection dropdown
|
|
59
|
+
const SegmentationCollapsedSelector = () => {
|
|
60
|
+
const { t } = useTranslation('SegmentationPanel');
|
|
61
|
+
const { data, onSegmentationClick, segmentationRepresentationTypes } =
|
|
62
|
+
useSegmentationTableContext('SegmentationCollapsedSelector');
|
|
63
|
+
// This selector is only ever rendered inside SegmentationCollapsedRoot, which
|
|
64
|
+
// provides the context, so a missing context is a wiring mistake rather than a
|
|
65
|
+
// supported state. Assert here rather than in the hook, so the error names the
|
|
66
|
+
// component that has the requirement.
|
|
67
|
+
const expandedContext = useSegmentationExpanded();
|
|
68
|
+
if (!expandedContext) {
|
|
69
|
+
throw new Error(
|
|
70
|
+
'SegmentationCollapsedSelector must be rendered inside a SegmentationExpandedProvider'
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
const { segmentation } = expandedContext;
|
|
74
|
+
|
|
75
|
+
if (!data?.length) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const segmentations = data
|
|
80
|
+
// Only show segmentations of the representation type for this panel. Show all segmentations if no type is specified.
|
|
81
|
+
.filter(
|
|
82
|
+
seg =>
|
|
83
|
+
!segmentationRepresentationTypes ||
|
|
84
|
+
segmentationRepresentationTypes.includes(seg.representation?.type)
|
|
85
|
+
)
|
|
86
|
+
.map(seg => ({
|
|
87
|
+
id: seg.segmentation.segmentationId,
|
|
88
|
+
segmentation: seg.segmentation,
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
const dataCyTypeSuffix = segmentationRepresentationTypes
|
|
92
|
+
? `-${segmentationRepresentationTypes[0]}`
|
|
93
|
+
: '';
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Select
|
|
97
|
+
onValueChange={value => onSegmentationClick(value)}
|
|
98
|
+
value={segmentation?.segmentationId}
|
|
99
|
+
>
|
|
100
|
+
<SelectTrigger
|
|
101
|
+
className="w-full overflow-hidden"
|
|
102
|
+
data-cy={`segmentation-select${dataCyTypeSuffix}`}
|
|
103
|
+
>
|
|
104
|
+
<SelectValue
|
|
105
|
+
placeholder={t('Select a segmentation')}
|
|
106
|
+
data-cy={`segmentation-select-value${dataCyTypeSuffix}`}
|
|
107
|
+
>
|
|
108
|
+
<SegmentationLabel segmentation={segmentation} />
|
|
109
|
+
</SelectValue>
|
|
110
|
+
</SelectTrigger>
|
|
111
|
+
<SelectContent>
|
|
112
|
+
{segmentations.map(seg => (
|
|
113
|
+
<SelectItem
|
|
114
|
+
key={seg.id}
|
|
115
|
+
value={seg.id}
|
|
116
|
+
>
|
|
117
|
+
<SegmentationLabel segmentation={seg.segmentation} />
|
|
118
|
+
</SelectItem>
|
|
119
|
+
))}
|
|
120
|
+
</SelectContent>
|
|
121
|
+
</Select>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Info component - for displaying the info tooltip
|
|
126
|
+
const SegmentationCollapsedInfo = () => {
|
|
127
|
+
const { data, activeSegmentationId } = useSegmentationTableContext('SegmentationCollapsedInfo');
|
|
128
|
+
|
|
129
|
+
const activeSegmentationObj = data.find(
|
|
130
|
+
seg => seg.segmentation.segmentationId === activeSegmentationId
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const info = activeSegmentationObj?.segmentation.cachedStats?.info;
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<Tooltip delayDuration={100}>
|
|
137
|
+
<TooltipTrigger asChild>
|
|
138
|
+
<Button
|
|
139
|
+
variant="ghost"
|
|
140
|
+
size="icon"
|
|
141
|
+
>
|
|
142
|
+
<Icons.Info className="h-6 w-6" />
|
|
143
|
+
</Button>
|
|
144
|
+
</TooltipTrigger>
|
|
145
|
+
<TooltipContent
|
|
146
|
+
side="bottom"
|
|
147
|
+
align="end"
|
|
148
|
+
>
|
|
149
|
+
{info}
|
|
150
|
+
</TooltipContent>
|
|
151
|
+
</Tooltip>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// Content component - for the main collapsed view content
|
|
156
|
+
const SegmentationCollapsedContent = ({ children }: { children: React.ReactNode }) => {
|
|
157
|
+
return <div className="collapsed-content">{children}</div>;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Main compound component
|
|
161
|
+
const SegmentationCollapsedRoot: React.FC<{ children?: React.ReactNode }> = ({
|
|
162
|
+
children = null,
|
|
163
|
+
}) => {
|
|
164
|
+
const { mode, data, segmentationRepresentationTypes, selectedSegmentationIdForType } =
|
|
165
|
+
useSegmentationTableContext('SegmentationCollapsed');
|
|
166
|
+
|
|
167
|
+
// Find the segmentations for the representation type for this collapsed view.
|
|
168
|
+
const segmentations = data.filter(
|
|
169
|
+
segmentation =>
|
|
170
|
+
!segmentationRepresentationTypes ||
|
|
171
|
+
segmentationRepresentationTypes.includes(segmentation.representation?.type)
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
// Check if we should render.
|
|
175
|
+
if (mode !== 'collapsed' || !data || data.length === 0 || segmentations.length === 0) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Find the selected segmentation info for the representation type, or default to the first one.
|
|
180
|
+
const selectedSegmentationInfo =
|
|
181
|
+
segmentations.find(
|
|
182
|
+
segmentation => segmentation.segmentation.segmentationId === selectedSegmentationIdForType
|
|
183
|
+
) ?? segmentations[0];
|
|
184
|
+
|
|
185
|
+
return (
|
|
186
|
+
<div className="space-y-0">
|
|
187
|
+
<PanelSection className="mb-0">
|
|
188
|
+
<SegmentationExpandedProvider
|
|
189
|
+
segmentation={selectedSegmentationInfo.segmentation}
|
|
190
|
+
representation={selectedSegmentationInfo.representation}
|
|
191
|
+
isActive={true}
|
|
192
|
+
onSegmentationClick={() => {}} // No-op since it's already the active one
|
|
193
|
+
>
|
|
194
|
+
{children}
|
|
195
|
+
</SegmentationExpandedProvider>
|
|
196
|
+
</PanelSection>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// Add the subcomponents to the main component
|
|
202
|
+
const SegmentationCollapsed = Object.assign(SegmentationCollapsedRoot, {
|
|
203
|
+
Header: SegmentationCollapsedHeader,
|
|
204
|
+
DropdownMenu: SegmentationCollapsedDropdownMenu,
|
|
205
|
+
Selector: SegmentationCollapsedSelector,
|
|
206
|
+
Info: SegmentationCollapsedInfo,
|
|
207
|
+
Content: SegmentationCollapsedContent,
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// Export the component
|
|
211
|
+
export { SegmentationCollapsed };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PanelSection } from '../PanelSection';
|
|
3
|
+
import {
|
|
4
|
+
useSegmentationTableContext,
|
|
5
|
+
SegmentationExpandedProvider,
|
|
6
|
+
useSegmentationExpanded,
|
|
7
|
+
} from './contexts';
|
|
8
|
+
import { Button } from '../Button';
|
|
9
|
+
import { Icons } from '../Icons/Icons';
|
|
10
|
+
import { DropdownMenu, DropdownMenuTrigger } from '../DropdownMenu';
|
|
11
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip';
|
|
12
|
+
import { ScrollArea } from '../../components';
|
|
13
|
+
import { useDynamicMaxHeight } from '../../hooks/useDynamicMaxHeight';
|
|
14
|
+
import { SegmentationLabel } from './SegmentationLabel';
|
|
15
|
+
|
|
16
|
+
// The Header, Label, Info and Content parts are only ever rendered inside
|
|
17
|
+
// SegmentationExpandedRoot, which provides the context, so a missing context is a
|
|
18
|
+
// wiring mistake rather than a supported state. Assert here rather than in the
|
|
19
|
+
// hook, so the error names the component that has the requirement.
|
|
20
|
+
const useRequiredSegmentationExpanded = (
|
|
21
|
+
componentName: string
|
|
22
|
+
): NonNullable<ReturnType<typeof useSegmentationExpanded>> => {
|
|
23
|
+
const context = useSegmentationExpanded();
|
|
24
|
+
if (!context) {
|
|
25
|
+
throw new Error(`${componentName} must be rendered inside a SegmentationExpandedProvider`);
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// The Header container component
|
|
31
|
+
const SegmentationExpandedHeader = ({ children }: { children: React.ReactNode }) => {
|
|
32
|
+
const { segmentation, isActive } = useRequiredSegmentationExpanded('SegmentationExpandedHeader');
|
|
33
|
+
const { onSegmentationClick } = useSegmentationTableContext('SegmentationExpandedHeader');
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<PanelSection.Header
|
|
37
|
+
className={`bg-muted my-0 rounded-none border-l-[2px] pl-0 ${isActive ? 'border-primary/70' : 'border-primary/35'}`}
|
|
38
|
+
onClick={e => {
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
onSegmentationClick(segmentation.segmentationId);
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<div className="text-foreground flex h-8 w-full items-center">{children}</div>
|
|
44
|
+
</PanelSection.Header>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Dropdown menu component - specifically for dropdown menu content
|
|
49
|
+
const SegmentationExpandedDropdownMenu = ({ children }: { children: React.ReactNode }) => {
|
|
50
|
+
return (
|
|
51
|
+
<DropdownMenu>
|
|
52
|
+
<DropdownMenuTrigger asChild>
|
|
53
|
+
<Button
|
|
54
|
+
variant="ghost"
|
|
55
|
+
size="icon"
|
|
56
|
+
className="ml-1"
|
|
57
|
+
onClick={e => e.stopPropagation()}
|
|
58
|
+
>
|
|
59
|
+
<Icons.More />
|
|
60
|
+
</Button>
|
|
61
|
+
</DropdownMenuTrigger>
|
|
62
|
+
{children}
|
|
63
|
+
</DropdownMenu>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Label component - for displaying the segmentation label
|
|
68
|
+
const SegmentationExpandedLabel = () => {
|
|
69
|
+
const { segmentation } = useRequiredSegmentationExpanded('SegmentationExpandedLabel');
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div className="pl-1.5">
|
|
73
|
+
<SegmentationLabel segmentation={segmentation} />
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// Info component - for the info tooltip
|
|
79
|
+
const SegmentationExpandedInfo = () => {
|
|
80
|
+
const { segmentation } = useRequiredSegmentationExpanded('SegmentationExpandedInfo');
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div className="ml-auto mr-2">
|
|
84
|
+
<Tooltip>
|
|
85
|
+
<TooltipTrigger asChild>
|
|
86
|
+
<Button
|
|
87
|
+
variant="ghost"
|
|
88
|
+
size="icon"
|
|
89
|
+
>
|
|
90
|
+
<Icons.Info className="h-6 w-6" />
|
|
91
|
+
</Button>
|
|
92
|
+
</TooltipTrigger>
|
|
93
|
+
<TooltipContent>
|
|
94
|
+
<p>{segmentation.cachedStats?.info}</p>
|
|
95
|
+
</TooltipContent>
|
|
96
|
+
</Tooltip>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Content component
|
|
102
|
+
const SegmentationExpandedContent = ({ children }: { children: React.ReactNode }) => {
|
|
103
|
+
const { isActive } = useRequiredSegmentationExpanded('SegmentationExpandedContent');
|
|
104
|
+
return (
|
|
105
|
+
<PanelSection.Content
|
|
106
|
+
className={`border-l-[2px] py-0 pb-6 pl-[8px] ${isActive ? 'border-primary/70' : 'border-primary/35'}`}
|
|
107
|
+
>
|
|
108
|
+
<div className="segmentation-expanded-section">{children}</div>
|
|
109
|
+
</PanelSection.Content>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Main compound component
|
|
114
|
+
const SegmentationExpandedRoot = ({ children }) => {
|
|
115
|
+
const { data, activeSegmentationId, onSegmentationClick, mode, segmentationRepresentationTypes } =
|
|
116
|
+
useSegmentationTableContext('SegmentationExpanded');
|
|
117
|
+
|
|
118
|
+
const { ref: scrollableContainerRef, maxHeight } = useDynamicMaxHeight(data);
|
|
119
|
+
|
|
120
|
+
// Check if we should render based on mode
|
|
121
|
+
if (mode !== 'expanded' || !data || data.length === 0) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<ScrollArea
|
|
127
|
+
className={`bg-background space-y-px`}
|
|
128
|
+
showArrows={true}
|
|
129
|
+
>
|
|
130
|
+
<div
|
|
131
|
+
ref={scrollableContainerRef}
|
|
132
|
+
style={{ maxHeight: maxHeight }}
|
|
133
|
+
className={`space-y-0 pl-0.5`}
|
|
134
|
+
>
|
|
135
|
+
{data
|
|
136
|
+
.filter(
|
|
137
|
+
segmentationInfo =>
|
|
138
|
+
!segmentationRepresentationTypes ||
|
|
139
|
+
segmentationRepresentationTypes.includes(segmentationInfo.representation.type)
|
|
140
|
+
)
|
|
141
|
+
.map(segmentationInfo => {
|
|
142
|
+
const isActive = segmentationInfo.segmentation.segmentationId === activeSegmentationId;
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<PanelSection
|
|
146
|
+
key={segmentationInfo.segmentation.segmentationId}
|
|
147
|
+
className=""
|
|
148
|
+
>
|
|
149
|
+
<SegmentationExpandedProvider
|
|
150
|
+
segmentation={segmentationInfo.segmentation}
|
|
151
|
+
representation={segmentationInfo.representation}
|
|
152
|
+
isActive={isActive}
|
|
153
|
+
onSegmentationClick={onSegmentationClick}
|
|
154
|
+
>
|
|
155
|
+
{children}
|
|
156
|
+
</SegmentationExpandedProvider>
|
|
157
|
+
</PanelSection>
|
|
158
|
+
);
|
|
159
|
+
})}
|
|
160
|
+
</div>
|
|
161
|
+
</ScrollArea>
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const SegmentationExpanded = Object.assign(SegmentationExpandedRoot, {
|
|
166
|
+
Header: SegmentationExpandedHeader,
|
|
167
|
+
DropdownMenu: SegmentationExpandedDropdownMenu,
|
|
168
|
+
Label: SegmentationExpandedLabel,
|
|
169
|
+
Info: SegmentationExpandedInfo,
|
|
170
|
+
Content: SegmentationExpandedContent,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
export { SegmentationExpanded };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '../Button';
|
|
3
|
+
import { Icons } from '../Icons/Icons';
|
|
4
|
+
import { DropdownMenu, DropdownMenuTrigger } from '../DropdownMenu';
|
|
5
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip/Tooltip';
|
|
6
|
+
import { useSegmentationExpanded, useSegmentationTableContext } from './contexts';
|
|
7
|
+
|
|
8
|
+
// Then use it in your component:
|
|
9
|
+
export const SegmentationHeader: React.FC<{
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}> = ({ children }) => {
|
|
12
|
+
// Always call both hooks unconditionally at the top level
|
|
13
|
+
const expandedContext = useSegmentationExpanded();
|
|
14
|
+
const tableContext = useSegmentationTableContext('SegmentationHeader');
|
|
15
|
+
|
|
16
|
+
// Determine which segmentation to use
|
|
17
|
+
const segmentation = expandedContext?.segmentation || tableContext.activeSegmentation;
|
|
18
|
+
|
|
19
|
+
if (!segmentation) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="text-foreground flex h-8 w-full items-center justify-between">
|
|
25
|
+
<div className="flex items-center space-x-1">
|
|
26
|
+
<DropdownMenu>
|
|
27
|
+
<DropdownMenuTrigger asChild>
|
|
28
|
+
<Button
|
|
29
|
+
variant="ghost"
|
|
30
|
+
size="icon"
|
|
31
|
+
className="ml-1"
|
|
32
|
+
onClick={e => e.stopPropagation()}
|
|
33
|
+
>
|
|
34
|
+
<Icons.More />
|
|
35
|
+
</Button>
|
|
36
|
+
</DropdownMenuTrigger>
|
|
37
|
+
{children}
|
|
38
|
+
</DropdownMenu>
|
|
39
|
+
<div className="pl-1.5">{segmentation.label}</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div className="mr-1 flex items-center">
|
|
42
|
+
<Tooltip>
|
|
43
|
+
<TooltipTrigger asChild>
|
|
44
|
+
<Button
|
|
45
|
+
variant="ghost"
|
|
46
|
+
size="icon"
|
|
47
|
+
>
|
|
48
|
+
<Icons.Info className="h-6 w-6" />
|
|
49
|
+
</Button>
|
|
50
|
+
</TooltipTrigger>
|
|
51
|
+
<TooltipContent>
|
|
52
|
+
<p>{segmentation.cachedStats?.info}</p>
|
|
53
|
+
</TooltipContent>
|
|
54
|
+
</Tooltip>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Segmentation } from './contexts/SegmentationTableContext';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Displays the segmentation label. When the label is blank, shows a translated
|
|
7
|
+
* "No description" with the series/modality suffix styled in a lighter, muted font.
|
|
8
|
+
*/
|
|
9
|
+
export const SegmentationLabel = ({ segmentation }: { segmentation: Segmentation }) => {
|
|
10
|
+
const { t } = useTranslation('SegmentationPanel');
|
|
11
|
+
|
|
12
|
+
if (!segmentation) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (segmentation.label) {
|
|
17
|
+
return <>{segmentation.label}</>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const suffix = segmentation.fallbackLabel;
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<span>{t('No description')}</span>
|
|
24
|
+
{suffix && <span className="text-muted-foreground text-xxs"> {suffix}</span>}
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
};
|