nmrium 0.52.0 → 0.54.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 (100) hide show
  1. package/lib/component/1d/Viewer1D.js +48 -17
  2. package/lib/component/1d/ranges/AssignmentLabel.d.ts +7 -0
  3. package/lib/component/1d/ranges/AssignmentLabel.js +10 -0
  4. package/lib/component/1d/ranges/Range.js +15 -6
  5. package/lib/component/1d/tool/XLabelPointer.js +4 -12
  6. package/lib/component/2d/tools/XYLabelPointer.js +3 -9
  7. package/lib/component/context/LoggerContext.js +11 -4
  8. package/lib/component/elements/CloseButton.d.ts +1 -1
  9. package/lib/component/elements/CustomToolTip.d.ts +8 -0
  10. package/lib/component/elements/CustomToolTip.js +107 -0
  11. package/lib/component/elements/EditableColumn.js +6 -5
  12. package/lib/component/elements/SaveButton.d.ts +1 -1
  13. package/lib/component/elements/formik/FormikError.js +2 -4
  14. package/lib/component/elements/formik/FormikInput.js +2 -2
  15. package/lib/component/header/Header.js +1 -1
  16. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
  17. package/lib/component/hooks/useActiveSpectrumRangesViewState.js +1 -0
  18. package/lib/component/hooks/useActiveSpectrumZonesViewState.js +1 -0
  19. package/lib/component/hooks/useToolsFunctions.js +7 -1
  20. package/lib/component/main/NMRiumStateProvider.js +12 -2
  21. package/lib/component/modal/AboutPredictionModal.js +1 -1
  22. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  23. package/lib/component/modal/CopyClipboardModal.js +1 -1
  24. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  25. package/lib/component/modal/ImportPublicationStringModal.d.ts +5 -3
  26. package/lib/component/modal/ImportPublicationStringModal.js +18 -9
  27. package/lib/component/modal/PredictSpectraModal.js +1 -1
  28. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  29. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  30. package/lib/component/modal/editRange/EditRangeModal.js +1 -1
  31. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +1 -1
  32. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +1 -1
  33. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  34. package/lib/component/modal/setting/GeneralSettings.js +12 -19
  35. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
  36. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
  37. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
  38. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
  39. package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
  40. package/lib/component/panels/RangesPanel/RangesHeader.js +29 -15
  41. package/lib/component/panels/RangesPanel/RangesPreferences.js +19 -13
  42. package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
  43. package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -1
  44. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.d.ts +7 -0
  45. package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentColumn.js +16 -0
  46. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
  47. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  48. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
  49. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
  50. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
  51. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
  52. package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
  53. package/lib/component/panels/ZonesPanel/ZonesPanel.js +4 -4
  54. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
  55. package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
  56. package/lib/component/panels/header/PreferencesHeader.js +1 -1
  57. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
  58. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
  59. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +8 -1
  60. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
  61. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +1 -1
  62. package/lib/component/reducer/Reducer.js +4 -0
  63. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
  64. package/lib/component/reducer/actions/FiltersActions.js +364 -318
  65. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  66. package/lib/component/reducer/actions/RangesActions.d.ts +9 -5
  67. package/lib/component/reducer/actions/RangesActions.js +31 -21
  68. package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
  69. package/lib/component/reducer/actions/SpectraActions.js +5 -1
  70. package/lib/component/reducer/actions/ToolsActions.js +13 -20
  71. package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
  72. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +6 -4
  73. package/lib/component/toolbar/ToolBar.js +112 -26
  74. package/lib/component/utility/export.js +1 -1
  75. package/lib/component/workspaces/workspaceDefaultProperties.js +7 -12
  76. package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
  77. package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
  78. package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
  79. package/lib/data/data1d/Spectrum1D/index.js +2 -2
  80. package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
  81. package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
  82. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
  83. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
  84. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
  85. package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
  86. package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
  87. package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
  88. package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
  89. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
  90. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
  91. package/lib/data/utilities/generateColor.d.ts +7 -3
  92. package/lib/data/utilities/generateColor.js +5 -17
  93. package/lib/versionInfo.js +1 -1
  94. package/package.json +29 -29
  95. package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
  96. package/lib/component/elements/MolecularFormulaInput.js +0 -63
  97. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
  98. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
  99. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
  100. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
@@ -1,12 +1,13 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
+ import { Select } from '@blueprintjs/select';
3
4
  import { css } from '@emotion/react';
4
5
  import debounce from 'lodash/debounce';
5
6
  import { Filters } from 'nmr-processing';
6
7
  import { useCallback, useEffect, useRef, useState } from 'react';
7
8
  import { FaRulerHorizontal, FaRulerVertical } from 'react-icons/fa';
8
9
  import { MdLooksTwo } from 'react-icons/md';
9
- import { Toolbar } from 'react-science/ui';
10
+ import { Button, Toolbar, useSelect } from 'react-science/ui';
10
11
  import { useActivePhaseTraces } from '../2d/1d-tracer/phase-correction-traces/useActivePhaseTraces';
11
12
  import { useDispatch } from '../context/DispatchContext';
12
13
  import ActionButtons from '../elements/ActionButtons';
@@ -17,6 +18,17 @@ import { useFilter } from '../hooks/useFilter';
17
18
  import useSpectrum from '../hooks/useSpectrum';
18
19
  import { headerLabelStyle } from './Header';
19
20
  import { HeaderContainer } from './HeaderContainer';
21
+ const defaultPhasingTypeItem = {
22
+ label: 'Manual',
23
+ value: 'manual',
24
+ };
25
+ const algorithms = [
26
+ defaultPhasingTypeItem,
27
+ {
28
+ label: 'Automatic',
29
+ value: 'automatic',
30
+ },
31
+ ];
20
32
  const inputStyle = {
21
33
  input: {
22
34
  width: '70px',
@@ -46,8 +58,12 @@ export default function PhaseCorrectionTwoDimensionsPanel() {
46
58
  const valueRef = useRef(defaultPhaseOptions);
47
59
  const ph0Ref = useRef();
48
60
  const ph1Ref = useRef();
61
+ const { value: phaseCorrectionTypeItem, ...defaultSelectProps } = useSelect({
62
+ defaultSelectedItem: defaultPhasingTypeItem,
63
+ itemTextKey: 'label',
64
+ });
49
65
  useEffect(() => {
50
- if (filter) {
66
+ if (filter && phaseCorrectionTypeItem?.value === 'manual') {
51
67
  const { value } = filter;
52
68
  const phaseOptions = defaultPhaseOptions;
53
69
  for (const direction of Object.keys(value)) {
@@ -57,7 +73,7 @@ export default function PhaseCorrectionTwoDimensionsPanel() {
57
73
  setValue(phaseOptions);
58
74
  valueRef.current = phaseOptions;
59
75
  }
60
- }, [filter]);
76
+ }, [filter, phaseCorrectionTypeItem?.value]);
61
77
  useEffect(() => {
62
78
  if (ph0Ref.current && ph1Ref.current) {
63
79
  const { ph0, ph1 } = valueRef.current[activeTraceDirection];
@@ -142,14 +158,29 @@ export default function PhaseCorrectionTwoDimensionsPanel() {
142
158
  });
143
159
  }
144
160
  function handleApplyFilter() {
145
- dispatch({ type: 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER' });
161
+ switch (phaseCorrectionTypeItem?.value) {
162
+ case 'automatic': {
163
+ dispatch({
164
+ type: 'APPLY_AUTO_PHASE_CORRECTION_TOW_DIMENSION_FILTER',
165
+ });
166
+ break;
167
+ }
168
+ case 'manual': {
169
+ dispatch({
170
+ type: 'APPLY_MANUAL_PHASE_CORRECTION_TOW_DIMENSION_FILTER',
171
+ });
172
+ break;
173
+ }
174
+ default:
175
+ break;
176
+ }
146
177
  }
147
178
  function handleToggleAddTraceToBothDirections() {
148
179
  dispatch({ type: 'TOGGLE_ADD_PHASE_CORRECTION_TRACE_TO_BOTH_DIRECTIONS' });
149
180
  }
150
- return (_jsxs(HeaderContainer, { style: { padding: '0 5px' }, children: [_jsx(Label, { title: "Direction:", style: headerLabelStyle, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { css: css `
151
- border: 1px solid #f7f7f7;
152
- `, title: "Horizontal", icon: _jsx(FaRulerHorizontal, {}), active: activeTraceDirection === 'horizontal', onClick: () => onChangeHandler('horizontal') }), _jsx(Toolbar.Item, { css: css `
153
- border: 1px solid #f7f7f7;
154
- `, title: "Vertical", icon: _jsx(FaRulerVertical, {}), active: activeTraceDirection === 'vertical', onClick: () => onChangeHandler('vertical') })] }) }), _jsx("div", { style: { paddingRight: '5px' }, children: _jsx(Toolbar, { children: _jsx(Toolbar.Item, { title: "Add the trace in both directions", icon: _jsx(MdLooksTwo, {}), active: addTracesToBothDirections, onClick: handleToggleAddTraceToBothDirections }) }) }), _jsx(Label, { title: "PH0:", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1:", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change PH0 (click and drag)", shortLabel: "Ph0", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change PH1 (click and drag)", shortLabel: "Ph1", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
181
+ return (_jsxs(HeaderContainer, { style: { padding: '0 5px' }, children: [_jsx("div", { style: { padding: '0 5px' }, children: _jsx(Select, { items: algorithms, filterable: false, itemsEqual: "value", ...defaultSelectProps, children: _jsx(Button, { text: phaseCorrectionTypeItem?.label, rightIcon: "double-caret-vertical" }) }) }), phaseCorrectionTypeItem?.value === 'manual' && (_jsxs(_Fragment, { children: [_jsx(Label, { title: "Direction:", style: headerLabelStyle, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { css: css `
182
+ border: 1px solid #f7f7f7;
183
+ `, tooltip: "Horizontal", icon: _jsx(FaRulerHorizontal, {}), active: activeTraceDirection === 'horizontal', onClick: () => onChangeHandler('horizontal') }), _jsx(Toolbar.Item, { css: css `
184
+ border: 1px solid #f7f7f7;
185
+ `, tooltip: "Vertical", icon: _jsx(FaRulerVertical, {}), active: activeTraceDirection === 'vertical', onClick: () => onChangeHandler('vertical') })] }) }), _jsx("div", { style: { paddingRight: '5px' }, children: _jsx(Toolbar, { children: _jsx(Toolbar.Item, { tooltip: "Add the trace in both directions", icon: _jsx(MdLooksTwo, {}), active: addTracesToBothDirections, onClick: handleToggleAddTraceToBothDirections }) }) }), _jsx(Label, { title: "PH0:", style: headerLabelStyle, children: _jsx(Input, { name: "ph0", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph0, type: "number", debounceTime: 250 }) }), _jsx(Label, { title: "PH1:", style: headerLabelStyle, children: _jsx(Input, { name: "ph1", style: inputStyle, onChange: handleInput, value: value[activeTraceDirection].ph1, type: "number", debounceTime: 250 }) }), _jsx(InputRange, { ref: ph0Ref, name: "ph0", label: "Change PH0 (click and drag)", shortLabel: "Ph0", style: { width: '20%' }, onChange: handleRangeChange }), _jsx(InputRange, { ref: ph1Ref, name: "ph1", label: "Change PH1 (click and drag)", shortLabel: "Ph1", style: { width: '20%' }, onChange: handleRangeChange })] })), _jsx(ActionButtons, { onDone: handleApplyFilter, onCancel: handleCancelFilter })] }));
155
186
  }
@@ -8,6 +8,7 @@ export const defaultRangesViewState = {
8
8
  showJGraph: false,
9
9
  displayingMode: 'spread',
10
10
  integralsScaleRatio: 1,
11
+ showAssignmentsLabels: false,
11
12
  };
12
13
  export function useActiveSpectrumRangesViewState() {
13
14
  const activeSpectrum = useActiveSpectrum();
@@ -4,6 +4,7 @@ export const defaultZonesViewState = {
4
4
  showPeaks: true,
5
5
  showSignals: true,
6
6
  showZones: true,
7
+ showAssignmentsLabels: false,
7
8
  };
8
9
  export function useActiveSpectrumZonesViewState() {
9
10
  const activeSpectrum = useActiveSpectrum();
@@ -2,6 +2,7 @@ import lodashDebounce from 'lodash/debounce';
2
2
  import lodashMap from 'lodash/map';
3
3
  import { useCallback, useRef, useState } from 'react';
4
4
  import { useToggleAccordion } from 'react-science/ui';
5
+ import { useChartData } from '../context/ChartContext';
5
6
  import { useDispatch } from '../context/DispatchContext';
6
7
  import { usePreferences } from '../context/PreferencesContext';
7
8
  import { useToaster } from '../context/ToasterContext';
@@ -14,7 +15,12 @@ export default function useToolsFunctions() {
14
15
  const [isRealSpectrumShown, setIsRealSpectrumShown] = useState(false);
15
16
  const debounceClickEventsRef = useRef({ clicks: [] });
16
17
  const { current: { general: { invert }, }, } = usePreferences();
18
+ const { toolOptions: { selectedTool: previousSelectedTool }, } = useChartData();
17
19
  const handleChangeOption = useCallback((selectedTool) => {
20
+ //avoid reselecting the tool if it's already selected
21
+ if (selectedTool === previousSelectedTool) {
22
+ return;
23
+ }
18
24
  if ([
19
25
  options.peakPicking.id,
20
26
  options.integral.id,
@@ -33,7 +39,7 @@ export default function useToolsFunctions() {
33
39
  type: 'SET_SELECTED_TOOL',
34
40
  payload: { selectedTool: selectedTool || options.zoom.id },
35
41
  });
36
- }, [dispatch, invert, openPanel, toaster]);
42
+ }, [dispatch, invert, openPanel, previousSelectedTool, toaster]);
37
43
  const handleFullZoomOut = useCallback(() => {
38
44
  if (debounceClickEventsRef.current.clicks.length === 0) {
39
45
  dispatch({
@@ -15,6 +15,7 @@ export default function NMRiumStateProvider(props) {
15
15
  const { children, onChange, nmriumData = defaultData } = props;
16
16
  const { logger } = useLogger();
17
17
  const preferencesState = usePreferences();
18
+ const { dispatch: dispatchPreferences } = preferencesState;
18
19
  const [state, dispatchRaw] = useReducer(spectrumReducer, initialState, initState);
19
20
  const dispatch = useCallback((action) => {
20
21
  logger.trace({ action }, `Dispatch main reducer action: ${action.type}`);
@@ -60,15 +61,24 @@ export default function NMRiumStateProvider(props) {
60
61
  if (nmriumData) {
61
62
  void readNMRiumObject(nmriumData)
62
63
  .then((nmriumState) => {
64
+ if (nmriumState?.settings) {
65
+ dispatchPreferences({
66
+ type: 'SET_WORKSPACE',
67
+ payload: {
68
+ data: nmriumState.settings,
69
+ workspaceSource: 'nmriumFile',
70
+ },
71
+ });
72
+ }
63
73
  dispatch({ type: 'INITIATE', payload: { nmriumState } });
64
74
  })
65
75
  .catch((error) => {
66
76
  dispatch({ type: 'SET_LOADING_FLAG', payload: { isLoading: false } });
67
77
  // eslint-disable-next-line no-alert
68
- alert(error.message);
78
+ window.alert(error.message);
69
79
  reportError(error);
70
80
  });
71
81
  }
72
- }, [nmriumData, dispatch]);
82
+ }, [nmriumData, dispatch, dispatchPreferences]);
73
83
  return (_jsx(DispatchProvider, { value: dispatch, children: _jsx(ChartDataProvider, { value: state, children: children }) }));
74
84
  }
@@ -40,6 +40,6 @@ const styles = css `
40
40
  `;
41
41
  function AboutPredictionModal() {
42
42
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
43
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaInfo, {}), onClick: openDialog, title: "About prediction" }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About prediction", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }));
43
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaInfo, {}), onClick: openDialog, tooltip: "About prediction" }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About prediction", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsxs("ul", { children: [_jsxs("li", { children: ["Damiano Banfi and Luc Patiny", ' ', _jsx("a", { href: "http://dx.doi.org/10.2533/chimia.2008.280", target: "_blank", rel: "noreferrer", children: "www.nmrdb.org: Resurrecting and processing NMR spectra on-line" }), ' ', _jsx("i", { children: "Chimia" }), ", ", _jsx("b", { children: "2008" }), ", 62(4), 280-281."] }), _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "1" }), "H NMR prediction is possible thanks to the tool of the FCT-Universidade NOVA de Lisboa developed by Yuri Binev and Joao Aires-de-Sousa:"] }), _jsxs("ul", { children: [_jsxs("li", { children: ["Yuri Binev, Maria M. B. Marques and Jo\u00E3o Aires-de-Sousa", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ci700172n", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR coupling constants with associative neural networks trained for chemical shifts"] }), ' ', _jsx("i", { children: "J. Chem. Inf. Model." }), " ", _jsx("b", { children: "2007" }), ", 47(6), 2089-2097."] }), _jsxs("li", { children: ["Jo\u00E3o Aires-de-Sousa, Markus C. Hemmer and Johann Gasteiger", ' ', _jsxs("a", { href: "http://dx.doi.org/10.1021/ac010737m", target: "_blank", rel: "noreferrer", children: ["Prediction of ", _jsx("sup", { children: "1" }), "H NMR Chemical Shifts Using Neural Networks"] }), ", ", _jsx("i", { children: "Analytical Chemistry" }), ", ", _jsx("b", { children: "2002" }), ", 74(1), 80-90."] })] }), _jsxs("p", { children: [_jsx("sup", { children: "13" }), "C NMR prediction was possible thanks to NMRshiftDB:"] }), _jsx("ul", { children: _jsxs("li", { children: ["Steinbeck, Christoph, Stefan Krause, and Stefan Kuhn", ' ', _jsx("a", { href: "http://dx.doi.org/10.1021/ci0341363", target: "_blank", rel: "noreferrer", children: "NMRShiftDB Constructing a Free Chemical Information System with Open-Source Components" }), ' ', _jsx("i", { children: "Journal of chemical information and computer sciences" }), ",", ' ', _jsx("b", { children: "2003" }), ", 43(6): 1733-1739."] }) })] }) })] }));
44
44
  }
45
45
  export default AboutPredictionModal;
@@ -40,6 +40,6 @@ const styles = css `
40
40
  `;
41
41
  function AboutSpectrumSimulationModal() {
42
42
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
43
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, title: "About prediction", icon: _jsx(FaInfo, {}) }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About spectrum simulation", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }));
43
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { onClick: openDialog, tooltip: "About prediction", icon: _jsx(FaInfo, {}) }) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, title: "About spectrum simulation", style: { width: '600px' }, children: _jsxs(DialogBody, { css: styles, children: [_jsx("p", { children: "If you are using our tools please cite us:" }), _jsx("ul", { children: _jsxs("li", { children: ["Andr\u00E9s M. Castillo, Luc Patiny and Julien Wist", ' ', _jsx("a", { href: "http://dx.doi.org/10.1016/j.jmr.2010.12.008", target: "_blank", rel: "noreferrer", children: "Fast and Accurate Algorithm for the Simulation of NMR spectra of Large Spin Systems" }), ' ', _jsx("i", { children: "Journal of Magnetic Resonance" }), " ", _jsx("b", { children: "2011" }), ", 209(2), 123-130."] }) })] }) })] }));
44
44
  }
45
45
  export default AboutSpectrumSimulationModal;
@@ -32,7 +32,7 @@ const styles = css `
32
32
  }
33
33
  `;
34
34
  function CopyClipboardModal({ text, onClose, onCopyClick, }) {
35
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "main-buttons-container handle", children: [_jsx("button", { type: "button", onClick: () => onCopyClick(text), children: _jsx(FaCopy, {}) }), _jsx(CloseButton, { title: "Close", onClick: onClose })] }), _jsx("div", { className: "inner-container",
35
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "main-buttons-container handle", children: [_jsx("button", { type: "button", onClick: () => onCopyClick(text), children: _jsx(FaCopy, {}) }), _jsx(CloseButton, { tooltip: "Close", onClick: onClose })] }), _jsx("div", { className: "inner-container",
36
36
  // eslint-disable-next-line react/no-danger
37
37
  dangerouslySetInnerHTML: { __html: text } })] }));
38
38
  }
@@ -79,6 +79,6 @@ function EditPeakShapeModal({ onClose = () => null, peak, peaksPreferences, }) {
79
79
  }, [dispatch, onClose, peak.id]);
80
80
  const values = getValues(peak, kind);
81
81
  const valuePPM = formatNumber(peak.x, peaksPreferences.deltaPPM.format);
82
- return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { title: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Kind:", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "FWHM:", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "Mu:", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
82
+ return (_jsxs("div", { css: [ModalStyles, styles], children: [_jsxs("div", { className: "header handle", children: [_jsxs("span", { children: [`Peak Shape Edition ( ${valuePPM} PPM)`, " "] }), _jsx(CloseButton, { tooltip: "Close", onClick: () => onClose?.(), className: "close-bt" })] }), _jsx("div", { className: "inner-content", children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: values, validationSchema: validation(kind), onSubmit: changePeakShapeHandler, children: _jsxs(_Fragment, { children: [_jsx(Label, { title: "Kind:", style: labelStyle, children: _jsx(Select, { items: KINDS, style: { margin: 0, height: 30 }, value: kind, onChange: (kind) => setKind(kind) }) }), _jsx(Label, { title: "FWHM:", style: labelStyle, children: _jsx(FormikInput, { name: "fwhm", style: inputStyle }) }), kind === 'pseudoVoigt' && (_jsx(Label, { title: "Mu:", style: labelStyle, children: _jsx(FormikInput, { name: "mu", style: inputStyle }) }))] }) }) }), _jsx("div", { className: "footer-container", children: _jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current.submitForm(), doneLabel: "Save", onCancel: () => onClose?.() }) })] }));
83
83
  }
84
84
  export default EditPeakShapeModal;
@@ -1,6 +1,8 @@
1
- interface ImportPublicationStringModalProps {
1
+ interface InnerImportPublicationStringModalProps {
2
2
  onClose: () => void;
3
+ }
4
+ interface ImportPublicationStringModalProps extends InnerImportPublicationStringModalProps {
3
5
  isOpen: boolean;
4
6
  }
5
- declare function ImportPublicationStringModal(props: ImportPublicationStringModalProps): import("react/jsx-runtime").JSX.Element | undefined;
6
- export default ImportPublicationStringModal;
7
+ export declare function ImportPublicationStringModal(props: ImportPublicationStringModalProps): import("react/jsx-runtime").JSX.Element | undefined;
8
+ export {};
@@ -4,7 +4,7 @@ import { FifoLogger } from 'fifo-logger';
4
4
  import { Formik } from 'formik';
5
5
  import debounce from 'lodash/debounce';
6
6
  import { resurrect } from 'nmr-processing';
7
- import { useMemo, useRef, useState } from 'react';
7
+ import { useEffect, useMemo, useRef, useState } from 'react';
8
8
  import * as yup from 'yup';
9
9
  import { useDispatch } from '../context/DispatchContext';
10
10
  import { useToaster } from '../context/ToasterContext';
@@ -29,17 +29,29 @@ function handleRowStyle(data) {
29
29
  const INITIAL_VALUES = {
30
30
  publicationText: '1H NMR (CDCl3, 400MHz) δ 10.58 (b, 1H), 7.40 (d, 1H, J = 8.0 Hz), 6.19 (d, 1H, J = 7.6 Hz), 4.88 (s, 1H), 2.17 (s, 3H), 1.02 (s, 9H), 1.01 (s, 9H), 0.89 (s, 9H)',
31
31
  };
32
- function ImportPublicationStringModal(props) {
32
+ export function ImportPublicationStringModal(props) {
33
33
  const { onClose, isOpen } = props;
34
+ if (!isOpen)
35
+ return;
36
+ return _jsx(InnerImportPublicationStringModal, { onClose: onClose });
37
+ }
38
+ function InnerImportPublicationStringModal(props) {
39
+ const { onClose } = props;
34
40
  const formRef = useRef();
35
41
  const dispatch = useDispatch();
36
42
  const toaster = useToaster();
37
43
  const [logs, setLogs] = useState([]);
38
- const loggerRef = useRef(new FifoLogger({
39
- onChange: (log, logs) => {
44
+ const loggerRef = useRef(new FifoLogger());
45
+ useEffect(() => {
46
+ function handleLogs({ detail: { logs } }) {
40
47
  setLogs(logs.slice());
41
- },
42
- }));
48
+ }
49
+ const loggerInstance = loggerRef.current;
50
+ loggerInstance.addEventListener('change', handleLogs);
51
+ return () => {
52
+ loggerInstance.removeEventListener('change', handleLogs);
53
+ };
54
+ }, []);
43
55
  const COLUMNS = useMemo(() => [
44
56
  {
45
57
  Header: '#',
@@ -59,8 +71,6 @@ function ImportPublicationStringModal(props) {
59
71
  const debounceChanges = useMemo(() => debounce((value) => {
60
72
  resurrect(value, { logger: loggerRef.current });
61
73
  }, 250), []);
62
- if (!isOpen)
63
- return;
64
74
  function publicationStringHandler({ publicationText }) {
65
75
  void (async () => {
66
76
  const hideLoading = toaster.showLoading({
@@ -103,4 +113,3 @@ function ImportPublicationStringModal(props) {
103
113
  padding: '15px',
104
114
  }, name: "publicationText", className: "text-area", placeholder: "Enter publication string", onChange: handleOnChange })] }), _jsx(GroupPane, { text: "Logs", children: _jsx(ReactTable, { columns: COLUMNS, data: logs, emptyDataRowText: "No Logs", rowStyle: handleRowStyle, style: { height: '120px' } }) })] }) }), _jsx(DialogFooter, { children: _jsx("div", { style: { display: 'flex', flexDirection: 'row-reverse' }, children: _jsx(Button.Done, { onClick: () => formRef.current.submitForm(), disabled: isNotValid || !isValid, children: "Generate spectrum" }) }) })] })) }) }));
105
115
  }
106
- export default ImportPublicationStringModal;
@@ -107,7 +107,7 @@ export function PredictSpectraModal({ onClose = () => null, molecule, }) {
107
107
  dispatch,
108
108
  logger,
109
109
  ]);
110
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(SvgNmrFt, {}), title: "Predict spectra", onClick: openDialog }) }), _jsxs(Dialog, { isOpen: isOpenDialog, onClose: () => {
110
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { children: _jsx(Toolbar.Item, { icon: _jsx(SvgNmrFt, {}), tooltip: "Predict spectra", onClick: openDialog }) }), _jsxs(Dialog, { isOpen: isOpenDialog, onClose: () => {
111
111
  onClose();
112
112
  closeDialog();
113
113
  }, style: { width: 600, maxWidth: 1000 }, title: "Prediction of NMR spectrum", children: [_jsxs(DialogBody, { css: styles, children: [_jsx(PredictionPreferences, { onSubmit: submitHandler, options: initValues, ref: refForm }), _jsx("p", { className: "warning", children: "In order to predict spectra we are calling an external service and the chemical structure will leave your browser! You should never predict spectra for confidential molecules." }), _jsx("div", { className: "warning-container", children: _jsx(Checkbox, { onChange: (value) => setApproved(value.target.checked), checked: isApproved, label: "I confirm that the chemical structure is not confidential." }) })] }), _jsx(DialogFooter, { className: "footer-container", children: _jsx(Button.Done, { onClick: handleSave, disabled: !isApproved, children: "Predict spectrum" }) })] })] }));
@@ -70,7 +70,7 @@ const styles = css `
70
70
  `;
71
71
  function AboutUsModal() {
72
72
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
73
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { onClick: openDialog, id: "logo", title: "About NMRium", icon: _jsx(SvgLogoNmrium, {}) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, style: {
73
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { onClick: openDialog, id: "logo", tooltip: "About NMRium", icon: _jsx(SvgLogoNmrium, {}) }), _jsx(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, style: {
74
74
  maxWidth: 1000,
75
75
  width: '40vw',
76
76
  minWidth: '500px',
@@ -6,7 +6,7 @@ import { ChangeSumModalContents, } from './ChangeSumModalContents';
6
6
  export default function ChangeSumModal(props) {
7
7
  const { disabled = false, currentSum, sumType, ...otherProps } = props;
8
8
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
9
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgNmrSum, {}), title: currentSum
9
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { disabled: disabled, icon: _jsx(SvgNmrSum, {}), tooltip: currentSum
10
10
  ? `Change ${sumType} sum (${currentSum.toFixed(2)})`
11
11
  : `Change ${sumType} sum`, onClick: openDialog }), isOpenDialog && (_jsx(Dialog, { isOpen: true, onClose: closeDialog, style: { width: 500, height: 400 }, title: currentSum
12
12
  ? `Set new ${sumType} sum (Current: ${currentSum.toFixed(2)})`
@@ -154,7 +154,7 @@ function EditRangeModal({ onSave, onClose, onZoom, onRest, rangeId, }) {
154
154
  if (!rangesPreferences || !range) {
155
155
  return;
156
156
  }
157
- return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and Exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsContent, { range: range }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
157
+ return (_jsxs("div", { css: styles, children: [_jsxs("div", { className: "header handle", children: [_jsx(Button.Action, { onClick: handleOnZoom, fill: "outline", style: { fontSize: '14' }, color: { base: '#5f5f5f', hover: 'white' }, children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { className: "title", children: ` Range and Signal edition: ${formatNumber(range?.from, rangesPreferences.from.format)} ppm to ${formatNumber(range?.to, rangesPreferences.to.format)} ppm` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), tooltip: "Save and Exit" }), _jsx(CloseButton, { tooltip: "Close", onClick: handleOnClose })] }), _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: editRangeFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsx(SignalsContent, { range: range }), _jsx(FormikOnChange, { onChange: changeHandler })] }) })] }));
158
158
  }
159
159
  function useRange(rangeId) {
160
160
  const { ranges } = useSpectrum({
@@ -126,7 +126,7 @@ export function SignalJCouplingsTable(props) {
126
126
  function handleActiveRow(row) {
127
127
  return row?.index === lastSelectedCouplingIndex;
128
128
  }
129
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: { padding: '5px 0', display: 'flex' }, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaPlus, {}), title: "Add a new J coupling", intent: "success", onClick: () => addHandler(jCouplings) }), _jsx(Toolbar.Item, { icon: _jsx(FaRegTrashAlt, {}), title: "Delete all J couplings", intent: "danger", onClick: deleteAllHandler })] }) }), _jsx("div", { style: {
129
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: { padding: '5px 0', display: 'flex' }, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaPlus, {}), tooltip: "Add a new J coupling", intent: "success", onClick: () => addHandler(jCouplings) }), _jsx(Toolbar.Item, { icon: _jsx(FaRegTrashAlt, {}), tooltip: "Delete all J couplings", intent: "danger", onClick: deleteAllHandler })] }) }), _jsx("div", { style: {
130
130
  maxHeight: '300px',
131
131
  overflow: 'auto',
132
132
  }, children: _jsx(ReactTable, { data: jCouplings, columns: COLUMNS, onClick: (e, rowData) => selectRowHandler(rowData.index), activeRow: handleActiveRow, emptyDataRowText: "No J Couplings" }) })] }));
@@ -134,7 +134,7 @@ export function SignalPeaksTable(props) {
134
134
  function handleActiveRow(row) {
135
135
  return row?.index === lastSelectedPeakIndex;
136
136
  }
137
- return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: { padding: '5px 0', display: 'flex' }, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaPlus, {}), title: "Add a new peak", intent: "success", onClick: () => addHandler(peaks) }), _jsx(Toolbar.Item, { icon: _jsx(FaRegTrashAlt, {}), title: "Delete all peaks", intent: "danger", onClick: deleteAllHandler })] }) }), _jsx("div", { style: {
137
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsx("div", { style: { padding: '5px 0', display: 'flex' }, children: _jsxs(Toolbar, { children: [_jsx(Toolbar.Item, { icon: _jsx(FaPlus, {}), tooltip: "Add a new peak", intent: "success", onClick: () => addHandler(peaks) }), _jsx(Toolbar.Item, { icon: _jsx(FaRegTrashAlt, {}), tooltip: "Delete all peaks", intent: "danger", onClick: deleteAllHandler })] }) }), _jsx("div", { style: {
138
138
  maxHeight: '300px',
139
139
  overflow: 'auto',
140
140
  }, children: _jsx(ReactTable, { data: peaks, columns: COLUMNS, onClick: (e, rowData) => selectRowHandler(rowData.index), activeRow: handleActiveRow, emptyDataRowText: "No peaks" }) })] }));
@@ -96,6 +96,6 @@ function EditZoneModal({ onSaveEditZoneModal = () => null, onCloseEditZoneModal
96
96
  }),
97
97
  };
98
98
  }, [rowData.signals, rowData.tableMetaInfo.experiment]);
99
- return (_jsx("div", { css: styles, children: _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: zoneFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "header handle", children: [_jsx(Button, { onClick: handleOnZoom, className: "zoom-button", children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { children: `Zone and Signal edition` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), title: "Save and exit" }), _jsx(CloseButton, { title: "Close", onClick: handleOnClose })] }), _jsx(SignalsForm, {})] }) }) }));
99
+ return (_jsx("div", { css: styles, children: _jsx(Formik, { innerRef: formRef, initialValues: data, validationSchema: zoneFormValidation, onSubmit: handleOnSave, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: "header handle", children: [_jsx(Button, { onClick: handleOnZoom, className: "zoom-button", children: _jsx(FaSearchPlus, { title: "Set to default view on range in spectrum" }) }), _jsx("span", { children: `Zone and Signal edition` }), _jsx(SaveButton, { onClick: () => formRef.current.submitForm(), tooltip: "Save and exit" }), _jsx(CloseButton, { tooltip: "Close", onClick: handleOnClose })] }), _jsx(SignalsForm, {})] }) }) }));
100
100
  }
101
101
  export default EditZoneModal;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
2
  /** @jsxImportSource @emotion/react */
3
- import { Dialog, DialogBody, DialogFooter, Classes } from '@blueprintjs/core';
3
+ import { Dialog, DialogBody, DialogFooter, Classes, Tabs, Tab, } from '@blueprintjs/core';
4
4
  import { css } from '@emotion/react';
5
5
  import { Formik } from 'formik';
6
6
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
@@ -13,8 +13,6 @@ import { useToaster } from '../../context/ToasterContext';
13
13
  import ActionButtons from '../../elements/ActionButtons';
14
14
  import Button from '../../elements/Button';
15
15
  import Label from '../../elements/Label';
16
- import Tab from '../../elements/Tab/Tab';
17
- import Tabs, { PositionsEnum } from '../../elements/Tab/Tabs';
18
16
  import DropDownButton from '../../elements/dropDownButton/DropDownButton';
19
17
  import { useSaveSettings } from '../../hooks/useSaveSettings';
20
18
  import { getPreferencesByWorkspace } from '../../reducer/preferences/utilities/getPreferencesByWorkspace';
@@ -31,10 +29,6 @@ import SpectraColorsTabContent from './settings-tabs/SpectraColorsTabContent';
31
29
  import ToolsTabContent from './settings-tabs/ToolsTabContent';
32
30
  import { validation } from './settingsValidation';
33
31
  const styles = css `
34
- .tab-content {
35
- width: 100%;
36
- }
37
-
38
32
  .section-header {
39
33
  font-size: 13px;
40
34
  color: #2ca8ff;
@@ -64,12 +58,6 @@ const styles = css `
64
58
  width: 260px;
65
59
  }
66
60
  }
67
-
68
- .inner-content {
69
- padding: 15px 30px;
70
- width: 100%;
71
- overflow: auto;
72
- }
73
61
  `;
74
62
  function isRestButtonDisable(currentWorkspaceSetting, workspaceName, customWorkspaces) {
75
63
  if (!PredefinedWorkspaces[workspaceName] &&
@@ -83,7 +71,6 @@ function isRestButtonDisable(currentWorkspaceSetting, workspaceName, customWorks
83
71
  }
84
72
  function GeneralSettingsModal({ height }) {
85
73
  const [isOpenDialog, openDialog, closeDialog] = useOnOff(false);
86
- const [activeTab, setActiveTab] = useState('general');
87
74
  const { dispatch, current: currentWorkspace, originalWorkspaces, ...preferences } = usePreferences();
88
75
  const { saveSettings, SaveSettingsModal } = useSaveSettings();
89
76
  const toaster = useToaster();
@@ -108,9 +95,6 @@ function GeneralSettingsModal({ height }) {
108
95
  saveSettings(values);
109
96
  closeDialog?.();
110
97
  }
111
- const tabChangeHandler = useCallback((tab) => {
112
- setActiveTab(tab.tabid);
113
- }, []);
114
98
  function addWorkSpaceHandler(name) {
115
99
  dispatch({
116
100
  type: 'ADD_WORKSPACE',
@@ -204,7 +188,7 @@ function GeneralSettingsModal({ height }) {
204
188
  function handlePastWorkspaceAction() {
205
189
  void readText().then(handlePastWorkspace);
206
190
  }
207
- return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, title: "General settings", icon: _jsx(FaWrench, {}) }), _jsxs(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, style: { maxWidth: 1000, width: '50vw', minWidth: 800 }, title: "General settings", icon: "cog", children: [_jsx("div", { children: _jsxs("div", { className: Classes.DIALOG_HEADER, style: {
191
+ return (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { id: "general-settings", onClick: openDialog, tooltip: "General settings", icon: _jsx(FaWrench, {}) }), _jsxs(Dialog, { isOpen: isOpenDialog, onClose: closeDialog, style: { maxWidth: 1000, width: '50vw', minWidth: 800 }, title: "General settings", icon: "cog", children: [_jsx("div", { children: _jsxs("div", { className: Classes.DIALOG_HEADER, style: {
208
192
  cursor: 'default',
209
193
  paddingTop: '10px',
210
194
  boxShadow: 'none',
@@ -218,7 +202,16 @@ function GeneralSettingsModal({ height }) {
218
202
  }, children: _jsx(FaPaste, {}) })] }) }), _jsx(DialogBody, { css: css `
219
203
  padding: 0;
220
204
  background-color: white;
221
- `, children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { position: PositionsEnum.LEFT, activeTab: activeTab, onClick: tabChangeHandler, children: [_jsx(Tab, { title: "General", tabid: "general", children: _jsx("div", { className: "inner-content", children: _jsx(GeneralTabContent, {}) }) }), _jsx(Tab, { title: "Formatting", tabid: "formatting", children: _jsx("div", { className: "inner-content", children: _jsx(FormattingTabContent, {}) }) }), _jsx(Tab, { title: "Panels", tabid: "display", children: _jsx("div", { className: "inner-content", children: _jsx(DisplayTabContent, {}) }) }), _jsx(Tab, { title: "Tools", tabid: "tools", children: _jsx("div", { className: "inner-content", children: _jsx(ToolsTabContent, {}) }) }), _jsx(Tab, { title: "Databases", tabid: "databases", children: _jsx("div", { className: "inner-content", children: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }) }), _jsx(Tab, { title: "Import filters", tabid: "importation-filters", children: _jsx("div", { className: "inner-content", children: _jsx(ImportationFiltersTabContent, {}) }) }), _jsx(Tab, { title: "Title block", tabid: "title-block", children: _jsx("div", { className: "inner-content", children: _jsx(InfoBlockTabContent, {}) }) }), _jsx(Tab, { title: "Auto processing", tabid: "on-load-processing", children: _jsx("div", { className: "inner-content", children: _jsx(OnLoadProcessingTabContent, {}) }) }), _jsx(Tab, { title: "Spectra colors", tabid: "spectra-colors", children: _jsx("div", { className: "inner-content", children: _jsx(SpectraColorsTabContent, {}) }) })] }) }) }) }), _jsx(DialogFooter, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
205
+ `, children: _jsx("div", { css: styles, style: { height }, children: _jsx(Formik, { enableReinitialize: true, innerRef: refForm, initialValues: currentWorkspace, validationSchema: validation, onSubmit: submitHandler, validate: handleDisabledRestButton, children: _jsxs(Tabs, { vertical: true, css: css `
206
+ height: 100%;
207
+
208
+ div[role='tabpanel'] {
209
+ width: 100%;
210
+ padding: 0.8rem;
211
+ overflow: auto;
212
+ max-height: 100%;
213
+ }
214
+ `, fill: true, children: [_jsx(Tab, { title: "General", id: "general", panel: _jsx(GeneralTabContent, {}) }), _jsx(Tab, { title: "Formatting", id: "formatting", panel: _jsx(FormattingTabContent, {}) }), _jsx(Tab, { title: "Panels", id: "display", panel: _jsx(DisplayTabContent, {}) }), _jsx(Tab, { title: "Tools", id: "tools", panel: _jsx(ToolsTabContent, {}) }), _jsx(Tab, { title: "Databases", id: "databases", panel: _jsx(DatabasesTabContent, { currentWorkspace: workspaceName, originalWorkspaces: originalWorkspaces }) }), _jsx(Tab, { title: "Import filters", id: "importation-filters", panel: _jsx(ImportationFiltersTabContent, {}) }), _jsx(Tab, { title: "Title block", id: "title-block", panel: _jsx(InfoBlockTabContent, {}) }), _jsx(Tab, { title: "Auto processing", id: "on-load-processing", panel: _jsx(OnLoadProcessingTabContent, {}) }), _jsx(Tab, { title: "Spectra colors", id: "spectra-colors", panel: _jsx(SpectraColorsTabContent, {}) })] }) }) }) }), _jsx(DialogFooter, { children: _jsxs("div", { style: { display: 'flex', justifyContent: 'flex-end' }, children: [_jsx(ActionButtons, { style: { flexDirection: 'row-reverse', margin: 0 }, onDone: () => refForm.current?.submitForm(), doneLabel: "Apply and Save", onCancel: () => {
222
215
  closeDialog?.();
223
216
  } }), _jsx(Button.Secondary, { style: { margin: '0 10px' }, onClick: applyPreferencesHandler, children: "Apply" })] }) })] }), _jsx(SaveSettingsModal, {}), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePastWorkspace, text: text, label: "Workspace" })] }));
224
217
  }
@@ -27,13 +27,13 @@ function AutomaticAssignment() {
27
27
  },
28
28
  {
29
29
  icon: _jsx(SvgNmrAssignment2, {}),
30
- title: 'Automatic assignment',
30
+ tooltip: 'Automatic assignment',
31
31
  onClick: getAssignments,
32
32
  disabled: !enabled,
33
33
  },
34
34
  {
35
35
  icon: _jsx(FaBolt, {}),
36
- title: 'Reset assignment',
36
+ tooltip: 'Reset assignment',
37
37
  onClick: restAssignments,
38
38
  },
39
39
  ] }), _jsx("div", { className: "inner-container", children: _jsx(AutomaticAssignmentTable, { data: assignments }) })] }));
@@ -94,13 +94,13 @@ function IntegralPanelInner({ integrals, info, activeTab, xDomain, }) {
94
94
  },
95
95
  {
96
96
  icon: _jsx(ImLink, {}),
97
- title: 'Fixed integration values',
97
+ tooltip: 'Fixed integration values',
98
98
  onClick: toggleConstantSumHandler,
99
99
  active: integrals?.options?.isSumConstant || false,
100
100
  },
101
101
  {
102
102
  icon: _jsx(SvgNmrIntegrate, {}),
103
- title: `${booleanToString(!showIntegralsValues)} integrals values`,
103
+ tooltip: `${booleanToString(!showIntegralsValues)} integrals values`,
104
104
  onClick: handleShowIntegralsValues,
105
105
  active: showIntegralsValues,
106
106
  },
@@ -85,13 +85,13 @@ function MatrixGenerationPanel() {
85
85
  return (_jsxs("div", { css: tablePanelStyle, children: [_jsx(DefaultPanelHeader, { leftButtons: [
86
86
  {
87
87
  icon: _jsx(SvgNmrExportAsMatrix, {}),
88
- title: 'Export spectra as a matrix',
88
+ tooltip: 'Export spectra as a matrix',
89
89
  onClick: handleExportAsMatrix,
90
90
  },
91
91
  ], rightButtons: [
92
92
  {
93
93
  onClick: () => formRef.current?.submitForm(),
94
- title: 'Signal processing',
94
+ tooltip: 'Signal processing',
95
95
  id: 'save-button',
96
96
  intent: 'success',
97
97
  icon: _jsx(FaCheck, {}),
@@ -160,5 +160,5 @@ export default function MoleculePanelHeader({ currentIndex, molecules, molecules
160
160
  });
161
161
  }
162
162
  const hasMolecules = molecules && molecules.length > 0;
163
- return (_jsxs(PanelHeader, { children: [_jsxs(Toolbar, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(ToolbarPopoverItem, { options: MOL_EXPORT_MENU, onClick: exportHandler, disabled: !hasMolecules, title: "Export As", icon: _jsx(FaFileExport, {}) }), _jsx(Toolbar.Item, { title: "Paste molfile", icon: _jsx(FaPaste, {}), onClick: handlePasteMolfileAction }), _jsx(Toolbar.Item, { title: "Add molecule", icon: _jsx(FaPlus, {}), onClick: onOpenMoleculeEditor })] })), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { title: "Delete molecule", icon: _jsx(FaRegTrashAlt, {}), onClick: handleDelete, disabled: !hasMolecules }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(Toolbar.Item, { title: "Float molecule", icon: _jsx(IoOpenOutline, {}), onClick: floatMoleculeHandler, active: moleculesView?.[moleculeKey]?.floating.visible || false, disabled: !hasMolecules }), _jsx(Toolbar.Item, { title: "Show atom number", icon: _jsx("p", { style: styles.atomLabel, children: "#" }), onClick: showAtomNumbersHandler, active: moleculesView?.[moleculeKey]?.showAtomNumber || false, disabled: !hasMolecules })] }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(PreferencesButton, { title: "Preferences", onClick: onClickPreferences })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
163
+ return (_jsxs(PanelHeader, { children: [_jsxs(Toolbar, { children: [renderSource === 'predictionPanel' && _jsx(AboutPredictionModal, {}), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(ToolbarPopoverItem, { options: MOL_EXPORT_MENU, onClick: exportHandler, disabled: !hasMolecules, tooltip: "Export As", icon: _jsx(FaFileExport, {}) }), _jsx(Toolbar.Item, { tooltip: "Paste molfile", icon: _jsx(FaPaste, {}), onClick: handlePasteMolfileAction }), _jsx(Toolbar.Item, { tooltip: "Add molecule", icon: _jsx(FaPlus, {}), onClick: onOpenMoleculeEditor })] })), renderSource === 'moleculePanel' && (_jsxs(_Fragment, { children: [_jsx(Toolbar.Item, { tooltip: "Delete molecule", icon: _jsx(FaRegTrashAlt, {}), onClick: handleDelete, disabled: !hasMolecules }), hasMolecules && (_jsx(PredictSpectraModal, { molecule: molecules[currentIndex] }))] })), _jsx(Toolbar.Item, { tooltip: "Float molecule", icon: _jsx(IoOpenOutline, {}), onClick: floatMoleculeHandler, active: moleculesView?.[moleculeKey]?.floating.visible || false, disabled: !hasMolecules }), _jsx(Toolbar.Item, { tooltip: "Show atom number", icon: _jsx("p", { style: styles.atomLabel, children: "#" }), onClick: showAtomNumbersHandler, active: moleculesView?.[moleculeKey]?.showAtomNumber || false, disabled: !hasMolecules })] }), _jsx("div", { style: { flex: 1 }, children: children }), molecules && molecules.length > 0 && (_jsx("p", { style: styles.counter, children: `${+(currentIndex + 1)} / ${molecules.length}` })), onClickPreferences && (_jsx(PreferencesButton, { tooltip: "Preferences", onClick: onClickPreferences })), _jsx(ClipboardFallbackModal, { mode: shouldFallback, onDismiss: cleanShouldFallback, onReadText: handlePasteMolfile, text: text, label: "Molfile" })] }));
164
164
  }
@@ -98,14 +98,14 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
98
98
  {
99
99
  disabled,
100
100
  icon: _jsx(SvgNmrPeaks, {}),
101
- title: `${booleanToString(!showPeaks)} peaks`,
101
+ tooltip: `${booleanToString(!showPeaks)} peaks`,
102
102
  onClick: () => toggleViewProperty('showPeaks'),
103
103
  active: showPeaks,
104
104
  },
105
105
  {
106
106
  disabled,
107
107
  icon: _jsx(SvgNmrPeaksTopLabels, {}),
108
- title: `${displayingMode === 'spread' ? 'Single' : 'Spread'} mode`,
108
+ tooltip: `${displayingMode === 'spread' ? 'Single' : 'Spread'} mode`,
109
109
  onClick: toggleDisplayingMode,
110
110
  active: displayingMode === 'spread',
111
111
  },
@@ -114,18 +114,18 @@ function PeaksPanelInner({ peaks, info, xDomain, activeTab, peaksViewState, }) {
114
114
  leftButtons.unshift({
115
115
  disabled,
116
116
  icon: _jsx(SvgPeaks, {}),
117
- title: `${booleanToString(!showPeaksShapes)} peaks shapes`,
117
+ tooltip: `${booleanToString(!showPeaksShapes)} peaks shapes`,
118
118
  onClick: () => toggleViewProperty('showPeaksShapes'),
119
119
  active: showPeaksShapes,
120
120
  }, {
121
121
  disabled,
122
122
  icon: _jsx(SvgNmrFt, {}),
123
- title: `${booleanToString(!showPeaksSum)} peaks sum`,
123
+ tooltip: `${booleanToString(!showPeaksSum)} peaks sum`,
124
124
  onClick: () => toggleViewProperty('showPeaksSum'),
125
125
  active: showPeaksSum,
126
126
  }, {
127
127
  icon: _jsx(FaThinkPeaks, {}),
128
- title: 'Optimize peaks',
128
+ tooltip: 'Optimize peaks',
129
129
  onClick: optimizePeaksHandler,
130
130
  });
131
131
  }