@choice-ui/react 1.6.8 → 1.6.9
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/dist/components/description/dist/index.d.ts +8 -0
- package/dist/components/description/dist/index.js +29 -0
- package/dist/components/description/src/description.d.ts +6 -0
- package/dist/components/description/src/description.js +18 -0
- package/dist/components/description/src/index.d.ts +2 -0
- package/dist/components/description/src/tv.d.ts +13 -0
- package/dist/components/description/src/tv.js +15 -0
- package/dist/components/description/tsup.config.d.ts +2 -0
- package/dist/components/emoji-picker/dist/index.d.ts +1 -0
- package/dist/components/emoji-picker/dist/index.js +4 -2
- package/dist/components/emoji-picker/src/emoji-picker.d.ts +1 -0
- package/dist/components/emoji-picker/src/emoji-picker.js +4 -2
- package/dist/components/error-message/dist/index.d.ts +8 -0
- package/dist/components/error-message/dist/index.js +30 -0
- package/dist/components/error-message/src/error-message.d.ts +6 -0
- package/dist/components/error-message/src/error-message.js +19 -0
- package/dist/components/error-message/src/index.d.ts +2 -0
- package/dist/components/error-message/src/tv.d.ts +13 -0
- package/dist/components/error-message/src/tv.js +15 -0
- package/dist/components/error-message/tsup.config.d.ts +2 -0
- package/dist/components/form/src/adapters/base-adapter.js +4 -2
- package/dist/components/form/src/tv.d.ts +0 -12
- package/dist/components/form/src/tv.js +1 -13
- package/dist/components/index.d.ts +3 -0
- package/dist/components/md-render/dist/index.d.ts +2 -1
- package/dist/components/md-render/dist/index.js +3 -1
- package/dist/components/md-render/src/md-render.js +3 -1
- package/dist/components/md-render/src/types.d.ts +2 -1
- package/dist/components/notifications/dist/index.d.ts +1 -5
- package/dist/components/notifications/src/notifications.d.ts +0 -1
- package/dist/components/notifications/src/notifications.js +0 -1
- package/dist/components/numeric-input/dist/index.d.ts +23 -9
- package/dist/components/numeric-input/dist/index.js +26 -3
- package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.js +4 -1
- package/dist/components/numeric-input/src/hooks/index.d.ts +1 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.d.ts +13 -0
- package/dist/components/numeric-input/src/hooks/use-numeric-long-press.js +27 -0
- package/dist/components/numeric-input/src/index.d.ts +1 -0
- package/dist/components/numeric-input/src/tv.js +22 -2
- package/dist/components/picture-preview/dist/index.d.ts +5 -0
- package/dist/components/picture-preview/dist/index.js +287 -140
- package/dist/components/picture-preview/src/hooks/useWheelHandler.d.ts +6 -1
- package/dist/components/picture-preview/src/hooks/useWheelHandler.js +25 -7
- package/dist/components/picture-preview/src/picture-preview.d.ts +5 -0
- package/dist/components/picture-preview/src/picture-preview.js +214 -123
- package/dist/components/picture-preview/src/tv.d.ts +93 -3
- package/dist/components/picture-preview/src/tv.js +48 -10
- package/dist/components/separator/dist/index.d.ts +1 -8
- package/dist/components/separator/src/separator.d.ts +1 -8
- package/dist/components/separator/src/separator.js +33 -5
- package/dist/components/separator/src/tv.d.ts +39 -18
- package/dist/components/separator/src/tv.js +37 -7
- package/dist/components/text-field/dist/index.d.ts +2 -3
- package/dist/components/text-field/dist/index.js +4 -19
- package/dist/components/text-field/src/components/index.d.ts +0 -1
- package/dist/components/text-field/src/text-field.d.ts +3 -2
- package/dist/components/text-field/src/text-field.js +2 -2
- package/dist/components/text-field/src/tv.d.ts +3 -3
- package/dist/components/text-field/src/tv.js +1 -6
- package/dist/components/toast/dist/index.d.ts +248 -0
- package/dist/components/toast/src/components/index.d.ts +3 -0
- package/dist/components/toast/src/components/toast-progress-bar.d.ts +7 -0
- package/dist/components/toast/src/components/toast-progress-bar.js +53 -0
- package/dist/components/toast/src/components/toaster-item.d.ts +26 -0
- package/dist/components/toast/src/components/toaster-item.js +416 -0
- package/dist/components/toast/src/components/toaster-slots.d.ts +87 -0
- package/dist/components/toast/src/components/toaster-slots.js +38 -0
- package/dist/components/toast/src/index.d.ts +5 -0
- package/dist/components/toast/src/store.d.ts +101 -0
- package/dist/components/toast/src/store.js +205 -0
- package/dist/components/toast/src/toaster.d.ts +87 -0
- package/dist/components/toast/src/toaster.js +271 -0
- package/dist/components/toast/src/tv.d.ts +365 -0
- package/dist/components/toast/src/tv.js +412 -0
- package/dist/components/toast/src/types.d.ts +79 -0
- package/dist/components/toast/tsup.config.d.ts +2 -0
- package/dist/index.js +11 -2
- package/dist/styles/components.css +2 -0
- package/package.json +1 -1
- package/dist/components/text-field/src/components/field-description.d.ts +0 -2
- package/dist/components/text-field/src/components/field-description.js +0 -16
|
@@ -12,6 +12,11 @@ interface PicturePreviewProps extends HTMLProps<HTMLDivElement> {
|
|
|
12
12
|
fileName?: string;
|
|
13
13
|
onClose?: () => void;
|
|
14
14
|
src: string;
|
|
15
|
+
control?: {
|
|
16
|
+
enable?: boolean;
|
|
17
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
|
18
|
+
show?: "always" | "hover";
|
|
19
|
+
};
|
|
15
20
|
}
|
|
16
21
|
export declare const PicturePreview: import('react').ForwardRefExoticComponent<Omit<PicturePreviewProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
17
22
|
export {};
|
|
@@ -2,16 +2,17 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Dropdown as Dropdown2 } from "../../dropdown/dist/index.js";
|
|
3
3
|
import { IconButton } from "../../icon-button/dist/index.js";
|
|
4
4
|
import { LoaderCircle, ImageRemove, Delete, Add } from "@choiceform/icons-react";
|
|
5
|
-
import { forwardRef, useState,
|
|
5
|
+
import { forwardRef, useState, useMemo, useRef, useEffect, useCallback } from "react";
|
|
6
|
+
import { useEventCallback } from "usehooks-ts";
|
|
6
7
|
import { PicturePreviewTv } from "./tv.js";
|
|
7
8
|
import { useDraggable } from "./hooks/useDraggable.js";
|
|
8
9
|
import { useWheelHandler } from "./hooks/useWheelHandler.js";
|
|
9
10
|
import { useHotkeys, HOTKEYS } from "./hooks/useHotkeys.js";
|
|
10
11
|
import { tcx } from "../../../shared/utils/tcx/tcx.js";
|
|
11
|
-
const MIN_ZOOM = 0.01;
|
|
12
|
-
const MAX_ZOOM = 10;
|
|
13
12
|
const ZOOM_STEP = 0.1;
|
|
14
13
|
const INITIAL_ZOOM = 1;
|
|
14
|
+
const MIN_ACTUAL_PERCENT = 2;
|
|
15
|
+
const MAX_ACTUAL_PERCENT = 1e3;
|
|
15
16
|
const PicturePreview = forwardRef(
|
|
16
17
|
function PicturePreview2(props, ref) {
|
|
17
18
|
const {
|
|
@@ -29,16 +30,32 @@ const PicturePreview = forwardRef(
|
|
|
29
30
|
zoomTo200: "Zoom to 200%",
|
|
30
31
|
error: "Image loading failed, please try again."
|
|
31
32
|
},
|
|
33
|
+
control = {
|
|
34
|
+
enable: true,
|
|
35
|
+
position: "bottom-right",
|
|
36
|
+
show: "hover"
|
|
37
|
+
},
|
|
32
38
|
...rest
|
|
33
39
|
} = props;
|
|
34
40
|
const [zoom, setZoom] = useState(INITIAL_ZOOM);
|
|
35
41
|
const [isLoading, setIsLoading] = useState(true);
|
|
36
42
|
const [isError, setIsError] = useState(false);
|
|
43
|
+
const [naturalSize, setNaturalSize] = useState(null);
|
|
44
|
+
const [baseScale, setBaseScale] = useState(1);
|
|
45
|
+
const [menuIsOpen, setMenuIsOpen] = useState(false);
|
|
46
|
+
const minZoom = useMemo(
|
|
47
|
+
() => baseScale > 0 ? MIN_ACTUAL_PERCENT / 100 / baseScale : 0.01,
|
|
48
|
+
[baseScale]
|
|
49
|
+
);
|
|
50
|
+
const maxZoom = useMemo(
|
|
51
|
+
() => baseScale > 0 ? MAX_ACTUAL_PERCENT / 100 / baseScale : 100,
|
|
52
|
+
[baseScale]
|
|
53
|
+
);
|
|
37
54
|
const internalRef = useRef(null);
|
|
38
55
|
const canvasRef = useRef(null);
|
|
39
56
|
const zoomRef = useRef(zoom);
|
|
40
57
|
const rafId = useRef(null);
|
|
41
|
-
const scheduleUpdate =
|
|
58
|
+
const scheduleUpdate = useEventCallback(() => {
|
|
42
59
|
if (rafId.current !== null) {
|
|
43
60
|
return;
|
|
44
61
|
}
|
|
@@ -46,7 +63,7 @@ const PicturePreview = forwardRef(
|
|
|
46
63
|
setZoom(zoomRef.current);
|
|
47
64
|
rafId.current = null;
|
|
48
65
|
});
|
|
49
|
-
}
|
|
66
|
+
});
|
|
50
67
|
useEffect(() => {
|
|
51
68
|
return () => {
|
|
52
69
|
if (rafId.current !== null) {
|
|
@@ -58,43 +75,52 @@ const PicturePreview = forwardRef(
|
|
|
58
75
|
zoomRef.current = zoom;
|
|
59
76
|
}, [zoom]);
|
|
60
77
|
const { position, isDragging, handleMouseDown, updatePosition, positionRef } = useDraggable();
|
|
61
|
-
const
|
|
62
|
-
(
|
|
63
|
-
|
|
78
|
+
const handlePositionChange = useEventCallback((newPosition) => {
|
|
79
|
+
updatePosition(newPosition);
|
|
80
|
+
});
|
|
81
|
+
const handleZoomAtPoint = useEventCallback(
|
|
82
|
+
(params) => {
|
|
83
|
+
zoomRef.current = params.newZoom;
|
|
84
|
+
updatePosition(params.newPosition);
|
|
64
85
|
scheduleUpdate();
|
|
65
|
-
}
|
|
66
|
-
[scheduleUpdate]
|
|
67
|
-
);
|
|
68
|
-
const handlePositionChange = useCallback(
|
|
69
|
-
(newPosition) => {
|
|
70
|
-
updatePosition(newPosition);
|
|
71
|
-
},
|
|
72
|
-
[updatePosition]
|
|
86
|
+
}
|
|
73
87
|
);
|
|
74
88
|
useWheelHandler(internalRef, zoomRef, positionRef, {
|
|
75
|
-
minZoom
|
|
76
|
-
maxZoom
|
|
89
|
+
minZoom,
|
|
90
|
+
maxZoom,
|
|
77
91
|
zoomStep: ZOOM_STEP,
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
onPan: handlePositionChange,
|
|
93
|
+
onZoomAtPoint: handleZoomAtPoint
|
|
94
|
+
});
|
|
95
|
+
const zoomIn = useEventCallback(() => {
|
|
96
|
+
zoomRef.current = Math.min(maxZoom, zoomRef.current + ZOOM_STEP);
|
|
97
|
+
scheduleUpdate();
|
|
80
98
|
});
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [handleZoomChange]);
|
|
87
|
-
const resetView = useCallback(() => {
|
|
99
|
+
const zoomOut = useEventCallback(() => {
|
|
100
|
+
zoomRef.current = Math.max(minZoom, zoomRef.current - ZOOM_STEP);
|
|
101
|
+
scheduleUpdate();
|
|
102
|
+
});
|
|
103
|
+
const resetView = useEventCallback(() => {
|
|
88
104
|
zoomRef.current = INITIAL_ZOOM;
|
|
89
105
|
updatePosition({ x: 0, y: 0 });
|
|
90
106
|
scheduleUpdate();
|
|
91
|
-
}
|
|
92
|
-
const fitToView =
|
|
93
|
-
if (!canvasRef.current) return;
|
|
94
|
-
|
|
107
|
+
});
|
|
108
|
+
const fitToView = useEventCallback(() => {
|
|
109
|
+
if (!canvasRef.current || !naturalSize || !internalRef.current || baseScale <= 0) return;
|
|
110
|
+
const containerRect = internalRef.current.getBoundingClientRect();
|
|
111
|
+
const containerWidth = containerRect.width;
|
|
112
|
+
const containerHeight = containerRect.height;
|
|
113
|
+
if (naturalSize.width <= 0 || naturalSize.height <= 0) return;
|
|
114
|
+
const scaleX = containerWidth / naturalSize.width;
|
|
115
|
+
const scaleY = containerHeight / naturalSize.height;
|
|
116
|
+
const fitScale = Math.min(scaleX, scaleY);
|
|
117
|
+
zoomRef.current = fitScale / baseScale;
|
|
95
118
|
updatePosition({ x: 0, y: 0 });
|
|
96
119
|
scheduleUpdate();
|
|
97
|
-
}
|
|
120
|
+
});
|
|
121
|
+
const handleDoubleClick = useEventCallback(() => {
|
|
122
|
+
fitToView();
|
|
123
|
+
});
|
|
98
124
|
useHotkeys([
|
|
99
125
|
{
|
|
100
126
|
hotkey: HOTKEYS.ZOOM_IN,
|
|
@@ -113,13 +139,16 @@ const PicturePreview = forwardRef(
|
|
|
113
139
|
handler: () => fitToView()
|
|
114
140
|
}
|
|
115
141
|
]);
|
|
116
|
-
const handleZoomMenuItemClick =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
142
|
+
const handleZoomMenuItemClick = useEventCallback((zoomLevel) => {
|
|
143
|
+
zoomRef.current = zoomLevel;
|
|
144
|
+
scheduleUpdate();
|
|
145
|
+
});
|
|
146
|
+
const setActualZoomPercent = useEventCallback((percent) => {
|
|
147
|
+
if (baseScale === 0) return;
|
|
148
|
+
const newZoom = percent / 100 / baseScale;
|
|
149
|
+
zoomRef.current = Math.max(minZoom, Math.min(maxZoom, newZoom));
|
|
150
|
+
scheduleUpdate();
|
|
151
|
+
});
|
|
123
152
|
useEffect(() => {
|
|
124
153
|
if (!internalRef.current) return;
|
|
125
154
|
if (typeof ref === "function") {
|
|
@@ -139,26 +168,75 @@ const PicturePreview = forwardRef(
|
|
|
139
168
|
backfaceVisibility: "hidden"
|
|
140
169
|
};
|
|
141
170
|
}, [position.x, position.y, zoom, isDragging]);
|
|
171
|
+
const calculateBaseScale = useCallback(() => {
|
|
172
|
+
if (!naturalSize || !internalRef.current) return 1;
|
|
173
|
+
const containerRect = internalRef.current.getBoundingClientRect();
|
|
174
|
+
const containerWidth = containerRect.width;
|
|
175
|
+
const containerHeight = containerRect.height;
|
|
176
|
+
if (naturalSize.width <= 0 || naturalSize.height <= 0 || containerWidth <= 0 || containerHeight <= 0) {
|
|
177
|
+
return 1;
|
|
178
|
+
}
|
|
179
|
+
const scaleX = containerWidth / naturalSize.width;
|
|
180
|
+
const scaleY = containerHeight / naturalSize.height;
|
|
181
|
+
return Math.min(scaleX, scaleY);
|
|
182
|
+
}, [naturalSize]);
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (!naturalSize || !internalRef.current) return;
|
|
185
|
+
const updateBaseScale = () => {
|
|
186
|
+
const scale = calculateBaseScale();
|
|
187
|
+
setBaseScale(scale);
|
|
188
|
+
};
|
|
189
|
+
updateBaseScale();
|
|
190
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
191
|
+
updateBaseScale();
|
|
192
|
+
});
|
|
193
|
+
resizeObserver.observe(internalRef.current);
|
|
194
|
+
return () => {
|
|
195
|
+
resizeObserver.disconnect();
|
|
196
|
+
};
|
|
197
|
+
}, [naturalSize, calculateBaseScale]);
|
|
142
198
|
useEffect(() => {
|
|
143
199
|
setIsLoading(true);
|
|
200
|
+
setIsError(false);
|
|
201
|
+
setNaturalSize(null);
|
|
144
202
|
const img = new Image();
|
|
145
|
-
|
|
203
|
+
let isCancelled = false;
|
|
146
204
|
img.onload = () => {
|
|
205
|
+
if (isCancelled) return;
|
|
206
|
+
setNaturalSize({ width: img.naturalWidth, height: img.naturalHeight });
|
|
147
207
|
setIsLoading(false);
|
|
148
208
|
};
|
|
149
209
|
img.onerror = () => {
|
|
210
|
+
if (isCancelled) return;
|
|
211
|
+
setIsError(true);
|
|
150
212
|
setIsLoading(false);
|
|
151
213
|
};
|
|
214
|
+
img.src = src;
|
|
215
|
+
return () => {
|
|
216
|
+
isCancelled = true;
|
|
217
|
+
img.onload = null;
|
|
218
|
+
img.onerror = null;
|
|
219
|
+
img.src = "";
|
|
220
|
+
};
|
|
152
221
|
}, [src]);
|
|
153
|
-
const
|
|
222
|
+
const actualZoomPercent = useMemo(() => {
|
|
223
|
+
return Math.round(zoom * baseScale * 100);
|
|
224
|
+
}, [zoom, baseScale]);
|
|
225
|
+
const tv = PicturePreviewTv({
|
|
226
|
+
isLoading,
|
|
227
|
+
isError,
|
|
228
|
+
isMenuOpen: menuIsOpen,
|
|
229
|
+
controlPosition: control.position,
|
|
230
|
+
controlShow: control.show
|
|
231
|
+
});
|
|
154
232
|
return /* @__PURE__ */ jsxs(
|
|
155
233
|
"div",
|
|
156
234
|
{
|
|
157
235
|
ref: internalRef,
|
|
158
|
-
className: tcx(
|
|
236
|
+
className: tcx(tv.root(), className),
|
|
159
237
|
...rest,
|
|
160
238
|
children: [
|
|
161
|
-
isLoading && /* @__PURE__ */ jsx("div", { className:
|
|
239
|
+
isLoading && /* @__PURE__ */ jsx("div", { className: tv.loading(), children: /* @__PURE__ */ jsx(
|
|
162
240
|
LoaderCircle,
|
|
163
241
|
{
|
|
164
242
|
className: "animate-spin",
|
|
@@ -166,7 +244,7 @@ const PicturePreview = forwardRef(
|
|
|
166
244
|
height: 32
|
|
167
245
|
}
|
|
168
246
|
) }),
|
|
169
|
-
isError && /* @__PURE__ */ jsxs("div", { className:
|
|
247
|
+
isError && /* @__PURE__ */ jsxs("div", { className: tv.loading(), children: [
|
|
170
248
|
/* @__PURE__ */ jsx(
|
|
171
249
|
ImageRemove,
|
|
172
250
|
{
|
|
@@ -176,19 +254,24 @@ const PicturePreview = forwardRef(
|
|
|
176
254
|
),
|
|
177
255
|
/* @__PURE__ */ jsx("span", { children: defaultText.error })
|
|
178
256
|
] }),
|
|
179
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
257
|
+
!isError && /* @__PURE__ */ jsx("div", { className: tv.content(), children: /* @__PURE__ */ jsx(
|
|
180
258
|
"div",
|
|
181
259
|
{
|
|
182
260
|
ref: canvasRef,
|
|
183
|
-
className:
|
|
261
|
+
className: tv.canvas(),
|
|
184
262
|
style: transformStyle,
|
|
185
263
|
onMouseDown: handleMouseDown,
|
|
264
|
+
onDoubleClick: handleDoubleClick,
|
|
186
265
|
children: /* @__PURE__ */ jsx(
|
|
187
266
|
"img",
|
|
188
267
|
{
|
|
189
268
|
src,
|
|
190
269
|
alt: fileName || "Preview",
|
|
191
|
-
className:
|
|
270
|
+
className: tv.image(),
|
|
271
|
+
style: naturalSize ? {
|
|
272
|
+
width: naturalSize.width * baseScale,
|
|
273
|
+
height: naturalSize.height * baseScale
|
|
274
|
+
} : void 0,
|
|
192
275
|
draggable: false,
|
|
193
276
|
loading: "eager",
|
|
194
277
|
decoding: "async",
|
|
@@ -198,7 +281,7 @@ const PicturePreview = forwardRef(
|
|
|
198
281
|
)
|
|
199
282
|
}
|
|
200
283
|
) }),
|
|
201
|
-
isError || isLoading ? null : /* @__PURE__ */ jsxs("div", { className:
|
|
284
|
+
isError || isLoading || control.enable === false ? null : /* @__PURE__ */ jsxs("div", { className: tv.controlGroup(), children: [
|
|
202
285
|
/* @__PURE__ */ jsx(
|
|
203
286
|
IconButton,
|
|
204
287
|
{
|
|
@@ -215,82 +298,90 @@ const PicturePreview = forwardRef(
|
|
|
215
298
|
children: /* @__PURE__ */ jsx(Delete, {})
|
|
216
299
|
}
|
|
217
300
|
),
|
|
218
|
-
/* @__PURE__ */ jsxs(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
301
|
+
/* @__PURE__ */ jsxs(
|
|
302
|
+
Dropdown2,
|
|
303
|
+
{
|
|
304
|
+
selection: true,
|
|
305
|
+
open: menuIsOpen,
|
|
306
|
+
onOpenChange: setMenuIsOpen,
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsx(
|
|
309
|
+
Dropdown2.Trigger,
|
|
310
|
+
{
|
|
311
|
+
variant: "ghost",
|
|
312
|
+
className: "border-x-default rounded-none",
|
|
313
|
+
size: "large",
|
|
314
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex-1", children: [
|
|
315
|
+
actualZoomPercent,
|
|
316
|
+
"%"
|
|
317
|
+
] })
|
|
318
|
+
}
|
|
319
|
+
),
|
|
320
|
+
/* @__PURE__ */ jsxs(Dropdown2.Content, { children: [
|
|
321
|
+
/* @__PURE__ */ jsx(
|
|
322
|
+
Dropdown2.Item,
|
|
323
|
+
{
|
|
324
|
+
onMouseUp: () => handleZoomMenuItemClick(zoomRef.current + ZOOM_STEP),
|
|
325
|
+
shortcut: {
|
|
326
|
+
keys: "+",
|
|
327
|
+
modifier: "command"
|
|
328
|
+
},
|
|
329
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomIn })
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ jsx(
|
|
333
|
+
Dropdown2.Item,
|
|
334
|
+
{
|
|
335
|
+
onMouseUp: () => handleZoomMenuItemClick(zoomRef.current - ZOOM_STEP),
|
|
336
|
+
shortcut: {
|
|
337
|
+
keys: "-",
|
|
338
|
+
modifier: "command"
|
|
339
|
+
},
|
|
340
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomOut })
|
|
341
|
+
}
|
|
342
|
+
),
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
Dropdown2.Item,
|
|
345
|
+
{
|
|
346
|
+
selected: actualZoomPercent === 50,
|
|
347
|
+
onMouseUp: () => setActualZoomPercent(50),
|
|
348
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomTo50 })
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
/* @__PURE__ */ jsx(
|
|
352
|
+
Dropdown2.Item,
|
|
353
|
+
{
|
|
354
|
+
selected: actualZoomPercent === 100,
|
|
355
|
+
onMouseUp: () => setActualZoomPercent(100),
|
|
356
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomTo100 })
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ jsx(
|
|
360
|
+
Dropdown2.Item,
|
|
361
|
+
{
|
|
362
|
+
selected: actualZoomPercent === 200,
|
|
363
|
+
onMouseUp: () => setActualZoomPercent(200),
|
|
364
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomTo200 })
|
|
365
|
+
}
|
|
366
|
+
),
|
|
367
|
+
/* @__PURE__ */ jsx(Dropdown2.Divider, {}),
|
|
368
|
+
/* @__PURE__ */ jsx(
|
|
369
|
+
Dropdown2.Item,
|
|
370
|
+
{
|
|
371
|
+
onMouseUp: () => {
|
|
372
|
+
fitToView();
|
|
373
|
+
},
|
|
374
|
+
shortcut: {
|
|
375
|
+
keys: "1",
|
|
376
|
+
modifier: "command"
|
|
377
|
+
},
|
|
378
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.fitToScreen })
|
|
379
|
+
}
|
|
380
|
+
)
|
|
228
381
|
] })
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
/* @__PURE__ */ jsx(
|
|
233
|
-
Dropdown2.Item,
|
|
234
|
-
{
|
|
235
|
-
onMouseUp: () => handleZoomMenuItemClick(zoomRef.current + ZOOM_STEP),
|
|
236
|
-
shortcut: {
|
|
237
|
-
keys: "+",
|
|
238
|
-
modifier: "command"
|
|
239
|
-
},
|
|
240
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomIn })
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
/* @__PURE__ */ jsx(
|
|
244
|
-
Dropdown2.Item,
|
|
245
|
-
{
|
|
246
|
-
onMouseUp: () => handleZoomMenuItemClick(zoomRef.current - ZOOM_STEP),
|
|
247
|
-
shortcut: {
|
|
248
|
-
keys: "-",
|
|
249
|
-
modifier: "command"
|
|
250
|
-
},
|
|
251
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomOut })
|
|
252
|
-
}
|
|
253
|
-
),
|
|
254
|
-
/* @__PURE__ */ jsx(
|
|
255
|
-
Dropdown2.Item,
|
|
256
|
-
{
|
|
257
|
-
selected: zoomRef.current === 0.5,
|
|
258
|
-
onMouseUp: () => handleZoomMenuItemClick(0.5),
|
|
259
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomTo50 })
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
/* @__PURE__ */ jsx(
|
|
263
|
-
Dropdown2.Item,
|
|
264
|
-
{
|
|
265
|
-
selected: zoomRef.current === 1,
|
|
266
|
-
onMouseUp: () => handleZoomMenuItemClick(1),
|
|
267
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomTo100 })
|
|
268
|
-
}
|
|
269
|
-
),
|
|
270
|
-
/* @__PURE__ */ jsx(
|
|
271
|
-
Dropdown2.Item,
|
|
272
|
-
{
|
|
273
|
-
selected: zoomRef.current === 2,
|
|
274
|
-
onMouseUp: () => handleZoomMenuItemClick(2),
|
|
275
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.zoomTo200 })
|
|
276
|
-
}
|
|
277
|
-
),
|
|
278
|
-
/* @__PURE__ */ jsx(Dropdown2.Divider, {}),
|
|
279
|
-
/* @__PURE__ */ jsx(
|
|
280
|
-
Dropdown2.Item,
|
|
281
|
-
{
|
|
282
|
-
onMouseUp: () => {
|
|
283
|
-
fitToView();
|
|
284
|
-
},
|
|
285
|
-
shortcut: {
|
|
286
|
-
keys: "1",
|
|
287
|
-
modifier: "command"
|
|
288
|
-
},
|
|
289
|
-
children: /* @__PURE__ */ jsx("span", { className: "flex-1", children: defaultText.fitToScreen })
|
|
290
|
-
}
|
|
291
|
-
)
|
|
292
|
-
] })
|
|
293
|
-
] }),
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
),
|
|
294
385
|
/* @__PURE__ */ jsx(
|
|
295
386
|
IconButton,
|
|
296
387
|
{
|
|
@@ -3,7 +3,9 @@ export declare const PicturePreviewTv: import('tailwind-variants').TVReturnType<
|
|
|
3
3
|
true: {
|
|
4
4
|
image: string;
|
|
5
5
|
};
|
|
6
|
-
false: {
|
|
6
|
+
false: {
|
|
7
|
+
image: string;
|
|
8
|
+
};
|
|
7
9
|
};
|
|
8
10
|
isError: {
|
|
9
11
|
true: {
|
|
@@ -11,6 +13,34 @@ export declare const PicturePreviewTv: import('tailwind-variants').TVReturnType<
|
|
|
11
13
|
};
|
|
12
14
|
false: {};
|
|
13
15
|
};
|
|
16
|
+
isMenuOpen: {
|
|
17
|
+
true: {
|
|
18
|
+
controlGroup: string;
|
|
19
|
+
};
|
|
20
|
+
false: {};
|
|
21
|
+
};
|
|
22
|
+
controlPosition: {
|
|
23
|
+
"top-left": {
|
|
24
|
+
controlGroup: string;
|
|
25
|
+
};
|
|
26
|
+
"top-right": {
|
|
27
|
+
controlGroup: string;
|
|
28
|
+
};
|
|
29
|
+
"bottom-left": {
|
|
30
|
+
controlGroup: string;
|
|
31
|
+
};
|
|
32
|
+
"bottom-right": {
|
|
33
|
+
controlGroup: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
controlShow: {
|
|
37
|
+
always: {
|
|
38
|
+
controlGroup: string;
|
|
39
|
+
};
|
|
40
|
+
hover: {
|
|
41
|
+
controlGroup: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
14
44
|
}, {
|
|
15
45
|
root: string[];
|
|
16
46
|
loading: string[];
|
|
@@ -23,7 +53,9 @@ export declare const PicturePreviewTv: import('tailwind-variants').TVReturnType<
|
|
|
23
53
|
true: {
|
|
24
54
|
image: string;
|
|
25
55
|
};
|
|
26
|
-
false: {
|
|
56
|
+
false: {
|
|
57
|
+
image: string;
|
|
58
|
+
};
|
|
27
59
|
};
|
|
28
60
|
isError: {
|
|
29
61
|
true: {
|
|
@@ -31,6 +63,34 @@ export declare const PicturePreviewTv: import('tailwind-variants').TVReturnType<
|
|
|
31
63
|
};
|
|
32
64
|
false: {};
|
|
33
65
|
};
|
|
66
|
+
isMenuOpen: {
|
|
67
|
+
true: {
|
|
68
|
+
controlGroup: string;
|
|
69
|
+
};
|
|
70
|
+
false: {};
|
|
71
|
+
};
|
|
72
|
+
controlPosition: {
|
|
73
|
+
"top-left": {
|
|
74
|
+
controlGroup: string;
|
|
75
|
+
};
|
|
76
|
+
"top-right": {
|
|
77
|
+
controlGroup: string;
|
|
78
|
+
};
|
|
79
|
+
"bottom-left": {
|
|
80
|
+
controlGroup: string;
|
|
81
|
+
};
|
|
82
|
+
"bottom-right": {
|
|
83
|
+
controlGroup: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
controlShow: {
|
|
87
|
+
always: {
|
|
88
|
+
controlGroup: string;
|
|
89
|
+
};
|
|
90
|
+
hover: {
|
|
91
|
+
controlGroup: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
34
94
|
}, {
|
|
35
95
|
root: string[];
|
|
36
96
|
loading: string[];
|
|
@@ -43,7 +103,9 @@ export declare const PicturePreviewTv: import('tailwind-variants').TVReturnType<
|
|
|
43
103
|
true: {
|
|
44
104
|
image: string;
|
|
45
105
|
};
|
|
46
|
-
false: {
|
|
106
|
+
false: {
|
|
107
|
+
image: string;
|
|
108
|
+
};
|
|
47
109
|
};
|
|
48
110
|
isError: {
|
|
49
111
|
true: {
|
|
@@ -51,6 +113,34 @@ export declare const PicturePreviewTv: import('tailwind-variants').TVReturnType<
|
|
|
51
113
|
};
|
|
52
114
|
false: {};
|
|
53
115
|
};
|
|
116
|
+
isMenuOpen: {
|
|
117
|
+
true: {
|
|
118
|
+
controlGroup: string;
|
|
119
|
+
};
|
|
120
|
+
false: {};
|
|
121
|
+
};
|
|
122
|
+
controlPosition: {
|
|
123
|
+
"top-left": {
|
|
124
|
+
controlGroup: string;
|
|
125
|
+
};
|
|
126
|
+
"top-right": {
|
|
127
|
+
controlGroup: string;
|
|
128
|
+
};
|
|
129
|
+
"bottom-left": {
|
|
130
|
+
controlGroup: string;
|
|
131
|
+
};
|
|
132
|
+
"bottom-right": {
|
|
133
|
+
controlGroup: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
controlShow: {
|
|
137
|
+
always: {
|
|
138
|
+
controlGroup: string;
|
|
139
|
+
};
|
|
140
|
+
hover: {
|
|
141
|
+
controlGroup: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
54
144
|
}, {
|
|
55
145
|
root: string[];
|
|
56
146
|
loading: string[];
|