@ohif/ui-next 3.14.0-beta.97 → 3.14.0-beta.99

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 (433) hide show
  1. package/dist/ohif-ui-next.umd.js +4 -1925
  2. package/package.json +18 -7
  3. package/src/__mocks__/fileMock.js +7 -0
  4. package/src/assets/fonts.css +50 -0
  5. package/src/assets/styles.css +55 -0
  6. package/src/assets/woff2/latin.woff2 +0 -0
  7. package/src/components/Accordion/Accordion.tsx +70 -0
  8. package/src/components/Accordion/index.ts +3 -0
  9. package/src/components/AllInOneMenu/BackItem.tsx +32 -0
  10. package/src/components/AllInOneMenu/DividerItem.tsx +11 -0
  11. package/src/components/AllInOneMenu/HeaderItem.tsx +15 -0
  12. package/src/components/AllInOneMenu/IconMenu.tsx +83 -0
  13. package/src/components/AllInOneMenu/Item.tsx +51 -0
  14. package/src/components/AllInOneMenu/ItemPanel.tsx +38 -0
  15. package/src/components/AllInOneMenu/Menu.tsx +231 -0
  16. package/src/components/AllInOneMenu/PanelSelector.tsx +32 -0
  17. package/src/components/AllInOneMenu/SubMenu.tsx +36 -0
  18. package/src/components/AllInOneMenu/index.ts +42 -0
  19. package/src/components/BackgroundColorSelect/BackgroundColorSelect.tsx +38 -0
  20. package/src/components/BackgroundColorSelect/index.tsx +1 -0
  21. package/src/components/Badge/Badge.tsx +38 -0
  22. package/src/components/Badge/index.ts +1 -0
  23. package/src/components/Button/Button.tsx +65 -0
  24. package/src/components/Button/index.ts +1 -0
  25. package/src/components/Calendar/Calendar.tsx +258 -0
  26. package/src/components/Calendar/index.tsx +3 -0
  27. package/src/components/Card/Card.tsx +83 -0
  28. package/src/components/Card/index.ts +2 -0
  29. package/src/components/Checkbox/Checkbox.tsx +27 -0
  30. package/src/components/Checkbox/index.tsx +3 -0
  31. package/src/components/CinePlayer/CinePlayer.tsx +187 -0
  32. package/src/components/CinePlayer/index.ts +5 -0
  33. package/src/components/Clipboard/Clipboard.tsx +58 -0
  34. package/src/components/Clipboard/index.tsx +3 -0
  35. package/src/components/ColorCircle.tsx +12 -0
  36. package/src/components/Combobox/Combobox.tsx +66 -0
  37. package/src/components/Combobox/index.ts +3 -0
  38. package/src/components/Command/Command.tsx +149 -0
  39. package/src/components/Command/index.ts +23 -0
  40. package/src/components/ContextMenu/ContextMenu.tsx +202 -0
  41. package/src/components/ContextMenu/index.ts +35 -0
  42. package/src/components/ContextMenuViewport/ContextMenuViewport.tsx +47 -0
  43. package/src/components/ContextMenuViewport/index.ts +1 -0
  44. package/src/components/DataRow/DataRow.tsx +532 -0
  45. package/src/components/DataRow/index.ts +1 -0
  46. package/src/components/DataRow/types.ts +31 -0
  47. package/src/components/DataTable/ActionOverlayCell.tsx +153 -0
  48. package/src/components/DataTable/ColumnHeader.tsx +70 -0
  49. package/src/components/DataTable/DataTable.tsx +532 -0
  50. package/src/components/DataTable/FilterRow.tsx +52 -0
  51. package/src/components/DataTable/Pagination.tsx +78 -0
  52. package/src/components/DataTable/Title.tsx +5 -0
  53. package/src/components/DataTable/Toolbar.tsx +5 -0
  54. package/src/components/DataTable/ViewOptions.tsx +86 -0
  55. package/src/components/DataTable/context.tsx +21 -0
  56. package/src/components/DataTable/index.ts +5 -0
  57. package/src/components/DataTable/types.ts +27 -0
  58. package/src/components/DataTable/useResponsiveColumns.tsx +346 -0
  59. package/src/components/DateRange/DateRange.tsx +163 -0
  60. package/src/components/DateRange/index.ts +3 -0
  61. package/src/components/Dialog/Dialog.tsx +201 -0
  62. package/src/components/Dialog/index.ts +25 -0
  63. package/src/components/Dialog/useDraggable.ts +108 -0
  64. package/src/components/DisplaySetMessageListTooltip/DisplaySetMessageListTooltip.tsx +64 -0
  65. package/src/components/DisplaySetMessageListTooltip/index.ts +3 -0
  66. package/src/components/DoubleSlider/DoubleSlider.test.ts +232 -0
  67. package/src/components/DoubleSlider/DoubleSlider.tsx +211 -0
  68. package/src/components/DoubleSlider/index.tsx +3 -0
  69. package/src/components/DropdownMenu/DropdownMenu.tsx +213 -0
  70. package/src/components/DropdownMenu/index.ts +35 -0
  71. package/src/components/Errorboundary/ErrorBoundary.tsx +345 -0
  72. package/src/components/Errorboundary/index.tsx +3 -0
  73. package/src/components/FooterAction/FooterAction.tsx +115 -0
  74. package/src/components/FooterAction/index.tsx +3 -0
  75. package/src/components/Header/Header.tsx +140 -0
  76. package/src/components/Header/index.js +2 -0
  77. package/src/components/HoverCard/HoverCard.tsx +30 -0
  78. package/src/components/HoverCard/index.ts +1 -0
  79. package/src/components/Icons/Icons.tsx +852 -0
  80. package/src/components/Icons/Sources/ActionNewDialog.tsx +64 -0
  81. package/src/components/Icons/Sources/Actions.tsx +47 -0
  82. package/src/components/Icons/Sources/Add.tsx +51 -0
  83. package/src/components/Icons/Sources/Alert.tsx +32 -0
  84. package/src/components/Icons/Sources/AlertOutline.tsx +30 -0
  85. package/src/components/Icons/Sources/ArrowLeftBold.tsx +49 -0
  86. package/src/components/Icons/Sources/ArrowRight.tsx +25 -0
  87. package/src/components/Icons/Sources/Cancel.tsx +37 -0
  88. package/src/components/Icons/Sources/CheckBoxChecked.tsx +39 -0
  89. package/src/components/Icons/Sources/CheckBoxUnChecked.tsx +25 -0
  90. package/src/components/Icons/Sources/Checked.tsx +23 -0
  91. package/src/components/Icons/Sources/ChevronClosed.tsx +40 -0
  92. package/src/components/Icons/Sources/ChevronLeft.tsx +28 -0
  93. package/src/components/Icons/Sources/ChevronOpen.tsx +38 -0
  94. package/src/components/Icons/Sources/Clear.tsx +34 -0
  95. package/src/components/Icons/Sources/Clipboard.tsx +15 -0
  96. package/src/components/Icons/Sources/Close.tsx +28 -0
  97. package/src/components/Icons/Sources/CloudSettings.tsx +34 -0
  98. package/src/components/Icons/Sources/Code.tsx +7 -0
  99. package/src/components/Icons/Sources/ColorChange.tsx +100 -0
  100. package/src/components/Icons/Sources/ContentNext.tsx +35 -0
  101. package/src/components/Icons/Sources/ContentPrev.tsx +35 -0
  102. package/src/components/Icons/Sources/Controls.tsx +99 -0
  103. package/src/components/Icons/Sources/Copy.tsx +44 -0
  104. package/src/components/Icons/Sources/Database.tsx +33 -0
  105. package/src/components/Icons/Sources/Delete.tsx +58 -0
  106. package/src/components/Icons/Sources/DicomTagBrowser.tsx +79 -0
  107. package/src/components/Icons/Sources/DisplayFillAndOutline.tsx +49 -0
  108. package/src/components/Icons/Sources/DisplayFillOnly.tsx +40 -0
  109. package/src/components/Icons/Sources/DisplayOutlineOnly.tsx +40 -0
  110. package/src/components/Icons/Sources/Download.tsx +75 -0
  111. package/src/components/Icons/Sources/Export.tsx +53 -0
  112. package/src/components/Icons/Sources/ExternalLink.tsx +26 -0
  113. package/src/components/Icons/Sources/EyeHidden.tsx +32 -0
  114. package/src/components/Icons/Sources/EyeVisible.tsx +28 -0
  115. package/src/components/Icons/Sources/FeedbackComplete.tsx +35 -0
  116. package/src/components/Icons/Sources/GearSettings.tsx +59 -0
  117. package/src/components/Icons/Sources/GroupLayers.tsx +33 -0
  118. package/src/components/Icons/Sources/Helpers.tsx +398 -0
  119. package/src/components/Icons/Sources/Hide.tsx +45 -0
  120. package/src/components/Icons/Sources/IconColorLUT.tsx +103 -0
  121. package/src/components/Icons/Sources/IconMPR.tsx +55 -0
  122. package/src/components/Icons/Sources/IconTransferring.tsx +25 -0
  123. package/src/components/Icons/Sources/IllustrationNotFound.tsx +102 -0
  124. package/src/components/Icons/Sources/Info.tsx +55 -0
  125. package/src/components/Icons/Sources/InfoLink.tsx +23 -0
  126. package/src/components/Icons/Sources/InfoSeries.tsx +52 -0
  127. package/src/components/Icons/Sources/InvestigationalUse.tsx +82 -0
  128. package/src/components/Icons/Sources/JumpToSlice.tsx +69 -0
  129. package/src/components/Icons/Sources/LaunchArrow.tsx +34 -0
  130. package/src/components/Icons/Sources/LaunchInfo.tsx +38 -0
  131. package/src/components/Icons/Sources/LayerBackground.tsx +28 -0
  132. package/src/components/Icons/Sources/LayerForeground.tsx +34 -0
  133. package/src/components/Icons/Sources/LayerSegmentation.tsx +20 -0
  134. package/src/components/Icons/Sources/Layout.tsx +433 -0
  135. package/src/components/Icons/Sources/Link.tsx +58 -0
  136. package/src/components/Icons/Sources/ListView.tsx +79 -0
  137. package/src/components/Icons/Sources/LoadingOHIFMark.tsx +21 -0
  138. package/src/components/Icons/Sources/LoadingSpinner.tsx +49 -0
  139. package/src/components/Icons/Sources/Lock.tsx +35 -0
  140. package/src/components/Icons/Sources/Magnifier.tsx +37 -0
  141. package/src/components/Icons/Sources/Minus.tsx +40 -0
  142. package/src/components/Icons/Sources/MissingIcon.tsx +6 -0
  143. package/src/components/Icons/Sources/More.tsx +53 -0
  144. package/src/components/Icons/Sources/MultiplePatients.tsx +76 -0
  145. package/src/components/Icons/Sources/NavigationPanelReveal.tsx +25 -0
  146. package/src/components/Icons/Sources/NotificationInfo.tsx +33 -0
  147. package/src/components/Icons/Sources/NotificationWarning.tsx +44 -0
  148. package/src/components/Icons/Sources/OHIFLogo.tsx +72 -0
  149. package/src/components/Icons/Sources/OHIFLogoColorDarkBackground.tsx +78 -0
  150. package/src/components/Icons/Sources/OHIFLogoHorizontal.tsx +139 -0
  151. package/src/components/Icons/Sources/Opacity.tsx +106 -0
  152. package/src/components/Icons/Sources/OrientationSwitch.tsx +41 -0
  153. package/src/components/Icons/Sources/OrientationSwitchA.tsx +41 -0
  154. package/src/components/Icons/Sources/OrientationSwitchC.tsx +41 -0
  155. package/src/components/Icons/Sources/OrientationSwitchR.tsx +41 -0
  156. package/src/components/Icons/Sources/OrientationSwitchS.tsx +41 -0
  157. package/src/components/Icons/Sources/PanelRight.tsx +29 -0
  158. package/src/components/Icons/Sources/Patient.tsx +58 -0
  159. package/src/components/Icons/Sources/PatientStudyList.tsx +62 -0
  160. package/src/components/Icons/Sources/Pause.tsx +26 -0
  161. package/src/components/Icons/Sources/Pencil.tsx +16 -0
  162. package/src/components/Icons/Sources/Pin.tsx +50 -0
  163. package/src/components/Icons/Sources/PinFill.tsx +51 -0
  164. package/src/components/Icons/Sources/Play.tsx +25 -0
  165. package/src/components/Icons/Sources/Plus.tsx +29 -0
  166. package/src/components/Icons/Sources/PowerOff.tsx +19 -0
  167. package/src/components/Icons/Sources/Redo.tsx +51 -0
  168. package/src/components/Icons/Sources/Refresh.tsx +42 -0
  169. package/src/components/Icons/Sources/Rename.tsx +50 -0
  170. package/src/components/Icons/Sources/Search.tsx +35 -0
  171. package/src/components/Icons/Sources/SegActions.tsx +594 -0
  172. package/src/components/Icons/Sources/Series.tsx +47 -0
  173. package/src/components/Icons/Sources/SeriesPlaceholder.tsx +40 -0
  174. package/src/components/Icons/Sources/Settings.tsx +105 -0
  175. package/src/components/Icons/Sources/SettingsStudyList.tsx +28 -0
  176. package/src/components/Icons/Sources/Show.tsx +67 -0
  177. package/src/components/Icons/Sources/SidePanelCloseLeft.tsx +75 -0
  178. package/src/components/Icons/Sources/SidePanelCloseRight.tsx +74 -0
  179. package/src/components/Icons/Sources/SocialGithub.tsx +39 -0
  180. package/src/components/Icons/Sources/Sorting.tsx +39 -0
  181. package/src/components/Icons/Sources/SortingAscending.tsx +28 -0
  182. package/src/components/Icons/Sources/SortingDescending.tsx +26 -0
  183. package/src/components/Icons/Sources/SortingNew.tsx +20 -0
  184. package/src/components/Icons/Sources/SortingNewAscending.tsx +35 -0
  185. package/src/components/Icons/Sources/SortingNewDescending.tsx +35 -0
  186. package/src/components/Icons/Sources/StatusAlert.tsx +36 -0
  187. package/src/components/Icons/Sources/StatusError.tsx +57 -0
  188. package/src/components/Icons/Sources/StatusLocked.tsx +35 -0
  189. package/src/components/Icons/Sources/StatusSuccess.tsx +45 -0
  190. package/src/components/Icons/Sources/StatusTracking.tsx +37 -0
  191. package/src/components/Icons/Sources/StatusUntracked.tsx +30 -0
  192. package/src/components/Icons/Sources/StatusWarning.tsx +58 -0
  193. package/src/components/Icons/Sources/Tab4D.tsx +54 -0
  194. package/src/components/Icons/Sources/TabContours.tsx +63 -0
  195. package/src/components/Icons/Sources/TabLinear.tsx +47 -0
  196. package/src/components/Icons/Sources/TabPatientInfo.tsx +33 -0
  197. package/src/components/Icons/Sources/TabRoiThreshold.tsx +38 -0
  198. package/src/components/Icons/Sources/TabSegmentation.tsx +38 -0
  199. package/src/components/Icons/Sources/TabStudies.tsx +62 -0
  200. package/src/components/Icons/Sources/Threshold.tsx +38 -0
  201. package/src/components/Icons/Sources/ThumbnailView.tsx +67 -0
  202. package/src/components/Icons/Sources/Tools.tsx +3659 -0
  203. package/src/components/Icons/Sources/Trash.tsx +17 -0
  204. package/src/components/Icons/Sources/Undo.tsx +51 -0
  205. package/src/components/Icons/Sources/Upload.tsx +29 -0
  206. package/src/components/Icons/Sources/ViewportViews.tsx +45 -0
  207. package/src/components/Icons/Sources/ViewportWindowLevel.tsx +58 -0
  208. package/src/components/Icons/Sources/WindowLevelAdvanced.tsx +30 -0
  209. package/src/components/Icons/index.ts +4 -0
  210. package/src/components/Icons/types.ts +3 -0
  211. package/src/components/Input/Input.tsx +25 -0
  212. package/src/components/Input/index.tsx +3 -0
  213. package/src/components/InputFilter/InputFilter.tsx +200 -0
  214. package/src/components/InputFilter/index.ts +2 -0
  215. package/src/components/InputMultiSelect/InputMultiSelect.tsx +370 -0
  216. package/src/components/InputMultiSelect/index.ts +1 -0
  217. package/src/components/InputNumber/InputNumber.tsx +439 -0
  218. package/src/components/InputNumber/index.ts +3 -0
  219. package/src/components/InvestigationalUseDialog/InvestigationalUseDialog.tsx +98 -0
  220. package/src/components/InvestigationalUseDialog/index.ts +3 -0
  221. package/src/components/Label/Label.tsx +24 -0
  222. package/src/components/Label/index.tsx +3 -0
  223. package/src/components/Labelling/LabellingFlow.tsx +92 -0
  224. package/src/components/Labelling/index.ts +2 -0
  225. package/src/components/LayoutSelector/LayoutSelector.tsx +345 -0
  226. package/src/components/LayoutSelector/index.ts +4 -0
  227. package/src/components/LineChart/LineChart.css +40 -0
  228. package/src/components/LineChart/LineChart.tsx +101 -0
  229. package/src/components/LineChart/d3LineChart/chart.ts +365 -0
  230. package/src/components/LineChart/d3LineChart/events.ts +149 -0
  231. package/src/components/LineChart/d3LineChart/index.ts +3 -0
  232. package/src/components/LineChart/d3LineChart/lineChart.ts +272 -0
  233. package/src/components/LineChart/index.ts +1 -0
  234. package/src/components/LoadingIndicatorProgress/LoadingIndicatorProgress.tsx +29 -0
  235. package/src/components/LoadingIndicatorProgress/index.ts +2 -0
  236. package/src/components/LoadingIndicatorTotalPercent/LoadingIndicatorTotalPercent.tsx +49 -0
  237. package/src/components/LoadingIndicatorTotalPercent/index.ts +2 -0
  238. package/src/components/MeasurementTable/MeasurementTable.tsx +144 -0
  239. package/src/components/MeasurementTable/index.js +3 -0
  240. package/src/components/Modal/Modal.tsx +44 -0
  241. package/src/components/NavBar/NavBar.tsx +32 -0
  242. package/src/components/NavBar/index.js +2 -0
  243. package/src/components/Numeric/Numeric.test.ts +124 -0
  244. package/src/components/Numeric/Numeric.tsx +576 -0
  245. package/src/components/Numeric/index.ts +3 -0
  246. package/src/components/OHIFDialogs/InputDialog.tsx +287 -0
  247. package/src/components/OHIFDialogs/PresetDialog.tsx +106 -0
  248. package/src/components/OHIFDialogs/index.ts +2 -0
  249. package/src/components/OHIFModals/AboutModal.tsx +114 -0
  250. package/src/components/OHIFModals/AppearanceModal.tsx +38 -0
  251. package/src/components/OHIFModals/ImageModal.tsx +251 -0
  252. package/src/components/OHIFModals/UserPreferencesModal.tsx +229 -0
  253. package/src/components/OHIFModals/index.ts +4 -0
  254. package/src/components/OHIFPanels/WindowLevel.tsx +162 -0
  255. package/src/components/OHIFPanels/WindowLevelHistogram.tsx +237 -0
  256. package/src/components/OHIFPanels/index.ts +3 -0
  257. package/src/components/OHIFPanels/types.ts +41 -0
  258. package/src/components/OHIFToolSettings/RowDoubleRange.tsx +67 -0
  259. package/src/components/OHIFToolSettings/RowInputRange.tsx +65 -0
  260. package/src/components/OHIFToolSettings/RowSegmentedControl.tsx +77 -0
  261. package/src/components/OHIFToolSettings/ToolSettings.tsx +253 -0
  262. package/src/components/OHIFToolSettings/index.ts +1 -0
  263. package/src/components/OHIFToolbox/ToolboxUI.tsx +104 -0
  264. package/src/components/OHIFToolbox/index.ts +1 -0
  265. package/src/components/Onboarding/Onboarding.css +48 -0
  266. package/src/components/Onboarding/Onboarding.tsx +58 -0
  267. package/src/components/Onboarding/index.ts +3 -0
  268. package/src/components/Onboarding/utilities.ts +91 -0
  269. package/src/components/PanelSection/PanelSection.tsx +70 -0
  270. package/src/components/PanelSection/index.ts +2 -0
  271. package/src/components/Popover/Popover.tsx +35 -0
  272. package/src/components/Popover/index.ts +3 -0
  273. package/src/components/ProgressDropdown/ProgressDiscreteBar.tsx +24 -0
  274. package/src/components/ProgressDropdown/ProgressDropdown.tsx +158 -0
  275. package/src/components/ProgressDropdown/ProgressItem.tsx +27 -0
  276. package/src/components/ProgressDropdown/ProgressItemDetail.tsx +89 -0
  277. package/src/components/ProgressDropdown/index.ts +1 -0
  278. package/src/components/ProgressDropdown/types.ts +9 -0
  279. package/src/components/ProgressLoadingBar/ProgressLoadingBar.css +26 -0
  280. package/src/components/ProgressLoadingBar/ProgressLoadingBar.tsx +32 -0
  281. package/src/components/ProgressLoadingBar/index.ts +2 -0
  282. package/src/components/Resizable/Resizable.tsx +43 -0
  283. package/src/components/Resizable/index.ts +3 -0
  284. package/src/components/ScrollArea/ScrollArea.tsx +127 -0
  285. package/src/components/ScrollArea/index.tsx +3 -0
  286. package/src/components/SegmentationTable/AddSegmentRow.tsx +78 -0
  287. package/src/components/SegmentationTable/AddSegmentationRow.tsx +56 -0
  288. package/src/components/SegmentationTable/SegmentStatistics.tsx +104 -0
  289. package/src/components/SegmentationTable/SegmentationCollapsed.tsx +211 -0
  290. package/src/components/SegmentationTable/SegmentationExpanded.tsx +173 -0
  291. package/src/components/SegmentationTable/SegmentationHeader.tsx +58 -0
  292. package/src/components/SegmentationTable/SegmentationLabel.tsx +27 -0
  293. package/src/components/SegmentationTable/SegmentationSegments.tsx +206 -0
  294. package/src/components/SegmentationTable/SegmentationTable.tsx +169 -0
  295. package/src/components/SegmentationTable/SegmentationTableConfig.tsx +194 -0
  296. package/src/components/SegmentationTable/contexts/SegmentStatisticsContext.tsx +45 -0
  297. package/src/components/SegmentationTable/contexts/SegmentationExpandedContext.tsx +45 -0
  298. package/src/components/SegmentationTable/contexts/SegmentationTableContext.tsx +148 -0
  299. package/src/components/SegmentationTable/contexts/index.ts +15 -0
  300. package/src/components/SegmentationTable/index.ts +24 -0
  301. package/src/components/Select/Select.tsx +167 -0
  302. package/src/components/Select/index.tsx +40 -0
  303. package/src/components/Separator/Separator.tsx +32 -0
  304. package/src/components/Separator/index.ts +3 -0
  305. package/src/components/Separator/index.tsx +3 -0
  306. package/src/components/SidePanel/SidePanel.tsx +479 -0
  307. package/src/components/SidePanel/index.ts +2 -0
  308. package/src/components/Slider/Slider.tsx +24 -0
  309. package/src/components/Slider/index.tsx +3 -0
  310. package/src/components/SmartScrollbar/SmartScrollbar.tsx +349 -0
  311. package/src/components/SmartScrollbar/SmartScrollbarEndpoints.tsx +82 -0
  312. package/src/components/SmartScrollbar/SmartScrollbarFill.tsx +54 -0
  313. package/src/components/SmartScrollbar/SmartScrollbarIndicator.tsx +59 -0
  314. package/src/components/SmartScrollbar/SmartScrollbarTrack.tsx +104 -0
  315. package/src/components/SmartScrollbar/defaultSmartScrollbarIndicatorConfig.tsx +48 -0
  316. package/src/components/SmartScrollbar/index.ts +11 -0
  317. package/src/components/SmartScrollbar/useByteArray.ts +146 -0
  318. package/src/components/SmartScrollbar/utils.test.ts +124 -0
  319. package/src/components/SmartScrollbar/utils.ts +168 -0
  320. package/src/components/Sonner/Sonner.tsx +31 -0
  321. package/src/components/Sonner/index.ts +4 -0
  322. package/src/components/StudyBrowser/StudyBrowser.tsx +89 -0
  323. package/src/components/StudyBrowser/index.ts +2 -0
  324. package/src/components/StudyBrowserSort/StudyBrowserSort.tsx +87 -0
  325. package/src/components/StudyBrowserSort/index.ts +3 -0
  326. package/src/components/StudyBrowserViewOptions/StudyBrowserViewOptions.tsx +50 -0
  327. package/src/components/StudyBrowserViewOptions/index.ts +3 -0
  328. package/src/components/StudyItem/StudyItem.tsx +100 -0
  329. package/src/components/StudyItem/index.ts +2 -0
  330. package/src/components/StudyList/columns/defaultColumns.tsx +258 -0
  331. package/src/components/StudyList/components/ActionCell.tsx +19 -0
  332. package/src/components/StudyList/components/Layout.tsx +206 -0
  333. package/src/components/StudyList/components/PreviewContainer.tsx +45 -0
  334. package/src/components/StudyList/components/PreviewContent.tsx +186 -0
  335. package/src/components/StudyList/components/PreviewHeader.tsx +5 -0
  336. package/src/components/StudyList/components/PreviewPatientSummary.tsx +224 -0
  337. package/src/components/StudyList/components/PreviewSeriesList.tsx +64 -0
  338. package/src/components/StudyList/components/PreviewToggleButton.tsx +69 -0
  339. package/src/components/StudyList/components/SettingsPopover.tsx +214 -0
  340. package/src/components/StudyList/components/Table.tsx +247 -0
  341. package/src/components/StudyList/components/WorkflowMenu.tsx +72 -0
  342. package/src/components/StudyList/components/WorkflowsProvider.tsx +169 -0
  343. package/src/components/StudyList/hooks/useDefaultWorkflow.ts +60 -0
  344. package/src/components/StudyList/index.ts +52 -0
  345. package/src/components/StudyList/types/types.ts +42 -0
  346. package/src/components/StudyList/utils/tokenizeModalities.ts +6 -0
  347. package/src/components/StudySummary/StudySummary.tsx +27 -0
  348. package/src/components/StudySummary/index.tsx +3 -0
  349. package/src/components/Switch/Switch.tsx +28 -0
  350. package/src/components/Switch/index.tsx +3 -0
  351. package/src/components/Table/Table.tsx +134 -0
  352. package/src/components/Table/index.ts +11 -0
  353. package/src/components/Tabs/Tabs.tsx +56 -0
  354. package/src/components/Tabs/index.ts +3 -0
  355. package/src/components/Tabs/index.tsx +3 -0
  356. package/src/components/ThemeWrapper/ThemeWrapper.tsx +5 -0
  357. package/src/components/ThemeWrapper/index.ts +1 -0
  358. package/src/components/Thumbnail/Thumbnail.test.ts +71 -0
  359. package/src/components/Thumbnail/Thumbnail.tsx +351 -0
  360. package/src/components/Thumbnail/index.ts +2 -0
  361. package/src/components/ThumbnailList/ThumbnailList.tsx +94 -0
  362. package/src/components/ThumbnailList/index.ts +2 -0
  363. package/src/components/Toggle/Toggle.tsx +45 -0
  364. package/src/components/Toggle/index.ts +3 -0
  365. package/src/components/Toggle/index.tsx +3 -0
  366. package/src/components/ToggleGroup/ToggleGroup.tsx +63 -0
  367. package/src/components/ToggleGroup/index.ts +3 -0
  368. package/src/components/ToolButton/ToolButton.tsx +134 -0
  369. package/src/components/ToolButton/ToolButtonList.tsx +243 -0
  370. package/src/components/ToolButton/index.ts +8 -0
  371. package/src/components/Tooltip/Tooltip.tsx +34 -0
  372. package/src/components/Tooltip/index.ts +3 -0
  373. package/src/components/Viewport/ImageScrollbar.module.css +89 -0
  374. package/src/components/Viewport/ImageScrollbar.tsx +71 -0
  375. package/src/components/Viewport/PatientInfo.tsx +126 -0
  376. package/src/components/Viewport/ViewportActionArrows.tsx +36 -0
  377. package/src/components/Viewport/ViewportActionBar.tsx +107 -0
  378. package/src/components/Viewport/ViewportActionButton.tsx +25 -0
  379. package/src/components/Viewport/ViewportActionCorners.tsx +171 -0
  380. package/src/components/Viewport/ViewportGrid.tsx +24 -0
  381. package/src/components/Viewport/ViewportOverlay.css +32 -0
  382. package/src/components/Viewport/ViewportOverlay.tsx +54 -0
  383. package/src/components/Viewport/ViewportPane.tsx +82 -0
  384. package/src/components/Viewport/index.ts +9 -0
  385. package/src/components/ViewportDialog/ViewportDialog.tsx +128 -0
  386. package/src/components/ViewportDialog/index.ts +2 -0
  387. package/src/components/index.ts +323 -0
  388. package/src/contextProviders/ActiveThemeProvider.tsx +204 -0
  389. package/src/contextProviders/CineProvider.tsx +98 -0
  390. package/src/contextProviders/DialogProvider.tsx +103 -0
  391. package/src/contextProviders/DragAndDropProvider.tsx +37 -0
  392. package/src/contextProviders/IconPresentationProvider.tsx +88 -0
  393. package/src/contextProviders/ImageViewerProvider.tsx +15 -0
  394. package/src/contextProviders/ManagedDialog.tsx +176 -0
  395. package/src/contextProviders/ModalProvider.tsx +102 -0
  396. package/src/contextProviders/NotificationProvider.tsx +246 -0
  397. package/src/contextProviders/UserAuthenticationProvider.tsx +118 -0
  398. package/src/contextProviders/ViewportDialogProvider.tsx +42 -0
  399. package/src/contextProviders/ViewportGridProvider.tsx +556 -0
  400. package/src/contextProviders/index.ts +26 -0
  401. package/src/hooks/index.ts +4 -0
  402. package/src/hooks/useDynamicMaxHeight.ts +105 -0
  403. package/src/hooks/useSessionStorage.test.js +103 -0
  404. package/src/hooks/useSessionStorage.tsx +71 -0
  405. package/src/index.ts +7 -0
  406. package/src/lib/utils.ts +6 -0
  407. package/src/tailwind.css +266 -0
  408. package/src/themes/arctic.json +31 -0
  409. package/src/themes/deep.json +31 -0
  410. package/src/themes/index.ts +16 -0
  411. package/src/themes/midnight.json +31 -0
  412. package/src/themes/orchid.json +31 -0
  413. package/src/themes/slate.json +31 -0
  414. package/src/themes/themes.css +206 -0
  415. package/src/themes/verdant.json +31 -0
  416. package/src/types/ActionCorners.ts +18 -0
  417. package/src/types/AppTypes.ts +24 -0
  418. package/src/types/ContextMenuItem.ts +9 -0
  419. package/src/types/Predicate.ts +1 -0
  420. package/src/types/ThumbnailType.ts +3 -0
  421. package/src/types/ViewportActionCornersTypes.ts +13 -0
  422. package/src/types/global.d.ts +4 -0
  423. package/src/types/index.ts +21 -0
  424. package/src/utils/formatDICOMDate.test.ts +61 -0
  425. package/src/utils/formatDICOMDate.ts +65 -0
  426. package/src/utils/formatDICOMTime.test.ts +62 -0
  427. package/src/utils/formatDICOMTime.ts +49 -0
  428. package/src/utils/getToggledClassName.tsx +5 -0
  429. package/src/utils/index.ts +15 -0
  430. package/src/utils/parseStudyDateTimestamp.test.ts +47 -0
  431. package/src/utils/parseStudyDateTimestamp.ts +27 -0
  432. package/src/utils/roundNumber.ts +43 -0
  433. package/tailwind.config.js +120 -0
@@ -0,0 +1,206 @@
1
+ import React, { useEffect } from 'react';
2
+ import { ScrollArea, DataRow } from '../../components';
3
+ import { HoverCard, HoverCardTrigger, HoverCardContent } from '../../components/HoverCard';
4
+ import { useSegmentationTableContext, useSegmentationExpanded } from './contexts';
5
+ import { SegmentStatistics } from './SegmentStatistics';
6
+ import { useDynamicMaxHeight } from '../../hooks/useDynamicMaxHeight';
7
+
8
+ export const SegmentationSegments = ({ children = null }: { children?: React.ReactNode }) => {
9
+ const {
10
+ activeSegmentationId,
11
+ disableEditing,
12
+ onSegmentColorClick,
13
+ onToggleSegmentVisibility,
14
+ onToggleSegmentLock,
15
+ onSegmentClick,
16
+ onSegmentEdit,
17
+ onSegmentDelete,
18
+ onSegmentCopy,
19
+ data,
20
+ showSegmentIndex = true,
21
+ } = useSegmentationTableContext('SegmentationSegments');
22
+
23
+ const activeSegmentRef = React.useRef<{
24
+ element: HTMLElement | null;
25
+ index: number | null;
26
+ }>({ element: null, index: null });
27
+
28
+ // Prefer the expanded context when this list is rendered inside one, otherwise
29
+ // fall back to the active segmentation from the table context. Both shapes
30
+ // expose `segmentation` and `representation`, so one lookup covers each case.
31
+ const expandedContext = useSegmentationExpanded();
32
+ const segmentationInfo =
33
+ expandedContext ??
34
+ data.find(entry => entry.segmentation.segmentationId === activeSegmentationId);
35
+ const segmentation = segmentationInfo?.segmentation;
36
+ const representation = segmentationInfo?.representation;
37
+
38
+ const segments = Object.values(representation.segments);
39
+
40
+ // Find the active segment to scroll to it when it changes
41
+ const activeSegment = segments.find(segment => {
42
+ if (!segment) {
43
+ return false;
44
+ }
45
+ const segmentFromSegmentation = segmentation.segments[segment.segmentIndex];
46
+ return segmentFromSegmentation?.active;
47
+ });
48
+
49
+ const isActiveSegmentation = segmentation.segmentationId === activeSegmentationId;
50
+
51
+ const { ref: scrollableContainerRef, maxHeight } = useDynamicMaxHeight(segments);
52
+
53
+ useEffect(() => {
54
+ const activeSegmentIndex = activeSegmentRef.current.index;
55
+ if (!activeSegmentIndex || activeSegmentIndex !== activeSegment?.segmentIndex) {
56
+ return;
57
+ }
58
+
59
+ const activeSegmentElement = activeSegmentRef.current.element;
60
+
61
+ if (!activeSegmentElement) {
62
+ return;
63
+ }
64
+
65
+ // Check if the active segment is already visible.
66
+ const activeSegmentElementBounds = activeSegmentElement.getBoundingClientRect();
67
+ const scrollableContainerRect = scrollableContainerRef.current.getBoundingClientRect();
68
+ if (
69
+ activeSegmentElementBounds.top > scrollableContainerRect.top &&
70
+ activeSegmentElementBounds.bottom < scrollableContainerRect.bottom
71
+ ) {
72
+ // The active segment is already visible, so we don't need to scroll.
73
+ return;
74
+ }
75
+
76
+ activeSegmentElement.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
77
+ }, [activeSegment?.segmentIndex, scrollableContainerRef]);
78
+
79
+ if (!representation || !segmentation) {
80
+ return null;
81
+ }
82
+
83
+ return (
84
+ <div ref={scrollableContainerRef}>
85
+ <ScrollArea
86
+ className={`bg-background space-y-px`}
87
+ showArrows={true}
88
+ >
89
+ <div style={{ maxHeight: maxHeight }}>
90
+ {segments.map(segment => {
91
+ if (!segment) {
92
+ return null;
93
+ }
94
+ const { segmentIndex, color, visible } = segment as {
95
+ segmentIndex: number;
96
+ color: number[];
97
+ visible: boolean;
98
+ };
99
+ const segmentFromSegmentation = segmentation.segments[segmentIndex];
100
+
101
+ if (!segmentFromSegmentation) {
102
+ return null;
103
+ }
104
+
105
+ const { locked, active, label, displayText } = segmentFromSegmentation;
106
+ const cssColor = `rgb(${color[0]},${color[1]},${color[2]})`;
107
+
108
+ // Secondary selection: segment is active, but its parent segmentation is inactive
109
+ const isSecondarySelected = active && !isActiveSegmentation;
110
+
111
+ const hasStats = segmentFromSegmentation.cachedStats?.namedStats;
112
+
113
+ const segmentRowRef = (element: HTMLElement) => {
114
+ if (!active) {
115
+ return;
116
+ }
117
+
118
+ if (element) {
119
+ activeSegmentRef.current = { element, index: segmentIndex };
120
+ } else {
121
+ activeSegmentRef.current = { element: null, index: null };
122
+ }
123
+ };
124
+
125
+ const DataRowComponent = (
126
+ <DataRow
127
+ ref={segmentRowRef}
128
+ key={segmentIndex}
129
+ number={showSegmentIndex ? segmentIndex : null}
130
+ title={label}
131
+ // details={displayText}
132
+ description={displayText}
133
+ colorHex={cssColor}
134
+ // Primary selection only when part of the active segmentation
135
+ isSelected={active && isActiveSegmentation}
136
+ // Secondary selection tint when selected in an inactive segmentation
137
+ isSecondarySelected={isSecondarySelected}
138
+ isVisible={visible}
139
+ isLocked={locked}
140
+ disableEditing={disableEditing}
141
+ className={!isActiveSegmentation ? 'opacity-80' : ''}
142
+ onColor={() => onSegmentColorClick(segmentation.segmentationId, segmentIndex)}
143
+ onToggleVisibility={() =>
144
+ onToggleSegmentVisibility(
145
+ segmentation.segmentationId,
146
+ segmentIndex,
147
+ representation.type
148
+ )
149
+ }
150
+ onToggleLocked={() =>
151
+ onToggleSegmentLock(segmentation.segmentationId, segmentIndex)
152
+ }
153
+ onSelect={() => onSegmentClick(segmentation.segmentationId, segmentIndex)}
154
+ onRename={() => onSegmentEdit(segmentation.segmentationId, segmentIndex)}
155
+ onDelete={() => onSegmentDelete(segmentation.segmentationId, segmentIndex)}
156
+ onCopy={
157
+ onSegmentCopy
158
+ ? () => onSegmentCopy(segmentation.segmentationId, segmentIndex)
159
+ : undefined
160
+ }
161
+ />
162
+ );
163
+
164
+ return hasStats ? (
165
+ <HoverCard
166
+ key={`hover-${segmentIndex}`}
167
+ openDelay={300}
168
+ >
169
+ <HoverCardTrigger asChild>
170
+ <div>{DataRowComponent}</div>
171
+ </HoverCardTrigger>
172
+ <HoverCardContent
173
+ side="left"
174
+ align="start"
175
+ className="w-72 border"
176
+ >
177
+ <div className="mb-4 flex items-center space-x-2">
178
+ <div
179
+ className="h-2.5 w-2.5 flex-shrink-0 rounded-full"
180
+ style={{ backgroundColor: cssColor }}
181
+ ></div>
182
+ <h3 className="text-muted-foreground break-words font-semibold">{label}</h3>
183
+ </div>
184
+
185
+ <SegmentStatistics
186
+ segment={{
187
+ ...segmentFromSegmentation,
188
+ segmentIndex,
189
+ }}
190
+ segmentationId={segmentation.segmentationId}
191
+ >
192
+ {children}
193
+ </SegmentStatistics>
194
+ </HoverCardContent>
195
+ </HoverCard>
196
+ ) : (
197
+ DataRowComponent
198
+ );
199
+ })}
200
+ </div>
201
+ </ScrollArea>
202
+ </div>
203
+ );
204
+ };
205
+
206
+ SegmentationSegments.displayName = 'SegmentationTable.Segments';
@@ -0,0 +1,169 @@
1
+ import React, { ReactNode, useState, Children, isValidElement } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { PanelSection } from '../PanelSection';
4
+ import {
5
+ SegmentationTableProvider,
6
+ SegmentationTableContextType,
7
+ } from './contexts/SegmentationTableContext';
8
+ import { SegmentationSegments } from './SegmentationSegments';
9
+ import { SegmentStatistics } from './SegmentStatistics';
10
+ import { SegmentationTableConfig } from './SegmentationTableConfig';
11
+ import { AddSegmentRow } from './AddSegmentRow';
12
+ import { AddSegmentationRow } from './AddSegmentationRow';
13
+ import { SegmentationHeader } from './SegmentationHeader';
14
+ import { SegmentationCollapsed } from './SegmentationCollapsed';
15
+ import { SegmentationExpanded } from './SegmentationExpanded';
16
+ import Icons from '../Icons';
17
+
18
+ // Only include props that aren't part of the context
19
+ interface SegmentationTableProps extends Omit<SegmentationTableContextType, 'setShowConfig'> {
20
+ title?: string;
21
+ children?: ReactNode;
22
+ setShowConfig?: (value: boolean) => void;
23
+ }
24
+
25
+ interface SegmentationTableComponent extends React.FC<SegmentationTableProps> {
26
+ Segments: typeof SegmentationSegments;
27
+ Config: typeof SegmentationTableConfig;
28
+ AddSegmentRow: typeof AddSegmentRow;
29
+ AddSegmentationRow: typeof AddSegmentationRow;
30
+ Header: typeof SegmentationHeader;
31
+ Collapsed: typeof SegmentationCollapsed;
32
+ Expanded: typeof SegmentationExpanded;
33
+ SegmentStatistics: typeof SegmentStatistics;
34
+ }
35
+
36
+ /**
37
+ * Returns `fallback` only when `value` is `undefined`, matching the semantics of
38
+ * a destructuring default (which `??` does not - it also replaces `null`).
39
+ */
40
+ function pick<T>(value: T | undefined, fallback: T): T {
41
+ return value === undefined ? fallback : value;
42
+ }
43
+
44
+ export const SegmentationTableRoot = (props: SegmentationTableProps) => {
45
+ const { t } = useTranslation('SegmentationPanel');
46
+ const {
47
+ data = [],
48
+ mode,
49
+ title,
50
+ disableEditing = false,
51
+ disabled = false,
52
+ children,
53
+ showConfig: externalShowConfig,
54
+ selectedSegmentationIdForType,
55
+ segmentationRepresentationTypes,
56
+ ...contextProps
57
+ } = props;
58
+
59
+ const [internalShowConfig, setInternalShowConfig] = useState(false);
60
+ const showConfig = externalShowConfig !== undefined ? externalShowConfig : internalShowConfig;
61
+
62
+ // Find the active segmentation info based on which representation is active
63
+ const activeSegmentationInfo = data.find(info => info.representation?.active);
64
+
65
+ // Get the active segmentation ID
66
+ const activeSegmentationId =
67
+ props.activeSegmentationId || activeSegmentationInfo?.segmentation?.segmentationId;
68
+ const activeRepresentation = props.activeRepresentation || activeSegmentationInfo?.representation;
69
+ const activeSegmentation = props.activeSegmentation || activeSegmentationInfo?.segmentation;
70
+
71
+ const selectedSegmentationForTypeInfo = data.find(
72
+ info => info.segmentation?.segmentationId === selectedSegmentationIdForType
73
+ );
74
+ const selectedSegmentationForTypeRepresentation = selectedSegmentationForTypeInfo?.representation;
75
+
76
+ // Extract style properties or use defaults. These were destructuring defaults,
77
+ // which the compiler cannot reorder; `pick` keeps the same rule - a default
78
+ // applies only when the value is `undefined`, never when it is `null`.
79
+ const styles = selectedSegmentationForTypeRepresentation?.styles ?? {};
80
+ const fillAlpha = pick(styles.fillAlpha, props.fillAlpha || 0.5);
81
+ const fillAlphaInactive = pick(styles.fillAlphaInactive, props.fillAlphaInactive || 0.2);
82
+ const outlineWidth = pick(styles.outlineWidth, props.outlineWidth || 1);
83
+ const renderFill = pick(styles.renderFill, pick(props.renderFill, true));
84
+ const renderOutline = pick(styles.renderOutline, pick(props.renderOutline, true));
85
+
86
+ // Check if SegmentationTableConfig is present in children
87
+ const hasConfigComponent = Children.toArray(children).some(
88
+ child => isValidElement(child) && child.type === SegmentationTableConfig
89
+ );
90
+
91
+ // Process children to conditionally render the config component based on showConfig
92
+ const processedChildren = Children.map(children, child => {
93
+ if (isValidElement(child) && child.type === SegmentationTableConfig) {
94
+ // Only render the Config component if showConfig is true
95
+ return showConfig ? child : null;
96
+ }
97
+ return child;
98
+ });
99
+
100
+ const toggleShowConfig = () => {
101
+ if (props.setShowConfig) {
102
+ props.setShowConfig(!showConfig);
103
+ } else {
104
+ setInternalShowConfig(!internalShowConfig);
105
+ }
106
+ };
107
+
108
+ const dataCyTypeSuffix = segmentationRepresentationTypes
109
+ ? `-${segmentationRepresentationTypes[0]}`
110
+ : '';
111
+
112
+ return (
113
+ <SegmentationTableProvider
114
+ value={{
115
+ data,
116
+ mode,
117
+ showConfig,
118
+ disabled,
119
+ disableEditing,
120
+ fillAlpha,
121
+ fillAlphaInactive,
122
+ outlineWidth,
123
+ renderFill,
124
+ renderOutline,
125
+ activeSegmentationId,
126
+ activeSegmentation,
127
+ activeRepresentation,
128
+ selectedSegmentationIdForType,
129
+ segmentationRepresentationTypes,
130
+ ...contextProps,
131
+ setShowConfig: toggleShowConfig,
132
+ }}
133
+ >
134
+ <PanelSection defaultOpen={true}>
135
+ <PanelSection.Header className="flex items-center justify-between">
136
+ <span>{t(title)}</span>
137
+ {hasConfigComponent && (
138
+ <div
139
+ className="ml-auto mr-2"
140
+ data-cy={`segmentation-config-toggle${dataCyTypeSuffix}`}
141
+ >
142
+ <Icons.Settings
143
+ className="text-primary h-4 w-4"
144
+ onClick={e => {
145
+ e.stopPropagation();
146
+ toggleShowConfig();
147
+ }}
148
+ />
149
+ </div>
150
+ )}
151
+ </PanelSection.Header>
152
+ <PanelSection.Content>{processedChildren}</PanelSection.Content>
153
+ </PanelSection>
154
+ </SegmentationTableProvider>
155
+ );
156
+ };
157
+
158
+ const SegmentationTable = Object.assign(SegmentationTableRoot, {
159
+ Segments: SegmentationSegments,
160
+ Config: SegmentationTableConfig,
161
+ AddSegmentRow: AddSegmentRow,
162
+ AddSegmentationRow: AddSegmentationRow,
163
+ Collapsed: SegmentationCollapsed,
164
+ Expanded: SegmentationExpanded,
165
+ SegmentStatistics: SegmentStatistics,
166
+ Header: SegmentationHeader,
167
+ }) as SegmentationTableComponent;
168
+
169
+ export { SegmentationTable };
@@ -0,0 +1,194 @@
1
+ import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Tabs, TabsList, TabsTrigger } from '../Tabs';
4
+ import { Icons } from '../Icons';
5
+ import { Switch } from '../Switch';
6
+ import { Label } from '../Label';
7
+ import Numeric from '../Numeric';
8
+ import { useSegmentationTableContext } from './contexts';
9
+
10
+ export const SegmentationTableConfig: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
11
+ const { t } = useTranslation('SegmentationPanel');
12
+ const {
13
+ renderFill,
14
+ renderOutline,
15
+ setRenderFill,
16
+ setRenderFillInactive,
17
+ setRenderOutline,
18
+ setRenderOutlineInactive,
19
+ fillAlpha,
20
+ fillAlphaInactive,
21
+ outlineWidth,
22
+ setFillAlpha,
23
+ setFillAlphaInactive,
24
+ setOutlineWidth,
25
+ renderInactiveSegmentations,
26
+ toggleRenderInactiveSegmentations,
27
+ segmentationRepresentationTypes,
28
+ data,
29
+ } = useSegmentationTableContext('SegmentationTableConfig');
30
+
31
+ if (!data?.length) {
32
+ return null;
33
+ }
34
+
35
+ const dataCyTypeSuffix = segmentationRepresentationTypes
36
+ ? `-${segmentationRepresentationTypes[0]}`
37
+ : '';
38
+
39
+ return (
40
+ <div className="bg-muted mb-0.5 space-y-2 rounded-b px-1.5 pt-0.5 pb-3">
41
+ <div className="my-1 flex items-center justify-between">
42
+ <span className="text-muted-foreground text-xs">
43
+ {t('Show')}:{' '}
44
+ {renderFill && renderOutline
45
+ ? t('Fill & Outline')
46
+ : renderOutline
47
+ ? t('Outline Only')
48
+ : t('Fill Only')}
49
+ </span>
50
+ <Tabs
51
+ value={
52
+ renderFill && renderOutline ? 'fill-and-outline' : renderOutline ? 'outline' : 'fill'
53
+ }
54
+ onValueChange={value => {
55
+ const type = segmentationRepresentationTypes?.[0];
56
+ if (value === 'fill-and-outline') {
57
+ setRenderFill({ type }, true);
58
+ setRenderOutline({ type }, true);
59
+ setRenderFillInactive({ type }, true);
60
+ setRenderOutlineInactive({ type }, true);
61
+ } else if (value === 'outline') {
62
+ setRenderFill({ type }, false);
63
+ setRenderOutline({ type }, true);
64
+ setRenderFillInactive({ type }, false);
65
+ setRenderOutlineInactive({ type }, true);
66
+ } else {
67
+ setRenderFill({ type }, true);
68
+ setRenderOutline({ type }, false);
69
+ setRenderFillInactive({ type }, true);
70
+ setRenderOutlineInactive({ type }, false);
71
+ }
72
+ }}
73
+ >
74
+ <TabsList>
75
+ <TabsTrigger
76
+ value="fill-and-outline"
77
+ data-cy={`segmentation-config-display-fill-and-outline${dataCyTypeSuffix}`}
78
+ >
79
+ <Icons.FillAndOutline className="text-primary" />
80
+ </TabsTrigger>
81
+ <TabsTrigger
82
+ value="outline"
83
+ data-cy={`segmentation-config-display-outline${dataCyTypeSuffix}`}
84
+ >
85
+ <Icons.OutlineOnly className="text-primary" />
86
+ </TabsTrigger>
87
+ <TabsTrigger
88
+ value="fill"
89
+ data-cy={`segmentation-config-display-fill${dataCyTypeSuffix}`}
90
+ >
91
+ <Icons.FillOnly className="text-primary" />
92
+ </TabsTrigger>
93
+ </TabsList>
94
+ </Tabs>
95
+ </div>
96
+
97
+ <div className="space-y-2">
98
+ <div className="my-2 flex items-center">
99
+ <Label className="text-muted-foreground w-14 flex-none whitespace-nowrap text-xs">
100
+ {t('Opacity')}
101
+ </Label>
102
+ <div
103
+ className="mx-1 flex-1"
104
+ data-cy={`segmentation-config-opacity${dataCyTypeSuffix}`}
105
+ >
106
+ <Numeric.Container
107
+ mode="singleRange"
108
+ min={0}
109
+ max={1}
110
+ step={0.1}
111
+ value={fillAlpha}
112
+ onChange={value =>
113
+ setFillAlpha({ type: segmentationRepresentationTypes?.[0] }, value as number)
114
+ }
115
+ >
116
+ <Numeric.SingleRange
117
+ showNumberInput={true}
118
+ numberInputClassName="w-10 text-center"
119
+ />
120
+ </Numeric.Container>
121
+ </div>
122
+ </div>
123
+
124
+ <div className="my-2 flex items-center">
125
+ <Label className="text-muted-foreground w-14 flex-none whitespace-nowrap text-xs">
126
+ {t('Border')}
127
+ </Label>
128
+ <div
129
+ className="mx-1 flex-1"
130
+ data-cy={`segmentation-config-border${dataCyTypeSuffix}`}
131
+ >
132
+ <Numeric.Container
133
+ mode="singleRange"
134
+ min={0}
135
+ max={10}
136
+ step={1}
137
+ value={outlineWidth}
138
+ onChange={value =>
139
+ setOutlineWidth(
140
+ { type: segmentationRepresentationTypes?.[0] },
141
+ Math.round(value as number)
142
+ )
143
+ }
144
+ >
145
+ <Numeric.SingleRange
146
+ showNumberInput={true}
147
+ numberInputClassName="w-10 text-center"
148
+ />
149
+ </Numeric.Container>
150
+ </div>
151
+ </div>
152
+ </div>
153
+
154
+ <div className="border-input w-full border"></div>
155
+
156
+ <div className="my-2 flex items-center pl-1">
157
+ <Switch
158
+ checked={renderInactiveSegmentations}
159
+ onCheckedChange={toggleRenderInactiveSegmentations}
160
+ data-cy={`segmentation-config-render-inactive${dataCyTypeSuffix}`}
161
+ />
162
+ <Label className="text-muted-foreground mx-2 text-xs">
163
+ {t('Display inactive segmentations')}
164
+ </Label>
165
+ </div>
166
+ {renderInactiveSegmentations && (
167
+ <div className="my-2 flex items-center">
168
+ <Label className="text-muted-foreground w-14 flex-none whitespace-nowrap text-xs">
169
+ {t('Opacity')}
170
+ </Label>
171
+ <div
172
+ className="mx-1 flex-1"
173
+ data-cy={`segmentation-config-opacity-inactive${dataCyTypeSuffix}`}
174
+ >
175
+ <Numeric.Container
176
+ mode="singleRange"
177
+ min={0}
178
+ max={1}
179
+ step={0.1}
180
+ value={fillAlphaInactive}
181
+ onChange={value => setFillAlphaInactive({}, value as number)}
182
+ >
183
+ <Numeric.SingleRange
184
+ showNumberInput={true}
185
+ numberInputClassName="w-10 text-center"
186
+ />
187
+ </Numeric.Container>
188
+ </div>
189
+ </div>
190
+ )}
191
+ {children}
192
+ </div>
193
+ );
194
+ };
@@ -0,0 +1,45 @@
1
+ import React, { createContext, useContext } from 'react';
2
+
3
+ interface SegmentStatisticsContextType {
4
+ segment: {
5
+ segmentIndex: number;
6
+ cachedStats: any;
7
+ };
8
+ namedStats: Record<string, any> | undefined;
9
+ segmentationId: string;
10
+ }
11
+
12
+ // Create a named context
13
+ const SegmentStatisticsContext = createContext<SegmentStatisticsContextType | undefined>(undefined);
14
+ SegmentStatisticsContext.displayName = 'SegmentStatisticsContext';
15
+
16
+ export const useSegmentStatistics = (componentName?: string) => {
17
+ const context = useContext(SegmentStatisticsContext);
18
+
19
+ if (context === undefined) {
20
+ throw new Error(
21
+ `useSegmentStatistics must be used within a SegmentStatisticsProvider` +
22
+ (componentName ? ` (called from ${componentName})` : '')
23
+ );
24
+ }
25
+
26
+ return context;
27
+ };
28
+
29
+ export const SegmentStatisticsProvider: React.FC<{
30
+ segment: {
31
+ segmentIndex: number;
32
+ cachedStats: any;
33
+ };
34
+ segmentationId: string;
35
+ children: React.ReactNode;
36
+ }> = ({ segment, segmentationId, children }) => {
37
+ const { cachedStats } = segment || {};
38
+ const { namedStats } = cachedStats || {};
39
+
40
+ return (
41
+ <SegmentStatisticsContext.Provider value={{ segment, namedStats, segmentationId }}>
42
+ {children}
43
+ </SegmentStatisticsContext.Provider>
44
+ );
45
+ };
@@ -0,0 +1,45 @@
1
+ import React, { createContext, useContext } from 'react';
2
+
3
+ // Context for expanded segmentation panel
4
+ interface SegmentationExpandedContextType {
5
+ segmentation: any;
6
+ representation: any;
7
+ isActive: boolean;
8
+ }
9
+
10
+ // Create a named context
11
+ const SegmentationExpandedContext = createContext<SegmentationExpandedContextType | undefined>(
12
+ undefined
13
+ );
14
+ SegmentationExpandedContext.displayName = 'SegmentationExpandedContext';
15
+
16
+ /**
17
+ * Returns the expanded-segmentation context, or undefined when rendered outside a
18
+ * SegmentationExpandedProvider.
19
+ *
20
+ * Deliberately does not throw. Most consumers render both inside and outside the
21
+ * provider and treat absence as a normal fallback case; when this hook threw,
22
+ * every one of them wrapped it in try/catch, which puts a hook call inside a try
23
+ * block - a rules-of-hooks violation that also makes the React Compiler bail on
24
+ * the whole component. The `| undefined` return type is the guard instead: it
25
+ * makes callers state what they do when the context is absent, at compile time.
26
+ *
27
+ * A consumer that genuinely requires the provider should assert for itself (see
28
+ * SegmentationCollapsedSelector), so the error names the component that has the
29
+ * requirement.
30
+ */
31
+ export const useSegmentationExpanded = (): SegmentationExpandedContextType | undefined =>
32
+ useContext(SegmentationExpandedContext);
33
+
34
+ export const SegmentationExpandedProvider: React.FC<{
35
+ segmentation: any;
36
+ representation: any;
37
+ isActive: boolean;
38
+ children: React.ReactNode;
39
+ }> = ({ segmentation, representation, isActive, children }) => {
40
+ return (
41
+ <SegmentationExpandedContext.Provider value={{ segmentation, representation, isActive }}>
42
+ {children}
43
+ </SegmentationExpandedContext.Provider>
44
+ );
45
+ };