@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,345 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { ErrorBoundary as ReactErrorBoundary, FallbackProps } from 'react-error-boundary';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Dialog, DialogContent, DialogTitle } from '../Dialog/Dialog';
|
|
5
|
+
import { ScrollArea } from '../ScrollArea/ScrollArea';
|
|
6
|
+
import { Button } from '../Button/Button';
|
|
7
|
+
import { useNotification } from '../../contextProviders';
|
|
8
|
+
|
|
9
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Parses an error stack trace to extract important information
|
|
13
|
+
* Extracts the first function name from the stack trace
|
|
14
|
+
*/
|
|
15
|
+
const parseErrorStack = (error: ErrorBoundaryError) => {
|
|
16
|
+
if (!error.stack) {
|
|
17
|
+
return { filePath: null, errorTitle: null, code: null, firstFilename: null };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const stack = error.stack;
|
|
21
|
+
const stackLines = stack.split('\n');
|
|
22
|
+
|
|
23
|
+
// Extract error message from first line
|
|
24
|
+
const errorMessage = stackLines[0].trim();
|
|
25
|
+
|
|
26
|
+
// Extract first function name from the stack trace
|
|
27
|
+
let firstFilename = null;
|
|
28
|
+
|
|
29
|
+
// Find the first stack line (starts with " at ")
|
|
30
|
+
for (let i = 1; i < stackLines.length; i++) {
|
|
31
|
+
const line = stackLines[i].trim();
|
|
32
|
+
if (line.startsWith('at ')) {
|
|
33
|
+
// Extract function name pattern
|
|
34
|
+
const match = line.match(/at\s+([^\s(]+)[\s(]/);
|
|
35
|
+
if (match && match[1]) {
|
|
36
|
+
firstFilename = match[1];
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Sanitize stack trace for display - safer approach to avoid ReDoS
|
|
43
|
+
const sanitizedStack = stackLines
|
|
44
|
+
.map(line => {
|
|
45
|
+
// Limit line length to prevent excessive processing
|
|
46
|
+
const limitedLine = line.substring(0, 2000);
|
|
47
|
+
|
|
48
|
+
// Process each part separately to avoid complex regex patterns
|
|
49
|
+
if (limitedLine.includes('(')) {
|
|
50
|
+
// Extract filename from paths in parentheses
|
|
51
|
+
const openParenIndex = limitedLine.indexOf('(');
|
|
52
|
+
const closeParenIndex = limitedLine.indexOf(')', openParenIndex);
|
|
53
|
+
|
|
54
|
+
if (openParenIndex >= 0 && closeParenIndex > openParenIndex) {
|
|
55
|
+
const pathInParens = limitedLine.substring(openParenIndex + 1, closeParenIndex);
|
|
56
|
+
|
|
57
|
+
// Find the last segment after slash or backslash
|
|
58
|
+
const lastSlashIndex = Math.max(
|
|
59
|
+
pathInParens.lastIndexOf('/'),
|
|
60
|
+
pathInParens.lastIndexOf('\\')
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (lastSlashIndex >= 0) {
|
|
64
|
+
const filename = pathInParens.substring(lastSlashIndex + 1);
|
|
65
|
+
return (
|
|
66
|
+
limitedLine.substring(0, openParenIndex + 1) +
|
|
67
|
+
filename +
|
|
68
|
+
limitedLine.substring(closeParenIndex)
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Handle the "at Function path:line:column" format
|
|
75
|
+
if (limitedLine.includes(' at ')) {
|
|
76
|
+
const atIndex = limitedLine.indexOf(' at ');
|
|
77
|
+
const afterAt = limitedLine.substring(atIndex + 4).trim();
|
|
78
|
+
|
|
79
|
+
// Split by whitespace to separate function and path
|
|
80
|
+
const spaceAfterFunc = afterAt.indexOf(' ');
|
|
81
|
+
|
|
82
|
+
if (spaceAfterFunc > 0) {
|
|
83
|
+
const funcName = afterAt.substring(0, spaceAfterFunc);
|
|
84
|
+
const path = afterAt.substring(spaceAfterFunc + 1);
|
|
85
|
+
|
|
86
|
+
// Check if this is a path with line/column numbers
|
|
87
|
+
if (path.includes(':') && /.*:[0-9]+:[0-9]+/.test(path)) {
|
|
88
|
+
// Find the last segment after slash or backslash
|
|
89
|
+
const lastSlashIndex = Math.max(path.lastIndexOf('/'), path.lastIndexOf('\\'));
|
|
90
|
+
|
|
91
|
+
if (lastSlashIndex >= 0) {
|
|
92
|
+
const filename = path.substring(lastSlashIndex + 1);
|
|
93
|
+
return limitedLine.substring(0, atIndex + 4) + funcName + ' ' + filename;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return limitedLine;
|
|
100
|
+
})
|
|
101
|
+
.join('\n');
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
errorTitle: errorMessage,
|
|
105
|
+
code: sanitizedStack,
|
|
106
|
+
firstFilename: firstFilename,
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
interface ErrorBoundaryError extends Error {
|
|
111
|
+
message: string;
|
|
112
|
+
stack?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
enum ShowErrorDetails {
|
|
116
|
+
always = 'always',
|
|
117
|
+
dev = 'dev',
|
|
118
|
+
production = 'production',
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface DefaultFallbackProps extends FallbackProps {
|
|
122
|
+
error: ErrorBoundaryError;
|
|
123
|
+
context: string;
|
|
124
|
+
resetErrorBoundary: () => void;
|
|
125
|
+
showErrorDetails?: ShowErrorDetails;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface ErrorBoundaryProps {
|
|
129
|
+
context?: string;
|
|
130
|
+
onReset?: () => void;
|
|
131
|
+
onError?: (error: ErrorBoundaryError, componentStack: string, context: string) => void;
|
|
132
|
+
fallbackComponent?: React.ComponentType<DefaultFallbackProps>;
|
|
133
|
+
children: React.ReactNode;
|
|
134
|
+
fallbackRoute?: string | null;
|
|
135
|
+
isPage?: boolean;
|
|
136
|
+
showErrorDetails?: ShowErrorDetails;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const DefaultFallback = ({
|
|
140
|
+
error,
|
|
141
|
+
context,
|
|
142
|
+
resetErrorBoundary = () => {},
|
|
143
|
+
showErrorDetails,
|
|
144
|
+
}: DefaultFallbackProps) => {
|
|
145
|
+
const isShowDetailsButtonVisible =
|
|
146
|
+
showErrorDetails == null ||
|
|
147
|
+
showErrorDetails === ShowErrorDetails.always ||
|
|
148
|
+
(showErrorDetails === ShowErrorDetails.dev && !isProduction) ||
|
|
149
|
+
(showErrorDetails === ShowErrorDetails.production && isProduction);
|
|
150
|
+
|
|
151
|
+
const { t } = useTranslation('ErrorBoundary');
|
|
152
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
153
|
+
const { show } = useNotification();
|
|
154
|
+
|
|
155
|
+
const title = `${t('Something went wrong')}${!isProduction && ` ${t('in')} ${context}`}.`;
|
|
156
|
+
const subtitle = t('Sorry, something went wrong there. Try again.');
|
|
157
|
+
|
|
158
|
+
const { errorTitle, code, firstFilename } = parseErrorStack(error);
|
|
159
|
+
|
|
160
|
+
const copyErrorToClipboard = () => {
|
|
161
|
+
if (code) {
|
|
162
|
+
navigator.clipboard.writeText(code);
|
|
163
|
+
show({
|
|
164
|
+
title: t('Success'),
|
|
165
|
+
message: t('Error copied to clipboard'),
|
|
166
|
+
type: 'success',
|
|
167
|
+
duration: 3000,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
// Use a stable ID based on error message to support deduplication
|
|
174
|
+
const errorId = `error-${errorTitle || error.message}`;
|
|
175
|
+
|
|
176
|
+
// We don't need to track shown state - instead rely on the notification deduplication system
|
|
177
|
+
show({
|
|
178
|
+
title,
|
|
179
|
+
message: subtitle,
|
|
180
|
+
type: 'error',
|
|
181
|
+
duration: 0,
|
|
182
|
+
id: errorId,
|
|
183
|
+
action: isShowDetailsButtonVisible
|
|
184
|
+
? {
|
|
185
|
+
label: t('Show Details'),
|
|
186
|
+
onClick: () => setShowDetails(true),
|
|
187
|
+
}
|
|
188
|
+
: undefined,
|
|
189
|
+
});
|
|
190
|
+
}, [error, errorTitle, subtitle, t, title, show]);
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<Dialog
|
|
194
|
+
open={showDetails}
|
|
195
|
+
onOpenChange={setShowDetails}
|
|
196
|
+
>
|
|
197
|
+
<DialogTitle className="invisible">{errorTitle}</DialogTitle>
|
|
198
|
+
<DialogContent
|
|
199
|
+
className="bg-muted max-w-3xl overflow-hidden border-0 p-0"
|
|
200
|
+
onInteractOutside={e => e.preventDefault()}
|
|
201
|
+
>
|
|
202
|
+
<div className="p-5 pb-4">
|
|
203
|
+
<div className="flex items-center justify-between">
|
|
204
|
+
<h2 className="text-highlight text-xl font-normal">
|
|
205
|
+
{errorTitle || error.message || title}
|
|
206
|
+
</h2>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
{/* Code block */}
|
|
211
|
+
{code && (
|
|
212
|
+
<>
|
|
213
|
+
<ScrollArea className="bg-background text-foreground mx-6 h-[321px] rounded-b-md">
|
|
214
|
+
<div className="bg-background border-input flex items-center justify-between rounded-t-md border-b px-4 py-2">
|
|
215
|
+
<div className="text-muted-foreground text-base">
|
|
216
|
+
{firstFilename || 'Error Stack'}
|
|
217
|
+
</div>
|
|
218
|
+
<Button
|
|
219
|
+
className="w-20"
|
|
220
|
+
onClick={copyErrorToClipboard}
|
|
221
|
+
title={t('Copy error')}
|
|
222
|
+
>
|
|
223
|
+
Copy
|
|
224
|
+
</Button>
|
|
225
|
+
</div>
|
|
226
|
+
<div className="p-4 font-mono text-sm">
|
|
227
|
+
{code.split('\n').map((line, index) => (
|
|
228
|
+
<div
|
|
229
|
+
key={index}
|
|
230
|
+
className="flex"
|
|
231
|
+
>
|
|
232
|
+
<span className="whitespace-pre">{line}</span>
|
|
233
|
+
</div>
|
|
234
|
+
))}
|
|
235
|
+
</div>
|
|
236
|
+
</ScrollArea>
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
239
|
+
|
|
240
|
+
{/* Footer */}
|
|
241
|
+
<div className="flex items-center justify-end p-6 pt-2">
|
|
242
|
+
<Button
|
|
243
|
+
variant="link"
|
|
244
|
+
className="text-primary p-0"
|
|
245
|
+
onClick={() =>
|
|
246
|
+
window.open(
|
|
247
|
+
'https://github.com/OHIF/Viewers/issues/new?template=bug-report.yml',
|
|
248
|
+
'_blank'
|
|
249
|
+
)
|
|
250
|
+
}
|
|
251
|
+
>
|
|
252
|
+
Report Issue
|
|
253
|
+
</Button>
|
|
254
|
+
</div>
|
|
255
|
+
</DialogContent>
|
|
256
|
+
</Dialog>
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const ErrorBoundary = ({
|
|
261
|
+
context = 'OHIF',
|
|
262
|
+
onReset = () => {},
|
|
263
|
+
onError = _error => {},
|
|
264
|
+
fallbackComponent: FallbackComponent = DefaultFallback,
|
|
265
|
+
children,
|
|
266
|
+
showErrorDetails,
|
|
267
|
+
}: ErrorBoundaryProps) => {
|
|
268
|
+
const [error, setError] = useState<ErrorBoundaryError | null>(null);
|
|
269
|
+
|
|
270
|
+
const onResetHandler = () => {
|
|
271
|
+
setError(null);
|
|
272
|
+
onReset();
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Declared above the effect that calls it: the effect body only runs after
|
|
276
|
+
// render, but a reference that textually precedes its declaration is something
|
|
277
|
+
// the compiler refuses to reason about.
|
|
278
|
+
const onErrorHandler = (
|
|
279
|
+
error: ErrorBoundaryError | ErrorEvent,
|
|
280
|
+
componentStack: string | null
|
|
281
|
+
) => {
|
|
282
|
+
console.debug(`${context} Error Boundary`, error, componentStack, context);
|
|
283
|
+
onError(error, componentStack || '', context);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// Add error event listener to window
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
let errorTimeout: NodeJS.Timeout;
|
|
289
|
+
|
|
290
|
+
const handleError = (event: ErrorEvent) => {
|
|
291
|
+
clearTimeout(errorTimeout);
|
|
292
|
+
errorTimeout = setTimeout(() => {
|
|
293
|
+
setError(event.error);
|
|
294
|
+
onErrorHandler(event.error, null);
|
|
295
|
+
}, 100);
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const handleRejection = (event: PromiseRejectionEvent) => {
|
|
299
|
+
event.preventDefault();
|
|
300
|
+
clearTimeout(errorTimeout);
|
|
301
|
+
errorTimeout = setTimeout(() => {
|
|
302
|
+
setError(event.reason || event);
|
|
303
|
+
onErrorHandler(event.reason || event, null);
|
|
304
|
+
}, 100);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
window.addEventListener('error', handleError);
|
|
308
|
+
window.addEventListener('unhandledrejection', handleRejection);
|
|
309
|
+
|
|
310
|
+
return () => {
|
|
311
|
+
clearTimeout(errorTimeout);
|
|
312
|
+
window.removeEventListener('error', handleError);
|
|
313
|
+
window.removeEventListener('unhandledrejection', handleRejection);
|
|
314
|
+
};
|
|
315
|
+
}, []);
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<ReactErrorBoundary
|
|
320
|
+
fallbackRender={props => (
|
|
321
|
+
<FallbackComponent
|
|
322
|
+
{...props}
|
|
323
|
+
context={context}
|
|
324
|
+
showErrorDetails={showErrorDetails}
|
|
325
|
+
/>
|
|
326
|
+
)}
|
|
327
|
+
onReset={onResetHandler}
|
|
328
|
+
onError={(error, info) => onErrorHandler(error as ErrorBoundaryError, info.componentStack)}
|
|
329
|
+
>
|
|
330
|
+
<>
|
|
331
|
+
{children}
|
|
332
|
+
{error && (
|
|
333
|
+
<FallbackComponent
|
|
334
|
+
error={error}
|
|
335
|
+
context={context}
|
|
336
|
+
resetErrorBoundary={() => setError(null)}
|
|
337
|
+
showErrorDetails={showErrorDetails}
|
|
338
|
+
/>
|
|
339
|
+
)}
|
|
340
|
+
</>
|
|
341
|
+
</ReactErrorBoundary>
|
|
342
|
+
);
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, ButtonProps } from '../Button/Button';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
interface FooterActionProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ActionProps extends ButtonProps {
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type FooterActionComponent = React.FC<FooterActionProps> & {
|
|
16
|
+
Left: React.FC<FooterActionProps>;
|
|
17
|
+
Right: React.FC<FooterActionProps>;
|
|
18
|
+
Primary: React.FC<ActionProps>;
|
|
19
|
+
Secondary: React.FC<ActionProps>;
|
|
20
|
+
Auxiliary: React.FC<ActionProps>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const FooterAction: FooterActionComponent = ({ children, className }: FooterActionProps) => {
|
|
24
|
+
// Convert children to array for easier inspection
|
|
25
|
+
const arrayChildren = React.Children.toArray(children);
|
|
26
|
+
|
|
27
|
+
// Check if we have a <FooterAction.Left> or <FooterAction.Right> among children
|
|
28
|
+
const hasLeft = arrayChildren.some(
|
|
29
|
+
(child: any) => child.type?.displayName === 'FooterAction.Left'
|
|
30
|
+
);
|
|
31
|
+
const hasRight = arrayChildren.some(
|
|
32
|
+
(child: any) => child.type?.displayName === 'FooterAction.Right'
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// Decide on the justification class based on presence of Left/Right
|
|
36
|
+
let justifyClass = 'justify-between'; // default
|
|
37
|
+
if (hasLeft && !hasRight) {
|
|
38
|
+
justifyClass = 'justify-start';
|
|
39
|
+
} else if (!hasLeft && hasRight) {
|
|
40
|
+
justifyClass = 'justify-end';
|
|
41
|
+
}
|
|
42
|
+
// If both or neither are present, keep justify-between (or adjust if you like)
|
|
43
|
+
return (
|
|
44
|
+
<div className={cn('flex w-full flex-shrink-0 items-center', justifyClass, className)}>
|
|
45
|
+
{children}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
FooterAction.displayName = 'FooterAction';
|
|
51
|
+
|
|
52
|
+
FooterAction.Left = ({ children }: FooterActionProps) => {
|
|
53
|
+
return <div className="flex items-center">{children}</div>;
|
|
54
|
+
};
|
|
55
|
+
FooterAction.Left.displayName = 'FooterAction.Left';
|
|
56
|
+
|
|
57
|
+
FooterAction.Right = ({ children }: FooterActionProps) => {
|
|
58
|
+
return <div className="flex items-center space-x-2">{children}</div>;
|
|
59
|
+
};
|
|
60
|
+
FooterAction.Right.displayName = 'FooterAction.Right';
|
|
61
|
+
|
|
62
|
+
// Primary action: Solid button (default)
|
|
63
|
+
FooterAction.Primary = ({
|
|
64
|
+
children,
|
|
65
|
+
onClick,
|
|
66
|
+
className = 'min-w-[80px]',
|
|
67
|
+
...rest
|
|
68
|
+
}: ActionProps) => {
|
|
69
|
+
return (
|
|
70
|
+
<Button
|
|
71
|
+
variant="default"
|
|
72
|
+
onClick={onClick}
|
|
73
|
+
className={className}
|
|
74
|
+
{...rest}
|
|
75
|
+
>
|
|
76
|
+
{children}
|
|
77
|
+
</Button>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
FooterAction.Primary.displayName = 'FooterAction.Primary';
|
|
81
|
+
|
|
82
|
+
// Secondary action: Ghost button
|
|
83
|
+
FooterAction.Secondary = ({
|
|
84
|
+
children,
|
|
85
|
+
onClick,
|
|
86
|
+
className = 'min-w-[80px]',
|
|
87
|
+
...rest
|
|
88
|
+
}: ActionProps) => {
|
|
89
|
+
return (
|
|
90
|
+
<Button
|
|
91
|
+
variant="secondary"
|
|
92
|
+
onClick={onClick}
|
|
93
|
+
className={className}
|
|
94
|
+
{...rest}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
</Button>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
FooterAction.Secondary.displayName = 'FooterAction.Secondary';
|
|
101
|
+
|
|
102
|
+
// Tertiary action: Ghost button with different styling
|
|
103
|
+
FooterAction.Auxiliary = ({ children, onClick, className, ...rest }: ActionProps) => {
|
|
104
|
+
return (
|
|
105
|
+
<Button
|
|
106
|
+
variant="ghost"
|
|
107
|
+
onClick={onClick}
|
|
108
|
+
className={className}
|
|
109
|
+
{...rest}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</Button>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
FooterAction.Auxiliary.displayName = 'FooterAction.Auxiliary';
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import {
|
|
4
|
+
DropdownMenu,
|
|
5
|
+
DropdownMenuTrigger,
|
|
6
|
+
DropdownMenuContent,
|
|
7
|
+
DropdownMenuItem,
|
|
8
|
+
Icons,
|
|
9
|
+
Button,
|
|
10
|
+
ToolButton,
|
|
11
|
+
} from '../';
|
|
12
|
+
import { IconPresentationProvider } from '@ohif/ui-next';
|
|
13
|
+
|
|
14
|
+
import NavBar from '../NavBar';
|
|
15
|
+
|
|
16
|
+
// Todo: we should move this component to composition and remove props base
|
|
17
|
+
|
|
18
|
+
interface HeaderProps {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
menuOptions: Array<{
|
|
21
|
+
title: string;
|
|
22
|
+
icon?: string;
|
|
23
|
+
onClick: () => void;
|
|
24
|
+
}>;
|
|
25
|
+
isReturnEnabled?: boolean;
|
|
26
|
+
onClickReturnButton?: () => void;
|
|
27
|
+
isSticky?: boolean;
|
|
28
|
+
WhiteLabeling?: {
|
|
29
|
+
createLogoComponentFn?: (React: any, props: any) => ReactNode;
|
|
30
|
+
};
|
|
31
|
+
Secondary?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Ordered slots filling the right of the menu bar, ahead of the settings
|
|
34
|
+
* menu — patient info, undo/redo, whatever a site puts there. Each is
|
|
35
|
+
* followed by a separator, and a slot whose content renders nothing takes
|
|
36
|
+
* its separator with it.
|
|
37
|
+
*/
|
|
38
|
+
RightSide?: ReactNode[];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Header({
|
|
42
|
+
children,
|
|
43
|
+
menuOptions,
|
|
44
|
+
isReturnEnabled = true,
|
|
45
|
+
onClickReturnButton,
|
|
46
|
+
isSticky = false,
|
|
47
|
+
WhiteLabeling,
|
|
48
|
+
RightSide = [],
|
|
49
|
+
Secondary,
|
|
50
|
+
...props
|
|
51
|
+
}: HeaderProps): ReactNode {
|
|
52
|
+
const onClickReturn = () => {
|
|
53
|
+
if (isReturnEnabled && onClickReturnButton) {
|
|
54
|
+
onClickReturnButton();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<IconPresentationProvider
|
|
60
|
+
size="large"
|
|
61
|
+
IconContainer={ToolButton}
|
|
62
|
+
>
|
|
63
|
+
<NavBar
|
|
64
|
+
isSticky={isSticky}
|
|
65
|
+
{...props}
|
|
66
|
+
>
|
|
67
|
+
<div className="relative h-[48px] items-center">
|
|
68
|
+
<div className="absolute left-0 top-1/2 flex -translate-y-1/2 items-center">
|
|
69
|
+
<div
|
|
70
|
+
className={classNames(
|
|
71
|
+
'mr-3 inline-flex items-center',
|
|
72
|
+
isReturnEnabled && 'cursor-pointer'
|
|
73
|
+
)}
|
|
74
|
+
onClick={onClickReturn}
|
|
75
|
+
data-cy="return-to-work-list"
|
|
76
|
+
>
|
|
77
|
+
{isReturnEnabled && <Icons.ArrowLeft className="text-primary ml-1 h-7 w-7" />}
|
|
78
|
+
<div className="ml-1">
|
|
79
|
+
{WhiteLabeling?.createLogoComponentFn?.(React, props) || <Icons.OHIFLogo />}
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
<div className="absolute top-1/2 left-[250px] h-8 -translate-y-1/2">{Secondary}</div>
|
|
84
|
+
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform">
|
|
85
|
+
<div className="flex items-center justify-center space-x-2">{children}</div>
|
|
86
|
+
</div>
|
|
87
|
+
<div className="absolute right-0 top-1/2 flex -translate-y-1/2 select-none items-center">
|
|
88
|
+
{RightSide.map((item, index) => (
|
|
89
|
+
// The separator is an `::after` so that `empty:hidden` can drop
|
|
90
|
+
// the whole slot — separator included — when the item rendered
|
|
91
|
+
// nothing (e.g. patient info with `showPatientInfo: 'disabled'`).
|
|
92
|
+
<div
|
|
93
|
+
key={index}
|
|
94
|
+
className="after:border-muted flex items-center empty:hidden after:mx-1.5 after:h-[25px] after:border-r after:content-['']"
|
|
95
|
+
>
|
|
96
|
+
{item}
|
|
97
|
+
</div>
|
|
98
|
+
))}
|
|
99
|
+
<div className="flex-shrink-0">
|
|
100
|
+
<DropdownMenu>
|
|
101
|
+
<DropdownMenuTrigger asChild>
|
|
102
|
+
<Button
|
|
103
|
+
variant="ghost"
|
|
104
|
+
size="icon"
|
|
105
|
+
className="text-primary hover:bg-muted mt-2 h-full w-full"
|
|
106
|
+
>
|
|
107
|
+
<Icons.GearSettings />
|
|
108
|
+
</Button>
|
|
109
|
+
</DropdownMenuTrigger>
|
|
110
|
+
<DropdownMenuContent align="end">
|
|
111
|
+
{menuOptions.map((option, index) => {
|
|
112
|
+
const IconComponent = option.icon
|
|
113
|
+
? Icons[option.icon as keyof typeof Icons]
|
|
114
|
+
: null;
|
|
115
|
+
return (
|
|
116
|
+
<DropdownMenuItem
|
|
117
|
+
key={index}
|
|
118
|
+
onSelect={option.onClick}
|
|
119
|
+
className="flex items-center gap-2 py-2"
|
|
120
|
+
>
|
|
121
|
+
{IconComponent && (
|
|
122
|
+
<span className="flex h-4 w-4 items-center justify-center">
|
|
123
|
+
<Icons.ByName name={option.icon} />
|
|
124
|
+
</span>
|
|
125
|
+
)}
|
|
126
|
+
<span className="flex-1">{option.title}</span>
|
|
127
|
+
</DropdownMenuItem>
|
|
128
|
+
);
|
|
129
|
+
})}
|
|
130
|
+
</DropdownMenuContent>
|
|
131
|
+
</DropdownMenu>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</NavBar>
|
|
136
|
+
</IconPresentationProvider>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export default Header;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
const HoverCardContent = ({
|
|
11
|
+
className,
|
|
12
|
+
align = 'center',
|
|
13
|
+
sideOffset = 4,
|
|
14
|
+
ref,
|
|
15
|
+
...props
|
|
16
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) => (
|
|
17
|
+
<HoverCardPrimitive.Content
|
|
18
|
+
ref={ref}
|
|
19
|
+
align={align}
|
|
20
|
+
sideOffset={sideOffset}
|
|
21
|
+
className={cn(
|
|
22
|
+
'bg-muted text-muted-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-input z-50 w-64 rounded-md border p-4 shadow-md outline-none',
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
29
|
+
|
|
30
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HoverCard';
|