react-science 6.0.2 → 7.0.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.map +1 -1
- package/lib/components/button/Button.js +19 -13
- package/lib/components/button/Button.js.map +1 -1
- package/lib/components/header/PanelHeader.d.ts.map +1 -1
- package/lib/components/header/PanelHeader.js +2 -19
- package/lib/components/header/PanelHeader.js.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +1 -0
- package/lib/components/index.js.map +1 -1
- package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib/components/info-panel/InfoPanel.js +2 -1
- package/lib/components/info-panel/InfoPanel.js.map +1 -1
- package/lib/components/selected-total/SelectedTotal.d.ts +7 -0
- package/lib/components/selected-total/SelectedTotal.d.ts.map +1 -0
- package/lib/components/selected-total/SelectedTotal.js +25 -0
- package/lib/components/selected-total/SelectedTotal.js.map +1 -0
- package/lib/components/selected-total/index.d.ts +2 -0
- package/lib/components/selected-total/index.d.ts.map +1 -0
- package/lib/components/selected-total/index.js +18 -0
- package/lib/components/selected-total/index.js.map +1 -0
- package/lib/components/toolbar/Toolbar.d.ts +5 -14
- package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/toolbar/Toolbar.js +28 -13
- package/lib/components/toolbar/Toolbar.js.map +1 -1
- package/lib-esm/components/button/Button.d.ts.map +1 -1
- package/lib-esm/components/button/Button.js +20 -14
- package/lib-esm/components/button/Button.js.map +1 -1
- package/lib-esm/components/header/PanelHeader.d.ts.map +1 -1
- package/lib-esm/components/header/PanelHeader.js +2 -19
- package/lib-esm/components/header/PanelHeader.js.map +1 -1
- package/lib-esm/components/index.d.ts +1 -0
- package/lib-esm/components/index.d.ts.map +1 -1
- package/lib-esm/components/index.js +1 -0
- package/lib-esm/components/index.js.map +1 -1
- package/lib-esm/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib-esm/components/info-panel/InfoPanel.js +2 -1
- package/lib-esm/components/info-panel/InfoPanel.js.map +1 -1
- package/lib-esm/components/selected-total/SelectedTotal.d.ts +7 -0
- package/lib-esm/components/selected-total/SelectedTotal.d.ts.map +1 -0
- package/lib-esm/components/selected-total/SelectedTotal.js +22 -0
- package/lib-esm/components/selected-total/SelectedTotal.js.map +1 -0
- package/lib-esm/components/selected-total/index.d.ts +2 -0
- package/lib-esm/components/selected-total/index.d.ts.map +1 -0
- package/lib-esm/components/selected-total/index.js +2 -0
- package/lib-esm/components/selected-total/index.js.map +1 -0
- package/lib-esm/components/toolbar/Toolbar.d.ts +5 -14
- package/lib-esm/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib-esm/components/toolbar/Toolbar.js +28 -13
- package/lib-esm/components/toolbar/Toolbar.js.map +1 -1
- package/package.json +1 -1
- package/src/components/button/Button.tsx +41 -28
- package/src/components/header/PanelHeader.tsx +2 -20
- package/src/components/index.ts +1 -0
- package/src/components/info-panel/InfoPanel.tsx +2 -1
- package/src/components/selected-total/SelectedTotal.tsx +32 -0
- package/src/components/selected-total/index.ts +1 -0
- package/src/components/toolbar/Toolbar.tsx +42 -32
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
/** @jsxImportSource @emotion/react */
|
|
2
2
|
import {
|
|
3
3
|
ButtonGroup,
|
|
4
|
+
ButtonGroupProps,
|
|
4
5
|
Classes,
|
|
5
6
|
Colors,
|
|
6
7
|
Icon,
|
|
7
8
|
Intent,
|
|
8
9
|
Popover,
|
|
9
10
|
PopoverProps,
|
|
10
|
-
TagProps,
|
|
11
11
|
TooltipProps,
|
|
12
12
|
} from '@blueprintjs/core';
|
|
13
|
-
import { IconName } from '@blueprintjs/icons';
|
|
14
13
|
import { css } from '@emotion/react';
|
|
15
14
|
import {
|
|
16
15
|
cloneElement,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type ReactNode,
|
|
16
|
+
MouseEvent,
|
|
17
|
+
ReactNode,
|
|
20
18
|
useLayoutEffect,
|
|
21
19
|
useMemo,
|
|
22
20
|
useRef,
|
|
23
21
|
} from 'react';
|
|
24
22
|
|
|
25
|
-
import { Button } from '../button';
|
|
23
|
+
import { Button, ButtonProps } from '../button';
|
|
26
24
|
|
|
27
25
|
import {
|
|
28
26
|
ToolbarContext,
|
|
@@ -40,33 +38,26 @@ interface ToolbarBaseProps {
|
|
|
40
38
|
intent?: Intent;
|
|
41
39
|
disabled?: boolean;
|
|
42
40
|
}
|
|
43
|
-
export interface ToolbarProps
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| Iterable<ReactNode>
|
|
50
|
-
| boolean
|
|
51
|
-
| null;
|
|
41
|
+
export interface ToolbarProps
|
|
42
|
+
extends ToolbarBaseProps,
|
|
43
|
+
Pick<
|
|
44
|
+
ButtonGroupProps,
|
|
45
|
+
'children' | 'minimal' | 'large' | 'vertical' | 'fill'
|
|
46
|
+
> {
|
|
52
47
|
popoverInteractionKind?: PopoverInteractionType;
|
|
53
48
|
}
|
|
54
49
|
|
|
55
|
-
export interface ToolbarItemProps
|
|
56
|
-
|
|
50
|
+
export interface ToolbarItemProps
|
|
51
|
+
extends ToolbarBaseProps,
|
|
52
|
+
Pick<ButtonProps, 'id' | 'icon' | 'active' | 'tag' | 'tagProps'> {
|
|
57
53
|
tooltip?: TooltipProps['content'];
|
|
58
54
|
tooltipProps?: Omit<TooltipProps, 'content'>;
|
|
59
|
-
icon: IconName | ReactElement;
|
|
60
|
-
active?: boolean;
|
|
61
55
|
onClick?: (
|
|
62
56
|
item: ToolbarItemProps & {
|
|
63
57
|
event: MouseEvent;
|
|
64
58
|
},
|
|
65
59
|
) => void;
|
|
66
|
-
className?: string;
|
|
67
60
|
isPopover?: boolean;
|
|
68
|
-
tag?: ReactNode;
|
|
69
|
-
tagProps?: Omit<TagProps, 'children'>;
|
|
70
61
|
}
|
|
71
62
|
|
|
72
63
|
export interface ToolbarPopoverItemProps extends PopoverProps {
|
|
@@ -83,10 +74,18 @@ export function Toolbar(props: ToolbarProps) {
|
|
|
83
74
|
large,
|
|
84
75
|
vertical,
|
|
85
76
|
popoverInteractionKind,
|
|
77
|
+
minimal,
|
|
78
|
+
fill,
|
|
86
79
|
} = props;
|
|
87
80
|
|
|
88
81
|
const contextValue = useMemo(
|
|
89
|
-
() => ({
|
|
82
|
+
() => ({
|
|
83
|
+
intent,
|
|
84
|
+
large,
|
|
85
|
+
vertical,
|
|
86
|
+
disabled,
|
|
87
|
+
popoverInteractionKind,
|
|
88
|
+
}),
|
|
90
89
|
[intent, large, vertical, disabled, popoverInteractionKind],
|
|
91
90
|
);
|
|
92
91
|
const ref = useRef<HTMLDivElement>(null);
|
|
@@ -124,11 +123,13 @@ export function Toolbar(props: ToolbarProps) {
|
|
|
124
123
|
return (
|
|
125
124
|
<ToolbarProvider value={contextValue}>
|
|
126
125
|
<ButtonGroup
|
|
126
|
+
fill={fill}
|
|
127
127
|
// Reset because of layout effect above
|
|
128
128
|
// TODO: remove once the workaround is no longer needed
|
|
129
129
|
key={String(vertical)}
|
|
130
130
|
vertical={vertical}
|
|
131
131
|
large={large}
|
|
132
|
+
minimal={minimal}
|
|
132
133
|
style={{
|
|
133
134
|
flexWrap: 'wrap',
|
|
134
135
|
borderRight: vertical ? border : undefined,
|
|
@@ -147,7 +148,6 @@ Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
|
147
148
|
onClick,
|
|
148
149
|
tooltip,
|
|
149
150
|
tooltipProps,
|
|
150
|
-
id,
|
|
151
151
|
intent: itemIntent,
|
|
152
152
|
disabled: itemDisabled,
|
|
153
153
|
isPopover,
|
|
@@ -163,7 +163,7 @@ Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
|
163
163
|
const intent = itemIntent ?? toolbarIntent;
|
|
164
164
|
const disabled = itemDisabled ?? toolbarDisabled;
|
|
165
165
|
const resizedIcon =
|
|
166
|
-
typeof icon === 'string'
|
|
166
|
+
!icon || typeof icon === 'string'
|
|
167
167
|
? icon
|
|
168
168
|
: cloneElement(icon, {
|
|
169
169
|
className: icon.props.className
|
|
@@ -174,19 +174,28 @@ Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
|
174
174
|
return (
|
|
175
175
|
<Button
|
|
176
176
|
alignText={isPopover ? 'left' : undefined}
|
|
177
|
-
minimal
|
|
178
177
|
disabled={disabled}
|
|
179
178
|
css={css`
|
|
180
179
|
.${Classes.ICON} {
|
|
181
180
|
color: ${Colors.DARK_GRAY3};
|
|
182
181
|
}
|
|
182
|
+
.bp5-icon {
|
|
183
|
+
width: ${large ? '20px' : '16px'};
|
|
184
|
+
height: ${large ? '20px' : '16px'};
|
|
185
|
+
font-size: ${large ? '14px' : '12px'};
|
|
186
|
+
}
|
|
187
|
+
.bp5-tag {
|
|
188
|
+
font-size: ${large ? '12px' : '10px'};
|
|
189
|
+
line-height: ${large ? '14px' : '12px'};
|
|
190
|
+
min-width: ${large ? '18px' : '15px'};
|
|
191
|
+
min-height: ${large ? '18px' : '15px'};
|
|
192
|
+
}
|
|
183
193
|
`}
|
|
184
194
|
intent={intent}
|
|
185
195
|
style={{
|
|
186
196
|
position: 'relative',
|
|
187
197
|
fontSize: '1.125em',
|
|
188
198
|
width: 'fit-content',
|
|
189
|
-
flex: 'none',
|
|
190
199
|
}}
|
|
191
200
|
type="button"
|
|
192
201
|
active={active}
|
|
@@ -198,9 +207,10 @@ Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
|
198
207
|
alignItems: 'center',
|
|
199
208
|
width: 0,
|
|
200
209
|
height: 0,
|
|
210
|
+
marginRight: 0,
|
|
201
211
|
}}
|
|
202
212
|
>
|
|
203
|
-
<Icon icon={resizedIcon} />
|
|
213
|
+
<Icon icon={resizedIcon} size={large ? 20 : 16} />
|
|
204
214
|
{isPopover && (
|
|
205
215
|
<Icon
|
|
206
216
|
icon="caret-right"
|
|
@@ -210,6 +220,8 @@ Toolbar.Item = function ToolbarItem(props: ToolbarItemProps) {
|
|
|
210
220
|
position: 'absolute',
|
|
211
221
|
bottom: 0,
|
|
212
222
|
right: 0,
|
|
223
|
+
width: large ? 14 : 9,
|
|
224
|
+
height: large ? 14 : 9,
|
|
213
225
|
}}
|
|
214
226
|
/>
|
|
215
227
|
)}
|
|
@@ -260,13 +272,11 @@ Toolbar.PopoverItem = function ToolbarPopoverItem(
|
|
|
260
272
|
fontSize: '1.125em',
|
|
261
273
|
width: 'fit-content',
|
|
262
274
|
height: 'fit-content',
|
|
263
|
-
flex: 'none',
|
|
264
275
|
},
|
|
265
276
|
}}
|
|
277
|
+
renderTarget={() => <Toolbar.Item isPopover {...itemProps} />}
|
|
266
278
|
{...other}
|
|
267
|
-
|
|
268
|
-
<Toolbar.Item isPopover {...itemProps} />
|
|
269
|
-
</Popover>
|
|
279
|
+
/>
|
|
270
280
|
);
|
|
271
281
|
};
|
|
272
282
|
|