@ohif/ui-next 3.14.0-beta.10 → 3.14.0-beta.101

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.
Files changed (434) hide show
  1. package/dist/ohif-ui-next.css +6 -6
  2. package/dist/ohif-ui-next.umd.js +4 -1838
  3. package/package.json +31 -14
  4. package/src/__mocks__/fileMock.js +7 -0
  5. package/src/assets/fonts.css +50 -0
  6. package/src/assets/styles.css +55 -0
  7. package/src/assets/woff2/latin.woff2 +0 -0
  8. package/src/components/Accordion/Accordion.tsx +70 -0
  9. package/src/components/Accordion/index.ts +3 -0
  10. package/src/components/AllInOneMenu/BackItem.tsx +32 -0
  11. package/src/components/AllInOneMenu/DividerItem.tsx +11 -0
  12. package/src/components/AllInOneMenu/HeaderItem.tsx +15 -0
  13. package/src/components/AllInOneMenu/IconMenu.tsx +83 -0
  14. package/src/components/AllInOneMenu/Item.tsx +51 -0
  15. package/src/components/AllInOneMenu/ItemPanel.tsx +38 -0
  16. package/src/components/AllInOneMenu/Menu.tsx +231 -0
  17. package/src/components/AllInOneMenu/PanelSelector.tsx +32 -0
  18. package/src/components/AllInOneMenu/SubMenu.tsx +36 -0
  19. package/src/components/AllInOneMenu/index.ts +42 -0
  20. package/src/components/BackgroundColorSelect/BackgroundColorSelect.tsx +38 -0
  21. package/src/components/BackgroundColorSelect/index.tsx +1 -0
  22. package/src/components/Badge/Badge.tsx +38 -0
  23. package/src/components/Badge/index.ts +1 -0
  24. package/src/components/Button/Button.tsx +65 -0
  25. package/src/components/Button/index.ts +1 -0
  26. package/src/components/Calendar/Calendar.tsx +258 -0
  27. package/src/components/Calendar/index.tsx +3 -0
  28. package/src/components/Card/Card.tsx +83 -0
  29. package/src/components/Card/index.ts +2 -0
  30. package/src/components/Checkbox/Checkbox.tsx +27 -0
  31. package/src/components/Checkbox/index.tsx +3 -0
  32. package/src/components/CinePlayer/CinePlayer.tsx +187 -0
  33. package/src/components/CinePlayer/index.ts +5 -0
  34. package/src/components/Clipboard/Clipboard.tsx +58 -0
  35. package/src/components/Clipboard/index.tsx +3 -0
  36. package/src/components/ColorCircle.tsx +12 -0
  37. package/src/components/Combobox/Combobox.tsx +66 -0
  38. package/src/components/Combobox/index.ts +3 -0
  39. package/src/components/Command/Command.tsx +149 -0
  40. package/src/components/Command/index.ts +23 -0
  41. package/src/components/ContextMenu/ContextMenu.tsx +202 -0
  42. package/src/components/ContextMenu/index.ts +35 -0
  43. package/src/components/ContextMenuViewport/ContextMenuViewport.tsx +47 -0
  44. package/src/components/ContextMenuViewport/index.ts +1 -0
  45. package/src/components/DataRow/DataRow.tsx +532 -0
  46. package/src/components/DataRow/index.ts +1 -0
  47. package/src/components/DataRow/types.ts +31 -0
  48. package/src/components/DataTable/ActionOverlayCell.tsx +153 -0
  49. package/src/components/DataTable/ColumnHeader.tsx +70 -0
  50. package/src/components/DataTable/DataTable.tsx +532 -0
  51. package/src/components/DataTable/FilterRow.tsx +52 -0
  52. package/src/components/DataTable/Pagination.tsx +78 -0
  53. package/src/components/DataTable/Title.tsx +5 -0
  54. package/src/components/DataTable/Toolbar.tsx +5 -0
  55. package/src/components/DataTable/ViewOptions.tsx +86 -0
  56. package/src/components/DataTable/context.tsx +21 -0
  57. package/src/components/DataTable/index.ts +5 -0
  58. package/src/components/DataTable/types.ts +27 -0
  59. package/src/components/DataTable/useResponsiveColumns.tsx +346 -0
  60. package/src/components/DateRange/DateRange.tsx +163 -0
  61. package/src/components/DateRange/index.ts +3 -0
  62. package/src/components/Dialog/Dialog.tsx +201 -0
  63. package/src/components/Dialog/index.ts +25 -0
  64. package/src/components/Dialog/useDraggable.ts +108 -0
  65. package/src/components/DisplaySetMessageListTooltip/DisplaySetMessageListTooltip.tsx +64 -0
  66. package/src/components/DisplaySetMessageListTooltip/index.ts +3 -0
  67. package/src/components/DoubleSlider/DoubleSlider.test.ts +232 -0
  68. package/src/components/DoubleSlider/DoubleSlider.tsx +211 -0
  69. package/src/components/DoubleSlider/index.tsx +3 -0
  70. package/src/components/DropdownMenu/DropdownMenu.tsx +213 -0
  71. package/src/components/DropdownMenu/index.ts +35 -0
  72. package/src/components/Errorboundary/ErrorBoundary.tsx +345 -0
  73. package/src/components/Errorboundary/index.tsx +3 -0
  74. package/src/components/FooterAction/FooterAction.tsx +115 -0
  75. package/src/components/FooterAction/index.tsx +3 -0
  76. package/src/components/Header/Header.tsx +140 -0
  77. package/src/components/Header/index.js +2 -0
  78. package/src/components/HoverCard/HoverCard.tsx +30 -0
  79. package/src/components/HoverCard/index.ts +1 -0
  80. package/src/components/Icons/Icons.tsx +852 -0
  81. package/src/components/Icons/Sources/ActionNewDialog.tsx +64 -0
  82. package/src/components/Icons/Sources/Actions.tsx +47 -0
  83. package/src/components/Icons/Sources/Add.tsx +51 -0
  84. package/src/components/Icons/Sources/Alert.tsx +32 -0
  85. package/src/components/Icons/Sources/AlertOutline.tsx +30 -0
  86. package/src/components/Icons/Sources/ArrowLeftBold.tsx +49 -0
  87. package/src/components/Icons/Sources/ArrowRight.tsx +25 -0
  88. package/src/components/Icons/Sources/Cancel.tsx +37 -0
  89. package/src/components/Icons/Sources/CheckBoxChecked.tsx +39 -0
  90. package/src/components/Icons/Sources/CheckBoxUnChecked.tsx +25 -0
  91. package/src/components/Icons/Sources/Checked.tsx +23 -0
  92. package/src/components/Icons/Sources/ChevronClosed.tsx +40 -0
  93. package/src/components/Icons/Sources/ChevronLeft.tsx +28 -0
  94. package/src/components/Icons/Sources/ChevronOpen.tsx +38 -0
  95. package/src/components/Icons/Sources/Clear.tsx +34 -0
  96. package/src/components/Icons/Sources/Clipboard.tsx +15 -0
  97. package/src/components/Icons/Sources/Close.tsx +28 -0
  98. package/src/components/Icons/Sources/CloudSettings.tsx +34 -0
  99. package/src/components/Icons/Sources/Code.tsx +7 -0
  100. package/src/components/Icons/Sources/ColorChange.tsx +100 -0
  101. package/src/components/Icons/Sources/ContentNext.tsx +35 -0
  102. package/src/components/Icons/Sources/ContentPrev.tsx +35 -0
  103. package/src/components/Icons/Sources/Controls.tsx +99 -0
  104. package/src/components/Icons/Sources/Copy.tsx +44 -0
  105. package/src/components/Icons/Sources/Database.tsx +33 -0
  106. package/src/components/Icons/Sources/Delete.tsx +58 -0
  107. package/src/components/Icons/Sources/DicomTagBrowser.tsx +79 -0
  108. package/src/components/Icons/Sources/DisplayFillAndOutline.tsx +49 -0
  109. package/src/components/Icons/Sources/DisplayFillOnly.tsx +40 -0
  110. package/src/components/Icons/Sources/DisplayOutlineOnly.tsx +40 -0
  111. package/src/components/Icons/Sources/Download.tsx +75 -0
  112. package/src/components/Icons/Sources/Export.tsx +53 -0
  113. package/src/components/Icons/Sources/ExternalLink.tsx +26 -0
  114. package/src/components/Icons/Sources/EyeHidden.tsx +32 -0
  115. package/src/components/Icons/Sources/EyeVisible.tsx +28 -0
  116. package/src/components/Icons/Sources/FeedbackComplete.tsx +35 -0
  117. package/src/components/Icons/Sources/GearSettings.tsx +59 -0
  118. package/src/components/Icons/Sources/GroupLayers.tsx +33 -0
  119. package/src/components/Icons/Sources/Helpers.tsx +398 -0
  120. package/src/components/Icons/Sources/Hide.tsx +45 -0
  121. package/src/components/Icons/Sources/IconColorLUT.tsx +103 -0
  122. package/src/components/Icons/Sources/IconMPR.tsx +55 -0
  123. package/src/components/Icons/Sources/IconTransferring.tsx +25 -0
  124. package/src/components/Icons/Sources/IllustrationNotFound.tsx +102 -0
  125. package/src/components/Icons/Sources/Info.tsx +55 -0
  126. package/src/components/Icons/Sources/InfoLink.tsx +23 -0
  127. package/src/components/Icons/Sources/InfoSeries.tsx +52 -0
  128. package/src/components/Icons/Sources/InvestigationalUse.tsx +82 -0
  129. package/src/components/Icons/Sources/JumpToSlice.tsx +69 -0
  130. package/src/components/Icons/Sources/LaunchArrow.tsx +34 -0
  131. package/src/components/Icons/Sources/LaunchInfo.tsx +38 -0
  132. package/src/components/Icons/Sources/LayerBackground.tsx +28 -0
  133. package/src/components/Icons/Sources/LayerForeground.tsx +34 -0
  134. package/src/components/Icons/Sources/LayerSegmentation.tsx +20 -0
  135. package/src/components/Icons/Sources/Layout.tsx +433 -0
  136. package/src/components/Icons/Sources/Link.tsx +58 -0
  137. package/src/components/Icons/Sources/ListView.tsx +79 -0
  138. package/src/components/Icons/Sources/LoadingOHIFMark.tsx +21 -0
  139. package/src/components/Icons/Sources/LoadingSpinner.tsx +49 -0
  140. package/src/components/Icons/Sources/Lock.tsx +35 -0
  141. package/src/components/Icons/Sources/Magnifier.tsx +37 -0
  142. package/src/components/Icons/Sources/Minus.tsx +40 -0
  143. package/src/components/Icons/Sources/MissingIcon.tsx +6 -0
  144. package/src/components/Icons/Sources/More.tsx +53 -0
  145. package/src/components/Icons/Sources/MultiplePatients.tsx +76 -0
  146. package/src/components/Icons/Sources/NavigationPanelReveal.tsx +25 -0
  147. package/src/components/Icons/Sources/NotificationInfo.tsx +33 -0
  148. package/src/components/Icons/Sources/NotificationWarning.tsx +44 -0
  149. package/src/components/Icons/Sources/OHIFLogo.tsx +72 -0
  150. package/src/components/Icons/Sources/OHIFLogoColorDarkBackground.tsx +78 -0
  151. package/src/components/Icons/Sources/OHIFLogoHorizontal.tsx +139 -0
  152. package/src/components/Icons/Sources/Opacity.tsx +106 -0
  153. package/src/components/Icons/Sources/OrientationSwitch.tsx +41 -0
  154. package/src/components/Icons/Sources/OrientationSwitchA.tsx +41 -0
  155. package/src/components/Icons/Sources/OrientationSwitchC.tsx +41 -0
  156. package/src/components/Icons/Sources/OrientationSwitchR.tsx +41 -0
  157. package/src/components/Icons/Sources/OrientationSwitchS.tsx +41 -0
  158. package/src/components/Icons/Sources/PanelRight.tsx +29 -0
  159. package/src/components/Icons/Sources/Patient.tsx +58 -0
  160. package/src/components/Icons/Sources/PatientStudyList.tsx +62 -0
  161. package/src/components/Icons/Sources/Pause.tsx +26 -0
  162. package/src/components/Icons/Sources/Pencil.tsx +16 -0
  163. package/src/components/Icons/Sources/Pin.tsx +50 -0
  164. package/src/components/Icons/Sources/PinFill.tsx +51 -0
  165. package/src/components/Icons/Sources/Play.tsx +25 -0
  166. package/src/components/Icons/Sources/Plus.tsx +29 -0
  167. package/src/components/Icons/Sources/PowerOff.tsx +19 -0
  168. package/src/components/Icons/Sources/Redo.tsx +51 -0
  169. package/src/components/Icons/Sources/Refresh.tsx +42 -0
  170. package/src/components/Icons/Sources/Rename.tsx +50 -0
  171. package/src/components/Icons/Sources/Search.tsx +35 -0
  172. package/src/components/Icons/Sources/SegActions.tsx +594 -0
  173. package/src/components/Icons/Sources/Series.tsx +47 -0
  174. package/src/components/Icons/Sources/SeriesPlaceholder.tsx +40 -0
  175. package/src/components/Icons/Sources/Settings.tsx +105 -0
  176. package/src/components/Icons/Sources/SettingsStudyList.tsx +28 -0
  177. package/src/components/Icons/Sources/Show.tsx +67 -0
  178. package/src/components/Icons/Sources/SidePanelCloseLeft.tsx +75 -0
  179. package/src/components/Icons/Sources/SidePanelCloseRight.tsx +74 -0
  180. package/src/components/Icons/Sources/SocialGithub.tsx +39 -0
  181. package/src/components/Icons/Sources/Sorting.tsx +39 -0
  182. package/src/components/Icons/Sources/SortingAscending.tsx +28 -0
  183. package/src/components/Icons/Sources/SortingDescending.tsx +26 -0
  184. package/src/components/Icons/Sources/SortingNew.tsx +20 -0
  185. package/src/components/Icons/Sources/SortingNewAscending.tsx +35 -0
  186. package/src/components/Icons/Sources/SortingNewDescending.tsx +35 -0
  187. package/src/components/Icons/Sources/StatusAlert.tsx +36 -0
  188. package/src/components/Icons/Sources/StatusError.tsx +57 -0
  189. package/src/components/Icons/Sources/StatusLocked.tsx +35 -0
  190. package/src/components/Icons/Sources/StatusSuccess.tsx +45 -0
  191. package/src/components/Icons/Sources/StatusTracking.tsx +37 -0
  192. package/src/components/Icons/Sources/StatusUntracked.tsx +30 -0
  193. package/src/components/Icons/Sources/StatusWarning.tsx +58 -0
  194. package/src/components/Icons/Sources/Tab4D.tsx +54 -0
  195. package/src/components/Icons/Sources/TabContours.tsx +63 -0
  196. package/src/components/Icons/Sources/TabLinear.tsx +47 -0
  197. package/src/components/Icons/Sources/TabPatientInfo.tsx +33 -0
  198. package/src/components/Icons/Sources/TabRoiThreshold.tsx +38 -0
  199. package/src/components/Icons/Sources/TabSegmentation.tsx +38 -0
  200. package/src/components/Icons/Sources/TabStudies.tsx +62 -0
  201. package/src/components/Icons/Sources/Threshold.tsx +38 -0
  202. package/src/components/Icons/Sources/ThumbnailView.tsx +67 -0
  203. package/src/components/Icons/Sources/Tools.tsx +3659 -0
  204. package/src/components/Icons/Sources/Trash.tsx +17 -0
  205. package/src/components/Icons/Sources/Undo.tsx +51 -0
  206. package/src/components/Icons/Sources/Upload.tsx +29 -0
  207. package/src/components/Icons/Sources/ViewportViews.tsx +45 -0
  208. package/src/components/Icons/Sources/ViewportWindowLevel.tsx +58 -0
  209. package/src/components/Icons/Sources/WindowLevelAdvanced.tsx +30 -0
  210. package/src/components/Icons/index.ts +4 -0
  211. package/src/components/Icons/types.ts +3 -0
  212. package/src/components/Input/Input.tsx +25 -0
  213. package/src/components/Input/index.tsx +3 -0
  214. package/src/components/InputFilter/InputFilter.tsx +200 -0
  215. package/src/components/InputFilter/index.ts +2 -0
  216. package/src/components/InputMultiSelect/InputMultiSelect.tsx +370 -0
  217. package/src/components/InputMultiSelect/index.ts +1 -0
  218. package/src/components/InputNumber/InputNumber.tsx +439 -0
  219. package/src/components/InputNumber/index.ts +3 -0
  220. package/src/components/InvestigationalUseDialog/InvestigationalUseDialog.tsx +98 -0
  221. package/src/components/InvestigationalUseDialog/index.ts +3 -0
  222. package/src/components/Label/Label.tsx +24 -0
  223. package/src/components/Label/index.tsx +3 -0
  224. package/src/components/Labelling/LabellingFlow.tsx +92 -0
  225. package/src/components/Labelling/index.ts +2 -0
  226. package/src/components/LayoutSelector/LayoutSelector.tsx +345 -0
  227. package/src/components/LayoutSelector/index.ts +4 -0
  228. package/src/components/LineChart/LineChart.css +40 -0
  229. package/src/components/LineChart/LineChart.tsx +101 -0
  230. package/src/components/LineChart/d3LineChart/chart.ts +365 -0
  231. package/src/components/LineChart/d3LineChart/events.ts +149 -0
  232. package/src/components/LineChart/d3LineChart/index.ts +3 -0
  233. package/src/components/LineChart/d3LineChart/lineChart.ts +272 -0
  234. package/src/components/LineChart/index.ts +1 -0
  235. package/src/components/LoadingIndicatorProgress/LoadingIndicatorProgress.tsx +29 -0
  236. package/src/components/LoadingIndicatorProgress/index.ts +2 -0
  237. package/src/components/LoadingIndicatorTotalPercent/LoadingIndicatorTotalPercent.tsx +49 -0
  238. package/src/components/LoadingIndicatorTotalPercent/index.ts +2 -0
  239. package/src/components/MeasurementTable/MeasurementTable.tsx +144 -0
  240. package/src/components/MeasurementTable/index.js +3 -0
  241. package/src/components/Modal/Modal.tsx +44 -0
  242. package/src/components/NavBar/NavBar.tsx +32 -0
  243. package/src/components/NavBar/index.js +2 -0
  244. package/src/components/Numeric/Numeric.test.ts +124 -0
  245. package/src/components/Numeric/Numeric.tsx +576 -0
  246. package/src/components/Numeric/index.ts +3 -0
  247. package/src/components/OHIFDialogs/InputDialog.tsx +287 -0
  248. package/src/components/OHIFDialogs/PresetDialog.tsx +106 -0
  249. package/src/components/OHIFDialogs/index.ts +2 -0
  250. package/src/components/OHIFModals/AboutModal.tsx +114 -0
  251. package/src/components/OHIFModals/AppearanceModal.tsx +38 -0
  252. package/src/components/OHIFModals/ImageModal.tsx +251 -0
  253. package/src/components/OHIFModals/UserPreferencesModal.tsx +229 -0
  254. package/src/components/OHIFModals/index.ts +4 -0
  255. package/src/components/OHIFPanels/WindowLevel.tsx +162 -0
  256. package/src/components/OHIFPanels/WindowLevelHistogram.tsx +237 -0
  257. package/src/components/OHIFPanels/index.ts +3 -0
  258. package/src/components/OHIFPanels/types.ts +41 -0
  259. package/src/components/OHIFToolSettings/RowDoubleRange.tsx +67 -0
  260. package/src/components/OHIFToolSettings/RowInputRange.tsx +65 -0
  261. package/src/components/OHIFToolSettings/RowSegmentedControl.tsx +77 -0
  262. package/src/components/OHIFToolSettings/ToolSettings.tsx +253 -0
  263. package/src/components/OHIFToolSettings/index.ts +1 -0
  264. package/src/components/OHIFToolbox/ToolboxUI.tsx +104 -0
  265. package/src/components/OHIFToolbox/index.ts +1 -0
  266. package/src/components/Onboarding/Onboarding.css +48 -0
  267. package/src/components/Onboarding/Onboarding.tsx +58 -0
  268. package/src/components/Onboarding/index.ts +3 -0
  269. package/src/components/Onboarding/utilities.ts +91 -0
  270. package/src/components/PanelSection/PanelSection.tsx +70 -0
  271. package/src/components/PanelSection/index.ts +2 -0
  272. package/src/components/Popover/Popover.tsx +35 -0
  273. package/src/components/Popover/index.ts +3 -0
  274. package/src/components/ProgressDropdown/ProgressDiscreteBar.tsx +24 -0
  275. package/src/components/ProgressDropdown/ProgressDropdown.tsx +158 -0
  276. package/src/components/ProgressDropdown/ProgressItem.tsx +27 -0
  277. package/src/components/ProgressDropdown/ProgressItemDetail.tsx +89 -0
  278. package/src/components/ProgressDropdown/index.ts +1 -0
  279. package/src/components/ProgressDropdown/types.ts +9 -0
  280. package/src/components/ProgressLoadingBar/ProgressLoadingBar.css +26 -0
  281. package/src/components/ProgressLoadingBar/ProgressLoadingBar.tsx +32 -0
  282. package/src/components/ProgressLoadingBar/index.ts +2 -0
  283. package/src/components/Resizable/Resizable.tsx +43 -0
  284. package/src/components/Resizable/index.ts +3 -0
  285. package/src/components/ScrollArea/ScrollArea.tsx +127 -0
  286. package/src/components/ScrollArea/index.tsx +3 -0
  287. package/src/components/SegmentationTable/AddSegmentRow.tsx +78 -0
  288. package/src/components/SegmentationTable/AddSegmentationRow.tsx +56 -0
  289. package/src/components/SegmentationTable/SegmentStatistics.tsx +104 -0
  290. package/src/components/SegmentationTable/SegmentationCollapsed.tsx +211 -0
  291. package/src/components/SegmentationTable/SegmentationExpanded.tsx +173 -0
  292. package/src/components/SegmentationTable/SegmentationHeader.tsx +58 -0
  293. package/src/components/SegmentationTable/SegmentationLabel.tsx +27 -0
  294. package/src/components/SegmentationTable/SegmentationSegments.tsx +206 -0
  295. package/src/components/SegmentationTable/SegmentationTable.tsx +169 -0
  296. package/src/components/SegmentationTable/SegmentationTableConfig.tsx +194 -0
  297. package/src/components/SegmentationTable/contexts/SegmentStatisticsContext.tsx +45 -0
  298. package/src/components/SegmentationTable/contexts/SegmentationExpandedContext.tsx +45 -0
  299. package/src/components/SegmentationTable/contexts/SegmentationTableContext.tsx +148 -0
  300. package/src/components/SegmentationTable/contexts/index.ts +15 -0
  301. package/src/components/SegmentationTable/index.ts +24 -0
  302. package/src/components/Select/Select.tsx +167 -0
  303. package/src/components/Select/index.tsx +40 -0
  304. package/src/components/Separator/Separator.tsx +32 -0
  305. package/src/components/Separator/index.ts +3 -0
  306. package/src/components/Separator/index.tsx +3 -0
  307. package/src/components/SidePanel/SidePanel.tsx +479 -0
  308. package/src/components/SidePanel/index.ts +2 -0
  309. package/src/components/Slider/Slider.tsx +24 -0
  310. package/src/components/Slider/index.tsx +3 -0
  311. package/src/components/SmartScrollbar/SmartScrollbar.tsx +349 -0
  312. package/src/components/SmartScrollbar/SmartScrollbarEndpoints.tsx +82 -0
  313. package/src/components/SmartScrollbar/SmartScrollbarFill.tsx +54 -0
  314. package/src/components/SmartScrollbar/SmartScrollbarIndicator.tsx +59 -0
  315. package/src/components/SmartScrollbar/SmartScrollbarTrack.tsx +104 -0
  316. package/src/components/SmartScrollbar/defaultSmartScrollbarIndicatorConfig.tsx +48 -0
  317. package/src/components/SmartScrollbar/index.ts +11 -0
  318. package/src/components/SmartScrollbar/useByteArray.ts +146 -0
  319. package/src/components/SmartScrollbar/utils.test.ts +124 -0
  320. package/src/components/SmartScrollbar/utils.ts +168 -0
  321. package/src/components/Sonner/Sonner.tsx +31 -0
  322. package/src/components/Sonner/index.ts +4 -0
  323. package/src/components/StudyBrowser/StudyBrowser.tsx +89 -0
  324. package/src/components/StudyBrowser/index.ts +2 -0
  325. package/src/components/StudyBrowserSort/StudyBrowserSort.tsx +87 -0
  326. package/src/components/StudyBrowserSort/index.ts +3 -0
  327. package/src/components/StudyBrowserViewOptions/StudyBrowserViewOptions.tsx +50 -0
  328. package/src/components/StudyBrowserViewOptions/index.ts +3 -0
  329. package/src/components/StudyItem/StudyItem.tsx +100 -0
  330. package/src/components/StudyItem/index.ts +2 -0
  331. package/src/components/StudyList/columns/defaultColumns.tsx +258 -0
  332. package/src/components/StudyList/components/ActionCell.tsx +19 -0
  333. package/src/components/StudyList/components/Layout.tsx +206 -0
  334. package/src/components/StudyList/components/PreviewContainer.tsx +45 -0
  335. package/src/components/StudyList/components/PreviewContent.tsx +186 -0
  336. package/src/components/StudyList/components/PreviewHeader.tsx +5 -0
  337. package/src/components/StudyList/components/PreviewPatientSummary.tsx +224 -0
  338. package/src/components/StudyList/components/PreviewSeriesList.tsx +64 -0
  339. package/src/components/StudyList/components/PreviewToggleButton.tsx +69 -0
  340. package/src/components/StudyList/components/SettingsPopover.tsx +214 -0
  341. package/src/components/StudyList/components/Table.tsx +247 -0
  342. package/src/components/StudyList/components/WorkflowMenu.tsx +72 -0
  343. package/src/components/StudyList/components/WorkflowsProvider.tsx +169 -0
  344. package/src/components/StudyList/hooks/useDefaultWorkflow.ts +60 -0
  345. package/src/components/StudyList/index.ts +52 -0
  346. package/src/components/StudyList/types/types.ts +42 -0
  347. package/src/components/StudyList/utils/tokenizeModalities.ts +6 -0
  348. package/src/components/StudySummary/StudySummary.tsx +27 -0
  349. package/src/components/StudySummary/index.tsx +3 -0
  350. package/src/components/Switch/Switch.tsx +28 -0
  351. package/src/components/Switch/index.tsx +3 -0
  352. package/src/components/Table/Table.tsx +134 -0
  353. package/src/components/Table/index.ts +11 -0
  354. package/src/components/Tabs/Tabs.tsx +56 -0
  355. package/src/components/Tabs/index.ts +3 -0
  356. package/src/components/Tabs/index.tsx +3 -0
  357. package/src/components/ThemeWrapper/ThemeWrapper.tsx +5 -0
  358. package/src/components/ThemeWrapper/index.ts +1 -0
  359. package/src/components/Thumbnail/Thumbnail.test.ts +71 -0
  360. package/src/components/Thumbnail/Thumbnail.tsx +351 -0
  361. package/src/components/Thumbnail/index.ts +2 -0
  362. package/src/components/ThumbnailList/ThumbnailList.tsx +94 -0
  363. package/src/components/ThumbnailList/index.ts +2 -0
  364. package/src/components/Toggle/Toggle.tsx +45 -0
  365. package/src/components/Toggle/index.ts +3 -0
  366. package/src/components/Toggle/index.tsx +3 -0
  367. package/src/components/ToggleGroup/ToggleGroup.tsx +63 -0
  368. package/src/components/ToggleGroup/index.ts +3 -0
  369. package/src/components/ToolButton/ToolButton.tsx +134 -0
  370. package/src/components/ToolButton/ToolButtonList.tsx +243 -0
  371. package/src/components/ToolButton/index.ts +8 -0
  372. package/src/components/Tooltip/Tooltip.tsx +34 -0
  373. package/src/components/Tooltip/index.ts +3 -0
  374. package/src/components/Viewport/ImageScrollbar.module.css +89 -0
  375. package/src/components/Viewport/ImageScrollbar.tsx +71 -0
  376. package/src/components/Viewport/PatientInfo.tsx +126 -0
  377. package/src/components/Viewport/ViewportActionArrows.tsx +36 -0
  378. package/src/components/Viewport/ViewportActionBar.tsx +107 -0
  379. package/src/components/Viewport/ViewportActionButton.tsx +25 -0
  380. package/src/components/Viewport/ViewportActionCorners.tsx +171 -0
  381. package/src/components/Viewport/ViewportGrid.tsx +24 -0
  382. package/src/components/Viewport/ViewportOverlay.css +32 -0
  383. package/src/components/Viewport/ViewportOverlay.tsx +54 -0
  384. package/src/components/Viewport/ViewportPane.tsx +82 -0
  385. package/src/components/Viewport/index.ts +9 -0
  386. package/src/components/ViewportDialog/ViewportDialog.tsx +128 -0
  387. package/src/components/ViewportDialog/index.ts +2 -0
  388. package/src/components/index.ts +323 -0
  389. package/src/contextProviders/ActiveThemeProvider.tsx +204 -0
  390. package/src/contextProviders/CineProvider.tsx +98 -0
  391. package/src/contextProviders/DialogProvider.tsx +103 -0
  392. package/src/contextProviders/DragAndDropProvider.tsx +37 -0
  393. package/src/contextProviders/IconPresentationProvider.tsx +88 -0
  394. package/src/contextProviders/ImageViewerProvider.tsx +15 -0
  395. package/src/contextProviders/ManagedDialog.tsx +176 -0
  396. package/src/contextProviders/ModalProvider.tsx +102 -0
  397. package/src/contextProviders/NotificationProvider.tsx +246 -0
  398. package/src/contextProviders/UserAuthenticationProvider.tsx +118 -0
  399. package/src/contextProviders/ViewportDialogProvider.tsx +42 -0
  400. package/src/contextProviders/ViewportGridProvider.tsx +556 -0
  401. package/src/contextProviders/index.ts +26 -0
  402. package/src/hooks/index.ts +4 -0
  403. package/src/hooks/useDynamicMaxHeight.ts +105 -0
  404. package/src/hooks/useSessionStorage.test.js +103 -0
  405. package/src/hooks/useSessionStorage.tsx +71 -0
  406. package/src/index.ts +7 -0
  407. package/src/lib/utils.ts +6 -0
  408. package/src/tailwind.css +266 -0
  409. package/src/themes/arctic.json +31 -0
  410. package/src/themes/deep.json +31 -0
  411. package/src/themes/index.ts +16 -0
  412. package/src/themes/midnight.json +31 -0
  413. package/src/themes/orchid.json +31 -0
  414. package/src/themes/slate.json +31 -0
  415. package/src/themes/themes.css +206 -0
  416. package/src/themes/verdant.json +31 -0
  417. package/src/types/ActionCorners.ts +18 -0
  418. package/src/types/AppTypes.ts +24 -0
  419. package/src/types/ContextMenuItem.ts +9 -0
  420. package/src/types/Predicate.ts +1 -0
  421. package/src/types/ThumbnailType.ts +3 -0
  422. package/src/types/ViewportActionCornersTypes.ts +13 -0
  423. package/src/types/global.d.ts +4 -0
  424. package/src/types/index.ts +21 -0
  425. package/src/utils/formatDICOMDate.test.ts +61 -0
  426. package/src/utils/formatDICOMDate.ts +65 -0
  427. package/src/utils/formatDICOMTime.test.ts +62 -0
  428. package/src/utils/formatDICOMTime.ts +49 -0
  429. package/src/utils/getToggledClassName.tsx +5 -0
  430. package/src/utils/index.ts +15 -0
  431. package/src/utils/parseStudyDateTimestamp.test.ts +47 -0
  432. package/src/utils/parseStudyDateTimestamp.ts +27 -0
  433. package/src/utils/roundNumber.ts +43 -0
  434. package/tailwind.config.js +120 -0
@@ -0,0 +1,214 @@
1
+ import * as React from 'react';
2
+ import { Popover, PopoverTrigger, PopoverContent } from '../../Popover/Popover';
3
+ import {
4
+ Select,
5
+ SelectContent,
6
+ SelectItem,
7
+ SelectSeparator,
8
+ SelectTrigger,
9
+ SelectValue,
10
+ } from '../../Select';
11
+ import { Label } from '../../Label';
12
+ import { Button } from '../../Button';
13
+ import { useWorkflows } from './WorkflowsProvider';
14
+
15
+ /** Context to allow subcomponents to close the popover */
16
+ type SettingsPopoverContextValue = {
17
+ close: () => void;
18
+ };
19
+
20
+ const SettingsPopoverContext = React.createContext<SettingsPopoverContextValue | null>(null);
21
+
22
+ function useSettingsPopoverContext() {
23
+ const ctx = React.useContext(SettingsPopoverContext);
24
+ if (!ctx) {
25
+ throw new Error('SettingsPopover subcomponents must be used within <SettingsPopover>');
26
+ }
27
+ return ctx;
28
+ }
29
+
30
+ type SettingsPopoverProps = {
31
+ children?: React.ReactNode;
32
+ };
33
+
34
+ /** Marker subcomponent: consumed by the root to render the PopoverTrigger */
35
+ type TriggerProps = {
36
+ children: React.ReactNode;
37
+ };
38
+
39
+ function SettingsPopoverTrigger(_props: TriggerProps) {
40
+ // This is a marker-only component. The root extracts its children and renders them inside PopoverTrigger.
41
+ return null;
42
+ }
43
+ SettingsPopoverTrigger.displayName = 'SettingsPopover.Trigger';
44
+
45
+ /**
46
+ * Root SettingsPopover component (compound API).
47
+ * Usage:
48
+ * <SettingsPopover>
49
+ * <SettingsPopover.Trigger><Button>...</Button></SettingsPopover.Trigger>
50
+ * <SettingsPopover.Content>
51
+ * <SettingsPopover.Workflow ... />
52
+ * <SettingsPopover.Divider />
53
+ * <SettingsPopover.Item onClick={...}>About</SettingsPopover.Item>
54
+ * </SettingsPopover.Content>
55
+ * </SettingsPopover>
56
+ */
57
+ function SettingsPopoverRoot({ children }: SettingsPopoverProps) {
58
+ const [open, setOpen] = React.useState(false);
59
+ const close = React.useCallback(() => setOpen(false), []);
60
+
61
+ // Extract the Trigger and Content nodes from children
62
+ const childrenArray = React.Children.toArray(children);
63
+ let triggerNode: React.ReactNode | null = null;
64
+ let contentNode: React.ReactElement<ContentProps> | null = null;
65
+
66
+ for (const child of childrenArray) {
67
+ if (React.isValidElement(child) && child.type === SettingsPopoverTrigger) {
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
69
+ triggerNode = (child.props as TriggerProps).children;
70
+ } else if (React.isValidElement(child) && child.type === SettingsPopoverContent) {
71
+ contentNode = child as React.ReactElement<ContentProps>;
72
+ }
73
+ }
74
+
75
+ if (!triggerNode) {
76
+ throw new Error(
77
+ '<SettingsPopover.Trigger> is required as a direct child of <SettingsPopover>.'
78
+ );
79
+ }
80
+ if (!contentNode) {
81
+ throw new Error(
82
+ '<SettingsPopover.Content> is required as a direct child of <SettingsPopover>.'
83
+ );
84
+ }
85
+
86
+ return (
87
+ <Popover
88
+ open={open}
89
+ onOpenChange={setOpen}
90
+ >
91
+ <PopoverTrigger asChild>{triggerNode}</PopoverTrigger>
92
+
93
+ <SettingsPopoverContext.Provider value={{ close }}>
94
+ {contentNode}
95
+ </SettingsPopoverContext.Provider>
96
+ </Popover>
97
+ );
98
+ }
99
+
100
+ type ContentProps = {
101
+ children?: React.ReactNode;
102
+ };
103
+
104
+ function SettingsPopoverContent({ children }: ContentProps) {
105
+ return (
106
+ <PopoverContent
107
+ align="end"
108
+ sideOffset={8}
109
+ className="w-[315px] p-4"
110
+ onOpenAutoFocus={e => e.preventDefault()}
111
+ >
112
+ {children}
113
+ </PopoverContent>
114
+ );
115
+ }
116
+
117
+ /**
118
+ * SettingsPopover.Workflow
119
+ * Renders the "Default Workflow" row with a Select.
120
+ * Closes the popover after selection.
121
+ */
122
+ function Workflow() {
123
+ const { close } = useSettingsPopoverContext();
124
+ const { workflows, defaultWorkflowId, setDefaultWorkflowId } = useWorkflows();
125
+ const selectId = React.useId();
126
+ const NO_DEFAULT_VALUE = '__NO_DEFAULT__';
127
+
128
+ return (
129
+ <div className="mt-0 flex items-center gap-3">
130
+ <Label
131
+ htmlFor={selectId}
132
+ className="whitespace-nowrap"
133
+ >
134
+ Default Workflow
135
+ </Label>
136
+ <div className="min-w-0 flex-1">
137
+ <Select
138
+ value={defaultWorkflowId ?? undefined}
139
+ onValueChange={value => {
140
+ if (value === NO_DEFAULT_VALUE) {
141
+ setDefaultWorkflowId();
142
+ } else {
143
+ setDefaultWorkflowId(value);
144
+ }
145
+ close();
146
+ }}
147
+ >
148
+ <SelectTrigger
149
+ id={selectId}
150
+ className="w-full"
151
+ >
152
+ <SelectValue placeholder="Select Workflow" />
153
+ </SelectTrigger>
154
+ {/* Keep stopPropagation so the Select's portal doesn't trigger outside interactions on the Popover */}
155
+ <SelectContent onPointerDown={e => e.stopPropagation()}>
156
+ {workflows.map(workflow => (
157
+ <SelectItem
158
+ key={workflow.id}
159
+ value={workflow.id}
160
+ >
161
+ {workflow.displayName}
162
+ </SelectItem>
163
+ ))}
164
+ <SelectSeparator />
165
+ <SelectItem value={NO_DEFAULT_VALUE}>No Default</SelectItem>
166
+ </SelectContent>
167
+ </Select>
168
+ </div>
169
+ </div>
170
+ );
171
+ }
172
+
173
+ /**
174
+ * SettingsPopover.Divider
175
+ * A simple divider to separate sections inside the popover.
176
+ */
177
+ function Divider() {
178
+ return <div className="bg-muted -mx-2 my-3 h-px" />;
179
+ }
180
+
181
+ type ItemProps = {
182
+ children: React.ReactNode;
183
+ onClick?: () => void;
184
+ };
185
+
186
+ function Item({ children, onClick }: ItemProps) {
187
+ const { close } = useSettingsPopoverContext();
188
+
189
+ const handleClick = () => {
190
+ onClick?.();
191
+ close();
192
+ };
193
+
194
+ return (
195
+ <Button
196
+ variant="ghost"
197
+ size="default"
198
+ onClick={handleClick}
199
+ className="h-7 w-full justify-start"
200
+ >
201
+ {children}
202
+ </Button>
203
+ );
204
+ }
205
+
206
+ SettingsPopoverRoot.displayName = 'SettingsPopover';
207
+
208
+ export const SettingsPopover = Object.assign(SettingsPopoverRoot, {
209
+ Trigger: SettingsPopoverTrigger,
210
+ Content: SettingsPopoverContent,
211
+ Workflow,
212
+ Divider,
213
+ Item,
214
+ });
@@ -0,0 +1,247 @@
1
+ import type { ReactNode } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { DataTable, useDataTable } from '../../DataTable';
4
+ import type { DataTableProps } from '../../DataTable/DataTable';
5
+ import { Button } from '../../Button';
6
+ import { DatePickerWithRange } from '../../DateRange';
7
+ import { InputMultiSelect } from '../../InputMultiSelect';
8
+ import type { StudyDateRangeFilter, StudyRow } from '../types/types';
9
+ import { tokenizeModalities } from '../utils/tokenizeModalities';
10
+ import { useWorkflows, type Workflow } from './WorkflowsProvider';
11
+ import { COLUMN_IDS } from '../columns/defaultColumns';
12
+
13
+ /**
14
+ * Replaces the built-in double-click action (launch the default workflow,
15
+ * falling back to the first applicable one). The row is selected before this
16
+ * is called. `workflows` are the workflows applicable to the study, in menu
17
+ * order; `defaultWorkflow` is the user's default when it applies to the study.
18
+ */
19
+ export type OnStudyDoubleClick = (
20
+ study: StudyRow,
21
+ context: { defaultWorkflow?: Workflow; workflows: Workflow[] }
22
+ ) => void;
23
+
24
+ export type TableProps = Omit<DataTableProps<StudyRow>, 'children' | 'getRowId'> & {
25
+ title?: ReactNode;
26
+ showColumnVisibility?: boolean;
27
+ tableClassName?: string;
28
+ toolbarLeftComponent?: ReactNode;
29
+ toolbarRightActionsComponent?: ReactNode;
30
+ toolbarRightComponent?: ReactNode;
31
+ isLoading?: boolean;
32
+ loadingComponent?: ReactNode;
33
+ onStudyDoubleClick?: OnStudyDoubleClick;
34
+ };
35
+
36
+ export function Table({
37
+ columns,
38
+ data,
39
+ title,
40
+ initialVisibility = {},
41
+ sorting,
42
+ pagination,
43
+ filters,
44
+ onSortingChange,
45
+ onPaginationChange,
46
+ onFiltersChange,
47
+ enforceSingleSelection = true,
48
+ showColumnVisibility = true,
49
+ tableClassName,
50
+ onSelectionChange,
51
+ toolbarLeftComponent,
52
+ toolbarRightActionsComponent,
53
+ toolbarRightComponent,
54
+ isLoading,
55
+ loadingComponent,
56
+ manualFiltering,
57
+ onStudyDoubleClick,
58
+ }: TableProps) {
59
+ return (
60
+ <DataTable<StudyRow>
61
+ data={data}
62
+ columns={columns}
63
+ getRowId={row => row.studyInstanceUid}
64
+ initialVisibility={initialVisibility}
65
+ sorting={sorting}
66
+ pagination={pagination}
67
+ filters={filters}
68
+ onSortingChange={onSortingChange}
69
+ onPaginationChange={onPaginationChange}
70
+ onFiltersChange={onFiltersChange}
71
+ manualFiltering={manualFiltering}
72
+ enforceSingleSelection={enforceSingleSelection}
73
+ onSelectionChange={onSelectionChange}
74
+ >
75
+ <TableContent
76
+ title={title}
77
+ showColumnVisibility={showColumnVisibility}
78
+ tableClassName={tableClassName}
79
+ toolbarLeftComponent={toolbarLeftComponent}
80
+ toolbarRightActionsComponent={toolbarRightActionsComponent}
81
+ toolbarRightComponent={toolbarRightComponent}
82
+ isLoading={isLoading}
83
+ loadingComponent={loadingComponent}
84
+ onStudyDoubleClick={onStudyDoubleClick}
85
+ />
86
+ </DataTable>
87
+ );
88
+ }
89
+
90
+ function TableContent({
91
+ title,
92
+ showColumnVisibility,
93
+ tableClassName,
94
+ toolbarLeftComponent,
95
+ toolbarRightActionsComponent,
96
+ toolbarRightComponent,
97
+ isLoading,
98
+ loadingComponent,
99
+ onStudyDoubleClick,
100
+ }: {
101
+ title?: ReactNode;
102
+ showColumnVisibility?: boolean;
103
+ tableClassName?: string;
104
+ toolbarLeftComponent?: ReactNode;
105
+ toolbarRightActionsComponent?: ReactNode;
106
+ toolbarRightComponent?: ReactNode;
107
+ isLoading?: boolean;
108
+ loadingComponent?: ReactNode;
109
+ onStudyDoubleClick?: TableProps['onStudyDoubleClick'];
110
+ }) {
111
+ const { t } = useTranslation('StudyList');
112
+ const { table } = useDataTable<StudyRow>();
113
+ const rows = (table.options?.data as StudyRow[]) ?? [];
114
+ // Build a flat list of modality tokens across all rows.
115
+ // tokenizeModalities uppercases and splits on whitespace/slash/comma to produce unique modality codes for filtering.
116
+ const tokens = rows.flatMap(r => tokenizeModalities(String(r.modalities ?? '')));
117
+ const modalityOptions = Array.from(new Set(tokens)).sort();
118
+ // Access workflow provider for default workflow + launch
119
+ const { getDefaultWorkflowForStudy, getWorkflowsForStudy } = useWorkflows();
120
+
121
+ return (
122
+ <div className="flex h-full flex-col">
123
+ {(showColumnVisibility || title) && (
124
+ <DataTable.Toolbar>
125
+ <div className="absolute left-0">{toolbarLeftComponent}</div>
126
+ {title ? <DataTable.Title>{title}</DataTable.Title> : null}
127
+ <div className="absolute right-0 flex items-center">
128
+ {toolbarRightActionsComponent}
129
+ {toolbarRightActionsComponent && <div className="bg-input mx-2 h-4 w-px" />}
130
+ {/* Pagination appears to the left of the "View" button */}
131
+ <DataTable.Pagination<StudyRow> />
132
+ {showColumnVisibility && <DataTable.ViewOptions<StudyRow> />}
133
+ {toolbarRightComponent}
134
+ </div>
135
+ </DataTable.Toolbar>
136
+ )}
137
+ <DataTable.Table<StudyRow> tableClassName={tableClassName}>
138
+ <DataTable.Header<StudyRow> />
139
+ <DataTable.FilterRow<StudyRow>
140
+ excludeColumnIds={[COLUMN_IDS.INSTANCES]}
141
+ renderFilterCell={({ columnId, value, setValue }) => {
142
+ if (columnId === COLUMN_IDS.ACTIONS) {
143
+ return (
144
+ <div className="text-right">
145
+ <Button
146
+ variant="ghost"
147
+ size="sm"
148
+ onClick={() => table.setColumnFilters([])}
149
+ aria-label="Reset filters"
150
+ >
151
+ Reset
152
+ </Button>
153
+ </div>
154
+ );
155
+ }
156
+ if (columnId === COLUMN_IDS.STUDY_DATE_TIME) {
157
+ const dateRange =
158
+ value && typeof value === 'object' ? (value as StudyDateRangeFilter) : {};
159
+ const startDate = dateRange.startDate ?? '';
160
+ const endDate = dateRange.endDate ?? '';
161
+
162
+ return (
163
+ <DatePickerWithRange
164
+ id={COLUMN_IDS.STUDY_DATE_TIME}
165
+ startDate={startDate}
166
+ endDate={endDate}
167
+ onChange={next => {
168
+ const normalized = {
169
+ ...(next.startDate ? { startDate: next.startDate } : {}),
170
+ ...(next.endDate ? { endDate: next.endDate } : {}),
171
+ };
172
+ setValue(Object.keys(normalized).length > 0 ? normalized : undefined);
173
+ }}
174
+ />
175
+ );
176
+ }
177
+ if (columnId === COLUMN_IDS.MODALITIES) {
178
+ const selected = Array.isArray(value) ? (value as string[]) : [];
179
+ return (
180
+ <InputMultiSelect
181
+ options={modalityOptions}
182
+ value={selected}
183
+ onChange={next => setValue(next)}
184
+ >
185
+ <InputMultiSelect.Field>
186
+ <InputMultiSelect.Summary />
187
+ <InputMultiSelect.Input
188
+ ariaLabel="Filter Modalities"
189
+ placeholder=""
190
+ />
191
+ </InputMultiSelect.Field>
192
+ <InputMultiSelect.Content
193
+ fitToContent
194
+ maxWidth={185}
195
+ >
196
+ <InputMultiSelect.Options />
197
+ </InputMultiSelect.Content>
198
+ </InputMultiSelect>
199
+ );
200
+ }
201
+ // Return null/undefined to use default rendering for other columns
202
+ return null;
203
+ }}
204
+ />
205
+ <DataTable.Body<StudyRow>
206
+ emptyMessage={t('No studies available')}
207
+ isLoading={isLoading}
208
+ loadingComponent={loadingComponent}
209
+ rowProps={{
210
+ className: 'group cursor-pointer',
211
+ onClick: row => {
212
+ const original = row.original as StudyRow;
213
+ const canDoubleClickLaunch =
214
+ Boolean(onStudyDoubleClick) || getWorkflowsForStudy(original).length > 0;
215
+ // When a double click can launch, the second click must not read
216
+ // as an unselect — clicking only ever selects. Otherwise toggle.
217
+ if (canDoubleClickLaunch) {
218
+ if (!row.getIsSelected()) {
219
+ row.toggleSelected(true);
220
+ }
221
+ } else {
222
+ row.toggleSelected();
223
+ }
224
+ },
225
+ onDoubleClick: row => {
226
+ const original = row.original as StudyRow;
227
+ const workflows = getWorkflowsForStudy(original);
228
+ const defaultWorkflow = getDefaultWorkflowForStudy(original);
229
+ // Ensure the row is selected before launching
230
+ if (!row.getIsSelected()) {
231
+ row.toggleSelected(true);
232
+ }
233
+ if (onStudyDoubleClick) {
234
+ onStudyDoubleClick(original, { defaultWorkflow, workflows });
235
+ return;
236
+ }
237
+ // Launch the default workflow, or fall back to the first
238
+ // applicable one (the top entry of the row's workflow menu).
239
+ const workflow = defaultWorkflow ?? workflows[0];
240
+ workflow?.launchWithStudy(original);
241
+ },
242
+ }}
243
+ />
244
+ </DataTable.Table>
245
+ </div>
246
+ );
247
+ }
@@ -0,0 +1,72 @@
1
+ import * as React from 'react';
2
+ import { Button } from '../../Button';
3
+ import { Icons } from '../../Icons';
4
+ import {
5
+ DropdownMenu,
6
+ DropdownMenuTrigger,
7
+ DropdownMenuContent,
8
+ DropdownMenuItem,
9
+ } from '../../DropdownMenu';
10
+ import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from '../../Tooltip';
11
+ import { useWorkflows } from './WorkflowsProvider';
12
+ import type { StudyRow } from '../types/types';
13
+
14
+ type Props = {
15
+ studyRow: StudyRow;
16
+ align?: 'start' | 'end' | 'center';
17
+ };
18
+
19
+ export function WorkflowMenu({ studyRow, align = 'end' }: Props) {
20
+ const [open, setOpen] = React.useState(false);
21
+ const { getWorkflowsForStudy } = useWorkflows();
22
+ const workflows = getWorkflowsForStudy(studyRow);
23
+
24
+ return (
25
+ <DropdownMenu
26
+ open={open}
27
+ onOpenChange={setOpen}
28
+ >
29
+ <TooltipProvider delayDuration={200}>
30
+ <Tooltip>
31
+ <TooltipTrigger asChild>
32
+ <DropdownMenuTrigger asChild>
33
+ <Button
34
+ size="icon"
35
+ variant="ghost"
36
+ aria-expanded={open}
37
+ aria-haspopup="menu"
38
+ aria-label="Action Menu"
39
+ className="bg-primary/20 text-primary hover:bg-primary/30 mt-1 h-6 w-6 transition-opacity"
40
+ >
41
+ <Icons.More className="h-6 w-6" />
42
+ </Button>
43
+ </DropdownMenuTrigger>
44
+ </TooltipTrigger>
45
+ <TooltipContent side="bottom">Action Menu</TooltipContent>
46
+ </Tooltip>
47
+ </TooltipProvider>
48
+ <DropdownMenuContent
49
+ align={align}
50
+ onClick={e => e.stopPropagation()}
51
+ >
52
+ <div className="text-muted-foreground border-input my-1.5 mx-1 border-b py-1 pl-1 pr-4 text-sm">
53
+ Launch Workflow:
54
+ </div>
55
+ {workflows.map(workflow => (
56
+ <DropdownMenuItem
57
+ key={workflow.id}
58
+ onSelect={e => {
59
+ e.preventDefault();
60
+ workflow.launchWithStudy(studyRow);
61
+ }}
62
+ className={workflow.isDefault ? 'font-semibold' : undefined}
63
+ aria-current={workflow.isDefault ? 'true' : undefined}
64
+ >
65
+ {workflow.isDefault ? '✓ ' : null}
66
+ {workflow.displayName}
67
+ </DropdownMenuItem>
68
+ ))}
69
+ </DropdownMenuContent>
70
+ </DropdownMenu>
71
+ );
72
+ }
@@ -0,0 +1,169 @@
1
+ import * as React from 'react';
2
+ import { useNavigate } from 'react-router-dom';
3
+ import type { StudyRow } from '../types/types';
4
+ import { useDefaultWorkflow } from '../hooks/useDefaultWorkflow';
5
+
6
+ /**
7
+ * Represents a workflow that can be launched from the study list.
8
+ * Each workflow corresponds to a mode from appConfig.loadedModes.
9
+ */
10
+ export interface Workflow {
11
+ /** Unique identifier for the workflow (from mode.id) */
12
+ readonly id: string;
13
+ /** Display name of the workflow (from mode.displayName) */
14
+ readonly displayName: string;
15
+ /** Launches the study using this workflow's route */
16
+ launchWithStudy: (studyRow: StudyRow) => void;
17
+ /** Determines if this workflow is applicable to the given study */
18
+ isApplicableToStudy: (studyRow: StudyRow) => boolean;
19
+ /** Whether this workflow is the default workflow */
20
+ readonly isDefault: boolean;
21
+ }
22
+
23
+ export type WorkflowsContextValue = {
24
+ /** All available workflows */
25
+ workflows: readonly Workflow[];
26
+ /** Get workflows that are applicable to a specific study */
27
+ getWorkflowsForStudy: (studyRow: StudyRow) => Workflow[];
28
+ /** Get the default workflow for a study (only if it's applicable) */
29
+ getDefaultWorkflowForStudy: (studyRow: StudyRow) => Workflow | undefined;
30
+ /** The current default workflow mode ID */
31
+ defaultWorkflowId: string | undefined;
32
+ /** Set the default workflow ID */
33
+ setDefaultWorkflowId: (workflowId?: string) => void;
34
+ };
35
+
36
+ const WorkflowsContext = React.createContext<WorkflowsContextValue | undefined>(undefined);
37
+
38
+ export type Mode = {
39
+ id: string;
40
+ routeName: string;
41
+ displayName: string;
42
+ hide?: boolean;
43
+ isValidMode?: (args: { modalities: string; study: unknown }) => {
44
+ valid: boolean | null;
45
+ description?: string;
46
+ };
47
+ };
48
+
49
+ type WorkflowsProviderProps = {
50
+ /** Array of loaded modes from appConfig */
51
+ loadedModes: Mode[];
52
+ /** Optional data path prefix for routes (e.g., '/dicomweb') */
53
+ dataPath?: string;
54
+ /** Function to preserve query parameters when launching workflows */
55
+ preserveQueryParameters: (query: URLSearchParams) => void;
56
+ children: React.ReactNode;
57
+ };
58
+
59
+ /**
60
+ * Provider that creates workflows from loaded modes and provides them via context.
61
+ * Each workflow can launch studies and determine applicability based on mode validation.
62
+ */
63
+ export function WorkflowsProvider({
64
+ loadedModes,
65
+ dataPath,
66
+ preserveQueryParameters,
67
+ children,
68
+ }: WorkflowsProviderProps) {
69
+ const navigate = useNavigate();
70
+
71
+ // Get valid workflow IDs from loaded modes (for validation)
72
+ const validWorkflowIds = loadedModes.filter(m => !m.hide && m.displayName).map(m => m.id);
73
+
74
+ // Use localStorage-backed hook for persistence
75
+ const [storedDefaultWorkflowId, setStoredDefaultWorkflowId] =
76
+ useDefaultWorkflow(validWorkflowIds);
77
+
78
+ // Convert null to undefined for consistency with context type
79
+ const defaultWorkflowId = storedDefaultWorkflowId ?? undefined;
80
+
81
+ // Wrapper that persists to localStorage
82
+ const setDefaultWorkflowId = (workflowId?: string) => {
83
+ setStoredDefaultWorkflowId(workflowId ?? null);
84
+ };
85
+
86
+ const workflows: Workflow[] = [];
87
+
88
+ for (const mode of loadedModes) {
89
+ // Filter out hidden modes
90
+ if (mode.hide) {
91
+ continue;
92
+ }
93
+
94
+ // Skip modes without displayName
95
+ if (!mode.displayName) {
96
+ continue;
97
+ }
98
+
99
+ const isDefault = mode.id === defaultWorkflowId;
100
+
101
+ const workflow: Workflow = {
102
+ id: mode.id,
103
+ displayName: mode.displayName,
104
+ launchWithStudy: (studyRow: StudyRow) => {
105
+ if (!studyRow.studyInstanceUid) {
106
+ console.warn('Cannot launch workflow: study has no studyInstanceUid');
107
+ return;
108
+ }
109
+
110
+ const query = new URLSearchParams();
111
+ query.append('StudyInstanceUIDs', studyRow.studyInstanceUid);
112
+ preserveQueryParameters(query);
113
+
114
+ const route = `${mode.routeName}${dataPath || ''}?${query.toString()}`;
115
+ navigate(route);
116
+ },
117
+ isApplicableToStudy: (studyRow: StudyRow) => {
118
+ if (!mode.isValidMode) {
119
+ // If no validation function, assume applicable
120
+ return true;
121
+ }
122
+
123
+ const modalitiesToCheck = String(studyRow.modalities ?? '').replaceAll('/', '\\');
124
+ const result = mode.isValidMode({
125
+ modalities: modalitiesToCheck,
126
+ study: studyRow,
127
+ });
128
+
129
+ // Return true only if valid is explicitly true
130
+ // null means hide (not applicable), false means disabled but visible
131
+ return result.valid === true;
132
+ },
133
+ isDefault,
134
+ };
135
+
136
+ workflows.push(workflow);
137
+ }
138
+
139
+ const getWorkflowsForStudy = (studyRow: StudyRow): Workflow[] => {
140
+ return workflows.filter(workflow => workflow.isApplicableToStudy(studyRow));
141
+ };
142
+
143
+ const getDefaultWorkflowForStudy = (studyRow: StudyRow): Workflow | undefined => {
144
+ const applicableWorkflows = getWorkflowsForStudy(studyRow);
145
+ return applicableWorkflows.find(workflow => workflow.isDefault);
146
+ };
147
+
148
+ const value: WorkflowsContextValue = {
149
+ workflows,
150
+ getWorkflowsForStudy,
151
+ getDefaultWorkflowForStudy,
152
+ defaultWorkflowId,
153
+ setDefaultWorkflowId,
154
+ };
155
+
156
+ return <WorkflowsContext.Provider value={value}>{children}</WorkflowsContext.Provider>;
157
+ }
158
+
159
+ /**
160
+ * Hook to access the study list workflow context.
161
+ * Must be used within a WorkflowsProvider.
162
+ */
163
+ export function useWorkflows(): WorkflowsContextValue {
164
+ const ctx = React.useContext(WorkflowsContext);
165
+ if (!ctx) {
166
+ throw new Error('useWorkflows must be used within <WorkflowsProvider>');
167
+ }
168
+ return ctx;
169
+ }