@ohif/ui-next 3.14.0-beta.11 → 3.14.0-beta.110
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,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export const Trash = (props: IconProps) => (
|
|
5
|
+
<svg
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
viewBox="0 0 448 512"
|
|
8
|
+
aria-labelledby="title"
|
|
9
|
+
fill="currentColor"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<title id="title">Trash</title>
|
|
13
|
+
<path d="M32 464a48 48 0 0 0 48 48h288a48 48 0 0 0 48-48V128H32zm272-256a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zm-96 0a16 16 0 0 1 32 0v224a16 16 0 0 1-32 0zM432 32H312l-9.4-18.7A24 24 0 0 0 281.1 0H166.8a23.72 23.72 0 0 0-21.4 13.3L136 32H16A16 16 0 0 0 0 48v32a16 16 0 0 0 16 16h416a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16z" />
|
|
14
|
+
</svg>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default Trash;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export const Undo = (props: IconProps) => (
|
|
5
|
+
<svg
|
|
6
|
+
width="20px"
|
|
7
|
+
height="20px"
|
|
8
|
+
viewBox="0 0 20 20"
|
|
9
|
+
version="1.1"
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<g
|
|
13
|
+
id="Page-1"
|
|
14
|
+
stroke="none"
|
|
15
|
+
strokeWidth="1"
|
|
16
|
+
fill="none"
|
|
17
|
+
fillRule="evenodd"
|
|
18
|
+
>
|
|
19
|
+
<g
|
|
20
|
+
id="Toolbar"
|
|
21
|
+
transform="translate(-1375, -246)"
|
|
22
|
+
>
|
|
23
|
+
<g
|
|
24
|
+
id="undo"
|
|
25
|
+
transform="translate(1373, 244)"
|
|
26
|
+
>
|
|
27
|
+
<g
|
|
28
|
+
id="icon-undo"
|
|
29
|
+
transform="translate(2, 2)"
|
|
30
|
+
>
|
|
31
|
+
<rect
|
|
32
|
+
id="Rectangle"
|
|
33
|
+
x="0"
|
|
34
|
+
y="0"
|
|
35
|
+
width="20"
|
|
36
|
+
height="20"
|
|
37
|
+
></rect>
|
|
38
|
+
<path
|
|
39
|
+
d="M7.35208562,2 C7.15515629,2 6.92990335,2.09653697 6.77177033,2.25466008 L1.74936988,7.20233994 C1.59094799,7.35387392 1.5,7.57447116 1.5,7.79610318 C1.5,8.02332566 1.58842308,8.23591732 1.75201182,8.39243102 L6.77309942,13.3388655 C6.92990335,13.4956694 7.15515629,13.5922064 7.35208562,13.5922064 C7.81787582,13.5922064 8.11909989,13.2870188 8.11909989,12.8345225 C8.11909989,12.6063308 8.0418091,12.4315864 7.88716003,12.2768955 L5.74465493,10.1984823 L4.25178995,8.93887748 L3.68918984,8.46418364 L4.42451621,8.49806964 L6.43770582,8.59110867 L11.8680022,8.59110867 C14.688432,8.59110867 16.4379802,10.2154905 16.4379802,12.6945664 C16.4379802,15.1936455 14.678791,16.863337 11.8680022,16.863337 L11.8059824,16.863337 C11.3318199,16.863337 10.9923161,17.2049494 10.9923161,17.6583425 C10.9923161,18.1117355 11.3318199,18.453348 11.8059824,18.453348 L11.9519759,18.453348 C15.7113807,18.453348 18,16.2610136 18,12.7692097 C18,9.27273433 15.6408003,7.00109769 11.8493414,7.00109769 L6.44921434,7.00083266 L4.42451621,7.09413672 L3.68918984,7.12802273 L4.25178995,6.65332889 L5.73143708,5.40570972 L7.88441979,3.30867885 C8.04444784,3.1486508 8.11909989,2.98311799 8.11909989,2.75768386 C8.11909989,2.30518755 7.81787582,2 7.35208562,2 Z"
|
|
40
|
+
id="Path"
|
|
41
|
+
fill="currentColor"
|
|
42
|
+
fillRule="nonzero"
|
|
43
|
+
></path>
|
|
44
|
+
</g>
|
|
45
|
+
</g>
|
|
46
|
+
</g>
|
|
47
|
+
</g>
|
|
48
|
+
</svg>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export default Undo;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export const Upload = (props: IconProps) => (
|
|
5
|
+
<svg
|
|
6
|
+
width="18"
|
|
7
|
+
height="18"
|
|
8
|
+
viewBox="0 0 18 18"
|
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10
|
+
>
|
|
11
|
+
<g
|
|
12
|
+
transform="translate(1 1)"
|
|
13
|
+
stroke="currentColor"
|
|
14
|
+
fill="none"
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
strokeLinecap="round"
|
|
17
|
+
strokeLinejoin="round"
|
|
18
|
+
>
|
|
19
|
+
<circle
|
|
20
|
+
cx="8"
|
|
21
|
+
cy="8"
|
|
22
|
+
r="8"
|
|
23
|
+
/>
|
|
24
|
+
<path d="M8 3.273v9.454M4 7.273l4-4 4 4" />
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export default Upload;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export const ViewportViews = (props: IconProps) => (
|
|
5
|
+
<svg
|
|
6
|
+
width="24px"
|
|
7
|
+
height="24px"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
version="1.1"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<g
|
|
14
|
+
id="icon-views"
|
|
15
|
+
stroke="none"
|
|
16
|
+
strokeWidth="1"
|
|
17
|
+
fill="none"
|
|
18
|
+
fillRule="evenodd"
|
|
19
|
+
>
|
|
20
|
+
<rect
|
|
21
|
+
id="Rectangle"
|
|
22
|
+
x="0"
|
|
23
|
+
y="0"
|
|
24
|
+
width="24"
|
|
25
|
+
height="24"
|
|
26
|
+
></rect>
|
|
27
|
+
<path
|
|
28
|
+
d="M12.1675111,14.754511 C12.0607016,14.815163 11.9392984,14.815163 11.8324889,14.754511 L3.25173267,9.89965265 C3.09886891,9.81313583 3,9.61689546 3,9.4 C3,9.18310454 3.09886891,8.98686417 3.25173267,8.90034735 L11.8324889,4.04548902 C11.9392984,3.98483699 12.0607016,3.98483699 12.1675111,4.04548902 L20.7482673,8.90034735 C20.9011311,8.98686417 21,9.18310454 21,9.4 C21,9.61689546 20.9011311,9.81313583 20.7482673,9.89965265 L12.1675111,14.754511 Z"
|
|
29
|
+
id="Path"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
strokeLinecap="round"
|
|
32
|
+
strokeLinejoin="round"
|
|
33
|
+
></path>
|
|
34
|
+
<path
|
|
35
|
+
d="M16.7792809,12.1 L20.7482673,14.3367372 C20.9011311,14.4227204 21,14.6177503 21,14.833308 C21,15.0488656 20.9011311,15.2438955 20.7482673,15.3298787 L12.1675111,20.1547916 C12.0607016,20.2150695 11.9392984,20.2150695 11.8324889,20.1547916 L3.25173267,15.3298787 C3.09886891,15.2438955 3,15.0488656 3,14.833308 C3,14.6177503 3.09886891,14.4227204 3.25173267,14.3367372 L7.2018101,12.1"
|
|
36
|
+
id="Path"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
strokeLinecap="round"
|
|
39
|
+
strokeLinejoin="round"
|
|
40
|
+
></path>
|
|
41
|
+
</g>
|
|
42
|
+
</svg>
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export default ViewportViews;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export const ViewportWindowLevel = (props: IconProps) => (
|
|
5
|
+
<svg
|
|
6
|
+
width="24px"
|
|
7
|
+
height="24px"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
version="1.1"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<g
|
|
14
|
+
id="Icons"
|
|
15
|
+
stroke="none"
|
|
16
|
+
strokeWidth="1"
|
|
17
|
+
fill="none"
|
|
18
|
+
fillRule="evenodd"
|
|
19
|
+
>
|
|
20
|
+
<g
|
|
21
|
+
id="Artboard"
|
|
22
|
+
transform="translate(-184, -87)"
|
|
23
|
+
>
|
|
24
|
+
<g
|
|
25
|
+
id="viewport-window-level"
|
|
26
|
+
transform="translate(184, 87)"
|
|
27
|
+
>
|
|
28
|
+
<rect
|
|
29
|
+
id="Rectangle"
|
|
30
|
+
opacity="0.5"
|
|
31
|
+
x="0"
|
|
32
|
+
y="0"
|
|
33
|
+
width="24"
|
|
34
|
+
height="24"
|
|
35
|
+
></rect>
|
|
36
|
+
<g
|
|
37
|
+
id="Group"
|
|
38
|
+
transform="translate(4, 4)"
|
|
39
|
+
fill="currentColor"
|
|
40
|
+
>
|
|
41
|
+
<g id="icon-info-link">
|
|
42
|
+
<path
|
|
43
|
+
d="M8,0 C3.581722,0 0,3.581722 0,8 C0,12.418278 3.581722,16 8,16 C12.418278,16 16,12.418278 16,8 C16,3.581722 12.418278,0 8,0 Z M8,1.01463415 C11.857911,1.01463415 14.9853659,4.14208897 14.9853659,8 C14.9853659,11.857911 11.857911,14.9853659 8,14.9853659 C4.14208897,14.9853659 1.01463415,11.857911 1.01463415,8 C1.01463415,4.14208897 4.14208897,1.01463415 8,1.01463415 Z"
|
|
44
|
+
id="Oval"
|
|
45
|
+
></path>
|
|
46
|
+
</g>
|
|
47
|
+
<path
|
|
48
|
+
d="M13.9802015,2.99802095 C15.2351212,4.37868604 16,6.21291722 16,8.2258274 C16,12.5193844 12.5200077,16 8.22721968,16 C6.21466999,16 4.38076731,15.2349842 3.00034948,13.9798397 C3.38388248,13.5964084 3.81184081,13.1683734 4.28334632,12.6967835 L4.86417397,12.1158518 C5.13143061,11.8485473 5.41083528,11.5690926 5.70238798,11.2774876 L7.59748054,9.38205562 C8.61791499,8.36143838 9.74768171,7.2314693 10.9867807,5.99214837 Z"
|
|
49
|
+
id="Combined-Shape"
|
|
50
|
+
></path>
|
|
51
|
+
</g>
|
|
52
|
+
</g>
|
|
53
|
+
</g>
|
|
54
|
+
</g>
|
|
55
|
+
</svg>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export default ViewportWindowLevel;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IconProps } from '../types';
|
|
3
|
+
|
|
4
|
+
export const WindowLevelAdvanced = (props: IconProps) => (
|
|
5
|
+
<svg
|
|
6
|
+
width="24"
|
|
7
|
+
height="24"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M16.8555 8.05566L7.85547 17.0557"
|
|
15
|
+
stroke="currentColor"
|
|
16
|
+
strokeWidth="1.25"
|
|
17
|
+
strokeLinecap="round"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
d="M6.30518 10.4448L5.06152 5.99316C5.02197 5.84375 5 5.68115 5 5.58447C5 5.2417 5.24609 5 5.59766 5C5.91846 5 6.11621 5.21533 6.21729 5.66797L7.07422 9.41211H7.13135L8.04541 5.66357C8.15527 5.20215 8.34863 5 8.7002 5C9.05615 5 9.25391 5.21094 9.36377 5.66357L10.2778 9.41211H10.335L11.1699 5.66797C11.2666 5.22412 11.4731 5 11.7983 5C12.1455 5 12.3872 5.2373 12.3872 5.57568C12.3872 5.67676 12.3696 5.83496 12.3433 5.93604L11.0996 10.4448C10.9722 10.9019 10.77 11.082 10.4053 11.082C10.0229 11.082 9.79004 10.8887 9.66699 10.4185L8.72656 6.86328H8.67822L7.73779 10.4448C7.62354 10.8755 7.38623 11.082 7.02148 11.082C6.66113 11.082 6.44141 10.9282 6.30518 10.4448Z"
|
|
21
|
+
fill="currentColor"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M18.2935 18.5503C18.2935 18.8535 18.0737 19.0557 17.7617 19.0557H15.2832C14.7515 19.0557 14.4922 18.8052 14.4922 18.2954V13.6548C14.4922 13.2505 14.7075 13.0132 15.0854 13.0132C15.459 13.0132 15.6787 13.2505 15.6787 13.6548V18.0449H17.7617C18.0737 18.0449 18.2935 18.2515 18.2935 18.5503Z"
|
|
25
|
+
fill="currentColor"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export default WindowLevelAdvanced;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
6
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Input = ({ className, type, ref, ...props }: InputProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<input
|
|
12
|
+
type={type}
|
|
13
|
+
className={cn(
|
|
14
|
+
'border-input text-foreground bg-background hover:bg-primary/10 placeholder:text-muted-foreground focus-visible:ring-ring flex h-7 w-full rounded border px-2 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-base file:font-medium focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50',
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
ref={ref}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Input.displayName = 'Input';
|
|
24
|
+
|
|
25
|
+
export { Input };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createContext, useContext, useState, useEffect, useMemo } from 'react';
|
|
3
|
+
import debounce from 'lodash.debounce';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
import { Input } from '../Input';
|
|
6
|
+
import { Icons } from '../Icons';
|
|
7
|
+
|
|
8
|
+
// Context to share state between compound components
|
|
9
|
+
type InputFilterContextType = {
|
|
10
|
+
value: string;
|
|
11
|
+
setValue: (value: string) => void;
|
|
12
|
+
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
13
|
+
clearValue: () => void;
|
|
14
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const InputFilterContext = createContext<InputFilterContextType | undefined>(undefined);
|
|
18
|
+
|
|
19
|
+
function useInputFilterContext() {
|
|
20
|
+
const context = useContext(InputFilterContext);
|
|
21
|
+
if (!context) {
|
|
22
|
+
throw new Error('InputFilter compound components must be used within InputFilter');
|
|
23
|
+
}
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Root component
|
|
28
|
+
interface RootProps {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
defaultValue?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
onChange?: (value: string) => void;
|
|
34
|
+
debounceTime?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function Root({
|
|
38
|
+
children,
|
|
39
|
+
className,
|
|
40
|
+
defaultValue = '',
|
|
41
|
+
value: controlledValue,
|
|
42
|
+
onChange,
|
|
43
|
+
debounceTime = 200,
|
|
44
|
+
}: RootProps) {
|
|
45
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
46
|
+
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
47
|
+
|
|
48
|
+
// Determine if this is a controlled or uncontrolled component
|
|
49
|
+
const isControlled = controlledValue !== undefined;
|
|
50
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
51
|
+
|
|
52
|
+
const debouncedOnChange = useMemo(() => {
|
|
53
|
+
return onChange ? debounce(onChange, debounceTime) : undefined;
|
|
54
|
+
}, [onChange, debounceTime]);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
return () => debouncedOnChange?.cancel();
|
|
58
|
+
}, [debouncedOnChange]);
|
|
59
|
+
|
|
60
|
+
const setValue = (newValue: string) => {
|
|
61
|
+
if (!isControlled) {
|
|
62
|
+
setUncontrolledValue(newValue);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (debouncedOnChange) {
|
|
66
|
+
debouncedOnChange(newValue);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
71
|
+
setValue(event.target.value);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const clearValue = () => {
|
|
75
|
+
setValue('');
|
|
76
|
+
inputRef.current?.focus();
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<InputFilterContext.Provider value={{ value, setValue, handleChange, clearValue, inputRef }}>
|
|
81
|
+
<div className={cn('relative', className)}>{children}</div>
|
|
82
|
+
</InputFilterContext.Provider>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Input component
|
|
87
|
+
interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function InputComponent({ className, placeholder, ...props }: InputProps) {
|
|
92
|
+
const { value, handleChange, inputRef } = useInputFilterContext();
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Input
|
|
96
|
+
ref={inputRef}
|
|
97
|
+
className={cn('w-full', className)}
|
|
98
|
+
placeholder={placeholder}
|
|
99
|
+
value={value}
|
|
100
|
+
onChange={handleChange}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Search icon component
|
|
107
|
+
interface SearchIconProps {
|
|
108
|
+
className?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function SearchIcon({ className }: SearchIconProps) {
|
|
112
|
+
return (
|
|
113
|
+
<span className={cn('absolute inset-y-0 left-0 flex items-center pl-2', className)}>
|
|
114
|
+
<Icons.Search className="text-muted-foreground" />
|
|
115
|
+
</span>
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Clear button component
|
|
120
|
+
interface ClearButtonProps {
|
|
121
|
+
className?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function ClearButton({ className }: ClearButtonProps) {
|
|
125
|
+
const { value, clearValue } = useInputFilterContext();
|
|
126
|
+
|
|
127
|
+
if (!value) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<span className={cn('absolute inset-y-0 right-0 flex items-center pr-2', className)}>
|
|
133
|
+
<Icons.Clear
|
|
134
|
+
className={cn('cursor-pointer', className)}
|
|
135
|
+
onClick={clearValue}
|
|
136
|
+
/>
|
|
137
|
+
</span>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Main InputFilter component
|
|
142
|
+
interface InputFilterProps {
|
|
143
|
+
children?: React.ReactNode;
|
|
144
|
+
className?: string;
|
|
145
|
+
placeholder?: string;
|
|
146
|
+
value?: string;
|
|
147
|
+
defaultValue?: string;
|
|
148
|
+
onChange?: (value: string) => void;
|
|
149
|
+
debounceTime?: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function InputFilter({
|
|
153
|
+
children,
|
|
154
|
+
className,
|
|
155
|
+
placeholder = 'Search...',
|
|
156
|
+
value,
|
|
157
|
+
defaultValue = '',
|
|
158
|
+
onChange,
|
|
159
|
+
debounceTime = 200,
|
|
160
|
+
}: InputFilterProps) {
|
|
161
|
+
// If children are provided, act as a container (former Root)
|
|
162
|
+
if (children) {
|
|
163
|
+
return (
|
|
164
|
+
<Root
|
|
165
|
+
className={className}
|
|
166
|
+
value={value}
|
|
167
|
+
defaultValue={defaultValue}
|
|
168
|
+
onChange={onChange}
|
|
169
|
+
debounceTime={debounceTime}
|
|
170
|
+
>
|
|
171
|
+
{children}
|
|
172
|
+
</Root>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Otherwise act as the complete pre-composed component
|
|
177
|
+
return (
|
|
178
|
+
<Root
|
|
179
|
+
className={className}
|
|
180
|
+
value={value}
|
|
181
|
+
defaultValue={defaultValue}
|
|
182
|
+
onChange={onChange}
|
|
183
|
+
debounceTime={debounceTime}
|
|
184
|
+
>
|
|
185
|
+
<SearchIcon />
|
|
186
|
+
<InputComponent
|
|
187
|
+
placeholder={placeholder}
|
|
188
|
+
className="pl-9 pr-9"
|
|
189
|
+
/>
|
|
190
|
+
<ClearButton />
|
|
191
|
+
</Root>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Attach subcomponents as static properties
|
|
196
|
+
InputFilter.Input = InputComponent;
|
|
197
|
+
InputFilter.SearchIcon = SearchIcon;
|
|
198
|
+
InputFilter.ClearButton = ClearButton;
|
|
199
|
+
|
|
200
|
+
export { InputFilter, type InputFilterProps };
|