@open-slide/core 2.0.0-beta.3 → 2.0.0-beta.5
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 +1 -1
- package/dist/{build-Bzy-qlGc.js → build-Cu5_qRyE.js} +1 -1
- package/dist/cli/bin.js +3 -3
- package/dist/{config-nbSvY7z_.js → config-BQ6rD2iE.js} +226 -27
- package/dist/{config-DjWifhaA.d.ts → config-GMR1QUlM.d.ts} +1 -1
- package/dist/{dev-MXa5Tod4.js → dev-BK641O5e.js} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-DEpQcKz3.js → preview-BuCI-RMW.js} +1 -1
- package/dist/{types-BWg-Dtbg.d.ts → types-BcbaKTNY.d.ts} +60 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-DlKyeNX7.js → zh-tw-B51sMTg3.js} +267 -31
- package/package.json +4 -4
- package/src/app/components/asset-view.tsx +448 -0
- package/src/app/components/history-provider.tsx +68 -44
- package/src/app/components/icon-switcher-indicator.tsx +10 -0
- package/src/app/components/inspector/arrange-panel.tsx +449 -0
- package/src/app/components/inspector/inline-text-editor.tsx +170 -284
- package/src/app/components/inspector/inspect-overlay.tsx +642 -295
- package/src/app/components/inspector/inspector-panel.tsx +434 -427
- package/src/app/components/inspector/inspector-provider.tsx +564 -293
- package/src/app/components/inspector/save-bar.tsx +36 -0
- package/src/app/components/panel/editor-sidebar.tsx +50 -0
- package/src/app/components/panel/panel-fields.tsx +204 -16
- package/src/app/components/panel/panel-shell.tsx +3 -18
- package/src/app/components/style-panel/style-panel.tsx +4 -69
- package/src/app/lib/assets.ts +33 -0
- package/src/app/lib/inspector/geometry.test.ts +324 -0
- package/src/app/lib/inspector/geometry.ts +207 -0
- package/src/app/lib/inspector/text-edit-timeline.test.ts +121 -0
- package/src/app/lib/inspector/text-edit-timeline.ts +12 -0
- package/src/app/lib/inspector/text-selection.ts +117 -0
- package/src/app/lib/inspector/use-editor.ts +1 -1
- package/src/app/lib/inspector/use-visual-editor.ts +429 -0
- package/src/app/lib/inspector/visual-dom.ts +255 -0
- package/src/app/lib/keys.ts +9 -0
- package/src/app/routes/slide.tsx +34 -9
- package/src/locale/en.ts +70 -8
- package/src/locale/ja.ts +72 -7
- package/src/locale/types.ts +60 -0
- package/src/locale/zh-cn.ts +68 -8
- package/src/locale/zh-tw.ts +68 -8
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AlignHorizontalDistributeCenter,
|
|
3
|
+
AlignHorizontalJustifyCenter,
|
|
4
|
+
AlignHorizontalJustifyEnd,
|
|
5
|
+
AlignHorizontalJustifyStart,
|
|
6
|
+
AlignVerticalDistributeCenter,
|
|
7
|
+
AlignVerticalJustifyCenter,
|
|
8
|
+
AlignVerticalJustifyEnd,
|
|
9
|
+
AlignVerticalJustifyStart,
|
|
10
|
+
ArrowDown,
|
|
11
|
+
ArrowUp,
|
|
12
|
+
BringToFront,
|
|
13
|
+
CircleHelp,
|
|
14
|
+
CornerLeftUp,
|
|
15
|
+
type LucideIcon,
|
|
16
|
+
Magnet,
|
|
17
|
+
RotateCw,
|
|
18
|
+
SendToBack,
|
|
19
|
+
} from 'lucide-react';
|
|
20
|
+
import { useEffect, useRef, useState } from 'react';
|
|
21
|
+
import { NumberInput, NumberShell, Section } from '@/components/panel/panel-fields';
|
|
22
|
+
import { Button } from '@/components/ui/button';
|
|
23
|
+
import { Toggle } from '@/components/ui/toggle';
|
|
24
|
+
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
|
|
25
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
|
26
|
+
import { canTransform, readCanvas, readFrame, readRotation } from '@/lib/inspector/visual-dom';
|
|
27
|
+
import { useLocale } from '@/lib/use-locale';
|
|
28
|
+
import { round2 } from '@/lib/utils';
|
|
29
|
+
import { useInspector } from './inspector-provider';
|
|
30
|
+
|
|
31
|
+
type Frame = {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
rotation: number;
|
|
37
|
+
editable: boolean;
|
|
38
|
+
shared: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export function ArrangePanel() {
|
|
42
|
+
const { selection, opsVersion, visual, committing } = useInspector();
|
|
43
|
+
const { inspector: t } = useLocale();
|
|
44
|
+
const [frame, setFrame] = useState<Frame | null>(null);
|
|
45
|
+
const [toSlide, setToSlide] = useState(false);
|
|
46
|
+
const multiple = selection.length > 1;
|
|
47
|
+
const alignToSlide = !multiple || toSlide;
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
void opsVersion;
|
|
51
|
+
const update = () => {
|
|
52
|
+
const canvas = readCanvas();
|
|
53
|
+
const anchors = selection
|
|
54
|
+
.map((target) => target.anchor)
|
|
55
|
+
.filter((anchor) => anchor.isConnected);
|
|
56
|
+
if (!canvas || anchors.length === 0) {
|
|
57
|
+
setFrame(null);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const frames = anchors.map((anchor) => readFrame(anchor, canvas));
|
|
61
|
+
const x = Math.min(...frames.map((frame) => frame.x));
|
|
62
|
+
const y = Math.min(...frames.map((frame) => frame.y));
|
|
63
|
+
setFrame({
|
|
64
|
+
x,
|
|
65
|
+
y,
|
|
66
|
+
width: Math.max(...frames.map((frame) => frame.x + frame.width)) - x,
|
|
67
|
+
height: Math.max(...frames.map((frame) => frame.y + frame.height)) - y,
|
|
68
|
+
rotation: anchors.length === 1 ? readRotation(anchors[0]) : 0,
|
|
69
|
+
editable: selection.every((target) => canTransform(target, canvas)),
|
|
70
|
+
shared: selection.some(
|
|
71
|
+
(target) =>
|
|
72
|
+
canvas.root.querySelectorAll(`[data-slide-loc="${target.line}:${target.column}"]`)
|
|
73
|
+
.length > 1,
|
|
74
|
+
),
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
update();
|
|
78
|
+
const observer = new ResizeObserver(update);
|
|
79
|
+
for (const target of selection) observer.observe(target.anchor);
|
|
80
|
+
window.addEventListener('resize', update);
|
|
81
|
+
return () => {
|
|
82
|
+
observer.disconnect();
|
|
83
|
+
window.removeEventListener('resize', update);
|
|
84
|
+
};
|
|
85
|
+
}, [selection, opsVersion]);
|
|
86
|
+
|
|
87
|
+
if (!frame) return null;
|
|
88
|
+
const blocked = !frame.editable || committing;
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<TooltipProvider delay={350}>
|
|
92
|
+
<Section
|
|
93
|
+
title={t.positionLabel}
|
|
94
|
+
action={
|
|
95
|
+
<div className="flex items-center gap-0.5">
|
|
96
|
+
<HeaderButton
|
|
97
|
+
label={t.selectParent}
|
|
98
|
+
icon={CornerLeftUp}
|
|
99
|
+
disabled={multiple || committing}
|
|
100
|
+
onClick={visual.selectParent}
|
|
101
|
+
/>
|
|
102
|
+
<Tooltip>
|
|
103
|
+
<TooltipTrigger
|
|
104
|
+
render={
|
|
105
|
+
<Button
|
|
106
|
+
variant="ghost"
|
|
107
|
+
size="icon-xs"
|
|
108
|
+
className="cursor-help text-muted-foreground hover:text-foreground"
|
|
109
|
+
aria-label={t.visualEditorHint}
|
|
110
|
+
/>
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<CircleHelp />
|
|
114
|
+
</TooltipTrigger>
|
|
115
|
+
<TooltipContent side="bottom" align="end" className="max-w-64 leading-relaxed">
|
|
116
|
+
{t.visualEditorHint}
|
|
117
|
+
</TooltipContent>
|
|
118
|
+
</Tooltip>
|
|
119
|
+
</div>
|
|
120
|
+
}
|
|
121
|
+
>
|
|
122
|
+
{!frame.editable && (
|
|
123
|
+
<p className="text-[11px] leading-relaxed text-muted-foreground">
|
|
124
|
+
{frame.shared ? t.sharedLayoutHint : t.inlineLayoutHint}
|
|
125
|
+
</p>
|
|
126
|
+
)}
|
|
127
|
+
<div className="grid grid-cols-2 gap-1.5">
|
|
128
|
+
<FrameInput
|
|
129
|
+
prefix="X"
|
|
130
|
+
label={t.positionX}
|
|
131
|
+
value={frame.x}
|
|
132
|
+
disabled={blocked}
|
|
133
|
+
onChange={(x) => visual.setFrame({ x })}
|
|
134
|
+
/>
|
|
135
|
+
<FrameInput
|
|
136
|
+
prefix="Y"
|
|
137
|
+
label={t.positionY}
|
|
138
|
+
value={frame.y}
|
|
139
|
+
disabled={blocked}
|
|
140
|
+
onChange={(y) => visual.setFrame({ y })}
|
|
141
|
+
/>
|
|
142
|
+
<FrameInput
|
|
143
|
+
prefix="W"
|
|
144
|
+
label={t.widthLabel}
|
|
145
|
+
value={frame.width}
|
|
146
|
+
min={8}
|
|
147
|
+
disabled={multiple || blocked}
|
|
148
|
+
onChange={(width) => visual.setFrame({ width })}
|
|
149
|
+
/>
|
|
150
|
+
<FrameInput
|
|
151
|
+
prefix="H"
|
|
152
|
+
label={t.heightLabel}
|
|
153
|
+
value={frame.height}
|
|
154
|
+
min={8}
|
|
155
|
+
disabled={multiple || blocked}
|
|
156
|
+
onChange={(height) => visual.setFrame({ height })}
|
|
157
|
+
/>
|
|
158
|
+
<FrameInput
|
|
159
|
+
icon={RotateCw}
|
|
160
|
+
suffix="°"
|
|
161
|
+
label={t.rotationLabel}
|
|
162
|
+
value={frame.rotation}
|
|
163
|
+
disabled={multiple || blocked}
|
|
164
|
+
onChange={(rotation) => visual.setFrame({ rotation })}
|
|
165
|
+
/>
|
|
166
|
+
</div>
|
|
167
|
+
</Section>
|
|
168
|
+
|
|
169
|
+
<Section
|
|
170
|
+
title={t.alignLabel}
|
|
171
|
+
action={
|
|
172
|
+
<Tooltip>
|
|
173
|
+
<TooltipTrigger
|
|
174
|
+
render={
|
|
175
|
+
<Toggle
|
|
176
|
+
size="sm"
|
|
177
|
+
disabled={committing}
|
|
178
|
+
pressed={visual.snapping}
|
|
179
|
+
onPressedChange={visual.setSnapping}
|
|
180
|
+
aria-label={t.smartGuides}
|
|
181
|
+
className="size-6 min-w-6 rounded-[5px] px-0 text-muted-foreground/60 hover:bg-transparent hover:text-foreground data-pressed:bg-muted data-pressed:text-foreground"
|
|
182
|
+
/>
|
|
183
|
+
}
|
|
184
|
+
>
|
|
185
|
+
<Magnet />
|
|
186
|
+
</TooltipTrigger>
|
|
187
|
+
<TooltipContent side="bottom" align="end">
|
|
188
|
+
{t.smartGuides}
|
|
189
|
+
</TooltipContent>
|
|
190
|
+
</Tooltip>
|
|
191
|
+
}
|
|
192
|
+
>
|
|
193
|
+
{multiple && (
|
|
194
|
+
<ToggleGroup
|
|
195
|
+
size="sm"
|
|
196
|
+
variant="outline"
|
|
197
|
+
disabled={committing}
|
|
198
|
+
value={[alignToSlide ? 'slide' : 'selection']}
|
|
199
|
+
onValueChange={(value) => {
|
|
200
|
+
if (value.length > 0) setToSlide(value[0] === 'slide');
|
|
201
|
+
}}
|
|
202
|
+
aria-label={t.alignToLabel}
|
|
203
|
+
className="w-full"
|
|
204
|
+
>
|
|
205
|
+
<ToggleGroupItem value="selection" className="flex-1">
|
|
206
|
+
{t.alignToSelection}
|
|
207
|
+
</ToggleGroupItem>
|
|
208
|
+
<ToggleGroupItem value="slide" className="flex-1">
|
|
209
|
+
{t.alignToSlide}
|
|
210
|
+
</ToggleGroupItem>
|
|
211
|
+
</ToggleGroup>
|
|
212
|
+
)}
|
|
213
|
+
<div className="flex items-center gap-2">
|
|
214
|
+
<ButtonGroup label={t.alignLabel}>
|
|
215
|
+
<ArrangeButton
|
|
216
|
+
label={t.alignLeft}
|
|
217
|
+
icon={AlignHorizontalJustifyStart}
|
|
218
|
+
disabled={blocked}
|
|
219
|
+
onClick={() => visual.align('left', alignToSlide)}
|
|
220
|
+
/>
|
|
221
|
+
<ArrangeButton
|
|
222
|
+
label={t.alignCenter}
|
|
223
|
+
icon={AlignHorizontalJustifyCenter}
|
|
224
|
+
disabled={blocked}
|
|
225
|
+
onClick={() => visual.align('center', alignToSlide)}
|
|
226
|
+
/>
|
|
227
|
+
<ArrangeButton
|
|
228
|
+
label={t.alignRight}
|
|
229
|
+
icon={AlignHorizontalJustifyEnd}
|
|
230
|
+
disabled={blocked}
|
|
231
|
+
onClick={() => visual.align('right', alignToSlide)}
|
|
232
|
+
/>
|
|
233
|
+
</ButtonGroup>
|
|
234
|
+
<ButtonGroup label={t.alignLabel}>
|
|
235
|
+
<ArrangeButton
|
|
236
|
+
label={t.alignTop}
|
|
237
|
+
icon={AlignVerticalJustifyStart}
|
|
238
|
+
disabled={blocked}
|
|
239
|
+
onClick={() => visual.align('top', alignToSlide)}
|
|
240
|
+
/>
|
|
241
|
+
<ArrangeButton
|
|
242
|
+
label={t.alignMiddle}
|
|
243
|
+
icon={AlignVerticalJustifyCenter}
|
|
244
|
+
disabled={blocked}
|
|
245
|
+
onClick={() => visual.align('middle', alignToSlide)}
|
|
246
|
+
/>
|
|
247
|
+
<ArrangeButton
|
|
248
|
+
label={t.alignBottom}
|
|
249
|
+
icon={AlignVerticalJustifyEnd}
|
|
250
|
+
disabled={blocked}
|
|
251
|
+
onClick={() => visual.align('bottom', alignToSlide)}
|
|
252
|
+
/>
|
|
253
|
+
</ButtonGroup>
|
|
254
|
+
{multiple && (
|
|
255
|
+
<ButtonGroup label={t.distributeLabel}>
|
|
256
|
+
<ArrangeButton
|
|
257
|
+
label={t.distributeHorizontal}
|
|
258
|
+
icon={AlignHorizontalDistributeCenter}
|
|
259
|
+
disabled={blocked || selection.length < 3}
|
|
260
|
+
onClick={() => visual.distribute('x')}
|
|
261
|
+
/>
|
|
262
|
+
<ArrangeButton
|
|
263
|
+
label={t.distributeVertical}
|
|
264
|
+
icon={AlignVerticalDistributeCenter}
|
|
265
|
+
disabled={blocked || selection.length < 3}
|
|
266
|
+
onClick={() => visual.distribute('y')}
|
|
267
|
+
/>
|
|
268
|
+
</ButtonGroup>
|
|
269
|
+
)}
|
|
270
|
+
</div>
|
|
271
|
+
</Section>
|
|
272
|
+
|
|
273
|
+
<Section title={t.layerLabel}>
|
|
274
|
+
<ButtonGroup label={t.layerLabel}>
|
|
275
|
+
<ArrangeButton
|
|
276
|
+
label={t.bringToFront}
|
|
277
|
+
icon={BringToFront}
|
|
278
|
+
disabled={blocked}
|
|
279
|
+
onClick={() => visual.arrange('front')}
|
|
280
|
+
/>
|
|
281
|
+
<ArrangeButton
|
|
282
|
+
label={t.bringForward}
|
|
283
|
+
icon={ArrowUp}
|
|
284
|
+
disabled={blocked}
|
|
285
|
+
onClick={() => visual.arrange('forward')}
|
|
286
|
+
/>
|
|
287
|
+
<ArrangeButton
|
|
288
|
+
label={t.sendBackward}
|
|
289
|
+
icon={ArrowDown}
|
|
290
|
+
disabled={blocked}
|
|
291
|
+
onClick={() => visual.arrange('backward')}
|
|
292
|
+
/>
|
|
293
|
+
<ArrangeButton
|
|
294
|
+
label={t.sendToBack}
|
|
295
|
+
icon={SendToBack}
|
|
296
|
+
disabled={blocked}
|
|
297
|
+
onClick={() => visual.arrange('back')}
|
|
298
|
+
/>
|
|
299
|
+
</ButtonGroup>
|
|
300
|
+
</Section>
|
|
301
|
+
</TooltipProvider>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function ButtonGroup({ label, children }: { label: string; children: React.ReactNode }) {
|
|
306
|
+
return (
|
|
307
|
+
<fieldset
|
|
308
|
+
aria-label={label}
|
|
309
|
+
className="flex min-w-0 [&>button]:relative [&>button]:rounded-none [&>button+button]:-ml-px [&>button:first-child]:rounded-l-[5px] [&>button:last-child]:rounded-r-[5px] [&>button:focus-visible]:z-10 [&>button:hover]:z-10"
|
|
310
|
+
>
|
|
311
|
+
{children}
|
|
312
|
+
</fieldset>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function ArrangeButton({
|
|
317
|
+
label,
|
|
318
|
+
icon: Icon,
|
|
319
|
+
onClick,
|
|
320
|
+
disabled = false,
|
|
321
|
+
}: {
|
|
322
|
+
label: string;
|
|
323
|
+
icon: LucideIcon;
|
|
324
|
+
onClick: () => void;
|
|
325
|
+
disabled?: boolean;
|
|
326
|
+
}) {
|
|
327
|
+
return (
|
|
328
|
+
<Tooltip>
|
|
329
|
+
<TooltipTrigger
|
|
330
|
+
render={
|
|
331
|
+
<Button
|
|
332
|
+
variant="outline"
|
|
333
|
+
size="icon-sm"
|
|
334
|
+
aria-label={label}
|
|
335
|
+
disabled={disabled}
|
|
336
|
+
onClick={onClick}
|
|
337
|
+
/>
|
|
338
|
+
}
|
|
339
|
+
>
|
|
340
|
+
<Icon />
|
|
341
|
+
</TooltipTrigger>
|
|
342
|
+
<TooltipContent>{label}</TooltipContent>
|
|
343
|
+
</Tooltip>
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function HeaderButton({
|
|
348
|
+
label,
|
|
349
|
+
icon: Icon,
|
|
350
|
+
onClick,
|
|
351
|
+
disabled = false,
|
|
352
|
+
}: {
|
|
353
|
+
label: string;
|
|
354
|
+
icon: LucideIcon;
|
|
355
|
+
onClick: () => void;
|
|
356
|
+
disabled?: boolean;
|
|
357
|
+
}) {
|
|
358
|
+
return (
|
|
359
|
+
<Tooltip>
|
|
360
|
+
<TooltipTrigger
|
|
361
|
+
render={
|
|
362
|
+
<Button
|
|
363
|
+
variant="ghost"
|
|
364
|
+
size="icon-xs"
|
|
365
|
+
className="text-muted-foreground hover:text-foreground"
|
|
366
|
+
aria-label={label}
|
|
367
|
+
disabled={disabled}
|
|
368
|
+
onClick={onClick}
|
|
369
|
+
/>
|
|
370
|
+
}
|
|
371
|
+
>
|
|
372
|
+
<Icon />
|
|
373
|
+
</TooltipTrigger>
|
|
374
|
+
<TooltipContent side="bottom" align="end">
|
|
375
|
+
{label}
|
|
376
|
+
</TooltipContent>
|
|
377
|
+
</Tooltip>
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function FrameInput({
|
|
382
|
+
prefix,
|
|
383
|
+
icon,
|
|
384
|
+
suffix,
|
|
385
|
+
label,
|
|
386
|
+
value,
|
|
387
|
+
onChange,
|
|
388
|
+
min,
|
|
389
|
+
disabled = false,
|
|
390
|
+
}: {
|
|
391
|
+
prefix?: string;
|
|
392
|
+
icon?: LucideIcon;
|
|
393
|
+
suffix?: string;
|
|
394
|
+
label: string;
|
|
395
|
+
value: number;
|
|
396
|
+
onChange: (value: number) => void;
|
|
397
|
+
min?: number;
|
|
398
|
+
disabled?: boolean;
|
|
399
|
+
}) {
|
|
400
|
+
const [draft, setDraft] = useState(String(round2(value)));
|
|
401
|
+
const focused = useRef(false);
|
|
402
|
+
const cancelled = useRef(false);
|
|
403
|
+
const edit = useRef({ value, onChange });
|
|
404
|
+
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (!focused.current) setDraft(String(round2(value)));
|
|
407
|
+
}, [value]);
|
|
408
|
+
|
|
409
|
+
return (
|
|
410
|
+
<NumberShell prefix={prefix} icon={icon} suffix={suffix} label={label}>
|
|
411
|
+
<NumberInput
|
|
412
|
+
aria-label={label}
|
|
413
|
+
value={draft}
|
|
414
|
+
min={min}
|
|
415
|
+
step={1}
|
|
416
|
+
disabled={disabled}
|
|
417
|
+
onFocus={() => {
|
|
418
|
+
focused.current = true;
|
|
419
|
+
cancelled.current = false;
|
|
420
|
+
edit.current = { value, onChange };
|
|
421
|
+
}}
|
|
422
|
+
onChange={(event) => setDraft(event.target.value)}
|
|
423
|
+
onBlur={() => {
|
|
424
|
+
focused.current = false;
|
|
425
|
+
const next = Number(draft);
|
|
426
|
+
if (
|
|
427
|
+
!disabled &&
|
|
428
|
+
!cancelled.current &&
|
|
429
|
+
draft.trim() &&
|
|
430
|
+
Number.isFinite(next) &&
|
|
431
|
+
next !== round2(edit.current.value)
|
|
432
|
+
) {
|
|
433
|
+
const clamped = min === undefined ? next : Math.max(min, next);
|
|
434
|
+
edit.current.onChange(clamped);
|
|
435
|
+
}
|
|
436
|
+
setDraft(String(round2(value)));
|
|
437
|
+
}}
|
|
438
|
+
onKeyDown={(event) => {
|
|
439
|
+
if (event.key === 'Enter') event.currentTarget.blur();
|
|
440
|
+
if (event.key === 'Escape') {
|
|
441
|
+
event.stopPropagation();
|
|
442
|
+
cancelled.current = true;
|
|
443
|
+
event.currentTarget.blur();
|
|
444
|
+
}
|
|
445
|
+
}}
|
|
446
|
+
/>
|
|
447
|
+
</NumberShell>
|
|
448
|
+
);
|
|
449
|
+
}
|