react-science 12.1.0 → 13.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/README.md +11 -3
- package/lib/components/accordion/accordion.d.ts +2 -2
- package/lib/components/accordion/accordion.d.ts.map +1 -1
- package/lib/components/accordion/accordion.js +26 -42
- package/lib/components/accordion/accordion.js.map +1 -1
- package/lib/components/accordion/accordion_context.d.ts +1 -1
- package/lib/components/accordion/accordion_context.js +1 -1
- package/lib/components/accordion/accordion_context.provider.d.ts +9 -2
- package/lib/components/accordion/accordion_context.provider.d.ts.map +1 -1
- package/lib/components/accordion/accordion_context.provider.js +49 -32
- package/lib/components/accordion/accordion_context.provider.js.map +1 -1
- package/lib/components/accordion/accordion_context.utils.d.ts +23 -0
- package/lib/components/accordion/accordion_context.utils.d.ts.map +1 -0
- package/lib/components/accordion/accordion_context.utils.js +40 -0
- package/lib/components/accordion/accordion_context.utils.js.map +1 -0
- package/lib/components/accordion/index.d.ts +1 -1
- package/lib/components/accordion/index.js +1 -1
- package/lib/components/activity_bar/activity_bar.d.ts.map +1 -1
- package/lib/components/activity_bar/activity_bar.js +6 -4
- package/lib/components/activity_bar/activity_bar.js.map +1 -1
- package/lib/components/button/Button.d.ts +2 -3
- package/lib/components/button/Button.d.ts.map +1 -1
- package/lib/components/button/Button.js +31 -27
- package/lib/components/button/Button.js.map +1 -1
- package/lib/components/color-picker/gradient_select/gradient_select.d.ts +1 -1
- package/lib/components/color-picker/gradient_select/gradient_select.d.ts.map +1 -1
- package/lib/components/color-picker/gradient_select/gradient_select.js +8 -9
- package/lib/components/color-picker/gradient_select/gradient_select.js.map +1 -1
- package/lib/components/color-picker/react-color/ColorPicker.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/ColorPicker.js +5 -5
- package/lib/components/color-picker/react-color/ColorPicker.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Saturation.js +5 -5
- package/lib/components/color-picker/react-color/common/Saturation.js.map +1 -1
- package/lib/components/color-picker/react-color/helpers/color.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/helpers/color.js +2 -3
- package/lib/components/color-picker/react-color/helpers/color.js.map +1 -1
- package/lib/components/dialog/ConfirmDialog.d.ts +1 -2
- package/lib/components/dialog/ConfirmDialog.d.ts.map +1 -1
- package/lib/components/dialog/ConfirmDialog.js +12 -9
- package/lib/components/dialog/ConfirmDialog.js.map +1 -1
- package/lib/components/drop-zone/DropZone.d.ts.map +1 -1
- package/lib/components/drop-zone/DropZone.js +3 -7
- package/lib/components/drop-zone/DropZone.js.map +1 -1
- package/lib/components/forms/radio-button-group/RadioButton.d.ts +1 -2
- package/lib/components/forms/radio-button-group/RadioButton.d.ts.map +1 -1
- package/lib/components/forms/radio-button-group/RadioButton.js +5 -4
- package/lib/components/forms/radio-button-group/RadioButton.js.map +1 -1
- package/lib/components/forms/radio-button-group/RadioButtonGroup.d.ts +1 -2
- package/lib/components/forms/radio-button-group/RadioButtonGroup.d.ts.map +1 -1
- package/lib/components/forms/radio-button-group/RadioButtonGroup.js +3 -1
- package/lib/components/forms/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/components/header/Header.d.ts +1 -1
- package/lib/components/header/Header.d.ts.map +1 -1
- package/lib/components/header/Header.js +11 -14
- package/lib/components/header/Header.js.map +1 -1
- package/lib/components/header/PanelHeader.d.ts +1 -1
- package/lib/components/header/PanelHeader.d.ts.map +1 -1
- package/lib/components/header/PanelHeader.js +22 -23
- package/lib/components/header/PanelHeader.js.map +1 -1
- package/lib/components/info-panel/InfoPanel.d.ts +1 -1
- package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib/components/info-panel/InfoPanel.js +35 -30
- package/lib/components/info-panel/InfoPanel.js.map +1 -1
- package/lib/components/inline_editable_renderer/index.d.ts +2 -0
- package/lib/components/inline_editable_renderer/index.d.ts.map +1 -0
- package/lib/components/inline_editable_renderer/index.js +2 -0
- package/lib/components/inline_editable_renderer/index.js.map +1 -0
- package/lib/components/inline_editable_renderer/inline_editable_renderer.d.ts +24 -0
- package/lib/components/inline_editable_renderer/inline_editable_renderer.d.ts.map +1 -0
- package/lib/components/inline_editable_renderer/inline_editable_renderer.js +52 -0
- package/lib/components/inline_editable_renderer/inline_editable_renderer.js.map +1 -0
- package/lib/components/logger/FifoLoggerDialog.d.ts +1 -2
- package/lib/components/logger/FifoLoggerDialog.d.ts.map +1 -1
- package/lib/components/logger/FifoLoggerDialog.js +8 -9
- package/lib/components/logger/FifoLoggerDialog.js.map +1 -1
- package/lib/components/root-layout/css-reset/customPreflight.d.ts.map +1 -1
- package/lib/components/root-layout/css-reset/customPreflight.js +1 -2
- package/lib/components/root-layout/css-reset/customPreflight.js.map +1 -1
- package/lib/components/split-pane/SplitPane.d.ts +36 -19
- package/lib/components/split-pane/SplitPane.d.ts.map +1 -1
- package/lib/components/split-pane/SplitPane.js +69 -79
- package/lib/components/split-pane/SplitPane.js.map +1 -1
- package/lib/components/table/table_body.js +1 -0
- package/lib/components/table/table_body.js.map +1 -1
- package/lib/components/table/table_root.d.ts +11 -4
- package/lib/components/table/table_root.d.ts.map +1 -1
- package/lib/components/table/table_root.js +9 -7
- package/lib/components/table/table_root.js.map +1 -1
- package/lib/components/table/table_utils.d.ts +8 -0
- package/lib/components/table/table_utils.d.ts.map +1 -1
- package/lib/components/table/table_utils.js.map +1 -1
- package/lib/components/table/use_table_scroll.d.ts +5 -0
- package/lib/components/table/use_table_scroll.d.ts.map +1 -0
- package/lib/components/table/use_table_scroll.js +36 -0
- package/lib/components/table/use_table_scroll.js.map +1 -0
- package/lib/components/toolbar/PanelPreferencesToolbar.d.ts +1 -1
- package/lib/components/toolbar/PanelPreferencesToolbar.d.ts.map +1 -1
- package/lib/components/toolbar/PanelPreferencesToolbar.js +24 -27
- package/lib/components/toolbar/PanelPreferencesToolbar.js.map +1 -1
- package/lib/components/toolbar/Toolbar.d.ts +4 -5
- package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/toolbar/Toolbar.js +27 -32
- package/lib/components/toolbar/Toolbar.js.map +1 -1
- package/lib/components/utils/debounce.d.ts +2 -0
- package/lib/components/utils/debounce.d.ts.map +1 -0
- package/lib/components/utils/debounce.js +12 -0
- package/lib/components/utils/debounce.js.map +1 -0
- package/lib/components/utils/index.d.ts +2 -0
- package/lib/components/utils/index.d.ts.map +1 -1
- package/lib/components/utils/index.js +2 -0
- package/lib/components/utils/index.js.map +1 -1
- package/lib/components/utils/throttle.d.ts +2 -0
- package/lib/components/utils/throttle.d.ts.map +1 -0
- package/lib/components/utils/throttle.js +14 -0
- package/lib/components/utils/throttle.js.map +1 -0
- package/lib/components/value-renderers/Color.d.ts +1 -1
- package/lib/components/value-renderers/Color.d.ts.map +1 -1
- package/lib/components/value-renderers/Color.js +7 -13
- package/lib/components/value-renderers/Color.js.map +1 -1
- package/lib/components/value-renderers/Text.d.ts +1 -1
- package/lib/components/value-renderers/Text.d.ts.map +1 -1
- package/lib/components/value-renderers/Text.js +6 -9
- package/lib/components/value-renderers/Text.js.map +1 -1
- package/lib/components/value-renderers/Title.d.ts +1 -1
- package/lib/components/value-renderers/Title.d.ts.map +1 -1
- package/lib/components/value-renderers/Title.js +6 -9
- package/lib/components/value-renderers/Title.js.map +1 -1
- package/package.json +42 -37
- package/src/components/accordion/accordion.tsx +28 -48
- package/src/components/accordion/accordion_context.provider.tsx +74 -36
- package/src/components/accordion/accordion_context.ts +2 -2
- package/src/components/accordion/accordion_context.utils.ts +66 -0
- package/src/components/accordion/index.ts +1 -1
- package/src/components/activity_bar/activity_bar.tsx +6 -4
- package/src/components/button/Button.tsx +47 -35
- package/src/components/color-picker/gradient_select/gradient_select.tsx +9 -11
- package/src/components/color-picker/react-color/ColorPicker.tsx +6 -6
- package/src/components/color-picker/react-color/common/Saturation.tsx +6 -6
- package/src/components/color-picker/react-color/helpers/color.ts +4 -3
- package/src/components/dialog/ConfirmDialog.tsx +14 -11
- package/src/components/drop-zone/DropZone.tsx +3 -7
- package/src/components/forms/radio-button-group/RadioButton.tsx +4 -4
- package/src/components/forms/radio-button-group/RadioButtonGroup.tsx +2 -1
- package/src/components/header/Header.tsx +11 -16
- package/src/components/header/PanelHeader.tsx +26 -30
- package/src/components/info-panel/InfoPanel.tsx +43 -39
- package/src/components/inline_editable_renderer/index.ts +1 -0
- package/src/components/inline_editable_renderer/inline_editable_renderer.tsx +86 -0
- package/src/components/logger/FifoLoggerDialog.tsx +9 -11
- package/src/components/root-layout/css-reset/customPreflight.ts +1 -2
- package/src/components/split-pane/SplitPane.tsx +144 -117
- package/src/components/table/table_body.tsx +1 -0
- package/src/components/table/table_root.tsx +25 -6
- package/src/components/table/table_utils.ts +11 -0
- package/src/components/table/use_table_scroll.ts +55 -0
- package/src/components/toolbar/PanelPreferencesToolbar.tsx +30 -30
- package/src/components/toolbar/Toolbar.tsx +33 -37
- package/src/components/utils/debounce.ts +16 -0
- package/src/components/utils/index.ts +2 -0
- package/src/components/utils/throttle.ts +19 -0
- package/src/components/value-renderers/Color.tsx +8 -13
- package/src/components/value-renderers/Text.tsx +6 -12
- package/src/components/value-renderers/Title.tsx +6 -12
- package/lib/components/accordion/accordion_context.state.d.ts +0 -26
- package/lib/components/accordion/accordion_context.state.d.ts.map +0 -1
- package/lib/components/accordion/accordion_context.state.js +0 -47
- package/lib/components/accordion/accordion_context.state.js.map +0 -1
- package/src/components/accordion/accordion_context.state.ts +0 -84
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import styled from '@emotion/styled';
|
|
3
2
|
import type { ReactElement } from 'react';
|
|
4
3
|
|
|
5
4
|
import type { ToolbarProps } from '../toolbar/Toolbar.js';
|
|
@@ -10,24 +9,20 @@ interface HeaderProps {
|
|
|
10
9
|
children: [ReactProps, ReactProps];
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
boxShadow: 'rgb(255, 255, 255) 0px 1px 0px 0px inset',
|
|
23
|
-
}),
|
|
24
|
-
};
|
|
12
|
+
const HeaderContainer = styled.div`
|
|
13
|
+
width: 100%;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
border-bottom: 1px solid rgb(247 247 247);
|
|
18
|
+
box-shadow: rgb(255 255 255) 0 1px 0 0 inset;
|
|
19
|
+
`;
|
|
25
20
|
|
|
26
21
|
export function Header(props: HeaderProps) {
|
|
27
22
|
return (
|
|
28
|
-
<
|
|
23
|
+
<HeaderContainer>
|
|
29
24
|
<div>{props.children[0]}</div>
|
|
30
25
|
<div>{props.children[1]}</div>
|
|
31
|
-
</
|
|
26
|
+
</HeaderContainer>
|
|
32
27
|
);
|
|
33
28
|
}
|
|
@@ -1,29 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import styled from '@emotion/styled';
|
|
3
2
|
import type { ReactNode } from 'react';
|
|
4
3
|
|
|
5
4
|
import { Button } from '../button/index.js';
|
|
6
5
|
import { SelectedTotal } from '../selected-total/index.js';
|
|
7
6
|
|
|
8
|
-
const styles = {
|
|
9
|
-
container: css({
|
|
10
|
-
display: 'flex',
|
|
11
|
-
flexDirection: 'row',
|
|
12
|
-
alignItems: 'center',
|
|
13
|
-
justifyContent: 'space-between',
|
|
14
|
-
borderBottom: '0.55px solid rgb(240, 240, 240)',
|
|
15
|
-
}),
|
|
16
|
-
leftContainer: css({
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'row',
|
|
19
|
-
flex: 1,
|
|
20
|
-
'& > button': {
|
|
21
|
-
padding: '0 5px',
|
|
22
|
-
minWidth: 'auto',
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
7
|
interface PanelHeaderProps {
|
|
28
8
|
total?: number;
|
|
29
9
|
current?: number;
|
|
@@ -31,19 +11,35 @@ interface PanelHeaderProps {
|
|
|
31
11
|
children?: ReactNode;
|
|
32
12
|
}
|
|
33
13
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
14
|
+
const HeaderContainer = styled.div`
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
border-bottom: 0.55px solid rgb(240 240 240);
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const HeaderLeftContainer = styled.div`
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
flex: 1;
|
|
26
|
+
|
|
27
|
+
'& > button:' {
|
|
28
|
+
padding: 0 5px;
|
|
29
|
+
min-width: auto;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export function PanelHeader(props: PanelHeaderProps) {
|
|
34
|
+
const { total, current, children, onClickSettings } = props;
|
|
35
|
+
|
|
40
36
|
return (
|
|
41
|
-
<
|
|
42
|
-
<
|
|
37
|
+
<HeaderContainer>
|
|
38
|
+
<HeaderLeftContainer>{children}</HeaderLeftContainer>
|
|
43
39
|
<SelectedTotal count={current} total={total} />
|
|
44
40
|
{onClickSettings && (
|
|
45
41
|
<Button color="black" minimal onClick={onClickSettings} icon="cog" />
|
|
46
42
|
)}
|
|
47
|
-
</
|
|
43
|
+
</HeaderContainer>
|
|
48
44
|
);
|
|
49
45
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsxImportSource @emotion/react */
|
|
2
1
|
import { Classes, Collapse, InputGroup } from '@blueprintjs/core';
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
2
|
import styled from '@emotion/styled';
|
|
5
3
|
import type { CSSProperties } from 'react';
|
|
6
4
|
import { memo, useCallback, useMemo, useState } from 'react';
|
|
@@ -35,6 +33,7 @@ const AccordionButton = styled(Button, {
|
|
|
35
33
|
rotate: ${(props) => (props.open ? '90deg' : '')};
|
|
36
34
|
transition: all 0.3s ease-in-out;
|
|
37
35
|
}
|
|
36
|
+
|
|
38
37
|
cursor: pointer;
|
|
39
38
|
border-bottom: 1px solid #f5f5f5;
|
|
40
39
|
display: flex;
|
|
@@ -44,22 +43,37 @@ const AccordionButton = styled(Button, {
|
|
|
44
43
|
&.${Classes.MINIMAL} {
|
|
45
44
|
background-color: white;
|
|
46
45
|
}
|
|
46
|
+
|
|
47
47
|
:hover {
|
|
48
48
|
background-color: #f5f5f5;
|
|
49
49
|
}
|
|
50
50
|
`;
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
const InfoPanelContainer = styled.div`
|
|
53
|
+
padding: 5px 0 0;
|
|
54
|
+
height: 100%;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
const InfoPanelCollapse = styled(Collapse)`
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
const InfoPanelInputGroup = styled(InputGroup)`
|
|
64
|
+
flex-grow: 1;
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const InfoPanelGroup = styled.div`
|
|
68
|
+
padding: 0 5px;
|
|
69
|
+
margin-top: 5px;
|
|
70
|
+
background-color: white;
|
|
71
|
+
top: 5px;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: 6px;
|
|
75
|
+
width: 100%;
|
|
76
|
+
`;
|
|
63
77
|
|
|
64
78
|
interface InfoPanelDatum {
|
|
65
79
|
parameter: string;
|
|
@@ -95,9 +109,9 @@ export function InfoPanel(props: InfoPanelProps) {
|
|
|
95
109
|
const includes: InfoPanelDatum[] = [];
|
|
96
110
|
const valueContains: InfoPanelDatum[] = [];
|
|
97
111
|
|
|
98
|
-
for (const [parameter, value] of Object.entries(data).sort(([a], [b]) =>
|
|
99
|
-
a.localeCompare(b)
|
|
100
|
-
)) {
|
|
112
|
+
for (const [parameter, value] of Object.entries(data).sort(([a], [b]) => {
|
|
113
|
+
return a.localeCompare(b);
|
|
114
|
+
})) {
|
|
101
115
|
const lowerKey = parameter.toLowerCase();
|
|
102
116
|
const lowerSearch = search.toLowerCase();
|
|
103
117
|
if (lowerKey === lowerSearch) {
|
|
@@ -137,7 +151,7 @@ export function InfoPanel(props: InfoPanelProps) {
|
|
|
137
151
|
}, [data, viewData]);
|
|
138
152
|
|
|
139
153
|
return (
|
|
140
|
-
<
|
|
154
|
+
<InfoPanelContainer>
|
|
141
155
|
<div
|
|
142
156
|
style={{
|
|
143
157
|
padding: '0 5px',
|
|
@@ -146,23 +160,8 @@ export function InfoPanel(props: InfoPanelProps) {
|
|
|
146
160
|
>
|
|
147
161
|
{title}
|
|
148
162
|
</div>
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
css={css({
|
|
152
|
-
padding: '0 5px',
|
|
153
|
-
marginTop: '5px',
|
|
154
|
-
backgroundColor: 'white',
|
|
155
|
-
top: '5px',
|
|
156
|
-
display: 'flex',
|
|
157
|
-
alignItems: 'center',
|
|
158
|
-
gap: 6,
|
|
159
|
-
width: '100%',
|
|
160
|
-
})}
|
|
161
|
-
>
|
|
162
|
-
<InputGroup
|
|
163
|
-
css={css({
|
|
164
|
-
flexGrow: 1,
|
|
165
|
-
})}
|
|
163
|
+
<InfoPanelGroup tabIndex={0}>
|
|
164
|
+
<InfoPanelInputGroup
|
|
166
165
|
placeholder="Search for a parameter"
|
|
167
166
|
value={search}
|
|
168
167
|
onChange={({ target }) => {
|
|
@@ -176,9 +175,9 @@ export function InfoPanel(props: InfoPanelProps) {
|
|
|
176
175
|
fill
|
|
177
176
|
/>
|
|
178
177
|
<SelectedTotal count={count} total={total} />
|
|
179
|
-
</
|
|
178
|
+
</InfoPanelGroup>
|
|
180
179
|
<InfoPanelContent filteredData={filteredData} />
|
|
181
|
-
</
|
|
180
|
+
</InfoPanelContainer>
|
|
182
181
|
);
|
|
183
182
|
}
|
|
184
183
|
|
|
@@ -225,7 +224,7 @@ const InfoPanelContent = memo((props: InfoPanelContentProps) => {
|
|
|
225
224
|
>
|
|
226
225
|
{description}
|
|
227
226
|
</AccordionButton>
|
|
228
|
-
<
|
|
227
|
+
<InfoPanelCollapse isOpen={open}>
|
|
229
228
|
<Table
|
|
230
229
|
data={data}
|
|
231
230
|
columns={columns}
|
|
@@ -233,7 +232,7 @@ const InfoPanelContent = memo((props: InfoPanelContentProps) => {
|
|
|
233
232
|
tableProps={{ style: { width: '100%' } }}
|
|
234
233
|
compact
|
|
235
234
|
/>
|
|
236
|
-
</
|
|
235
|
+
</InfoPanelCollapse>
|
|
237
236
|
</div>
|
|
238
237
|
);
|
|
239
238
|
})}
|
|
@@ -278,7 +277,12 @@ function valueSearch(
|
|
|
278
277
|
return match(value)
|
|
279
278
|
.with(P.boolean, (value) => String(value).includes(search))
|
|
280
279
|
.with(P.number, (value) => String(value).includes(search))
|
|
281
|
-
.with(P.string, (value) =>
|
|
280
|
+
.with(P.string, (value) => {
|
|
281
|
+
const newValue =
|
|
282
|
+
value === 'true' ? 'yes' : value === 'false' ? 'no' : value;
|
|
283
|
+
|
|
284
|
+
return newValue.includes(search);
|
|
285
|
+
})
|
|
282
286
|
.with({}, (value) => JSON.stringify(value).includes(search))
|
|
283
287
|
.otherwise(() => true);
|
|
284
288
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './inline_editable_renderer.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Colors } from '@blueprintjs/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import type { KeyboardEvent, ReactNode } from 'react';
|
|
4
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface InlineRendererEditableProps<T extends HTMLElement> {
|
|
7
|
+
ref: (node: T | null) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Function to exit the editable state and display the children content.
|
|
10
|
+
*/
|
|
11
|
+
exit: () => void;
|
|
12
|
+
onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InlineEditableProps<T extends HTMLElement> {
|
|
16
|
+
renderEditable: (props: InlineRendererEditableProps<T>) => ReactNode;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const InlineEditableInput = styled.input`
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
box-shadow: 0 0 1px 1px ${Colors.GRAY1};
|
|
24
|
+
position: absolute;
|
|
25
|
+
outline: none;
|
|
26
|
+
inset: 0;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const Container = styled.div`
|
|
30
|
+
min-width: 100%;
|
|
31
|
+
width: 100%;
|
|
32
|
+
min-height: 21px;
|
|
33
|
+
|
|
34
|
+
:focus,
|
|
35
|
+
:hover {
|
|
36
|
+
box-shadow: 0 0 1px 1px ${Colors.GRAY1};
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The `InlineEditable` component allows for inline editing of its content.
|
|
42
|
+
* It renders a component with `renderEditable` when focused or clicked
|
|
43
|
+
* and toggles back to the original content when the input loses focus.
|
|
44
|
+
*/
|
|
45
|
+
export function InlineEditable<T extends HTMLElement>(
|
|
46
|
+
props: InlineEditableProps<T>,
|
|
47
|
+
) {
|
|
48
|
+
const { children, renderEditable } = props;
|
|
49
|
+
const [isInputRendered, setIsInputRendered] = useState(false);
|
|
50
|
+
|
|
51
|
+
const toggle = useCallback(() => {
|
|
52
|
+
return setIsInputRendered((old) => !old);
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
const renderEditableProps = useMemo<InlineRendererEditableProps<T>>(() => {
|
|
56
|
+
return {
|
|
57
|
+
isRendered: isInputRendered,
|
|
58
|
+
onKeyDown: (event) => {
|
|
59
|
+
if (event.key === 'Enter') {
|
|
60
|
+
setIsInputRendered(false);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
ref: (node) => {
|
|
64
|
+
if (!node) return;
|
|
65
|
+
node.focus();
|
|
66
|
+
},
|
|
67
|
+
exit: () => setIsInputRendered(false),
|
|
68
|
+
};
|
|
69
|
+
}, [isInputRendered]);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div style={{ position: 'relative' }}>
|
|
73
|
+
<div style={{ visibility: isInputRendered ? 'visible' : 'hidden' }}>
|
|
74
|
+
{renderEditable(renderEditableProps)}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<Container
|
|
78
|
+
tabIndex={isInputRendered ? -1 : 0}
|
|
79
|
+
onFocus={() => setIsInputRendered(true)}
|
|
80
|
+
onClick={toggle}
|
|
81
|
+
>
|
|
82
|
+
{children}
|
|
83
|
+
</Container>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
/** @jsxImportSource @emotion/react */
|
|
2
|
-
|
|
3
1
|
import { Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
4
|
-
import { css } from '@emotion/react';
|
|
5
2
|
import styled from '@emotion/styled';
|
|
6
3
|
import type { LogEntry } from 'fifo-logger';
|
|
7
4
|
import type { CSSProperties } from 'react';
|
|
@@ -76,24 +73,25 @@ function useColumns(unseen: number) {
|
|
|
76
73
|
);
|
|
77
74
|
}
|
|
78
75
|
|
|
76
|
+
const LoggerDialog = styled(Dialog)`
|
|
77
|
+
min-width: 800px;
|
|
78
|
+
min-height: 500px;
|
|
79
|
+
max-height: 80vh;
|
|
80
|
+
max-width: 1000px;
|
|
81
|
+
`;
|
|
82
|
+
|
|
79
83
|
export function FifoLoggerDialog(props: FifoLoggerDialogProps) {
|
|
80
84
|
const logger = useFifoLogger();
|
|
81
85
|
|
|
82
86
|
const columns = useColumns(props.unseen);
|
|
83
87
|
|
|
84
88
|
return (
|
|
85
|
-
<
|
|
89
|
+
<LoggerDialog
|
|
86
90
|
shouldReturnFocusOnClose={false}
|
|
87
91
|
isOpen={props.isOpen}
|
|
88
92
|
onClose={props.onClose}
|
|
89
93
|
title="Logs"
|
|
90
94
|
icon="info-sign"
|
|
91
|
-
css={css`
|
|
92
|
-
min-width: 800px;
|
|
93
|
-
min-height: 500px;
|
|
94
|
-
max-height: 80vh;
|
|
95
|
-
max-width: 1000px;
|
|
96
|
-
`}
|
|
97
95
|
>
|
|
98
96
|
<DialogBody>
|
|
99
97
|
<Table
|
|
@@ -131,7 +129,7 @@ export function FifoLoggerDialog(props: FifoLoggerDialogProps) {
|
|
|
131
129
|
</ActionsFooter>
|
|
132
130
|
}
|
|
133
131
|
/>
|
|
134
|
-
</
|
|
132
|
+
</LoggerDialog>
|
|
135
133
|
);
|
|
136
134
|
}
|
|
137
135
|
|
|
@@ -4,7 +4,7 @@ import styled from '@emotion/styled';
|
|
|
4
4
|
export const CustomDivPreflight = styled.div`
|
|
5
5
|
/* html */
|
|
6
6
|
line-height: 1.5;
|
|
7
|
-
|
|
7
|
+
text-size-adjust: 100%;
|
|
8
8
|
tab-size: 4;
|
|
9
9
|
font-family:
|
|
10
10
|
ui-sans-serif,
|
|
@@ -21,7 +21,6 @@ export const CustomDivPreflight = styled.div`
|
|
|
21
21
|
'Segoe UI Emoji',
|
|
22
22
|
'Segoe UI Symbol',
|
|
23
23
|
'Noto Color Emoji';
|
|
24
|
-
|
|
25
24
|
width: 100%;
|
|
26
25
|
height: 100%;
|
|
27
26
|
position: relative;
|