nmrium 2.4.0 → 2.5.0

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 (277) hide show
  1. package/lib/component/1d/HorizontalAxis1D.d.ts.map +1 -1
  2. package/lib/component/1d/HorizontalAxis1D.js +4 -1
  3. package/lib/component/1d/HorizontalAxis1D.js.map +1 -1
  4. package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
  5. package/lib/component/1d/SVGContent1D.js +2 -1
  6. package/lib/component/1d/SVGContent1D.js.map +1 -1
  7. package/lib/component/1d/Viewer1D.d.ts.map +1 -1
  8. package/lib/component/1d/Viewer1D.js +2 -1
  9. package/lib/component/1d/Viewer1D.js.map +1 -1
  10. package/lib/component/1d/integral/IntegralResizable.d.ts.map +1 -1
  11. package/lib/component/1d/integral/IntegralResizable.js +4 -4
  12. package/lib/component/1d/integral/IntegralResizable.js.map +1 -1
  13. package/lib/component/1d/ranges/Range.d.ts.map +1 -1
  14. package/lib/component/1d/ranges/Range.js +3 -3
  15. package/lib/component/1d/ranges/Range.js.map +1 -1
  16. package/lib/component/1d/ranges/Signals.d.ts +2 -0
  17. package/lib/component/1d/ranges/Signals.d.ts.map +1 -0
  18. package/lib/component/1d/ranges/Signals.js +16 -0
  19. package/lib/component/1d/ranges/Signals.js.map +1 -0
  20. package/lib/component/1d-2d/components/RangeIndicator.d.ts +13 -0
  21. package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -0
  22. package/lib/component/1d-2d/components/RangeIndicator.js +52 -0
  23. package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -0
  24. package/lib/component/1d-2d/components/Signals1D.d.ts +19 -0
  25. package/lib/component/1d-2d/components/Signals1D.d.ts.map +1 -0
  26. package/lib/component/1d-2d/components/Signals1D.js +155 -0
  27. package/lib/component/1d-2d/components/Signals1D.js.map +1 -0
  28. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts +16 -1
  29. package/lib/component/1d-2d/tools/CrossLinePointer.d.ts.map +1 -1
  30. package/lib/component/1d-2d/tools/CrossLinePointer.js +25 -15
  31. package/lib/component/1d-2d/tools/CrossLinePointer.js.map +1 -1
  32. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts +9 -0
  33. package/lib/component/1d-2d/tools/CursorToolIcon.d.ts.map +1 -0
  34. package/lib/component/1d-2d/tools/CursorToolIcon.js +58 -0
  35. package/lib/component/1d-2d/tools/CursorToolIcon.js.map +1 -0
  36. package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
  37. package/lib/component/2d/1d-tracer/Left1DChart.js +3 -2
  38. package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
  39. package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -1
  40. package/lib/component/2d/1d-tracer/Ranges1D.js +4 -60
  41. package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -1
  42. package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
  43. package/lib/component/2d/1d-tracer/Top1DChart.js +3 -2
  44. package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
  45. package/lib/component/2d/DirectAxis2D.d.ts.map +1 -1
  46. package/lib/component/2d/DirectAxis2D.js +4 -1
  47. package/lib/component/2d/DirectAxis2D.js.map +1 -1
  48. package/lib/component/2d/IndirectAxis2D.d.ts.map +1 -1
  49. package/lib/component/2d/IndirectAxis2D.js +5 -2
  50. package/lib/component/2d/IndirectAxis2D.js.map +1 -1
  51. package/lib/component/2d/Viewer2D.d.ts.map +1 -1
  52. package/lib/component/2d/Viewer2D.js +2 -1
  53. package/lib/component/2d/Viewer2D.js.map +1 -1
  54. package/lib/component/AnchorSVG.d.ts +5 -6
  55. package/lib/component/AnchorSVG.d.ts.map +1 -1
  56. package/lib/component/AnchorSVG.js +9 -6
  57. package/lib/component/AnchorSVG.js.map +1 -1
  58. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  59. package/lib/component/EventsTrackers/BrushTracker.js +14 -4
  60. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  61. package/lib/component/EventsTrackers/MouseTracker.d.ts +3 -0
  62. package/lib/component/EventsTrackers/MouseTracker.d.ts.map +1 -1
  63. package/lib/component/EventsTrackers/MouseTracker.js +15 -0
  64. package/lib/component/EventsTrackers/MouseTracker.js.map +1 -1
  65. package/lib/component/context/KeyModifierContext.d.ts +1 -0
  66. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  67. package/lib/component/context/KeyModifierContext.js +22 -6
  68. package/lib/component/context/KeyModifierContext.js.map +1 -1
  69. package/lib/component/elements/D3Axis.d.ts.map +1 -1
  70. package/lib/component/elements/D3Axis.js +4 -3
  71. package/lib/component/elements/D3Axis.js.map +1 -1
  72. package/lib/component/header/AutoPeakPickingOptionPanel.d.ts.map +1 -1
  73. package/lib/component/header/AutoPeakPickingOptionPanel.js +59 -31
  74. package/lib/component/header/AutoPeakPickingOptionPanel.js.map +1 -1
  75. package/lib/component/header/RangesPickingOptionPanel.d.ts.map +1 -1
  76. package/lib/component/header/RangesPickingOptionPanel.js +34 -19
  77. package/lib/component/header/RangesPickingOptionPanel.js.map +1 -1
  78. package/lib/component/hooks/useAddMultipletSignal.d.ts +7 -0
  79. package/lib/component/hooks/useAddMultipletSignal.d.ts.map +1 -0
  80. package/lib/component/hooks/useAddMultipletSignal.js +28 -0
  81. package/lib/component/hooks/useAddMultipletSignal.js.map +1 -0
  82. package/lib/component/hooks/useFilter.d.ts.map +1 -1
  83. package/lib/component/hooks/useFilter.js.map +1 -1
  84. package/lib/component/hooks/useSpectrum.d.ts +3 -1
  85. package/lib/component/hooks/useSpectrum.d.ts.map +1 -1
  86. package/lib/component/hooks/useSpectrum.js +1 -1
  87. package/lib/component/hooks/useSpectrum.js.map +1 -1
  88. package/lib/component/hooks/useSpectrumWithDataSource.d.ts +1 -1
  89. package/lib/component/hooks/useSpectrumWithDataSource.d.ts.map +1 -1
  90. package/lib/component/hooks/useSpectrumWithDataSource.js.map +1 -1
  91. package/lib/component/hooks/useTempSpectrum.d.ts +1 -1
  92. package/lib/component/hooks/useTempSpectrum.d.ts.map +1 -1
  93. package/lib/component/hooks/use_ticks_config.d.ts +1 -4
  94. package/lib/component/hooks/use_ticks_config.d.ts.map +1 -1
  95. package/lib/component/hooks/use_ticks_config.js +1 -6
  96. package/lib/component/hooks/use_ticks_config.js.map +1 -1
  97. package/lib/component/modal/PublicationStringModal.d.ts +1 -1
  98. package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
  99. package/lib/component/modal/PublicationStringModal.js +2 -2
  100. package/lib/component/modal/PublicationStringModal.js.map +1 -1
  101. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +118 -0
  102. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
  103. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +118 -0
  104. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
  105. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +118 -0
  106. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
  107. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +96 -0
  108. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
  109. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +96 -0
  110. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
  111. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +16 -0
  112. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts.map +1 -1
  113. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +96 -0
  114. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
  115. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +96 -0
  116. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
  117. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js +12 -1
  118. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.js.map +1 -1
  119. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +96 -0
  120. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
  121. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +96 -0
  122. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
  123. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +96 -0
  124. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
  125. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +96 -0
  126. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
  127. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +96 -0
  128. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
  129. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +96 -0
  130. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
  131. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +96 -0
  132. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
  133. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +96 -0
  134. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
  135. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +96 -0
  136. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
  137. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +96 -0
  138. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
  139. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +96 -0
  140. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
  141. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts +22 -0
  142. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.d.ts.map +1 -1
  143. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js +15 -2
  144. package/lib/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.js.map +1 -1
  145. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +22 -0
  146. package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts.map +1 -1
  147. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js +1 -1
  148. package/lib/component/panels/MoleculesPanel/hooks/useAtomAssignment.js.map +1 -1
  149. package/lib/component/panels/RangesPanel/RangesPanel.d.ts.map +1 -1
  150. package/lib/component/panels/RangesPanel/RangesPanel.js +1 -3
  151. package/lib/component/panels/RangesPanel/RangesPanel.js.map +1 -1
  152. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts.map +1 -1
  153. package/lib/component/panels/RangesPanel/RangesTableRow.js +10 -12
  154. package/lib/component/panels/RangesPanel/RangesTableRow.js.map +1 -1
  155. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +1 -1
  156. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts.map +1 -1
  157. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js +1 -1
  158. package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.js.map +1 -1
  159. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -1
  160. package/lib/component/panels/filtersPanel/processings_sections_panel.js +13 -23
  161. package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -1
  162. package/lib/component/panels/hooks/use_processings_mutation.d.ts +10 -0
  163. package/lib/component/panels/hooks/use_processings_mutation.d.ts.map +1 -0
  164. package/lib/component/panels/hooks/use_processings_mutation.js +130 -0
  165. package/lib/component/panels/hooks/use_processings_mutation.js.map +1 -0
  166. package/lib/component/panels/informationPanel/InformationPanel.js +1 -1
  167. package/lib/component/panels/informationPanel/InformationPanel.js.map +1 -1
  168. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  169. package/lib/component/reducer/Reducer.js +2 -0
  170. package/lib/component/reducer/Reducer.js.map +1 -1
  171. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  172. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  173. package/lib/component/reducer/actions/FiltersActions.d.ts +2 -0
  174. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  175. package/lib/component/reducer/actions/FiltersActions.js +1 -1
  176. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  177. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  178. package/lib/component/reducer/actions/RangesActions.js +13 -24
  179. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  180. package/lib/component/reducer/actions/SpectraActions.d.ts +8 -2
  181. package/lib/component/reducer/actions/SpectraActions.d.ts.map +1 -1
  182. package/lib/component/reducer/actions/SpectraActions.js +6 -1
  183. package/lib/component/reducer/actions/SpectraActions.js.map +1 -1
  184. package/lib/component/reducer/preferences/actions/setPreferences.d.ts +2 -2
  185. package/lib/component/reducer/preferences/actions/setPreferences.d.ts.map +1 -1
  186. package/lib/component/reducer/preferences/actions/setPreferences.js +8 -5
  187. package/lib/component/reducer/preferences/actions/setPreferences.js.map +1 -1
  188. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  189. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  190. package/lib/component/toolbar/ToolTypes.d.ts +21 -1
  191. package/lib/component/toolbar/ToolTypes.d.ts.map +1 -1
  192. package/lib/component/toolbar/ToolTypes.js +40 -0
  193. package/lib/component/toolbar/ToolTypes.js.map +1 -1
  194. package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
  195. package/lib/component/toolbar/nmr_toolbar.js +9 -35
  196. package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
  197. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  198. package/lib/component/workspaces/workspaceDefaultProperties.js +19 -2
  199. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  200. package/lib/data/data1d/Spectrum1D/initiateDatum1D.d.ts.map +1 -1
  201. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +13 -5
  202. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js.map +1 -1
  203. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  204. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +12 -4
  205. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  206. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts +1 -1
  207. package/lib/data/data2d/Spectrum2D/isSpectrum2D.d.ts.map +1 -1
  208. package/lib/data/data2d/Spectrum2D/isSpectrum2D.js.map +1 -1
  209. package/lib/data/utilities/RangeUtilities.d.ts +1 -6
  210. package/lib/data/utilities/RangeUtilities.d.ts.map +1 -1
  211. package/lib/data/utilities/RangeUtilities.js +10 -27
  212. package/lib/data/utilities/RangeUtilities.js.map +1 -1
  213. package/lib/versionInfo.js +1 -1
  214. package/package.json +15 -14
  215. package/src/component/1d/HorizontalAxis1D.tsx +12 -2
  216. package/src/component/1d/SVGContent1D.tsx +2 -0
  217. package/src/component/1d/Viewer1D.tsx +2 -0
  218. package/src/component/1d/integral/IntegralResizable.tsx +6 -6
  219. package/src/component/1d/ranges/Range.tsx +6 -6
  220. package/src/component/1d/ranges/Signals.tsx +28 -0
  221. package/src/component/1d-2d/components/RangeIndicator.tsx +106 -0
  222. package/src/component/1d-2d/components/Signals1D.tsx +306 -0
  223. package/src/component/1d-2d/tools/CrossLinePointer.tsx +75 -32
  224. package/src/component/1d-2d/tools/CursorToolIcon.tsx +110 -0
  225. package/src/component/2d/1d-tracer/Left1DChart.tsx +4 -2
  226. package/src/component/2d/1d-tracer/Ranges1D.tsx +4 -100
  227. package/src/component/2d/1d-tracer/Top1DChart.tsx +4 -2
  228. package/src/component/2d/DirectAxis2D.tsx +12 -3
  229. package/src/component/2d/IndirectAxis2D.tsx +9 -5
  230. package/src/component/2d/Viewer2D.tsx +5 -2
  231. package/src/component/AnchorSVG.tsx +27 -28
  232. package/src/component/EventsTrackers/BrushTracker.tsx +21 -7
  233. package/src/component/EventsTrackers/MouseTracker.tsx +21 -0
  234. package/src/component/context/KeyModifierContext.tsx +27 -8
  235. package/src/component/elements/D3Axis.tsx +31 -9
  236. package/src/component/header/AutoPeakPickingOptionPanel.tsx +173 -102
  237. package/src/component/header/RangesPickingOptionPanel.tsx +72 -59
  238. package/src/component/hooks/useAddMultipletSignal.tsx +32 -0
  239. package/src/component/hooks/useFilter.ts +2 -1
  240. package/src/component/hooks/useSpectrum.ts +7 -1
  241. package/src/component/hooks/useSpectrumWithDataSource.ts +16 -8
  242. package/src/component/hooks/use_ticks_config.ts +1 -7
  243. package/src/component/modal/PublicationStringModal.tsx +3 -3
  244. package/src/component/modal/setting/tanstack_general_settings/tabs/axis_tab.tsx +76 -12
  245. package/src/component/modal/setting/tanstack_general_settings/validation/axis_tab_validation.ts +16 -2
  246. package/src/component/panels/MoleculesPanel/hooks/useAtomAssignment.tsx +1 -1
  247. package/src/component/panels/RangesPanel/RangesPanel.tsx +1 -3
  248. package/src/component/panels/RangesPanel/RangesTableRow.tsx +10 -12
  249. package/src/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.tsx +2 -2
  250. package/src/component/panels/filtersPanel/processings_sections_panel.tsx +27 -44
  251. package/src/component/panels/hooks/use_processings_mutation.ts +171 -0
  252. package/src/component/panels/informationPanel/InformationPanel.tsx +1 -1
  253. package/src/component/reducer/Reducer.ts +2 -0
  254. package/src/component/reducer/actions/CorrelationsActions.ts +1 -1
  255. package/src/component/reducer/actions/FiltersActions.ts +1 -1
  256. package/src/component/reducer/actions/RangesActions.ts +14 -25
  257. package/src/component/reducer/actions/SpectraActions.ts +20 -1
  258. package/src/component/reducer/preferences/actions/setPreferences.ts +18 -10
  259. package/src/component/reducer/preferences/preferencesReducer.ts +1 -1
  260. package/src/component/toolbar/ToolTypes.ts +92 -1
  261. package/src/component/toolbar/nmr_toolbar.tsx +12 -69
  262. package/src/component/workspaces/workspaceDefaultProperties.ts +19 -2
  263. package/src/data/data1d/Spectrum1D/initiateDatum1D.ts +14 -8
  264. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +12 -4
  265. package/src/data/data2d/Spectrum2D/isSpectrum2D.ts +1 -1
  266. package/src/data/utilities/RangeUtilities.ts +12 -36
  267. package/src/versionInfo.ts +1 -1
  268. package/lib/component/1d/integral/IntegralIndicator.d.ts +0 -9
  269. package/lib/component/1d/integral/IntegralIndicator.d.ts.map +0 -1
  270. package/lib/component/1d/integral/IntegralIndicator.js +0 -22
  271. package/lib/component/1d/integral/IntegralIndicator.js.map +0 -1
  272. package/lib/component/2d/1d-tracer/Signals1D.d.ts +0 -11
  273. package/lib/component/2d/1d-tracer/Signals1D.d.ts.map +0 -1
  274. package/lib/component/2d/1d-tracer/Signals1D.js +0 -90
  275. package/lib/component/2d/1d-tracer/Signals1D.js.map +0 -1
  276. package/src/component/1d/integral/IntegralIndicator.tsx +0 -43
  277. package/src/component/2d/1d-tracer/Signals1D.tsx +0 -145
@@ -1,13 +1,13 @@
1
- import { yupResolver } from '@hookform/resolvers/yup';
2
- import { useForm } from 'react-hook-form';
3
- import { Button, TooltipHelpContent } from 'react-science/ui';
4
- import * as Yup from 'yup';
1
+ import { Classes, FormGroup, MenuItem, NumericInput } from '@blueprintjs/core';
2
+ import type { ItemRenderer } from '@blueprintjs/select';
3
+ import { Select } from '@blueprintjs/select';
4
+ import styled from '@emotion/styled';
5
+ import { revalidateLogic } from '@tanstack/react-form';
6
+ import { AppForm, Button, TooltipHelpContent, useForm } from 'react-science/ui';
7
+ import { z } from 'zod/v4';
5
8
 
6
9
  import { useDispatch } from '../context/DispatchContext.js';
7
10
  import { useToaster } from '../context/ToasterContext.js';
8
- import Label from '../elements/Label.js';
9
- import { NumberInput2Controller } from '../elements/NumberInput2Controller.js';
10
- import { Select2Controller } from '../elements/Select2Controller.js';
11
11
  import { useActiveNucleusTab } from '../hooks/useActiveNucleusTab.ts';
12
12
  import { useActiveSpectra } from '../hooks/useActiveSpectra.ts';
13
13
  import {
@@ -16,12 +16,14 @@ import {
16
16
  } from '../hooks/useCheckPointsNumberInWindowArea.js';
17
17
  import { usePanelPreferences } from '../hooks/usePanelPreferences.ts';
18
18
 
19
- import { headerLabelStyle } from './Header.js';
20
- import { HeaderWrapper } from './HeaderWrapper.js';
21
-
22
19
  type Direction = 'positive' | 'negative' | 'both';
23
20
 
24
- const LookFor: Array<{ label: string; value: Direction }> = [
21
+ interface Item {
22
+ label: string;
23
+ value: Direction;
24
+ }
25
+
26
+ const LookFor: Item[] = [
25
27
  {
26
28
  label: 'Positive',
27
29
  value: 'positive',
@@ -36,48 +38,78 @@ const LookFor: Array<{ label: string; value: Direction }> = [
36
38
  },
37
39
  ];
38
40
 
39
- interface AutoPeakPickingOptions {
40
- maxNumberOfPeaks: number;
41
- minMaxRatio: number;
42
- noiseFactor: number;
43
- direction: Direction;
44
- }
45
-
46
- const validationSchema = Yup.object().shape({
47
- maxNumberOfPeaks: Yup.number().min(1).required(),
48
- minMaxRatio: Yup.number().min(0).required(),
49
- noiseFactor: Yup.number().min(0).required(),
50
- direction: Yup.mixed<Direction>()
51
- .oneOf(['both', 'negative', 'positive'])
52
- .required(),
41
+ const validationSchema = z.object({
42
+ maxNumberOfPeaks: z.coerce.number<string>().min(1),
43
+ minMaxRatio: z.coerce.number<string>().min(0),
44
+ noiseFactor: z.coerce.number<string>().min(0),
45
+ direction: z.enum(['both', 'negative', 'positive']),
53
46
  });
54
47
 
55
- const INIT_VALUES: AutoPeakPickingOptions = {
56
- maxNumberOfPeaks: 50,
57
- minMaxRatio: 0.05,
58
- noiseFactor: 3,
48
+ type AutoPeakPickingOptionsInput = z.input<typeof validationSchema>;
49
+ type AutoPeakPickingOptions = z.output<typeof validationSchema>;
50
+
51
+ const defaultValues: AutoPeakPickingOptionsInput = {
52
+ maxNumberOfPeaks: '50',
53
+ minMaxRatio: '0.05',
54
+ noiseFactor: '3',
59
55
  direction: 'both',
60
56
  };
61
57
 
58
+ const AppFormContainer = styled(AppForm)`
59
+ display: flex;
60
+ flex-direction: row;
61
+ gap: 10px;
62
+ align-items: center;
63
+
64
+ .${Classes.FORM_GROUP} {
65
+ margin-bottom: 0;
66
+ }
67
+ `;
68
+
69
+ const renderDirection: ItemRenderer<Item> = (
70
+ direction,
71
+ { handleClick, handleFocus, modifiers },
72
+ ) => {
73
+ if (!modifiers.matchesPredicate) {
74
+ return null;
75
+ }
76
+
77
+ return (
78
+ <MenuItem
79
+ active={modifiers.active}
80
+ disabled={modifiers.disabled}
81
+ key={direction.value}
82
+ label={direction.label}
83
+ onClick={handleClick}
84
+ onFocus={handleFocus}
85
+ roleStructure="listoption"
86
+ text={direction.label}
87
+ />
88
+ );
89
+ };
90
+
62
91
  export function AutoPeakPickingOptionPanel() {
63
92
  const dispatch = useDispatch();
64
93
  const hasEnoughPoints = useCheckPointsNumberInSelectedSpectra();
65
94
  const toaster = useToaster();
66
95
  const nucleus = useActiveNucleusTab();
67
96
  const activeSpectra = useActiveSpectra();
68
-
69
97
  const { defaultPeakShape } = usePanelPreferences('peaks', nucleus);
70
- const {
71
- handleSubmit,
72
- formState: { isValid },
73
- control,
74
- } = useForm<AutoPeakPickingOptions>({
75
- defaultValues: INIT_VALUES,
76
- resolver: yupResolver(validationSchema),
77
- mode: 'onChange',
98
+ const isSpectraSelected = activeSpectra && activeSpectra.length > 0;
99
+
100
+ const form = useForm({
101
+ defaultValues,
102
+ validationLogic: revalidateLogic({ modeAfterSubmission: 'change' }),
103
+ onSubmit: ({ value }) => {
104
+ const parsedValues = validationSchema.parse(value);
105
+ handlePeakPicking(parsedValues);
106
+ },
107
+ validators: {
108
+ onDynamic: validationSchema,
109
+ },
78
110
  });
79
111
 
80
- function handlePeakPicking(values: any) {
112
+ function handlePeakPicking(values: AutoPeakPickingOptions) {
81
113
  if (hasEnoughPoints) {
82
114
  dispatch({
83
115
  type: 'AUTO_PEAK_PICKING',
@@ -94,69 +126,108 @@ export function AutoPeakPickingOptionPanel() {
94
126
  }
95
127
  }
96
128
 
97
- const isSpectraSelected = activeSpectra && activeSpectra.length > 0;
98
129
  return (
99
- <HeaderWrapper>
100
- <Label title="Direction:" shortTitle="" style={headerLabelStyle}>
101
- <Select2Controller control={control} name="direction" items={LookFor} />
102
- </Label>
103
- <Label
104
- title="Max number of peaks:"
105
- shortTitle="Max peaks:"
106
- style={headerLabelStyle}
107
- >
108
- <NumberInput2Controller
109
- control={control}
110
- name="maxNumberOfPeaks"
111
- min={1}
112
- stepSize={1}
113
- style={{ width: '60px' }}
114
- />
115
- </Label>
116
- <Label title="Noise factor:" shortTitle="Noise:" style={headerLabelStyle}>
117
- <NumberInput2Controller
118
- control={control}
119
- name="noiseFactor"
120
- min={0}
121
- stepSize={1}
122
- style={{ width: '60px' }}
123
- />
124
- </Label>
125
- <Label
126
- title="Min/max Ratio:"
127
- shortTitle="Ratio:"
128
- style={headerLabelStyle}
129
- >
130
- <NumberInput2Controller
131
- control={control}
132
- name="minMaxRatio"
133
- min={0}
134
- stepSize={0.01}
135
- majorStepSize={0.01}
136
- minorStepSize={0.01}
137
- style={{ width: '60px' }}
138
- debounceTime={500}
139
- />
140
- </Label>
141
- <Button
142
- intent="success"
143
- onClick={() => handleSubmit(handlePeakPicking)()}
144
- style={{ margin: '0 10px' }}
145
- disabled={!isValid || !isSpectraSelected}
146
- {...(!isSpectraSelected && {
147
- tooltipProps: {
148
- content: (
149
- <TooltipHelpContent
150
- title="Auto peak picking"
151
- description="Select a one or more spectra to enable auto peak picking"
152
- />
153
- ),
154
- intent: 'danger',
155
- },
156
- })}
157
- >
158
- Apply to {activeSpectra?.length} spectra
159
- </Button>
160
- </HeaderWrapper>
130
+ <AppFormContainer form={form}>
131
+ <form.AppField name="direction">
132
+ {(field) => {
133
+ const activeItem = LookFor.find(
134
+ (item) => item.value === field.state.value,
135
+ );
136
+
137
+ return (
138
+ <FormGroup label="Direction:" inline>
139
+ <Select<Item>
140
+ filterable={false}
141
+ items={LookFor}
142
+ itemRenderer={renderDirection}
143
+ activeItem={activeItem}
144
+ onItemSelect={(element) => {
145
+ field.handleChange(element.value);
146
+ }}
147
+ >
148
+ <Button
149
+ text={activeItem?.label}
150
+ endIcon="double-caret-vertical"
151
+ />
152
+ </Select>
153
+ </FormGroup>
154
+ );
155
+ }}
156
+ </form.AppField>
157
+
158
+ <form.AppField name="maxNumberOfPeaks">
159
+ {(field) => (
160
+ <FormGroup label="Max peaks:" inline>
161
+ <NumericInput
162
+ value={field.state.value ?? ''}
163
+ onBlur={field.handleBlur}
164
+ min={1}
165
+ style={{ width: '60px' }}
166
+ stepSize={1}
167
+ onValueChange={(_, valueAsString) => {
168
+ field.handleChange(valueAsString);
169
+ }}
170
+ />
171
+ </FormGroup>
172
+ )}
173
+ </form.AppField>
174
+
175
+ <form.AppField name="noiseFactor">
176
+ {(field) => (
177
+ <FormGroup label="Noise:" inline>
178
+ <NumericInput
179
+ value={field.state.value ?? ''}
180
+ onBlur={field.handleBlur}
181
+ min={1}
182
+ style={{ width: '60px' }}
183
+ stepSize={1}
184
+ onValueChange={(_, valueAsString) => {
185
+ field.handleChange(valueAsString);
186
+ }}
187
+ />
188
+ </FormGroup>
189
+ )}
190
+ </form.AppField>
191
+
192
+ <form.AppField name="minMaxRatio">
193
+ {(field) => (
194
+ <FormGroup label="Ratio:" inline>
195
+ <NumericInput
196
+ value={field.state.value ?? ''}
197
+ onBlur={field.handleBlur}
198
+ style={{ width: '60px' }}
199
+ min={0}
200
+ stepSize={0.01}
201
+ majorStepSize={0.01}
202
+ minorStepSize={0.01}
203
+ onValueChange={(_, valueAsString) => {
204
+ field.handleChange(valueAsString);
205
+ }}
206
+ />
207
+ </FormGroup>
208
+ )}
209
+ </form.AppField>
210
+
211
+ <div>
212
+ <form.SubmitButton
213
+ tooltipProps={
214
+ !isSpectraSelected
215
+ ? {
216
+ intent: 'danger',
217
+ content: (
218
+ <TooltipHelpContent
219
+ title="Auto peak picking"
220
+ description="Select a one or more spectra to enable auto peak picking"
221
+ />
222
+ ),
223
+ }
224
+ : undefined
225
+ }
226
+ intent={isSpectraSelected ? 'success' : 'danger'}
227
+ >
228
+ Apply to {activeSpectra?.length} spectra
229
+ </form.SubmitButton>
230
+ </div>
231
+ </AppFormContainer>
161
232
  );
162
233
  }
@@ -1,51 +1,47 @@
1
- import { Button, Checkbox } from '@blueprintjs/core';
2
- import { yupResolver } from '@hookform/resolvers/yup';
3
- import { useForm } from 'react-hook-form';
4
- import * as Yup from 'yup';
1
+ import { Checkbox, Classes, FormGroup, NumericInput } from '@blueprintjs/core';
2
+ import styled from '@emotion/styled';
3
+ import { revalidateLogic } from '@tanstack/react-form';
4
+ import { AppForm, useForm } from 'react-science/ui';
5
+ import { z } from 'zod';
5
6
 
6
7
  import { useDispatch } from '../context/DispatchContext.js';
7
8
  import { useToaster } from '../context/ToasterContext.js';
8
- import Label from '../elements/Label.js';
9
- import { NumberInput2Controller } from '../elements/NumberInput2Controller.js';
10
9
  import {
11
10
  MIN_AREA_POINTS,
12
11
  useCheckPointsNumberInWindowArea,
13
12
  } from '../hooks/useCheckPointsNumberInWindowArea.js';
14
13
 
15
- import { headerLabelStyle } from './Header.js';
16
- import { HeaderWrapper } from './HeaderWrapper.js';
17
-
18
- interface AutoRangesOptions {
19
- minMaxRatio: number;
20
- lookNegative: boolean;
21
- }
22
-
23
- const validationSchema = Yup.object().shape({
24
- minMaxRatio: Yup.number().min(0).required(),
25
- lookNegative: Yup.boolean().required(),
14
+ const validationZodSchema = z.object({
15
+ minMaxRatio: z.coerce.number<string>().min(0),
16
+ lookNegative: z.boolean(),
26
17
  });
27
18
 
28
- const initialValues: AutoRangesOptions = {
29
- minMaxRatio: 0.05,
19
+ const defaultValues: AutoRangesOptionsInput = {
20
+ minMaxRatio: '0.05',
30
21
  lookNegative: false,
31
22
  };
32
23
 
24
+ const AppFormContainer = styled(AppForm)`
25
+ display: flex;
26
+ flex-direction: row;
27
+ gap: 10px;
28
+ align-items: center;
29
+
30
+ .${Classes.CHECKBOX}, .${Classes.FORM_GROUP} {
31
+ margin-bottom: 0;
32
+ }
33
+ `;
34
+
35
+ type AutoRangesOptionsInput = z.input<typeof validationZodSchema>;
36
+ type AutoRangesOptions = z.output<typeof validationZodSchema>;
37
+
33
38
  function RangesPickingOptionPanel() {
34
39
  const dispatch = useDispatch();
35
- const {
36
- handleSubmit,
37
- register,
38
- control,
39
- formState: { isValid },
40
- } = useForm<AutoRangesOptions>({
41
- defaultValues: initialValues,
42
- resolver: yupResolver(validationSchema),
43
- mode: 'onChange',
44
- });
40
+
45
41
  const hasEnoughPoints = useCheckPointsNumberInWindowArea();
46
42
  const toaster = useToaster();
47
43
 
48
- function handleRangesPicking(values: any) {
44
+ function handleRangesPicking(values: AutoRangesOptions) {
49
45
  if (hasEnoughPoints) {
50
46
  dispatch({
51
47
  type: 'AUTO_RANGES_DETECTION',
@@ -59,37 +55,54 @@ function RangesPickingOptionPanel() {
59
55
  }
60
56
  }
61
57
 
58
+ const form = useForm({
59
+ defaultValues,
60
+ validationLogic: revalidateLogic({ modeAfterSubmission: 'change' }),
61
+ validators: {
62
+ onDynamic: validationZodSchema,
63
+ },
64
+ onSubmit: ({ value }) => {
65
+ const parsedValues = validationZodSchema.parse(value);
66
+ handleRangesPicking(parsedValues);
67
+ },
68
+ });
69
+
62
70
  return (
63
- <HeaderWrapper>
64
- <Label title="Detect negative" style={headerLabelStyle}>
65
- <Checkbox
66
- style={{ margin: 0 }}
67
- {...register(`lookNegative`)}
68
- defaultChecked={false}
69
- />
70
- </Label>
71
- <Label title="Min/max ratio:" style={headerLabelStyle}>
72
- <NumberInput2Controller
73
- control={control}
74
- name="minMaxRatio"
75
- min={0}
76
- stepSize={0.01}
77
- majorStepSize={0.01}
78
- minorStepSize={0.01}
79
- style={{ width: '70px' }}
80
- debounceTime={500}
81
- />
82
- </Label>
71
+ <AppFormContainer form={form}>
72
+ <form.AppField name="lookNegative">
73
+ {(field) => (
74
+ <Checkbox
75
+ label="Detect negative"
76
+ checked={field.state.value}
77
+ onBlur={field.handleBlur}
78
+ onChange={({ target: { checked } }) => field.handleChange(checked)}
79
+ />
80
+ )}
81
+ </form.AppField>
82
+
83
+ <form.AppField name="minMaxRatio">
84
+ {(field) => (
85
+ <FormGroup label="Min/max ratio:" inline>
86
+ <NumericInput
87
+ value={field.state.value ?? ''}
88
+ onBlur={field.handleBlur}
89
+ min={0}
90
+ stepSize={0.01}
91
+ minorStepSize={0.01}
92
+ onValueChange={(_, valueAsString) => {
93
+ field.handleChange(valueAsString);
94
+ }}
95
+ />
96
+ </FormGroup>
97
+ )}
98
+ </form.AppField>
83
99
 
84
- <Button
85
- intent="success"
86
- onClick={() => handleSubmit(handleRangesPicking)()}
87
- style={{ margin: '0 10px' }}
88
- disabled={!isValid}
89
- >
90
- Auto ranges picking
91
- </Button>
92
- </HeaderWrapper>
100
+ <div>
101
+ <form.SubmitButton intent="success">
102
+ Auto ranges picking
103
+ </form.SubmitButton>
104
+ </div>
105
+ </AppFormContainer>
93
106
  );
94
107
  }
95
108
 
@@ -0,0 +1,32 @@
1
+ import type { Jcoupling, Range, Signal1D } from '@zakodium/nmr-types';
2
+
3
+ import { useDispatch } from '../context/DispatchContext.tsx';
4
+
5
+ export function useAddMultipletSignal() {
6
+ const dispatch = useDispatch();
7
+
8
+ return (options: { range: Range; spectrumId?: string; delta: number }) => {
9
+ const { range, delta, spectrumId } = options;
10
+ const updatedRange = structuredClone(range);
11
+ const signal: Signal1D = {
12
+ id: crypto.randomUUID(),
13
+ delta,
14
+ js: [
15
+ {
16
+ multiplicity: 'm',
17
+ } as Jcoupling,
18
+ ],
19
+ kind: 'signal',
20
+ multiplicity: 'm',
21
+ };
22
+ updatedRange.signals.push(signal);
23
+
24
+ dispatch({
25
+ type: 'UPDATE_RANGE',
26
+ payload: {
27
+ range: updatedRange,
28
+ spectrumId,
29
+ },
30
+ });
31
+ };
32
+ }
@@ -1,4 +1,5 @@
1
1
  import type { Filter1DEntry, Filter2DEntry } from '@zakodium/nmr-types';
2
+ import type { Spectrum } from '@zakodium/nmrium-core';
2
3
  import { useMemo } from 'react';
3
4
 
4
5
  import type { ExtractFilterEntry } from '../../data/types/common/ExtractFilterEntry.js';
@@ -6,7 +7,7 @@ import type { FilterEntry } from '../../data/types/common/FilterEntry.js';
6
7
 
7
8
  import useSpectrum from './useSpectrum.js';
8
9
 
9
- const emptyData = { filters: [] };
10
+ const emptyData: Pick<Spectrum, 'filters'> = { filters: [] };
10
11
  type FilterReturnType<T> = T extends Filter1DEntry['name']
11
12
  ? ExtractFilterEntry<T>
12
13
  : T extends Filter2DEntry['name']
@@ -1,8 +1,14 @@
1
+ import type { Spectrum } from '@zakodium/nmrium-core';
2
+
1
3
  import { useChartData } from '../context/ChartContext.js';
2
4
 
3
5
  import { useSpectrumWithDataSource } from './useSpectrumWithDataSource.js';
4
6
 
5
- export default function useSpectrum(defaultValue: any = null) {
7
+ export default function useSpectrum<Default>(
8
+ defaultValue: Default,
9
+ ): Spectrum | Default;
10
+ export default function useSpectrum(): Spectrum | undefined;
11
+ export default function useSpectrum<Default>(defaultValue?: Default) {
6
12
  const { data } = useChartData();
7
13
  return useSpectrumWithDataSource(data, defaultValue);
8
14
  }
@@ -5,30 +5,38 @@ import { useInsetOptions } from '../1d/inset/InsetProvider.js';
5
5
 
6
6
  import { useActiveSpectrum } from './useActiveSpectrum.js';
7
7
 
8
- function getSpectrum(
8
+ function getSpectrum<Default>(
9
9
  data: Spectrum[],
10
10
  spectrumKey: string,
11
- defaultValue?: any,
11
+ defaultValue: Default,
12
12
  ) {
13
13
  return data.find((datum) => datum.id === spectrumKey) || defaultValue;
14
14
  }
15
15
 
16
- export function useSpectrumWithDataSource(
17
- dataSource: any,
18
- defaultValue: any = null,
16
+ export function useSpectrumWithDataSource<Default = Spectrum>(
17
+ dataSource: Spectrum[],
18
+ defaultValue: Default | null = null,
19
19
  ) {
20
20
  const activeSpectrum = useActiveSpectrum();
21
21
  const inset = useInsetOptions();
22
22
 
23
- return useMemo<Spectrum>(() => {
23
+ return useMemo<Spectrum | Default | null>(() => {
24
24
  if (!dataSource) return defaultValue;
25
25
 
26
26
  if (inset) {
27
- return getSpectrum(dataSource, inset.spectrumKey, defaultValue);
27
+ return getSpectrum<Default | null>(
28
+ dataSource,
29
+ inset.spectrumKey,
30
+ defaultValue,
31
+ );
28
32
  }
29
33
 
30
34
  if (dataSource && activeSpectrum?.selected) {
31
- return getSpectrum(dataSource, activeSpectrum.id, defaultValue);
35
+ return getSpectrum<Default | null>(
36
+ dataSource,
37
+ activeSpectrum.id,
38
+ defaultValue,
39
+ );
32
40
  }
33
41
 
34
42
  return defaultValue;
@@ -5,11 +5,5 @@ export function useTicksConfig() {
5
5
  const { current } = usePreferences();
6
6
  const axis = current.axis ?? workspaceDefaultProperties.axis;
7
7
 
8
- const { textStyle } = axis.primaryTicks;
9
- const { enabled } = axis.secondaryTicks;
10
-
11
- return {
12
- textStyle,
13
- isSecondaryEnabled: enabled,
14
- };
8
+ return axis;
15
9
  }
@@ -91,7 +91,7 @@ interface InnerPublicationStringModalProps {
91
91
  onClose: () => void;
92
92
 
93
93
  acsExportOptions: ACSExportOptions;
94
- spectrum: Spectrum;
94
+ spectrum: Spectrum | undefined;
95
95
  publicationStringVisibility?: {
96
96
  isShown: boolean;
97
97
  toggle: () => void;
@@ -150,7 +150,7 @@ function InnerPublicationStringModal(props: InnerPublicationStringModalProps) {
150
150
  defaultValues,
151
151
  validators: { onChange: validationSchema },
152
152
  onSubmit: ({ value, formApi }) => {
153
- assert(spectrum && isSpectrum1D(spectrum));
153
+ assert(isSpectrum1D(spectrum));
154
154
  const nucleus = spectrum.info.nucleus;
155
155
 
156
156
  const parsedValues = validationSchema.parse(value);
@@ -188,7 +188,7 @@ function InnerPublicationStringModal(props: InnerPublicationStringModalProps) {
188
188
  },
189
189
  });
190
190
 
191
- if (!spectrum || !isSpectrum1D(spectrum)) return null;
191
+ if (!isSpectrum1D(spectrum)) return null;
192
192
 
193
193
  return (
194
194
  <>