@ohif/ui-next 3.14.0-beta.1 → 3.14.0-beta.100
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 +7 -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 +15 -0
- package/src/components/SegmentationTable/index.ts +24 -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 +323 -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,253 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import RowInputRange from './RowInputRange';
|
|
3
|
+
import RowSegmentedControl from './RowSegmentedControl';
|
|
4
|
+
import RowDoubleRange from './RowDoubleRange';
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { Checkbox } from '../Checkbox/Checkbox';
|
|
7
|
+
import { Label } from '../Label';
|
|
8
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../Select';
|
|
9
|
+
import { Switch } from '../Switch';
|
|
10
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from '../Tooltip';
|
|
11
|
+
|
|
12
|
+
const SETTING_TYPES = {
|
|
13
|
+
RANGE: 'range',
|
|
14
|
+
RADIO: 'radio',
|
|
15
|
+
CUSTOM: 'custom',
|
|
16
|
+
DOUBLE_RANGE: 'double-range',
|
|
17
|
+
BUTTON: 'button',
|
|
18
|
+
CHECKBOX: 'checkbox',
|
|
19
|
+
SWITCH: 'switch',
|
|
20
|
+
SELECT: 'select',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function ToolSettings({ options }) {
|
|
24
|
+
if (!options) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof options === 'function') {
|
|
29
|
+
const OptionsComponent = options;
|
|
30
|
+
return <OptionsComponent />;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div className="text-foreground space-y-2 pb-4">
|
|
35
|
+
{options?.map(option => {
|
|
36
|
+
if (option.condition && option.condition?.({ options }) === false) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
switch (option.type) {
|
|
41
|
+
case SETTING_TYPES.RANGE:
|
|
42
|
+
return renderRangeSetting(option);
|
|
43
|
+
case SETTING_TYPES.RADIO:
|
|
44
|
+
return renderRadioSetting(option);
|
|
45
|
+
case SETTING_TYPES.DOUBLE_RANGE:
|
|
46
|
+
return renderDoubleRangeSetting(option);
|
|
47
|
+
case SETTING_TYPES.CUSTOM:
|
|
48
|
+
return renderCustomSetting(option);
|
|
49
|
+
case SETTING_TYPES.BUTTON:
|
|
50
|
+
return renderButtonSetting(option);
|
|
51
|
+
case SETTING_TYPES.CHECKBOX:
|
|
52
|
+
return renderCheckboxSetting(option);
|
|
53
|
+
case SETTING_TYPES.SWITCH:
|
|
54
|
+
return renderSwitchSetting(option);
|
|
55
|
+
case SETTING_TYPES.SELECT:
|
|
56
|
+
return renderSelectSetting(option);
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
})}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const renderLabelWithTooltip = (label: React.ReactNode, tooltip?: string) => {
|
|
66
|
+
if (!label) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!tooltip) {
|
|
71
|
+
return <span>{label}</span>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Tooltip>
|
|
76
|
+
<TooltipTrigger asChild>
|
|
77
|
+
<span className="cursor-help">{label}</span>
|
|
78
|
+
</TooltipTrigger>
|
|
79
|
+
<TooltipContent side="top">{tooltip}</TooltipContent>
|
|
80
|
+
</Tooltip>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const renderRangeSetting = option => {
|
|
85
|
+
return (
|
|
86
|
+
<div
|
|
87
|
+
className="flex items-center"
|
|
88
|
+
key={option.id}
|
|
89
|
+
>
|
|
90
|
+
<div className="w-1/3 text-[13px]">{renderLabelWithTooltip(option.name, option.tooltip)}</div>
|
|
91
|
+
<div
|
|
92
|
+
className="w-2/3"
|
|
93
|
+
data-cy={option.id}
|
|
94
|
+
>
|
|
95
|
+
<RowInputRange
|
|
96
|
+
minValue={option.min}
|
|
97
|
+
maxValue={option.max}
|
|
98
|
+
step={option.step}
|
|
99
|
+
value={option.value}
|
|
100
|
+
onChange={value => option.onChange?.(value)}
|
|
101
|
+
allowNumberEdit={true}
|
|
102
|
+
inputClassName="ml-1 w-4/5 cursor-pointer"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const renderRadioSetting = option => {
|
|
110
|
+
return (
|
|
111
|
+
<RowSegmentedControl
|
|
112
|
+
key={option.id}
|
|
113
|
+
option={option}
|
|
114
|
+
onChange={option.onChange}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function renderDoubleRangeSetting(option) {
|
|
120
|
+
return (
|
|
121
|
+
<div
|
|
122
|
+
key={option.id}
|
|
123
|
+
data-cy={option.id}
|
|
124
|
+
>
|
|
125
|
+
<RowDoubleRange
|
|
126
|
+
values={option.value}
|
|
127
|
+
onChange={option.onChange}
|
|
128
|
+
minValue={option.min}
|
|
129
|
+
maxValue={option.max}
|
|
130
|
+
allowTypedExpansion={option.allowTypedExpansion}
|
|
131
|
+
step={option.step}
|
|
132
|
+
showLabel={false}
|
|
133
|
+
tooltip={option.tooltip}
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const renderCustomSetting = option => {
|
|
140
|
+
return (
|
|
141
|
+
<div key={option.id}>
|
|
142
|
+
{typeof option.children === 'function' ? option.children() : option.children}
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const renderButtonSetting = option => {
|
|
148
|
+
const button = (
|
|
149
|
+
<Button
|
|
150
|
+
key={option.id}
|
|
151
|
+
variant={option.variant || 'ghost'}
|
|
152
|
+
className={option.className || ''}
|
|
153
|
+
onClick={() => option.onChange()}
|
|
154
|
+
>
|
|
155
|
+
{option.name}
|
|
156
|
+
</Button>
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
if (option.tooltip) {
|
|
160
|
+
return (
|
|
161
|
+
<Tooltip>
|
|
162
|
+
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
163
|
+
<TooltipContent side="top">{option.tooltip}</TooltipContent>
|
|
164
|
+
</Tooltip>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return button;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const renderCheckboxLabel = option => {
|
|
172
|
+
return (
|
|
173
|
+
<Label
|
|
174
|
+
htmlFor={option.id}
|
|
175
|
+
className="cursor-pointer"
|
|
176
|
+
>
|
|
177
|
+
{renderLabelWithTooltip(option.name, option.tooltip)}
|
|
178
|
+
</Label>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const renderCheckboxSetting = option => {
|
|
183
|
+
return (
|
|
184
|
+
<div
|
|
185
|
+
key={option.id}
|
|
186
|
+
className="flex items-center gap-2"
|
|
187
|
+
>
|
|
188
|
+
<Checkbox
|
|
189
|
+
id={option.id}
|
|
190
|
+
checked={option.value}
|
|
191
|
+
onCheckedChange={checked => {
|
|
192
|
+
option.onChange?.(checked);
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
{renderCheckboxLabel(option)}
|
|
196
|
+
</div>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const renderSwitchSetting = option => {
|
|
201
|
+
return (
|
|
202
|
+
<div
|
|
203
|
+
key={option.id}
|
|
204
|
+
className="flex items-center gap-2"
|
|
205
|
+
>
|
|
206
|
+
<Switch
|
|
207
|
+
id={option.id}
|
|
208
|
+
checked={option.value}
|
|
209
|
+
onCheckedChange={checked => {
|
|
210
|
+
option.onChange?.(checked);
|
|
211
|
+
}}
|
|
212
|
+
/>
|
|
213
|
+
{renderCheckboxLabel(option)}
|
|
214
|
+
</div>
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const renderSelectSetting = option => {
|
|
219
|
+
return (
|
|
220
|
+
<div
|
|
221
|
+
className="flex items-center"
|
|
222
|
+
key={option.id}
|
|
223
|
+
>
|
|
224
|
+
<div className="w-1/3 text-[13px]">{renderLabelWithTooltip(option.name, option.tooltip)}</div>
|
|
225
|
+
<div
|
|
226
|
+
className="w-2/3"
|
|
227
|
+
data-cy={option.id}
|
|
228
|
+
>
|
|
229
|
+
<Select
|
|
230
|
+
onValueChange={value => option.onChange?.(value)}
|
|
231
|
+
value={option.value}
|
|
232
|
+
>
|
|
233
|
+
<SelectTrigger className="w-full overflow-hidden">
|
|
234
|
+
<SelectValue />
|
|
235
|
+
</SelectTrigger>
|
|
236
|
+
<SelectContent>
|
|
237
|
+
{option.values.map(value => (
|
|
238
|
+
<SelectItem
|
|
239
|
+
key={value.id}
|
|
240
|
+
value={value.id}
|
|
241
|
+
data-cy={value.id}
|
|
242
|
+
>
|
|
243
|
+
{value.label}
|
|
244
|
+
</SelectItem>
|
|
245
|
+
))}
|
|
246
|
+
</SelectContent>
|
|
247
|
+
</Select>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export default ToolSettings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ToolSettings } from './ToolSettings';
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
|
|
4
|
+
import { PanelSection } from '../../components';
|
|
5
|
+
import { ToolSettings } from '../OHIFToolSettings';
|
|
6
|
+
|
|
7
|
+
const ItemsPerRow = 4;
|
|
8
|
+
|
|
9
|
+
interface ToolbarButton {
|
|
10
|
+
id: string;
|
|
11
|
+
Component: React.ComponentType<{
|
|
12
|
+
id: string;
|
|
13
|
+
onInteraction: (details: { itemId: string }) => void;
|
|
14
|
+
size: string;
|
|
15
|
+
}>;
|
|
16
|
+
componentProps: {
|
|
17
|
+
isActive?: boolean;
|
|
18
|
+
buttonSection?: string;
|
|
19
|
+
options?: unknown;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface ToolboxProps {
|
|
24
|
+
toolbarButtons: ToolbarButton[];
|
|
25
|
+
numRows: number;
|
|
26
|
+
title?: string;
|
|
27
|
+
useCollapsedPanel?: boolean;
|
|
28
|
+
onInteraction?: (details: { itemId: string }) => void;
|
|
29
|
+
activeToolOptions?: unknown;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function ToolboxUI(props: ToolboxProps) {
|
|
33
|
+
const {
|
|
34
|
+
toolbarButtons = [],
|
|
35
|
+
numRows,
|
|
36
|
+
title,
|
|
37
|
+
useCollapsedPanel = true,
|
|
38
|
+
onInteraction,
|
|
39
|
+
activeToolOptions,
|
|
40
|
+
} = props;
|
|
41
|
+
|
|
42
|
+
const render = () => {
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<div className="flex flex-col">
|
|
46
|
+
<div className="bg-muted mt-0.5 flex flex-wrap space-x-2 py-2 px-1">
|
|
47
|
+
{toolbarButtons.map((toolDef, index) => {
|
|
48
|
+
if (!toolDef) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const { id, Component, componentProps } = toolDef;
|
|
53
|
+
const isLastRow = Math.floor(index / ItemsPerRow) + 1 === numRows;
|
|
54
|
+
|
|
55
|
+
const toolClasses = `ml-1 ${isLastRow ? '' : 'mb-2'}`;
|
|
56
|
+
|
|
57
|
+
const handleInteraction = ({ itemId }: { itemId: string }) => {
|
|
58
|
+
onInteraction?.({
|
|
59
|
+
itemId,
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
key={id}
|
|
66
|
+
className={classnames({
|
|
67
|
+
[toolClasses]: true,
|
|
68
|
+
})}
|
|
69
|
+
>
|
|
70
|
+
<Component
|
|
71
|
+
{...componentProps}
|
|
72
|
+
id={id}
|
|
73
|
+
onInteraction={handleInteraction}
|
|
74
|
+
size="toolbox"
|
|
75
|
+
/>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
})}
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
<div className="bg-muted h-auto px-2">
|
|
82
|
+
{activeToolOptions && <ToolSettings options={activeToolOptions} />}
|
|
83
|
+
</div>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
{useCollapsedPanel ? (
|
|
91
|
+
<PanelSection>
|
|
92
|
+
<PanelSection.Header>
|
|
93
|
+
<span>{title}</span>
|
|
94
|
+
</PanelSection.Header>
|
|
95
|
+
<PanelSection.Content className="flex-shrink-0">{render()}</PanelSection.Content>
|
|
96
|
+
</PanelSection>
|
|
97
|
+
) : (
|
|
98
|
+
render()
|
|
99
|
+
)}
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { ToolboxUI };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ToolboxUI';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.shepherd-header {
|
|
2
|
+
@apply !bg-popover !w-[100%] !p-0;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.shepherd-title {
|
|
6
|
+
@apply !text-highlight !w-[100%] !break-words !text-xl !leading-[1.5];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.shepherd-content {
|
|
10
|
+
@apply flex flex-col gap-[8px] p-[12px];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.shepherd-element {
|
|
14
|
+
@apply !bg-popover !max-w-[260px];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.shepherd-text {
|
|
18
|
+
@apply text-foreground !w-[100%] p-0 text-lg leading-normal;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.shepherd-footer {
|
|
22
|
+
@apply !w-[100%] p-0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.shepherd-button {
|
|
26
|
+
@apply !text-foreground !inline-flex !h-[36px] !min-w-[62px] !flex-row !items-center !justify-center !gap-[5px] !whitespace-nowrap !rounded !bg-primary !px-[10px] !text-center !font-sans !text-[14px] !leading-[1.2] !outline-none !transition !duration-300 !ease-in-out focus:!outline-none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.shepherd-button.shepherd-button-secondary {
|
|
30
|
+
@apply !bg-transparent !text-primary;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.shepherd-arrow::before {
|
|
34
|
+
@apply !bg-popover !h-[30px] !w-[30px];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.shepherd-element[data-popper-placement^='left'] > .shepherd-arrow {
|
|
38
|
+
right: 3px !important;
|
|
39
|
+
top: 6px !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.shepherd-element[data-popper-placement^='top'] > .shepherd-arrow {
|
|
43
|
+
bottom: 2px !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.shepherd-modal-overlay-container.shepherd-modal-is-visible {
|
|
47
|
+
@apply !opacity-70;
|
|
48
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import Shepherd, { StepOptions, TourOptions } from 'shepherd.js';
|
|
3
|
+
import { useLocation } from 'react-router';
|
|
4
|
+
import 'shepherd.js/dist/css/shepherd.css';
|
|
5
|
+
import './Onboarding.css';
|
|
6
|
+
|
|
7
|
+
import { hasTourBeenShown, markTourAsShown, defaultShowHandler, middleware } from './utilities';
|
|
8
|
+
|
|
9
|
+
const Onboarding = ({
|
|
10
|
+
tours = [],
|
|
11
|
+
}: {
|
|
12
|
+
tours?: Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
route: string;
|
|
15
|
+
tourOptions: TourOptions;
|
|
16
|
+
steps: StepOptions[];
|
|
17
|
+
}>;
|
|
18
|
+
}) => {
|
|
19
|
+
const location = useLocation();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Show the tour if it hasn't been shown yet based on the current route.
|
|
23
|
+
* Constructs a tour instance and adds steps to it based on the matching tour.
|
|
24
|
+
*/
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!tours.length) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const matchingTour = tours.find(tour => tour.route === location.pathname);
|
|
31
|
+
if (!matchingTour || hasTourBeenShown(matchingTour.id)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const tourInstance = new Shepherd.Tour({
|
|
36
|
+
...matchingTour.tourOptions,
|
|
37
|
+
defaultStepOptions: {
|
|
38
|
+
...matchingTour.tourOptions?.defaultStepOptions,
|
|
39
|
+
floatingUIOptions: matchingTour.tourOptions?.defaultStepOptions?.floatingUIOptions || {
|
|
40
|
+
middleware,
|
|
41
|
+
},
|
|
42
|
+
when: {
|
|
43
|
+
...matchingTour.tourOptions?.defaultStepOptions?.when,
|
|
44
|
+
show:
|
|
45
|
+
matchingTour.tourOptions?.defaultStepOptions?.when?.show ||
|
|
46
|
+
(() => defaultShowHandler(Shepherd)),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
matchingTour.steps.forEach(step => tourInstance.addStep(step));
|
|
51
|
+
tourInstance.start();
|
|
52
|
+
markTourAsShown(matchingTour.id);
|
|
53
|
+
}, [tours, location.pathname]);
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { Onboarding };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ShepherdBase } from 'shepherd.js';
|
|
2
|
+
import { offset, flip, shift, detectOverflow } from '@floating-ui/dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves the list of tours that have been shown from localStorage.
|
|
6
|
+
* @returns {string[]} An array of tour IDs that have been shown.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const getShownTours = () => JSON.parse(localStorage.getItem('shownTours')) || [];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checks if a specific tour has been shown.
|
|
13
|
+
* @param {string} tourId - The ID of the tour to check.
|
|
14
|
+
* @returns {boolean} True if the tour has been shown, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
const hasTourBeenShown = (tourId: string) => getShownTours().includes(tourId);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Marks a specific tour as shown by adding it to localStorage.
|
|
20
|
+
* @param {string} tourId - The ID of the tour to mark as shown.
|
|
21
|
+
* @returns {void}
|
|
22
|
+
*/
|
|
23
|
+
const markTourAsShown = (tourId: string) => {
|
|
24
|
+
const shownTours = getShownTours();
|
|
25
|
+
if (!shownTours.includes(tourId)) {
|
|
26
|
+
shownTours.push(tourId);
|
|
27
|
+
localStorage.setItem('shownTours', JSON.stringify(shownTours));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Default handler for the 'show' event in Shepherd steps.
|
|
33
|
+
* Adds a progress indicator to the footer of the current step.
|
|
34
|
+
*
|
|
35
|
+
* @param {ShepherdBase} Shepherd - The Shepherd.js instance.
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
const defaultShowHandler = (Shepherd: ShepherdBase) => {
|
|
39
|
+
const currentStep = Shepherd.activeTour?.getCurrentStep();
|
|
40
|
+
if (currentStep) {
|
|
41
|
+
const progress = document.createElement('span');
|
|
42
|
+
progress.className = 'shepherd-progress text-lg text-muted-foreground';
|
|
43
|
+
progress.innerText = `${Shepherd.activeTour?.steps.indexOf(currentStep) + 1}/${Shepherd.activeTour?.steps.length}`;
|
|
44
|
+
progress.style.position = 'absolute';
|
|
45
|
+
progress.style.left = '13px';
|
|
46
|
+
progress.style.bottom = '20px';
|
|
47
|
+
progress.style.zIndex = '1';
|
|
48
|
+
|
|
49
|
+
const footer = currentStep?.getElement()?.querySelector('.shepherd-footer');
|
|
50
|
+
footer?.appendChild(progress);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Custom middleware for adjusting Shepherd step positioning when overflowing.
|
|
56
|
+
*
|
|
57
|
+
* @type {object}
|
|
58
|
+
* @property {string} name - The name of the middleware.
|
|
59
|
+
* @property {function} fn - The function that adjusts the position of the step when overflowing.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
const customMiddleware = {
|
|
63
|
+
name: 'customOverflowMiddleware',
|
|
64
|
+
async fn(state) {
|
|
65
|
+
const overflow = await detectOverflow(state, {
|
|
66
|
+
boundary: document.querySelector('body'),
|
|
67
|
+
padding: 24,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const xAdjustment =
|
|
71
|
+
overflow.left > 0 ? overflow.left : overflow.right > 0 ? -overflow.right : 0;
|
|
72
|
+
const yAdjustment =
|
|
73
|
+
overflow.top > 0 ? overflow.top : overflow.bottom > 0 ? -overflow.bottom : 0;
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
x: state.x + xAdjustment,
|
|
77
|
+
y: state.y + yAdjustment,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Default Floating UI middleware for positioning steps in Shepherd.js.
|
|
84
|
+
* Includes offset, shift, flip, and custom overflow middleware.
|
|
85
|
+
*
|
|
86
|
+
* @type {Array<object>}
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
const middleware = [offset(15), shift(), flip(), customMiddleware];
|
|
90
|
+
|
|
91
|
+
export { hasTourBeenShown, markTourAsShown, middleware, defaultShowHandler };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Accordion,
|
|
4
|
+
AccordionItem,
|
|
5
|
+
AccordionTrigger,
|
|
6
|
+
AccordionContent,
|
|
7
|
+
} from '../Accordion/Accordion';
|
|
8
|
+
import { cn } from '../../lib/utils';
|
|
9
|
+
import { Icons } from '../Icons/Icons';
|
|
10
|
+
|
|
11
|
+
interface PanelSectionProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface PanelSectionHeaderProps {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
showChevron?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface PanelSectionContentProps {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const PanelSection: React.FC<PanelSectionProps> & {
|
|
29
|
+
Header: React.FC<PanelSectionHeaderProps>;
|
|
30
|
+
Content: React.FC<PanelSectionContentProps>;
|
|
31
|
+
} = ({ children, defaultOpen = true, className, ...props }) => {
|
|
32
|
+
return (
|
|
33
|
+
<Accordion
|
|
34
|
+
type="single"
|
|
35
|
+
collapsible
|
|
36
|
+
defaultValue={defaultOpen ? 'item' : undefined}
|
|
37
|
+
className={cn('flex-shrink-0 overflow-hidden', className)}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<AccordionItem
|
|
41
|
+
value="item"
|
|
42
|
+
className="border-none"
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</AccordionItem>
|
|
46
|
+
</Accordion>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
PanelSection.Header = ({ children, className }) => (
|
|
51
|
+
<AccordionTrigger
|
|
52
|
+
className={cn(
|
|
53
|
+
'bg-popover hover:bg-accent text-muted-foreground',
|
|
54
|
+
'my-0.5 flex h-7 w-full items-center justify-between rounded py-2 pr-1 pl-2.5 text-[13px]',
|
|
55
|
+
className
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{children}
|
|
59
|
+
</AccordionTrigger>
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
PanelSection.Header.displayName = 'PanelSection.Header';
|
|
63
|
+
|
|
64
|
+
PanelSection.Content = ({ children, className }) => (
|
|
65
|
+
<AccordionContent className={cn('overflow-hidden p-0', className)}>
|
|
66
|
+
<div className="rounded-b">{children}</div>
|
|
67
|
+
</AccordionContent>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
PanelSection.Content.displayName = 'PanelSection.Content';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
|
|
6
|
+
const Popover = PopoverPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
11
|
+
|
|
12
|
+
const PopoverContent = ({
|
|
13
|
+
className,
|
|
14
|
+
align = 'center',
|
|
15
|
+
sideOffset = 4,
|
|
16
|
+
ref,
|
|
17
|
+
...props
|
|
18
|
+
}: React.ComponentProps<typeof PopoverPrimitive.Content>) => (
|
|
19
|
+
<PopoverPrimitive.Portal>
|
|
20
|
+
<PopoverPrimitive.Content
|
|
21
|
+
ref={ref}
|
|
22
|
+
align={align}
|
|
23
|
+
sideOffset={sideOffset}
|
|
24
|
+
data-slot="popover-content"
|
|
25
|
+
className={cn(
|
|
26
|
+
'bg-popover text-popover-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-72 rounded-md border p-4 shadow-md outline-none',
|
|
27
|
+
className
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
/>
|
|
31
|
+
</PopoverPrimitive.Portal>
|
|
32
|
+
);
|
|
33
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
34
|
+
|
|
35
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
|