react-dialogger 1.1.140 → 1.1.142
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/components/DialogContent.js +11 -3
- package/helpers/Resizeable.js +7 -1
- package/models/baseDialogOptions.js +1 -1
- package/package.json +3 -2
- package/styles/dialog.css +112 -0
|
@@ -64,7 +64,6 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
64
64
|
var react_draggable_1 = __importDefault(require("react-draggable"));
|
|
65
65
|
var _helpers_1 = require("../helpers/index.js");
|
|
66
66
|
var React = __importStar(require("react"));
|
|
67
|
-
var _icons_1 = require("../icons/index.js");
|
|
68
67
|
var notistack_1 = require("notistack");
|
|
69
68
|
var _1 = require("./");
|
|
70
69
|
var react_1 = require("react");
|
|
@@ -73,6 +72,7 @@ var _context_1 = require("../context/index.js");
|
|
|
73
72
|
var appLogger_1 = require("../helpers/appLogger");
|
|
74
73
|
var PlusIcon_1 = __importDefault(require("../icons/PlusIcon"));
|
|
75
74
|
var MinusIcon_1 = __importDefault(require("../icons/MinusIcon"));
|
|
75
|
+
var go_1 = require("react-icons/go");
|
|
76
76
|
var DialogContent = function (props) {
|
|
77
77
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
78
78
|
var firstUpdate = React.useRef(true);
|
|
@@ -81,9 +81,10 @@ var DialogContent = function (props) {
|
|
|
81
81
|
var baseOptions = dialogOptions.base;
|
|
82
82
|
var _l = React.useState(false), fullscreenMode = _l[0], setFullscreenMode = _l[1];
|
|
83
83
|
var _m = React.useState(null), rect = _m[0], setRect = _m[1];
|
|
84
|
+
var _o = React.useState(!!(baseOptions === null || baseOptions === void 0 ? void 0 : baseOptions.resizeable)), showResizeHint = _o[0], setShowResizeHint = _o[1];
|
|
84
85
|
var bounds = ((_a = dialog.dialogOptions.base) === null || _a === void 0 ? void 0 : _a.memoBounds) ? (0, _helpers_1.getDialogBounds)(dialog.dialogOptions.base.id) : null;
|
|
85
86
|
var domZIndex = window.getComputedStyle(dialog.getDom()).zIndex;
|
|
86
|
-
var
|
|
87
|
+
var _p = React.useState(((_b = bounds === null || bounds === void 0 ? void 0 : bounds.scale) !== null && _b !== void 0 ? _b : ((_c = dialogOptions === null || dialogOptions === void 0 ? void 0 : dialogOptions.scale) !== null && _c !== void 0 ? _c : 1))), zoom = _p[0], setZoom = _p[1];
|
|
87
88
|
var positionSelector = function () {
|
|
88
89
|
var _a;
|
|
89
90
|
var _b;
|
|
@@ -123,6 +124,13 @@ var DialogContent = function (props) {
|
|
|
123
124
|
(0, jumper_animate_1.jumperAnimate)(dialogRef.current);
|
|
124
125
|
}
|
|
125
126
|
}, []);
|
|
127
|
+
// Resize hint — auto-hide after animation completes (3.2s lifecycle)
|
|
128
|
+
(0, react_1.useEffect)(function () {
|
|
129
|
+
if (!showResizeHint)
|
|
130
|
+
return;
|
|
131
|
+
var t = setTimeout(function () { return setShowResizeHint(false); }, 3200);
|
|
132
|
+
return function () { return clearTimeout(t); };
|
|
133
|
+
}, []);
|
|
126
134
|
// Set Rect
|
|
127
135
|
(0, react_1.useEffect)(function () {
|
|
128
136
|
setRect(positionSelector());
|
|
@@ -220,6 +228,6 @@ var DialogContent = function (props) {
|
|
|
220
228
|
setTimeout(function () {
|
|
221
229
|
event.clientX;
|
|
222
230
|
});
|
|
223
|
-
}, children: (0, jsx_runtime_1.jsx)(MinusIcon_1.default, { size: 22 }) })] }), (0, jsx_runtime_1.jsxs)("span", { className: 'dialog-zoom-label', children: [(Math.round(zoom * 100)), "%"] })] }), (dialog.props.header || dialogOptions.slot.header) && ((0, jsx_runtime_1.jsx)(_1.DialogContentHeader, { ref: headerRef, header: dialog.props.header, bounds: bounds })), (0, jsx_runtime_1.jsx)(_1.DialogContentBody, { ref: bodyRef, body: body }), (0, jsx_runtime_1.jsx)(_1.DialogContentFooter, { ref: footerRef }), (baseOptions.resizeable) && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-n", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('n') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-s", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('s') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-e", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('e') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-w", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('w') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-nw", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('nw') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-ne", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('ne') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-sw", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('sw') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-se", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('se')
|
|
231
|
+
}, children: (0, jsx_runtime_1.jsx)(MinusIcon_1.default, { size: 22 }) })] }), (0, jsx_runtime_1.jsxs)("span", { className: 'dialog-zoom-label', children: [(Math.round(zoom * 100)), "%"] })] }), (dialog.props.header || dialogOptions.slot.header) && ((0, jsx_runtime_1.jsx)(_1.DialogContentHeader, { ref: headerRef, header: dialog.props.header, bounds: bounds })), (0, jsx_runtime_1.jsx)(_1.DialogContentBody, { ref: bodyRef, body: body }), (0, jsx_runtime_1.jsx)(_1.DialogContentFooter, { ref: footerRef }), (baseOptions.resizeable && showResizeHint) && ((0, jsx_runtime_1.jsxs)("div", { className: "resize-hint-overlay", "aria-hidden": "true", children: [(0, jsx_runtime_1.jsx)("div", { className: "rh rh-n", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowUp, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-ne", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowUpRight, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-e", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowRight, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-se", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowDownRight, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-s", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowDown, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-sw", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowDownLeft, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-w", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowLeft, { size: 16 }) }), (0, jsx_runtime_1.jsx)("div", { className: "rh rh-nw", children: (0, jsx_runtime_1.jsx)(go_1.GoArrowUpLeft, { size: 16 }) })] })), (baseOptions.resizeable) && (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-n", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('n') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-s", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('s') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-e", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('e') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-w", style: { zIndex: parseInt(domZIndex) + 1 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('w') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-nw", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('nw') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-ne", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('ne') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-sw", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('sw') }), (0, jsx_runtime_1.jsx)("div", { className: "resize-handle resize-se", style: { zIndex: parseInt(domZIndex) + 2 }, onMouseDown: resizeableObject === null || resizeableObject === void 0 ? void 0 : resizeableObject.resizeHandleMouseDown('se') })] })] }) }) });
|
|
224
232
|
};
|
|
225
233
|
exports.DialogContent = DialogContent;
|
package/helpers/Resizeable.js
CHANGED
|
@@ -75,7 +75,13 @@ var Resizeable = /** @class */ (function () {
|
|
|
75
75
|
// CSS position = visual position minus Draggable's transform offset
|
|
76
76
|
_this._startCssLeft = rect.left - translate.x;
|
|
77
77
|
_this._startCssTop = rect.top - translate.y;
|
|
78
|
-
|
|
78
|
+
// Pin absolute position immediately so justify-self / margin centering
|
|
79
|
+
// cannot shift the left/top edge while we resize from the right or bottom.
|
|
80
|
+
var container = _this._container.current;
|
|
81
|
+
container.style.position = 'absolute';
|
|
82
|
+
container.style.left = _this._startCssLeft + 'px';
|
|
83
|
+
container.style.top = _this._startCssTop + 'px';
|
|
84
|
+
container.classList.add('no-select-on-resize');
|
|
79
85
|
_this.init();
|
|
80
86
|
}; };
|
|
81
87
|
this.resizeHandleMouseMove = function (e) {
|
|
@@ -46,7 +46,7 @@ var BASE_DIALOG_OPTIONS = {
|
|
|
46
46
|
about: false,
|
|
47
47
|
initialAnchor: { vertical: "flex-start", horizontal: "center" },
|
|
48
48
|
draggable: false,
|
|
49
|
-
size: { width: '
|
|
49
|
+
size: { width: 'fit-content', height: 'fit-content' },
|
|
50
50
|
actions: {
|
|
51
51
|
initialIntents: {
|
|
52
52
|
positive: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-dialogger",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.142",
|
|
4
4
|
"description": "This package is a continuation of the react-araci package. Due to an error, react-araci was removed, and it has been decided to continue under the new package name react-dialogger",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Sueleyman Topaloglu",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"notistack": "^3.0.2",
|
|
13
13
|
"react": "^18.2.0",
|
|
14
14
|
"react-dom": "^18.2.0",
|
|
15
|
-
"react-draggable": "^4.4.6"
|
|
15
|
+
"react-draggable": "^4.4.6",
|
|
16
|
+
"react-icons": "^5.6.0"
|
|
16
17
|
},
|
|
17
18
|
"maintainers": [
|
|
18
19
|
{
|
package/styles/dialog.css
CHANGED
|
@@ -322,6 +322,64 @@
|
|
|
322
322
|
flex: 0;
|
|
323
323
|
overflow: hidden;
|
|
324
324
|
}
|
|
325
|
+
.dialog-main .resize-hint-overlay {
|
|
326
|
+
position: absolute;
|
|
327
|
+
inset: 0;
|
|
328
|
+
pointer-events: none;
|
|
329
|
+
z-index: 500;
|
|
330
|
+
animation: resizeHintFade 3.2s ease-in-out forwards;
|
|
331
|
+
}
|
|
332
|
+
.dialog-main .rh {
|
|
333
|
+
position: absolute;
|
|
334
|
+
pointer-events: none;
|
|
335
|
+
}
|
|
336
|
+
.dialog-main .rh.rh-n {
|
|
337
|
+
top: 8px;
|
|
338
|
+
left: 50%;
|
|
339
|
+
translate: -50% 0;
|
|
340
|
+
animation: rhBounce-n 0.65s ease-in-out 0.5s 3 alternate;
|
|
341
|
+
}
|
|
342
|
+
.dialog-main .rh.rh-s {
|
|
343
|
+
bottom: 8px;
|
|
344
|
+
left: 50%;
|
|
345
|
+
translate: -50% 0;
|
|
346
|
+
animation: rhBounce-s 0.65s ease-in-out 0.5s 3 alternate;
|
|
347
|
+
}
|
|
348
|
+
.dialog-main .rh.rh-e {
|
|
349
|
+
right: 8px;
|
|
350
|
+
top: 50%;
|
|
351
|
+
translate: 0 -50%;
|
|
352
|
+
animation: rhBounce-e 0.65s ease-in-out 0.5s 3 alternate;
|
|
353
|
+
}
|
|
354
|
+
.dialog-main .rh.rh-w {
|
|
355
|
+
left: 8px;
|
|
356
|
+
top: 50%;
|
|
357
|
+
translate: 0 -50%;
|
|
358
|
+
animation: rhBounce-w 0.65s ease-in-out 0.5s 3 alternate;
|
|
359
|
+
}
|
|
360
|
+
.dialog-main .rh.rh-nw {
|
|
361
|
+
top: 8px;
|
|
362
|
+
left: 8px;
|
|
363
|
+
animation: rhBounce-nw 0.65s ease-in-out 0.5s 3 alternate;
|
|
364
|
+
}
|
|
365
|
+
.dialog-main .rh.rh-ne {
|
|
366
|
+
top: 8px;
|
|
367
|
+
right: 8px;
|
|
368
|
+
animation: rhBounce-ne 0.65s ease-in-out 0.5s 3 alternate;
|
|
369
|
+
}
|
|
370
|
+
.dialog-main .rh.rh-sw {
|
|
371
|
+
bottom: 8px;
|
|
372
|
+
left: 8px;
|
|
373
|
+
animation: rhBounce-sw 0.65s ease-in-out 0.5s 3 alternate;
|
|
374
|
+
}
|
|
375
|
+
.dialog-main .rh.rh-se {
|
|
376
|
+
bottom: 8px;
|
|
377
|
+
right: 8px;
|
|
378
|
+
animation: rhBounce-se 0.65s ease-in-out 0.5s 3 alternate;
|
|
379
|
+
}
|
|
380
|
+
.dialog-main .rh svg {
|
|
381
|
+
color: rgba(40, 110, 148, 0.85);
|
|
382
|
+
}
|
|
325
383
|
.dialog-main .resize-handle {
|
|
326
384
|
position: absolute;
|
|
327
385
|
user-select: none;
|
|
@@ -391,6 +449,60 @@
|
|
|
391
449
|
bottom: 0;
|
|
392
450
|
}
|
|
393
451
|
|
|
452
|
+
@keyframes resizeHintFade {
|
|
453
|
+
0% {
|
|
454
|
+
opacity: 0;
|
|
455
|
+
}
|
|
456
|
+
12% {
|
|
457
|
+
opacity: 1;
|
|
458
|
+
}
|
|
459
|
+
78% {
|
|
460
|
+
opacity: 1;
|
|
461
|
+
}
|
|
462
|
+
100% {
|
|
463
|
+
opacity: 0;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
@keyframes rhBounce-n {
|
|
467
|
+
to {
|
|
468
|
+
transform: translateY(-5px);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
@keyframes rhBounce-s {
|
|
472
|
+
to {
|
|
473
|
+
transform: translateY(5px);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
@keyframes rhBounce-e {
|
|
477
|
+
to {
|
|
478
|
+
transform: translateX(5px);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
@keyframes rhBounce-w {
|
|
482
|
+
to {
|
|
483
|
+
transform: translateX(-5px);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
@keyframes rhBounce-nw {
|
|
487
|
+
to {
|
|
488
|
+
transform: translate(-4px, -4px);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
@keyframes rhBounce-ne {
|
|
492
|
+
to {
|
|
493
|
+
transform: translate(4px, -4px);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
@keyframes rhBounce-sw {
|
|
497
|
+
to {
|
|
498
|
+
transform: translate(-4px, 4px);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
@keyframes rhBounce-se {
|
|
502
|
+
to {
|
|
503
|
+
transform: translate(4px, 4px);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
394
506
|
.fullscreen {
|
|
395
507
|
-webkit-transform: inherit !important;
|
|
396
508
|
-moz-transform: inherit !important;
|