@ohif/ui-next 3.14.0-beta.1 → 3.14.0-beta.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/dist/ohif-ui-next.css +7 -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,11 @@
1
+ export {
2
+ SmartScrollbar,
3
+ useSmartScrollbarLayoutContext,
4
+ useSmartScrollbarScrollContext,
5
+ } from './SmartScrollbar';
6
+ export { SmartScrollbarTrack } from './SmartScrollbarTrack';
7
+ export { SmartScrollbarFill } from './SmartScrollbarFill';
8
+ export { SmartScrollbarIndicator } from './SmartScrollbarIndicator';
9
+ export { SmartScrollbarEndpoints } from './SmartScrollbarEndpoints';
10
+ export { useByteArray } from './useByteArray';
11
+ export type { ByteArrayHandle } from './useByteArray';
@@ -0,0 +1,146 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+
3
+ export interface ByteArrayHandle {
4
+ /** Marked positions. A new identity is published whenever the contents change. */
5
+ bytes: Uint8Array;
6
+ /** True when every byte in the array is set (all positions marked). */
7
+ isFull: boolean;
8
+ setByte: (index: number) => void;
9
+ clearByte: (index: number) => void;
10
+ resetWith: (populate: (bytes: Uint8Array) => void) => void;
11
+ }
12
+
13
+ /**
14
+ * Manages a mutable Uint8Array (one byte per position) with React change
15
+ * detection.
16
+ *
17
+ * Writes mutate a single buffer in place, so marking a position costs nothing
18
+ * and never reallocates. Change is published by `commit()`, which swaps in a
19
+ * fresh view over that same buffer via `subarray()` — an O(1) identity change
20
+ * with no copy.
21
+ *
22
+ * Publishing a new identity is load-bearing, not cosmetic. The React Compiler
23
+ * infers memoization dependencies from the values a callback actually reads, so
24
+ * a separate change token would be dropped from the emitted cache guard, and a
25
+ * consumer memoizing on `bytes` alone would never recompute.
26
+ *
27
+ * @param size - Number of positions (e.g. total slices in a viewport).
28
+ * @param batchIntervalMs - When > 0, writes are coalesced into a scheduled
29
+ * flush: the first write starts a timer, the next
30
+ * flush publishes, and the timer stops. New writes
31
+ * start a new interval window. Omit or pass 0 for
32
+ * immediate re-renders on every write.
33
+ */
34
+ export function useByteArray(size: number, batchIntervalMs = 0): ByteArrayHandle {
35
+ // State is declared first so the initial buffer comes from it rather than
36
+ // from a ref read during render, which the compiler rightly rejects.
37
+ const [published, setPublished] = useState(() => ({
38
+ bytes: new Uint8Array(size),
39
+ count: 0,
40
+ }));
41
+ const bytesRef = useRef(published.bytes);
42
+ const countRef = useRef(0);
43
+ const timeoutIdRef = useRef<number | null>(null);
44
+
45
+ const clearScheduledFlush = useCallback(() => {
46
+ if (timeoutIdRef.current !== null) {
47
+ window.clearTimeout(timeoutIdRef.current);
48
+ timeoutIdRef.current = null;
49
+ }
50
+ }, []);
51
+
52
+ // Publish the buffer's current contents: a new view identity over the same
53
+ // memory, plus the count that goes with it, in one state update.
54
+ const commit = useCallback(() => {
55
+ setPublished({ bytes: bytesRef.current.subarray(), count: countRef.current });
56
+ }, []);
57
+
58
+ const flushScheduled = useCallback(() => {
59
+ // End this timeout window after the scheduled flush.
60
+ clearScheduledFlush();
61
+ commit();
62
+ }, [clearScheduledFlush, commit]);
63
+
64
+ // Reset array only when size actually changes — skip on initial mount since
65
+ // bytesRef is already initialized to the correct size via useState.
66
+ useEffect(() => {
67
+ if (bytesRef.current.length === size) return;
68
+ // Drop any in-flight timeout window when resetting the underlying array.
69
+ clearScheduledFlush();
70
+ bytesRef.current = new Uint8Array(size);
71
+ countRef.current = 0;
72
+ commit();
73
+ }, [size, clearScheduledFlush, commit]);
74
+
75
+ useEffect(() => {
76
+ // If timing changes mid-window, restart that timeout using the new timing.
77
+ const pendingTimeoutId = timeoutIdRef.current;
78
+ clearScheduledFlush();
79
+ if (batchIntervalMs <= 0) {
80
+ if (pendingTimeoutId !== null) {
81
+ commit();
82
+ }
83
+ return;
84
+ }
85
+ if (pendingTimeoutId !== null) {
86
+ timeoutIdRef.current = window.setTimeout(flushScheduled, batchIntervalMs);
87
+ }
88
+ return () => clearScheduledFlush();
89
+ }, [batchIntervalMs, clearScheduledFlush, commit, flushScheduled]);
90
+
91
+ const bump = useCallback(() => {
92
+ if (batchIntervalMs <= 0) {
93
+ commit();
94
+ return;
95
+ }
96
+
97
+ if (timeoutIdRef.current === null) {
98
+ timeoutIdRef.current = window.setTimeout(flushScheduled, batchIntervalMs);
99
+ }
100
+ }, [batchIntervalMs, commit, flushScheduled]);
101
+
102
+ const setByte = useCallback(
103
+ (index: number) => {
104
+ const bytes = bytesRef.current;
105
+ if (index < 0 || index >= bytes.length || bytes[index] === 1) return;
106
+ bytes[index] = 1;
107
+ countRef.current++;
108
+ bump();
109
+ },
110
+ [bump]
111
+ );
112
+
113
+ const clearByte = useCallback(
114
+ (index: number) => {
115
+ const bytes = bytesRef.current;
116
+ if (index < 0 || index >= bytes.length || bytes[index] === 0) return;
117
+ bytes[index] = 0;
118
+ countRef.current--;
119
+ bump();
120
+ },
121
+ [bump]
122
+ );
123
+
124
+ const resetWith = useCallback(
125
+ (populate: (bytes: Uint8Array) => void) => {
126
+ const bytes = bytesRef.current;
127
+ bytes.fill(0);
128
+ populate(bytes);
129
+ let count = 0;
130
+ for (let i = 0; i < bytes.length; i++) {
131
+ if (bytes[i]) count++;
132
+ }
133
+ countRef.current = count;
134
+ bump();
135
+ },
136
+ [bump]
137
+ );
138
+
139
+ return {
140
+ bytes: published.bytes,
141
+ isFull: size > 0 && published.count === size,
142
+ setByte,
143
+ clearByte,
144
+ resetWith,
145
+ };
146
+ }
@@ -0,0 +1,124 @@
1
+ import {
2
+ computeContiguousRuns,
3
+ computeIndicatorTopOffsetInFill,
4
+ computePixelFilledFromMarked,
5
+ } from './utils';
6
+
7
+ function u8(values: number[]): Uint8Array {
8
+ return new Uint8Array(values);
9
+ }
10
+
11
+ describe('computePixelFilledFromMarked', () => {
12
+ it('returns empty when pixelCount <= 0', () => {
13
+ expect(computePixelFilledFromMarked(u8([1, 1, 1]), 0)).toEqual(new Uint8Array(0));
14
+ expect(computePixelFilledFromMarked(u8([1, 1, 1]), -10)).toEqual(new Uint8Array(0));
15
+ });
16
+
17
+ it('returns empty when marked is empty', () => {
18
+ expect(computePixelFilledFromMarked(new Uint8Array(0), 10)).toEqual(new Uint8Array(0));
19
+ });
20
+
21
+ it('downsamples conservatively when total >= pixelCount (AND within each bucket)', () => {
22
+ // total=7, pixelCount=3 => buckets [0..2), [2..4), [4..7) (requires rounding)
23
+ const marked = u8([1, 1, 1, 0, 1, 1, 1]);
24
+ const result = computePixelFilledFromMarked(marked, 3);
25
+ expect(Array.from(result)).toEqual([1, 0, 1]);
26
+ });
27
+
28
+ it('downsamples conservatively with uneven bucket sizes (requires rounding)', () => {
29
+ // total=5, pixelCount=4 => buckets [0..1), [1..2), [2..3), [3..5)
30
+ const marked = u8([1, 1, 1, 1, 0]);
31
+ const result = computePixelFilledFromMarked(marked, 4);
32
+ expect(Array.from(result)).toEqual([1, 1, 1, 0]);
33
+ });
34
+
35
+ it('upsamples by filling the full pixel span of each marked item when pixelCount > total', () => {
36
+ // total=4, pixelCount=7 =>
37
+ // item 0 spans pixels [0..1) (requires rounding)
38
+ // item 2 spans pixels [3..5) (requires rounding)
39
+ const marked = u8([1, 0, 1, 0]);
40
+ const result = computePixelFilledFromMarked(marked, 7);
41
+ expect(Array.from(result)).toEqual([1, 0, 0, 1, 1, 0, 0]);
42
+ });
43
+
44
+ it('upsamples correctly when a marked item maps to a single pixel row', () => {
45
+ // total=6, pixelCount=7 => items 0..4 each map to exactly 1 pixel; item 5 maps to 2 pixels.
46
+ const marked = u8([0, 0, 0, 1, 0, 1]); // item 3 => pixel 3; item 5 => pixels 5-6
47
+ const result = computePixelFilledFromMarked(marked, 7);
48
+ expect(Array.from(result)).toEqual([0, 0, 0, 1, 0, 1, 1]);
49
+ });
50
+
51
+ it('uses Math.floor(pixelCount) for output length (downsample branch)', () => {
52
+ const marked = u8([1, 0, 1, 0]);
53
+ expect(computePixelFilledFromMarked(marked, 3.9)).toHaveLength(3);
54
+ expect(computePixelFilledFromMarked(marked, 3.1)).toHaveLength(3);
55
+ });
56
+
57
+ it('uses Math.floor(pixelCount) for output length (upsample branch)', () => {
58
+ const marked = u8([1, 0, 1]);
59
+ expect(computePixelFilledFromMarked(marked, 7.9)).toHaveLength(7);
60
+ expect(computePixelFilledFromMarked(marked, 7.1)).toHaveLength(7);
61
+ });
62
+ });
63
+
64
+ describe('computeIndicatorTopOffsetInFill', () => {
65
+ it('top-aligns first bucket, centers middle, bottom-aligns last (pixelCount > total)', () => {
66
+ const total = 3;
67
+ const pixelCount = 9;
68
+ const indicatorHeight = 2;
69
+ // Buckets: [0,3), [3,6), [6,9)
70
+ expect(computeIndicatorTopOffsetInFill(0, total, pixelCount, indicatorHeight)).toBe(0);
71
+ expect(computeIndicatorTopOffsetInFill(1, total, pixelCount, indicatorHeight)).toBe(3);
72
+ expect(computeIndicatorTopOffsetInFill(2, total, pixelCount, indicatorHeight)).toBe(7);
73
+ });
74
+
75
+ it('top-aligns to fill pixel row when total >= pixelCount (slices > pixels)', () => {
76
+ const total = 10;
77
+ const pixelCount = 3;
78
+ const indicatorHeight = 1;
79
+ // Same buckets as computePixelFilledFromMarked: row0 [0,3), row1 [3,6), row2 [6,10)
80
+ expect(computeIndicatorTopOffsetInFill(0, total, pixelCount, indicatorHeight)).toBe(0);
81
+ expect(computeIndicatorTopOffsetInFill(2, total, pixelCount, indicatorHeight)).toBe(0);
82
+ expect(computeIndicatorTopOffsetInFill(3, total, pixelCount, indicatorHeight)).toBe(1);
83
+ expect(computeIndicatorTopOffsetInFill(5, total, pixelCount, indicatorHeight)).toBe(1);
84
+ expect(computeIndicatorTopOffsetInFill(6, total, pixelCount, indicatorHeight)).toBe(2);
85
+ expect(computeIndicatorTopOffsetInFill(9, total, pixelCount, indicatorHeight)).toBe(2);
86
+ });
87
+
88
+ it('clamps when indicator is taller than remaining fill space', () => {
89
+ const total = 2;
90
+ const pixelCount = 5;
91
+ const indicatorHeight = 10;
92
+ expect(computeIndicatorTopOffsetInFill(0, total, pixelCount, indicatorHeight)).toBe(0);
93
+ expect(computeIndicatorTopOffsetInFill(1, total, pixelCount, indicatorHeight)).toBe(0);
94
+ });
95
+
96
+ it('returns 0 when pixelCount is 0', () => {
97
+ expect(computeIndicatorTopOffsetInFill(0, 5, 0, 4)).toBe(0);
98
+ });
99
+ });
100
+
101
+ describe('computeContiguousRuns', () => {
102
+ it('returns [] for empty input', () => {
103
+ expect(computeContiguousRuns(new Uint8Array(0))).toEqual([]);
104
+ });
105
+
106
+ it('returns [] when all bytes are zero', () => {
107
+ expect(computeContiguousRuns(u8([0, 0, 0, 0]))).toEqual([]);
108
+ });
109
+
110
+ it('returns a single run when all bytes are non-zero', () => {
111
+ expect(computeContiguousRuns(u8([1, 1, 2, 3]))).toEqual([{ start: 0, length: 4 }]);
112
+ });
113
+
114
+ it('finds runs with leading/trailing zeros', () => {
115
+ expect(computeContiguousRuns(u8([0, 0, 1, 1, 0, 2, 0, 0]))).toEqual([
116
+ { start: 2, length: 2 },
117
+ { start: 5, length: 1 },
118
+ ]);
119
+ });
120
+
121
+ it('treats any non-zero byte as filled', () => {
122
+ expect(computeContiguousRuns(u8([0, 255, 128, 0]))).toEqual([{ start: 1, length: 2 }]);
123
+ });
124
+ });
@@ -0,0 +1,168 @@
1
+ export interface ContiguousRun {
2
+ start: number;
3
+ length: number;
4
+ }
5
+
6
+ /**
7
+ * Given a Uint8Array where each non-zero byte represents a set position,
8
+ * returns contiguous runs in a single O(n) pass. No sorting or heap
9
+ * allocations inside the loop.
10
+ */
11
+ export function computeContiguousRuns(bytes: Uint8Array): ContiguousRun[] {
12
+ const runs: ContiguousRun[] = [];
13
+ const n = bytes.length;
14
+ let i = 0;
15
+
16
+ while (i < n) {
17
+ while (i < n && bytes[i] === 0) i++;
18
+ if (i >= n) break;
19
+
20
+ const start = i;
21
+ while (i < n && bytes[i] !== 0) i++;
22
+
23
+ runs.push({ start, length: i - start });
24
+ }
25
+
26
+ return runs;
27
+ }
28
+
29
+ /**
30
+ * When `total >= pixelRowCount`: half-open item index range `[itemStart, itemEnd)`
31
+ * covered by fill pixel row `pixelIndex`. `pixelRowCount` is `floor(pixelCount)` from callers.
32
+ * Shared by `computePixelFilledFromMarked` and `computeIndicatorTopOffsetInFill` — keep in sync.
33
+ */
34
+ function itemRangeForPixelRow(
35
+ pixelIndex: number,
36
+ total: number,
37
+ pixelRowCount: number
38
+ ): { itemStart: number; itemEnd: number } {
39
+ const itemStart = Math.floor((pixelIndex * total) / pixelRowCount);
40
+ const itemEnd = Math.floor(((pixelIndex + 1) * total) / pixelRowCount);
41
+ return { itemStart, itemEnd };
42
+ }
43
+
44
+ /**
45
+ * When `total >= pixelRowCount`: which fill pixel row owns `itemIndex` for the same
46
+ * partition as `itemRangeForPixelRow` (inverse of scanning rows until
47
+ * `itemIndex ∈ [itemStart, itemEnd)`).
48
+ *
49
+ * Readable form: `ceil((itemIndex + 1) * pixelRowCount / total) - 1`, clamped to `[0, pixelRowCount - 1]`.
50
+ */
51
+ function pixelRowIndexForItemDownsample(
52
+ itemIndex: number,
53
+ total: number,
54
+ pixelRowCount: number
55
+ ): number {
56
+ const rowIndex = Math.ceil(((itemIndex + 1) * pixelRowCount) / total) - 1;
57
+ return Math.max(0, Math.min(pixelRowCount - 1, rowIndex));
58
+ }
59
+
60
+ /**
61
+ * When `pixelRowCount > total`: half-open pixel row range `[pixelStart, pixelEnd)`
62
+ * covered by `itemIndex`. `pixelRowCount` is `floor(pixelCount)` from callers.
63
+ * Shared by `computePixelFilledFromMarked` and `computeIndicatorTopOffsetInFill` — keep in sync.
64
+ */
65
+ function pixelSpanForItem(
66
+ itemIndex: number,
67
+ total: number,
68
+ pixelRowCount: number
69
+ ): { pixelStart: number; pixelEnd: number } {
70
+ const pixelStart = Math.floor((itemIndex * pixelRowCount) / total);
71
+ const pixelEnd = Math.floor(((itemIndex + 1) * pixelRowCount) / total);
72
+ return { pixelStart, pixelEnd };
73
+ }
74
+
75
+ /**
76
+ * Convert marked items (0/1 bytes) into a per-pixel fill mask (0/1 bytes).
77
+ * The result is conservative in the sense that a pixel row is filled only when
78
+ * its mapped items are all marked, so the fill never overstates coverage.
79
+ *
80
+ * - If `total >= pixelCount`: each pixel row maps to a disjoint item-index
81
+ * range; a pixel row is filled only if all items in that range are marked.
82
+ * - If `pixelCount > total`: each item spans multiple pixel rows; if the item
83
+ * is marked, its entire pixel span is filled.
84
+ */
85
+ export function computePixelFilledFromMarked(
86
+ marked: Uint8Array,
87
+ pixelCount: number
88
+ ): Uint8Array {
89
+ const total = marked.length;
90
+ const pixelRowCount = Math.max(0, Math.floor(pixelCount));
91
+ if (pixelRowCount === 0 || total <= 0) return new Uint8Array(0);
92
+
93
+ const pixelFilled = new Uint8Array(pixelRowCount);
94
+
95
+ if (total >= pixelRowCount) {
96
+ for (let pixelIndex = 0; pixelIndex < pixelRowCount; pixelIndex++) {
97
+ const { itemStart, itemEnd } = itemRangeForPixelRow(pixelIndex, total, pixelRowCount);
98
+ if (itemEnd <= itemStart) continue;
99
+
100
+ let filled = 1;
101
+ for (let i = itemStart; i < itemEnd; i++) {
102
+ if (marked[i] === 0) {
103
+ filled = 0;
104
+ break;
105
+ }
106
+ }
107
+ pixelFilled[pixelIndex] = filled;
108
+ }
109
+ } else {
110
+ for (let itemIndex = 0; itemIndex < total; itemIndex++) {
111
+ if (marked[itemIndex] === 0) continue;
112
+ const { pixelStart, pixelEnd } = pixelSpanForItem(itemIndex, total, pixelRowCount);
113
+ for (let pixel = pixelStart; pixel < pixelEnd; pixel++) {
114
+ pixelFilled[pixel] = 1;
115
+ }
116
+ }
117
+ }
118
+
119
+ return pixelFilled;
120
+ }
121
+
122
+ /**
123
+ * Vertical offset (px) of the indicator within the fill strip `[0, pixelCount)`,
124
+ * clamped so the indicator stays inside the track.
125
+ *
126
+ * - When `total >= pixelCount` (many slices, few pixel rows): same partition as
127
+ * `computePixelFilledFromMarked` (per-pixel item buckets); **top-align** the
128
+ * indicator to that row (then clamp so the thumb does not overflow the strip).
129
+ * - When `pixelCount > total`: same per-item pixel spans as the fill’s upsample
130
+ * branch; first item top-aligned, last bottom-aligned, middle centered in bucket.
131
+ * - Zero-height bucket (upsample only): top-aligned `pixelStart` from `pixelSpanForItem`.
132
+ */
133
+ export function computeIndicatorTopOffsetInFill(
134
+ itemIndex: number,
135
+ total: number,
136
+ pixelCount: number,
137
+ indicatorHeight: number
138
+ ): number {
139
+ const pixelRowCount = Math.max(0, Math.floor(pixelCount));
140
+ const indicatorHeightPx = Math.max(0, Math.floor(indicatorHeight));
141
+ const maxTopInFill = Math.max(0, pixelRowCount - indicatorHeightPx);
142
+ if (pixelRowCount === 0 || total <= 0) {
143
+ return 0;
144
+ }
145
+
146
+ const clamp = (x: number) => Math.max(0, Math.min(maxTopInFill, x));
147
+
148
+ if (total >= pixelRowCount) {
149
+ const pixelRowIndex = pixelRowIndexForItemDownsample(itemIndex, total, pixelRowCount);
150
+ return clamp(pixelRowIndex);
151
+ } else {
152
+ const { pixelStart, pixelEnd } = pixelSpanForItem(itemIndex, total, pixelRowCount);
153
+ const bucketHeight = pixelEnd - pixelStart;
154
+
155
+ let topOffset: number;
156
+ if (bucketHeight <= 0) {
157
+ topOffset = pixelStart;
158
+ } else if (itemIndex === 0) {
159
+ topOffset = pixelStart;
160
+ } else if (itemIndex === total - 1) {
161
+ topOffset = pixelEnd - indicatorHeightPx;
162
+ } else {
163
+ topOffset = pixelStart + Math.floor((bucketHeight - indicatorHeightPx) / 2);
164
+ }
165
+
166
+ return clamp(topOffset);
167
+ }
168
+ }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { Toaster as Sonner } from 'sonner';
3
+ import { Icons } from '../Icons';
4
+
5
+ type ToasterProps = React.ComponentProps<typeof Sonner>;
6
+
7
+ const Toaster = ({ ...props }: ToasterProps) => {
8
+ return (
9
+ <Sonner
10
+ className="toaster group"
11
+ loadingIcon={<Icons.LoadingSpinner className="text-highlight" />}
12
+ icons={{
13
+ warning: <Icons.StatusWarning />,
14
+ info: <Icons.Info className="text-secondary-foreground" />,
15
+ success: <Icons.StatusSuccess />,
16
+ error: <Icons.StatusError className="text-destructive" />,
17
+ }}
18
+ theme="dark"
19
+ richColors="true"
20
+ toastOptions={{
21
+ style: {
22
+ width: '430px', // Set a maximum width
23
+ right: '8px',
24
+ },
25
+ }}
26
+ {...props}
27
+ />
28
+ );
29
+ };
30
+
31
+ export { Toaster };
@@ -0,0 +1,4 @@
1
+ import { Toaster } from './Sonner';
2
+ import { toast } from 'sonner';
3
+
4
+ export { Toaster, toast };
@@ -0,0 +1,89 @@
1
+ import React from 'react';
2
+
3
+ import { StudyItem } from '../StudyItem';
4
+ import { StudyBrowserSort } from '../StudyBrowserSort';
5
+ import { StudyBrowserViewOptions } from '../StudyBrowserViewOptions';
6
+ import { ScrollArea } from '../ScrollArea';
7
+
8
+ const noop = () => {};
9
+
10
+ const StudyBrowser = ({
11
+ tabs,
12
+ activeTabName,
13
+ expandedStudyInstanceUIDs,
14
+ onClickTab = noop,
15
+ onClickStudy = noop,
16
+ onClickThumbnail = noop,
17
+ onDoubleClickThumbnail = noop,
18
+ onClickUntrack = noop,
19
+ activeDisplaySetInstanceUIDs,
20
+ servicesManager,
21
+ showSettings,
22
+ viewPresets,
23
+ ThumbnailMenuItems,
24
+ StudyMenuItems,
25
+ }: withAppTypes) => {
26
+ const getTabContent = () => {
27
+ const tabData = tabs.find(tab => tab.name === activeTabName);
28
+ const viewPreset = viewPresets
29
+ ? viewPresets.filter(preset => preset.selected)[0]?.id
30
+ : 'thumbnails';
31
+ return tabData?.studies?.map(
32
+ ({ studyInstanceUid, date, description, numInstances, modalities, displaySets }) => {
33
+ const isExpanded = expandedStudyInstanceUIDs.includes(studyInstanceUid);
34
+ return (
35
+ <React.Fragment key={studyInstanceUid}>
36
+ <StudyItem
37
+ date={date}
38
+ description={description}
39
+ numInstances={numInstances}
40
+ isExpanded={isExpanded}
41
+ displaySets={displaySets}
42
+ modalities={modalities}
43
+ isActive={isExpanded}
44
+ onClick={() => onClickStudy(studyInstanceUid)}
45
+ onClickThumbnail={onClickThumbnail}
46
+ onDoubleClickThumbnail={onDoubleClickThumbnail}
47
+ onClickUntrack={onClickUntrack}
48
+ activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
49
+ data-cy="thumbnail-list"
50
+ viewPreset={viewPreset}
51
+ ThumbnailMenuItems={ThumbnailMenuItems}
52
+ StudyMenuItems={StudyMenuItems}
53
+ StudyInstanceUID={studyInstanceUid}
54
+ />
55
+ </React.Fragment>
56
+ );
57
+ }
58
+ );
59
+ };
60
+
61
+ return (
62
+ <ScrollArea>
63
+ <div
64
+ className="bg-background flex flex-1 flex-col gap-[4px]"
65
+ data-cy={'studyBrowser-panel'}
66
+ >
67
+ <div className="flex flex-col gap-[4px]">
68
+ {showSettings && (
69
+ <div className="w-100 bg-background flex h-[48px] items-center justify-center gap-[10px] px-[8px] py-[10px]">
70
+ <>
71
+ <StudyBrowserViewOptions
72
+ tabs={tabs}
73
+ onSelectTab={onClickTab}
74
+ activeTabName={activeTabName}
75
+ />
76
+ <StudyBrowserSort servicesManager={servicesManager} />
77
+ </>
78
+ </div>
79
+ )}
80
+ {getTabContent()}
81
+ </div>
82
+ </div>
83
+ </ScrollArea>
84
+ );
85
+ };
86
+
87
+
88
+
89
+ export { StudyBrowser };
@@ -0,0 +1,2 @@
1
+ import { StudyBrowser } from './StudyBrowser';
2
+ export { StudyBrowser };
@@ -0,0 +1,87 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Icons } from '../Icons';
3
+ import {
4
+ DropdownMenu,
5
+ DropdownMenuTrigger,
6
+ DropdownMenuContent,
7
+ DropdownMenuItem,
8
+ } from '../DropdownMenu/DropdownMenu';
9
+ import { Tooltip, TooltipContent, TooltipTrigger } from '../Tooltip';
10
+
11
+ export function StudyBrowserSort({ servicesManager }: withAppTypes) {
12
+ // Todo: this should not be here, no servicesManager should be in ui-next, only
13
+ // customization service
14
+ const { customizationService, displaySetService } = servicesManager.services;
15
+ const sortFunctions = customizationService.getCustomization('studyBrowser.sortFunctions');
16
+
17
+ // The picker unmounts whenever the settings row is closed, so it starts from
18
+ // the sort the display set service last applied rather than from the first
19
+ // entry, which would show a choice the thumbnails are not in.
20
+ const appliedSort = displaySetService.getDisplaySetSort();
21
+ const [selectedSort, setSelectedSort] = useState(
22
+ () => sortFunctions.find(sort => sort.sortFunction === appliedSort?.sortFn) ?? sortFunctions[0]
23
+ );
24
+ const [sortDirection, setSortDirection] = useState(appliedSort?.direction ?? 'ascending');
25
+ // Opening the settings row leaves the thumbnails in their default order until
26
+ // the user picks a sort or a direction.
27
+ const [sortChosen, setSortChosen] = useState(appliedSort !== null);
28
+
29
+ const handleSortChange = sortFunction => {
30
+ setSortChosen(true);
31
+ setSelectedSort(sortFunction);
32
+ };
33
+
34
+ const toggleSortDirection = e => {
35
+ e.stopPropagation();
36
+ setSortChosen(true);
37
+ setSortDirection(prevDirection => (prevDirection === 'ascending' ? 'descending' : 'ascending'));
38
+ };
39
+
40
+ useEffect(() => {
41
+ if (!sortChosen) {
42
+ return;
43
+ }
44
+ displaySetService.sortDisplaySets(selectedSort.sortFunction, sortDirection);
45
+ }, [displaySetService, selectedSort, sortDirection, sortChosen]);
46
+
47
+ return (
48
+ <div className="flex w-[50%] items-center gap-1">
49
+ <DropdownMenu>
50
+ <Tooltip>
51
+ <TooltipTrigger className="w-full overflow-hidden">
52
+ <DropdownMenuTrigger className="border-input focus:border-input text-foreground bg-background flex h-[26px] w-full items-center justify-start overflow-hidden whitespace-nowrap rounded border p-2 text-base">
53
+ {selectedSort.label}
54
+ </DropdownMenuTrigger>
55
+ </TooltipTrigger>
56
+ <TooltipContent>{selectedSort.label}</TooltipContent>
57
+ </Tooltip>
58
+ <DropdownMenuContent className="bg-background">
59
+ {sortFunctions.map(sort => (
60
+ <DropdownMenuItem
61
+ key={sort.label}
62
+ className="text-foreground"
63
+ onClick={() => handleSortChange(sort)}
64
+ >
65
+ {sort.label}
66
+ </DropdownMenuItem>
67
+ ))}
68
+ </DropdownMenuContent>
69
+ </DropdownMenu>
70
+ <Tooltip>
71
+ <TooltipTrigger>
72
+ <button
73
+ onClick={toggleSortDirection}
74
+ className="bg-background flex h-[26px] items-center justify-center"
75
+ >
76
+ {sortDirection === 'ascending' ? (
77
+ <Icons.SortingAscending className="text-primary w-2" />
78
+ ) : (
79
+ <Icons.SortingDescending className="text-primary w-2" />
80
+ )}
81
+ </button>
82
+ </TooltipTrigger>
83
+ <TooltipContent>Sort direction</TooltipContent>
84
+ </Tooltip>
85
+ </div>
86
+ );
87
+ }
@@ -0,0 +1,3 @@
1
+ import { StudyBrowserSort } from './StudyBrowserSort';
2
+
3
+ export { StudyBrowserSort };