@ms-cloudpack/overlay 0.11.1 → 0.11.2
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/CHANGELOG.json +16 -1
- package/CHANGELOG.md +10 -2
- package/dist/lib/index.js +66 -57
- package/dist/ori-output.json +2 -2
- package/lib/components/Dialog/Dialog.js +5 -1
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/StatusBadge/StatusBadge.js +24 -17
- package/lib/components/StatusBadge/StatusBadge.js.map +1 -1
- package/lib/hooks/useDraggable.d.ts +13 -1
- package/lib/hooks/useDraggable.js +44 -39
- package/lib/hooks/useDraggable.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
2
2
|
"name": "@ms-cloudpack/overlay",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sun, 04 Dec 2022 08:11:24 GMT",
|
|
6
|
+
"tag": "@ms-cloudpack/overlay_v0.11.2",
|
|
7
|
+
"version": "0.11.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "elcraig@microsoft.com",
|
|
12
|
+
"package": "@ms-cloudpack/overlay",
|
|
13
|
+
"commit": "7672998c2474fc5f82ce6c9055092a41d2675172",
|
|
14
|
+
"comment": "Fix dragging the status badge"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Sat, 03 Dec 2022 08:10:45 GMT",
|
|
6
21
|
"tag": "@ms-cloudpack/overlay_v0.11.1",
|
|
7
22
|
"version": "0.11.1",
|
|
8
23
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @ms-cloudpack/overlay
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sun, 04 Dec 2022 08:11:24 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.11.2
|
|
8
|
+
|
|
9
|
+
Sun, 04 Dec 2022 08:11:24 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Fix dragging the status badge (elcraig@microsoft.com)
|
|
14
|
+
|
|
7
15
|
## 0.11.1
|
|
8
16
|
|
|
9
|
-
Sat, 03 Dec 2022 08:10:
|
|
17
|
+
Sat, 03 Dec 2022 08:10:45 GMT
|
|
10
18
|
|
|
11
19
|
### Patches
|
|
12
20
|
|
package/dist/lib/index.js
CHANGED
|
@@ -187,48 +187,48 @@ import React2, { useRef } from "react";
|
|
|
187
187
|
|
|
188
188
|
// src/hooks/useDraggable.ts
|
|
189
189
|
import { useEffect, useState as useState2 } from "react";
|
|
190
|
-
function useDraggable(
|
|
190
|
+
function useDraggable(options) {
|
|
191
|
+
const { enabled, containerElementRef, dragElementRef } = options;
|
|
191
192
|
const [isDragging, setIsDragging] = useState2(false);
|
|
192
193
|
useEffect(() => {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
let originalX = 0;
|
|
198
|
-
let originalY = 0;
|
|
199
|
-
let offset = { x: 0, y: 0 };
|
|
200
|
-
const onPointerMove = (event) => {
|
|
201
|
-
moveTarget.style.transform = `translate(${offset.x + event.clientX - originalX}px, ${offset.y + event.clientY - originalY}px)`;
|
|
202
|
-
};
|
|
203
|
-
const onPointerUp = (event) => {
|
|
204
|
-
setIsDragging(false);
|
|
205
|
-
offset = {
|
|
206
|
-
x: offset.x + event.clientX - originalX,
|
|
207
|
-
y: offset.y + event.clientY - originalY
|
|
208
|
-
};
|
|
209
|
-
dragTarget.releasePointerCapture(event.pointerId);
|
|
210
|
-
dragTarget.removeEventListener("pointerup", onPointerUp);
|
|
211
|
-
dragTarget.removeEventListener("pointermove", onPointerMove);
|
|
212
|
-
event.preventDefault();
|
|
213
|
-
};
|
|
214
|
-
const onPointerDown = (event) => {
|
|
215
|
-
setIsDragging(true);
|
|
216
|
-
originalX = event.clientX;
|
|
217
|
-
originalY = event.clientY;
|
|
218
|
-
dragTarget.setPointerCapture(event.pointerId);
|
|
219
|
-
dragTarget.addEventListener("pointerup", onPointerUp);
|
|
220
|
-
dragTarget.addEventListener("pointermove", onPointerMove);
|
|
221
|
-
event.preventDefault();
|
|
222
|
-
};
|
|
223
|
-
dragTarget.addEventListener("pointerdown", onPointerDown);
|
|
224
|
-
return () => {
|
|
225
|
-
dragTarget.removeEventListener("pointerdown", onPointerDown);
|
|
226
|
-
dragTarget.removeEventListener("pointermove", onPointerMove);
|
|
227
|
-
dragTarget.removeEventListener("pointerup", onPointerUp);
|
|
228
|
-
};
|
|
229
|
-
}
|
|
194
|
+
const moveTarget = containerElementRef?.current;
|
|
195
|
+
const dragTarget = dragElementRef?.current;
|
|
196
|
+
if (!enabled || !moveTarget || !dragTarget) {
|
|
197
|
+
return;
|
|
230
198
|
}
|
|
231
|
-
|
|
199
|
+
let originalX = 0;
|
|
200
|
+
let originalY = 0;
|
|
201
|
+
let offset = { x: 0, y: 0 };
|
|
202
|
+
const onPointerMove = (event) => {
|
|
203
|
+
moveTarget.style.transform = `translate(${offset.x + event.clientX - originalX}px, ${offset.y + event.clientY - originalY}px)`;
|
|
204
|
+
};
|
|
205
|
+
const onPointerUp = (event) => {
|
|
206
|
+
setIsDragging(false);
|
|
207
|
+
offset = {
|
|
208
|
+
x: offset.x + event.clientX - originalX,
|
|
209
|
+
y: offset.y + event.clientY - originalY
|
|
210
|
+
};
|
|
211
|
+
dragTarget.releasePointerCapture(event.pointerId);
|
|
212
|
+
dragTarget.removeEventListener("pointerup", onPointerUp);
|
|
213
|
+
dragTarget.removeEventListener("pointermove", onPointerMove);
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
};
|
|
216
|
+
const onPointerDown = (event) => {
|
|
217
|
+
setIsDragging(true);
|
|
218
|
+
originalX = event.clientX;
|
|
219
|
+
originalY = event.clientY;
|
|
220
|
+
dragTarget.setPointerCapture(event.pointerId);
|
|
221
|
+
dragTarget.addEventListener("pointerup", onPointerUp);
|
|
222
|
+
dragTarget.addEventListener("pointermove", onPointerMove);
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
};
|
|
225
|
+
dragTarget.addEventListener("pointerdown", onPointerDown);
|
|
226
|
+
return () => {
|
|
227
|
+
dragTarget.removeEventListener("pointerdown", onPointerDown);
|
|
228
|
+
dragTarget.removeEventListener("pointermove", onPointerMove);
|
|
229
|
+
dragTarget.removeEventListener("pointerup", onPointerUp);
|
|
230
|
+
};
|
|
231
|
+
}, [enabled, containerElementRef, dragElementRef]);
|
|
232
232
|
return {
|
|
233
233
|
isDragging
|
|
234
234
|
};
|
|
@@ -394,15 +394,20 @@ function StatusBadge({ inline: inline2, onExpand }) {
|
|
|
394
394
|
const rootElementRef = useRef(null);
|
|
395
395
|
const dragElementRef = useRef(null);
|
|
396
396
|
const status = useStatus();
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
const shouldRender = status.status !== "unknown";
|
|
398
|
+
useDraggable({
|
|
399
|
+
enabled: shouldRender && !inline2,
|
|
400
|
+
containerElementRef: rootElementRef,
|
|
401
|
+
dragElementRef
|
|
402
|
+
});
|
|
403
|
+
if (!shouldRender) {
|
|
399
404
|
return null;
|
|
400
405
|
}
|
|
401
406
|
const badge2 = /* @__PURE__ */ React2.createElement("div", {
|
|
402
|
-
ref:
|
|
407
|
+
ref: rootElementRef,
|
|
403
408
|
className: getStatusClassName(status, !!inline2)
|
|
404
409
|
}, !inline2 && /* @__PURE__ */ React2.createElement("div", {
|
|
405
|
-
ref:
|
|
410
|
+
ref: dragElementRef,
|
|
406
411
|
className: StatusBadge_module_default.gripArea
|
|
407
412
|
}, /* @__PURE__ */ React2.createElement("div", {
|
|
408
413
|
className: StatusBadge_module_default.grip
|
|
@@ -430,26 +435,26 @@ function getStatusString(status) {
|
|
|
430
435
|
}
|
|
431
436
|
return status.totalErrors === 0 ? "Success" : "Errors";
|
|
432
437
|
}
|
|
433
|
-
function getStatusClassName(status, inline2) {
|
|
438
|
+
function getStatusClassName({ status, totalTasks, totalErrors, totalWarnings }, inline2) {
|
|
434
439
|
return cx(StatusBadge_module_default.badge, {
|
|
435
440
|
[StatusBadge_module_default.inline]: inline2,
|
|
436
|
-
[StatusBadge_module_default.building]: status
|
|
437
|
-
[StatusBadge_module_default.success]: status
|
|
438
|
-
[StatusBadge_module_default.error]: status
|
|
439
|
-
[StatusBadge_module_default.warning]: status
|
|
441
|
+
[StatusBadge_module_default.building]: status === "pending",
|
|
442
|
+
[StatusBadge_module_default.success]: status === "idle" && totalTasks > 0 && totalErrors === 0 && totalWarnings === 0,
|
|
443
|
+
[StatusBadge_module_default.error]: status === "idle" && totalErrors > 0,
|
|
444
|
+
[StatusBadge_module_default.warning]: status === "idle" && totalErrors === 0 && totalWarnings > 0
|
|
440
445
|
});
|
|
441
446
|
}
|
|
442
|
-
function getStatsString(
|
|
443
|
-
if (
|
|
447
|
+
function getStatsString({ totalTasks, remainingTasks, totalErrors, totalWarnings }) {
|
|
448
|
+
if (totalTasks === 0) {
|
|
444
449
|
return "";
|
|
445
450
|
}
|
|
446
451
|
return [
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
452
|
+
remainingTasks > 0 && `${remainingTasks} of ${totalTasks} tasks pending`,
|
|
453
|
+
remainingTasks === 0 && `${totalTasks} tasks completed`,
|
|
454
|
+
totalErrors === 1 && `${totalErrors} error`,
|
|
455
|
+
totalErrors > 1 && `${totalErrors} errors`,
|
|
456
|
+
totalWarnings === 1 && `${totalWarnings} warning`,
|
|
457
|
+
totalWarnings > 1 && `${totalWarnings} warnings`
|
|
453
458
|
].filter(Boolean).join(", ");
|
|
454
459
|
}
|
|
455
460
|
|
|
@@ -1115,7 +1120,11 @@ function Dialog({ title: title3, style, draggable, onClose, commands: commands3,
|
|
|
1115
1120
|
const draggableTargetRef = useRef2(null);
|
|
1116
1121
|
const colorAccent = style === "error" ? "rgb(164, 38, 44)" : void 0;
|
|
1117
1122
|
const cursorDraggable = draggable ? "move" : void 0;
|
|
1118
|
-
useDraggable(
|
|
1123
|
+
useDraggable({
|
|
1124
|
+
enabled: !!draggable,
|
|
1125
|
+
containerElementRef: draggableRef,
|
|
1126
|
+
dragElementRef: draggableTargetRef
|
|
1127
|
+
});
|
|
1119
1128
|
return /* @__PURE__ */ React7.createElement("div", {
|
|
1120
1129
|
className: Dialog_module_default.overlay
|
|
1121
1130
|
}, /* @__PURE__ */ React7.createElement("div", {
|
package/dist/ori-output.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "buildStatus",
|
|
3
|
-
"buildId": "
|
|
3
|
+
"buildId": "2e17f0c7-5f64-4c0a-b47e-57d7fa2affe7",
|
|
4
4
|
"buildStatus": "complete",
|
|
5
5
|
"internalError": null,
|
|
6
6
|
"warnings": [],
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"outputFilePaths": [
|
|
9
9
|
"/home/runner/work/cloudpack/cloudpack/packages/overlay/dist/lib/index.js"
|
|
10
10
|
],
|
|
11
|
-
"metafile": "{\n \"inputs\": {\n \"src/components/CloudpackProvider/getCookies.ts\": {\n \"bytes\": 452,\n \"imports\": []\n },\n \"src/components/CloudpackProvider/createCloudpackClient.ts\": {\n \"bytes\": 6293,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/getCookies.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/CloudpackProvider/CloudpackProvider.tsx\": {\n \"bytes\": 552,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/createCloudpackClient.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/hooks/useDraggable.ts\": {\n \"bytes\": 2050,\n \"imports\": []\n },\n \"src/components/StatusBadge/StatusBadge.module.css\": {\n \"bytes\": 3473,\n \"imports\": []\n },\n \"src/components/CloudpackProvider/useStatus.ts\": {\n \"bytes\": 866,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusBadge/StatusBadge.tsx\": {\n \"bytes\": 2733,\n \"imports\": [\n {\n \"path\": \"src/hooks/useDraggable.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusBadge/StatusBadge.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/useStatus.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskResultItem.module.css\": {\n \"bytes\": 2067,\n \"imports\": []\n },\n \"src/components/StatusDialog/TaskResultItem.tsx\": {\n \"bytes\": 1433,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskResultItem.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskStatus.module.css\": {\n \"bytes\": 4179,\n \"imports\": []\n },\n \"src/images/error-24.inline.svg\": {\n \"bytes\": 1024,\n \"imports\": []\n },\n \"src/images/success-24.inline.svg\": {\n \"bytes\": 562,\n \"imports\": []\n },\n \"src/images/chevrondown-20.inline.svg\": {\n \"bytes\": 450,\n \"imports\": []\n },\n \"src/components/Button/Button.module.css\": {\n \"bytes\": 2263,\n \"imports\": []\n },\n \"src/components/Button/Button.tsx\": {\n \"bytes\": 360,\n \"imports\": [\n {\n \"path\": \"src/components/Button/Button.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskStatus.tsx\": {\n \"bytes\": 4795,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskResultItem.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskStatus.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/error-24.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/success-24.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/chevrondown-20.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/CloudpackProvider/useStatusDetails.ts\": {\n \"bytes\": 858,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskList.module.css\": {\n \"bytes\": 615,\n \"imports\": []\n },\n \"src/components/StatusDialog/TaskList.tsx\": {\n \"bytes\": 1204,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskStatus.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/useStatusDetails.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskList.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/Dialog/Dialog.module.css\": {\n \"bytes\": 2454,\n \"imports\": []\n },\n \"src/images/dismiss-16-filled.inline.svg\": {\n \"bytes\": 718,\n \"imports\": []\n },\n \"src/components/Dialog/Dialog.tsx\": {\n \"bytes\": 1648,\n \"imports\": [\n {\n \"path\": \"src/components/Dialog/Dialog.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/hooks/useDraggable.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/dismiss-16-filled.inline.svg\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/Searchbox.module.css\": {\n \"bytes\": 862,\n \"imports\": []\n },\n \"src/components/StatusDialog/Searchbox.tsx\": {\n \"bytes\": 452,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/Searchbox.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/StatusDialog.tsx\": {\n \"bytes\": 1134,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskList.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Dialog/Dialog.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/Searchbox.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ErrorDialog/PathError.tsx\": {\n \"bytes\": 2731,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskStatus.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/error-24.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/chevrondown-20.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ErrorDialog/ErrorDialog.tsx\": {\n \"bytes\": 1021,\n \"imports\": [\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ErrorDialog/PathError.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskList.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Dialog/Dialog.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ErrorDialog/useErrorEvents.ts\": {\n \"bytes\": 3264,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusOverlay/StatusOverlay.tsx\": {\n \"bytes\": 1426,\n \"imports\": [\n {\n \"path\": \"src/components/StatusBadge/StatusBadge.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/StatusDialog.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/useStatus.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ErrorDialog/ErrorDialog.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ErrorDialog/useErrorEvents.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ThemeProvider/ThemeProvider.module.css\": {\n \"bytes\": 630,\n \"imports\": []\n },\n \"src/components/ThemeProvider/ThemeProvider.tsx\": {\n \"bytes\": 210,\n \"imports\": [\n {\n \"path\": \"src/components/ThemeProvider/ThemeProvider.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/index.tsx\": {\n \"bytes\": 532,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusOverlay/StatusOverlay.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ThemeProvider/ThemeProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n }\n },\n \"outputs\": {\n \"dist/lib/index.js\": {\n \"imports\": [],\n \"exports\": [],\n \"entryPoint\": \"src/index.tsx\",\n \"inputs\": {\n \"src/index.tsx\": {\n \"bytesInOutput\": 360\n },\n \"src/components/CloudpackProvider/CloudpackProvider.tsx\": {\n \"bytesInOutput\": 372\n },\n \"src/components/CloudpackProvider/getCookies.ts\": {\n \"bytesInOutput\": 317\n },\n \"src/components/CloudpackProvider/createCloudpackClient.ts\": {\n \"bytesInOutput\": 4112\n },\n \"src/components/StatusOverlay/StatusOverlay.tsx\": {\n \"bytesInOutput\": 1041\n },\n \"src/components/StatusBadge/StatusBadge.tsx\": {\n \"bytesInOutput\": 2863\n },\n \"src/hooks/useDraggable.ts\": {\n \"bytesInOutput\": 1937\n },\n \"src/components/StatusBadge/StatusBadge.module.css\": {\n \"bytesInOutput\": 3183\n },\n \"src/components/CloudpackProvider/useStatus.ts\": {\n \"bytesInOutput\": 448\n },\n \"src/components/StatusDialog/StatusDialog.tsx\": {\n \"bytesInOutput\": 876\n },\n \"src/components/StatusDialog/TaskList.tsx\": {\n \"bytesInOutput\": 898\n },\n \"src/components/StatusDialog/TaskStatus.tsx\": {\n \"bytesInOutput\": 5172\n },\n \"src/components/StatusDialog/TaskResultItem.tsx\": {\n \"bytesInOutput\": 1421\n },\n \"src/components/StatusDialog/TaskResultItem.module.css\": {\n \"bytesInOutput\": 1881\n },\n \"src/components/StatusDialog/TaskStatus.module.css\": {\n \"bytesInOutput\": 3889\n },\n \"src/images/error-24.inline.svg\": {\n \"bytesInOutput\": 1428\n },\n \"src/images/success-24.inline.svg\": {\n \"bytesInOutput\": 814\n },\n \"src/images/chevrondown-20.inline.svg\": {\n \"bytesInOutput\": 666\n },\n \"src/components/Button/Button.tsx\": {\n \"bytesInOutput\": 312\n },\n \"src/components/Button/Button.module.css\": {\n \"bytesInOutput\": 2117\n },\n \"src/components/CloudpackProvider/useStatusDetails.ts\": {\n \"bytesInOutput\": 299\n },\n \"src/components/StatusDialog/TaskList.module.css\": {\n \"bytesInOutput\": 541\n },\n \"src/components/Dialog/Dialog.tsx\": {\n \"bytesInOutput\": 1436\n },\n \"src/components/Dialog/Dialog.module.css\": {\n \"bytesInOutput\": 2292\n },\n \"src/images/dismiss-16-filled.inline.svg\": {\n \"bytesInOutput\": 1029\n },\n \"src/components/StatusDialog/Searchbox.tsx\": {\n \"bytesInOutput\": 362\n },\n \"src/components/StatusDialog/Searchbox.module.css\": {\n \"bytesInOutput\": 771\n },\n \"src/components/ErrorDialog/ErrorDialog.tsx\": {\n \"bytesInOutput\": 709\n },\n \"src/components/ErrorDialog/PathError.tsx\": {\n \"bytesInOutput\": 3043\n },\n \"src/components/ErrorDialog/useErrorEvents.ts\": {\n \"bytesInOutput\": 2092\n },\n \"src/components/ThemeProvider/ThemeProvider.tsx\": {\n \"bytesInOutput\": 191\n },\n \"src/components/ThemeProvider/ThemeProvider.module.css\": {\n \"bytesInOutput\": 561\n }\n },\n \"bytes\": 49614\n }\n }\n}\n"
|
|
11
|
+
"metafile": "{\n \"inputs\": {\n \"src/components/CloudpackProvider/getCookies.ts\": {\n \"bytes\": 452,\n \"imports\": []\n },\n \"src/components/CloudpackProvider/createCloudpackClient.ts\": {\n \"bytes\": 6293,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/getCookies.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/CloudpackProvider/CloudpackProvider.tsx\": {\n \"bytes\": 552,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/createCloudpackClient.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/hooks/useDraggable.ts\": {\n \"bytes\": 2353,\n \"imports\": []\n },\n \"src/components/StatusBadge/StatusBadge.module.css\": {\n \"bytes\": 3473,\n \"imports\": []\n },\n \"src/components/CloudpackProvider/useStatus.ts\": {\n \"bytes\": 866,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusBadge/StatusBadge.tsx\": {\n \"bytes\": 2875,\n \"imports\": [\n {\n \"path\": \"src/hooks/useDraggable.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusBadge/StatusBadge.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/useStatus.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskResultItem.module.css\": {\n \"bytes\": 2067,\n \"imports\": []\n },\n \"src/components/StatusDialog/TaskResultItem.tsx\": {\n \"bytes\": 1433,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskResultItem.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskStatus.module.css\": {\n \"bytes\": 4179,\n \"imports\": []\n },\n \"src/images/error-24.inline.svg\": {\n \"bytes\": 1024,\n \"imports\": []\n },\n \"src/images/success-24.inline.svg\": {\n \"bytes\": 562,\n \"imports\": []\n },\n \"src/images/chevrondown-20.inline.svg\": {\n \"bytes\": 450,\n \"imports\": []\n },\n \"src/components/Button/Button.module.css\": {\n \"bytes\": 2263,\n \"imports\": []\n },\n \"src/components/Button/Button.tsx\": {\n \"bytes\": 360,\n \"imports\": [\n {\n \"path\": \"src/components/Button/Button.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskStatus.tsx\": {\n \"bytes\": 4795,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskResultItem.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskStatus.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/error-24.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/success-24.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/chevrondown-20.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/CloudpackProvider/useStatusDetails.ts\": {\n \"bytes\": 858,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/TaskList.module.css\": {\n \"bytes\": 615,\n \"imports\": []\n },\n \"src/components/StatusDialog/TaskList.tsx\": {\n \"bytes\": 1204,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskStatus.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/useStatusDetails.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskList.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/Dialog/Dialog.module.css\": {\n \"bytes\": 2454,\n \"imports\": []\n },\n \"src/images/dismiss-16-filled.inline.svg\": {\n \"bytes\": 718,\n \"imports\": []\n },\n \"src/components/Dialog/Dialog.tsx\": {\n \"bytes\": 1710,\n \"imports\": [\n {\n \"path\": \"src/components/Dialog/Dialog.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/hooks/useDraggable.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/dismiss-16-filled.inline.svg\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/Searchbox.module.css\": {\n \"bytes\": 862,\n \"imports\": []\n },\n \"src/components/StatusDialog/Searchbox.tsx\": {\n \"bytes\": 452,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/Searchbox.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusDialog/StatusDialog.tsx\": {\n \"bytes\": 1134,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskList.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Dialog/Dialog.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/Searchbox.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ErrorDialog/PathError.tsx\": {\n \"bytes\": 2731,\n \"imports\": [\n {\n \"path\": \"src/components/StatusDialog/TaskStatus.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/error-24.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/images/chevrondown-20.inline.svg\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ErrorDialog/ErrorDialog.tsx\": {\n \"bytes\": 1021,\n \"imports\": [\n {\n \"path\": \"src/components/Button/Button.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ErrorDialog/PathError.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/TaskList.module.css\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/Dialog/Dialog.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ErrorDialog/useErrorEvents.ts\": {\n \"bytes\": 3264,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/StatusOverlay/StatusOverlay.tsx\": {\n \"bytes\": 1426,\n \"imports\": [\n {\n \"path\": \"src/components/StatusBadge/StatusBadge.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusDialog/StatusDialog.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/CloudpackProvider/useStatus.ts\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ErrorDialog/ErrorDialog.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ErrorDialog/useErrorEvents.ts\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/components/ThemeProvider/ThemeProvider.module.css\": {\n \"bytes\": 630,\n \"imports\": []\n },\n \"src/components/ThemeProvider/ThemeProvider.tsx\": {\n \"bytes\": 210,\n \"imports\": [\n {\n \"path\": \"src/components/ThemeProvider/ThemeProvider.module.css\",\n \"kind\": \"import-statement\"\n }\n ]\n },\n \"src/index.tsx\": {\n \"bytes\": 532,\n \"imports\": [\n {\n \"path\": \"src/components/CloudpackProvider/CloudpackProvider.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/StatusOverlay/StatusOverlay.tsx\",\n \"kind\": \"import-statement\"\n },\n {\n \"path\": \"src/components/ThemeProvider/ThemeProvider.tsx\",\n \"kind\": \"import-statement\"\n }\n ]\n }\n },\n \"outputs\": {\n \"dist/lib/index.js\": {\n \"imports\": [],\n \"exports\": [],\n \"entryPoint\": \"src/index.tsx\",\n \"inputs\": {\n \"src/index.tsx\": {\n \"bytesInOutput\": 360\n },\n \"src/components/CloudpackProvider/CloudpackProvider.tsx\": {\n \"bytesInOutput\": 372\n },\n \"src/components/CloudpackProvider/getCookies.ts\": {\n \"bytesInOutput\": 317\n },\n \"src/components/CloudpackProvider/createCloudpackClient.ts\": {\n \"bytesInOutput\": 4112\n },\n \"src/components/StatusOverlay/StatusOverlay.tsx\": {\n \"bytesInOutput\": 1041\n },\n \"src/components/StatusBadge/StatusBadge.tsx\": {\n \"bytesInOutput\": 2865\n },\n \"src/hooks/useDraggable.ts\": {\n \"bytesInOutput\": 1803\n },\n \"src/components/StatusBadge/StatusBadge.module.css\": {\n \"bytesInOutput\": 3183\n },\n \"src/components/CloudpackProvider/useStatus.ts\": {\n \"bytesInOutput\": 448\n },\n \"src/components/StatusDialog/StatusDialog.tsx\": {\n \"bytesInOutput\": 876\n },\n \"src/components/StatusDialog/TaskList.tsx\": {\n \"bytesInOutput\": 898\n },\n \"src/components/StatusDialog/TaskStatus.tsx\": {\n \"bytesInOutput\": 5172\n },\n \"src/components/StatusDialog/TaskResultItem.tsx\": {\n \"bytesInOutput\": 1421\n },\n \"src/components/StatusDialog/TaskResultItem.module.css\": {\n \"bytesInOutput\": 1881\n },\n \"src/components/StatusDialog/TaskStatus.module.css\": {\n \"bytesInOutput\": 3889\n },\n \"src/images/error-24.inline.svg\": {\n \"bytesInOutput\": 1428\n },\n \"src/images/success-24.inline.svg\": {\n \"bytesInOutput\": 814\n },\n \"src/images/chevrondown-20.inline.svg\": {\n \"bytesInOutput\": 666\n },\n \"src/components/Button/Button.tsx\": {\n \"bytesInOutput\": 312\n },\n \"src/components/Button/Button.module.css\": {\n \"bytesInOutput\": 2117\n },\n \"src/components/CloudpackProvider/useStatusDetails.ts\": {\n \"bytesInOutput\": 299\n },\n \"src/components/StatusDialog/TaskList.module.css\": {\n \"bytesInOutput\": 541\n },\n \"src/components/Dialog/Dialog.tsx\": {\n \"bytesInOutput\": 1471\n },\n \"src/components/Dialog/Dialog.module.css\": {\n \"bytesInOutput\": 2292\n },\n \"src/images/dismiss-16-filled.inline.svg\": {\n \"bytesInOutput\": 1029\n },\n \"src/components/StatusDialog/Searchbox.tsx\": {\n \"bytesInOutput\": 362\n },\n \"src/components/StatusDialog/Searchbox.module.css\": {\n \"bytesInOutput\": 771\n },\n \"src/components/ErrorDialog/ErrorDialog.tsx\": {\n \"bytesInOutput\": 709\n },\n \"src/components/ErrorDialog/PathError.tsx\": {\n \"bytesInOutput\": 3043\n },\n \"src/components/ErrorDialog/useErrorEvents.ts\": {\n \"bytesInOutput\": 2092\n },\n \"src/components/ThemeProvider/ThemeProvider.tsx\": {\n \"bytesInOutput\": 191\n },\n \"src/components/ThemeProvider/ThemeProvider.module.css\": {\n \"bytesInOutput\": 561\n }\n },\n \"bytes\": 49517\n }\n }\n}\n"
|
|
12
12
|
}
|
|
@@ -7,7 +7,11 @@ export function Dialog({ title, style, draggable, onClose, commands, children })
|
|
|
7
7
|
const draggableTargetRef = useRef(null);
|
|
8
8
|
const colorAccent = style === 'error' ? 'rgb(164, 38, 44)' : undefined;
|
|
9
9
|
const cursorDraggable = draggable ? 'move' : undefined;
|
|
10
|
-
useDraggable(
|
|
10
|
+
useDraggable({
|
|
11
|
+
enabled: !!draggable,
|
|
12
|
+
containerElementRef: draggableRef,
|
|
13
|
+
dragElementRef: draggableTargetRef,
|
|
14
|
+
});
|
|
11
15
|
return (React.createElement("div", { className: styles.overlay },
|
|
12
16
|
React.createElement("div", { ref: draggableRef, className: styles.dialog, style: { borderTopColor: colorAccent } },
|
|
13
17
|
React.createElement("div", { className: styles.titleArea },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,SAAS,MAAM,2CAA2C,CAAC;AAWlE,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAe;IAC1F,MAAM,YAAY,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAA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,CAAO;YAChE,QAAQ,CACL,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -7,12 +7,19 @@ export function StatusBadge({ inline, onExpand }) {
|
|
|
7
7
|
const rootElementRef = useRef(null);
|
|
8
8
|
const dragElementRef = useRef(null);
|
|
9
9
|
const status = useStatus();
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const shouldRender = status.status !== 'unknown';
|
|
11
|
+
useDraggable({
|
|
12
|
+
// If we're not yet able to render, don't enable dragging yet.
|
|
13
|
+
// Otherwise the event handlers won't be attached when the component renders.
|
|
14
|
+
enabled: shouldRender && !inline,
|
|
15
|
+
containerElementRef: rootElementRef,
|
|
16
|
+
dragElementRef,
|
|
17
|
+
});
|
|
18
|
+
if (!shouldRender) {
|
|
12
19
|
return null;
|
|
13
20
|
}
|
|
14
|
-
const badge = (React.createElement("div", { ref:
|
|
15
|
-
!inline && (React.createElement("div", { ref:
|
|
21
|
+
const badge = (React.createElement("div", { ref: rootElementRef, className: getStatusClassName(status, !!inline) },
|
|
22
|
+
!inline && (React.createElement("div", { ref: dragElementRef, className: styles.gripArea },
|
|
16
23
|
React.createElement("div", { className: styles.grip }),
|
|
17
24
|
React.createElement("div", { className: styles.grip }))),
|
|
18
25
|
React.createElement("button", { className: styles.button, onClick: onExpand, "aria-label": "Expand overlay" },
|
|
@@ -30,26 +37,26 @@ function getStatusString(status) {
|
|
|
30
37
|
}
|
|
31
38
|
return status.totalErrors === 0 ? 'Success' : 'Errors';
|
|
32
39
|
}
|
|
33
|
-
function getStatusClassName(status, inline) {
|
|
40
|
+
function getStatusClassName({ status, totalTasks, totalErrors, totalWarnings }, inline) {
|
|
34
41
|
return cx(styles.badge, {
|
|
35
42
|
[styles.inline]: inline,
|
|
36
|
-
[styles.building]: status
|
|
37
|
-
[styles.success]: status
|
|
38
|
-
[styles.error]: status
|
|
39
|
-
[styles.warning]: status
|
|
43
|
+
[styles.building]: status === 'pending',
|
|
44
|
+
[styles.success]: status === 'idle' && totalTasks > 0 && totalErrors === 0 && totalWarnings === 0,
|
|
45
|
+
[styles.error]: status === 'idle' && totalErrors > 0,
|
|
46
|
+
[styles.warning]: status === 'idle' && totalErrors === 0 && totalWarnings > 0,
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
|
-
function getStatsString(
|
|
43
|
-
if (
|
|
49
|
+
function getStatsString({ totalTasks, remainingTasks, totalErrors, totalWarnings }) {
|
|
50
|
+
if (totalTasks === 0) {
|
|
44
51
|
return '';
|
|
45
52
|
}
|
|
46
53
|
return [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
remainingTasks > 0 && `${remainingTasks} of ${totalTasks} tasks pending`,
|
|
55
|
+
remainingTasks === 0 && `${totalTasks} tasks completed`,
|
|
56
|
+
totalErrors === 1 && `${totalErrors} error`,
|
|
57
|
+
totalErrors > 1 && `${totalErrors} errors`,
|
|
58
|
+
totalWarnings === 1 && `${totalWarnings} warning`,
|
|
59
|
+
totalWarnings > 1 && `${totalWarnings} warnings`,
|
|
53
60
|
]
|
|
54
61
|
.filter(Boolean)
|
|
55
62
|
.join(', ');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","sourceRoot":"","sources":["../../../src/components/StatusBadge/StatusBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,MAAM,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAwB,MAAM,mCAAmC,CAAC;AAOpF,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAoB;IAChE,MAAM,cAAc,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACpD,MAA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AAG,CAAC;QACpD,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,IAAI,WAAW,KAAK,CAAC,IAAI,aAAa,GAAG,CAAC;KAC9E,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAmB;IACjG,IAAI,UAAU,KAAK,CAAC,EAAE;QACpB,OAAO,EAAE,CAAC;KACX;IAED,OAAO;QACL,cAAc,GAAG,CAAC,IAAI,GAAG,cAAc,OAAO,UAAU,gBAAgB;QACxE,cAAc,KAAK,CAAC,IAAI,GAAG,UAAU,kBAAkB;QACvD,WAAW,KAAK,CAAC,IAAI,GAAG,WAAW,QAAQ;QAC3C,WAAW,GAAG,CAAC,IAAI,GAAG,WAAW,SAAS;QAC1C,aAAa,KAAK,CAAC,IAAI,GAAG,aAAa,UAAU;QACjD,aAAa,GAAG,CAAC,IAAI,GAAG,aAAa,WAAW;KACjD;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Make an element draggable. Note that changing `enabled` or passing different ref objects
|
|
4
|
+
* will trigger reconfiguring the event handlers, but changing `.current` will not.
|
|
5
|
+
* @returns Whether the element is currently being dragged
|
|
6
|
+
*/
|
|
7
|
+
export declare function useDraggable(options: {
|
|
8
|
+
/** Whether to enable dragging */
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** Element that should be draggable */
|
|
11
|
+
containerElementRef: RefObject<HTMLElement>;
|
|
12
|
+
/** The drag handle element */
|
|
13
|
+
dragElementRef: RefObject<HTMLElement>;
|
|
14
|
+
}): {
|
|
3
15
|
isDragging: boolean;
|
|
4
16
|
};
|
|
@@ -1,46 +1,51 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Make an element draggable. Note that changing `enabled` or passing different ref objects
|
|
4
|
+
* will trigger reconfiguring the event handlers, but changing `.current` will not.
|
|
5
|
+
* @returns Whether the element is currently being dragged
|
|
6
|
+
*/
|
|
7
|
+
export function useDraggable(options) {
|
|
8
|
+
const { enabled, containerElementRef, dragElementRef } = options;
|
|
3
9
|
const [isDragging, setIsDragging] = useState(false);
|
|
4
10
|
useEffect(() => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let originalX = 0;
|
|
10
|
-
let originalY = 0;
|
|
11
|
-
let offset = { x: 0, y: 0 };
|
|
12
|
-
const onPointerMove = (event) => {
|
|
13
|
-
moveTarget.style.transform = `translate(${offset.x + event.clientX - originalX}px, ${offset.y + event.clientY - originalY}px)`;
|
|
14
|
-
};
|
|
15
|
-
const onPointerUp = (event) => {
|
|
16
|
-
setIsDragging(false);
|
|
17
|
-
offset = {
|
|
18
|
-
x: offset.x + event.clientX - originalX,
|
|
19
|
-
y: offset.y + event.clientY - originalY,
|
|
20
|
-
};
|
|
21
|
-
dragTarget.releasePointerCapture(event.pointerId);
|
|
22
|
-
dragTarget.removeEventListener('pointerup', onPointerUp);
|
|
23
|
-
dragTarget.removeEventListener('pointermove', onPointerMove);
|
|
24
|
-
event.preventDefault();
|
|
25
|
-
};
|
|
26
|
-
const onPointerDown = (event) => {
|
|
27
|
-
setIsDragging(true);
|
|
28
|
-
originalX = event.clientX;
|
|
29
|
-
originalY = event.clientY;
|
|
30
|
-
dragTarget.setPointerCapture(event.pointerId);
|
|
31
|
-
dragTarget.addEventListener('pointerup', onPointerUp);
|
|
32
|
-
dragTarget.addEventListener('pointermove', onPointerMove);
|
|
33
|
-
event.preventDefault();
|
|
34
|
-
};
|
|
35
|
-
dragTarget.addEventListener('pointerdown', onPointerDown);
|
|
36
|
-
return () => {
|
|
37
|
-
dragTarget.removeEventListener('pointerdown', onPointerDown);
|
|
38
|
-
dragTarget.removeEventListener('pointermove', onPointerMove);
|
|
39
|
-
dragTarget.removeEventListener('pointerup', onPointerUp);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
11
|
+
const moveTarget = containerElementRef?.current;
|
|
12
|
+
const dragTarget = dragElementRef?.current;
|
|
13
|
+
if (!enabled || !moveTarget || !dragTarget) {
|
|
14
|
+
return;
|
|
42
15
|
}
|
|
43
|
-
|
|
16
|
+
let originalX = 0;
|
|
17
|
+
let originalY = 0;
|
|
18
|
+
let offset = { x: 0, y: 0 };
|
|
19
|
+
const onPointerMove = (event) => {
|
|
20
|
+
moveTarget.style.transform = `translate(${offset.x + event.clientX - originalX}px, ${offset.y + event.clientY - originalY}px)`;
|
|
21
|
+
};
|
|
22
|
+
const onPointerUp = (event) => {
|
|
23
|
+
setIsDragging(false);
|
|
24
|
+
offset = {
|
|
25
|
+
x: offset.x + event.clientX - originalX,
|
|
26
|
+
y: offset.y + event.clientY - originalY,
|
|
27
|
+
};
|
|
28
|
+
dragTarget.releasePointerCapture(event.pointerId);
|
|
29
|
+
dragTarget.removeEventListener('pointerup', onPointerUp);
|
|
30
|
+
dragTarget.removeEventListener('pointermove', onPointerMove);
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
};
|
|
33
|
+
const onPointerDown = (event) => {
|
|
34
|
+
setIsDragging(true);
|
|
35
|
+
originalX = event.clientX;
|
|
36
|
+
originalY = event.clientY;
|
|
37
|
+
dragTarget.setPointerCapture(event.pointerId);
|
|
38
|
+
dragTarget.addEventListener('pointerup', onPointerUp);
|
|
39
|
+
dragTarget.addEventListener('pointermove', onPointerMove);
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
};
|
|
42
|
+
dragTarget.addEventListener('pointerdown', onPointerDown);
|
|
43
|
+
return () => {
|
|
44
|
+
dragTarget.removeEventListener('pointerdown', onPointerDown);
|
|
45
|
+
dragTarget.removeEventListener('pointermove', onPointerMove);
|
|
46
|
+
dragTarget.removeEventListener('pointerup', onPointerUp);
|
|
47
|
+
};
|
|
48
|
+
}, [enabled, containerElementRef, dragElementRef]);
|
|
44
49
|
return {
|
|
45
50
|
isDragging,
|
|
46
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDraggable.js","sourceRoot":"","sources":["../../src/hooks/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,UAAU,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"useDraggable.js","sourceRoot":"","sources":["../../src/hooks/useDraggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAO5B;IACC,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAEjE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEpD,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,mBAAmB,EAAE,OAAO,CAAC;QAChD,MAAM,UAAU,GAAG,cAAc,EAAE,OAAO,CAAC;QAE3C,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE;YAC1C,OAAO;SACR;QAED,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,IAAI,MAAM,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAE5B,MAAM,aAAa,GAAG,CAAC,KAAmB,EAAE,EAAE;YAC5C,UAAU,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,SAAS,OAC5E,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,OA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