@ohif/ui-next 3.14.0-beta.12 → 3.14.0-beta.120
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,201 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
|
+
import { Cross2Icon } from '@radix-ui/react-icons';
|
|
4
|
+
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { useDraggable } from './useDraggable';
|
|
7
|
+
|
|
8
|
+
interface DialogContextValue {
|
|
9
|
+
isDraggable?: boolean;
|
|
10
|
+
shouldCloseOnEsc?: boolean;
|
|
11
|
+
shouldCloseOnOverlayClick?: boolean;
|
|
12
|
+
showOverlay?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const DialogContext = React.createContext<DialogContextValue>({
|
|
16
|
+
isDraggable: false,
|
|
17
|
+
shouldCloseOnEsc: true,
|
|
18
|
+
shouldCloseOnOverlayClick: true,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
interface DialogRootProps extends DialogPrimitive.DialogProps {
|
|
22
|
+
isDraggable?: boolean;
|
|
23
|
+
shouldCloseOnEsc?: boolean;
|
|
24
|
+
shouldCloseOnOverlayClick?: boolean;
|
|
25
|
+
showOverlay?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const Dialog = ({
|
|
29
|
+
isDraggable,
|
|
30
|
+
shouldCloseOnEsc = true,
|
|
31
|
+
shouldCloseOnOverlayClick = true,
|
|
32
|
+
showOverlay = true,
|
|
33
|
+
...props
|
|
34
|
+
}: DialogRootProps) => (
|
|
35
|
+
<DialogContext.Provider
|
|
36
|
+
value={{ isDraggable, shouldCloseOnEsc, shouldCloseOnOverlayClick, showOverlay }}
|
|
37
|
+
>
|
|
38
|
+
<DialogPrimitive.Root {...props} />
|
|
39
|
+
</DialogContext.Provider>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
43
|
+
|
|
44
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
45
|
+
|
|
46
|
+
const DialogClose = DialogPrimitive.Close;
|
|
47
|
+
|
|
48
|
+
const DialogOverlay = ({
|
|
49
|
+
className,
|
|
50
|
+
ref,
|
|
51
|
+
...props
|
|
52
|
+
}: React.ComponentProps<typeof DialogPrimitive.Overlay> & {
|
|
53
|
+
className?: string;
|
|
54
|
+
}) => (
|
|
55
|
+
<div
|
|
56
|
+
ref={ref}
|
|
57
|
+
className={cn(
|
|
58
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-40 bg-background/60',
|
|
59
|
+
className
|
|
60
|
+
)}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
65
|
+
|
|
66
|
+
interface DialogContentProps extends React.ComponentProps<typeof DialogPrimitive.Content> {
|
|
67
|
+
unstyled?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const DialogContent = ({
|
|
71
|
+
className,
|
|
72
|
+
children,
|
|
73
|
+
unstyled,
|
|
74
|
+
ref,
|
|
75
|
+
...props
|
|
76
|
+
}: DialogContentProps & {
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
}) => {
|
|
79
|
+
const { isDraggable, shouldCloseOnEsc, shouldCloseOnOverlayClick, showOverlay } =
|
|
80
|
+
React.useContext(DialogContext);
|
|
81
|
+
|
|
82
|
+
const { handlePointerDown, setRefs, initialTransform } = useDraggable(
|
|
83
|
+
{
|
|
84
|
+
enabled: isDraggable,
|
|
85
|
+
},
|
|
86
|
+
ref
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// When not isDraggable, Tailwind centers the dialog.
|
|
90
|
+
// When isDraggable, we remove the built‑in centering so our inline transform takes over.
|
|
91
|
+
const contentClassName = cn(
|
|
92
|
+
unstyled ? '' : 'w-full',
|
|
93
|
+
'max-w-md bg-muted 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid gap-4 p-4 shadow-lg duration-200 sm:rounded-lg',
|
|
94
|
+
!isDraggable ? 'translate-x-[-50%] translate-y-[-50%]' : '',
|
|
95
|
+
className
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const style = isDraggable ? { ...props.style, transform: initialTransform } : props.style;
|
|
99
|
+
|
|
100
|
+
const content = (
|
|
101
|
+
<DialogPrimitive.Content
|
|
102
|
+
ref={setRefs}
|
|
103
|
+
className={contentClassName}
|
|
104
|
+
{...props}
|
|
105
|
+
style={style}
|
|
106
|
+
onPointerDown={isDraggable ? handlePointerDown : props.onPointerDown}
|
|
107
|
+
onEscapeKeyDown={event => {
|
|
108
|
+
if (!shouldCloseOnEsc) {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
}
|
|
111
|
+
}}
|
|
112
|
+
onInteractOutside={event => {
|
|
113
|
+
if (!shouldCloseOnOverlayClick) {
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
}
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
{children}
|
|
119
|
+
{!unstyled && (
|
|
120
|
+
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">
|
|
121
|
+
<Cross2Icon className="text-primary h-4 w-4" />
|
|
122
|
+
<span className="sr-only">Close</span>
|
|
123
|
+
</DialogPrimitive.Close>
|
|
124
|
+
)}
|
|
125
|
+
</DialogPrimitive.Content>
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<DialogPortal>
|
|
130
|
+
{showOverlay && !isDraggable && <DialogOverlay />}
|
|
131
|
+
{content}
|
|
132
|
+
</DialogPortal>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
136
|
+
|
|
137
|
+
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => {
|
|
138
|
+
return (
|
|
139
|
+
<div
|
|
140
|
+
className={cn(
|
|
141
|
+
'drag-handle relative flex select-none flex-col space-y-1.5 text-center sm:text-left',
|
|
142
|
+
className
|
|
143
|
+
)}
|
|
144
|
+
{...props}
|
|
145
|
+
>
|
|
146
|
+
{props.children}
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
DialogHeader.displayName = 'DialogHeader';
|
|
151
|
+
|
|
152
|
+
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
153
|
+
<div
|
|
154
|
+
className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}
|
|
155
|
+
{...props}
|
|
156
|
+
/>
|
|
157
|
+
);
|
|
158
|
+
DialogFooter.displayName = 'DialogFooter';
|
|
159
|
+
|
|
160
|
+
const DialogTitle = ({
|
|
161
|
+
className,
|
|
162
|
+
ref,
|
|
163
|
+
...props
|
|
164
|
+
}: React.ComponentProps<typeof DialogPrimitive.Title> & {
|
|
165
|
+
className?: string;
|
|
166
|
+
}) => (
|
|
167
|
+
<DialogPrimitive.Title
|
|
168
|
+
ref={ref}
|
|
169
|
+
className={cn('text-highlight text-xl font-normal leading-none tracking-tight', className)}
|
|
170
|
+
{...props}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
173
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
174
|
+
|
|
175
|
+
const DialogDescription = ({
|
|
176
|
+
className,
|
|
177
|
+
ref,
|
|
178
|
+
...props
|
|
179
|
+
}: React.ComponentProps<typeof DialogPrimitive.Description> & {
|
|
180
|
+
className?: string;
|
|
181
|
+
}) => (
|
|
182
|
+
<DialogPrimitive.Description
|
|
183
|
+
ref={ref}
|
|
184
|
+
className={cn('text-base', className)}
|
|
185
|
+
{...props}
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
188
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
189
|
+
|
|
190
|
+
export {
|
|
191
|
+
Dialog,
|
|
192
|
+
DialogPortal,
|
|
193
|
+
DialogOverlay,
|
|
194
|
+
DialogTrigger,
|
|
195
|
+
DialogClose,
|
|
196
|
+
DialogContent,
|
|
197
|
+
DialogHeader,
|
|
198
|
+
DialogFooter,
|
|
199
|
+
DialogTitle,
|
|
200
|
+
DialogDescription,
|
|
201
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Dialog,
|
|
3
|
+
DialogPortal,
|
|
4
|
+
DialogOverlay,
|
|
5
|
+
DialogTrigger,
|
|
6
|
+
DialogClose,
|
|
7
|
+
DialogContent,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogFooter,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
} from './Dialog';
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
Dialog,
|
|
16
|
+
DialogPortal,
|
|
17
|
+
DialogOverlay,
|
|
18
|
+
DialogTrigger,
|
|
19
|
+
DialogClose,
|
|
20
|
+
DialogContent,
|
|
21
|
+
DialogHeader,
|
|
22
|
+
DialogFooter,
|
|
23
|
+
DialogTitle,
|
|
24
|
+
DialogDescription,
|
|
25
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface Offset {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface DragState {
|
|
9
|
+
startX: number;
|
|
10
|
+
startY: number;
|
|
11
|
+
initialOffset: Offset;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface UseDraggableProps {
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface UseDraggableReturn {
|
|
19
|
+
offset: React.RefObject<Offset | null>;
|
|
20
|
+
internalRef: React.RefObject<HTMLDivElement | null>;
|
|
21
|
+
handlePointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
|
|
22
|
+
setRefs: (node: HTMLDivElement) => void;
|
|
23
|
+
initialTransform: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function useDraggable(
|
|
27
|
+
props: UseDraggableProps,
|
|
28
|
+
ref?: React.ForwardedRef<HTMLDivElement>
|
|
29
|
+
): UseDraggableReturn {
|
|
30
|
+
const { enabled = false } = props;
|
|
31
|
+
const offsetRef = React.useRef<Offset>({ x: 0, y: 0 });
|
|
32
|
+
const internalRef = React.useRef<HTMLDivElement>(null);
|
|
33
|
+
|
|
34
|
+
const dragState = React.useRef<DragState | null>(null);
|
|
35
|
+
|
|
36
|
+
const handlePointerMove = React.useCallback((e: PointerEvent) => {
|
|
37
|
+
if (!dragState.current) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const deltaX = e.clientX - dragState.current.startX;
|
|
42
|
+
const deltaY = e.clientY - dragState.current.startY;
|
|
43
|
+
const newOffset = {
|
|
44
|
+
x: dragState.current.initialOffset.x + deltaX,
|
|
45
|
+
y: dragState.current.initialOffset.y + deltaY,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
offsetRef.current = newOffset;
|
|
49
|
+
if (internalRef.current) {
|
|
50
|
+
internalRef.current.style.transform = `translate(-50%, -50%) translate(${newOffset.x}px, ${newOffset.y}px)`;
|
|
51
|
+
}
|
|
52
|
+
}, []);
|
|
53
|
+
|
|
54
|
+
const handlePointerUp = React.useCallback(() => {
|
|
55
|
+
if (internalRef.current) {
|
|
56
|
+
internalRef.current.style.transition = '';
|
|
57
|
+
}
|
|
58
|
+
window.removeEventListener('pointermove', handlePointerMove);
|
|
59
|
+
window.removeEventListener('pointerup', handlePointerUp);
|
|
60
|
+
dragState.current = null;
|
|
61
|
+
}, [handlePointerMove]);
|
|
62
|
+
|
|
63
|
+
const handlePointerDown = React.useCallback(
|
|
64
|
+
(e: React.PointerEvent<HTMLDivElement>) => {
|
|
65
|
+
const target = e.target as HTMLElement;
|
|
66
|
+
if (!target.closest('.drag-handle')) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (internalRef.current) {
|
|
71
|
+
internalRef.current.style.transition = 'none';
|
|
72
|
+
}
|
|
73
|
+
dragState.current = {
|
|
74
|
+
startX: e.clientX,
|
|
75
|
+
startY: e.clientY,
|
|
76
|
+
initialOffset: { ...offsetRef.current },
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
window.addEventListener('pointermove', handlePointerMove);
|
|
80
|
+
window.addEventListener('pointerup', handlePointerUp);
|
|
81
|
+
},
|
|
82
|
+
[handlePointerMove, handlePointerUp]
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const setRefs = React.useCallback(
|
|
86
|
+
(node: HTMLDivElement) => {
|
|
87
|
+
internalRef.current = node;
|
|
88
|
+
if (typeof ref === 'function') {
|
|
89
|
+
ref(node);
|
|
90
|
+
} else if (ref) {
|
|
91
|
+
(ref as React.MutableRefObject<HTMLDivElement | null>).current = node;
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
[ref]
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const initialTransform = enabled
|
|
98
|
+
? `translate(-50%, -50%) translate(${offsetRef.current.x}px, ${offsetRef.current.y}px)`
|
|
99
|
+
: undefined;
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
offset: offsetRef,
|
|
103
|
+
internalRef,
|
|
104
|
+
handlePointerDown,
|
|
105
|
+
setRefs,
|
|
106
|
+
initialTransform,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icons } from '../Icons';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Displays a tooltip with a list of messages of a displaySet
|
|
8
|
+
* @param param0
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const DisplaySetMessageListTooltip = ({ messages, id }): React.ReactNode => {
|
|
12
|
+
const { t } = useTranslation('Messages');
|
|
13
|
+
if (messages?.size()) {
|
|
14
|
+
return (
|
|
15
|
+
<>
|
|
16
|
+
<Tooltip>
|
|
17
|
+
<TooltipTrigger id={id}>
|
|
18
|
+
<Icons.StatusWarning
|
|
19
|
+
className="h-[20px] w-[20px]"
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
role="presentation"
|
|
22
|
+
/>
|
|
23
|
+
</TooltipTrigger>
|
|
24
|
+
<TooltipContent side="right">
|
|
25
|
+
<div className="max-w-68 text-foreground text-left text-base">
|
|
26
|
+
<div
|
|
27
|
+
className="text-muted-foreground break-normal text-base font-semibold"
|
|
28
|
+
style={{
|
|
29
|
+
marginLeft: '4px',
|
|
30
|
+
marginTop: '4px',
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
{t('Display Set Messages')}
|
|
34
|
+
</div>
|
|
35
|
+
<ol
|
|
36
|
+
style={{
|
|
37
|
+
marginLeft: '4px',
|
|
38
|
+
marginRight: '4px',
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
{messages.messages.map((message, index) => (
|
|
42
|
+
<li
|
|
43
|
+
style={{
|
|
44
|
+
marginTop: '6px',
|
|
45
|
+
marginBottom: '6px',
|
|
46
|
+
}}
|
|
47
|
+
key={index}
|
|
48
|
+
>
|
|
49
|
+
{index + 1}. {t(message.id)}
|
|
50
|
+
</li>
|
|
51
|
+
))}
|
|
52
|
+
</ol>
|
|
53
|
+
</div>
|
|
54
|
+
</TooltipContent>
|
|
55
|
+
</Tooltip>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return <></>;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export { DisplaySetMessageListTooltip };
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { createElement } from 'react';
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
+
|
|
4
|
+
import { DoubleSlider } from './DoubleSlider';
|
|
5
|
+
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
global.ResizeObserver = class ResizeObserver {
|
|
8
|
+
observe() {}
|
|
9
|
+
unobserve() {}
|
|
10
|
+
disconnect() {}
|
|
11
|
+
} as typeof global.ResizeObserver;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const renderDoubleSlider = (overrides = {}) => {
|
|
15
|
+
const onValueChange = jest.fn();
|
|
16
|
+
const result = render(
|
|
17
|
+
createElement(DoubleSlider, {
|
|
18
|
+
min: 0,
|
|
19
|
+
max: 1000,
|
|
20
|
+
defaultValue: [50, 600],
|
|
21
|
+
showNumberInputs: true,
|
|
22
|
+
onValueChange,
|
|
23
|
+
...overrides,
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const inputs = Array.from(result.container.querySelectorAll('input')) as HTMLInputElement[];
|
|
28
|
+
const thumbs = Array.from(result.container.querySelectorAll('[role="slider"]')) as HTMLElement[];
|
|
29
|
+
|
|
30
|
+
return { ...result, inputs, thumbs, onValueChange };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
describe('DoubleSlider', () => {
|
|
34
|
+
it('expands its slider limits when typed expansion is enabled', () => {
|
|
35
|
+
const { inputs, thumbs, onValueChange } = renderDoubleSlider({
|
|
36
|
+
allowTypedExpansion: true,
|
|
37
|
+
});
|
|
38
|
+
const [lowerInput, upperInput] = inputs;
|
|
39
|
+
|
|
40
|
+
fireEvent.change(lowerInput, { target: { value: '-1500' } });
|
|
41
|
+
|
|
42
|
+
expect(lowerInput.value).toBe('-1500');
|
|
43
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
44
|
+
|
|
45
|
+
fireEvent.keyDown(lowerInput, { key: 'Enter' });
|
|
46
|
+
|
|
47
|
+
expect(onValueChange).toHaveBeenLastCalledWith([-1500, 600]);
|
|
48
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('-1500');
|
|
49
|
+
expect(thumbs[0].getAttribute('aria-valuemax')).toBe('1000');
|
|
50
|
+
|
|
51
|
+
fireEvent.change(upperInput, { target: { value: '3000' } });
|
|
52
|
+
fireEvent.keyDown(upperInput, { key: 'Enter' });
|
|
53
|
+
|
|
54
|
+
expect(onValueChange).toHaveBeenLastCalledWith([-1500, 3000]);
|
|
55
|
+
expect(thumbs[1].getAttribute('aria-valuemin')).toBe('-1500');
|
|
56
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('3000');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('keeps intermediate text without committing on each keystroke', () => {
|
|
60
|
+
const { inputs, onValueChange } = renderDoubleSlider();
|
|
61
|
+
const upperInput = inputs[1];
|
|
62
|
+
|
|
63
|
+
for (const value of ['1', '15', '150', '750']) {
|
|
64
|
+
fireEvent.change(upperInput, { target: { value } });
|
|
65
|
+
expect(upperInput.value).toBe(value);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
69
|
+
|
|
70
|
+
fireEvent.keyDown(upperInput, { key: 'Enter' });
|
|
71
|
+
|
|
72
|
+
expect(onValueChange).toHaveBeenLastCalledWith([50, 750]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('allows deleting an entire value before typing its replacement', () => {
|
|
76
|
+
const { inputs, onValueChange } = renderDoubleSlider({ defaultValue: [-1, 600] });
|
|
77
|
+
const lowerInput = inputs[0];
|
|
78
|
+
|
|
79
|
+
for (const value of ['', '3', '30']) {
|
|
80
|
+
fireEvent.change(lowerInput, { target: { value } });
|
|
81
|
+
expect(lowerInput.value).toBe(value);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
85
|
+
|
|
86
|
+
fireEvent.blur(lowerInput);
|
|
87
|
+
|
|
88
|
+
expect(lowerInput.value).toBe('30');
|
|
89
|
+
expect(onValueChange).toHaveBeenLastCalledWith([30, 600]);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('restores the last valid value when an invalid draft loses focus', () => {
|
|
93
|
+
const { inputs, onValueChange } = renderDoubleSlider();
|
|
94
|
+
const lowerInput = inputs[0];
|
|
95
|
+
|
|
96
|
+
fireEvent.change(lowerInput, { target: { value: '-' } });
|
|
97
|
+
fireEvent.blur(lowerInput);
|
|
98
|
+
|
|
99
|
+
expect(lowerInput.value).toBe('50');
|
|
100
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('restores the last valid value when Enter is pressed on an invalid draft', () => {
|
|
104
|
+
const { inputs, onValueChange } = renderDoubleSlider();
|
|
105
|
+
const lowerInput = inputs[0];
|
|
106
|
+
|
|
107
|
+
fireEvent.change(lowerInput, { target: { value: '.' } });
|
|
108
|
+
fireEvent.keyDown(lowerInput, { key: 'Enter' });
|
|
109
|
+
|
|
110
|
+
expect(lowerInput.value).toBe('50');
|
|
111
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('uses min and max as typed bounds when expansion is disabled', () => {
|
|
115
|
+
const { inputs, thumbs, onValueChange } = renderDoubleSlider();
|
|
116
|
+
|
|
117
|
+
fireEvent.change(inputs[0], { target: { value: '-1500' } });
|
|
118
|
+
fireEvent.keyDown(inputs[0], { key: 'Enter' });
|
|
119
|
+
expect(onValueChange).toHaveBeenLastCalledWith([0, 600]);
|
|
120
|
+
|
|
121
|
+
fireEvent.change(inputs[1], { target: { value: '3000' } });
|
|
122
|
+
fireEvent.keyDown(inputs[1], { key: 'Enter' });
|
|
123
|
+
expect(onValueChange).toHaveBeenLastCalledWith([0, 1000]);
|
|
124
|
+
|
|
125
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('0');
|
|
126
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('1000');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('limits typed expansion to an optional configured range', () => {
|
|
130
|
+
const { inputs, thumbs, onValueChange } = renderDoubleSlider({
|
|
131
|
+
allowTypedExpansion: [-1500, 3000],
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
fireEvent.change(inputs[0], { target: { value: '-2000' } });
|
|
135
|
+
fireEvent.keyDown(inputs[0], { key: 'Enter' });
|
|
136
|
+
expect(onValueChange).toHaveBeenLastCalledWith([-1500, 600]);
|
|
137
|
+
|
|
138
|
+
fireEvent.change(inputs[1], { target: { value: '4000' } });
|
|
139
|
+
fireEvent.keyDown(inputs[1], { key: 'Enter' });
|
|
140
|
+
expect(onValueChange).toHaveBeenLastCalledWith([-1500, 3000]);
|
|
141
|
+
|
|
142
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('-1500');
|
|
143
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('3000');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('resets empty inputs and their expanded slider limits on Enter', () => {
|
|
147
|
+
const { inputs, thumbs, onValueChange } = renderDoubleSlider({
|
|
148
|
+
defaultValue: [-1500, 3000],
|
|
149
|
+
allowTypedExpansion: true,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('-1500');
|
|
153
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('3000');
|
|
154
|
+
|
|
155
|
+
fireEvent.change(inputs[0], { target: { value: '' } });
|
|
156
|
+
expect(inputs[0].value).toBe('');
|
|
157
|
+
fireEvent.keyDown(inputs[0], { key: 'Enter' });
|
|
158
|
+
|
|
159
|
+
expect(onValueChange).toHaveBeenLastCalledWith([0, 3000]);
|
|
160
|
+
expect(inputs[0].value).toBe('0');
|
|
161
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('0');
|
|
162
|
+
|
|
163
|
+
fireEvent.change(inputs[1], { target: { value: '' } });
|
|
164
|
+
expect(inputs[1].value).toBe('');
|
|
165
|
+
fireEvent.keyDown(inputs[1], { key: 'Enter' });
|
|
166
|
+
|
|
167
|
+
expect(onValueChange).toHaveBeenLastCalledWith([0, 1000]);
|
|
168
|
+
expect(inputs[1].value).toBe('1000');
|
|
169
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('1000');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('widens the slider before mounting with default values outside its limits', () => {
|
|
173
|
+
const { thumbs } = renderDoubleSlider({ defaultValue: [-100, 1500] });
|
|
174
|
+
|
|
175
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('-100');
|
|
176
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('1500');
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('resets changed limits before widening them for changed default values', () => {
|
|
180
|
+
const onValueChange = jest.fn();
|
|
181
|
+
const { container, rerender } = render(
|
|
182
|
+
createElement(DoubleSlider, {
|
|
183
|
+
min: 0,
|
|
184
|
+
max: 1000,
|
|
185
|
+
defaultValue: [50, 600],
|
|
186
|
+
showNumberInputs: true,
|
|
187
|
+
onValueChange,
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
rerender(
|
|
192
|
+
createElement(DoubleSlider, {
|
|
193
|
+
min: 100,
|
|
194
|
+
max: 500,
|
|
195
|
+
defaultValue: [-100, 800],
|
|
196
|
+
showNumberInputs: true,
|
|
197
|
+
onValueChange,
|
|
198
|
+
})
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const inputs = Array.from(container.querySelectorAll('input')) as HTMLInputElement[];
|
|
202
|
+
const thumbs = Array.from(container.querySelectorAll('[role="slider"]')) as HTMLElement[];
|
|
203
|
+
expect(inputs.map(input => input.value)).toEqual(['-100', '800']);
|
|
204
|
+
expect(thumbs[0].getAttribute('aria-valuemin')).toBe('-100');
|
|
205
|
+
expect(thumbs[1].getAttribute('aria-valuemax')).toBe('800');
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('does not commit Enter while an IME composition is active', () => {
|
|
209
|
+
const { inputs, onValueChange } = renderDoubleSlider();
|
|
210
|
+
const lowerInput = inputs[0];
|
|
211
|
+
|
|
212
|
+
fireEvent.change(lowerInput, { target: { value: '30' } });
|
|
213
|
+
fireEvent.keyDown(lowerInput, { key: 'Enter', isComposing: true });
|
|
214
|
+
|
|
215
|
+
expect(lowerInput.value).toBe('30');
|
|
216
|
+
expect(onValueChange).not.toHaveBeenCalled();
|
|
217
|
+
|
|
218
|
+
fireEvent.keyDown(lowerInput, { key: 'Enter' });
|
|
219
|
+
|
|
220
|
+
expect(onValueChange).toHaveBeenLastCalledWith([30, 600]);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('keeps the lower value at or below the upper value', () => {
|
|
224
|
+
const { inputs, onValueChange } = renderDoubleSlider();
|
|
225
|
+
|
|
226
|
+
fireEvent.change(inputs[0], { target: { value: '700' } });
|
|
227
|
+
fireEvent.keyDown(inputs[0], { key: 'Enter' });
|
|
228
|
+
|
|
229
|
+
expect(onValueChange).toHaveBeenLastCalledWith([700, 700]);
|
|
230
|
+
expect(inputs[1].value).toBe('700');
|
|
231
|
+
});
|
|
232
|
+
});
|