react-science 0.30.1 → 0.31.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import {
|
|
2
|
+
import { Intent } from '@blueprintjs/core';
|
|
3
3
|
import { ReactElement, ReactNode } from 'react';
|
|
4
|
+
import { ButtonProps } from '../index';
|
|
4
5
|
export interface ToolbarProps {
|
|
5
6
|
vertical?: boolean;
|
|
6
7
|
large?: boolean;
|
|
@@ -15,6 +16,7 @@ export interface ToolbarItemProps {
|
|
|
15
16
|
active?: boolean;
|
|
16
17
|
onClick?: (item: ToolbarItemProps) => void;
|
|
17
18
|
className?: string;
|
|
19
|
+
intent?: Intent;
|
|
18
20
|
}
|
|
19
21
|
export declare function Toolbar(props: ToolbarProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
20
22
|
export declare namespace Toolbar {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAgC,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EACL,YAAY,EACZ,SAAS,EAIV,MAAM,OAAO,CAAC;AAEf,OAAO,EAAU,WAAW,EAAE,MAAM,UAAU,CAAC;AAQ/C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,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;CACV;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAID,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,oDAuD1C;yBAvDe,OAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { ButtonGroup, Classes, Colors
|
|
3
|
+
import { ButtonGroup, Classes, Colors } from '@blueprintjs/core';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { useLayoutEffect, useMemo, useRef, } from 'react';
|
|
6
6
|
import { Button } from '../index';
|
|
@@ -38,24 +38,27 @@ export function Toolbar(props) {
|
|
|
38
38
|
return () => observer.unobserve(element);
|
|
39
39
|
}
|
|
40
40
|
}, [vertical]);
|
|
41
|
-
return (_jsx(ToolbarProvider, { value: contextValue, children: _jsx(ButtonGroup, { ref: ref, vertical: vertical, large: large, style: {
|
|
41
|
+
return (_jsx(ToolbarProvider, { value: contextValue, children: _jsx(ButtonGroup, { ref: ref, vertical: vertical, large: large, style: {
|
|
42
|
+
flexWrap: 'wrap',
|
|
43
|
+
borderRight: vertical ? border : undefined,
|
|
44
|
+
}, children: children }) }));
|
|
42
45
|
}
|
|
43
46
|
Toolbar.Item = function ToolbarItem(props) {
|
|
44
|
-
const { active = false, icon, onClick, title, id, ...other } = props;
|
|
45
|
-
const { intent, large, vertical, disabled } = useToolbarContext();
|
|
47
|
+
const { active = false, icon, onClick, title, id, intent: itemIntent, ...other } = props;
|
|
48
|
+
const { intent: toolbarIntent, large, vertical, disabled, } = useToolbarContext();
|
|
49
|
+
const intent = itemIntent || toolbarIntent;
|
|
46
50
|
return (_jsx(Button, { minimal: true, disabled: disabled, css: css `
|
|
47
51
|
.${Classes.ICON} {
|
|
48
52
|
color: ${Colors.DARK_GRAY3};
|
|
49
53
|
}
|
|
50
|
-
`, intent: intent, style: { position: 'relative', fontSize: '1.25em', width: '
|
|
51
|
-
|
|
52
|
-
onClick(props);
|
|
53
|
-
}
|
|
54
|
+
`, intent: intent, style: { position: 'relative', fontSize: '1.25em', width: 'fit-content' }, type: "button", active: active, icon: icon, onClick: () => {
|
|
55
|
+
onClick?.(props);
|
|
54
56
|
}, tooltipProps: {
|
|
55
57
|
content: title,
|
|
56
58
|
placement: vertical ? 'right' : 'bottom',
|
|
57
59
|
intent,
|
|
58
60
|
compact: !large,
|
|
61
|
+
targetProps: { style: { flex: 'none' } },
|
|
59
62
|
}, ...other }));
|
|
60
63
|
};
|
|
61
64
|
function ToolbarProvider(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../src/components/toolbar/Toolbar.tsx"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAU,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAGL,eAAe,EACf,OAAO,EACP,MAAM,GACP,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,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EAAE,EACzE,IAAI,EAAC,QAAQ,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,EACD,YAAY,EAAE;YACZ,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;YACxC,MAAM;YACN,OAAO,EAAE,CAAC,KAAK;YACf,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;SACzC,KACG,KAAK,GACT,CACH,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"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
|
-
import {
|
|
3
|
-
ButtonGroup,
|
|
4
|
-
ButtonProps,
|
|
5
|
-
Classes,
|
|
6
|
-
Colors,
|
|
7
|
-
Intent,
|
|
8
|
-
} from '@blueprintjs/core';
|
|
2
|
+
import { ButtonGroup, Classes, Colors, Intent } from '@blueprintjs/core';
|
|
9
3
|
import { css } from '@emotion/react';
|
|
10
4
|
import {
|
|
11
5
|
ReactElement,
|
|
@@ -15,7 +9,7 @@ import {
|
|
|
15
9
|
useRef,
|
|
16
10
|
} from 'react';
|
|
17
11
|
|
|
18
|
-
import { Button } from '../index';
|
|
12
|
+
import { Button, ButtonProps } from '../index';
|
|
19
13
|
|
|
20
14
|
import {
|
|
21
15
|
ToolbarContext,
|
|
@@ -43,6 +37,7 @@ export interface ToolbarItemProps {
|
|
|
43
37
|
active?: boolean;
|
|
44
38
|
onClick?: (item: ToolbarItemProps) => void;
|
|
45
39
|
className?: string;
|
|
40
|
+
intent?: Intent;
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
const border = '1px solid rgb(247, 247, 247)';
|
|
@@ -54,7 +49,6 @@ export function Toolbar(props: ToolbarProps) {
|
|
|
54
49
|
() => ({ intent, large, vertical, disabled }),
|
|
55
50
|
[intent, large, vertical, disabled],
|
|
56
51
|
);
|
|
57
|
-
|
|
58
52
|
const ref = useRef<HTMLDivElement>(null);
|
|
59
53
|
|
|
60
54
|
// Work around wrong width on vertical flex when wrapping
|
|
@@ -87,13 +81,17 @@ export function Toolbar(props: ToolbarProps) {
|
|
|
87
81
|
return () => observer.unobserve(element);
|
|
88
82
|
}
|
|
89
83
|
}, [vertical]);
|
|
84
|
+
|
|
90
85
|
return (
|
|
91
86
|
<ToolbarProvider value={contextValue}>
|
|
92
87
|
<ButtonGroup
|
|
93
88
|
ref={ref}
|
|
94
89
|
vertical={vertical}
|
|
95
90
|
large={large}
|
|
96
|
-
style={{
|
|
91
|
+
style={{
|
|
92
|
+
flexWrap: 'wrap',
|
|
93
|
+
borderRight: vertical ? border : undefined,
|
|
94
|
+
}}
|
|
97
95
|
>
|
|
98
96
|
{children}
|
|
99
97
|
</ButtonGroup>
|
|
@@ -102,9 +100,23 @@ export function Toolbar(props: ToolbarProps) {
|
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
105
|
-
const {
|
|
103
|
+
const {
|
|
104
|
+
active = false,
|
|
105
|
+
icon,
|
|
106
|
+
onClick,
|
|
107
|
+
title,
|
|
108
|
+
id,
|
|
109
|
+
intent: itemIntent,
|
|
110
|
+
...other
|
|
111
|
+
} = props;
|
|
106
112
|
|
|
107
|
-
const {
|
|
113
|
+
const {
|
|
114
|
+
intent: toolbarIntent,
|
|
115
|
+
large,
|
|
116
|
+
vertical,
|
|
117
|
+
disabled,
|
|
118
|
+
} = useToolbarContext();
|
|
119
|
+
const intent = itemIntent || toolbarIntent;
|
|
108
120
|
return (
|
|
109
121
|
<Button
|
|
110
122
|
minimal
|
|
@@ -115,20 +127,19 @@ Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
|
115
127
|
}
|
|
116
128
|
`}
|
|
117
129
|
intent={intent}
|
|
118
|
-
style={{ position: 'relative', fontSize: '1.25em', width: '
|
|
130
|
+
style={{ position: 'relative', fontSize: '1.25em', width: 'fit-content' }}
|
|
119
131
|
type="button"
|
|
120
132
|
active={active}
|
|
121
133
|
icon={icon}
|
|
122
134
|
onClick={() => {
|
|
123
|
-
|
|
124
|
-
onClick(props);
|
|
125
|
-
}
|
|
135
|
+
onClick?.(props);
|
|
126
136
|
}}
|
|
127
137
|
tooltipProps={{
|
|
128
138
|
content: title,
|
|
129
139
|
placement: vertical ? 'right' : 'bottom',
|
|
130
140
|
intent,
|
|
131
141
|
compact: !large,
|
|
142
|
+
targetProps: { style: { flex: 'none' } },
|
|
132
143
|
}}
|
|
133
144
|
{...other}
|
|
134
145
|
/>
|