react-science 0.35.0 → 0.37.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.
- package/lib/components/button/Button.d.ts +6 -2
- package/lib/components/button/Button.d.ts.map +1 -1
- package/lib/components/button/Button.js +17 -3
- package/lib/components/button/Button.js.map +1 -1
- package/lib/components/drop-zone/DropZone.d.ts +2 -4
- package/lib/components/drop-zone/DropZone.d.ts.map +1 -1
- package/lib/components/drop-zone/DropZone.js +4 -14
- package/lib/components/drop-zone/DropZone.js.map +1 -1
- package/lib/components/forms/radio-group/RadioGroup.d.ts +0 -1
- package/lib/components/forms/radio-group/RadioGroup.d.ts.map +1 -1
- package/lib/components/forms/radio-group/RadioGroup.js +4 -9
- package/lib/components/forms/radio-group/RadioGroup.js.map +1 -1
- package/lib/components/header/PanelHeader.d.ts.map +1 -1
- package/lib/components/header/PanelHeader.js +13 -16
- package/lib/components/header/PanelHeader.js.map +1 -1
- package/lib/components/hooks/index.d.ts +1 -0
- package/lib/components/hooks/index.d.ts.map +1 -1
- package/lib/components/hooks/index.js +1 -0
- package/lib/components/hooks/index.js.map +1 -1
- package/lib/components/hooks/useSelect.d.ts +21 -0
- package/lib/components/hooks/useSelect.d.ts.map +1 -0
- package/lib/components/hooks/useSelect.js +45 -0
- package/lib/components/hooks/useSelect.js.map +1 -0
- package/lib/components/toolbar/Toolbar.d.ts +5 -1
- package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/toolbar/Toolbar.js +4 -4
- package/lib/components/toolbar/Toolbar.js.map +1 -1
- package/lib/components/toolbar/toolbarContext.d.ts +2 -0
- package/lib/components/toolbar/toolbarContext.d.ts.map +1 -1
- package/lib/components/toolbar/toolbarContext.js.map +1 -1
- package/lib-esm/components/button/Button.d.ts +6 -2
- package/lib-esm/components/button/Button.d.ts.map +1 -1
- package/lib-esm/components/button/Button.js +18 -4
- package/lib-esm/components/button/Button.js.map +1 -1
- package/lib-esm/components/drop-zone/DropZone.d.ts +2 -4
- package/lib-esm/components/drop-zone/DropZone.d.ts.map +1 -1
- package/lib-esm/components/drop-zone/DropZone.js +4 -14
- package/lib-esm/components/drop-zone/DropZone.js.map +1 -1
- package/lib-esm/components/forms/radio-group/RadioGroup.d.ts +0 -1
- package/lib-esm/components/forms/radio-group/RadioGroup.d.ts.map +1 -1
- package/lib-esm/components/forms/radio-group/RadioGroup.js +4 -9
- package/lib-esm/components/forms/radio-group/RadioGroup.js.map +1 -1
- package/lib-esm/components/header/PanelHeader.d.ts.map +1 -1
- package/lib-esm/components/header/PanelHeader.js +13 -16
- package/lib-esm/components/header/PanelHeader.js.map +1 -1
- package/lib-esm/components/hooks/index.d.ts +1 -0
- package/lib-esm/components/hooks/index.d.ts.map +1 -1
- package/lib-esm/components/hooks/index.js +1 -0
- package/lib-esm/components/hooks/index.js.map +1 -1
- package/lib-esm/components/hooks/useSelect.d.ts +21 -0
- package/lib-esm/components/hooks/useSelect.d.ts.map +1 -0
- package/lib-esm/components/hooks/useSelect.js +41 -0
- package/lib-esm/components/hooks/useSelect.js.map +1 -0
- package/lib-esm/components/toolbar/Toolbar.d.ts +5 -1
- package/lib-esm/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib-esm/components/toolbar/Toolbar.js +4 -4
- package/lib-esm/components/toolbar/Toolbar.js.map +1 -1
- package/lib-esm/components/toolbar/toolbarContext.d.ts +2 -0
- package/lib-esm/components/toolbar/toolbarContext.d.ts.map +1 -1
- package/lib-esm/components/toolbar/toolbarContext.js.map +1 -1
- package/package.json +27 -27
- package/src/components/button/Button.tsx +35 -4
- package/src/components/drop-zone/DropZone.tsx +8 -27
- package/src/components/forms/radio-group/RadioGroup.tsx +3 -14
- package/src/components/header/PanelHeader.tsx +15 -16
- package/src/components/hooks/index.ts +1 -0
- package/src/components/hooks/useSelect.tsx +58 -0
- package/src/components/toolbar/Toolbar.tsx +23 -4
- package/src/components/toolbar/toolbarContext.ts +3 -0
- package/lib/components/forms/radio-group/ClassicRadioItem.d.ts +0 -3
- package/lib/components/forms/radio-group/ClassicRadioItem.d.ts.map +0 -1
- package/lib/components/forms/radio-group/ClassicRadioItem.js +0 -92
- package/lib/components/forms/radio-group/ClassicRadioItem.js.map +0 -1
- package/lib-esm/components/forms/radio-group/ClassicRadioItem.d.ts +0 -3
- package/lib-esm/components/forms/radio-group/ClassicRadioItem.d.ts.map +0 -1
- package/lib-esm/components/forms/radio-group/ClassicRadioItem.js +0 -65
- package/lib-esm/components/forms/radio-group/ClassicRadioItem.js.map +0 -1
- package/src/components/forms/radio-group/ClassicRadioItem.tsx +0 -94
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropZone.js","sourceRoot":"","sources":["../../../src/components/drop-zone/DropZone.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,MAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"DropZone.js","sourceRoot":"","sources":["../../../src/components/drop-zone/DropZone.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAmB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,SAAS,MAAM,YAAY,CAAC;AAWnC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAI9B,CAAC;AAMF,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAoB;;;;;;;;;;;;;kBAavC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAClC,WAAW,IAAI,SAAS,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;CACpE,CAAC;AAEF,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAoB;;wBAE5B,SAAS,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AK,EAAE,UAAU,EACjB,WAAW,EAAE,gBAAgB,EAC7B,MAAM,EACJ,KAAC,MAAM,IACL,SAAS,EAAC,iBAAiB,EAC3B,QAAQ,QACR,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,eAAe,EACrB,MAAM,EAAC,SAAS,GAChB,GAEJ,GACY,CACjB,CAAC,CAAC,CAAC,IAAI,EACR,mBAAW,aAAa,EAAE,GAAI,IACjB,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio-group/RadioGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/forms/radio-group/RadioGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAIzC,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAkBD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,oDAkChD"}
|
|
@@ -3,7 +3,6 @@ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import * as RadioGroupRadix from '@radix-ui/react-radio-group';
|
|
5
5
|
import { ButtonRadioItem } from './ButtonRadioItem';
|
|
6
|
-
import { ClassicRadioItem } from './ClassicRadioItem';
|
|
7
6
|
const rootStyles = {
|
|
8
7
|
basic: css({
|
|
9
8
|
display: 'flex',
|
|
@@ -21,15 +20,11 @@ const rootStyles = {
|
|
|
21
20
|
}),
|
|
22
21
|
};
|
|
23
22
|
export function RadioGroup(props) {
|
|
24
|
-
const { id, selected,
|
|
25
|
-
return (_jsx(RadioGroupRadix.Root, { id: id, css: [
|
|
26
|
-
|
|
27
|
-
type === 'classic' ? null : rootStyles.button(variant),
|
|
28
|
-
], style: {
|
|
29
|
-
gap: type === 'classic' ? (variant === 'default' ? 10 : 5) : 0,
|
|
23
|
+
const { id, selected, disabled: groupDisabled = false, options = [], onSelect, name = '', variant = 'default', } = props;
|
|
24
|
+
return (_jsx(RadioGroupRadix.Root, { id: id, css: [rootStyles.basic, rootStyles.button(variant)], style: {
|
|
25
|
+
gap: 0,
|
|
30
26
|
}, value: selected?.value, name: name, disabled: groupDisabled, children: options?.map(({ value, label, disabled }) => {
|
|
31
27
|
const childProps = {
|
|
32
|
-
key: value,
|
|
33
28
|
value,
|
|
34
29
|
label,
|
|
35
30
|
disabled: groupDisabled || disabled,
|
|
@@ -37,7 +32,7 @@ export function RadioGroup(props) {
|
|
|
37
32
|
variant,
|
|
38
33
|
name,
|
|
39
34
|
};
|
|
40
|
-
return
|
|
35
|
+
return _jsx(ButtonRadioItem, { ...childProps }, value);
|
|
41
36
|
}) }));
|
|
42
37
|
}
|
|
43
38
|
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../../src/components/forms/radio-group/RadioGroup.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../../src/components/forms/radio-group/RadioGroup.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAK/D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAgBpD,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE,GAAG,CAAC;QACT,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,aAAa;KACrB,CAAC;IACF,MAAM,EAAE,CAAC,OAAqB,EAAE,EAAE,CAChC,GAAG,CAAC;QACF,gDAAgD,EAAE;YAChD,YAAY,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa;SACpE;QACD,8CAA8C,EAAE;YAC9C,gBAAgB,EAAE,CAAC;YACnB,YAAY,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa;SACpE;KACF,CAAC;CACL,CAAC;AACF,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,EACJ,EAAE,EACF,QAAQ,EACR,QAAQ,EAAE,aAAa,GAAG,KAAK,EAC/B,OAAO,GAAG,EAAE,EACZ,QAAQ,EACR,IAAI,GAAG,EAAE,EACT,OAAO,GAAG,SAAS,GACpB,GAAG,KAAK,CAAC;IACV,OAAO,CACL,KAAC,eAAe,CAAC,IAAI,IACnB,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EACnD,KAAK,EAAE;YACL,GAAG,EAAE,CAAC;SACP,EACD,KAAK,EAAE,QAAQ,EAAE,KAAK,EACtB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,aAAa,YAEtB,OAAO,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC3C,MAAM,UAAU,GAAG;gBACjB,KAAK;gBACL,KAAK;gBACL,QAAQ,EAAE,aAAa,IAAI,QAAQ;gBACnC,QAAQ;gBACR,OAAO;gBACP,IAAI;aACL,CAAC;YACF,OAAO,KAAC,eAAe,OAAiB,UAAU,IAArB,KAAK,CAAoB,CAAC;QACzD,CAAC,CAAC,GACmB,CACxB,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/header/PanelHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"PanelHeader.d.ts","sourceRoot":"","sources":["../../../src/components/header/PanelHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA6BlC,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,QAAQ,EACR,eAAe,GAChB,EAAE,gBAAgB,oDAUlB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
import { useEffect, useRef } from 'react';
|
|
5
4
|
import { Button } from '../button/Button';
|
|
6
5
|
const styles = {
|
|
7
6
|
container: css({
|
|
@@ -28,20 +27,18 @@ const styles = {
|
|
|
28
27
|
}),
|
|
29
28
|
};
|
|
30
29
|
export function PanelHeader({ total, current, children, onClickSettings, }) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, [current, total]);
|
|
45
|
-
return (_jsxs("div", { css: styles.container, children: [_jsx("div", { css: styles.leftContainer, children: children }), _jsx("p", { ref: labelRef, css: styles.counterLabel }), onClickSettings && (_jsx(Button, { color: "black", minimal: true, onClick: onClickSettings, icon: "cog" }))] }));
|
|
30
|
+
return (_jsxs("div", { css: styles.container, children: [_jsx("div", { css: styles.leftContainer, children: children }), _jsx("p", { css: styles.counterLabel, children: formatCounterLabel(current, total) }), onClickSettings && (_jsx(Button, { color: "black", minimal: true, onClick: onClickSettings, icon: "cog" }))] }));
|
|
31
|
+
}
|
|
32
|
+
function formatCounterLabel(current, total) {
|
|
33
|
+
if (current !== undefined && total !== undefined) {
|
|
34
|
+
return `${current} / ${total}`;
|
|
35
|
+
}
|
|
36
|
+
if (current !== undefined) {
|
|
37
|
+
return `[ ${current} ]`;
|
|
38
|
+
}
|
|
39
|
+
if (total !== undefined) {
|
|
40
|
+
return `[ ${total} ]`;
|
|
41
|
+
}
|
|
42
|
+
return '';
|
|
46
43
|
}
|
|
47
44
|
//# sourceMappingURL=PanelHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PanelHeader.js","sourceRoot":"","sources":["../../../src/components/header/PanelHeader.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PanelHeader.js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,SAAS,EAAE,CAAC;QACjD,OAAO,GAAG,OAAO,MAAM,KAAK,EAAE,CAAC;IACjC,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,KAAK,OAAO,IAAI,CAAC;IAC1B,CAAC;IACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,KAAK,KAAK,IAAI,CAAC;IACxB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ItemRenderer } from '@blueprintjs/select';
|
|
3
|
+
export declare function useSelect<T extends {
|
|
4
|
+
label: string;
|
|
5
|
+
}>(): {
|
|
6
|
+
value: T | null;
|
|
7
|
+
setValue: import("react").Dispatch<import("react").SetStateAction<T | null>>;
|
|
8
|
+
itemRenderer: ItemRenderer<T>;
|
|
9
|
+
onItemSelect: import("react").Dispatch<import("react").SetStateAction<T | null>>;
|
|
10
|
+
popoverProps: {
|
|
11
|
+
onOpened: (node: HTMLElement) => void;
|
|
12
|
+
};
|
|
13
|
+
popoverTargetProps: {
|
|
14
|
+
style: {
|
|
15
|
+
display: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
itemPredicate: (query: string, item: T) => boolean;
|
|
19
|
+
itemListPredicate: (query: string, items: T[]) => T[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelect.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/useSelect.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;;;;;;yBAKhC,WAAW;;;;;;;2BAWA,MAAM,QAAQ,CAAC;+BAGX,MAAM,SAAS,CAAC,EAAE;EAerD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MenuItem } from '@blueprintjs/core';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
export function useSelect() {
|
|
5
|
+
const [value, setValue] = useState(null);
|
|
6
|
+
const itemRenderer = getItemRenderer(value);
|
|
7
|
+
const onItemSelect = setValue;
|
|
8
|
+
const popoverProps = {
|
|
9
|
+
onOpened: (node) => {
|
|
10
|
+
const firstUl = node.querySelector('ul');
|
|
11
|
+
if (firstUl) {
|
|
12
|
+
firstUl.tabIndex = 0;
|
|
13
|
+
firstUl.focus();
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const popoverTargetProps = {
|
|
18
|
+
style: { display: 'inline-block' },
|
|
19
|
+
};
|
|
20
|
+
const itemPredicate = (query, item) => {
|
|
21
|
+
return item.label.toLowerCase().includes(query.toLowerCase());
|
|
22
|
+
};
|
|
23
|
+
const itemListPredicate = (query, items) => {
|
|
24
|
+
return items.filter((item) => item.label.toLowerCase().includes(query.toLowerCase()));
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
value,
|
|
28
|
+
setValue,
|
|
29
|
+
itemRenderer,
|
|
30
|
+
onItemSelect,
|
|
31
|
+
popoverProps,
|
|
32
|
+
popoverTargetProps,
|
|
33
|
+
itemPredicate,
|
|
34
|
+
itemListPredicate,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getItemRenderer(value) {
|
|
38
|
+
const render = ({ label }, { handleClick, handleFocus, modifiers, index }) => (_jsx(MenuItem, { active: modifiers.active, disabled: modifiers.disabled, selected: value?.label === label, onClick: handleClick, onFocus: handleFocus, roleStructure: "listoption", text: label }, index));
|
|
39
|
+
return render;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=useSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelect.js","sourceRoot":"","sources":["../../../src/components/hooks/useSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,UAAU,SAAS;IACvB,MAAM,CA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EAAE,CAAC,CACH,KAAC,QAAQ,IACP,MAAM,EAAE,SAAS,CAAC,MAAM,EACxB,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,QAAQ,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,EAEhC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAC,YAAY,EAC1B,IAAI,EAAE,KAAK,IAJN,KAAK,CAKV,CACH,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import { Intent, PopoverProps } from '@blueprintjs/core';
|
|
2
|
+
import { Intent, PopoverProps, TagProps } from '@blueprintjs/core';
|
|
3
3
|
import { IconName } from '@blueprintjs/icons';
|
|
4
4
|
import { JSX, ReactElement, ReactNode } from 'react';
|
|
5
|
+
export type PopoverInteractionType = 'click' | 'hover' | 'click-target' | 'hover-target';
|
|
5
6
|
interface ToolbarBaseProps {
|
|
6
7
|
intent?: Intent;
|
|
7
8
|
disabled?: boolean;
|
|
@@ -10,6 +11,7 @@ export interface ToolbarProps extends ToolbarBaseProps {
|
|
|
10
11
|
vertical?: boolean;
|
|
11
12
|
large?: boolean;
|
|
12
13
|
children?: Array<ReactElement<ToolbarItemProps>> | ReactElement<ToolbarItemProps> | Iterable<ReactNode> | boolean | null;
|
|
14
|
+
popoverInteractionKind?: PopoverInteractionType;
|
|
13
15
|
}
|
|
14
16
|
export interface ToolbarItemProps extends ToolbarBaseProps {
|
|
15
17
|
id?: string;
|
|
@@ -20,6 +22,8 @@ export interface ToolbarItemProps extends ToolbarBaseProps {
|
|
|
20
22
|
className?: string;
|
|
21
23
|
noTooltip?: boolean;
|
|
22
24
|
isPopover?: boolean;
|
|
25
|
+
tag?: ReactNode;
|
|
26
|
+
tagProps?: Omit<TagProps, 'children'>;
|
|
23
27
|
}
|
|
24
28
|
export interface ToolbarPopoverItemProps extends PopoverProps {
|
|
25
29
|
itemProps: ToolbarItemProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAIL,MAAM,EAEN,YAAY,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAIL,MAAM,EAEN,YAAY,EACZ,QAAQ,EAET,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAEL,GAAG,EACH,YAAY,EACZ,SAAS,EAIV,MAAM,OAAO,CAAC;AAUf,MAAM,MAAM,sBAAsB,GAC9B,OAAO,GACP,OAAO,GACP,cAAc,GACd,cAAc,CAAC;AAEnB,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EACL,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,GACrC,YAAY,CAAC,gBAAgB,CAAC,GAC9B,QAAQ,CAAC,SAAS,CAAC,GACnB,OAAO,GACP,IAAI,CAAC;IACT,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAID,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,oDA+D1C;yBA/De,OAAO"}
|
|
@@ -7,8 +7,8 @@ import { Button } from '../index';
|
|
|
7
7
|
import { toolbarContext, useToolbarContext, } from './toolbarContext';
|
|
8
8
|
const border = '1px solid rgb(247, 247, 247)';
|
|
9
9
|
export function Toolbar(props) {
|
|
10
|
-
const { children, disabled, intent, large, vertical } = props;
|
|
11
|
-
const contextValue = useMemo(() => ({ intent, large, vertical, disabled }), [intent, large, vertical, disabled]);
|
|
10
|
+
const { children, disabled, intent, large, vertical, popoverInteractionKind, } = props;
|
|
11
|
+
const contextValue = useMemo(() => ({ intent, large, vertical, disabled, popoverInteractionKind }), [intent, large, vertical, disabled, popoverInteractionKind]);
|
|
12
12
|
const ref = useRef(null);
|
|
13
13
|
// Work around wrong width on vertical flex when wrapping
|
|
14
14
|
// In Chrome: recently fixed (https://bugs.chromium.org/p/chromium/issues/detail?id=507397)
|
|
@@ -91,8 +91,8 @@ Toolbar.Item = function ToolbarItem(props) {
|
|
|
91
91
|
};
|
|
92
92
|
Toolbar.PopoverItem = function ToolbarPopoverItem(props) {
|
|
93
93
|
const { itemProps, ...other } = props;
|
|
94
|
-
const { disabled, vertical } = useToolbarContext();
|
|
95
|
-
return (_jsx(Popover, { minimal: true, disabled: disabled, placement: vertical ? 'right-start' : 'bottom-start', css: css `
|
|
94
|
+
const { disabled, vertical, popoverInteractionKind } = useToolbarContext();
|
|
95
|
+
return (_jsx(Popover, { minimal: true, disabled: disabled, placement: vertical ? 'right-start' : 'bottom-start', interactionKind: popoverInteractionKind, hoverCloseDelay: 0, css: css `
|
|
96
96
|
.${Classes.ICON} {
|
|
97
97
|
color: ${Colors.DARK_GRAY3};
|
|
98
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EACL,WAAW,EACX,OAAO,EACP,MAAM,EAEN,OAAO,
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EACL,WAAW,EACX,OAAO,EACP,MAAM,EAEN,OAAO,EAGP,IAAI,GACL,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EACL,YAAY,EAIZ,eAAe,EACf,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAEL,cAAc,EACd,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAyC1B,MAAM,MAAM,GAAG,8BAA8B,CAAC;AAE9C,MAAM,UAAU,OAAO,CAAC,KAAmB;IACzC,MAAM,EACJ,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,EACL,QAAQ,EACR,sBAAsB,GACvB,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,OAAO,CAC1B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,sBAAsB,EAAE,CAAC,EACrE,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,sBAAsB,CAAC,CAC5D,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P,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,EACpD,eAAe,EAAE,sBAAsB,EACvC,eAAe,EAAE,CAAC,EAClB,GAAG,EAAE,GAAG,CAAA;WACH,OAAO,CAAC,IAAI;mBACJ,MAAM,CAAC,UAAU;;OAE7B,EACD,WAAW,EAAE;YACX,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,QAAQ,EAAE,SAAS;gBACnB,KAAK,EAAE,aAAa;gBACpB,MAAM,EAAE,aAAa;gBACrB,IAAI,EAAE,MAAM;aACb;SACF,KACG,KAAK,YAET,KAAC,OAAO,CAAC,IAAI,IAAC,SAAS,QAAC,SAAS,WAAK,SAAS,GAAI,GAC3C,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,KAGxB;IACC,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YACxC,KAAK,CAAC,QAAQ,GACS,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Intent } from '@blueprintjs/core';
|
|
3
|
+
import { PopoverInteractionType } from './Toolbar';
|
|
3
4
|
export interface ToolbarContext {
|
|
4
5
|
intent?: Intent;
|
|
5
6
|
large?: boolean;
|
|
6
7
|
vertical?: boolean;
|
|
7
8
|
disabled?: boolean;
|
|
9
|
+
popoverInteractionKind?: PopoverInteractionType;
|
|
8
10
|
}
|
|
9
11
|
export declare const toolbarContext: import("react").Context<ToolbarContext | null>;
|
|
10
12
|
export declare function useToolbarContext(): ToolbarContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbarContext.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/toolbarContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"toolbarContext.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/toolbarContext.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD;AAED,eAAO,MAAM,cAAc,gDAA6C,CAAC;AAEzE,wBAAgB,iBAAiB,mBAQhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbarContext.js","sourceRoot":"","sources":["../../../src/components/toolbar/toolbarContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"toolbarContext.js","sourceRoot":"","sources":["../../../src/components/toolbar/toolbarContext.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAYlD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAwB,IAAI,CAAC,CAAC;AAEzE,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-science",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "React components to build scientific applications UI",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./app": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"test-only": "vitest run --coverage "
|
|
52
52
|
},
|
|
53
53
|
"volta": {
|
|
54
|
-
"node": "20.11.
|
|
54
|
+
"node": "20.11.1"
|
|
55
55
|
},
|
|
56
56
|
"overrides": {
|
|
57
57
|
"react": "^18.2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"react-dom": ">=18.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@blueprintjs/select": "^5.
|
|
67
|
+
"@blueprintjs/select": "^5.1.1",
|
|
68
68
|
"@emotion/react": "^11.11.3",
|
|
69
69
|
"@emotion/styled": "^11.11.0",
|
|
70
70
|
"@headlessui/react": "^1.7.18",
|
|
@@ -73,20 +73,20 @@
|
|
|
73
73
|
"@radix-ui/react-checkbox": "^1.0.4",
|
|
74
74
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
75
75
|
"@radix-ui/react-select": "^2.0.0",
|
|
76
|
-
"@tanstack/react-query": "^5.
|
|
77
|
-
"@tanstack/react-table": "^8.
|
|
76
|
+
"@tanstack/react-query": "^5.21.7",
|
|
77
|
+
"@tanstack/react-table": "^8.12.0",
|
|
78
78
|
"biologic-converter": "^0.6.0",
|
|
79
79
|
"cheminfo-types": "^1.7.2",
|
|
80
80
|
"d3-scale-chromatic": "^3.0.0",
|
|
81
81
|
"filelist-utils": "^1.11.0",
|
|
82
82
|
"immer": "^10.0.3",
|
|
83
|
-
"jcampconverter": "^9.6.
|
|
83
|
+
"jcampconverter": "^9.6.1",
|
|
84
84
|
"lodash": "^4.17.21",
|
|
85
85
|
"ml-gsd": "^12.1.3",
|
|
86
86
|
"ml-peak-shape-generator": "^4.1.2",
|
|
87
87
|
"ml-signal-processing": "^1.0.3",
|
|
88
|
-
"ml-spectra-processing": "^12.
|
|
89
|
-
"ms-spectrum": "^3.4.
|
|
88
|
+
"ml-spectra-processing": "^12.10.2",
|
|
89
|
+
"ms-spectrum": "^3.4.2",
|
|
90
90
|
"netcdfjs": "^3.0.0",
|
|
91
91
|
"react-d3-utils": "^1.0.0",
|
|
92
92
|
"react-dropzone": "^14.2.3",
|
|
@@ -102,41 +102,41 @@
|
|
|
102
102
|
"wdf-parser": "^0.3.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@babel/core": "^7.23.
|
|
106
|
-
"@babel/eslint-parser": "^7.23.
|
|
105
|
+
"@babel/core": "^7.23.9",
|
|
106
|
+
"@babel/eslint-parser": "^7.23.10",
|
|
107
107
|
"@babel/preset-react": "^7.23.3",
|
|
108
|
-
"@blueprintjs/core": "^5.
|
|
109
|
-
"@blueprintjs/icons": "^5.7.
|
|
110
|
-
"@playwright/experimental-ct-react": "^1.41.
|
|
111
|
-
"@playwright/test": "^1.41.
|
|
112
|
-
"@storybook/addon-essentials": "7.6.
|
|
113
|
-
"@storybook/addon-storysource": "7.6.
|
|
114
|
-
"@storybook/blocks": "7.6.
|
|
115
|
-
"@storybook/react": "7.6.
|
|
116
|
-
"@storybook/react-vite": "7.6.
|
|
108
|
+
"@blueprintjs/core": "^5.9.1",
|
|
109
|
+
"@blueprintjs/icons": "^5.7.1",
|
|
110
|
+
"@playwright/experimental-ct-react": "^1.41.2",
|
|
111
|
+
"@playwright/test": "^1.41.2",
|
|
112
|
+
"@storybook/addon-essentials": "7.6.16",
|
|
113
|
+
"@storybook/addon-storysource": "7.6.16",
|
|
114
|
+
"@storybook/blocks": "7.6.16",
|
|
115
|
+
"@storybook/react": "7.6.16",
|
|
116
|
+
"@storybook/react-vite": "7.6.16",
|
|
117
117
|
"@types/babel__core": "^7.20.5",
|
|
118
118
|
"@types/d3-scale-chromatic": "^3.0.3",
|
|
119
119
|
"@types/lodash": "^4.14.202",
|
|
120
|
-
"@types/react": "^18.2.
|
|
121
|
-
"@types/react-dom": "^18.2.
|
|
120
|
+
"@types/react": "^18.2.56",
|
|
121
|
+
"@types/react-dom": "^18.2.19",
|
|
122
122
|
"@types/react-inspector": "^4.0.6",
|
|
123
123
|
"@types/tinycolor2": "^1.4.6",
|
|
124
124
|
"@vitejs/plugin-react": "^4.2.1",
|
|
125
|
-
"@vitest/coverage-v8": "^1.
|
|
125
|
+
"@vitest/coverage-v8": "^1.3.0",
|
|
126
126
|
"cheminfo-font": "^1.13.0",
|
|
127
127
|
"cross-env": "^7.0.3",
|
|
128
128
|
"eslint": "^8.56.0",
|
|
129
129
|
"eslint-config-zakodium": "^8.1.0",
|
|
130
|
-
"eslint-plugin-storybook": "^0.
|
|
131
|
-
"prettier": "^3.2.
|
|
130
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
131
|
+
"prettier": "^3.2.5",
|
|
132
132
|
"react": "^18.2.0",
|
|
133
133
|
"react-dom": "^18.2.0",
|
|
134
134
|
"react-ocl": "^6.1.0",
|
|
135
135
|
"rimraf": "^5.0.5",
|
|
136
|
-
"storybook": "7.6.
|
|
136
|
+
"storybook": "7.6.16",
|
|
137
137
|
"typescript": "^5.3.3",
|
|
138
|
-
"vite": "^5.
|
|
139
|
-
"vitest": "^1.
|
|
138
|
+
"vite": "^5.1.3",
|
|
139
|
+
"vitest": "^1.3.0"
|
|
140
140
|
},
|
|
141
141
|
"repository": {
|
|
142
142
|
"type": "git",
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
/** @jsxImportSource @emotion/react */
|
|
1
2
|
import {
|
|
2
3
|
AnchorButton as BlueprintAnchorButton,
|
|
3
4
|
AnchorButtonProps as BlueprintAnchorButtonProps,
|
|
4
5
|
Button as BlueprintButton,
|
|
5
6
|
ButtonProps as BlueprintButtonProps,
|
|
7
|
+
Tag,
|
|
8
|
+
TagProps,
|
|
6
9
|
Tooltip,
|
|
7
10
|
TooltipProps,
|
|
8
11
|
} from '@blueprintjs/core';
|
|
12
|
+
import { css } from '@emotion/react';
|
|
13
|
+
import { ReactNode } from 'react';
|
|
9
14
|
|
|
10
15
|
type BlueprintProps = {
|
|
11
16
|
[key in keyof BlueprintButtonProps &
|
|
@@ -14,10 +19,12 @@ type BlueprintProps = {
|
|
|
14
19
|
};
|
|
15
20
|
export type ButtonProps = BlueprintProps & {
|
|
16
21
|
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
22
|
+
tag?: ReactNode;
|
|
23
|
+
tagProps?: Omit<TagProps, 'children'>;
|
|
17
24
|
};
|
|
18
25
|
|
|
19
26
|
export function Button(props: ButtonProps) {
|
|
20
|
-
const { tooltipProps, children, ...buttonProps } = props;
|
|
27
|
+
const { tooltipProps, children, tag, tagProps, ...buttonProps } = props;
|
|
21
28
|
|
|
22
29
|
const InnerButton = buttonProps.disabled
|
|
23
30
|
? BlueprintAnchorButton
|
|
@@ -27,9 +34,33 @@ export function Button(props: ButtonProps) {
|
|
|
27
34
|
fill={tooltipProps?.fill || buttonProps.fill}
|
|
28
35
|
{...tooltipProps}
|
|
29
36
|
renderTarget={({ isOpen, ...targetProps }) => (
|
|
30
|
-
<
|
|
31
|
-
{
|
|
32
|
-
|
|
37
|
+
<div style={{ position: 'relative' }}>
|
|
38
|
+
{tag && (
|
|
39
|
+
<Tag
|
|
40
|
+
css={css`
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 0;
|
|
43
|
+
left: 0;
|
|
44
|
+
cursor: default;
|
|
45
|
+
font-size: 0.875em;
|
|
46
|
+
padding: 2px !important;
|
|
47
|
+
min-height: 15px;
|
|
48
|
+
min-width: 15px;
|
|
49
|
+
line-height: 1em;
|
|
50
|
+
text-align: center;
|
|
51
|
+
z-index: 20;
|
|
52
|
+
`}
|
|
53
|
+
round
|
|
54
|
+
intent="success"
|
|
55
|
+
{...tagProps}
|
|
56
|
+
>
|
|
57
|
+
{tag}
|
|
58
|
+
</Tag>
|
|
59
|
+
)}
|
|
60
|
+
<InnerButton {...targetProps} {...buttonProps} style={{}}>
|
|
61
|
+
{children}
|
|
62
|
+
</InnerButton>
|
|
63
|
+
</div>
|
|
33
64
|
)}
|
|
34
65
|
/>
|
|
35
66
|
);
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { Button, Colors, NonIdealState } from '@blueprintjs/core';
|
|
2
2
|
import type { IconName } from '@blueprintjs/icons';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import { CSSProperties, MouseEventHandler
|
|
5
|
-
import {
|
|
4
|
+
import { CSSProperties, MouseEventHandler } from 'react';
|
|
5
|
+
import { DropzoneOptions, useDropzone } from 'react-dropzone';
|
|
6
6
|
import tinycolor from 'tinycolor2';
|
|
7
7
|
|
|
8
|
-
export interface DropZoneProps {
|
|
8
|
+
export interface DropZoneProps extends DropzoneOptions {
|
|
9
9
|
borderColor?: string;
|
|
10
|
-
onDrop?: <T extends File>(
|
|
11
|
-
acceptedFiles: T[],
|
|
12
|
-
rejectedFiles?: FileRejection[],
|
|
13
|
-
) => void;
|
|
14
|
-
fileValidator?: <T extends File>(file: T) => FileError | FileError[] | null;
|
|
15
10
|
emptyIcon?: IconName;
|
|
16
11
|
emptyTitle?: string;
|
|
17
12
|
emptyDescription?: string;
|
|
@@ -85,39 +80,25 @@ function DropZoneContent(
|
|
|
85
80
|
const {
|
|
86
81
|
borderColor = Colors.GRAY3,
|
|
87
82
|
children = null,
|
|
88
|
-
onDrop,
|
|
89
83
|
onClick,
|
|
90
|
-
fileValidator,
|
|
91
84
|
emptyIcon = 'import',
|
|
92
85
|
emptyTitle = 'No data loaded',
|
|
93
86
|
emptyDescription = 'You can load data by drag-and-dropping files here',
|
|
94
87
|
emptyButtonText = 'Select files',
|
|
95
88
|
emptyButtonIcon = 'plus',
|
|
89
|
+
noClick,
|
|
90
|
+
...otherProps
|
|
96
91
|
} = props;
|
|
97
92
|
|
|
98
93
|
const hasChildren = children !== null;
|
|
99
94
|
|
|
100
|
-
const handleOnDrop = useCallback(
|
|
101
|
-
<T extends File>(acceptedFiles: T[], rejectedFiles: FileRejection[]) => {
|
|
102
|
-
onDrop?.(acceptedFiles, rejectedFiles);
|
|
103
|
-
},
|
|
104
|
-
[onDrop],
|
|
105
|
-
);
|
|
106
|
-
|
|
107
95
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
108
|
-
noClick: hasChildren,
|
|
109
|
-
|
|
110
|
-
onDrop: handleOnDrop,
|
|
96
|
+
noClick: noClick ?? hasChildren,
|
|
97
|
+
...otherProps,
|
|
111
98
|
});
|
|
112
99
|
|
|
113
|
-
const getPropsOptions = useMemo(() => {
|
|
114
|
-
if (onClick) {
|
|
115
|
-
return { onClick };
|
|
116
|
-
}
|
|
117
|
-
}, [onClick]);
|
|
118
|
-
|
|
119
100
|
return (
|
|
120
|
-
<DropzoneRoot {...getRootProps(
|
|
101
|
+
<DropzoneRoot {...getRootProps({ onClick })}>
|
|
121
102
|
{children}
|
|
122
103
|
{isDragActive ? (
|
|
123
104
|
<DropzoneDragActive borderColor={borderColor}>
|