react-dialogger 1.1.48 → 1.1.49

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.
Files changed (76) hide show
  1. package/README.md +2 -1
  2. package/components/Actions.d.ts +7 -0
  3. package/components/Actions.js +17 -0
  4. package/components/DialogActionBase.d.ts +10 -0
  5. package/components/DialogActionBase.js +13 -11
  6. package/components/DialogBase.d.ts +42 -109
  7. package/components/DialogBase.js +101 -762
  8. package/components/DialogContent.d.ts +1 -19
  9. package/components/DialogContent.js +66 -72
  10. package/components/DialogContentBody.d.ts +3 -5
  11. package/components/DialogContentBody.js +2 -23
  12. package/components/DialogContentFooter.d.ts +4 -0
  13. package/components/{DialogContenFooter.js → DialogContentFooter.js} +6 -33
  14. package/components/DialogContentHeader.d.ts +6 -6
  15. package/components/DialogContentHeader.js +74 -32
  16. package/components/DialogWithBackdropWrapper.d.ts +4 -0
  17. package/components/DialogWithBackdropWrapper.js +72 -0
  18. package/components/Features/DialogCloseAction.js +18 -0
  19. package/components/Features/DialogFullscreenAction.js +24 -0
  20. package/components/{Futures → Features}/DialogInfoAction.js +8 -11
  21. package/components/Features/DialogProcessing.js +14 -0
  22. package/components/RippleButton.d.ts +2 -2
  23. package/components/RippleButton.js +1 -3
  24. package/components/index.d.ts +9 -0
  25. package/components/index.js +24 -0
  26. package/components/utils/effects/jumper-animate.d.ts +2 -0
  27. package/components/utils/effects/jumper-animate.js +36 -0
  28. package/context/index.d.ts +3 -0
  29. package/context/index.js +54 -0
  30. package/{models → helpers}/Resizeable.d.ts +2 -2
  31. package/{models → helpers}/Resizeable.js +23 -11
  32. package/helpers/dialogBoundsMemoize.d.ts +5 -5
  33. package/helpers/dialogBoundsMemoize.js +82 -77
  34. package/helpers/dialogRectAuto.d.ts +3 -0
  35. package/helpers/dialogRectAuto.js +21 -0
  36. package/helpers/formInputKeyListeners.d.ts +2 -0
  37. package/helpers/formInputKeyListeners.js +18 -0
  38. package/helpers/hexToRgb.d.ts +2 -0
  39. package/helpers/hexToRgb.js +19 -0
  40. package/helpers/index.d.ts +1 -0
  41. package/helpers/index.js +3 -1
  42. package/helpers/initDialogMemoizeBounds.d.ts +7 -2
  43. package/helpers/initDialogMemoizeBounds.js +19 -14
  44. package/index.d.ts +3 -4
  45. package/index.js +12 -15
  46. package/models/Dialog.d.ts +29 -36
  47. package/models/Dialog.js +108 -99
  48. package/models/DialogAction.d.ts +1 -39
  49. package/models/DialogAction.js +2 -171
  50. package/models/baseDialogOptions.d.ts +5 -0
  51. package/models/baseDialogOptions.js +63 -0
  52. package/models/index.d.ts +3 -0
  53. package/models/index.js +13 -0
  54. package/package.json +1 -1
  55. package/styles/dialog.css +1 -2
  56. package/{helpers → types}/BoundTypes.d.ts +4 -1
  57. package/types/DialogActionTypes.d.ts +14 -6
  58. package/types/DialogTypes.d.ts +81 -31
  59. package/types/SizePosTypes.d.ts +3 -2
  60. package/types/index.d.ts +1 -1
  61. package/types/types.d.ts +1 -0
  62. package/components/DialogContenFooter.d.ts +0 -13
  63. package/components/Futures/DialogCloseAction.js +0 -30
  64. package/components/Futures/DialogFullscreenAction.js +0 -37
  65. package/components/Futures/DialogProcessing.js +0 -18
  66. package/hooks/useDialogOptions.d.ts +0 -3
  67. package/hooks/useDialogOptions.js +0 -82
  68. /package/components/{Futures → Features}/DialogCloseAction.d.ts +0 -0
  69. /package/components/{Futures → Features}/DialogFullscreenAction.d.ts +0 -0
  70. /package/components/{Futures → Features}/DialogHeaderActionsWrapper.d.ts +0 -0
  71. /package/components/{Futures → Features}/DialogHeaderActionsWrapper.js +0 -0
  72. /package/components/{Futures → Features}/DialogInfoAction.d.ts +0 -0
  73. /package/components/{Futures → Features}/DialogProcessing.d.ts +0 -0
  74. /package/components/{Futures → Features}/index.d.ts +0 -0
  75. /package/components/{Futures → Features}/index.js +0 -0
  76. /package/{helpers → types}/BoundTypes.js +0 -0
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DialogFullscreenAction = void 0;
7
+ var jsx_runtime_1 = require("react/jsx-runtime");
8
+ var FullscreenExitIcon_1 = __importDefault(require("../icons/FullscreenExitIcon"));
9
+ var FullscreenIcon_1 = __importDefault(require("../icons/FullscreenIcon"));
10
+ var react_1 = require("react");
11
+ var context_1 = require("../../context");
12
+ var helpers_1 = require("../../helpers");
13
+ var DialogFullscreenAction = function () {
14
+ var _a, _b, _c, _d, _e, _f, _g, _h;
15
+ var _j = (0, react_1.useContext)(context_1.DialogHeaderFooterContext), dialog = _j.dialog, setFullscreen = _j.setFullscreen, fullscreen = _j.fullscreen;
16
+ return (0, jsx_runtime_1.jsx)("div", { className: 'fullscreen-icon-wrapper', onClick: function (event) {
17
+ setFullscreen(!fullscreen);
18
+ (0, helpers_1.setDialogBound)(dialog.dialogOptions.base.id, "fullscreen", !fullscreen);
19
+ }, children: fullscreen ?
20
+ (0, jsx_runtime_1.jsx)(FullscreenExitIcon_1.default, { size: (_b = (_a = dialog.dialogOptions.base.headerControllerIcons) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 24, color: (_d = (_c = dialog.dialogOptions.base.headerControllerIcons) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : null })
21
+ :
22
+ (0, jsx_runtime_1.jsx)(FullscreenIcon_1.default, { size: (_f = (_e = dialog.dialogOptions.base.headerControllerIcons) === null || _e === void 0 ? void 0 : _e.size) !== null && _f !== void 0 ? _f : 24, color: (_h = (_g = dialog.dialogOptions.base.headerControllerIcons) === null || _g === void 0 ? void 0 : _g.color) !== null && _h !== void 0 ? _h : null }) });
23
+ };
24
+ exports.DialogFullscreenAction = DialogFullscreenAction;
@@ -39,18 +39,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.DialogInfoAction = void 0;
40
40
  var jsx_runtime_1 = require("react/jsx-runtime");
41
41
  var react_1 = require("react");
42
- var DialogBase_1 = require("../DialogBase");
43
42
  var InfoIcon_1 = __importDefault(require("../icons/InfoIcon"));
44
43
  //@ts-ignore
45
44
  var package_json_1 = __importDefault(require("../../package.json"));
46
- var __1 = __importStar(require("../../"));
45
+ var context_1 = require("../../context");
46
+ var models_1 = __importStar(require("../../models"));
47
47
  // const DialogFullscreenAction = ({dialog}:{dialog: React.RefObject<IDialogRef> | undefined}) => {
48
48
  var DialogInfoAction = function () {
49
49
  var _a, _b, _c, _d;
50
- var dialogHeaderContext = (0, react_1.useContext)(DialogBase_1.DialogHeaderFooterContext);
51
- var _dialog = dialogHeaderContext.dialog;
50
+ var prevDialog = (0, react_1.useContext)(context_1.DialogHeaderFooterContext).dialog;
52
51
  return (0, jsx_runtime_1.jsx)("div", { className: 'info-icon-wrapper', onClick: function (event) {
53
- var closeAction = new __1.DialogAction('closeAction', {
52
+ var closeAction = new models_1.DialogAction('closeAction', {
54
53
  label: 'Close',
55
54
  variant: 'text',
56
55
  color: 'default'
@@ -58,16 +57,15 @@ var DialogInfoAction = function () {
58
57
  closeAction.onClick(function (button, dialog1) {
59
58
  dialog1.close();
60
59
  });
61
- var dialog = new __1.default(null, {
60
+ var dialog = new models_1.default(null, {
62
61
  base: {
63
62
  resizeable: false,
64
63
  draggable: false,
65
64
  closeable: true,
66
65
  size: {
67
- width: 'xs',
68
- height: 'initial'
66
+ width: 'xs'
69
67
  },
70
- initialAnchor: _dialog.dialogOptions.base.initialAnchor,
68
+ initialAnchor: prevDialog.dialogOptions.base.initialAnchor,
71
69
  footer: {
72
70
  style: {
73
71
  borderTop: 'none'
@@ -86,8 +84,7 @@ var DialogInfoAction = function () {
86
84
  .addActions([
87
85
  closeAction
88
86
  ])
89
- .initialState({})
90
87
  .show();
91
- }, children: (0, jsx_runtime_1.jsx)(InfoIcon_1.default, { size: (_b = (_a = _dialog.dialogOptions.base.headerControllerIcons) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 24, color: (_d = (_c = _dialog.dialogOptions.base.headerControllerIcons) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : null }) });
88
+ }, children: (0, jsx_runtime_1.jsx)(InfoIcon_1.default, { size: (_b = (_a = prevDialog.dialogOptions.base.headerControllerIcons) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 24, color: (_d = (_c = prevDialog.dialogOptions.base.headerControllerIcons) === null || _c === void 0 ? void 0 : _c.color) !== null && _d !== void 0 ? _d : null }) });
92
89
  };
93
90
  exports.DialogInfoAction = DialogInfoAction;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DialogProcessing = void 0;
4
+ var jsx_runtime_1 = require("react/jsx-runtime");
5
+ var react_1 = require("react");
6
+ var context_1 = require("../../context");
7
+ var index_1 = require("../index");
8
+ var DialogProcessing = function () {
9
+ var _a, _b;
10
+ var dialog = (0, react_1.useContext)(context_1.DialogHeaderFooterContext).dialog;
11
+ var progressOption = dialog.dialogOptions.progress;
12
+ return (0, jsx_runtime_1.jsx)(index_1.CircularProgress, { size: (_a = progressOption.size) !== null && _a !== void 0 ? _a : 20, inProcess: dialog.isInProcess(), color: (_b = progressOption === null || progressOption === void 0 ? void 0 : progressOption.color) !== null && _b !== void 0 ? _b : '#399aec' });
13
+ };
14
+ exports.DialogProcessing = DialogProcessing;
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
- import { CSSProperties, ReactComponentElement } from "react";
2
+ import { CSSProperties, ReactNode } from "react";
3
3
  import { TBVariant, TBColor } from '../types/DialogActionTypes';
4
4
  declare const _default: React.ForwardRefExoticComponent<{
5
5
  variant: TBVariant;
6
6
  color: TBColor;
7
- children: (buttonRef: HTMLButtonElement) => string | ReactComponentElement<any>;
7
+ children: (buttonRef: HTMLButtonElement) => string | ReactNode;
8
8
  disabled: boolean;
9
9
  onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
10
10
  innerRef: React.RefObject<any>;
@@ -77,9 +77,7 @@ exports.default = React.forwardRef(function (_a, ref) {
77
77
  rippleEffect: rippleEffect
78
78
  }); });
79
79
  console.log('Ripple_button_style', style);
80
- return ((0, jsx_runtime_1.jsxs)("button", {
81
- // ref={buttonRef}
82
- ref: ref, disabled: disabled, className: "ripple-button ripple-button-".concat(variant, " ripple-button-").concat(color, " ").concat(disabled ? 'ripple-button-disabled' : ''), onClick: function (e) {
80
+ return ((0, jsx_runtime_1.jsxs)("button", { ref: ref, disabled: disabled, className: "ripple-button ripple-button-".concat(variant, " ripple-button-").concat(color, " ").concat(disabled ? 'ripple-button-disabled' : ''), onClick: function (e) {
83
81
  //@ts-ignore
84
82
  var rect = e.target.getBoundingClientRect();
85
83
  setCoords({ x: e.clientX - rect.left, y: e.clientY - rect.top });
@@ -0,0 +1,9 @@
1
+ export { default as CircularProgress } from "./CircularProgress";
2
+ export { DialogContentFooter } from "./DialogContentFooter";
3
+ export { DialogContentBody } from "./DialogContentBody";
4
+ export { DialogContent } from "./DialogContent";
5
+ export { default as DialogActionBase } from "./DialogActionBase";
6
+ export { DialogContentHeader } from "./DialogContentHeader";
7
+ export { DialogWithBackdropWrapper } from "./DialogWithBackdropWrapper";
8
+ export { Actions } from "./Actions";
9
+ export { default as RippleButton } from "./RippleButton";
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RippleButton = exports.Actions = exports.DialogWithBackdropWrapper = exports.DialogContentHeader = exports.DialogActionBase = exports.DialogContent = exports.DialogContentBody = exports.DialogContentFooter = exports.CircularProgress = void 0;
7
+ var CircularProgress_1 = require("./CircularProgress");
8
+ Object.defineProperty(exports, "CircularProgress", { enumerable: true, get: function () { return __importDefault(CircularProgress_1).default; } });
9
+ var DialogContentFooter_1 = require("./DialogContentFooter");
10
+ Object.defineProperty(exports, "DialogContentFooter", { enumerable: true, get: function () { return DialogContentFooter_1.DialogContentFooter; } });
11
+ var DialogContentBody_1 = require("./DialogContentBody");
12
+ Object.defineProperty(exports, "DialogContentBody", { enumerable: true, get: function () { return DialogContentBody_1.DialogContentBody; } });
13
+ var DialogContent_1 = require("./DialogContent");
14
+ Object.defineProperty(exports, "DialogContent", { enumerable: true, get: function () { return DialogContent_1.DialogContent; } });
15
+ var DialogActionBase_1 = require("./DialogActionBase");
16
+ Object.defineProperty(exports, "DialogActionBase", { enumerable: true, get: function () { return __importDefault(DialogActionBase_1).default; } });
17
+ var DialogContentHeader_1 = require("./DialogContentHeader");
18
+ Object.defineProperty(exports, "DialogContentHeader", { enumerable: true, get: function () { return DialogContentHeader_1.DialogContentHeader; } });
19
+ var DialogWithBackdropWrapper_1 = require("./DialogWithBackdropWrapper");
20
+ Object.defineProperty(exports, "DialogWithBackdropWrapper", { enumerable: true, get: function () { return DialogWithBackdropWrapper_1.DialogWithBackdropWrapper; } });
21
+ var Actions_1 = require("./Actions");
22
+ Object.defineProperty(exports, "Actions", { enumerable: true, get: function () { return Actions_1.Actions; } });
23
+ var RippleButton_1 = require("./RippleButton");
24
+ Object.defineProperty(exports, "RippleButton", { enumerable: true, get: function () { return __importDefault(RippleButton_1).default; } });
@@ -0,0 +1,2 @@
1
+ declare const jumperAnimate: (el: HTMLElement) => void;
2
+ export { jumperAnimate };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jumperAnimate = void 0;
4
+ var jumperAnimate = function (el) {
5
+ var animation = el.animate([
6
+ // key frames
7
+ // { transform: `translate(${20}px, ${20}px) scale(1)` },
8
+ // 1️⃣ Ortadan küçük başla
9
+ // { transform: 'translate(20px, 20px) scale(0.9)', boxShadow: '0 0 10px black' },
10
+ //
11
+ // // 2️⃣ Hafif büyü (kurulma)
12
+ // { transform: 'translate(20px, 20px) scale(1.05)', boxShadow: '0 0 50px black' },
13
+ //
14
+ // // 3️⃣ Orijinal boyuta dön
15
+ // { transform: 'translate(20px, 20px) scale(1)' ,boxShadow: '0 0 20px black'},
16
+ // { transform: 'translate(20px, 20px) scale(1.05)' ,boxShadow: '0 0 30px black'},
17
+ // { transform: 'translate(20px, 20px) scale(1)' ,boxShadow: '0 0 20px black'},
18
+ { transform: 'scale(0.9)', boxShadow: '0 0 10px black' },
19
+ { transform: 'scale(1.05)', boxShadow: '0 0 50px black' },
20
+ { transform: 'scale(1)', boxShadow: '0 0 20px black' },
21
+ { transform: 'scale(1.05)', boxShadow: '0 0 30px black' },
22
+ { transform: 'scale(1)', boxShadow: '0 0 20px black' },
23
+ ], {
24
+ // sync options
25
+ // duration: 250,
26
+ duration: 250,
27
+ iterations: 1,
28
+ fill: 'forwards'
29
+ });
30
+ animation.onfinish = function () {
31
+ // el.style.transform = 'none'; // stacking context kaldırılır
32
+ el.style.transform = 'scale(1)'; // stacking context kaldırılır
33
+ animation.cancel();
34
+ };
35
+ };
36
+ exports.jumperAnimate = jumperAnimate;
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ export declare const WithHeaderFooterContext: (props: any) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const DialogHeaderFooterContext: React.Context<any>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.DialogHeaderFooterContext = exports.WithHeaderFooterContext = void 0;
48
+ var jsx_runtime_1 = require("react/jsx-runtime");
49
+ var React = __importStar(require("react"));
50
+ var WithHeaderFooterContext = function (props) {
51
+ return (0, jsx_runtime_1.jsx)(exports.DialogHeaderFooterContext.Provider, { value: __assign({}, props), children: props.children });
52
+ };
53
+ exports.WithHeaderFooterContext = WithHeaderFooterContext;
54
+ exports.DialogHeaderFooterContext = React.createContext(null);
@@ -1,7 +1,7 @@
1
1
  import { MouseEvent } from "react";
2
2
  import { DialogOptionsType } from "../types/DialogTypes";
3
3
  declare class Resizeable {
4
- onResizeListener: (callbackFn: (width: number, height: number) => void) => void;
4
+ onResizeListener: (callbackFn: (width: number, height: number, rect?: DOMRect) => void) => void;
5
5
  get width(): number;
6
6
  get height(): number;
7
7
  get isResizing(): boolean;
@@ -20,4 +20,4 @@ declare class Resizeable {
20
20
  init: () => void;
21
21
  cleanUp: () => void;
22
22
  }
23
- export default Resizeable;
23
+ export { Resizeable };
@@ -1,5 +1,17 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.Resizeable = void 0;
3
15
  var helpers_1 = require("../helpers");
4
16
  var Resizeable = /** @class */ (function () {
5
17
  function Resizeable() {
@@ -12,16 +24,17 @@ var Resizeable = /** @class */ (function () {
12
24
  _this._dialogOptions = options;
13
25
  };
14
26
  this.resizeHandleMouseUp = function () {
15
- // console.log('handleMouseUp', false);
16
- _this._container.current.classList.remove('no-select-on-resize');
27
+ var _a, _b, _c;
28
+ (_b = (_a = _this._container) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.classList.remove('no-select-on-resize');
17
29
  _this.isResizing = false;
18
30
  // Bounds case
19
31
  var container = _this._container.current;
20
- var _a = container === null || container === void 0 ? void 0 : container.getBoundingClientRect(), width = _a.width, height = _a.height, x = _a.x, y = _a.y;
21
- (0, helpers_1.setDialogBounds)(_this._dialogOptions.base.id, { width: width, height: height, x: x, y: y }, _this._container);
32
+ var _d = (_c = container === null || container === void 0 ? void 0 : container.getBoundingClientRect()) !== null && _c !== void 0 ? _c : {}, width = _d.width, height = _d.height, x = _d.x, y = _d.y;
33
+ console.log('resizeHandleMouseUp', container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON());
34
+ // setDialogBounds( this._dialogOptions.base.id, {width, height, x, y, fullscreen: false}, this._container );
35
+ (0, helpers_1.setDialogBounds)(_this._dialogOptions.base.id, __assign(__assign({}, container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON()), { fullscreen: false }), _this._container);
22
36
  };
23
37
  this.resizeHandleMouseDown = function () {
24
- console.log('resizeHandleMouseDown', true);
25
38
  _this.isResizing = true;
26
39
  _this._container.current.classList.add('no-select-on-resize');
27
40
  _this.init();
@@ -35,23 +48,22 @@ var Resizeable = /** @class */ (function () {
35
48
  var container = _this._container.current;
36
49
  var newWidth = e.clientX - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) + 10;
37
50
  var newHeight = e.clientY - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().top) + 10;
38
- _this._width = Math.max(newWidth, 100); // Minimum genişlik
39
- _this._height = Math.max(newHeight, 100); // Minimum yükseklik
51
+ _this._width = Math.max(newWidth, 100); // Min Width
52
+ _this._height = Math.max(newHeight, 100); // Min Height
53
+ var rect = __assign(__assign({}, container === null || container === void 0 ? void 0 : container.getBoundingClientRect().toJSON()), { width: _this._width, height: _this._height });
40
54
  if (typeof _this._onResizeListener === "function") {
41
- _this._onResizeListener(_this._width, _this._height);
55
+ _this._onResizeListener(_this._width, _this._height, rect);
42
56
  }
43
57
  _this._container.current.style.width = _this._width + 'px';
44
58
  _this._container.current.style.height = _this._height + 'px';
45
59
  };
46
60
  this.init = function () {
47
61
  if (_this.isResizing) {
48
- // Fare olay dinleyicilerini ekliyoruz
49
62
  // @ts-ignore
50
63
  window.addEventListener('mousemove', _this.resizeHandleMouseMove);
51
64
  window.addEventListener('mouseup', _this.resizeHandleMouseUp);
52
65
  }
53
66
  else {
54
- // Fare olay dinleyicilerini kaldırıyoruz
55
67
  // @ts-ignore
56
68
  window.removeEventListener('mousemove', _this.resizeHandleMouseMove);
57
69
  window.removeEventListener('mouseup', _this.resizeHandleMouseUp);
@@ -90,4 +102,4 @@ var Resizeable = /** @class */ (function () {
90
102
  });
91
103
  return Resizeable;
92
104
  }());
93
- exports.default = Resizeable;
105
+ exports.Resizeable = Resizeable;
@@ -1,5 +1,5 @@
1
- import { IDialogBoundsDef } from "./BoundTypes";
2
- import { IBaseDialogOptions } from "../types/DialogTypes";
3
- export declare const dialogRegister: (options: IBaseDialogOptions, initialBounds: IDialogBoundsDef) => IDialogBoundsDef;
4
- export declare const getDialogBounds: (options: IBaseDialogOptions) => IDialogBoundsDef | undefined;
5
- export declare const setDialogBounds: (dialogId: string, bounds: IDialogBoundsDef, dialogRef: React.RefObject<any>) => void;
1
+ import { IDialogBoundsDef, IDialogIdentificationType } from "../types/BoundTypes";
2
+ export declare const dialogRegister: (dialogId: IDialogIdentificationType, initialBounds: IDialogBoundsDef) => IDialogBoundsDef;
3
+ export declare const getDialogBounds: (dialogId: IDialogIdentificationType) => IDialogBoundsDef | undefined;
4
+ export declare const setDialogBounds: (dialogId: IDialogIdentificationType, bounds: IDialogBoundsDef, dialogRef: React.RefObject<any>) => void;
5
+ export declare const setDialogBound: (dialogId: IDialogIdentificationType, key: keyof IDialogBoundsDef, value: any) => void;
@@ -1,113 +1,99 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
14
+ exports.setDialogBound = exports.setDialogBounds = exports.getDialogBounds = exports.dialogRegister = void 0;
4
15
  // import {registeredDialogs} from "../hooks/initDialogMemoizeBounds";
5
16
  var initDialogMemoizeBounds_1 = require("./initDialogMemoizeBounds");
6
- // const BOUNDS_STORE_KEY: IDialogBoundsMemoKey = 'react-super-dialog';
7
- // const boundStoreExists = () => {
8
- // try{
9
- // return !!window.localStorage.getItem(BOUNDS_STORE_KEY);
10
- // } catch (e){
11
- // return false;
12
- // }
13
- // }
14
- // const createBoundStore = () => {
15
- // if (!boundStoreExists()) {
16
- // try{
17
- // window.localStorage.setItem(BOUNDS_STORE_KEY, JSON.stringify([]));
18
- // } catch (e){
19
- // console.log(e);
20
- // }
21
- // }
22
- // }
23
17
  /**
24
- * RAM den okuyoruz...
18
+ * Read from RAM...
25
19
  * */
26
- var dialogInStore = function (options) {
20
+ var dialogInStore = function (dialogId) {
27
21
  var stores = initDialogMemoizeBounds_1.registeredDialogs;
28
- console.log('dialogInStoreX1', stores);
29
- if (!stores)
30
- return undefined;
31
- var parsedStores = stores; // JSON.parse(stores);
32
- var foundedStore = parsedStores.find(function (store) { return store.id === options.id; });
33
- return foundedStore;
22
+ var combined = ['guzzle', dialogId];
23
+ var isExists = stores.has(combined.join('-'));
24
+ if (isExists) {
25
+ return stores.get(combined.join('-'));
26
+ }
27
+ return undefined;
34
28
  };
35
- var dialogRegister = function (options, initialBounds) {
36
- console.log('Regsister fired!!!', options);
37
- if (dialogInStore(options))
29
+ var dialogRegister = function (dialogId, initialBounds) {
30
+ // If already registered ignore!
31
+ if (dialogInStore(dialogId))
38
32
  return;
39
- if (!options.id) {
33
+ if (!dialogId) {
40
34
  throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
41
35
  }
42
- // createBoundStore();
43
- var newBounds = {
44
- id: options.id,
36
+ var combined = ['guzzle', dialogId];
37
+ var newDialogBounds = {
38
+ id: combined.join('-'),
45
39
  bounds: {
46
40
  width: initialBounds.width,
47
41
  height: initialBounds.height,
48
42
  x: initialBounds.x,
49
- y: initialBounds.y + 100
43
+ y: initialBounds.y,
44
+ fullscreen: false
50
45
  }
51
46
  };
52
- var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.find(function (b) { return b.id === options.id; });
53
- console.log('foundedDialog', foundedDialog);
54
- if (!foundedDialog) {
55
- initDialogMemoizeBounds_1.registeredDialogs.push(newBounds);
56
- }
57
- console.log('foundedDialog_2', initDialogMemoizeBounds_1.registeredDialogs);
58
- // Register to Cookie
47
+ // To RAM
48
+ initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), newDialogBounds);
49
+ console.log('dialogRegister_combined', newDialogBounds, combined.join('-'), initDialogMemoizeBounds_1.registeredDialogs, Array.from(initDialogMemoizeBounds_1.registeredDialogs));
50
+ // To Store
59
51
  try {
60
- window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
52
+ window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
61
53
  }
62
54
  catch (e) {
63
55
  console.log(e);
64
56
  }
65
- // registeredDialogs.push(newBounds);
66
- console.log('Dialog_Bounds, initialBounds-A', initialBounds);
67
- var bounds = (0, exports.getDialogBounds)(options);
68
- return bounds;
57
+ return (0, exports.getDialogBounds)(dialogId);
69
58
  };
70
59
  exports.dialogRegister = dialogRegister;
71
- var getDialogBounds = function (options) {
72
- var dialog = dialogInStore(options);
73
- if (!options.id) {
60
+ var getDialogBounds = function (dialogId) {
61
+ if (!dialogId) {
74
62
  throw new Error('Dialog bounds can not be memoized. Dialog id is required.');
75
63
  }
76
- // Eget local vaiable icinde bulunamassa localStorage'dan al
77
- if (!dialog) {
78
- var boundsRaw = window.localStorage.getItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY);
79
- var boundsArray = boundsRaw ? JSON.parse(boundsRaw) : [];
80
- var founded = boundsArray.find(function (b) { return b.id === options.id; });
81
- if (founded) {
82
- return {
83
- width: founded.bounds.width,
84
- height: founded.bounds.height,
85
- x: founded.bounds.x,
86
- y: founded.bounds.y
87
- };
88
- }
89
- }
64
+ var dialog = dialogInStore(dialogId);
65
+ console.log('getDialogBounds_dialog', initDialogMemoizeBounds_1.registeredDialogs, dialog);
90
66
  if (dialog) {
91
- return {
92
- width: dialog.bounds.width,
93
- height: dialog.bounds.height,
94
- x: dialog.bounds.x,
95
- y: dialog.bounds.y
96
- };
67
+ return dialog.bounds;
97
68
  }
98
69
  return undefined;
99
70
  };
100
71
  exports.getDialogBounds = getDialogBounds;
101
72
  var setDialogBounds = function (dialogId, bounds, dialogRef) {
102
- var newBounds = {
103
- id: dialogId,
104
- bounds: bounds
105
- };
106
- var founded = initDialogMemoizeBounds_1.registeredDialogs.find(function (b) { return b.id === dialogId; });
107
- if (founded) {
108
- founded.bounds = bounds;
73
+ var combined = ['guzzle', dialogId];
74
+ var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.get(combined.join('-'));
75
+ console.log('setDialogBounds_combined', combined, combined.join('-'), bounds, foundedDialog);
76
+ if (foundedDialog) {
77
+ // Save to RAM
78
+ initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), {
79
+ id: combined.join('-'),
80
+ bounds: bounds
81
+ });
82
+ /**
83
+ * const myMap = new Map();
84
+ * myMap.set("a", 1);
85
+ * myMap.set("b", 2);
86
+ *
87
+ * const iterator = myMap.entries();
88
+ * console.log(iterator.next()); // { value: ["a", 1], done: false }
89
+ * console.log(iterator.next()); // { value: ["b", 2], done: false }
90
+ * console.log(iterator.next()); // { value: undefined, done: true }
91
+ *
92
+ * */
93
+ // Save to Store
94
+ console.log('registeredDialogs', initDialogMemoizeBounds_1.registeredDialogs);
109
95
  try {
110
- window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(initDialogMemoizeBounds_1.registeredDialogs));
96
+ window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
111
97
  }
112
98
  catch (e) {
113
99
  console.log(e);
@@ -115,3 +101,22 @@ var setDialogBounds = function (dialogId, bounds, dialogRef) {
115
101
  }
116
102
  };
117
103
  exports.setDialogBounds = setDialogBounds;
104
+ var setDialogBound = function (dialogId, key, value) {
105
+ var _a;
106
+ var combined = ['guzzle', dialogId];
107
+ var foundedDialog = initDialogMemoizeBounds_1.registeredDialogs.get(combined.join('-'));
108
+ if (foundedDialog) {
109
+ // Save to RAM
110
+ initDialogMemoizeBounds_1.registeredDialogs.set(combined.join('-'), {
111
+ id: combined.join('-'),
112
+ bounds: __assign(__assign({}, foundedDialog.bounds), (_a = {}, _a[key] = value, _a))
113
+ });
114
+ try {
115
+ window.localStorage.setItem(initDialogMemoizeBounds_1.BOUNDS_STORE_KEY, JSON.stringify(Array.from(initDialogMemoizeBounds_1.registeredDialogs)));
116
+ }
117
+ catch (e) {
118
+ console.log(e);
119
+ }
120
+ }
121
+ };
122
+ exports.setDialogBound = setDialogBound;
@@ -0,0 +1,3 @@
1
+ import { BaseDialogDOMRect } from "../types/types";
2
+ declare const dialogRectAuto: () => BaseDialogDOMRect;
3
+ export { dialogRectAuto };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dialogRectAuto = void 0;
4
+ var dialogRectAuto = function () {
5
+ var _a, _b;
6
+ var nodes = Array.from(document.querySelectorAll('.react-guzzle-root[data-family="presentation"]'));
7
+ if (nodes.length > 1) {
8
+ var lastDialog = nodes[nodes.length - 2];
9
+ var dialogMain = lastDialog.querySelector('#dialog-main');
10
+ var rect = dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect();
11
+ return {
12
+ top: ((_a = rect === null || rect === void 0 ? void 0 : rect.top) !== null && _a !== void 0 ? _a : 0) + 10,
13
+ left: ((_b = rect === null || rect === void 0 ? void 0 : rect.left) !== null && _b !== void 0 ? _b : 0) + 10,
14
+ x: rect.x,
15
+ y: rect.y,
16
+ isMultiple: true
17
+ };
18
+ }
19
+ return { top: 0, left: 0, isMultiple: false };
20
+ };
21
+ exports.dialogRectAuto = dialogRectAuto;
@@ -0,0 +1,2 @@
1
+ declare const formInputKeyListeners: (wrapperEl: HTMLElement) => void;
2
+ export { formInputKeyListeners };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formInputKeyListeners = void 0;
4
+ var formInputKeyListeners = function (wrapperEl) {
5
+ if (wrapperEl) {
6
+ // Öncelikle ref'i al ve input elemanlarını bul
7
+ var inputElements = wrapperEl.querySelectorAll("input");
8
+ // Tüm input elemanlarını döngüye al
9
+ inputElements.forEach(function (input) {
10
+ console.log(input); // Her bir input elemanını burada işleyebilirsiniz
11
+ // Örneğin, input değerini okuma veya ayarlama
12
+ input.addEventListener('keydown', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
13
+ input.addEventListener('keyup', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
14
+ input.addEventListener('keypress', function (e) { return e.key === "Enter" && e.preventDefault(); }); // Değerini boşaltmak için örnek
15
+ });
16
+ }
17
+ };
18
+ exports.formInputKeyListeners = formInputKeyListeners;
@@ -0,0 +1,2 @@
1
+ declare const hexToRgb: (hex: string, opacity: number) => string;
2
+ export { hexToRgb };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hexToRgb = void 0;
4
+ var hexToRgb = function (hex, opacity) {
5
+ try {
6
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
7
+ var colors = {
8
+ r: parseInt(result[1], 16),
9
+ g: parseInt(result[2], 16),
10
+ b: parseInt(result[3], 16)
11
+ };
12
+ return "rgba(".concat(colors.r, ", ").concat(colors.g, ", ").concat(colors.b, ", ").concat(opacity, ")");
13
+ }
14
+ catch (e) {
15
+ console.warn('Color should be hex string', e.message);
16
+ }
17
+ return '';
18
+ };
19
+ exports.hexToRgb = hexToRgb;