@ohif/ui-next 3.14.0-beta.10 → 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 +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,206 @@
1
+ /* Theme Presets
2
+ * Complete token sets applied via .theme-* class on <body>.
3
+ * Default theme ("Tonal: OHIF Blue") = no class (uses :root values from tailwind.css).
4
+ * Outside @layer base so presets override :root via proximity on <body>.
5
+ *
6
+ * Tonal themes: full hue-shifted palettes (surfaces, borders, text all carry the theme hue).
7
+ * Neutral themes: desaturated/achromatic surfaces with a colored primary accent.
8
+ */
9
+
10
+ /* ─── Tonal: Orchid ──────────────────────────────────────────────────── */
11
+
12
+ .theme-orchid {
13
+ --highlight: 292 75% 62%;
14
+ --neutral: 270 18% 55%;
15
+ --neutral-light: 275 35% 75%;
16
+ --neutral-dark: 268 20% 24%;
17
+ --background: 270 45% 6%;
18
+ --foreground: 280 15% 96%;
19
+ --card: 268 40% 10%;
20
+ --card-foreground: 280 15% 96%;
21
+ --popover: 264 48% 13%;
22
+ --popover-foreground: 280 15% 96%;
23
+ --primary: 270 85% 65%;
24
+ --primary-foreground: 0 0% 98%;
25
+ --secondary: 268 45% 32%;
26
+ --secondary-foreground: 275 45% 88%;
27
+ --muted: 268 40% 10%;
28
+ --muted-foreground: 272 30% 60%;
29
+ --accent: 268 50% 20%;
30
+ --accent-foreground: 280 15% 96%;
31
+ --destructive: 0 65% 40%;
32
+ --destructive-foreground: 0 0% 98%;
33
+ --border: 268 30% 18%;
34
+ --input: 268 40% 25%;
35
+ --ring: 270 80% 60%;
36
+ --chart-1: 270 70% 58%;
37
+ --chart-2: 160 55% 45%;
38
+ --chart-3: 35 80% 55%;
39
+ --chart-4: 200 65% 55%;
40
+ --chart-5: 340 70% 55%;
41
+ }
42
+
43
+ /* ─── Tonal: Arctic ──────────────────────────────────────────────────── */
44
+
45
+ .theme-arctic {
46
+ --highlight: 173 81% 52%;
47
+ --neutral: 185 20% 55%;
48
+ --neutral-light: 180 40% 78%;
49
+ --neutral-dark: 190 18% 22%;
50
+ --background: 0 0% 0%;
51
+ --foreground: 180 10% 97%;
52
+ --card: 203 39% 9%;
53
+ --card-foreground: 180 10% 97%;
54
+ --popover: 202 54% 11%;
55
+ --popover-foreground: 180 10% 97%;
56
+ --primary: 175 85% 42%;
57
+ --primary-foreground: 185 50% 8%;
58
+ --secondary: 180 45% 28%;
59
+ --secondary-foreground: 175 50% 88%;
60
+ --muted: 203 39% 9%;
61
+ --muted-foreground: 185 30% 60%;
62
+ --accent: 185 55% 18%;
63
+ --accent-foreground: 180 10% 97%;
64
+ --destructive: 0 65% 35%;
65
+ --destructive-foreground: 0 0% 98%;
66
+ --border: 190 25% 17%;
67
+ --input: 223 40% 24%;
68
+ --ring: 175 85% 42%;
69
+ --chart-1: 175 75% 45%;
70
+ --chart-2: 140 60% 42%;
71
+ --chart-3: 35 80% 55%;
72
+ --chart-4: 280 65% 58%;
73
+ --chart-5: 330 75% 55%;
74
+ }
75
+
76
+ /* ─── Tonal: Verdant ─────────────────────────────────────────────────── */
77
+
78
+ .theme-verdant {
79
+ --highlight: 152 79% 52%;
80
+ --neutral: 150 15% 52%;
81
+ --neutral-light: 145 30% 72%;
82
+ --neutral-dark: 155 18% 24%;
83
+ --background: 155 40% 5%;
84
+ --foreground: 140 15% 95%;
85
+ --card: 152 35% 9%;
86
+ --card-foreground: 140 15% 95%;
87
+ --popover: 167 65% 10%;
88
+ --popover-foreground: 140 15% 95%;
89
+ --primary: 152 75% 40%;
90
+ --primary-foreground: 155 50% 8%;
91
+ --secondary: 150 40% 26%;
92
+ --secondary-foreground: 145 40% 85%;
93
+ --muted: 152 35% 9%;
94
+ --muted-foreground: 148 25% 55%;
95
+ --accent: 150 45% 16%;
96
+ --accent-foreground: 140 15% 95%;
97
+ --destructive: 0 65% 38%;
98
+ --destructive-foreground: 0 0% 98%;
99
+ --border: 150 25% 16%;
100
+ --input: 150 35% 22%;
101
+ --ring: 152 75% 40%;
102
+ --chart-1: 152 70% 42%;
103
+ --chart-2: 200 60% 48%;
104
+ --chart-3: 35 80% 55%;
105
+ --chart-4: 280 60% 55%;
106
+ --chart-5: 340 70% 52%;
107
+ }
108
+
109
+ /* ─── Neutral: Midnight ──────────────────────────────────────────────── */
110
+
111
+ .theme-midnight {
112
+ --highlight: 188 90% 58%;
113
+ --neutral: 213 22% 59%;
114
+ --neutral-light: 214 69% 81%;
115
+ --neutral-dark: 214 16% 21%;
116
+ --background: 240 15% 3%;
117
+ --foreground: 0 0% 99%;
118
+ --card: 240 12% 8%;
119
+ --card-foreground: 0 0% 99%;
120
+ --popover: 225 45% 13%;
121
+ --popover-foreground: 0 0% 99%;
122
+ --primary: 210 100% 62%;
123
+ --primary-foreground: 0 0% 99%;
124
+ --secondary: 215 55% 32%;
125
+ --secondary-foreground: 200 60% 88%;
126
+ --muted: 240 12% 8%;
127
+ --muted-foreground: 210 40% 70%;
128
+ --accent: 220 65% 20%;
129
+ --accent-foreground: 0 0% 99%;
130
+ --destructive: 0 70% 35%;
131
+ --destructive-foreground: 0 0% 99%;
132
+ --border: 240 10% 18%;
133
+ --input: 225 35% 24%;
134
+ --ring: 210 100% 62%;
135
+ --chart-1: 210 85% 55%;
136
+ --chart-2: 165 70% 42%;
137
+ --chart-3: 35 85% 52%;
138
+ --chart-4: 275 70% 58%;
139
+ --chart-5: 335 80% 52%;
140
+ }
141
+
142
+ /* ─── Neutral: Slate ─────────────────────────────────────────────────── */
143
+
144
+ .theme-slate {
145
+ --highlight: 217 97% 52%;
146
+ --neutral: 0 0% 55%;
147
+ --neutral-light: 0 0% 75%;
148
+ --neutral-dark: 0 0% 25%;
149
+ --background: 0 0% 0%;
150
+ --foreground: 0 0% 96%;
151
+ --card: 0 0% 7%;
152
+ --card-foreground: 0 0% 96%;
153
+ --popover: 0 0% 9%;
154
+ --popover-foreground: 0 0% 96%;
155
+ --primary: 230 75% 55%;
156
+ --primary-foreground: 0 0% 98%;
157
+ --secondary: 0 0% 25%;
158
+ --secondary-foreground: 0 0% 85%;
159
+ --muted: 0 0% 7%;
160
+ --muted-foreground: 0 0% 60%;
161
+ --accent: 0 0% 18%;
162
+ --accent-foreground: 0 0% 96%;
163
+ --destructive: 0 65% 40%;
164
+ --destructive-foreground: 0 0% 98%;
165
+ --border: 0 0% 18%;
166
+ --input: 0 0% 22%;
167
+ --ring: 215 75% 55%;
168
+ --chart-1: 215 70% 55%;
169
+ --chart-2: 160 55% 45%;
170
+ --chart-3: 35 75% 55%;
171
+ --chart-4: 280 60% 58%;
172
+ --chart-5: 340 70% 55%;
173
+ }
174
+
175
+ /* ─── Neutral: Deep ──────────────────────────────────────────────────── */
176
+
177
+ .theme-deep {
178
+ --highlight: 184 53% 54%;
179
+ --neutral: 215 15% 50%;
180
+ --neutral-light: 210 20% 68%;
181
+ --neutral-dark: 220 18% 22%;
182
+ --background: 0 0% 0%;
183
+ --foreground: 215 15% 82%;
184
+ --card: 218 25% 5%;
185
+ --card-foreground: 215 15% 82%;
186
+ --popover: 215 30% 8%;
187
+ --popover-foreground: 215 15% 82%;
188
+ --primary: 200 43% 48%;
189
+ --primary-foreground: 210 20% 92%;
190
+ --secondary: 218 30% 18%;
191
+ --secondary-foreground: 215 25% 75%;
192
+ --muted: 214 28% 5%;
193
+ --muted-foreground: 215 18% 48%;
194
+ --accent: 216 32% 12%;
195
+ --accent-foreground: 215 15% 82%;
196
+ --destructive: 0 50% 35%;
197
+ --destructive-foreground: 0 15% 90%;
198
+ --border: 218 22% 10%;
199
+ --input: 216 28% 15%;
200
+ --ring: 215 45% 42%;
201
+ --chart-1: 215 50% 45%;
202
+ --chart-2: 175 40% 38%;
203
+ --chart-3: 35 50% 45%;
204
+ --chart-4: 280 40% 48%;
205
+ --chart-5: 340 45% 45%;
206
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "verdant",
3
+ "label": "Tonal: Verdant",
4
+ "cssVars": {
5
+ "dark": {
6
+ "highlight": "152 79% 52%",
7
+ "neutral": "150 15% 52%",
8
+ "neutral-light": "145 30% 72%",
9
+ "neutral-dark": "155 18% 24%",
10
+ "background": "155 40% 5%",
11
+ "foreground": "140 15% 95%",
12
+ "card": "152 35% 9%",
13
+ "card-foreground": "140 15% 95%",
14
+ "popover": "167 65% 10%",
15
+ "popover-foreground": "140 15% 95%",
16
+ "primary": "152 75% 40%",
17
+ "primary-foreground": "155 50% 8%",
18
+ "secondary": "150 40% 26%",
19
+ "secondary-foreground": "145 40% 85%",
20
+ "muted": "152 35% 9%",
21
+ "muted-foreground": "148 25% 55%",
22
+ "accent": "150 45% 16%",
23
+ "accent-foreground": "140 15% 95%",
24
+ "destructive": "0 65% 38%",
25
+ "destructive-foreground": "0 0% 98%",
26
+ "border": "150 25% 16%",
27
+ "input": "150 35% 22%",
28
+ "ring": "152 75% 40%"
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { ViewportActionCornersLocations } from '../components/Viewport/ViewportActionCorners';
3
+
4
+ export type ActionComponentInfo = {
5
+ viewportId: string;
6
+ id: string;
7
+ component: ReactNode;
8
+ location: ViewportActionCornersLocations;
9
+ indexPriority?: number;
10
+ isLocked?: boolean;
11
+ isOpen?: boolean;
12
+ isVisible?: boolean;
13
+ };
14
+
15
+ export type AlignAndSide = {
16
+ align: 'start' | 'end' | 'center';
17
+ side: 'top' | 'bottom' | 'left' | 'right';
18
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Customization ids owned by `ui-next`: the component here is the consumer, so
3
+ * the shape it reads is declared here, next to that consumer. The default value
4
+ * is registered by `extension-default`
5
+ * (`src/customizations/studyBrowserCustomization.ts`) — declaring the type here
6
+ * is what lets that package's default be checked against this contract.
7
+ */
8
+ declare global {
9
+ namespace AppTypes {
10
+ interface Customizations {
11
+ /**
12
+ * Sort options offered by the study browser's sort dropdown. Read by
13
+ * `StudyBrowserSort`, which indexes `[0]` for its initial selection, so a
14
+ * default with at least one entry is expected.
15
+ */
16
+ 'studyBrowser.sortFunctions': Array<{
17
+ label: string;
18
+ sortFunction: (a: AppTypes.DisplaySet, b: AppTypes.DisplaySet) => number;
19
+ }>;
20
+ }
21
+ }
22
+ }
23
+
24
+ export {};
@@ -0,0 +1,9 @@
1
+ export type ContextMenuItem = {
2
+ // A label to show for the item.
3
+ label: string;
4
+ // An icon to show the on right of the text - typically used for submenus
5
+ iconRight?: string;
6
+ // item is the menu item (eg the instance of this that is clicked on)
7
+ // props is the remaining properties passed to the context menu
8
+ action: (item, props) => void;
9
+ };
@@ -0,0 +1 @@
1
+ export type Predicate = (props: Record<string, unknown>) => boolean;
@@ -0,0 +1,3 @@
1
+ type ThumbnailType = 'thumbnail' | 'thumbnailTracked' | 'thumbnailNoImage';
2
+
3
+ export default ThumbnailType;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { ViewportActionCornersLocations } from '../components/Viewport/ViewportActionCorners';
3
+
4
+ export interface ViewportActionCornersComponentInfo {
5
+ id: string;
6
+ component: ReactNode;
7
+ }
8
+
9
+ export interface ViewportActionCornersProps {
10
+ cornerComponents: Record<ViewportActionCornersLocations, ViewportActionCornersComponentInfo[]>;
11
+ visibleItemsPerCorner?: number;
12
+ isActiveViewport: boolean;
13
+ }
@@ -0,0 +1,4 @@
1
+ declare module '*.png' {
2
+ const content: string;
3
+ export default content;
4
+ }
@@ -0,0 +1,21 @@
1
+ import ThumbnailType from './ThumbnailType';
2
+
3
+ // A few miscellaneous types declared inline here.
4
+
5
+ export * from './Predicate';
6
+ export * from './ContextMenuItem';
7
+ export * from './ViewportActionCornersTypes';
8
+ export * from './ActionCorners';
9
+
10
+ /**
11
+ * StringNumber often comes back from DICOMweb for integer valued items.
12
+ */
13
+ type StringNumber = string | number;
14
+
15
+ /**
16
+ * StringArray often comes back from dcmjs for single valued strings that
17
+ * might have multiple values such as window level descriptions.
18
+ */
19
+ type StringArray = string | string[];
20
+
21
+ export type { StringNumber, StringArray, ThumbnailType };
@@ -0,0 +1,61 @@
1
+ // Mock i18next so `t(key, fallback)` deterministically returns the fallback
2
+ // (the test env doesn't initialize i18n with resources).
3
+ jest.mock('i18next', () => ({
4
+ __esModule: true,
5
+ default: {
6
+ t: (_key: string, fallback?: string) => fallback,
7
+ language: 'en',
8
+ },
9
+ }));
10
+
11
+ import { formatDICOMDate } from './formatDICOMDate';
12
+
13
+ describe('formatDICOMDate', () => {
14
+ describe('valid DICOM dates', () => {
15
+ it('formats YYYYMMDD with the default fallback (MMM D, YYYY)', () => {
16
+ expect(formatDICOMDate('20180916')).toBe('Sep 16, 2018');
17
+ });
18
+
19
+ it('formats the YYYY.MM.DD variant', () => {
20
+ expect(formatDICOMDate('2018.09.16')).toBe('Sep 16, 2018');
21
+ });
22
+
23
+ it('honors fallbackFormat', () => {
24
+ expect(formatDICOMDate('20180916', { fallbackFormat: 'MMM-DD-YYYY' })).toBe('Sep-16-2018');
25
+ });
26
+
27
+ it('honors strFormat (overriding the locale key)', () => {
28
+ expect(formatDICOMDate('20180916', { strFormat: 'YYYY-MM-DD' })).toBe('2018-09-16');
29
+ });
30
+ });
31
+
32
+ describe('empty input', () => {
33
+ it('returns empty string by default', () => {
34
+ expect(formatDICOMDate('')).toBe('');
35
+ expect(formatDICOMDate(undefined as unknown as string)).toBe('');
36
+ });
37
+
38
+ it('returns invalidFallback when provided', () => {
39
+ expect(formatDICOMDate('', { invalidFallback: 'N/A' })).toBe('N/A');
40
+ });
41
+ });
42
+
43
+ describe('invalid input', () => {
44
+ it('preserves the prior lenient behavior when no invalidFallback is given', () => {
45
+ // A non-DICOM but moment-parseable string still formats via the lenient parse.
46
+ expect(formatDICOMDate('2018-09-16')).toBe('Sep 16, 2018');
47
+ // Genuinely unparseable input yields moment's "Invalid date".
48
+ expect(formatDICOMDate('garbage')).toBe('Invalid date');
49
+ });
50
+
51
+ it('returns invalidFallback for unparseable input when provided', () => {
52
+ expect(formatDICOMDate('garbage', { invalidFallback: 'N/A' })).toBe('N/A');
53
+ });
54
+
55
+ it('invalidFallback short-circuits the lenient parse', () => {
56
+ // Even though "2018-09-16" is loosely parseable, an explicit invalidFallback
57
+ // wins because strict DICOM parsing failed.
58
+ expect(formatDICOMDate('2018-09-16', { invalidFallback: 'N/A' })).toBe('N/A');
59
+ });
60
+ });
61
+ });
@@ -0,0 +1,65 @@
1
+ import moment from 'moment';
2
+ import i18n from 'i18next';
3
+
4
+ export interface FormatDICOMDateOptions {
5
+ /**
6
+ * Explicit output format. When provided it overrides the locale's
7
+ * `Common:localDateFormat`; when omitted the locale key is used.
8
+ */
9
+ strFormat?: string;
10
+ /**
11
+ * Output format used only when the active locale does not define
12
+ * `Common:localDateFormat` (8 of the shipped locales don't). Defaults to
13
+ * `MMM D, YYYY`.
14
+ */
15
+ fallbackFormat?: string;
16
+ /**
17
+ * Returned when `date` is empty or cannot be parsed as a date at all. When
18
+ * omitted, the prior behavior is preserved: a lenient `moment(date).format(...)`
19
+ * is returned (which is `"Invalid date"` for unparseable input).
20
+ */
21
+ invalidFallback?: string;
22
+ }
23
+
24
+ /**
25
+ * Formats a DICOM date.
26
+ *
27
+ * @param date - Raw date string (e.g. `YYYYMMDD` or `YYYY.MM.DD`).
28
+ * @param options - See {@link FormatDICOMDateOptions}.
29
+ * @returns The formatted date, or the resolved invalid fallback.
30
+ *
31
+ * @remarks
32
+ * Migration: this previously took a positional format argument
33
+ * (`formatDICOMDate(date, strFormat?)`). That format — and the additional
34
+ * `fallbackFormat` / `invalidFallback` options — are now passed as a single
35
+ * options object.
36
+ *
37
+ * @example
38
+ * // Before (positional):
39
+ * formatDICOMDate(date, 'YYYY-MM-DD');
40
+ * // After (options object):
41
+ * formatDICOMDate(date, { strFormat: 'YYYY-MM-DD' });
42
+ *
43
+ * @example
44
+ * formatDICOMDate(date, { fallbackFormat: 'DD-MMM-YYYY', invalidFallback: '' });
45
+ */
46
+ export function formatDICOMDate(date: string, options: FormatDICOMDateOptions = {}): string {
47
+ const { strFormat, fallbackFormat = 'MMM D, YYYY', invalidFallback } = options;
48
+
49
+ if (!date) {
50
+ return invalidFallback ?? '';
51
+ }
52
+
53
+ const format = strFormat ?? i18n.t('Common:localDateFormat', fallbackFormat);
54
+ const locale = i18n.language || 'en';
55
+ const parsed = moment(date, ['YYYYMMDD', 'YYYY.MM.DD'], true);
56
+
57
+ if (!parsed.isValid()) {
58
+ // Honor an explicit fallback, otherwise preserve prior behavior (a lenient
59
+ // parse, which formats valid non-DICOM strings and yields "Invalid date"
60
+ // for unparseable input).
61
+ return invalidFallback ?? moment(date).locale(locale).format(format);
62
+ }
63
+
64
+ return parsed.locale(locale).format(format);
65
+ }
@@ -0,0 +1,62 @@
1
+ // Mock i18next so `t(key, fallback)` deterministically returns the fallback
2
+ // (the test env doesn't initialize i18n with resources).
3
+ jest.mock('i18next', () => ({
4
+ __esModule: true,
5
+ default: {
6
+ t: (_key: string, fallback?: string) => fallback,
7
+ language: 'en',
8
+ },
9
+ }));
10
+
11
+ import { formatDICOMTime } from './formatDICOMTime';
12
+
13
+ describe('formatDICOMTime', () => {
14
+ describe('valid DICOM times (default hh:mm A fallback)', () => {
15
+ it('formats HHmmss', () => {
16
+ expect(formatDICOMTime('143052')).toBe('02:30 PM');
17
+ });
18
+
19
+ it('formats HHmm', () => {
20
+ expect(formatDICOMTime('0905')).toBe('09:05 AM');
21
+ });
22
+
23
+ it('formats HH', () => {
24
+ expect(formatDICOMTime('14')).toBe('02:00 PM');
25
+ });
26
+
27
+ it('does not misread a 4-digit HHmm time as a year', () => {
28
+ // The whole reason there is no lenient reparse: moment("1430") with no
29
+ // format would yield the year 1430, not 14:30.
30
+ expect(formatDICOMTime('1430')).toBe('02:30 PM');
31
+ });
32
+ });
33
+
34
+ describe('format overrides', () => {
35
+ it('uses strFormat when provided', () => {
36
+ expect(formatDICOMTime('143052', { strFormat: 'HH:mm:ss' })).toBe('14:30:52');
37
+ expect(formatDICOMTime('143052', { strFormat: 'HH:mm' })).toBe('14:30');
38
+ });
39
+
40
+ it('uses fallbackFormat for the locale-key-missing path', () => {
41
+ expect(formatDICOMTime('143052', { fallbackFormat: 'HH:mm' })).toBe('14:30');
42
+ });
43
+ });
44
+
45
+ describe('empty / invalid input', () => {
46
+ it('returns empty string by default for empty input', () => {
47
+ expect(formatDICOMTime('')).toBe('');
48
+ expect(formatDICOMTime(undefined as unknown as string)).toBe('');
49
+ });
50
+
51
+ it('returns empty string by default for unparseable input', () => {
52
+ expect(formatDICOMTime('notatime')).toBe('');
53
+ // Out-of-range hour is invalid under strict parsing.
54
+ expect(formatDICOMTime('2530')).toBe('');
55
+ });
56
+
57
+ it('returns invalidFallback when provided', () => {
58
+ expect(formatDICOMTime('', { invalidFallback: 'N/A' })).toBe('N/A');
59
+ expect(formatDICOMTime('notatime', { invalidFallback: '--' })).toBe('--');
60
+ });
61
+ });
62
+ });
@@ -0,0 +1,49 @@
1
+ import moment from 'moment';
2
+ import i18n from 'i18next';
3
+
4
+ export interface FormatDICOMTimeOptions {
5
+ /**
6
+ * Explicit output format. When provided it overrides the locale's
7
+ * `Common:localTimeFormat`; when omitted the locale key is used.
8
+ */
9
+ strFormat?: string;
10
+ /**
11
+ * Output format used when the active locale does not define
12
+ * `Common:localTimeFormat` (none of the shipped locales do today, so in
13
+ * practice this is what renders). Defaults to `hh:mm A`.
14
+ */
15
+ fallbackFormat?: string;
16
+ /** Returned when `time` is empty or cannot be parsed. Defaults to `''`. */
17
+ invalidFallback?: string;
18
+ }
19
+
20
+ /**
21
+ * Formats a DICOM time.
22
+ *
23
+ * @param time - Raw time string (e.g. `HH`, `HHmm`, `HHmmss`, `HHmmss.SSS`).
24
+ * @param options - See {@link FormatDICOMTimeOptions}.
25
+ * @returns The formatted time, or the resolved invalid fallback.
26
+ *
27
+ * @example
28
+ * formatDICOMTime(time, { invalidFallback: '' });
29
+ */
30
+ export function formatDICOMTime(time: string, options: FormatDICOMTimeOptions = {}): string {
31
+ const { strFormat, fallbackFormat = 'hh:mm A', invalidFallback } = options;
32
+
33
+ if (!time) {
34
+ return invalidFallback ?? '';
35
+ }
36
+
37
+ const format = strFormat ?? i18n.t('Common:localTimeFormat', fallbackFormat);
38
+ const locale = i18n.language || 'en';
39
+ const parsed = moment(time, ['HH', 'HHmm', 'HHmmss', 'HHmmss.SSS'], true);
40
+
41
+ // Unlike formatDICOMDate, there is no lenient reparse: a no-format
42
+ // moment(time) treats the string as a date (e.g. "1430" -> year 1430), so an
43
+ // unparseable time falls straight back rather than fabricating a wrong value.
44
+ if (!parsed.isValid()) {
45
+ return invalidFallback ?? '';
46
+ }
47
+
48
+ return parsed.locale(locale).format(format);
49
+ }
@@ -0,0 +1,5 @@
1
+ const getToggledClassName = isToggled => {
2
+ return isToggled ? '!text-primary' : '!text-foreground/80 hover:!bg-muted hover:text-highlight';
3
+ };
4
+
5
+ export { getToggledClassName };
@@ -0,0 +1,15 @@
1
+ import { getToggledClassName } from './getToggledClassName';
2
+ import roundNumber from './roundNumber';
3
+ import { cn } from '../lib/utils';
4
+ import { formatDICOMDate } from './formatDICOMDate';
5
+ import { formatDICOMTime } from './formatDICOMTime';
6
+ import { parseStudyDateTimestamp } from './parseStudyDateTimestamp';
7
+
8
+ export {
9
+ getToggledClassName,
10
+ roundNumber,
11
+ cn,
12
+ formatDICOMDate,
13
+ formatDICOMTime,
14
+ parseStudyDateTimestamp,
15
+ };
@@ -0,0 +1,47 @@
1
+ import { parseStudyDateTimestamp } from './parseStudyDateTimestamp';
2
+
3
+ describe('parseStudyDateTimestamp', () => {
4
+ it('parses date + time into the matching local timestamp', () => {
5
+ // Month is 0-indexed in the Date constructor; both use local time, so this
6
+ // is timezone-independent.
7
+ const expected = new Date(2018, 8, 16, 14, 30, 52).getTime();
8
+ expect(parseStudyDateTimestamp('20180916', '143052')).toBe(expected);
9
+ });
10
+
11
+ it('defaults to midnight when no time is given', () => {
12
+ const expected = new Date(2018, 8, 16, 0, 0, 0, 0).getTime();
13
+ expect(parseStudyDateTimestamp('20180916')).toBe(expected);
14
+ });
15
+
16
+ it('ignores an invalid time (treats as midnight)', () => {
17
+ expect(parseStudyDateTimestamp('20180916', 'notatime')).toBe(
18
+ parseStudyDateTimestamp('20180916')
19
+ );
20
+ });
21
+
22
+ it('returns 0 for missing or invalid dates', () => {
23
+ expect(parseStudyDateTimestamp(undefined, '143052')).toBe(0);
24
+ expect(parseStudyDateTimestamp('')).toBe(0);
25
+ expect(parseStudyDateTimestamp('garbage')).toBe(0);
26
+ });
27
+
28
+ describe('ordering (the sort use case)', () => {
29
+ it('orders by date', () => {
30
+ expect(parseStudyDateTimestamp('20180916')).toBeGreaterThan(
31
+ parseStudyDateTimestamp('20180915')
32
+ );
33
+ });
34
+
35
+ it('uses time as a tiebreaker within the same date', () => {
36
+ expect(parseStudyDateTimestamp('20180916', '130000')).toBeGreaterThan(
37
+ parseStudyDateTimestamp('20180916', '120000')
38
+ );
39
+ });
40
+
41
+ it('treats equal date + time as a true tie (equal keys)', () => {
42
+ expect(parseStudyDateTimestamp('20180916', '120000')).toBe(
43
+ parseStudyDateTimestamp('20180916', '120000')
44
+ );
45
+ });
46
+ });
47
+ });
@@ -0,0 +1,27 @@
1
+ import moment from 'moment';
2
+
3
+ /**
4
+ * Parses a DICOM study date and time into a timestamp for sorting.
5
+ *
6
+ * @param date - Raw date string (YYYYMMDD or YYYY.MM.DD format)
7
+ * @param time - Raw time string (HH, HHmm, HHmmss, or HHmmss.SSS format)
8
+ * @returns Timestamp in milliseconds, or 0 if the date is missing/invalid
9
+ */
10
+ export function parseStudyDateTimestamp(date?: string, time?: string): number {
11
+ const mDate = date && moment(date, ['YYYYMMDD', 'YYYY.MM.DD'], true);
12
+ const mTime = time && moment(time, ['HH', 'HHmm', 'HHmmss', 'HHmmss.SSS'], true);
13
+
14
+ if (mDate && mDate.isValid()) {
15
+ const md = mDate.clone();
16
+ if (mTime && mTime.isValid()) {
17
+ md.set({
18
+ hour: mTime.hour(),
19
+ minute: mTime.minute(),
20
+ second: mTime.second(),
21
+ millisecond: mTime.millisecond(),
22
+ });
23
+ }
24
+ return md.toDate().getTime();
25
+ }
26
+ return 0;
27
+ }