@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, { createContext, useContext, useState } from 'react';
|
|
2
|
+
import { Popover, PopoverTrigger, PopoverContent } from '../Popover/Popover';
|
|
3
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { Icons } from '../Icons';
|
|
7
|
+
|
|
8
|
+
// Types
|
|
9
|
+
type LayoutCommandOptions = {
|
|
10
|
+
numRows?: number;
|
|
11
|
+
numCols?: number;
|
|
12
|
+
protocolId?: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type LayoutPresetType = {
|
|
17
|
+
title?: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
commandOptions: LayoutCommandOptions;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Context
|
|
24
|
+
type LayoutSelectorContextType = {
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
27
|
+
onSelection: (commandOptions: LayoutCommandOptions) => void;
|
|
28
|
+
onSelectionPreset: (commandOptions: LayoutCommandOptions) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const LayoutSelectorContext = createContext<LayoutSelectorContextType | undefined>(undefined);
|
|
32
|
+
|
|
33
|
+
const useLayoutSelector = () => {
|
|
34
|
+
const context = useContext(LayoutSelectorContext);
|
|
35
|
+
if (context === undefined) {
|
|
36
|
+
throw new Error('useLayoutSelector must be used within a LayoutSelector component');
|
|
37
|
+
}
|
|
38
|
+
return context;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Main component
|
|
42
|
+
type LayoutSelectorProps = {
|
|
43
|
+
onSelectionChange?: (commandOptions: LayoutCommandOptions, isPreset: boolean) => void;
|
|
44
|
+
onSelection?: (commandOptions: LayoutCommandOptions) => void;
|
|
45
|
+
onSelectionPreset?: (commandOptions: LayoutCommandOptions) => void;
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
open?: boolean;
|
|
48
|
+
onOpenChange?: (open: boolean) => void;
|
|
49
|
+
tooltipDisabled?: boolean; // Keep this prop for now as it might be used elsewhere
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const LayoutSelector = ({
|
|
53
|
+
onSelectionChange,
|
|
54
|
+
onSelection = commandOptions => {},
|
|
55
|
+
onSelectionPreset = commandOptions => {},
|
|
56
|
+
children,
|
|
57
|
+
open,
|
|
58
|
+
onOpenChange,
|
|
59
|
+
tooltipDisabled,
|
|
60
|
+
}: LayoutSelectorProps) => {
|
|
61
|
+
const [isOpenInternal, setIsOpenInternal] = useState(false);
|
|
62
|
+
|
|
63
|
+
const isControlled = open !== undefined;
|
|
64
|
+
const isOpen = isControlled ? open : isOpenInternal;
|
|
65
|
+
const setIsOpen = isControlled ? onOpenChange! : setIsOpenInternal;
|
|
66
|
+
|
|
67
|
+
const handleSelection = (commandOptions: LayoutCommandOptions) => {
|
|
68
|
+
onSelection(commandOptions);
|
|
69
|
+
if (onSelectionChange) {
|
|
70
|
+
onSelectionChange(commandOptions, false);
|
|
71
|
+
}
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handlePresetSelection = (commandOptions: LayoutCommandOptions) => {
|
|
76
|
+
onSelectionPreset(commandOptions);
|
|
77
|
+
if (onSelectionChange) {
|
|
78
|
+
onSelectionChange(commandOptions, true);
|
|
79
|
+
}
|
|
80
|
+
setIsOpen(false);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<LayoutSelectorContext.Provider
|
|
85
|
+
value={{
|
|
86
|
+
isOpen,
|
|
87
|
+
setIsOpen,
|
|
88
|
+
onSelection: handleSelection,
|
|
89
|
+
onSelectionPreset: handlePresetSelection,
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<Popover
|
|
93
|
+
open={isOpen}
|
|
94
|
+
onOpenChange={setIsOpen}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
</Popover>
|
|
98
|
+
</LayoutSelectorContext.Provider>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// Sub-components
|
|
103
|
+
type TriggerProps = {
|
|
104
|
+
children?: React.ReactNode;
|
|
105
|
+
className?: string;
|
|
106
|
+
tooltip?: string;
|
|
107
|
+
disabled?: boolean;
|
|
108
|
+
disabledText?: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const Trigger = ({
|
|
112
|
+
children,
|
|
113
|
+
className,
|
|
114
|
+
tooltip = 'Change layout',
|
|
115
|
+
disabled = false,
|
|
116
|
+
disabledText,
|
|
117
|
+
}: TriggerProps) => {
|
|
118
|
+
const { isOpen } = useLayoutSelector();
|
|
119
|
+
|
|
120
|
+
const hasTooltip = tooltip || (disabled && disabledText);
|
|
121
|
+
|
|
122
|
+
const button = (
|
|
123
|
+
<Button
|
|
124
|
+
className={cn(
|
|
125
|
+
'inline-flex h-10 w-10 items-center justify-center !rounded-lg',
|
|
126
|
+
disabled
|
|
127
|
+
? 'text-foreground/80 hover:bg-muted hover:text-highlight cursor-not-allowed opacity-40'
|
|
128
|
+
: isOpen
|
|
129
|
+
? 'bg-background text-foreground/80'
|
|
130
|
+
: 'text-foreground/80 hover:bg-background hover:text-highlight bg-transparent',
|
|
131
|
+
className
|
|
132
|
+
)}
|
|
133
|
+
variant="ghost"
|
|
134
|
+
size="icon"
|
|
135
|
+
aria-label={tooltip}
|
|
136
|
+
disabled={disabled}
|
|
137
|
+
>
|
|
138
|
+
<Icons.ByName
|
|
139
|
+
name="tool-layout"
|
|
140
|
+
className="h-7 w-7"
|
|
141
|
+
/>
|
|
142
|
+
</Button>
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// If user passed children (custom button), just wrap it directly
|
|
146
|
+
if (children) {
|
|
147
|
+
return (
|
|
148
|
+
<PopoverTrigger
|
|
149
|
+
asChild
|
|
150
|
+
className={className}
|
|
151
|
+
>
|
|
152
|
+
{children}
|
|
153
|
+
</PopoverTrigger>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (!isOpen && hasTooltip) {
|
|
158
|
+
return (
|
|
159
|
+
<Tooltip>
|
|
160
|
+
<TooltipTrigger asChild>
|
|
161
|
+
<PopoverTrigger asChild>
|
|
162
|
+
<span data-cy="layout-button">{button}</span>
|
|
163
|
+
</PopoverTrigger>
|
|
164
|
+
</TooltipTrigger>
|
|
165
|
+
<TooltipContent side="bottom">
|
|
166
|
+
{tooltip && <div>{tooltip}</div>}
|
|
167
|
+
{disabled && disabledText && <div className="text-muted-foreground">{disabledText}</div>}
|
|
168
|
+
</TooltipContent>
|
|
169
|
+
</Tooltip>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<PopoverTrigger asChild>
|
|
175
|
+
<span data-cy="layout-button">{button}</span>
|
|
176
|
+
</PopoverTrigger>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
type ContentProps = {
|
|
181
|
+
children: React.ReactNode;
|
|
182
|
+
className?: string;
|
|
183
|
+
align?: 'center' | 'start' | 'end';
|
|
184
|
+
sideOffset?: number;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const Content = ({ children, className, align = 'center', sideOffset = 8 }: ContentProps) => {
|
|
188
|
+
return (
|
|
189
|
+
<PopoverContent
|
|
190
|
+
align={align}
|
|
191
|
+
sideOffset={sideOffset}
|
|
192
|
+
className={cn('w-auto rounded-lg border-none p-0 shadow-lg', className)}
|
|
193
|
+
>
|
|
194
|
+
<div className="flex">{children}</div>
|
|
195
|
+
</PopoverContent>
|
|
196
|
+
);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
type PresetSectionProps = {
|
|
200
|
+
children: React.ReactNode;
|
|
201
|
+
title: string;
|
|
202
|
+
className?: string;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const PresetSection = ({ children, title, className }: PresetSectionProps) => {
|
|
206
|
+
return (
|
|
207
|
+
<div className={cn('flex flex-col gap-2', className)}>
|
|
208
|
+
<div className="text-muted-foreground text-xs">{title}</div>
|
|
209
|
+
{React.Children.count(children) > 0 && (
|
|
210
|
+
<div
|
|
211
|
+
className={cn(title.toLowerCase() === 'common' ? 'flex gap-2' : 'flex flex-col gap-0')}
|
|
212
|
+
>
|
|
213
|
+
{children}
|
|
214
|
+
</div>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
type PresetProps = LayoutPresetType & {
|
|
221
|
+
className?: string;
|
|
222
|
+
isPreset?: boolean;
|
|
223
|
+
iconSize?: string; // Add new prop for icon size
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const Preset = ({
|
|
227
|
+
title,
|
|
228
|
+
icon,
|
|
229
|
+
commandOptions,
|
|
230
|
+
disabled = false,
|
|
231
|
+
className,
|
|
232
|
+
isPreset = false,
|
|
233
|
+
iconSize, // New prop
|
|
234
|
+
}: PresetProps) => {
|
|
235
|
+
const { onSelection, onSelectionPreset } = useLayoutSelector();
|
|
236
|
+
|
|
237
|
+
const handleClick = () => {
|
|
238
|
+
if (disabled) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (isPreset) {
|
|
243
|
+
onSelectionPreset(commandOptions);
|
|
244
|
+
} else {
|
|
245
|
+
onSelection(commandOptions);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div
|
|
251
|
+
className={cn(
|
|
252
|
+
'group cursor-pointer rounded transition',
|
|
253
|
+
'hover:bg-accent flex items-center gap-2 p-1.5',
|
|
254
|
+
disabled && 'pointer-events-none opacity-50',
|
|
255
|
+
className
|
|
256
|
+
)}
|
|
257
|
+
onClick={handleClick}
|
|
258
|
+
data-cy={title}
|
|
259
|
+
>
|
|
260
|
+
<div className="flex-shrink-0">
|
|
261
|
+
<Icons.ByName
|
|
262
|
+
name={icon}
|
|
263
|
+
className={cn('group-hover:text-primary', iconSize)}
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
{title && <div className="text-foreground text-base">{title}</div>}
|
|
267
|
+
</div>
|
|
268
|
+
);
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
type GridSelectorProps = {
|
|
272
|
+
rows?: number;
|
|
273
|
+
columns?: number;
|
|
274
|
+
className?: string;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const GridSelector = ({ rows = 3, columns = 4, className }: GridSelectorProps) => {
|
|
278
|
+
const [hoveredIndex, setHoveredIndex] = useState<number | undefined>(undefined);
|
|
279
|
+
const { onSelection } = useLayoutSelector();
|
|
280
|
+
|
|
281
|
+
const hoverX = hoveredIndex !== undefined ? hoveredIndex % columns : -1;
|
|
282
|
+
const hoverY = hoveredIndex !== undefined ? Math.floor(hoveredIndex / columns) : -1;
|
|
283
|
+
|
|
284
|
+
const isHovered = (index: number) => {
|
|
285
|
+
if (hoveredIndex === undefined) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
const x = index % columns;
|
|
289
|
+
const y = Math.floor(index / columns);
|
|
290
|
+
|
|
291
|
+
return x <= hoverX && y <= hoverY;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const handleSelection = (index: number) => {
|
|
295
|
+
const x = index % columns;
|
|
296
|
+
const y = Math.floor(index / columns);
|
|
297
|
+
onSelection({
|
|
298
|
+
numRows: y + 1,
|
|
299
|
+
numCols: x + 1,
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
return (
|
|
304
|
+
<div
|
|
305
|
+
className={cn(className)}
|
|
306
|
+
style={{
|
|
307
|
+
display: 'grid',
|
|
308
|
+
gridTemplateColumns: `repeat(${columns}, 20px)`,
|
|
309
|
+
gridTemplateRows: `repeat(${rows}, 20px)`,
|
|
310
|
+
gap: '2px',
|
|
311
|
+
}}
|
|
312
|
+
>
|
|
313
|
+
{Array.from(Array(rows * columns).keys()).map(index => (
|
|
314
|
+
<div
|
|
315
|
+
key={index}
|
|
316
|
+
className={cn('cursor-pointer', isHovered(index) ? 'bg-primary' : 'bg-accent')}
|
|
317
|
+
data-cy={`Layout-${index % columns}-${Math.floor(index / columns)}`}
|
|
318
|
+
onClick={() => handleSelection(index)}
|
|
319
|
+
onMouseEnter={() => setHoveredIndex(index)}
|
|
320
|
+
onMouseLeave={() => setHoveredIndex(undefined)}
|
|
321
|
+
/>
|
|
322
|
+
))}
|
|
323
|
+
</div>
|
|
324
|
+
);
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
const Divider = ({ className }: { className?: string }) => (
|
|
328
|
+
<div className={cn('h-px bg-background', className)}></div>
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
const HelpText = ({ children, className }: { children: React.ReactNode; className?: string }) => (
|
|
332
|
+
<p className={cn('text-muted-foreground text-xs leading-tight', className)}>{children}</p>
|
|
333
|
+
);
|
|
334
|
+
|
|
335
|
+
// Assemble the compound component
|
|
336
|
+
LayoutSelector.Trigger = Trigger;
|
|
337
|
+
LayoutSelector.Content = Content;
|
|
338
|
+
LayoutSelector.PresetSection = PresetSection;
|
|
339
|
+
LayoutSelector.Preset = Preset;
|
|
340
|
+
LayoutSelector.GridSelector = GridSelector;
|
|
341
|
+
LayoutSelector.Divider = Divider;
|
|
342
|
+
LayoutSelector.HelpText = HelpText;
|
|
343
|
+
|
|
344
|
+
export { LayoutSelector };
|
|
345
|
+
export default LayoutSelector;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.LineChart svg {
|
|
2
|
+
color: #ddd;
|
|
3
|
+
border: solid 1px #383f42;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.LineChart svg .background {
|
|
7
|
+
stroke: none;
|
|
8
|
+
fill: #151c20;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.LineChart svg .axis.label {
|
|
12
|
+
fill: #ddd;
|
|
13
|
+
font-size: 12px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.LineChart svg .axis .tick line {
|
|
17
|
+
stroke: #ddd;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.LineChart svg .axis .tick text {
|
|
21
|
+
fill: #ddd;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.LineChart svg .axis.grid .domain {
|
|
25
|
+
stroke: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.LineChart svg .axis.grid .tick line {
|
|
29
|
+
stroke: #383f42;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.LineChart svg .line {
|
|
33
|
+
stroke-width: 1px;
|
|
34
|
+
fill: none;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.LineChart svg .legend .legend-background {
|
|
38
|
+
fill: none;
|
|
39
|
+
stroke: #383f42;
|
|
40
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useEffect, useLayoutEffect, useState, useRef, type JSX } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import * as d3Selection from 'd3-selection';
|
|
4
|
+
import { lineChart } from './d3LineChart';
|
|
5
|
+
import './LineChart.css';
|
|
6
|
+
|
|
7
|
+
const LineChart = ({
|
|
8
|
+
width: widthProp,
|
|
9
|
+
height: heightProp,
|
|
10
|
+
axis,
|
|
11
|
+
series,
|
|
12
|
+
showAxisLabels = true,
|
|
13
|
+
showAxisGrid = true,
|
|
14
|
+
showLegend = false,
|
|
15
|
+
legendWidth = 120,
|
|
16
|
+
transparentChartBackground = false,
|
|
17
|
+
containerClassName,
|
|
18
|
+
chartContainerClassName,
|
|
19
|
+
}: {
|
|
20
|
+
title: string;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
showAxisGrid: boolean;
|
|
24
|
+
showAxisLabels: boolean;
|
|
25
|
+
showLegend: boolean;
|
|
26
|
+
legendWidth: number;
|
|
27
|
+
transparentChartBackground: boolean;
|
|
28
|
+
containerClassName: string;
|
|
29
|
+
chartContainerClassName: string;
|
|
30
|
+
}): JSX.Element => {
|
|
31
|
+
const chartContainerRef = useRef(null);
|
|
32
|
+
const [d3SVGContainer, setD3SVGRef] = useState(null);
|
|
33
|
+
const [width, setWidth] = useState(0);
|
|
34
|
+
const [height, setHeight] = useState(0);
|
|
35
|
+
|
|
36
|
+
useLayoutEffect(() => {
|
|
37
|
+
const chartContainer = chartContainerRef.current;
|
|
38
|
+
const containerWidth = chartContainer.offsetWidth;
|
|
39
|
+
const containerHeight = chartContainer.offsetHeight;
|
|
40
|
+
const d3Container = d3Selection
|
|
41
|
+
.create('svg')
|
|
42
|
+
.attr('viewBox', [0, 0, containerWidth, containerHeight])
|
|
43
|
+
.style('max-width', `${containerWidth}px`)
|
|
44
|
+
.style('overflow', 'visible');
|
|
45
|
+
|
|
46
|
+
chartContainer.append(d3Container.node());
|
|
47
|
+
|
|
48
|
+
setD3SVGRef(d3Container);
|
|
49
|
+
setWidth(containerWidth);
|
|
50
|
+
setHeight(containerHeight);
|
|
51
|
+
}, [chartContainerRef]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!d3SVGContainer) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
lineChart.addLineChartNode({
|
|
59
|
+
d3SVGRef: d3SVGContainer,
|
|
60
|
+
axis,
|
|
61
|
+
series,
|
|
62
|
+
width,
|
|
63
|
+
height,
|
|
64
|
+
showAxisLabels,
|
|
65
|
+
showAxisGrid,
|
|
66
|
+
showLegend,
|
|
67
|
+
legendWidth,
|
|
68
|
+
transparentChartBackground,
|
|
69
|
+
});
|
|
70
|
+
}, [
|
|
71
|
+
d3SVGContainer,
|
|
72
|
+
axis,
|
|
73
|
+
series,
|
|
74
|
+
width,
|
|
75
|
+
height,
|
|
76
|
+
showAxisLabels,
|
|
77
|
+
showAxisGrid,
|
|
78
|
+
transparentChartBackground,
|
|
79
|
+
showLegend,
|
|
80
|
+
legendWidth,
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div
|
|
85
|
+
className={classnames(
|
|
86
|
+
'LineChart text-foreground',
|
|
87
|
+
widthProp ? `w-[${widthProp}px]` : 'w-full',
|
|
88
|
+
heightProp ? `h-[${heightProp}px]` : 'h-full',
|
|
89
|
+
containerClassName
|
|
90
|
+
)}
|
|
91
|
+
>
|
|
92
|
+
<div
|
|
93
|
+
id="chartContainer"
|
|
94
|
+
ref={chartContainerRef}
|
|
95
|
+
className={classnames('h-full w-full', chartContainerClassName)}
|
|
96
|
+
></div>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default LineChart;
|