react-science 0.21.0 → 0.21.2
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.
- package/lib/app-data/loaders/loadMeasurements.js +1 -2
- package/lib/components/fullscreen/FullscreenContext.js +3 -1
- package/lib/components/modal/ConfirmModal.js +13 -12
- package/lib/components/modal/Modal.js +11 -10
- package/lib-esm/app-data/loaders/loadMeasurements.js +1 -2
- package/lib-esm/app-data/loaders/loadMeasurements.js.map +1 -1
- package/lib-esm/components/fullscreen/FullscreenContext.d.ts.map +1 -1
- package/lib-esm/components/fullscreen/FullscreenContext.js +3 -1
- package/lib-esm/components/fullscreen/FullscreenContext.js.map +1 -1
- package/lib-esm/components/modal/ConfirmModal.d.ts +1 -1
- package/lib-esm/components/modal/ConfirmModal.d.ts.map +1 -1
- package/lib-esm/components/modal/ConfirmModal.js +13 -12
- package/lib-esm/components/modal/ConfirmModal.js.map +1 -1
- package/lib-esm/components/modal/Modal.d.ts +1 -1
- package/lib-esm/components/modal/Modal.d.ts.map +1 -1
- package/lib-esm/components/modal/Modal.js +11 -10
- package/lib-esm/components/modal/Modal.js.map +1 -1
- package/package.json +21 -21
- package/src/app-data/loaders/loadMeasurements.ts +1 -4
- package/src/components/fullscreen/FullscreenContext.tsx +3 -1
- package/src/components/modal/ConfirmModal.tsx +13 -11
- package/src/components/modal/Modal.tsx +14 -11
|
@@ -28,8 +28,7 @@ function computeMinMax(measurement) {
|
|
|
28
28
|
// TODO: should we accept empty data?
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
if (
|
|
32
|
-
typeof variable.max === 'undefined') {
|
|
31
|
+
if (variable.min === undefined || variable.max === undefined) {
|
|
33
32
|
const { min, max } = (0, ml_spectra_processing_1.xMinMaxValues)(variable.data);
|
|
34
33
|
variable.min = min;
|
|
35
34
|
variable.max = max;
|
|
@@ -6,7 +6,9 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const fullscreenContextInit = {
|
|
8
8
|
isFullScreen: false,
|
|
9
|
-
toggle: () => {
|
|
9
|
+
toggle: () => {
|
|
10
|
+
// empty
|
|
11
|
+
},
|
|
10
12
|
};
|
|
11
13
|
const FullscreenContext = (0, react_1.createContext)(fullscreenContextInit);
|
|
12
14
|
function useFullscreen() {
|
|
@@ -7,27 +7,25 @@ exports.ConfirmModal = void 0;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
9
9
|
const __1 = require("..");
|
|
10
|
+
const Portal_1 = require("../root-layout/Portal");
|
|
10
11
|
const useDialog_1 = require("./useDialog");
|
|
11
12
|
const ConfirmModalDialog = styled_1.default.dialog `
|
|
12
|
-
display: flex;
|
|
13
|
-
position: fixed;
|
|
14
13
|
background-color: transparent;
|
|
15
14
|
|
|
16
15
|
::backdrop {
|
|
17
16
|
background-color: rgba(113, 113, 122, 0.75);
|
|
18
17
|
}
|
|
19
18
|
`;
|
|
20
|
-
const
|
|
19
|
+
const ConfirmModalContents = styled_1.default.div `
|
|
21
20
|
position: relative;
|
|
22
21
|
display: flex;
|
|
23
22
|
flex-direction: column;
|
|
24
23
|
background-color: white;
|
|
25
|
-
max-height: 90%;
|
|
26
24
|
width: 100%;
|
|
27
25
|
border-width: 1px;
|
|
28
26
|
border-color: transparent;
|
|
29
27
|
border-radius: 0.5rem;
|
|
30
|
-
box-shadow: 0 0 0 0, 0
|
|
28
|
+
box-shadow: 0 0 0 0, 0 0px 16px rgba(0, 0, 0, 0.3);
|
|
31
29
|
border-top: 10px solid ${({ headerColor }) => headerColor};
|
|
32
30
|
`;
|
|
33
31
|
const ConfirmModalChildrenRoot = styled_1.default.div `
|
|
@@ -50,12 +48,15 @@ function ConfirmModal(props) {
|
|
|
50
48
|
requestCloseOnBackdrop,
|
|
51
49
|
onRequestClose,
|
|
52
50
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
if (!isOpen) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(Portal_1.Portal, { children: (0, jsx_runtime_1.jsx)(ConfirmModalDialog, { ref: ref, onClick: onClick, children: (0, jsx_runtime_1.jsxs)(ConfirmModalContents, { headerColor: headerColor, style: { maxWidth }, children: [(0, jsx_runtime_1.jsx)(ConfirmModalChildrenRoot, { headerColor: headerColor, children: children }), (0, jsx_runtime_1.jsxs)(ConfirmModalFooter, { children: [(0, jsx_runtime_1.jsx)(__1.Button, { onClick: onConfirm, backgroundColor: {
|
|
55
|
+
basic: 'hsla(243deg, 75%, 58%, 1)',
|
|
56
|
+
hover: 'hsla(245deg, 58%, 50%, 1)',
|
|
57
|
+
}, color: { basic: 'white' }, children: saveText }), (0, jsx_runtime_1.jsx)(__1.Button, { onClick: onCancel, backgroundColor: {
|
|
58
|
+
basic: 'hsla(0deg, 72%, 50%, 1)',
|
|
59
|
+
hover: 'hsla(0deg, 73%, 42%, 1)',
|
|
60
|
+
}, color: { basic: 'white' }, children: cancelText })] })] }) }) }));
|
|
60
61
|
}
|
|
61
62
|
exports.ConfirmModal = ConfirmModal;
|
|
@@ -6,27 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Modal = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
9
|
+
const Portal_1 = require("../root-layout/Portal");
|
|
9
10
|
const ModalCloseButton_1 = __importDefault(require("./ModalCloseButton"));
|
|
10
11
|
const useDialog_1 = require("./useDialog");
|
|
11
12
|
const DialogRoot = styled_1.default.dialog `
|
|
12
|
-
display: flex;
|
|
13
|
-
position: fixed;
|
|
14
13
|
background-color: transparent;
|
|
15
14
|
|
|
16
15
|
::backdrop {
|
|
17
16
|
background-color: rgba(113, 113, 122, 0.75);
|
|
18
17
|
}
|
|
19
18
|
`;
|
|
20
|
-
const
|
|
19
|
+
const DialogContents = styled_1.default.div `
|
|
21
20
|
position: relative;
|
|
22
21
|
display: flex;
|
|
23
22
|
flex-direction: column;
|
|
24
23
|
background-color: white;
|
|
25
|
-
max-height: 90%;
|
|
26
24
|
border-width: 1px;
|
|
27
25
|
border-color: transparent;
|
|
28
26
|
border-radius: 0.5rem;
|
|
29
|
-
box-shadow: 0 0 0 0, 0
|
|
27
|
+
box-shadow: 0 0 0 0, 0 0px 16px rgba(0, 0, 0, 0.3);
|
|
30
28
|
`;
|
|
31
29
|
const ModalHeaderStyled = styled_1.default.div `
|
|
32
30
|
display: flex;
|
|
@@ -52,11 +50,14 @@ function Modal(props) {
|
|
|
52
50
|
requestCloseOnBackdrop,
|
|
53
51
|
onRequestClose,
|
|
54
52
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
if (!isOpen) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(Portal_1.Portal, { children: (0, jsx_runtime_1.jsx)(DialogRoot, { ref: ref, onClick: onClick, children: (0, jsx_runtime_1.jsxs)(DialogContents, { style: {
|
|
57
|
+
maxWidth,
|
|
58
|
+
height: height || 'max-content',
|
|
59
|
+
width: width || '100%',
|
|
60
|
+
}, children: [children, hasCloseButton && (0, jsx_runtime_1.jsx)(ModalCloseButton_1.default, { onClick: onRequestClose })] }) }) }));
|
|
60
61
|
}
|
|
61
62
|
exports.Modal = Modal;
|
|
62
63
|
Modal.Header = function ModalHeader(props) {
|
|
@@ -24,8 +24,7 @@ function computeMinMax(measurement) {
|
|
|
24
24
|
// TODO: should we accept empty data?
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
28
|
-
typeof variable.max === 'undefined') {
|
|
27
|
+
if (variable.min === undefined || variable.max === undefined) {
|
|
29
28
|
const { min, max } = xMinMaxValues(variable.data);
|
|
30
29
|
variable.min = min;
|
|
31
30
|
variable.max = max;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadMeasurements.js","sourceRoot":"","sources":["../../../src/app-data/loaders/loadMeasurements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAgB,OAAO,EAA8B,MAAM,UAAU,CAAC;AAE7E,OAAO,EAEL,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AASrC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,cAA8B,EAC9B,UAAuB,EAAE;IAEzB,MAAM,YAAY,GAA0B,EAAE,CAAC;IAC/C,IAAI,IAAI,GAAgB,EAAE,CAAC;IAC3B,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAChE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;QAC5B,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3E,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;YACnD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;gBAC3B,aAAa,CAAC,KAAK,CAAC,CAAC;aACtB;SACF;QACD,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC/B,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;KAC7C;IACD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;AAChC,CAAC;AAED,SAAS,aAAa,CAAC,WAA4B;IACjD,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,IAAI,EAAE;QACpC,KAAK,MAAM,QAAQ,IAAI,MAAM,C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AC,IAAI,EAAE;QACpC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YACrD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC9B,qCAAqC;gBACrC,OAAO;aACR;YACD,IAAI,QAAQ,CAAC,GAAG,KAAK,SAAS,IAAI,QAAQ,CAAC,GAAG,KAAK,SAAS,EAAE;gBAC5D,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAClD,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;gBACnB,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;aACpB;SACF;KACF;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenContext.d.ts","sourceRoot":"","sources":["../../../src/components/fullscreen/FullscreenContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EAMV,MAAM,OAAO,CAAC;AAUf,UAAU,eAAe;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,UAAU,eAAe;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,WAAY,SAAQ,eAAe;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"FullscreenContext.d.ts","sourceRoot":"","sources":["../../../src/components/fullscreen/FullscreenContext.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EAMV,MAAM,OAAO,CAAC;AAUf,UAAU,eAAe;IACvB,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,UAAU,eAAe;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,WAAY,SAAQ,eAAe;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AASD,wBAAgB,aAAa,gBAE5B;AACD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,eAYxD"}
|
|
@@ -3,7 +3,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext, useContext, useEffect, useMemo, useReducer, useRef, } from 'react';
|
|
4
4
|
const fullscreenContextInit = {
|
|
5
5
|
isFullScreen: false,
|
|
6
|
-
toggle: () => {
|
|
6
|
+
toggle: () => {
|
|
7
|
+
// empty
|
|
8
|
+
},
|
|
7
9
|
};
|
|
8
10
|
const FullscreenContext = createContext(fullscreenContextInit);
|
|
9
11
|
export function useFullscreen() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullscreenContext.js","sourceRoot":"","sources":["../../../src/components/fullscreen/FullscreenContext.tsx"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,OAAO,EACL,aAAa,EAEb,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,MAAM,GACP,MAAM,OAAO,CAAC;AAoBf,MAAM,qBAAqB,GAAG;IAC5B,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"FullscreenContext.js","sourceRoot":"","sources":["../../../src/components/fullscreen/FullscreenContext.tsx"],"names":[],"mappings":";AAAA,6BAA6B;AAC7B,OAAO,EACL,aAAa,EAEb,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,MAAM,GACP,MAAM,OAAO,CAAC;AAoBf,MAAM,qBAAqB,GAAG;IAC5B,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,GAAG,EAAE;QACX,QAAQ;IACV,CAAC;CACF,CAAC;AACF,MAAM,iBAAiB,GAAG,aAAa,CAAc,qBAAqB,CAAC,CAAC;AAE5E,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACvC,CAAC;AACD,MAAM,UAAU,kBAAkB,CAAC,KAAsB;IACvD,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,UAAU,CAAC,C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6 @@ interface ConfirmModalProps {
|
|
|
12
12
|
headerColor: string;
|
|
13
13
|
maxWidth?: number;
|
|
14
14
|
}
|
|
15
|
-
export declare function ConfirmModal(props: ConfirmModalProps): JSX.Element;
|
|
15
|
+
export declare function ConfirmModal(props: ConfirmModalProps): JSX.Element | null;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=ConfirmModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ConfirmModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmModal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/ConfirmModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,UAAU,iBAAiB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAuCD,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,sBA4DpD"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import { Button } from '..';
|
|
4
|
+
import { Portal } from '../root-layout/Portal';
|
|
4
5
|
import { useDialog } from './useDialog';
|
|
5
6
|
const ConfirmModalDialog = styled.dialog `
|
|
6
|
-
display: flex;
|
|
7
|
-
position: fixed;
|
|
8
7
|
background-color: transparent;
|
|
9
8
|
|
|
10
9
|
::backdrop {
|
|
11
10
|
background-color: rgba(113, 113, 122, 0.75);
|
|
12
11
|
}
|
|
13
12
|
`;
|
|
14
|
-
const
|
|
13
|
+
const ConfirmModalContents = styled.div `
|
|
15
14
|
position: relative;
|
|
16
15
|
display: flex;
|
|
17
16
|
flex-direction: column;
|
|
18
17
|
background-color: white;
|
|
19
|
-
max-height: 90%;
|
|
20
18
|
width: 100%;
|
|
21
19
|
border-width: 1px;
|
|
22
20
|
border-color: transparent;
|
|
23
21
|
border-radius: 0.5rem;
|
|
24
|
-
box-shadow: 0 0 0 0, 0
|
|
22
|
+
box-shadow: 0 0 0 0, 0 0px 16px rgba(0, 0, 0, 0.3);
|
|
25
23
|
border-top: 10px solid ${({ headerColor }) => headerColor};
|
|
26
24
|
`;
|
|
27
25
|
const ConfirmModalChildrenRoot = styled.div `
|
|
@@ -44,12 +42,15 @@ export function ConfirmModal(props) {
|
|
|
44
42
|
requestCloseOnBackdrop,
|
|
45
43
|
onRequestClose,
|
|
46
44
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
if (!isOpen) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return (_jsx(Portal, { children: _jsx(ConfirmModalDialog, { ref: ref, onClick: onClick, children: _jsxs(ConfirmModalContents, { headerColor: headerColor, style: { maxWidth }, children: [_jsx(ConfirmModalChildrenRoot, { headerColor: headerColor, children: children }), _jsxs(ConfirmModalFooter, { children: [_jsx(Button, { onClick: onConfirm, backgroundColor: {
|
|
49
|
+
basic: 'hsla(243deg, 75%, 58%, 1)',
|
|
50
|
+
hover: 'hsla(245deg, 58%, 50%, 1)',
|
|
51
|
+
}, color: { basic: 'white' }, children: saveText }), _jsx(Button, { onClick: onCancel, backgroundColor: {
|
|
52
|
+
basic: 'hsla(0deg, 72%, 50%, 1)',
|
|
53
|
+
hover: 'hsla(0deg, 73%, 42%, 1)',
|
|
54
|
+
}, color: { basic: 'white' }, children: cancelText })] })] }) }) }));
|
|
54
55
|
}
|
|
55
56
|
//# sourceMappingURL=ConfirmModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmModal.js","sourceRoot":"","sources":["../../../src/components/modal/ConfirmModal.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmModal.js","sourceRoot":"","sources":["../../../src/components/modal/ConfirmModal.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgBxC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAA;;;;;;CAMvC,CAAC;AAEF,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAErC;;;;;;;;;;2BAUyB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW;CAC1D,CAAC;AAEF,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAyB;WACzD,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW;;;CAG1C,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;CAMpC,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EACJ,MAAM,EACN,QAAQ,GAAG,MAAM,EACjB,UAAU,GAAG,QAAQ,EACrB,WAAW,EACX,QAAQ,EACR,cAAc,EACd,QAAQ,GAAG,cAAc,EACzB,SAAS,EACT,sBAAsB,GAAG,IAAI,EAC7B,iBAAiB,GAAG,IAAI,EACxB,QAAQ,GACT,GAAG,KAAK,CAAC;IAEV,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;QACjC,MAAM;QACN,iBAAiB;QACjB,sBAAsB;QACtB,cAAc;KACf,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,MAAM,cACL,KAAC,kBAAkB,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,YAC5C,MAAC,oBAAoB,IAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,aACjE,KAAC,wBAAwB,IAAC,WAAW,EAAE,WAAW,YAC/C,QAAQ,GACgB,EAE3B,MAAC,kBAAkB,eACjB,KAAC,MAAM,IACL,OAAO,EAAE,SAAS,EAClB,eAAe,EAAE;oCACf,KAAK,EAAE,2BAA2B;oCAClC,KAAK,EAAE,2BAA2B;iCACnC,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,YAExB,QAAQ,GACF,EACT,KAAC,MAAM,IACL,OAAO,EAAE,QAAQ,EACjB,eAAe,EAAE;oCACf,KAAK,EAAE,yBAAyB;oCAChC,KAAK,EAAE,yBAAyB;iCACjC,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,YAExB,UAAU,GACJ,IACU,IACA,GACJ,GACd,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -10,7 +10,7 @@ export interface ModalProps {
|
|
|
10
10
|
width?: number;
|
|
11
11
|
height?: number;
|
|
12
12
|
}
|
|
13
|
-
export declare function Modal(props: ModalProps): JSX.Element;
|
|
13
|
+
export declare function Modal(props: ModalProps): JSX.Element | null;
|
|
14
14
|
export declare namespace Modal {
|
|
15
15
|
var Header: (props: {
|
|
16
16
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOrD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwCD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,sBAwCtC;yBAxCe,KAAK"}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
+
import { Portal } from '../root-layout/Portal';
|
|
3
4
|
import ModalCloseButton from './ModalCloseButton';
|
|
4
5
|
import { useDialog } from './useDialog';
|
|
5
6
|
const DialogRoot = styled.dialog `
|
|
6
|
-
display: flex;
|
|
7
|
-
position: fixed;
|
|
8
7
|
background-color: transparent;
|
|
9
8
|
|
|
10
9
|
::backdrop {
|
|
11
10
|
background-color: rgba(113, 113, 122, 0.75);
|
|
12
11
|
}
|
|
13
12
|
`;
|
|
14
|
-
const
|
|
13
|
+
const DialogContents = styled.div `
|
|
15
14
|
position: relative;
|
|
16
15
|
display: flex;
|
|
17
16
|
flex-direction: column;
|
|
18
17
|
background-color: white;
|
|
19
|
-
max-height: 90%;
|
|
20
18
|
border-width: 1px;
|
|
21
19
|
border-color: transparent;
|
|
22
20
|
border-radius: 0.5rem;
|
|
23
|
-
box-shadow: 0 0 0 0, 0
|
|
21
|
+
box-shadow: 0 0 0 0, 0 0px 16px rgba(0, 0, 0, 0.3);
|
|
24
22
|
`;
|
|
25
23
|
const ModalHeaderStyled = styled.div `
|
|
26
24
|
display: flex;
|
|
@@ -46,11 +44,14 @@ export function Modal(props) {
|
|
|
46
44
|
requestCloseOnBackdrop,
|
|
47
45
|
onRequestClose,
|
|
48
46
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
if (!isOpen) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return (_jsx(Portal, { children: _jsx(DialogRoot, { ref: ref, onClick: onClick, children: _jsxs(DialogContents, { style: {
|
|
51
|
+
maxWidth,
|
|
52
|
+
height: height || 'max-content',
|
|
53
|
+
width: width || '100%',
|
|
54
|
+
}, children: [children, hasCloseButton && _jsx(ModalCloseButton, { onClick: onRequestClose })] }) }) }));
|
|
54
55
|
}
|
|
55
56
|
Modal.Header = function ModalHeader(props) {
|
|
56
57
|
return _jsx(ModalHeaderStyled, { children: props.children });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/modal/Modal.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAGrC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAcxC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAA
|
|
1
|
+
{"version":3,"file":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IAAI,KAAC,gBAAgB,IAAC,OAAO,EAAE,cAAc,GAAI,IACjD,GACN,GACN,CACV,CAAC;AACJ,CAAC;AAED,KAAK,CAAC,MAAM,GAAG,SAAS,WAAW,CAAC,KAA8B;IAChE,OAAO,KAAC,iBAAiB,cAAE,KAAK,CAAC,QAAQ,GAAqB,CAAC;AACjE,CAAC,CAAC;AAEF,KAAK,CAAC,IAAI,GAAG,SAAS,SAAS,CAAC,KAA8B;IAC5D,OAAO,KAAC,eAAe,cAAE,KAAK,CAAC,QAAQ,GAAmB,CAAC;AAC7D,CAAC,CAAC;AAEF,KAAK,CAAC,MAAM,GAAG,SAAS,WAAW,CAAC,KAA8B;IAChE,OAAO,KAAC,iBAAiB,cAAE,KAAK,CAAC,QAAQ,GAAqB,CAAC;AACjE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-science",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "React components to build analysis UI",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./app": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"test-only": "vitest run --coverage "
|
|
51
51
|
},
|
|
52
52
|
"volta": {
|
|
53
|
-
"node": "18.
|
|
53
|
+
"node": "18.15.0"
|
|
54
54
|
},
|
|
55
55
|
"overrides": {
|
|
56
56
|
"react": "^18.2.0",
|
|
@@ -66,24 +66,24 @@
|
|
|
66
66
|
"@headlessui/react": "^1.7.13",
|
|
67
67
|
"@lukeed/uuid": "^2.0.0",
|
|
68
68
|
"@popperjs/core": "^2.11.6",
|
|
69
|
-
"@tanstack/react-query": "^4.
|
|
70
|
-
"@tanstack/react-table": "^8.
|
|
69
|
+
"@tanstack/react-query": "^4.28.0",
|
|
70
|
+
"@tanstack/react-table": "^8.8.0",
|
|
71
71
|
"biologic-converter": "^0.6.0",
|
|
72
72
|
"cheminfo-types": "^1.4.0",
|
|
73
73
|
"d3-scale-chromatic": "^3.0.0",
|
|
74
74
|
"filelist-utils": "^1.8.0",
|
|
75
|
-
"immer": "^9.0.
|
|
76
|
-
"jcampconverter": "^9.0
|
|
75
|
+
"immer": "^9.0.21",
|
|
76
|
+
"jcampconverter": "^9.1.0",
|
|
77
77
|
"lodash": "^4.17.21",
|
|
78
78
|
"ml-gsd": "^12.1.2",
|
|
79
79
|
"ml-peak-shape-generator": "^4.1.2",
|
|
80
80
|
"ml-signal-processing": "^1.0.2",
|
|
81
81
|
"ml-spectra-processing": "^12.0.0",
|
|
82
|
-
"ms-spectrum": "^2.
|
|
82
|
+
"ms-spectrum": "^2.3.0",
|
|
83
83
|
"netcdfjs": "^2.0.2",
|
|
84
84
|
"react-d3-utils": "^1.0.0",
|
|
85
85
|
"react-dropzone": "^14.2.3",
|
|
86
|
-
"react-error-boundary": "^
|
|
86
|
+
"react-error-boundary": "^4.0.2",
|
|
87
87
|
"react-icons": "^4.8.0",
|
|
88
88
|
"react-inspector": "^6.0.1",
|
|
89
89
|
"react-kbs": "^2.1.1",
|
|
@@ -96,11 +96,11 @@
|
|
|
96
96
|
"wdf-parser": "^0.3.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@babel/core": "^7.21.
|
|
100
|
-
"@babel/eslint-parser": "^7.
|
|
101
|
-
"@ladle/react": "^2.
|
|
102
|
-
"@playwright/experimental-ct-react": "^1.
|
|
103
|
-
"@playwright/test": "^1.
|
|
99
|
+
"@babel/core": "^7.21.3",
|
|
100
|
+
"@babel/eslint-parser": "^7.21.3",
|
|
101
|
+
"@ladle/react": "^2.10.2",
|
|
102
|
+
"@playwright/experimental-ct-react": "^1.32.0",
|
|
103
|
+
"@playwright/test": "^1.32.0",
|
|
104
104
|
"@types/babel__core": "^7.20.0",
|
|
105
105
|
"@types/d3-scale-chromatic": "^3.0.0",
|
|
106
106
|
"@types/lodash": "^4.14.191",
|
|
@@ -108,19 +108,19 @@
|
|
|
108
108
|
"@types/react-dom": "^18.0.11",
|
|
109
109
|
"@types/react-inspector": "^4.0.2",
|
|
110
110
|
"@vitejs/plugin-react": "^3.1.0",
|
|
111
|
-
"@vitest/coverage-c8": "^0.29.
|
|
111
|
+
"@vitest/coverage-c8": "^0.29.7",
|
|
112
112
|
"cheminfo-font": "^1.9.0",
|
|
113
113
|
"cross-env": "^7.0.3",
|
|
114
|
-
"eslint": "^8.
|
|
115
|
-
"eslint-config-zakodium": "^7.
|
|
116
|
-
"prettier": "^2.8.
|
|
114
|
+
"eslint": "^8.36.0",
|
|
115
|
+
"eslint-config-zakodium": "^7.1.0",
|
|
116
|
+
"prettier": "^2.8.6",
|
|
117
117
|
"react": "^18.2.0",
|
|
118
118
|
"react-dom": "^18.2.0",
|
|
119
119
|
"react-ocl": "^5.0.0",
|
|
120
|
-
"rimraf": "^4.
|
|
121
|
-
"typescript": "^
|
|
122
|
-
"vite": "^4.1
|
|
123
|
-
"vitest": "^0.29.
|
|
120
|
+
"rimraf": "^4.4.1",
|
|
121
|
+
"typescript": "^5.0.2",
|
|
122
|
+
"vite": "^4.2.1",
|
|
123
|
+
"vitest": "^0.29.7"
|
|
124
124
|
},
|
|
125
125
|
"repository": {
|
|
126
126
|
"type": "git",
|
|
@@ -42,10 +42,7 @@ function computeMinMax(measurement: MeasurementBase) {
|
|
|
42
42
|
// TODO: should we accept empty data?
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
-
if (
|
|
46
|
-
typeof variable.min === 'undefined' ||
|
|
47
|
-
typeof variable.max === 'undefined'
|
|
48
|
-
) {
|
|
45
|
+
if (variable.min === undefined || variable.max === undefined) {
|
|
49
46
|
const { min, max } = xMinMaxValues(variable.data);
|
|
50
47
|
variable.min = min;
|
|
51
48
|
variable.max = max;
|
|
@@ -29,7 +29,9 @@ interface ContextType extends FullscreenState {
|
|
|
29
29
|
}
|
|
30
30
|
const fullscreenContextInit = {
|
|
31
31
|
isFullScreen: false,
|
|
32
|
-
toggle: () => {
|
|
32
|
+
toggle: () => {
|
|
33
|
+
// empty
|
|
34
|
+
},
|
|
33
35
|
};
|
|
34
36
|
const FullscreenContext = createContext<ContextType>(fullscreenContextInit);
|
|
35
37
|
|
|
@@ -2,6 +2,7 @@ import styled from '@emotion/styled';
|
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Button } from '..';
|
|
5
|
+
import { Portal } from '../root-layout/Portal';
|
|
5
6
|
|
|
6
7
|
import { useDialog } from './useDialog';
|
|
7
8
|
|
|
@@ -20,8 +21,6 @@ interface ConfirmModalProps {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const ConfirmModalDialog = styled.dialog`
|
|
23
|
-
display: flex;
|
|
24
|
-
position: fixed;
|
|
25
24
|
background-color: transparent;
|
|
26
25
|
|
|
27
26
|
::backdrop {
|
|
@@ -29,19 +28,18 @@ const ConfirmModalDialog = styled.dialog`
|
|
|
29
28
|
}
|
|
30
29
|
`;
|
|
31
30
|
|
|
32
|
-
const
|
|
31
|
+
const ConfirmModalContents = styled.div<{
|
|
33
32
|
headerColor: string;
|
|
34
33
|
}>`
|
|
35
34
|
position: relative;
|
|
36
35
|
display: flex;
|
|
37
36
|
flex-direction: column;
|
|
38
37
|
background-color: white;
|
|
39
|
-
max-height: 90%;
|
|
40
38
|
width: 100%;
|
|
41
39
|
border-width: 1px;
|
|
42
40
|
border-color: transparent;
|
|
43
41
|
border-radius: 0.5rem;
|
|
44
|
-
box-shadow: 0 0 0 0, 0
|
|
42
|
+
box-shadow: 0 0 0 0, 0 0px 16px rgba(0, 0, 0, 0.3);
|
|
45
43
|
border-top: 10px solid ${({ headerColor }) => headerColor};
|
|
46
44
|
`;
|
|
47
45
|
|
|
@@ -81,10 +79,14 @@ export function ConfirmModal(props: ConfirmModalProps) {
|
|
|
81
79
|
onRequestClose,
|
|
82
80
|
});
|
|
83
81
|
|
|
82
|
+
if (!isOpen) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
84
86
|
return (
|
|
85
|
-
<
|
|
86
|
-
{
|
|
87
|
-
<
|
|
87
|
+
<Portal>
|
|
88
|
+
<ConfirmModalDialog ref={ref} onClick={onClick}>
|
|
89
|
+
<ConfirmModalContents headerColor={headerColor} style={{ maxWidth }}>
|
|
88
90
|
<ConfirmModalChildrenRoot headerColor={headerColor}>
|
|
89
91
|
{children}
|
|
90
92
|
</ConfirmModalChildrenRoot>
|
|
@@ -111,8 +113,8 @@ export function ConfirmModal(props: ConfirmModalProps) {
|
|
|
111
113
|
{cancelText}
|
|
112
114
|
</Button>
|
|
113
115
|
</ConfirmModalFooter>
|
|
114
|
-
</
|
|
115
|
-
|
|
116
|
-
</
|
|
116
|
+
</ConfirmModalContents>
|
|
117
|
+
</ConfirmModalDialog>
|
|
118
|
+
</Portal>
|
|
117
119
|
);
|
|
118
120
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
2
|
import type { ReactElement, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
import { Portal } from '../root-layout/Portal';
|
|
5
|
+
|
|
4
6
|
import ModalCloseButton from './ModalCloseButton';
|
|
5
7
|
import { useDialog } from './useDialog';
|
|
6
8
|
|
|
@@ -17,8 +19,6 @@ export interface ModalProps {
|
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
const DialogRoot = styled.dialog`
|
|
20
|
-
display: flex;
|
|
21
|
-
position: fixed;
|
|
22
22
|
background-color: transparent;
|
|
23
23
|
|
|
24
24
|
::backdrop {
|
|
@@ -26,16 +26,15 @@ const DialogRoot = styled.dialog`
|
|
|
26
26
|
}
|
|
27
27
|
`;
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const DialogContents = styled.div`
|
|
30
30
|
position: relative;
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
background-color: white;
|
|
34
|
-
max-height: 90%;
|
|
35
34
|
border-width: 1px;
|
|
36
35
|
border-color: transparent;
|
|
37
36
|
border-radius: 0.5rem;
|
|
38
|
-
box-shadow: 0 0 0 0, 0
|
|
37
|
+
box-shadow: 0 0 0 0, 0 0px 16px rgba(0, 0, 0, 0.3);
|
|
39
38
|
`;
|
|
40
39
|
|
|
41
40
|
const ModalHeaderStyled = styled.div`
|
|
@@ -77,10 +76,14 @@ export function Modal(props: ModalProps) {
|
|
|
77
76
|
onRequestClose,
|
|
78
77
|
});
|
|
79
78
|
|
|
79
|
+
if (!isOpen) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
80
83
|
return (
|
|
81
|
-
<
|
|
82
|
-
{
|
|
83
|
-
<
|
|
84
|
+
<Portal>
|
|
85
|
+
<DialogRoot ref={ref} onClick={onClick}>
|
|
86
|
+
<DialogContents
|
|
84
87
|
style={{
|
|
85
88
|
maxWidth,
|
|
86
89
|
height: height || 'max-content',
|
|
@@ -89,9 +92,9 @@ export function Modal(props: ModalProps) {
|
|
|
89
92
|
>
|
|
90
93
|
{children}
|
|
91
94
|
{hasCloseButton && <ModalCloseButton onClick={onRequestClose} />}
|
|
92
|
-
</
|
|
93
|
-
|
|
94
|
-
</
|
|
95
|
+
</DialogContents>
|
|
96
|
+
</DialogRoot>
|
|
97
|
+
</Portal>
|
|
95
98
|
);
|
|
96
99
|
}
|
|
97
100
|
|