react-science 0.19.2 → 0.20.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/app/about/AboutDialogToolbarButton.js +10 -10
- package/lib/app/explorer/MeasurementExplorer.js +36 -43
- package/lib/app/helpers/react-plot.js +16 -13
- package/lib/app/kinds/iv/plot-view/IvPlotView.js +14 -13
- package/lib/app/panels/measurements/MeasurementCheckbox.js +10 -8
- package/lib/app/panels/measurements/MeasurementColorPreview.js +9 -7
- package/lib/app/panels/measurements/MeasurementsTable.js +81 -94
- package/lib/components/button/ButtonGroup.js +31 -43
- package/lib/components/color-picker/color-picker-dropdown/ColorPickerDropdown.js +18 -21
- package/lib/components/drop-zone/DropZone.js +48 -48
- package/lib/components/dropdown-menu/DropdownMenu.js +4 -4
- package/lib/components/forms/Input.js +150 -0
- package/lib/components/forms/context/FieldsContext.js +54 -0
- package/lib/components/forms/context/index.js +17 -0
- package/lib/components/forms/index.js +18 -0
- package/lib/components/index.js +1 -0
- package/lib/components/modal/ConfirmModal.js +40 -29
- package/lib/components/modal/Modal.js +45 -34
- package/lib/components/root-layout/RootLayout.js +1 -1
- package/lib/components/root-layout/css-reset/customPreflight.js +10 -3
- package/lib/components/spinner/FullSpinner.js +10 -7
- package/lib-esm/app/about/AboutDialogToolbarButton.d.ts +1 -1
- package/lib-esm/app/about/AboutDialogToolbarButton.d.ts.map +1 -1
- package/lib-esm/app/about/AboutDialogToolbarButton.js +7 -10
- package/lib-esm/app/about/AboutDialogToolbarButton.js.map +1 -1
- package/lib-esm/app/explorer/MeasurementExplorer.d.ts +2 -1
- package/lib-esm/app/explorer/MeasurementExplorer.d.ts.map +1 -1
- package/lib-esm/app/explorer/MeasurementExplorer.js +31 -41
- package/lib-esm/app/explorer/MeasurementExplorer.js.map +1 -1
- package/lib-esm/app/helpers/MeasurementPlot.js.map +1 -1
- package/lib-esm/app/helpers/react-plot.d.ts +4 -2
- package/lib-esm/app/helpers/react-plot.d.ts.map +1 -1
- package/lib-esm/app/helpers/react-plot.js +11 -11
- package/lib-esm/app/helpers/react-plot.js.map +1 -1
- package/lib-esm/app/kinds/iv/plot-view/IvPlotView.d.ts +2 -1
- package/lib-esm/app/kinds/iv/plot-view/IvPlotView.d.ts.map +1 -1
- package/lib-esm/app/kinds/iv/plot-view/IvPlotView.js +14 -13
- package/lib-esm/app/kinds/iv/plot-view/IvPlotView.js.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementCheckbox.d.ts +2 -1
- package/lib-esm/app/panels/measurements/MeasurementCheckbox.d.ts.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementCheckbox.js +4 -5
- package/lib-esm/app/panels/measurements/MeasurementCheckbox.js.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementColorPreview.d.ts +2 -1
- package/lib-esm/app/panels/measurements/MeasurementColorPreview.d.ts.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementColorPreview.js +4 -5
- package/lib-esm/app/panels/measurements/MeasurementColorPreview.js.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementsTable.d.ts +2 -1
- package/lib-esm/app/panels/measurements/MeasurementsTable.d.ts.map +1 -1
- package/lib-esm/app/panels/measurements/MeasurementsTable.js +81 -94
- package/lib-esm/app/panels/measurements/MeasurementsTable.js.map +1 -1
- package/lib-esm/components/button/ButtonGroup.d.ts +2 -2
- package/lib-esm/components/button/ButtonGroup.d.ts.map +1 -1
- package/lib-esm/components/button/ButtonGroup.js +28 -43
- package/lib-esm/components/button/ButtonGroup.js.map +1 -1
- package/lib-esm/components/color-picker/color-picker-dropdown/ColorPickerDropdown.d.ts +2 -1
- package/lib-esm/components/color-picker/color-picker-dropdown/ColorPickerDropdown.d.ts.map +1 -1
- package/lib-esm/components/color-picker/color-picker-dropdown/ColorPickerDropdown.js +16 -19
- package/lib-esm/components/color-picker/color-picker-dropdown/ColorPickerDropdown.js.map +1 -1
- package/lib-esm/components/drop-zone/DropZone.d.ts +2 -2
- package/lib-esm/components/drop-zone/DropZone.d.ts.map +1 -1
- package/lib-esm/components/drop-zone/DropZone.js +42 -45
- package/lib-esm/components/drop-zone/DropZone.js.map +1 -1
- package/lib-esm/components/dropdown-menu/DropdownMenu.js +4 -4
- package/lib-esm/components/dropdown-menu/DropdownMenu.js.map +1 -1
- package/lib-esm/components/forms/Input.d.ts +17 -0
- package/lib-esm/components/forms/Input.d.ts.map +1 -0
- package/lib-esm/components/forms/Input.js +144 -0
- package/lib-esm/components/forms/Input.js.map +1 -0
- package/lib-esm/components/forms/context/FieldsContext.d.ts +16 -0
- package/lib-esm/components/forms/context/FieldsContext.d.ts.map +1 -0
- package/lib-esm/components/forms/context/FieldsContext.js +47 -0
- package/lib-esm/components/forms/context/FieldsContext.js.map +1 -0
- package/lib-esm/components/forms/context/index.d.ts +2 -0
- package/lib-esm/components/forms/context/index.d.ts.map +1 -0
- package/lib-esm/components/forms/context/index.js +2 -0
- package/lib-esm/components/forms/context/index.js.map +1 -0
- package/lib-esm/components/forms/index.d.ts +3 -0
- package/lib-esm/components/forms/index.d.ts.map +1 -0
- package/lib-esm/components/forms/index.js +3 -0
- package/lib-esm/components/forms/index.js.map +1 -0
- 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/modal/ConfirmModal.d.ts +1 -1
- package/lib-esm/components/modal/ConfirmModal.d.ts.map +1 -1
- package/lib-esm/components/modal/ConfirmModal.js +37 -29
- package/lib-esm/components/modal/ConfirmModal.js.map +1 -1
- package/lib-esm/components/modal/Modal.d.ts +4 -4
- package/lib-esm/components/modal/Modal.d.ts.map +1 -1
- package/lib-esm/components/modal/Modal.js +45 -34
- package/lib-esm/components/modal/Modal.js.map +1 -1
- package/lib-esm/components/root-layout/RootLayout.d.ts.map +1 -1
- package/lib-esm/components/root-layout/RootLayout.js +2 -2
- package/lib-esm/components/root-layout/RootLayout.js.map +1 -1
- package/lib-esm/components/root-layout/css-reset/customPreflight.d.ts +5 -1
- package/lib-esm/components/root-layout/css-reset/customPreflight.d.ts.map +1 -1
- package/lib-esm/components/root-layout/css-reset/customPreflight.js +6 -2
- package/lib-esm/components/root-layout/css-reset/customPreflight.js.map +1 -1
- package/lib-esm/components/spinner/FullSpinner.d.ts +7 -1
- package/lib-esm/components/spinner/FullSpinner.d.ts.map +1 -1
- package/lib-esm/components/spinner/FullSpinner.js +8 -8
- package/lib-esm/components/spinner/FullSpinner.js.map +1 -1
- package/package.json +1 -1
- package/src/app/about/AboutDialogToolbarButton.tsx +6 -9
- package/src/app/explorer/MeasurementExplorer.tsx +47 -59
- package/src/app/helpers/MeasurementPlot.tsx +1 -0
- package/src/app/helpers/react-plot.tsx +24 -19
- package/src/app/kinds/iv/plot-view/IvPlotView.tsx +18 -19
- package/src/app/panels/measurements/MeasurementCheckbox.tsx +3 -5
- package/src/app/panels/measurements/MeasurementColorPreview.tsx +4 -6
- package/src/app/panels/measurements/MeasurementsTable.tsx +112 -115
- package/src/components/button/ButtonGroup.tsx +30 -44
- package/src/components/color-picker/color-picker-dropdown/ColorPickerDropdown.tsx +19 -26
- package/src/components/drop-zone/DropZone.tsx +54 -56
- package/src/components/dropdown-menu/DropdownMenu.tsx +19 -17
- package/src/components/forms/Input.tsx +255 -0
- package/src/components/forms/context/FieldsContext.tsx +82 -0
- package/src/components/forms/context/index.ts +1 -0
- package/src/components/forms/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/components/modal/ConfirmModal.tsx +49 -44
- package/src/components/modal/Modal.tsx +54 -58
- package/src/components/root-layout/RootLayout.tsx +3 -7
- package/src/components/root-layout/css-reset/customPreflight.ts +6 -2
- package/src/components/spinner/FullSpinner.tsx +14 -9
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import styled from '@emotion/styled';
|
|
3
2
|
import { FaTrash } from 'react-icons/fa';
|
|
4
3
|
|
|
5
4
|
import {
|
|
@@ -25,78 +24,75 @@ interface MeasurementsTableRowProps {
|
|
|
25
24
|
kind: MeasurementsTableProps['kind'];
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
border-bottom: 1px solid black;
|
|
98
|
-
`,
|
|
99
|
-
};
|
|
27
|
+
const MeasurementsTableContainer = styled.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: 5px;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const MeasurementsTableRoot = styled.table`
|
|
34
|
+
font-size: 0.875rem;
|
|
35
|
+
line-height: 1.25rem;
|
|
36
|
+
border-collapse: collapse;
|
|
37
|
+
table-layout: fixed;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const MeasurementsTableHeaderStyled = styled.tr`
|
|
41
|
+
border-bottom-width: 1px;
|
|
42
|
+
font-weight: 500;
|
|
43
|
+
text-align: left;
|
|
44
|
+
padding-bottom: 10px;
|
|
45
|
+
padding-top: 10px;
|
|
46
|
+
padding-left: 2rem;
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
const MeasurementsTableBody = styled.tbody`
|
|
50
|
+
background-color: white;
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const MeasurementsLinkButton = styled.span`
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
:hover {
|
|
56
|
+
text-decoration: underline;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const MeasurementsHeaderColumn = styled.div`
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: row;
|
|
63
|
+
gap: 10px;
|
|
64
|
+
align-items: center;
|
|
65
|
+
padding-left: 5px;
|
|
66
|
+
|
|
67
|
+
border-bottom: 1px solid black;
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
const MeasurementsTableRowData = styled.tr`
|
|
71
|
+
height: 50px;
|
|
72
|
+
max-height: 50px;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
padding-left: 2rem;
|
|
76
|
+
padding-bottom: 10px;
|
|
77
|
+
padding-top: 10px;
|
|
78
|
+
border-bottom-width: 1px;
|
|
79
|
+
|
|
80
|
+
font-weight: 500;
|
|
81
|
+
font-size: 0.875rem;
|
|
82
|
+
line-height: 1.25rem;
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
const MeasurementsIconsContainer = styled.td`
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-items: center;
|
|
90
|
+
height: 50px;
|
|
91
|
+
flex-direction: row;
|
|
92
|
+
gap: 0.5rem;
|
|
93
|
+
cursor: default;
|
|
94
|
+
width: 70px;
|
|
95
|
+
`;
|
|
100
96
|
|
|
101
97
|
export function MeasurementsTable(props: MeasurementsTableProps) {
|
|
102
98
|
const { kind } = props;
|
|
@@ -126,16 +122,16 @@ export function MeasurementsTable(props: MeasurementsTableProps) {
|
|
|
126
122
|
}
|
|
127
123
|
|
|
128
124
|
return (
|
|
129
|
-
<
|
|
130
|
-
<
|
|
125
|
+
<MeasurementsTableContainer>
|
|
126
|
+
<MeasurementsHeaderColumn>
|
|
131
127
|
<MeasurementSelectedVisibilityChange kind={kind} openedEyes />
|
|
132
128
|
<MeasurementSelectedVisibilityChange kind={kind} openedEyes={false} />
|
|
133
|
-
<
|
|
129
|
+
<MeasurementsLinkButton onClick={() => onSelectLink(true)}>
|
|
134
130
|
Select all
|
|
135
|
-
</
|
|
136
|
-
<
|
|
131
|
+
</MeasurementsLinkButton>
|
|
132
|
+
<MeasurementsLinkButton onClick={() => onSelectLink(false)}>
|
|
137
133
|
Unselect all
|
|
138
|
-
</
|
|
134
|
+
</MeasurementsLinkButton>
|
|
139
135
|
|
|
140
136
|
<FaTrash
|
|
141
137
|
style={
|
|
@@ -154,47 +150,48 @@ export function MeasurementsTable(props: MeasurementsTableProps) {
|
|
|
154
150
|
Remove selected measurements?
|
|
155
151
|
</div>
|
|
156
152
|
</ConfirmModal>
|
|
157
|
-
</
|
|
153
|
+
</MeasurementsHeaderColumn>
|
|
158
154
|
|
|
159
|
-
<
|
|
155
|
+
<MeasurementsTableRoot>
|
|
160
156
|
<MeasurementsTableHeader />
|
|
161
|
-
<
|
|
157
|
+
<MeasurementsTableBody>
|
|
162
158
|
{measurements[kind].entries.map((element) => (
|
|
163
159
|
<MeasurementsTableRow key={element.id} item={element} kind={kind} />
|
|
164
160
|
))}
|
|
165
|
-
</
|
|
166
|
-
</
|
|
167
|
-
</
|
|
161
|
+
</MeasurementsTableBody>
|
|
162
|
+
</MeasurementsTableRoot>
|
|
163
|
+
</MeasurementsTableContainer>
|
|
168
164
|
);
|
|
169
165
|
}
|
|
170
166
|
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
167
|
+
const TableHeaderEmpty = styled.th`
|
|
168
|
+
display: flex;
|
|
169
|
+
gap: 5px;
|
|
170
|
+
align-items: center;
|
|
171
|
+
width: 70px;
|
|
172
|
+
`;
|
|
173
|
+
|
|
174
|
+
const TableHeaderFilename = styled.th`
|
|
175
|
+
width: 60%;
|
|
176
|
+
`;
|
|
177
|
+
|
|
178
|
+
const TableHeaderTechnique = styled.th`
|
|
179
|
+
width: 150px;
|
|
180
|
+
`;
|
|
181
|
+
|
|
182
|
+
const TableDataHeaderName = styled.td`
|
|
183
|
+
width: 60%;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
`;
|
|
189
186
|
|
|
190
187
|
function MeasurementsTableHeader() {
|
|
191
188
|
return (
|
|
192
189
|
<thead>
|
|
193
|
-
<
|
|
194
|
-
<
|
|
195
|
-
<
|
|
196
|
-
<
|
|
197
|
-
</
|
|
190
|
+
<MeasurementsTableHeaderStyled>
|
|
191
|
+
<TableHeaderEmpty />
|
|
192
|
+
<TableHeaderFilename>Filename</TableHeaderFilename>
|
|
193
|
+
<TableHeaderTechnique>Technique</TableHeaderTechnique>
|
|
194
|
+
</MeasurementsTableHeaderStyled>
|
|
198
195
|
</thead>
|
|
199
196
|
);
|
|
200
197
|
}
|
|
@@ -225,8 +222,8 @@ function MeasurementsTableRow(props: MeasurementsTableRowProps) {
|
|
|
225
222
|
}
|
|
226
223
|
|
|
227
224
|
return (
|
|
228
|
-
<
|
|
229
|
-
<
|
|
225
|
+
<MeasurementsTableRowData>
|
|
226
|
+
<MeasurementsIconsContainer>
|
|
230
227
|
<MeasurementVisibilityToggle
|
|
231
228
|
id={item.id}
|
|
232
229
|
isVisible={measurements[item.id].visible}
|
|
@@ -240,11 +237,11 @@ function MeasurementsTableRow(props: MeasurementsTableRowProps) {
|
|
|
240
237
|
checked={selectedMeasurements[kind]?.includes(item.id) || false}
|
|
241
238
|
onSelectCheckbox={onSelectCheckbox}
|
|
242
239
|
/>
|
|
243
|
-
</
|
|
244
|
-
<
|
|
240
|
+
</MeasurementsIconsContainer>
|
|
241
|
+
<TableDataHeaderName onClick={onSelectRow} title={item.id}>
|
|
245
242
|
{item.info.file?.name ?? item.info.title}
|
|
246
|
-
</
|
|
243
|
+
</TableDataHeaderName>
|
|
247
244
|
<td onClick={onSelectRow}>{item.meta.technique}</td>
|
|
248
|
-
</
|
|
245
|
+
</MeasurementsTableRowData>
|
|
249
246
|
);
|
|
250
247
|
}
|
|
@@ -1,45 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import styled from '@emotion/styled';
|
|
3
2
|
import { ReactNode } from 'react';
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
font-size: 0.875rem;
|
|
32
|
-
line-height: 1.25rem;
|
|
33
|
-
padding-left: 1rem;
|
|
34
|
-
padding-right: 1rem;
|
|
35
|
-
padding-top: 5px;
|
|
36
|
-
padding-bottom: 5px;
|
|
37
|
-
border-width: 1px;
|
|
38
|
-
border-top-right-radius: 0.375rem;
|
|
39
|
-
border-bottom-right-radius: 0.375rem;
|
|
40
|
-
margin-left: -1px;
|
|
41
|
-
`,
|
|
42
|
-
};
|
|
4
|
+
const ButtonGroupRoot = styled.div`
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
border-radius: 0.375rem;
|
|
7
|
+
isolation: isolate;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const ButtonGroupCustomButton = styled.button<{ isLast: boolean }>`
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
font-weight: 500;
|
|
15
|
+
font-size: 0.875rem;
|
|
16
|
+
line-height: 1.25rem;
|
|
17
|
+
padding-left: 1rem;
|
|
18
|
+
padding-right: 1rem;
|
|
19
|
+
padding-top: 5px;
|
|
20
|
+
padding-bottom: 5px;
|
|
21
|
+
border-width: 1px;
|
|
22
|
+
border-top-left-radius: ${({ isLast }) => !isLast && '0.375rem'};
|
|
23
|
+
border-bottom-left-radius: ${({ isLast }) => !isLast && '0.375rem'};
|
|
24
|
+
|
|
25
|
+
border-top-right-radius: ${({ isLast }) => isLast && '0.375rem'};
|
|
26
|
+
border-bottom-right-radius: ${({ isLast }) => isLast && '0.375rem'};
|
|
27
|
+
margin-left: ${({ isLast }) => isLast && '-1px'};
|
|
28
|
+
`;
|
|
43
29
|
|
|
44
30
|
interface ButtonGroupProps {
|
|
45
31
|
children: [ReactNode, ReactNode];
|
|
@@ -47,7 +33,7 @@ interface ButtonGroupProps {
|
|
|
47
33
|
|
|
48
34
|
export function ButtonGroup(props: ButtonGroupProps) {
|
|
49
35
|
const { children } = props;
|
|
50
|
-
return <
|
|
36
|
+
return <ButtonGroupRoot>{children}</ButtonGroupRoot>;
|
|
51
37
|
}
|
|
52
38
|
|
|
53
39
|
interface ButtonGroupButtonProps {
|
|
@@ -60,12 +46,12 @@ ButtonGroup.Button = function ButtonGroupButton(props: ButtonGroupButtonProps) {
|
|
|
60
46
|
const { position, label, onClick } = props;
|
|
61
47
|
|
|
62
48
|
return (
|
|
63
|
-
<
|
|
49
|
+
<ButtonGroupCustomButton
|
|
64
50
|
type="button"
|
|
65
51
|
onClick={onClick}
|
|
66
|
-
|
|
52
|
+
isLast={position === 'last'}
|
|
67
53
|
>
|
|
68
54
|
{label}
|
|
69
|
-
</
|
|
55
|
+
</ButtonGroupCustomButton>
|
|
70
56
|
);
|
|
71
57
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { css } from '@emotion/react';
|
|
1
|
+
import styled from '@emotion/styled';
|
|
3
2
|
import { useRef } from 'react';
|
|
4
3
|
|
|
5
4
|
import { useModifiedPopper } from '../../hooks/useModifiedPopper';
|
|
@@ -15,21 +14,20 @@ type ColorPickerDropdownProps = Pick<
|
|
|
15
14
|
'color' | 'presetColors' | 'disableAlpha' | 'onChange' | 'onChangeComplete'
|
|
16
15
|
>;
|
|
17
16
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
17
|
+
const ColorPickerRoot = styled.button`
|
|
18
|
+
position: relative;
|
|
19
|
+
width: 100%;
|
|
20
|
+
border: 1px solid darkgray;
|
|
21
|
+
border-radius: 0.25rem;
|
|
22
|
+
height: 30px;
|
|
23
|
+
padding: 5px;
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const ColorPickerPreview = styled.div`
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 100%;
|
|
29
|
+
border-radius: 0.125rem;
|
|
30
|
+
`;
|
|
33
31
|
|
|
34
32
|
export function ColorPickerDropdown(props: ColorPickerDropdownProps) {
|
|
35
33
|
const { color, ...otherProps } = props;
|
|
@@ -49,16 +47,11 @@ export function ColorPickerDropdown(props: ColorPickerDropdownProps) {
|
|
|
49
47
|
|
|
50
48
|
return (
|
|
51
49
|
<>
|
|
52
|
-
<button
|
|
53
|
-
|
|
54
|
-
ref={setReferenceElement}
|
|
55
|
-
css={colorPickerDropdownCss.root}
|
|
56
|
-
onClick={toggle}
|
|
57
|
-
>
|
|
58
|
-
<div css={colorPickerDropdownCss.preview}>
|
|
50
|
+
<ColorPickerRoot type="button" ref={setReferenceElement} onClick={toggle}>
|
|
51
|
+
<ColorPickerPreview>
|
|
59
52
|
<FixedColorPreview color={hex} />
|
|
60
|
-
</
|
|
61
|
-
</
|
|
53
|
+
</ColorPickerPreview>
|
|
54
|
+
</ColorPickerRoot>
|
|
62
55
|
{isOpened && (
|
|
63
56
|
<Portal>
|
|
64
57
|
<div
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { MouseEventHandler, useCallback, useMemo } from 'react';
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import { CSSProperties, MouseEventHandler, useCallback, useMemo } from 'react';
|
|
4
3
|
import { FileError, FileRejection, useDropzone } from 'react-dropzone';
|
|
5
4
|
import { FaCloudUploadAlt } from 'react-icons/fa';
|
|
6
5
|
|
|
@@ -15,41 +14,52 @@ export interface DropZoneProps {
|
|
|
15
14
|
emptyText?: string;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
const DropzoneRoot = styled.div`
|
|
18
|
+
position: relative;
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
interface DropzoneColorProps {
|
|
24
|
+
borderColor: CSSProperties['borderColor'];
|
|
25
|
+
color: CSSProperties['color'];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const DropzoneDragActive = styled.div<DropzoneColorProps>`
|
|
29
|
+
font-size: 1.5em;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
right: 0;
|
|
36
|
+
opacity: 0.7;
|
|
37
|
+
background-color: white;
|
|
38
|
+
border: 5px dashed;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
|
|
44
|
+
border-color: ${({ borderColor }) => borderColor};
|
|
45
|
+
color: ${({ color }) => color};
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const DropzoneEmpty = styled.div<DropzoneColorProps>`
|
|
49
|
+
font-size: 1.5em;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
padding: 1em;
|
|
57
|
+
border: 5px dashed;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
|
|
60
|
+
border-color: ${({ borderColor }) => borderColor};
|
|
61
|
+
color: ${({ color }) => color};
|
|
62
|
+
`;
|
|
53
63
|
|
|
54
64
|
export function DropZone(props: DropZoneProps) {
|
|
55
65
|
return <DropZoneContent {...props} />;
|
|
@@ -102,31 +112,19 @@ function DropZoneContent(
|
|
|
102
112
|
}, [onClick]);
|
|
103
113
|
|
|
104
114
|
return (
|
|
105
|
-
<
|
|
115
|
+
<DropzoneRoot {...getRootProps(getPropsOptions)}>
|
|
106
116
|
{children}
|
|
107
117
|
{isDragActive ? (
|
|
108
|
-
<
|
|
109
|
-
css={dropZoneCss.dragActive}
|
|
110
|
-
style={{
|
|
111
|
-
borderColor,
|
|
112
|
-
color,
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
118
|
+
<DropzoneDragActive borderColor={borderColor} color={color}>
|
|
115
119
|
<FaCloudUploadAlt size={70} />
|
|
116
120
|
<p>Drop the files here.</p>
|
|
117
|
-
</
|
|
121
|
+
</DropzoneDragActive>
|
|
118
122
|
) : !hasChildren ? (
|
|
119
|
-
<
|
|
120
|
-
css={dropZoneCss.empty}
|
|
121
|
-
style={{
|
|
122
|
-
borderColor,
|
|
123
|
-
color,
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
123
|
+
<DropzoneEmpty borderColor={borderColor} color={color}>
|
|
126
124
|
{emptyText}
|
|
127
|
-
</
|
|
125
|
+
</DropzoneEmpty>
|
|
128
126
|
) : null}
|
|
129
127
|
<input {...getInputProps()} />
|
|
130
|
-
</
|
|
128
|
+
</DropzoneRoot>
|
|
131
129
|
);
|
|
132
130
|
}
|
|
@@ -72,24 +72,26 @@ function DropdownContextMenu<T>(props: Omit<DropdownMenuProps<T>, 'trigger'>) {
|
|
|
72
72
|
return (
|
|
73
73
|
<HandleMenuContextDiv onContextMenu={handleContextMenu}>
|
|
74
74
|
{isPopperElementOpen && (
|
|
75
|
-
<
|
|
76
|
-
<div
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
<Portal>
|
|
76
|
+
<div ref={ref}>
|
|
77
|
+
<div
|
|
78
|
+
ref={setPopperElement}
|
|
79
|
+
style={styles.popper}
|
|
80
|
+
{...attributes.popper}
|
|
81
|
+
>
|
|
82
|
+
<Menu>
|
|
83
|
+
<MenuItems
|
|
84
|
+
itemsStatic
|
|
85
|
+
onSelect={(selected) => {
|
|
86
|
+
closePopperElement();
|
|
87
|
+
onSelect(selected);
|
|
88
|
+
}}
|
|
89
|
+
{...otherProps}
|
|
90
|
+
/>
|
|
91
|
+
</Menu>
|
|
92
|
+
</div>
|
|
91
93
|
</div>
|
|
92
|
-
</
|
|
94
|
+
</Portal>
|
|
93
95
|
)}
|
|
94
96
|
|
|
95
97
|
{children}
|