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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/dist/ohif-ui-next.css +6 -6
  2. package/dist/ohif-ui-next.umd.js +4 -1838
  3. package/package.json +31 -14
  4. package/src/__mocks__/fileMock.js +7 -0
  5. package/src/assets/fonts.css +50 -0
  6. package/src/assets/styles.css +55 -0
  7. package/src/assets/woff2/latin.woff2 +0 -0
  8. package/src/components/Accordion/Accordion.tsx +70 -0
  9. package/src/components/Accordion/index.ts +3 -0
  10. package/src/components/AllInOneMenu/BackItem.tsx +32 -0
  11. package/src/components/AllInOneMenu/DividerItem.tsx +11 -0
  12. package/src/components/AllInOneMenu/HeaderItem.tsx +15 -0
  13. package/src/components/AllInOneMenu/IconMenu.tsx +83 -0
  14. package/src/components/AllInOneMenu/Item.tsx +51 -0
  15. package/src/components/AllInOneMenu/ItemPanel.tsx +38 -0
  16. package/src/components/AllInOneMenu/Menu.tsx +231 -0
  17. package/src/components/AllInOneMenu/PanelSelector.tsx +32 -0
  18. package/src/components/AllInOneMenu/SubMenu.tsx +36 -0
  19. package/src/components/AllInOneMenu/index.ts +42 -0
  20. package/src/components/BackgroundColorSelect/BackgroundColorSelect.tsx +38 -0
  21. package/src/components/BackgroundColorSelect/index.tsx +1 -0
  22. package/src/components/Badge/Badge.tsx +38 -0
  23. package/src/components/Badge/index.ts +1 -0
  24. package/src/components/Button/Button.tsx +65 -0
  25. package/src/components/Button/index.ts +1 -0
  26. package/src/components/Calendar/Calendar.tsx +258 -0
  27. package/src/components/Calendar/index.tsx +3 -0
  28. package/src/components/Card/Card.tsx +83 -0
  29. package/src/components/Card/index.ts +2 -0
  30. package/src/components/Checkbox/Checkbox.tsx +27 -0
  31. package/src/components/Checkbox/index.tsx +3 -0
  32. package/src/components/CinePlayer/CinePlayer.tsx +187 -0
  33. package/src/components/CinePlayer/index.ts +5 -0
  34. package/src/components/Clipboard/Clipboard.tsx +58 -0
  35. package/src/components/Clipboard/index.tsx +3 -0
  36. package/src/components/ColorCircle.tsx +12 -0
  37. package/src/components/Combobox/Combobox.tsx +66 -0
  38. package/src/components/Combobox/index.ts +3 -0
  39. package/src/components/Command/Command.tsx +149 -0
  40. package/src/components/Command/index.ts +23 -0
  41. package/src/components/ContextMenu/ContextMenu.tsx +202 -0
  42. package/src/components/ContextMenu/index.ts +35 -0
  43. package/src/components/ContextMenuViewport/ContextMenuViewport.tsx +47 -0
  44. package/src/components/ContextMenuViewport/index.ts +1 -0
  45. package/src/components/DataRow/DataRow.tsx +532 -0
  46. package/src/components/DataRow/index.ts +1 -0
  47. package/src/components/DataRow/types.ts +31 -0
  48. package/src/components/DataTable/ActionOverlayCell.tsx +153 -0
  49. package/src/components/DataTable/ColumnHeader.tsx +70 -0
  50. package/src/components/DataTable/DataTable.tsx +532 -0
  51. package/src/components/DataTable/FilterRow.tsx +52 -0
  52. package/src/components/DataTable/Pagination.tsx +78 -0
  53. package/src/components/DataTable/Title.tsx +5 -0
  54. package/src/components/DataTable/Toolbar.tsx +5 -0
  55. package/src/components/DataTable/ViewOptions.tsx +86 -0
  56. package/src/components/DataTable/context.tsx +21 -0
  57. package/src/components/DataTable/index.ts +5 -0
  58. package/src/components/DataTable/types.ts +27 -0
  59. package/src/components/DataTable/useResponsiveColumns.tsx +346 -0
  60. package/src/components/DateRange/DateRange.tsx +163 -0
  61. package/src/components/DateRange/index.ts +3 -0
  62. package/src/components/Dialog/Dialog.tsx +201 -0
  63. package/src/components/Dialog/index.ts +25 -0
  64. package/src/components/Dialog/useDraggable.ts +108 -0
  65. package/src/components/DisplaySetMessageListTooltip/DisplaySetMessageListTooltip.tsx +64 -0
  66. package/src/components/DisplaySetMessageListTooltip/index.ts +3 -0
  67. package/src/components/DoubleSlider/DoubleSlider.test.ts +232 -0
  68. package/src/components/DoubleSlider/DoubleSlider.tsx +211 -0
  69. package/src/components/DoubleSlider/index.tsx +3 -0
  70. package/src/components/DropdownMenu/DropdownMenu.tsx +213 -0
  71. package/src/components/DropdownMenu/index.ts +35 -0
  72. package/src/components/Errorboundary/ErrorBoundary.tsx +345 -0
  73. package/src/components/Errorboundary/index.tsx +3 -0
  74. package/src/components/FooterAction/FooterAction.tsx +115 -0
  75. package/src/components/FooterAction/index.tsx +3 -0
  76. package/src/components/Header/Header.tsx +140 -0
  77. package/src/components/Header/index.js +2 -0
  78. package/src/components/HoverCard/HoverCard.tsx +30 -0
  79. package/src/components/HoverCard/index.ts +1 -0
  80. package/src/components/Icons/Icons.tsx +852 -0
  81. package/src/components/Icons/Sources/ActionNewDialog.tsx +64 -0
  82. package/src/components/Icons/Sources/Actions.tsx +47 -0
  83. package/src/components/Icons/Sources/Add.tsx +51 -0
  84. package/src/components/Icons/Sources/Alert.tsx +32 -0
  85. package/src/components/Icons/Sources/AlertOutline.tsx +30 -0
  86. package/src/components/Icons/Sources/ArrowLeftBold.tsx +49 -0
  87. package/src/components/Icons/Sources/ArrowRight.tsx +25 -0
  88. package/src/components/Icons/Sources/Cancel.tsx +37 -0
  89. package/src/components/Icons/Sources/CheckBoxChecked.tsx +39 -0
  90. package/src/components/Icons/Sources/CheckBoxUnChecked.tsx +25 -0
  91. package/src/components/Icons/Sources/Checked.tsx +23 -0
  92. package/src/components/Icons/Sources/ChevronClosed.tsx +40 -0
  93. package/src/components/Icons/Sources/ChevronLeft.tsx +28 -0
  94. package/src/components/Icons/Sources/ChevronOpen.tsx +38 -0
  95. package/src/components/Icons/Sources/Clear.tsx +34 -0
  96. package/src/components/Icons/Sources/Clipboard.tsx +15 -0
  97. package/src/components/Icons/Sources/Close.tsx +28 -0
  98. package/src/components/Icons/Sources/CloudSettings.tsx +34 -0
  99. package/src/components/Icons/Sources/Code.tsx +7 -0
  100. package/src/components/Icons/Sources/ColorChange.tsx +100 -0
  101. package/src/components/Icons/Sources/ContentNext.tsx +35 -0
  102. package/src/components/Icons/Sources/ContentPrev.tsx +35 -0
  103. package/src/components/Icons/Sources/Controls.tsx +99 -0
  104. package/src/components/Icons/Sources/Copy.tsx +44 -0
  105. package/src/components/Icons/Sources/Database.tsx +33 -0
  106. package/src/components/Icons/Sources/Delete.tsx +58 -0
  107. package/src/components/Icons/Sources/DicomTagBrowser.tsx +79 -0
  108. package/src/components/Icons/Sources/DisplayFillAndOutline.tsx +49 -0
  109. package/src/components/Icons/Sources/DisplayFillOnly.tsx +40 -0
  110. package/src/components/Icons/Sources/DisplayOutlineOnly.tsx +40 -0
  111. package/src/components/Icons/Sources/Download.tsx +75 -0
  112. package/src/components/Icons/Sources/Export.tsx +53 -0
  113. package/src/components/Icons/Sources/ExternalLink.tsx +26 -0
  114. package/src/components/Icons/Sources/EyeHidden.tsx +32 -0
  115. package/src/components/Icons/Sources/EyeVisible.tsx +28 -0
  116. package/src/components/Icons/Sources/FeedbackComplete.tsx +35 -0
  117. package/src/components/Icons/Sources/GearSettings.tsx +59 -0
  118. package/src/components/Icons/Sources/GroupLayers.tsx +33 -0
  119. package/src/components/Icons/Sources/Helpers.tsx +398 -0
  120. package/src/components/Icons/Sources/Hide.tsx +45 -0
  121. package/src/components/Icons/Sources/IconColorLUT.tsx +103 -0
  122. package/src/components/Icons/Sources/IconMPR.tsx +55 -0
  123. package/src/components/Icons/Sources/IconTransferring.tsx +25 -0
  124. package/src/components/Icons/Sources/IllustrationNotFound.tsx +102 -0
  125. package/src/components/Icons/Sources/Info.tsx +55 -0
  126. package/src/components/Icons/Sources/InfoLink.tsx +23 -0
  127. package/src/components/Icons/Sources/InfoSeries.tsx +52 -0
  128. package/src/components/Icons/Sources/InvestigationalUse.tsx +82 -0
  129. package/src/components/Icons/Sources/JumpToSlice.tsx +69 -0
  130. package/src/components/Icons/Sources/LaunchArrow.tsx +34 -0
  131. package/src/components/Icons/Sources/LaunchInfo.tsx +38 -0
  132. package/src/components/Icons/Sources/LayerBackground.tsx +28 -0
  133. package/src/components/Icons/Sources/LayerForeground.tsx +34 -0
  134. package/src/components/Icons/Sources/LayerSegmentation.tsx +20 -0
  135. package/src/components/Icons/Sources/Layout.tsx +433 -0
  136. package/src/components/Icons/Sources/Link.tsx +58 -0
  137. package/src/components/Icons/Sources/ListView.tsx +79 -0
  138. package/src/components/Icons/Sources/LoadingOHIFMark.tsx +21 -0
  139. package/src/components/Icons/Sources/LoadingSpinner.tsx +49 -0
  140. package/src/components/Icons/Sources/Lock.tsx +35 -0
  141. package/src/components/Icons/Sources/Magnifier.tsx +37 -0
  142. package/src/components/Icons/Sources/Minus.tsx +40 -0
  143. package/src/components/Icons/Sources/MissingIcon.tsx +6 -0
  144. package/src/components/Icons/Sources/More.tsx +53 -0
  145. package/src/components/Icons/Sources/MultiplePatients.tsx +76 -0
  146. package/src/components/Icons/Sources/NavigationPanelReveal.tsx +25 -0
  147. package/src/components/Icons/Sources/NotificationInfo.tsx +33 -0
  148. package/src/components/Icons/Sources/NotificationWarning.tsx +44 -0
  149. package/src/components/Icons/Sources/OHIFLogo.tsx +72 -0
  150. package/src/components/Icons/Sources/OHIFLogoColorDarkBackground.tsx +78 -0
  151. package/src/components/Icons/Sources/OHIFLogoHorizontal.tsx +139 -0
  152. package/src/components/Icons/Sources/Opacity.tsx +106 -0
  153. package/src/components/Icons/Sources/OrientationSwitch.tsx +41 -0
  154. package/src/components/Icons/Sources/OrientationSwitchA.tsx +41 -0
  155. package/src/components/Icons/Sources/OrientationSwitchC.tsx +41 -0
  156. package/src/components/Icons/Sources/OrientationSwitchR.tsx +41 -0
  157. package/src/components/Icons/Sources/OrientationSwitchS.tsx +41 -0
  158. package/src/components/Icons/Sources/PanelRight.tsx +29 -0
  159. package/src/components/Icons/Sources/Patient.tsx +58 -0
  160. package/src/components/Icons/Sources/PatientStudyList.tsx +62 -0
  161. package/src/components/Icons/Sources/Pause.tsx +26 -0
  162. package/src/components/Icons/Sources/Pencil.tsx +16 -0
  163. package/src/components/Icons/Sources/Pin.tsx +50 -0
  164. package/src/components/Icons/Sources/PinFill.tsx +51 -0
  165. package/src/components/Icons/Sources/Play.tsx +25 -0
  166. package/src/components/Icons/Sources/Plus.tsx +29 -0
  167. package/src/components/Icons/Sources/PowerOff.tsx +19 -0
  168. package/src/components/Icons/Sources/Redo.tsx +51 -0
  169. package/src/components/Icons/Sources/Refresh.tsx +42 -0
  170. package/src/components/Icons/Sources/Rename.tsx +50 -0
  171. package/src/components/Icons/Sources/Search.tsx +35 -0
  172. package/src/components/Icons/Sources/SegActions.tsx +594 -0
  173. package/src/components/Icons/Sources/Series.tsx +47 -0
  174. package/src/components/Icons/Sources/SeriesPlaceholder.tsx +40 -0
  175. package/src/components/Icons/Sources/Settings.tsx +105 -0
  176. package/src/components/Icons/Sources/SettingsStudyList.tsx +28 -0
  177. package/src/components/Icons/Sources/Show.tsx +67 -0
  178. package/src/components/Icons/Sources/SidePanelCloseLeft.tsx +75 -0
  179. package/src/components/Icons/Sources/SidePanelCloseRight.tsx +74 -0
  180. package/src/components/Icons/Sources/SocialGithub.tsx +39 -0
  181. package/src/components/Icons/Sources/Sorting.tsx +39 -0
  182. package/src/components/Icons/Sources/SortingAscending.tsx +28 -0
  183. package/src/components/Icons/Sources/SortingDescending.tsx +26 -0
  184. package/src/components/Icons/Sources/SortingNew.tsx +20 -0
  185. package/src/components/Icons/Sources/SortingNewAscending.tsx +35 -0
  186. package/src/components/Icons/Sources/SortingNewDescending.tsx +35 -0
  187. package/src/components/Icons/Sources/StatusAlert.tsx +36 -0
  188. package/src/components/Icons/Sources/StatusError.tsx +57 -0
  189. package/src/components/Icons/Sources/StatusLocked.tsx +35 -0
  190. package/src/components/Icons/Sources/StatusSuccess.tsx +45 -0
  191. package/src/components/Icons/Sources/StatusTracking.tsx +37 -0
  192. package/src/components/Icons/Sources/StatusUntracked.tsx +30 -0
  193. package/src/components/Icons/Sources/StatusWarning.tsx +58 -0
  194. package/src/components/Icons/Sources/Tab4D.tsx +54 -0
  195. package/src/components/Icons/Sources/TabContours.tsx +63 -0
  196. package/src/components/Icons/Sources/TabLinear.tsx +47 -0
  197. package/src/components/Icons/Sources/TabPatientInfo.tsx +33 -0
  198. package/src/components/Icons/Sources/TabRoiThreshold.tsx +38 -0
  199. package/src/components/Icons/Sources/TabSegmentation.tsx +38 -0
  200. package/src/components/Icons/Sources/TabStudies.tsx +62 -0
  201. package/src/components/Icons/Sources/Threshold.tsx +38 -0
  202. package/src/components/Icons/Sources/ThumbnailView.tsx +67 -0
  203. package/src/components/Icons/Sources/Tools.tsx +3659 -0
  204. package/src/components/Icons/Sources/Trash.tsx +17 -0
  205. package/src/components/Icons/Sources/Undo.tsx +51 -0
  206. package/src/components/Icons/Sources/Upload.tsx +29 -0
  207. package/src/components/Icons/Sources/ViewportViews.tsx +45 -0
  208. package/src/components/Icons/Sources/ViewportWindowLevel.tsx +58 -0
  209. package/src/components/Icons/Sources/WindowLevelAdvanced.tsx +30 -0
  210. package/src/components/Icons/index.ts +4 -0
  211. package/src/components/Icons/types.ts +3 -0
  212. package/src/components/Input/Input.tsx +25 -0
  213. package/src/components/Input/index.tsx +3 -0
  214. package/src/components/InputFilter/InputFilter.tsx +200 -0
  215. package/src/components/InputFilter/index.ts +2 -0
  216. package/src/components/InputMultiSelect/InputMultiSelect.tsx +370 -0
  217. package/src/components/InputMultiSelect/index.ts +1 -0
  218. package/src/components/InputNumber/InputNumber.tsx +439 -0
  219. package/src/components/InputNumber/index.ts +3 -0
  220. package/src/components/InvestigationalUseDialog/InvestigationalUseDialog.tsx +98 -0
  221. package/src/components/InvestigationalUseDialog/index.ts +3 -0
  222. package/src/components/Label/Label.tsx +24 -0
  223. package/src/components/Label/index.tsx +3 -0
  224. package/src/components/Labelling/LabellingFlow.tsx +92 -0
  225. package/src/components/Labelling/index.ts +2 -0
  226. package/src/components/LayoutSelector/LayoutSelector.tsx +345 -0
  227. package/src/components/LayoutSelector/index.ts +4 -0
  228. package/src/components/LineChart/LineChart.css +40 -0
  229. package/src/components/LineChart/LineChart.tsx +101 -0
  230. package/src/components/LineChart/d3LineChart/chart.ts +365 -0
  231. package/src/components/LineChart/d3LineChart/events.ts +149 -0
  232. package/src/components/LineChart/d3LineChart/index.ts +3 -0
  233. package/src/components/LineChart/d3LineChart/lineChart.ts +272 -0
  234. package/src/components/LineChart/index.ts +1 -0
  235. package/src/components/LoadingIndicatorProgress/LoadingIndicatorProgress.tsx +29 -0
  236. package/src/components/LoadingIndicatorProgress/index.ts +2 -0
  237. package/src/components/LoadingIndicatorTotalPercent/LoadingIndicatorTotalPercent.tsx +49 -0
  238. package/src/components/LoadingIndicatorTotalPercent/index.ts +2 -0
  239. package/src/components/MeasurementTable/MeasurementTable.tsx +144 -0
  240. package/src/components/MeasurementTable/index.js +3 -0
  241. package/src/components/Modal/Modal.tsx +44 -0
  242. package/src/components/NavBar/NavBar.tsx +32 -0
  243. package/src/components/NavBar/index.js +2 -0
  244. package/src/components/Numeric/Numeric.test.ts +124 -0
  245. package/src/components/Numeric/Numeric.tsx +576 -0
  246. package/src/components/Numeric/index.ts +3 -0
  247. package/src/components/OHIFDialogs/InputDialog.tsx +287 -0
  248. package/src/components/OHIFDialogs/PresetDialog.tsx +106 -0
  249. package/src/components/OHIFDialogs/index.ts +2 -0
  250. package/src/components/OHIFModals/AboutModal.tsx +114 -0
  251. package/src/components/OHIFModals/AppearanceModal.tsx +38 -0
  252. package/src/components/OHIFModals/ImageModal.tsx +251 -0
  253. package/src/components/OHIFModals/UserPreferencesModal.tsx +229 -0
  254. package/src/components/OHIFModals/index.ts +4 -0
  255. package/src/components/OHIFPanels/WindowLevel.tsx +162 -0
  256. package/src/components/OHIFPanels/WindowLevelHistogram.tsx +237 -0
  257. package/src/components/OHIFPanels/index.ts +3 -0
  258. package/src/components/OHIFPanels/types.ts +41 -0
  259. package/src/components/OHIFToolSettings/RowDoubleRange.tsx +67 -0
  260. package/src/components/OHIFToolSettings/RowInputRange.tsx +65 -0
  261. package/src/components/OHIFToolSettings/RowSegmentedControl.tsx +77 -0
  262. package/src/components/OHIFToolSettings/ToolSettings.tsx +253 -0
  263. package/src/components/OHIFToolSettings/index.ts +1 -0
  264. package/src/components/OHIFToolbox/ToolboxUI.tsx +104 -0
  265. package/src/components/OHIFToolbox/index.ts +1 -0
  266. package/src/components/Onboarding/Onboarding.css +48 -0
  267. package/src/components/Onboarding/Onboarding.tsx +58 -0
  268. package/src/components/Onboarding/index.ts +3 -0
  269. package/src/components/Onboarding/utilities.ts +91 -0
  270. package/src/components/PanelSection/PanelSection.tsx +70 -0
  271. package/src/components/PanelSection/index.ts +2 -0
  272. package/src/components/Popover/Popover.tsx +35 -0
  273. package/src/components/Popover/index.ts +3 -0
  274. package/src/components/ProgressDropdown/ProgressDiscreteBar.tsx +24 -0
  275. package/src/components/ProgressDropdown/ProgressDropdown.tsx +158 -0
  276. package/src/components/ProgressDropdown/ProgressItem.tsx +27 -0
  277. package/src/components/ProgressDropdown/ProgressItemDetail.tsx +89 -0
  278. package/src/components/ProgressDropdown/index.ts +1 -0
  279. package/src/components/ProgressDropdown/types.ts +9 -0
  280. package/src/components/ProgressLoadingBar/ProgressLoadingBar.css +26 -0
  281. package/src/components/ProgressLoadingBar/ProgressLoadingBar.tsx +32 -0
  282. package/src/components/ProgressLoadingBar/index.ts +2 -0
  283. package/src/components/Resizable/Resizable.tsx +43 -0
  284. package/src/components/Resizable/index.ts +3 -0
  285. package/src/components/ScrollArea/ScrollArea.tsx +127 -0
  286. package/src/components/ScrollArea/index.tsx +3 -0
  287. package/src/components/SegmentationTable/AddSegmentRow.tsx +78 -0
  288. package/src/components/SegmentationTable/AddSegmentationRow.tsx +56 -0
  289. package/src/components/SegmentationTable/SegmentStatistics.tsx +104 -0
  290. package/src/components/SegmentationTable/SegmentationCollapsed.tsx +211 -0
  291. package/src/components/SegmentationTable/SegmentationExpanded.tsx +173 -0
  292. package/src/components/SegmentationTable/SegmentationHeader.tsx +58 -0
  293. package/src/components/SegmentationTable/SegmentationLabel.tsx +27 -0
  294. package/src/components/SegmentationTable/SegmentationSegments.tsx +206 -0
  295. package/src/components/SegmentationTable/SegmentationTable.tsx +169 -0
  296. package/src/components/SegmentationTable/SegmentationTableConfig.tsx +194 -0
  297. package/src/components/SegmentationTable/contexts/SegmentStatisticsContext.tsx +45 -0
  298. package/src/components/SegmentationTable/contexts/SegmentationExpandedContext.tsx +45 -0
  299. package/src/components/SegmentationTable/contexts/SegmentationTableContext.tsx +148 -0
  300. package/src/components/SegmentationTable/contexts/index.ts +15 -0
  301. package/src/components/SegmentationTable/index.ts +24 -0
  302. package/src/components/Select/Select.tsx +167 -0
  303. package/src/components/Select/index.tsx +40 -0
  304. package/src/components/Separator/Separator.tsx +32 -0
  305. package/src/components/Separator/index.ts +3 -0
  306. package/src/components/Separator/index.tsx +3 -0
  307. package/src/components/SidePanel/SidePanel.tsx +479 -0
  308. package/src/components/SidePanel/index.ts +2 -0
  309. package/src/components/Slider/Slider.tsx +24 -0
  310. package/src/components/Slider/index.tsx +3 -0
  311. package/src/components/SmartScrollbar/SmartScrollbar.tsx +349 -0
  312. package/src/components/SmartScrollbar/SmartScrollbarEndpoints.tsx +82 -0
  313. package/src/components/SmartScrollbar/SmartScrollbarFill.tsx +54 -0
  314. package/src/components/SmartScrollbar/SmartScrollbarIndicator.tsx +59 -0
  315. package/src/components/SmartScrollbar/SmartScrollbarTrack.tsx +104 -0
  316. package/src/components/SmartScrollbar/defaultSmartScrollbarIndicatorConfig.tsx +48 -0
  317. package/src/components/SmartScrollbar/index.ts +11 -0
  318. package/src/components/SmartScrollbar/useByteArray.ts +146 -0
  319. package/src/components/SmartScrollbar/utils.test.ts +124 -0
  320. package/src/components/SmartScrollbar/utils.ts +168 -0
  321. package/src/components/Sonner/Sonner.tsx +31 -0
  322. package/src/components/Sonner/index.ts +4 -0
  323. package/src/components/StudyBrowser/StudyBrowser.tsx +89 -0
  324. package/src/components/StudyBrowser/index.ts +2 -0
  325. package/src/components/StudyBrowserSort/StudyBrowserSort.tsx +87 -0
  326. package/src/components/StudyBrowserSort/index.ts +3 -0
  327. package/src/components/StudyBrowserViewOptions/StudyBrowserViewOptions.tsx +50 -0
  328. package/src/components/StudyBrowserViewOptions/index.ts +3 -0
  329. package/src/components/StudyItem/StudyItem.tsx +100 -0
  330. package/src/components/StudyItem/index.ts +2 -0
  331. package/src/components/StudyList/columns/defaultColumns.tsx +258 -0
  332. package/src/components/StudyList/components/ActionCell.tsx +19 -0
  333. package/src/components/StudyList/components/Layout.tsx +206 -0
  334. package/src/components/StudyList/components/PreviewContainer.tsx +45 -0
  335. package/src/components/StudyList/components/PreviewContent.tsx +186 -0
  336. package/src/components/StudyList/components/PreviewHeader.tsx +5 -0
  337. package/src/components/StudyList/components/PreviewPatientSummary.tsx +224 -0
  338. package/src/components/StudyList/components/PreviewSeriesList.tsx +64 -0
  339. package/src/components/StudyList/components/PreviewToggleButton.tsx +69 -0
  340. package/src/components/StudyList/components/SettingsPopover.tsx +214 -0
  341. package/src/components/StudyList/components/Table.tsx +247 -0
  342. package/src/components/StudyList/components/WorkflowMenu.tsx +72 -0
  343. package/src/components/StudyList/components/WorkflowsProvider.tsx +169 -0
  344. package/src/components/StudyList/hooks/useDefaultWorkflow.ts +60 -0
  345. package/src/components/StudyList/index.ts +52 -0
  346. package/src/components/StudyList/types/types.ts +42 -0
  347. package/src/components/StudyList/utils/tokenizeModalities.ts +6 -0
  348. package/src/components/StudySummary/StudySummary.tsx +27 -0
  349. package/src/components/StudySummary/index.tsx +3 -0
  350. package/src/components/Switch/Switch.tsx +28 -0
  351. package/src/components/Switch/index.tsx +3 -0
  352. package/src/components/Table/Table.tsx +134 -0
  353. package/src/components/Table/index.ts +11 -0
  354. package/src/components/Tabs/Tabs.tsx +56 -0
  355. package/src/components/Tabs/index.ts +3 -0
  356. package/src/components/Tabs/index.tsx +3 -0
  357. package/src/components/ThemeWrapper/ThemeWrapper.tsx +5 -0
  358. package/src/components/ThemeWrapper/index.ts +1 -0
  359. package/src/components/Thumbnail/Thumbnail.test.ts +71 -0
  360. package/src/components/Thumbnail/Thumbnail.tsx +351 -0
  361. package/src/components/Thumbnail/index.ts +2 -0
  362. package/src/components/ThumbnailList/ThumbnailList.tsx +94 -0
  363. package/src/components/ThumbnailList/index.ts +2 -0
  364. package/src/components/Toggle/Toggle.tsx +45 -0
  365. package/src/components/Toggle/index.ts +3 -0
  366. package/src/components/Toggle/index.tsx +3 -0
  367. package/src/components/ToggleGroup/ToggleGroup.tsx +63 -0
  368. package/src/components/ToggleGroup/index.ts +3 -0
  369. package/src/components/ToolButton/ToolButton.tsx +134 -0
  370. package/src/components/ToolButton/ToolButtonList.tsx +243 -0
  371. package/src/components/ToolButton/index.ts +8 -0
  372. package/src/components/Tooltip/Tooltip.tsx +34 -0
  373. package/src/components/Tooltip/index.ts +3 -0
  374. package/src/components/Viewport/ImageScrollbar.module.css +89 -0
  375. package/src/components/Viewport/ImageScrollbar.tsx +71 -0
  376. package/src/components/Viewport/PatientInfo.tsx +126 -0
  377. package/src/components/Viewport/ViewportActionArrows.tsx +36 -0
  378. package/src/components/Viewport/ViewportActionBar.tsx +107 -0
  379. package/src/components/Viewport/ViewportActionButton.tsx +25 -0
  380. package/src/components/Viewport/ViewportActionCorners.tsx +171 -0
  381. package/src/components/Viewport/ViewportGrid.tsx +24 -0
  382. package/src/components/Viewport/ViewportOverlay.css +32 -0
  383. package/src/components/Viewport/ViewportOverlay.tsx +54 -0
  384. package/src/components/Viewport/ViewportPane.tsx +82 -0
  385. package/src/components/Viewport/index.ts +9 -0
  386. package/src/components/ViewportDialog/ViewportDialog.tsx +128 -0
  387. package/src/components/ViewportDialog/index.ts +2 -0
  388. package/src/components/index.ts +323 -0
  389. package/src/contextProviders/ActiveThemeProvider.tsx +204 -0
  390. package/src/contextProviders/CineProvider.tsx +98 -0
  391. package/src/contextProviders/DialogProvider.tsx +103 -0
  392. package/src/contextProviders/DragAndDropProvider.tsx +37 -0
  393. package/src/contextProviders/IconPresentationProvider.tsx +88 -0
  394. package/src/contextProviders/ImageViewerProvider.tsx +15 -0
  395. package/src/contextProviders/ManagedDialog.tsx +176 -0
  396. package/src/contextProviders/ModalProvider.tsx +102 -0
  397. package/src/contextProviders/NotificationProvider.tsx +246 -0
  398. package/src/contextProviders/UserAuthenticationProvider.tsx +118 -0
  399. package/src/contextProviders/ViewportDialogProvider.tsx +42 -0
  400. package/src/contextProviders/ViewportGridProvider.tsx +556 -0
  401. package/src/contextProviders/index.ts +26 -0
  402. package/src/hooks/index.ts +4 -0
  403. package/src/hooks/useDynamicMaxHeight.ts +105 -0
  404. package/src/hooks/useSessionStorage.test.js +103 -0
  405. package/src/hooks/useSessionStorage.tsx +71 -0
  406. package/src/index.ts +7 -0
  407. package/src/lib/utils.ts +6 -0
  408. package/src/tailwind.css +266 -0
  409. package/src/themes/arctic.json +31 -0
  410. package/src/themes/deep.json +31 -0
  411. package/src/themes/index.ts +16 -0
  412. package/src/themes/midnight.json +31 -0
  413. package/src/themes/orchid.json +31 -0
  414. package/src/themes/slate.json +31 -0
  415. package/src/themes/themes.css +206 -0
  416. package/src/themes/verdant.json +31 -0
  417. package/src/types/ActionCorners.ts +18 -0
  418. package/src/types/AppTypes.ts +24 -0
  419. package/src/types/ContextMenuItem.ts +9 -0
  420. package/src/types/Predicate.ts +1 -0
  421. package/src/types/ThumbnailType.ts +3 -0
  422. package/src/types/ViewportActionCornersTypes.ts +13 -0
  423. package/src/types/global.d.ts +4 -0
  424. package/src/types/index.ts +21 -0
  425. package/src/utils/formatDICOMDate.test.ts +61 -0
  426. package/src/utils/formatDICOMDate.ts +65 -0
  427. package/src/utils/formatDICOMTime.test.ts +62 -0
  428. package/src/utils/formatDICOMTime.ts +49 -0
  429. package/src/utils/getToggledClassName.tsx +5 -0
  430. package/src/utils/index.ts +15 -0
  431. package/src/utils/parseStudyDateTimestamp.test.ts +47 -0
  432. package/src/utils/parseStudyDateTimestamp.ts +27 -0
  433. package/src/utils/roundNumber.ts +43 -0
  434. package/tailwind.config.js +120 -0
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Button } from '../Button';
4
+ import {
5
+ DropdownMenu,
6
+ DropdownMenuTrigger,
7
+ DropdownMenuContent,
8
+ DropdownMenuCheckboxItem,
9
+ } from '../DropdownMenu';
10
+ import { Icons } from '../Icons';
11
+ import { Tooltip, TooltipContent, TooltipTrigger } from '../Tooltip';
12
+
13
+ import { useDataTable } from './context';
14
+ import { useUnfitColumnIds, useToggleColumnVisibility } from './useResponsiveColumns';
15
+ import type { ColumnMeta } from './types';
16
+
17
+ type ViewOptionsProps = {
18
+ buttonText?: string;
19
+ };
20
+
21
+ export function ViewOptions<TData>({ buttonText = 'View' }: ViewOptionsProps) {
22
+ const { t } = useTranslation('DataTable');
23
+ const { table } = useDataTable<TData>();
24
+ const unfitColumnIds = useUnfitColumnIds();
25
+ const toggleColumnVisibility = useToggleColumnVisibility();
26
+ const columns = table.getAllColumns().filter(c => c.getCanHide());
27
+ // Visibility is read from table.state — the reactive path — rather than
28
+ // column.getIsVisible(): column objects are identity-stable across renders,
29
+ // so a compiled read through their methods would freeze at mount. The
30
+ // state object is replaced on every visibility change, so the compiler
31
+ // re-derives everything below exactly when it should.
32
+ const columnVisibility = table.state.columnVisibility;
33
+
34
+ return (
35
+ <DropdownMenu>
36
+ <DropdownMenuTrigger asChild>
37
+ <Button
38
+ variant="ghost"
39
+ size="sm"
40
+ className="gap-1 text-sm"
41
+ >
42
+ {buttonText}
43
+ <Icons.ChevronDown className="h-2 w-2" />
44
+ </Button>
45
+ </DropdownMenuTrigger>
46
+ <DropdownMenuContent align="end">
47
+ {columns.map(column => {
48
+ const meta = (column.columnDef.meta as ColumnMeta | undefined) ?? undefined;
49
+ const label = meta?.label ?? column.id;
50
+ const isVisible = columnVisibility[column.id] !== false;
51
+ const isUnfit = !isVisible && unfitColumnIds.has(column.id);
52
+ const checkbox = (
53
+ <DropdownMenuCheckboxItem
54
+ checked={isVisible}
55
+ disabled={isUnfit}
56
+ // The funnel both records the toggle as a sticky user decision
57
+ // and writes the table state. See useToggleColumnVisibility.
58
+ onCheckedChange={v => toggleColumnVisibility(column.id, !!v)}
59
+ className="capitalize"
60
+ >
61
+ {label}
62
+ </DropdownMenuCheckboxItem>
63
+ );
64
+
65
+ // Radix tooltips don't fire on a disabled descendant (no pointer
66
+ // events). Wrap in a span — matching the ToolButton pattern in this
67
+ // package — so the trigger element itself is enabled.
68
+ if (isUnfit) {
69
+ return (
70
+ <Tooltip key={column.id}>
71
+ <TooltipTrigger asChild>
72
+ <span>{checkbox}</span>
73
+ </TooltipTrigger>
74
+ <TooltipContent side="left">
75
+ {t('Not enough room to display this column')}
76
+ </TooltipContent>
77
+ </Tooltip>
78
+ );
79
+ }
80
+
81
+ return <React.Fragment key={column.id}>{checkbox}</React.Fragment>;
82
+ })}
83
+ </DropdownMenuContent>
84
+ </DropdownMenu>
85
+ );
86
+ }
@@ -0,0 +1,21 @@
1
+ import { createContext, useContext } from 'react';
2
+ import type { ReactTable } from '@tanstack/react-table';
3
+ import type { DataTableFeatures } from './DataTable';
4
+
5
+ export type DataTableContextValue<TData> = {
6
+ table: ReactTable<DataTableFeatures, TData>;
7
+ };
8
+
9
+ // React Context cannot be generic, so we use 'unknown' as the base type
10
+ // The generic type is properly restored by useDataTable<TData>() via type assertion
11
+ const DataTableContext = createContext<DataTableContextValue<unknown> | null>(null);
12
+
13
+ export function useDataTable<TData>() {
14
+ const ctx = useContext(DataTableContext);
15
+ if (!ctx) {
16
+ throw new Error('useDataTable must be used within a <DataTable> provider');
17
+ }
18
+ return ctx as DataTableContextValue<TData>;
19
+ }
20
+
21
+ export { DataTableContext };
@@ -0,0 +1,5 @@
1
+ // Core compound table + hook
2
+ export { DataTable } from './DataTable';
3
+ export type { DataTableProps, DataTableFeatures } from './DataTable';
4
+ export { useDataTable } from './context';
5
+ export { useToggleColumnVisibility, useUnfitColumnIds } from './useResponsiveColumns';
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+
3
+ /**
4
+ * Metadata type for DataTable columns.
5
+ * This type defines the structure of the `meta` property in TanStack Table column definitions.
6
+ */
7
+ export type ColumnMeta = {
8
+ /** Required label for the column (used by ViewOptions and as fallback for header) */
9
+ label: string;
10
+ /** Optional custom React node to render in the header instead of the label */
11
+ headerContent?: React.ReactNode;
12
+ /** Optional alignment for the column content */
13
+ align?: 'left' | 'center' | 'right';
14
+ /** Optional CSS class name for the header cell */
15
+ headerClassName?: string;
16
+ /** Optional CSS class name for the body cells in this column */
17
+ cellClassName?: string;
18
+ /** Optional minimum width for the column (can be a number or CSS string) */
19
+ minWidth?: number | string;
20
+ /**
21
+ * Drop priority for responsive column visibility. Setting this opts the
22
+ * column in to responsive dropping; columns without a priority are never
23
+ * auto-hidden. Among opted-in columns, higher values are kept visible
24
+ * longer when container width shrinks; lower values are dropped first.
25
+ */
26
+ priority?: number;
27
+ };
@@ -0,0 +1,346 @@
1
+ import React, {
2
+ createContext,
3
+ useContext,
4
+ useEffect,
5
+ useRef,
6
+ useState,
7
+ type ReactNode,
8
+ } from 'react';
9
+ import type { DataTableFeatures } from './DataTable';
10
+ import type { ReactTable, ColumnVisibilityState } from '@tanstack/react-table';
11
+ import type { ColumnMeta } from './types';
12
+ import { useDataTable } from './context';
13
+
14
+ // Default extra pixels required before re-showing a previously-hidden column on
15
+ // grow. Prevents oscillation at the threshold.
16
+ const DEFAULT_REGROW_SLACK_PX = 12;
17
+
18
+ type ColumnSizing = {
19
+ id: string;
20
+ minWidth: number;
21
+ priority: number;
22
+ alwaysVisible: boolean;
23
+ };
24
+
25
+ type ResponsiveColumnsContextValue = {
26
+ unfitColumnIds: Set<string>;
27
+ setUnfitColumnIds: React.Dispatch<React.SetStateAction<Set<string>>>;
28
+ /**
29
+ * Column ids the user has explicitly hidden via the View menu. A mutable ref
30
+ * rather than state: it is recorded synchronously at click time and read by
31
+ * the layout algorithm, and must never itself trigger a render.
32
+ */
33
+ userHiddenColumnIdsRef: React.RefObject<Set<string>>;
34
+ /** Records a user-driven visibility toggle. See useNoteUserColumnToggle. */
35
+ noteUserColumnToggle: (columnId: string, visible: boolean) => void;
36
+ };
37
+
38
+ const ResponsiveColumnsContext = createContext<ResponsiveColumnsContextValue | null>(null);
39
+
40
+ function useResponsiveColumnsContext(): ResponsiveColumnsContextValue {
41
+ const ctx = useContext(ResponsiveColumnsContext);
42
+ if (!ctx) {
43
+ throw new Error(
44
+ 'useResponsiveColumns/useUnfitColumnIds must be used within a <ResponsiveColumnsProvider>'
45
+ );
46
+ }
47
+ return ctx;
48
+ }
49
+
50
+ /**
51
+ * Holds the responsive-layout state for a single DataTable instance.
52
+ * Rendered by `DataTableRoot` so the writer (`useResponsiveColumns`) and
53
+ * readers (`useUnfitColumnIds`, `useToggleColumnVisibility`) can communicate.
54
+ */
55
+ export function ResponsiveColumnsProvider({ children }: { children: ReactNode }) {
56
+ const [unfitColumnIds, setUnfitColumnIds] = useState<Set<string>>(() => new Set());
57
+ const userHiddenColumnIdsRef = useRef<Set<string>>(new Set());
58
+ const noteUserColumnToggle = (columnId: string, visible: boolean) => {
59
+ if (visible) {
60
+ userHiddenColumnIdsRef.current.delete(columnId);
61
+ } else {
62
+ userHiddenColumnIdsRef.current.add(columnId);
63
+ }
64
+ };
65
+ const value = { unfitColumnIds, setUnfitColumnIds, userHiddenColumnIdsRef, noteUserColumnToggle };
66
+ return (
67
+ <ResponsiveColumnsContext.Provider value={value}>{children}</ResponsiveColumnsContext.Provider>
68
+ );
69
+ }
70
+
71
+ /**
72
+ * Returns the set of column ids the responsive layout has determined don't
73
+ * fit at the current table width. Consumed by `ViewOptions` to disable
74
+ * toggles whose effect would be immediately reverted.
75
+ */
76
+ export function useUnfitColumnIds(): Set<string> {
77
+ return useResponsiveColumnsContext().unfitColumnIds;
78
+ }
79
+
80
+ /** Internal: records a toggle without writing table state. Use useToggleColumnVisibility. */
81
+ function useNoteUserColumnToggle(): (columnId: string, visible: boolean) => void {
82
+ return useResponsiveColumnsContext().noteUserColumnToggle;
83
+ }
84
+
85
+ /**
86
+ * Returns the one supported way to show or hide a column from outside the
87
+ * responsive layout. The View menu uses it; consumers toggling columns
88
+ * programmatically should too.
89
+ *
90
+ * It records the toggle as an explicit external decision before writing the
91
+ * table state. That record is what makes a hide sticky (the layout algorithm
92
+ * won't auto-restore the column on grow) and a show clear that stickiness.
93
+ * Recording intent at its source — rather than inferring it by diffing
94
+ * visibility state — is what makes the attribution exact: state diffs cannot
95
+ * distinguish an external toggle from an algorithm write that lands on the
96
+ * same value, or from a write still in flight.
97
+ *
98
+ * Calling column.toggleVisibility() directly still works, but the layout
99
+ * algorithm treats the change as its own and may revert it on the next
100
+ * width change.
101
+ */
102
+ export function useToggleColumnVisibility(): (columnId: string, visible: boolean) => void {
103
+ const { table } = useDataTable();
104
+ const noteUserColumnToggle = useNoteUserColumnToggle();
105
+ return (columnId: string, visible: boolean) => {
106
+ noteUserColumnToggle(columnId, visible);
107
+ table.getColumn(columnId)?.toggleVisibility(visible);
108
+ };
109
+ }
110
+
111
+ type ComputeColumnVisibilityResult = {
112
+ /** Column ids hidden in the applied output (algorithm-dropped or user-hidden). */
113
+ hiddenIds: Set<string>;
114
+ /**
115
+ * Column ids whose View-menu toggle would have no visible effect right
116
+ * now — i.e. the algorithm would immediately re-hide them. A user-hidden
117
+ * column is unfit if lifting just *its* override wouldn't let it fit at
118
+ * its position in the walk (other user-hidden columns remain hidden). A
119
+ * non-user-hidden column is unfit if the algorithm has dropped it.
120
+ */
121
+ unfitIds: Set<string>;
122
+ };
123
+
124
+ /**
125
+ * Walk droppable columns in priority desc (tiebreaking by minWidth asc) and
126
+ * compute both the applied visibility (after strict-priority drops and
127
+ * user-hidden overrides) and the "unfit" set used by the View menu.
128
+ *
129
+ * Strict-priority drop rule: the first column whose minWidth (plus regrow
130
+ * slack, if it is currently hidden) doesn't fit in the remaining budget is
131
+ * dropped — and so is every lower-priority column after it, even if some of
132
+ * them would have fit on their own.
133
+ *
134
+ * `isUserHidden` items are hidden in the applied output without consuming
135
+ * budget or starting the drop, so hiding a mid-priority column via the View
136
+ * menu doesn't force every lower-priority column down with it.
137
+ *
138
+ * `wasHidden` reports each id's currently-committed hidden state; this
139
+ * controls regrow hysteresis.
140
+ */
141
+ function computeColumnVisibility(
142
+ droppableColumns: ColumnSizing[],
143
+ budget: number,
144
+ isUserHidden: (id: string) => boolean,
145
+ wasHidden: (id: string) => boolean
146
+ ): ComputeColumnVisibilityResult {
147
+ const hiddenIds = new Set<string>();
148
+ const unfitIds = new Set<string>();
149
+ let cumulative = 0;
150
+ let cascading = false;
151
+ for (const sizing of droppableColumns) {
152
+ const regrowSlack = wasHidden(sizing.id) ? DEFAULT_REGROW_SLACK_PX : 0;
153
+ // Would this column fit at this exact position in the walk? Used to
154
+ // answer "could the user re-show it?" for user-hidden columns and to
155
+ // decide when to start dropping the rest.
156
+ const fits = !cascading && cumulative + sizing.minWidth + regrowSlack <= budget;
157
+
158
+ if (isUserHidden(sizing.id)) {
159
+ hiddenIds.add(sizing.id);
160
+ if (!fits) {
161
+ unfitIds.add(sizing.id);
162
+ }
163
+ continue;
164
+ }
165
+
166
+ if (!fits) {
167
+ // Either dropping already started, or this column starts it.
168
+ hiddenIds.add(sizing.id);
169
+ unfitIds.add(sizing.id);
170
+ cascading = true;
171
+ continue;
172
+ }
173
+
174
+ // Fits — visible, consumes budget.
175
+ cumulative += sizing.minWidth;
176
+ }
177
+ return { hiddenIds, unfitIds };
178
+ }
179
+
180
+ function idSetsEqual(a: Set<string>, b: Set<string>): boolean {
181
+ if (a.size !== b.size) {
182
+ return false;
183
+ }
184
+ for (const id of a) {
185
+ if (!b.has(id)) {
186
+ return false;
187
+ }
188
+ }
189
+ return true;
190
+ }
191
+
192
+ /**
193
+ * Drives responsive column visibility from a wrapper element's width.
194
+ *
195
+ * Setting `meta.priority` opts a column in to responsive dropping; columns
196
+ * without a priority (or marked `enableHiding: false`) are always visible
197
+ * and consume their `meta.minWidth` from the budget unconditionally. Among
198
+ * the opted-in columns, higher priority is dropped last.
199
+ *
200
+ * Strict-priority drop rule: walk droppable columns by priority desc,
201
+ * including each that fits the remaining budget. The first column that
202
+ * doesn't fit — and every lower-priority column after it — is dropped, even
203
+ * if some would have fit individually. This guarantees that on shrink
204
+ * columns can only disappear (never reappear) and on grow they return in
205
+ * the reverse of the order they were dropped.
206
+ *
207
+ * User overrides are not inferred: every user-facing toggle reports itself
208
+ * through `useToggleColumnVisibility`, which records the column in a shared
209
+ * user-hidden set synchronously at click time. A user-hidden column stays
210
+ * hidden through subsequent width changes; a user-show clears its entry
211
+ * (the algorithm may still drop it for space on the next shrink). Because
212
+ * intent arrives explicitly, the algorithm never has to guess whether a
213
+ * visibility change was its own write or the user's, and every run is a
214
+ * pure function of (width, user-hidden set): re-running it is idempotent
215
+ * and converges instead of looping.
216
+ *
217
+ * Publishes the "unfit" set — hidden column ids whose View-menu toggle would
218
+ * have no visible effect because the algorithm would immediately re-hide
219
+ * them — through `ResponsiveColumnsProvider`. The check is per-column: a
220
+ * user-hidden column is unfit only if lifting *its* override (with other
221
+ * user overrides intact) wouldn't free enough budget for it to fit.
222
+ *
223
+ * This hook must be used inside a `<ResponsiveColumnsProvider>`.
224
+ */
225
+ export function useResponsiveColumns<TData>(
226
+ table: ReactTable<DataTableFeatures, TData>,
227
+ wrapperRef: React.RefObject<HTMLElement | null>
228
+ ): void {
229
+ const { setUnfitColumnIds, userHiddenColumnIdsRef } = useResponsiveColumnsContext();
230
+
231
+ // The last "unfit" set we published. Used to diff against the next run so
232
+ // we only call setUnfitColumnIds when the set actually changes.
233
+ const lastUnfitColumnIdsRef = useRef<Set<string>>(new Set());
234
+
235
+ // Snapshot column sizing data once per columns change. TanStack memoizes
236
+ // getAllLeafColumns() internally, so the array reference is stable across
237
+ // renders until the column definitions themselves change.
238
+ const leafColumns = table.getAllLeafColumns();
239
+ const columnSizings: ColumnSizing[] = leafColumns.map(col => {
240
+ const meta = (col.columnDef.meta as ColumnMeta | undefined) ?? undefined;
241
+ const minWidth = typeof meta?.minWidth === 'number' ? meta.minWidth : 0;
242
+ const enableHiding = col.columnDef.enableHiding !== false;
243
+ const hasPriority = typeof meta?.priority === 'number';
244
+ return {
245
+ id: col.id,
246
+ minWidth,
247
+ priority: hasPriority ? (meta!.priority as number) : 0,
248
+ // Setting meta.priority opts a column in to responsive hiding;
249
+ // enableHiding: false opts it out. Columns without a priority are
250
+ // treated as always-visible and consume their minWidth from the budget.
251
+ alwaysVisible: !enableHiding || !hasPriority,
252
+ };
253
+ });
254
+
255
+ // Droppable columns sorted in strict priority order (highest first), with
256
+ // minWidth ascending as a tiebreaker. computeColumnVisibility walks this list.
257
+ const droppableColumns: ColumnSizing[] = columnSizings
258
+ .filter(s => !s.alwaysVisible)
259
+ .sort((a, b) => b.priority - a.priority || a.minWidth - b.minWidth);
260
+
261
+ const runAlgorithm = (containerWidth: number) => {
262
+ if (droppableColumns.length === 0) {
263
+ return;
264
+ }
265
+
266
+ // Always-visible columns consume budget unconditionally; the walk
267
+ // operates on what remains.
268
+ let budget = containerWidth;
269
+ for (const sizing of columnSizings) {
270
+ if (sizing.alwaysVisible) {
271
+ budget -= sizing.minWidth;
272
+ }
273
+ }
274
+
275
+ // The currently-committed visibility. Feeds the regrow hysteresis
276
+ // (a hidden column must clear extra slack before re-showing) and the
277
+ // did-anything-change check below.
278
+ const currentVisibility = table.atoms.columnVisibility.get();
279
+
280
+ // Single walk produces both the applied visibility (honoring user-
281
+ // hidden columns) and the unfit set (columns whose View-menu toggle
282
+ // would have no effect because the algorithm would immediately re-hide
283
+ // them).
284
+ const { hiddenIds: appliedHidden, unfitIds: nextUnfit } = computeColumnVisibility(
285
+ droppableColumns,
286
+ budget,
287
+ (id: string) => userHiddenColumnIdsRef.current.has(id),
288
+ (id: string) => currentVisibility[id] === false
289
+ );
290
+
291
+ // Build the visibility map and apply it only if it changes anything.
292
+ const nextVisibility: ColumnVisibilityState = {};
293
+ for (const sizing of droppableColumns) {
294
+ nextVisibility[sizing.id] = !appliedHidden.has(sizing.id);
295
+ }
296
+ let appliedChanged = false;
297
+ for (const key of Object.keys(nextVisibility)) {
298
+ if ((currentVisibility[key] !== false) !== (nextVisibility[key] !== false)) {
299
+ appliedChanged = true;
300
+ break;
301
+ }
302
+ }
303
+ if (appliedChanged) {
304
+ table.setColumnVisibility(prev => ({ ...prev, ...nextVisibility }));
305
+ }
306
+
307
+ // Publish the unfit set if it changed.
308
+ const lastUnfit = lastUnfitColumnIdsRef.current;
309
+ lastUnfitColumnIdsRef.current = nextUnfit;
310
+ if (!idSetsEqual(lastUnfit, nextUnfit)) {
311
+ setUnfitColumnIds(nextUnfit);
312
+ }
313
+ };
314
+
315
+ // Track and react to the table's width.
316
+ useEffect(() => {
317
+ const wrapper = wrapperRef.current;
318
+ if (!wrapper || droppableColumns.length === 0) {
319
+ return;
320
+ }
321
+ runAlgorithm(wrapper.clientWidth);
322
+ const observer = new ResizeObserver(entries => {
323
+ for (const entry of entries) {
324
+ runAlgorithm(entry.contentRect.width);
325
+ }
326
+ });
327
+ observer.observe(wrapper);
328
+ return () => observer.disconnect();
329
+ }, [runAlgorithm, wrapperRef, droppableColumns]);
330
+
331
+ // Re-run whenever the committed visibility changes: a user toggle landing
332
+ // (its intent was already recorded synchronously at click time via
333
+ // useToggleColumnVisibility — this run applies the consequences, e.g. a
334
+ // user-hide freeing budget for a lower-priority column), one of our own
335
+ // writes landing, or a programmatic change by a consumer. Runs are
336
+ // idempotent — same width and user-hidden set recompute the same map and
337
+ // write nothing — so this converges instead of looping.
338
+ const columnVisibility = table.state.columnVisibility;
339
+ useEffect(() => {
340
+ const wrapper = wrapperRef.current;
341
+ if (!wrapper || droppableColumns.length === 0) {
342
+ return;
343
+ }
344
+ runAlgorithm(wrapper.clientWidth);
345
+ }, [columnVisibility, runAlgorithm, wrapperRef, droppableColumns]);
346
+ }
@@ -0,0 +1,163 @@
1
+ import * as React from 'react';
2
+ import { format, parse, isValid } from 'date-fns';
3
+ import { Calendar as CalendarIcon } from 'lucide-react';
4
+ import { useTranslation } from 'react-i18next';
5
+ import { cn } from '../../lib/utils';
6
+ import { Calendar } from '../Calendar';
7
+ import * as Popover from '../Popover';
8
+
9
+ export type DatePickerWithRangeProps = {
10
+ id: string;
11
+ /** YYYYMMDD (19921022) */
12
+ startDate: string;
13
+ /** YYYYMMDD (19921022) */
14
+ endDate: string;
15
+ /** Callback that received { startDate: string(YYYYMMDD), endDate: string(YYYYMMDD)} */
16
+ onChange: (value: { startDate: string; endDate: string }) => void;
17
+ };
18
+
19
+ export function DatePickerWithRange({
20
+ className,
21
+ id,
22
+ startDate,
23
+ endDate,
24
+ onChange,
25
+ ...props
26
+ }: React.HTMLAttributes<HTMLDivElement> & DatePickerWithRangeProps) {
27
+ const { t } = useTranslation('DatePicker');
28
+ const [start, setStart] = React.useState<string>(
29
+ startDate ? format(parse(startDate, 'yyyyMMdd', new Date()), 'yyyy-MM-dd') : ''
30
+ );
31
+ const [end, setEnd] = React.useState<string>(
32
+ endDate ? format(parse(endDate, 'yyyyMMdd', new Date()), 'yyyy-MM-dd') : ''
33
+ );
34
+ const [openEnd, setOpenEnd] = React.useState(false);
35
+
36
+ const handleStartSelect = (selectedDate: Date | undefined) => {
37
+ if (selectedDate) {
38
+ const formattedDate = format(selectedDate, 'yyyy-MM-dd');
39
+ setStart(formattedDate);
40
+ setOpenEnd(true);
41
+ onChange({
42
+ startDate: format(selectedDate, 'yyyyMMdd'),
43
+ endDate: end.replace(/-/g, ''),
44
+ });
45
+ }
46
+ };
47
+
48
+ const handleEndSelect = (selectedDate: Date | undefined) => {
49
+ if (selectedDate) {
50
+ const formattedDate = format(selectedDate, 'yyyy-MM-dd');
51
+ setEnd(formattedDate);
52
+ setOpenEnd(false);
53
+ onChange({
54
+ startDate: start.replace(/-/g, ''),
55
+ endDate: format(selectedDate, 'yyyyMMdd'),
56
+ });
57
+ }
58
+ };
59
+
60
+ const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>, type: 'start' | 'end') => {
61
+ const value = e.target.value;
62
+ const date = parse(value, 'yyyy-MM-dd', new Date());
63
+ if (type === 'start') {
64
+ setStart(value);
65
+ if (isValid(date)) {
66
+ handleStartSelect(date);
67
+ }
68
+ } else {
69
+ setEnd(value);
70
+ if (isValid(date)) {
71
+ handleEndSelect(date);
72
+ }
73
+ }
74
+ };
75
+
76
+ React.useEffect(() => {
77
+ setStart(startDate ? format(parse(startDate, 'yyyyMMdd', new Date()), 'yyyy-MM-dd') : '');
78
+ setEnd(endDate ? format(parse(endDate, 'yyyyMMdd', new Date()), 'yyyy-MM-dd') : '');
79
+ }, [startDate, endDate]);
80
+
81
+ return (
82
+ <div className={cn('flex gap-2', className)}>
83
+ <Popover.Popover>
84
+ <Popover.PopoverTrigger asChild>
85
+ <div className="relative w-full">
86
+ {!start && (
87
+ <CalendarIcon className="text-primary absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 transform" />
88
+ )}
89
+ <input
90
+ id={`${id}-start`}
91
+ type="text"
92
+ placeholder={t('Start', 'Start')}
93
+ autoComplete="off"
94
+ value={start}
95
+ onChange={e => handleInputChange(e, 'start')}
96
+ className={cn(
97
+ 'border-input focus:border-ring hover:text-foreground placeholder:text-muted-foreground h-7 w-full justify-start rounded border bg-background pl-1.5 pr-0.5 py-1 text-left text-base font-normal hover:bg-background'
98
+ )}
99
+ data-cy="input-date-range-start"
100
+ />
101
+ </div>
102
+ </Popover.PopoverTrigger>
103
+ <Popover.PopoverContent
104
+ className="w-auto overflow-hidden p-0"
105
+ align="start"
106
+ >
107
+ <Calendar
108
+ autoFocus
109
+ mode="single"
110
+ captionLayout="dropdown"
111
+ defaultMonth={start ? parse(start, 'yyyy-MM-dd', new Date()) : new Date()}
112
+ selected={start ? parse(start, 'yyyy-MM-dd', new Date()) : undefined}
113
+ onSelect={handleStartSelect}
114
+ startMonth={new Date(1900, 0)}
115
+ endMonth={new Date(new Date().getFullYear() + 1, 11)}
116
+ numberOfMonths={1}
117
+ />
118
+ </Popover.PopoverContent>
119
+ </Popover.Popover>
120
+
121
+ <Popover.Popover
122
+ open={openEnd}
123
+ onOpenChange={setOpenEnd}
124
+ >
125
+ <Popover.PopoverTrigger asChild>
126
+ <div className="relative w-full">
127
+ {!end && (
128
+ <CalendarIcon className="text-primary absolute right-2 top-1/2 h-4 w-4 -translate-y-1/2 transform" />
129
+ )}
130
+ <input
131
+ id={`${id}-end`}
132
+ type="text"
133
+ placeholder={t('End', 'End')}
134
+ autoComplete="off"
135
+ value={end}
136
+ onChange={e => handleInputChange(e, 'end')}
137
+ className={cn(
138
+ 'border-input focus:border-ring hover:text-foreground placeholder:text-muted-foreground h-7 w-full justify-start rounded border bg-background pl-1.5 pr-0.5 py-1 text-left text-base font-normal hover:bg-background'
139
+ )}
140
+ data-cy="input-date-range-end"
141
+ />
142
+ </div>
143
+ </Popover.PopoverTrigger>
144
+ <Popover.PopoverContent
145
+ className="w-auto overflow-hidden p-0"
146
+ align="start"
147
+ >
148
+ <Calendar
149
+ autoFocus
150
+ mode="single"
151
+ captionLayout="dropdown"
152
+ defaultMonth={start ? parse(start, 'yyyy-MM-dd', new Date()) : new Date()}
153
+ selected={end ? parse(end, 'yyyy-MM-dd', new Date()) : undefined}
154
+ onSelect={handleEndSelect}
155
+ startMonth={new Date(1900, 0)}
156
+ endMonth={new Date(new Date().getFullYear() + 1, 11)}
157
+ numberOfMonths={1}
158
+ />
159
+ </Popover.PopoverContent>
160
+ </Popover.Popover>
161
+ </div>
162
+ );
163
+ }
@@ -0,0 +1,3 @@
1
+ import { DatePickerWithRange } from './DateRange';
2
+
3
+ export { DatePickerWithRange };