@ohif/ui-next 3.14.0-beta.12 → 3.14.0-beta.121

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 +16 -0
  301. package/src/components/SegmentationTable/index.ts +27 -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 +330 -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,349 @@
1
+ import React, {
2
+ createContext,
3
+ useContext,
4
+ useState,
5
+ useEffect,
6
+ useRef,
7
+ Children,
8
+ isValidElement,
9
+ } from 'react';
10
+ import { SmartScrollbarIndicator } from './SmartScrollbarIndicator';
11
+ import { DEFAULT_INDICATOR_CONFIG } from './defaultSmartScrollbarIndicatorConfig';
12
+
13
+ // ── Child validation ────────────────────────────────────────────
14
+ function validateChildren(children: React.ReactNode): void {
15
+ let hasIndicator = false;
16
+
17
+ Children.forEach(children, child => {
18
+ if (!isValidElement(child)) return;
19
+ if (child.type === SmartScrollbarIndicator) hasIndicator = true;
20
+ });
21
+
22
+ if (!hasIndicator) {
23
+ throw new Error(
24
+ 'SmartScrollbar: <SmartScrollbarIndicator> is a required child. ' +
25
+ 'Users will not see their current scroll position without it.'
26
+ );
27
+ }
28
+ }
29
+
30
+ // ── Layout and timing constants ─────────────────────────────────
31
+ const TRACK_WIDTH = 8;
32
+ const RESTING_WIDTH = 4;
33
+ const FILL_PADDING = 3;
34
+ const SETTLE_DELAY = 600;
35
+
36
+ /** Package-internal type; not re-exported from `@ohif/ui-next` barrels. */
37
+ export interface SmartScrollbarIndicatorConfig {
38
+ totalWidth?: number;
39
+ totalHeight?: number;
40
+ renderIndicator?: (react: typeof React) => React.ReactNode;
41
+ }
42
+
43
+ /**
44
+ * Maps a raw record payload into partial `SmartScrollbarIndicatorConfig`.
45
+ *
46
+ * Supported keys on `raw`:
47
+ * - `totalWidth`, `totalHeight` — positive numbers
48
+ * - `renderIndicator` — `(React) => ReactNode`
49
+ */
50
+ function normalizeIndicatorRecord(
51
+ raw: Record<string, unknown> | null | undefined
52
+ ): SmartScrollbarIndicatorConfig {
53
+ if (raw == null) {
54
+ return {};
55
+ }
56
+ const config: SmartScrollbarIndicatorConfig = {};
57
+ if (typeof raw.totalWidth === 'number' && raw.totalWidth > 0) {
58
+ config.totalWidth = raw.totalWidth;
59
+ }
60
+ if (typeof raw.totalHeight === 'number' && raw.totalHeight > 0) {
61
+ config.totalHeight = raw.totalHeight;
62
+ }
63
+
64
+ if (typeof raw.renderIndicator === 'function') {
65
+ config.renderIndicator = raw.renderIndicator as (react: typeof React) => React.ReactNode;
66
+ }
67
+
68
+ return config;
69
+ }
70
+
71
+ // ── Contexts ───────────────────────────────────────────────────
72
+ export interface SmartScrollbarLayoutContextValue {
73
+ total: number;
74
+ trackHeight: number;
75
+ isLoading: boolean;
76
+ isDragging: boolean;
77
+ effectiveWidth: number;
78
+ trackWidth: number;
79
+ fillPadding: number;
80
+ stableLayerEl: HTMLDivElement | null;
81
+ indicatorTotalWidth: number;
82
+ indicatorTotalHeight: number;
83
+ renderIndicator: (react: typeof React) => React.ReactNode;
84
+ }
85
+
86
+ const SmartScrollbarLayoutContext = createContext<SmartScrollbarLayoutContextValue | null>(null);
87
+ const SmartScrollbarScrollContext = createContext<number | null>(null);
88
+
89
+ export function useSmartScrollbarLayoutContext(): SmartScrollbarLayoutContextValue {
90
+ const ctx = useContext(SmartScrollbarLayoutContext);
91
+ if (!ctx)
92
+ throw new Error('SmartScrollbar compound components must be used inside <SmartScrollbar>');
93
+ return ctx;
94
+ }
95
+
96
+ export function useSmartScrollbarScrollContext(): number {
97
+ const value = useContext(SmartScrollbarScrollContext);
98
+ if (value === null)
99
+ throw new Error('SmartScrollbar compound components must be used inside <SmartScrollbar>');
100
+ return value;
101
+ }
102
+
103
+ // ── Props ──────────────────────────────────────────────────────
104
+ interface SmartScrollbarProps {
105
+ value: number;
106
+ total: number;
107
+ onValueChange: (index: number) => void;
108
+ isLoading?: boolean;
109
+ enableKeyboardNavigation?: boolean;
110
+ 'aria-label'?: string;
111
+ className?: string;
112
+ /**
113
+ * Indicator payload parsed inside the component.
114
+ */
115
+ indicator?: Record<string, unknown>;
116
+ children: React.ReactNode;
117
+ }
118
+
119
+ // ── Component ──────────────────────────────────────────────────
120
+ export function SmartScrollbar({
121
+ value,
122
+ total,
123
+ onValueChange,
124
+ isLoading = false,
125
+ enableKeyboardNavigation = false,
126
+ 'aria-label': ariaLabel = 'Scroll position',
127
+ className,
128
+ indicator,
129
+ children,
130
+ }: SmartScrollbarProps) {
131
+ validateChildren(children);
132
+
133
+ const parsedIndicator = normalizeIndicatorRecord(indicator);
134
+ const resolvedIndicator =
135
+ parsedIndicator.totalWidth && parsedIndicator.totalHeight && parsedIndicator.renderIndicator
136
+ ? {
137
+ totalWidth: parsedIndicator.totalWidth,
138
+ totalHeight: parsedIndicator.totalHeight,
139
+ renderIndicator: parsedIndicator.renderIndicator,
140
+ }
141
+ : DEFAULT_INDICATOR_CONFIG;
142
+
143
+ // ── ResizeObserver for trackHeight ───────────────────────────
144
+ const containerRef = useRef<HTMLDivElement>(null);
145
+ const [trackHeight, setTrackHeight] = useState(0);
146
+
147
+ useEffect(() => {
148
+ const el = containerRef.current;
149
+ if (!el) return;
150
+ const syncTrackHeight = () => {
151
+ const measuredHeight = el.getBoundingClientRect().height;
152
+ setTrackHeight(prev => (prev === measuredHeight ? prev : measuredHeight));
153
+ };
154
+ // Capture an immediate measurement so we don't rely solely on async ResizeObserver delivery.
155
+ syncTrackHeight();
156
+ const ro = new ResizeObserver(([entry]) => {
157
+ setTrackHeight(entry.contentRect.height);
158
+ });
159
+ ro.observe(el);
160
+ return () => ro.disconnect();
161
+ }, []);
162
+
163
+ // ── Contraction state ────────────────────────────────────────
164
+ const [isHovered, setIsHovered] = useState(false);
165
+ const [isDragging, setIsDragging] = useState(false);
166
+ const isDraggingRef = useRef(false);
167
+ const trackTopRef = useRef(0);
168
+
169
+ // Settle delay — only contract after a real loading→done transition
170
+ const [hasSettled, setHasSettled] = useState(false);
171
+ const wasEverLoading = useRef(false);
172
+
173
+ useEffect(() => {
174
+ if (isLoading) {
175
+ wasEverLoading.current = true;
176
+ setHasSettled(false);
177
+ } else if (wasEverLoading.current) {
178
+ const timer = setTimeout(() => setHasSettled(true), SETTLE_DELAY);
179
+ return () => clearTimeout(timer);
180
+ }
181
+ }, [isLoading]);
182
+
183
+ const isExpanded = !hasSettled || isHovered || isDragging;
184
+ const effectiveWidth = isExpanded ? TRACK_WIDTH : RESTING_WIDTH;
185
+
186
+ // ── Hit zone: extend past `TRACK_WIDTH` on both sides when the pill is wider than the track ──
187
+ const hitZoneSideExtension = Math.max(0, resolvedIndicator.totalWidth / 2 - TRACK_WIDTH / 2);
188
+
189
+ // ── Stable layer (for elements that shouldn't move during contraction) ──
190
+ // Uses useState + callback ref so React triggers a re-render when the
191
+ // DOM node mounts — ensuring endpoints render on the first valid pass.
192
+ const [stableLayerEl, setStableLayerEl] = useState<HTMLDivElement | null>(null);
193
+
194
+ // ── Pointer helpers ──────────────────────────────────────────
195
+ const clamp = (val: number) => Math.max(0, Math.min(total - 1, val));
196
+
197
+ const indexFromPointerY = (clientY: number) => {
198
+ if (trackHeight <= 0) {
199
+ return 0;
200
+ }
201
+
202
+ // Map pointer Y within the same padded fill strip used by fill/indicator.
203
+ const fillTop = trackTopRef.current + FILL_PADDING;
204
+ const fillHeight = trackHeight - FILL_PADDING * 2;
205
+ if (fillHeight <= 0) {
206
+ return 0;
207
+ }
208
+ const ratio = Math.max(0, Math.min(1, (clientY - fillTop) / fillHeight));
209
+ return Math.round(ratio * (total - 1));
210
+ };
211
+
212
+ const handlePointerDown = (e: React.PointerEvent) => {
213
+ trackTopRef.current = e.currentTarget.getBoundingClientRect().top;
214
+ if (trackHeight <= 0) {
215
+ return;
216
+ }
217
+
218
+ isDraggingRef.current = true;
219
+ setIsDragging(true);
220
+ e.currentTarget.setPointerCapture(e.pointerId);
221
+
222
+ onValueChange(clamp(indexFromPointerY(e.clientY)));
223
+ };
224
+
225
+ const handlePointerMove = (e: React.PointerEvent) => {
226
+ if (!isDraggingRef.current) return;
227
+ onValueChange(clamp(indexFromPointerY(e.clientY)));
228
+ };
229
+
230
+ const handlePointerUp = (e: React.PointerEvent) => {
231
+ isDraggingRef.current = false;
232
+ setIsDragging(false);
233
+ e.currentTarget.releasePointerCapture(e.pointerId);
234
+ };
235
+
236
+ // ── Keyboard interaction (WAI-ARIA slider spec) ────────────
237
+ const PAGE_STEP = 10;
238
+
239
+ const handleKeyDown = (e: React.KeyboardEvent) => {
240
+ let next: number | null = null;
241
+
242
+ switch (e.key) {
243
+ case 'ArrowUp':
244
+ case 'ArrowLeft':
245
+ next = value - 1;
246
+ break;
247
+ case 'ArrowDown':
248
+ case 'ArrowRight':
249
+ next = value + 1;
250
+ break;
251
+ case 'PageUp':
252
+ next = value - PAGE_STEP;
253
+ break;
254
+ case 'PageDown':
255
+ next = value + PAGE_STEP;
256
+ break;
257
+ case 'Home':
258
+ next = 0;
259
+ break;
260
+ case 'End':
261
+ next = total - 1;
262
+ break;
263
+ default:
264
+ return;
265
+ }
266
+
267
+ e.preventDefault();
268
+ onValueChange(clamp(next));
269
+ };
270
+
271
+ // ── Context values ───────────────────────────────────────────
272
+ const layoutCtx: SmartScrollbarLayoutContextValue = {
273
+ total,
274
+ trackHeight,
275
+ isLoading,
276
+ isDragging,
277
+ effectiveWidth,
278
+ trackWidth: TRACK_WIDTH,
279
+ fillPadding: FILL_PADDING,
280
+ stableLayerEl,
281
+ indicatorTotalWidth: resolvedIndicator.totalWidth,
282
+ indicatorTotalHeight: resolvedIndicator.totalHeight,
283
+ renderIndicator: resolvedIndicator.renderIndicator,
284
+ };
285
+ return (
286
+ <SmartScrollbarLayoutContext.Provider value={layoutCtx}>
287
+ <SmartScrollbarScrollContext.Provider value={value}>
288
+ <div
289
+ ref={containerRef}
290
+ role="slider"
291
+ aria-valuenow={value}
292
+ aria-valuemin={0}
293
+ aria-valuemax={total - 1}
294
+ aria-orientation="vertical"
295
+ aria-label={ariaLabel}
296
+ tabIndex={0}
297
+ className={className}
298
+ style={{
299
+ width: TRACK_WIDTH + hitZoneSideExtension * 2,
300
+ height: '100%',
301
+ position: 'relative',
302
+ marginLeft: -hitZoneSideExtension,
303
+ cursor: isDragging ? 'grabbing' : 'grab',
304
+ touchAction: 'none',
305
+ }}
306
+ onPointerEnter={() => setIsHovered(true)}
307
+ onPointerLeave={() => setIsHovered(false)}
308
+ onPointerDown={handlePointerDown}
309
+ onPointerMove={handlePointerMove}
310
+ onPointerUp={handlePointerUp}
311
+ onPointerCancel={handlePointerUp}
312
+ onKeyDown={enableKeyboardNavigation ? handleKeyDown : undefined}
313
+ >
314
+ {trackHeight > 0 && (
315
+ <div
316
+ style={{
317
+ position: 'absolute',
318
+ right: hitZoneSideExtension,
319
+ top: 0,
320
+ width: TRACK_WIDTH,
321
+ height: trackHeight,
322
+ display: 'flex',
323
+ justifyContent: 'center',
324
+ }}
325
+ >
326
+ <div
327
+ className="relative"
328
+ style={{
329
+ width: effectiveWidth,
330
+ height: trackHeight,
331
+ transition: 'width 300ms ease',
332
+ }}
333
+ >
334
+ {children}
335
+ </div>
336
+ {/* Stable layer — always TRACK_WIDTH, never contracts. For elements like
337
+ endpoints that must not jitter during width transitions. Children
338
+ render here via createPortal using stableLayerRef from context. */}
339
+ <div
340
+ ref={setStableLayerEl}
341
+ style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}
342
+ />
343
+ </div>
344
+ )}
345
+ </div>
346
+ </SmartScrollbarScrollContext.Provider>
347
+ </SmartScrollbarLayoutContext.Provider>
348
+ );
349
+ }
@@ -0,0 +1,82 @@
1
+ import React from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { useSmartScrollbarLayoutContext } from './SmartScrollbar';
4
+ import { computePixelFilledFromMarked } from './utils';
5
+
6
+ // ── Endpoint cap dimensions and color ───────────────────────────
7
+ const CAP_SIZE = 4;
8
+ const CAP_HEIGHT = CAP_SIZE / 2 + 1; // 3
9
+ const CAP_COLOR = 'hsl(var(--neutral) / 1.0)';
10
+
11
+ interface SmartScrollbarEndpointsProps {
12
+ /** Marked positions. MUST change identity whenever its contents change. */
13
+ marked: Uint8Array;
14
+ className?: string;
15
+ }
16
+
17
+ export const SmartScrollbarEndpoints = React.memo(function SmartScrollbarEndpoints({
18
+ marked,
19
+ className,
20
+ }: SmartScrollbarEndpointsProps) {
21
+ const { trackHeight, trackWidth, fillPadding, stableLayerEl } =
22
+ useSmartScrollbarLayoutContext();
23
+
24
+ const fillAreaTop = fillPadding;
25
+ const pixelCount = Math.max(0, Math.floor(trackHeight - fillPadding * 2));
26
+ if (pixelCount === 0) return null;
27
+ const pixelFilled = computePixelFilledFromMarked(marked, pixelCount);
28
+
29
+ // Scan for the first and last filled pixel row in O(n) so endpoints align
30
+ // exactly with the fill rendering in pixel space.
31
+ let firstFilledPixel = -1;
32
+ let lastFilledPixel = -1;
33
+ for (let pixel = 0; pixel < pixelFilled.length; pixel++) {
34
+ if (pixelFilled[pixel]) {
35
+ firstFilledPixel = pixel;
36
+ break;
37
+ }
38
+ }
39
+ for (let pixel = pixelFilled.length - 1; pixel >= 0; pixel--) {
40
+ if (pixelFilled[pixel]) {
41
+ lastFilledPixel = pixel;
42
+ break;
43
+ }
44
+ }
45
+
46
+ if (firstFilledPixel === -1 || trackHeight === 0 || !stableLayerEl) return null;
47
+
48
+ // Use trackWidth (always 8px) not effectiveWidth — endpoints must stay
49
+ // stationary during contraction/expansion transitions.
50
+ const cx = trackWidth / 2;
51
+ const halfCap = CAP_SIZE / 2;
52
+ const topEdge = fillAreaTop + firstFilledPixel;
53
+ const bottomEdge = fillAreaTop + (lastFilledPixel + 1);
54
+
55
+ // Portal into the stable layer so position isn't affected by the
56
+ // contracting track div's width transition.
57
+ return createPortal(
58
+ <svg
59
+ width={trackWidth}
60
+ height={trackHeight}
61
+ className={`pointer-events-none absolute inset-0 ${className ?? ''}`}
62
+ >
63
+ {/* Top cap */}
64
+ <rect
65
+ x={cx - halfCap}
66
+ y={topEdge - CAP_HEIGHT}
67
+ width={CAP_SIZE}
68
+ height={CAP_HEIGHT}
69
+ fill={CAP_COLOR}
70
+ />
71
+ {/* Bottom cap */}
72
+ <rect
73
+ x={cx - halfCap}
74
+ y={bottomEdge}
75
+ width={CAP_SIZE}
76
+ height={CAP_HEIGHT}
77
+ fill={CAP_COLOR}
78
+ />
79
+ </svg>,
80
+ stableLayerEl
81
+ );
82
+ });
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { useSmartScrollbarLayoutContext } from './SmartScrollbar';
3
+ import { computeContiguousRuns, computePixelFilledFromMarked } from './utils';
4
+
5
+ interface SmartScrollbarFillProps {
6
+ /** Marked positions. MUST change identity whenever its contents change. */
7
+ marked: Uint8Array;
8
+ /** Fill color class. Defaults to `'bg-neutral/25'`. Override to customize (e.g. `'bg-primary/35'` for a viewed fill). */
9
+ className?: string;
10
+ /** Fill color class used while the scrollbar is in a loading state. Defaults to `'bg-neutral/50'`. */
11
+ loadingClassName?: string;
12
+ }
13
+
14
+ export const SmartScrollbarFill = React.memo(function SmartScrollbarFill({
15
+ marked,
16
+ className = 'bg-neutral/25',
17
+ loadingClassName = 'bg-neutral/50',
18
+ }: SmartScrollbarFillProps) {
19
+ const { trackHeight, effectiveWidth, fillPadding, isLoading } = useSmartScrollbarLayoutContext();
20
+
21
+ // Render fill in pixel space so the fill never overstates coverage when
22
+ // many indices map into a single pixel row (subpixel heights).
23
+ const pixelCount = Math.max(0, Math.floor(trackHeight - fillPadding * 2));
24
+ const pixelFilled = computePixelFilledFromMarked(marked, pixelCount);
25
+ const runs = computeContiguousRuns(pixelFilled);
26
+
27
+ if (runs.length === 0 || trackHeight === 0) return null;
28
+
29
+ const fillAreaTop = fillPadding;
30
+ const activeClass = isLoading && loadingClassName ? loadingClassName : className;
31
+
32
+ return (
33
+ <>
34
+ {runs.map((run, index) => {
35
+ const top = fillAreaTop + run.start;
36
+ const height = run.length;
37
+
38
+ return (
39
+ <div
40
+ key={index}
41
+ className={`absolute ${activeClass ?? ''}`}
42
+ style={{
43
+ left: 0,
44
+ top,
45
+ width: effectiveWidth,
46
+ height,
47
+ transition: 'width 300ms ease, left 300ms ease',
48
+ }}
49
+ />
50
+ );
51
+ })}
52
+ </>
53
+ );
54
+ });
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { useSmartScrollbarLayoutContext, useSmartScrollbarScrollContext } from './SmartScrollbar';
3
+ import { computeIndicatorTopOffsetInFill } from './utils';
4
+
5
+ interface SmartScrollbarIndicatorProps {
6
+ className?: string;
7
+ }
8
+
9
+ export function SmartScrollbarIndicator({ className }: SmartScrollbarIndicatorProps) {
10
+ const {
11
+ total,
12
+ trackHeight,
13
+ effectiveWidth,
14
+ fillPadding,
15
+ indicatorTotalWidth,
16
+ indicatorTotalHeight,
17
+ renderIndicator,
18
+ } = useSmartScrollbarLayoutContext();
19
+
20
+ const value = useSmartScrollbarScrollContext();
21
+
22
+ if (trackHeight === 0 || total <= 1) {
23
+ return null;
24
+ }
25
+
26
+ // Horizontal: center on the contracting inner width (not the full physical track).
27
+ const leftPos = effectiveWidth / 2 - indicatorTotalWidth / 2;
28
+
29
+ const fillAreaTop = fillPadding;
30
+ // Vertical: same fill strip as SmartScrollbarFill — full track height minus padding.
31
+ const pixelCount = Math.max(0, Math.floor(trackHeight - fillPadding * 2));
32
+ if (pixelCount === 0) {
33
+ return null;
34
+ }
35
+
36
+ const clampedValue = Math.max(0, Math.min(total - 1, value));
37
+ const topOffsetInFill = computeIndicatorTopOffsetInFill(
38
+ clampedValue,
39
+ total,
40
+ pixelCount,
41
+ indicatorTotalHeight
42
+ );
43
+ const topPos = fillAreaTop + topOffsetInFill;
44
+
45
+ return (
46
+ <div
47
+ className={`pointer-events-none absolute ${className ?? ''}`}
48
+ style={{
49
+ left: leftPos,
50
+ top: topPos,
51
+ width: indicatorTotalWidth,
52
+ height: indicatorTotalHeight,
53
+ transition: 'left 300ms ease, opacity 300ms ease',
54
+ }}
55
+ >
56
+ {renderIndicator(React)}
57
+ </div>
58
+ );
59
+ }
@@ -0,0 +1,104 @@
1
+ import React, { useId, useState, useEffect } from 'react';
2
+ import { useSmartScrollbarLayoutContext } from './SmartScrollbar';
3
+
4
+ // ── Dot-grid pattern constants ──────────────────────────────────
5
+ const DOT_SIZE = 2;
6
+ const DOT_GAP = 4;
7
+ const DOT_STEP = DOT_SIZE + DOT_GAP; // 6px
8
+ const DOT_RADIUS = DOT_SIZE / 2;
9
+ const FADE_DURATION_MS = 500;
10
+
11
+ interface SmartScrollbarTrackProps {
12
+ className?: string;
13
+ children?: React.ReactNode;
14
+ }
15
+
16
+ function DotGrid({ w, h, patternId }: { w: number; h: number; patternId: string }) {
17
+ const dotColor = `hsl(var(--neutral) / 0.5)`;
18
+ return (
19
+ <svg
20
+ width={w}
21
+ height={h}
22
+ className="absolute inset-0"
23
+ >
24
+ <defs>
25
+ <pattern
26
+ id={patternId}
27
+ width={DOT_STEP}
28
+ height={DOT_STEP}
29
+ patternUnits="userSpaceOnUse"
30
+ >
31
+ <circle
32
+ cx={DOT_RADIUS}
33
+ cy={DOT_RADIUS}
34
+ r={DOT_RADIUS}
35
+ fill={dotColor}
36
+ />
37
+ </pattern>
38
+ <clipPath id={`${patternId}-clip`}>
39
+ <rect
40
+ x={0}
41
+ y={0}
42
+ width={w}
43
+ height={h}
44
+ />
45
+ </clipPath>
46
+ </defs>
47
+ <rect
48
+ x={0}
49
+ y={0}
50
+ width={w}
51
+ height={h}
52
+ fill={`url(#${patternId})`}
53
+ clipPath={`url(#${patternId}-clip)`}
54
+ />
55
+ </svg>
56
+ );
57
+ }
58
+
59
+ export const SmartScrollbarTrack = React.memo(function SmartScrollbarTrack({
60
+ className,
61
+ children,
62
+ }: SmartScrollbarTrackProps) {
63
+ const { trackHeight, effectiveWidth, isLoading } = useSmartScrollbarLayoutContext();
64
+ const patternId = useId();
65
+
66
+ // Keep the dot grid mounted long enough to fade out, then unmount entirely.
67
+ const [dotGridMounted, setDotGridMounted] = useState(isLoading);
68
+ useEffect(() => {
69
+ if (isLoading) {
70
+ setDotGridMounted(true);
71
+ return;
72
+ }
73
+ const t = setTimeout(() => setDotGridMounted(false), FADE_DURATION_MS);
74
+ return () => clearTimeout(t);
75
+ }, [isLoading]);
76
+
77
+ if (trackHeight === 0) return null;
78
+
79
+ const w = effectiveWidth;
80
+ const h = trackHeight;
81
+
82
+ return (
83
+ <div className={`absolute inset-0 ${className ?? ''}`}>
84
+ {dotGridMounted && (
85
+ <div
86
+ className="absolute inset-0"
87
+ style={{
88
+ width: w,
89
+ height: h,
90
+ opacity: isLoading ? 1 : 0,
91
+ transition: `opacity ${FADE_DURATION_MS}ms ease`,
92
+ }}
93
+ >
94
+ <DotGrid
95
+ w={w}
96
+ h={h}
97
+ patternId={patternId}
98
+ />
99
+ </div>
100
+ )}
101
+ {children}
102
+ </div>
103
+ );
104
+ });
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { type SmartScrollbarIndicatorConfig } from './SmartScrollbar';
3
+
4
+ /** Ring inset for the default pill SVG (outer size is indicator total width × height). */
5
+ const BORDER_WIDTH = 1;
6
+
7
+ const INDICATOR_COLOR = 'hsl(var(--foreground) / 0.9)';
8
+ const BORDER_COLOR = 'hsl(var(--neutral) / 0.9)';
9
+ const TOTAL_WIDTH = 12;
10
+ const TOTAL_HEIGHT = 7;
11
+
12
+ function DefaultIndicator() {
13
+ const borderWidth = BORDER_WIDTH;
14
+ const fillWidth = Math.max(0, TOTAL_WIDTH - borderWidth * 2);
15
+ const fillHeight = Math.max(0, TOTAL_HEIGHT - borderWidth * 2);
16
+ return (
17
+ <svg
18
+ width={TOTAL_WIDTH}
19
+ height={TOTAL_HEIGHT}
20
+ viewBox={`0 0 ${TOTAL_WIDTH} ${TOTAL_HEIGHT}`}
21
+ >
22
+ <rect
23
+ x={0}
24
+ y={0}
25
+ width={TOTAL_WIDTH}
26
+ height={TOTAL_HEIGHT}
27
+ rx={TOTAL_HEIGHT / 2}
28
+ ry={TOTAL_HEIGHT / 2}
29
+ fill={BORDER_COLOR}
30
+ />
31
+ <rect
32
+ x={borderWidth}
33
+ y={borderWidth}
34
+ width={fillWidth}
35
+ height={fillHeight}
36
+ rx={fillHeight / 2}
37
+ ry={fillHeight / 2}
38
+ fill={INDICATOR_COLOR}
39
+ />
40
+ </svg>
41
+ );
42
+ }
43
+
44
+ export const DEFAULT_INDICATOR_CONFIG: SmartScrollbarIndicatorConfig = {
45
+ totalWidth: TOTAL_WIDTH,
46
+ totalHeight: TOTAL_HEIGHT,
47
+ renderIndicator: (_react: typeof React) => <DefaultIndicator />,
48
+ };