react-dialogger 1.1.0

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 (51) hide show
  1. package/README.md +303 -0
  2. package/components/CircularProgress.d.ts +8 -0
  3. package/components/CircularProgress.js +50 -0
  4. package/components/DialogActionBase.d.ts +44 -0
  5. package/components/DialogActionBase.js +222 -0
  6. package/components/DialogBase.d.ts +132 -0
  7. package/components/DialogBase.js +880 -0
  8. package/components/Futures/DialogCloseAction.d.ts +3 -0
  9. package/components/Futures/DialogCloseAction.js +54 -0
  10. package/components/Futures/DialogFullscreenAction.d.ts +3 -0
  11. package/components/Futures/DialogFullscreenAction.js +60 -0
  12. package/components/Futures/DialogHeaderActionsWrapper.d.ts +3 -0
  13. package/components/Futures/DialogHeaderActionsWrapper.js +11 -0
  14. package/components/Futures/DialogProcessing.d.ts +3 -0
  15. package/components/Futures/DialogProcessing.js +41 -0
  16. package/components/Futures/index.d.ts +4 -0
  17. package/components/Futures/index.js +11 -0
  18. package/components/RippleButton.d.ts +15 -0
  19. package/components/RippleButton.js +81 -0
  20. package/components/icons/CloseIcon.d.ts +6 -0
  21. package/components/icons/CloseIcon.js +23 -0
  22. package/components/icons/FullscreenExitIcon.d.ts +6 -0
  23. package/components/icons/FullscreenExitIcon.js +23 -0
  24. package/components/icons/FullscreenIcon.d.ts +6 -0
  25. package/components/icons/FullscreenIcon.js +23 -0
  26. package/components/icons/ResizeIcon.d.ts +6 -0
  27. package/components/icons/ResizeIcon.js +14 -0
  28. package/hooks/useDialogOptions.d.ts +3 -0
  29. package/hooks/useDialogOptions.js +82 -0
  30. package/index.d.ts +8 -0
  31. package/index.js +25 -0
  32. package/models/Dialog.d.ts +44 -0
  33. package/models/Dialog.js +142 -0
  34. package/models/DialogAction.d.ts +54 -0
  35. package/models/DialogAction.js +277 -0
  36. package/models/Resizeable.d.ts +21 -0
  37. package/models/Resizeable.js +87 -0
  38. package/package.json +20 -0
  39. package/styles/circular-progress.css +42 -0
  40. package/styles/dialog.action.css +234 -0
  41. package/styles/dialog.css +336 -0
  42. package/types/DialogActionTypes.d.ts +66 -0
  43. package/types/DialogActionTypes.js +3 -0
  44. package/types/DialogTypes.d.ts +128 -0
  45. package/types/DialogTypes.js +2 -0
  46. package/types/SizePosTypes.d.ts +5 -0
  47. package/types/SizePosTypes.js +2 -0
  48. package/types/index.d.ts +4 -0
  49. package/types/index.js +2 -0
  50. package/types/types.d.ts +58 -0
  51. package/types/types.js +2 -0
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var DialogBase_1 = __importDefault(require("../components/DialogBase"));
22
+ var Dialog = /** @class */ (function (_super) {
23
+ __extends(Dialog, _super);
24
+ // This property holds a callback function that listens to state changes within the dialog. It is used to track or respond to changes in dialog state.
25
+ // private _stateListener: TDialogStateListenerCallbackType;
26
+ // This property stores the initial state of the dialog, which could include default settings or values before any interactions.
27
+ // private _initialState: TBaseDialogState;
28
+ // private _initialValues: TInitialValues<any>;
29
+ // This property represents the initial holder of the dialog. It is used before the dialog is shown, typically to manage resources or prepare the dialog for display (like loading animations or initial data).
30
+ // private _initialHolder: TInitialHolder;
31
+ // This property indicates where the dialog is accessed from, such as from a button or menu item, providing context about its origin.
32
+ // private _accessFrom: TAccessFrom;
33
+ // This property refers to the DOM element that will represent the dialog container on the web page. It is a `div` element dynamically created when the dialog is displayed.
34
+ // private _dom: HTMLDivElement;
35
+ // This property holds a function to handle keyboard events. It listens for key presses and performs actions based on the key and the current state of the dialog.
36
+ // private _keyboardListener: (key: string, dialog: Dialog) => void;
37
+ // This is a React reference (`RefObject`) used to access the dialog instance or DOM element directly within React components. It provides a way to interact with the DOM element programmatically without triggering re-renders.
38
+ // private readonly _innerRef: React.RefObject<any>;
39
+ // initialValues = ( values: T ): this => {
40
+ // this._initialValues = values;
41
+ // return this;
42
+ // }
43
+ function Dialog(dialogRef, options) {
44
+ var _this = _super.call(this) || this;
45
+ /** @deprecated use Dialog Options */
46
+ _this.setSize = function (size) {
47
+ _this._dialogSize = size;
48
+ return _this;
49
+ };
50
+ /**
51
+ * @deprecated
52
+ * @info Dialog ordering after of before Reference Dom Element
53
+ * This method is deprecated and will be removed in a future release.
54
+ * Please use an alternative approach for setting dialog ordering or layout.
55
+ * The dialog ordering functionality will be managed differently in future versions.
56
+ */
57
+ _this.setOrder = function (position, component) {
58
+ _this._order = { position: position, dom: component };
59
+ return _this;
60
+ };
61
+ _this.getDom = function () {
62
+ return _this._dom;
63
+ };
64
+ _this.show = function (callback) {
65
+ _super.prototype.show.call(_this, callback);
66
+ };
67
+ if (dialogRef) {
68
+ _this._innerRef = dialogRef;
69
+ }
70
+ if (options) {
71
+ _this._dialogOptions = options;
72
+ }
73
+ return _this;
74
+ }
75
+ /**
76
+ * @deprecated
77
+ * @see dialogOptions.snackbar.anchorOrigin */
78
+ Dialog.prototype.snackbarAnchor = function (anchor) {
79
+ this._snackbarAnchor = anchor;
80
+ return this;
81
+ };
82
+ Object.defineProperty(Dialog.prototype, "accessFrom", {
83
+ get: function () {
84
+ return this._accessFrom;
85
+ },
86
+ set: function (accessFrom) {
87
+ this._accessFrom = accessFrom;
88
+ },
89
+ enumerable: false,
90
+ configurable: true
91
+ });
92
+ Dialog.prototype.setHeader = function (header) {
93
+ _super.prototype.setHeader.call(this, header);
94
+ return this;
95
+ };
96
+ // setBody = ( body: CallbackFn['NodeFn'] ): Dialog => {
97
+ Dialog.prototype.setBody = function (body) {
98
+ _super.prototype.setBody.call(this, body);
99
+ return this;
100
+ };
101
+ Dialog.prototype.addActions = function (actions) {
102
+ _super.prototype.addActions.call(this, actions); // overrided
103
+ return this;
104
+ };
105
+ Dialog.prototype.addAction = function (action) {
106
+ _super.prototype.addAction.call(this, action);
107
+ return this;
108
+ };
109
+ /**
110
+ * Only from init */
111
+ Dialog.prototype.stateListener = function (listener) {
112
+ _super.prototype.stateListener.call(this, listener);
113
+ return this;
114
+ };
115
+ /**
116
+ * @deprecated
117
+ * @link initialValues */
118
+ // initialState = ( state: TBaseDialogState ): this => {
119
+ Dialog.prototype.initialState = function (state) {
120
+ console.warn('Dialog Warning', 'initialState not more supported, replace this with initialValues');
121
+ this._initialState = state;
122
+ return this;
123
+ };
124
+ Dialog.prototype.initialValues = function (values) {
125
+ this._initialValues = values;
126
+ return this;
127
+ };
128
+ Dialog.prototype.initialHolder = function (holder) {
129
+ _super.prototype.initialHolder.call(this, holder);
130
+ return this;
131
+ };
132
+ Dialog.prototype.onClose = function (callback) {
133
+ _super.prototype.onClose.call(this, callback);
134
+ return this;
135
+ };
136
+ Dialog.prototype.keyboardListener = function (listener) {
137
+ _super.prototype.keyboardListener.call(this, listener); // overrided and return current dialog instance directly
138
+ return this;
139
+ };
140
+ return Dialog;
141
+ }(DialogBase_1.default));
142
+ exports.default = Dialog;
@@ -0,0 +1,54 @@
1
+ import { TDialogStateListenerForActionCallbackType, DialogActionOptionsType, TBVariant, TBColor, ActionProps, DialogActionType } from "../types/DialogActionTypes";
2
+ import DialogActionBase from "../components/DialogActionBase";
3
+ import * as React from "react";
4
+ declare const ActionProgress: () => React.JSX.Element;
5
+ export { ActionProgress };
6
+ declare class DialogAction extends DialogActionBase {
7
+ constructor(name: string, options?: DialogActionOptionsType);
8
+ setOptions: (options: DialogActionOptionsType) => this;
9
+ get options(): DialogActionOptionsType;
10
+ get name(): string;
11
+ /**
12
+ * @deprecated
13
+ * @see DialogActionOptionsType
14
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
15
+ setLabel: (label: string) => DialogAction;
16
+ getLabel: () => string;
17
+ onClick: (callback: DialogActionType) => this;
18
+ /**
19
+ * @deprecated
20
+ * @see onClickHandler */
21
+ getAction(): DialogActionType;
22
+ /**
23
+ * @deprecated
24
+ * @see DialogActionOptionsType
25
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
26
+ setVariant: (variant: TBVariant) => this;
27
+ getVariant: () => TBVariant;
28
+ /**
29
+ * @deprecated
30
+ * @see DialogActionOptionsType
31
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
32
+ setColor: (color: TBColor) => this;
33
+ getColor: () => TBColor;
34
+ /**
35
+ * Only from init */
36
+ stateListener: (listener: TDialogStateListenerForActionCallbackType) => this;
37
+ set baseDialogAction(baseDialogAction: DialogActionBase);
38
+ setInProcess: (inProcess: ActionProps['inProcess']) => this;
39
+ /**
40
+ * @deprecated
41
+ * @see isInProcess*/
42
+ getInProcess: () => boolean;
43
+ isInProcess: () => boolean;
44
+ /**
45
+ * @deprecated
46
+ * @see DialogActionOptionsType
47
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
48
+ setDisabled: (disabled: boolean) => this;
49
+ getDisabled: () => boolean;
50
+ isDisabled: () => boolean;
51
+ remove: () => void;
52
+ click: () => void;
53
+ }
54
+ export { DialogAction };
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ var desc = Object.getOwnPropertyDescriptor(m, k);
31
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
+ }
34
+ Object.defineProperty(o, k2, desc);
35
+ }) : (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ o[k2] = m[k];
38
+ }));
39
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
41
+ }) : function(o, v) {
42
+ o["default"] = v;
43
+ });
44
+ var __importStar = (this && this.__importStar) || function (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ var __importDefault = (this && this.__importDefault) || function (mod) {
52
+ return (mod && mod.__esModule) ? mod : { "default": mod };
53
+ };
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.DialogAction = exports.ActionProgress = void 0;
56
+ var DialogActionBase_1 = __importDefault(require("../components/DialogActionBase"));
57
+ var CircularProgress_1 = __importDefault(require("../components/CircularProgress"));
58
+ var React = __importStar(require("react"));
59
+ var ActionProgress = function () {
60
+ return React.createElement(CircularProgress_1.default, { size: 20, inProcess: { inProcess: true } });
61
+ };
62
+ exports.ActionProgress = ActionProgress;
63
+ var DialogAction = /** @class */ (function (_super) {
64
+ __extends(DialogAction, _super);
65
+ function DialogAction(name, options) {
66
+ var _this = _super.call(this) || this;
67
+ _this.setOptions = function (options) {
68
+ var _a;
69
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
70
+ _this._baseDialogAction.setOptions(options);
71
+ return _this;
72
+ }
73
+ // this._label = label;
74
+ _this._options = options;
75
+ return _this;
76
+ };
77
+ /**
78
+ * @deprecated
79
+ * @see DialogActionOptionsType
80
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
81
+ _this.setLabel = function (label) {
82
+ var _a;
83
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
84
+ _this._baseDialogAction.setLabel(label);
85
+ return _this;
86
+ }
87
+ if (_this._options) {
88
+ _this._options.label = label; // _options'ın başlatıldığını varsayarak erişim
89
+ }
90
+ else {
91
+ console.error('DialogAction _options is not initialized');
92
+ }
93
+ return _this;
94
+ };
95
+ _this.getLabel = function () {
96
+ var _a;
97
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
98
+ return _this._baseDialogAction.getLabel();
99
+ }
100
+ return _this._options.label;
101
+ };
102
+ _this.onClick = function (callback) {
103
+ _super.prototype.onClick.call(_this, callback);
104
+ return _this;
105
+ };
106
+ /**
107
+ * @deprecated
108
+ * @see DialogActionOptionsType
109
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
110
+ _this.setVariant = function (variant) {
111
+ var _a;
112
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
113
+ _this._baseDialogAction.setVariant(variant);
114
+ return _this;
115
+ }
116
+ if (_this._options) {
117
+ _this._options.variant = variant; // _options'ın başlatıldığını varsayarak erişim
118
+ }
119
+ else {
120
+ console.error('DialogAction _options is not initialized');
121
+ }
122
+ return _this;
123
+ };
124
+ _this.getVariant = function () {
125
+ var _a;
126
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
127
+ return _this._baseDialogAction.getVariant();
128
+ }
129
+ return _this._options.variant;
130
+ };
131
+ /**
132
+ * @deprecated
133
+ * @see DialogActionOptionsType
134
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
135
+ _this.setColor = function (color) {
136
+ var _a;
137
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
138
+ _this._baseDialogAction.setColor(color);
139
+ return _this;
140
+ }
141
+ if (_this._options) {
142
+ _this._options.color = color; // _options'ın başlatıldığını varsayarak erişim
143
+ }
144
+ else {
145
+ console.error('DialogAction _options is not initialized');
146
+ }
147
+ return _this;
148
+ };
149
+ _this.getColor = function () {
150
+ var _a;
151
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
152
+ return _this._baseDialogAction.getColor();
153
+ }
154
+ return _this._options.color;
155
+ };
156
+ /**
157
+ * Only from init */
158
+ _this.stateListener = function (listener) {
159
+ _this._stateListener = listener;
160
+ return _this;
161
+ };
162
+ _this.setInProcess = function (inProcess) {
163
+ var _a;
164
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
165
+ _this._baseDialogAction.setInProcess(inProcess);
166
+ return _this;
167
+ }
168
+ _this._inProcess = inProcess;
169
+ return _this;
170
+ };
171
+ /**
172
+ * @deprecated
173
+ * @see isInProcess*/
174
+ _this.getInProcess = function () {
175
+ var _a;
176
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
177
+ return _this._baseDialogAction.isInProcess();
178
+ }
179
+ return _this._inProcess;
180
+ };
181
+ _this.isInProcess = function () {
182
+ var _a;
183
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
184
+ return _this._baseDialogAction.isInProcess();
185
+ }
186
+ return _this._inProcess;
187
+ };
188
+ /**
189
+ * @deprecated
190
+ * @see DialogActionOptionsType
191
+ * @info Define this prop inside new DialogAction('varName', {>here<})*/
192
+ _this.setDisabled = function (disabled) {
193
+ var _a, _b;
194
+ console.error('DialogAction _options is not initialized', (_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom);
195
+ if (((_b = _this._baseDialogAction) === null || _b === void 0 ? void 0 : _b.dialogBaseComponent.parent.accessFrom) === "internal") {
196
+ _this._baseDialogAction.setDisabled(disabled);
197
+ return _this;
198
+ }
199
+ if (_this._options) {
200
+ _this._options.disabled = disabled; // _options'ın başlatıldığını varsayarak erişim
201
+ }
202
+ else {
203
+ console.error('DialogAction _options is not initialized');
204
+ }
205
+ return _this;
206
+ };
207
+ _this.getDisabled = function () {
208
+ var _a;
209
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
210
+ return _this._baseDialogAction.getDisabled();
211
+ }
212
+ return _this._options.disabled;
213
+ };
214
+ _this.isDisabled = function () {
215
+ var _a;
216
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
217
+ return _this._baseDialogAction.isDisabled();
218
+ }
219
+ return _this._options.disabled;
220
+ };
221
+ _this.remove = function () {
222
+ var _a;
223
+ if (((_a = _this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
224
+ _this._baseDialogAction.remove();
225
+ }
226
+ };
227
+ _this.click = function () {
228
+ _this._baseDialogAction.click();
229
+ };
230
+ _this._name = name;
231
+ var defaultOptions = {
232
+ label: 'Button',
233
+ variant: 'contained',
234
+ color: 'default',
235
+ disabled: false,
236
+ prevDisabled: false
237
+ };
238
+ _this._options = __assign(__assign({}, defaultOptions), (options !== null && options !== void 0 ? options : {}));
239
+ return _this;
240
+ }
241
+ Object.defineProperty(DialogAction.prototype, "options", {
242
+ get: function () {
243
+ var _a;
244
+ if (((_a = this._baseDialogAction) === null || _a === void 0 ? void 0 : _a.dialogBaseComponent.parent.accessFrom) === "internal") {
245
+ return this._baseDialogAction.options;
246
+ }
247
+ return this._options;
248
+ },
249
+ enumerable: false,
250
+ configurable: true
251
+ });
252
+ Object.defineProperty(DialogAction.prototype, "name", {
253
+ get: function () {
254
+ return this._name;
255
+ },
256
+ enumerable: false,
257
+ configurable: true
258
+ });
259
+ /**
260
+ * @deprecated
261
+ * @see onClickHandler */
262
+ DialogAction.prototype.getAction = function () {
263
+ return this._onClick;
264
+ };
265
+ Object.defineProperty(DialogAction.prototype, "baseDialogAction", {
266
+ // getStateListener(): TDialogStateListenerForActionCallbackType {
267
+ // return super.getStateListener();
268
+ // }
269
+ set: function (baseDialogAction) {
270
+ this._baseDialogAction = baseDialogAction;
271
+ },
272
+ enumerable: false,
273
+ configurable: true
274
+ });
275
+ return DialogAction;
276
+ }(DialogActionBase_1.default));
277
+ exports.DialogAction = DialogAction;
@@ -0,0 +1,21 @@
1
+ import { MouseEvent } from "react";
2
+ declare class Resizeable {
3
+ onResizeListener: (callbackFn: (width: number, height: number) => void) => void;
4
+ get width(): number;
5
+ get height(): number;
6
+ get isResizing(): boolean;
7
+ private set isResizing(value);
8
+ private _onResizeListener;
9
+ private _isResizing;
10
+ private _container;
11
+ private _width;
12
+ private _height;
13
+ constructor();
14
+ setContainer: (container: HTMLElement) => void;
15
+ private resizeHandleMouseUp;
16
+ resizeHandleMouseDown: () => void;
17
+ resizeHandleMouseMove: (e: MouseEvent) => void;
18
+ init: () => void;
19
+ cleanUp: () => void;
20
+ }
21
+ export default Resizeable;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Resizeable = /** @class */ (function () {
4
+ function Resizeable() {
5
+ var _this = this;
6
+ this.onResizeListener = function (callbackFn) {
7
+ _this._onResizeListener = callbackFn;
8
+ };
9
+ this.setContainer = function (container) {
10
+ _this._container = container;
11
+ };
12
+ this.resizeHandleMouseUp = function () {
13
+ console.log('handleMouseUp', false);
14
+ _this._container.classList.remove('no-select-on-resize');
15
+ _this.isResizing = false;
16
+ };
17
+ this.resizeHandleMouseDown = function () {
18
+ console.log('resizeHandleMouseDown', true);
19
+ _this.isResizing = true;
20
+ _this._container.classList.add('no-select-on-resize');
21
+ _this.init();
22
+ };
23
+ this.resizeHandleMouseMove = function (e) {
24
+ if (!_this.isResizing || !_this._container)
25
+ return;
26
+ if (!_this._container) {
27
+ throw new Error('Please define container');
28
+ }
29
+ var container = _this._container;
30
+ var newWidth = e.clientX - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) + 10;
31
+ var newHeight = e.clientY - (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().top) + 10;
32
+ _this._width = Math.max(newWidth, 100); // Minimum genişlik
33
+ _this._height = Math.max(newHeight, 100); // Minimum yükseklik
34
+ if (typeof _this._onResizeListener === "function") {
35
+ _this._onResizeListener(_this._width, _this._height);
36
+ }
37
+ _this._container.style.width = _this._width + 'px';
38
+ _this._container.style.height = _this._height + 'px';
39
+ };
40
+ this.init = function () {
41
+ if (_this.isResizing) {
42
+ // Fare olay dinleyicilerini ekliyoruz
43
+ // @ts-ignore
44
+ window.addEventListener('mousemove', _this.resizeHandleMouseMove);
45
+ window.addEventListener('mouseup', _this.resizeHandleMouseUp);
46
+ }
47
+ else {
48
+ // Fare olay dinleyicilerini kaldırıyoruz
49
+ // @ts-ignore
50
+ window.removeEventListener('mousemove', _this.resizeHandleMouseMove);
51
+ window.removeEventListener('mouseup', _this.resizeHandleMouseUp);
52
+ }
53
+ };
54
+ this.cleanUp = function () {
55
+ // @ts-ignore
56
+ window.removeEventListener('mousemove', _this.resizeHandleMouseMove);
57
+ window.removeEventListener('mouseup', _this.resizeHandleMouseUp);
58
+ };
59
+ this._isResizing = false;
60
+ }
61
+ Object.defineProperty(Resizeable.prototype, "width", {
62
+ get: function () {
63
+ return this._width;
64
+ },
65
+ enumerable: false,
66
+ configurable: true
67
+ });
68
+ Object.defineProperty(Resizeable.prototype, "height", {
69
+ get: function () {
70
+ return this._height;
71
+ },
72
+ enumerable: false,
73
+ configurable: true
74
+ });
75
+ Object.defineProperty(Resizeable.prototype, "isResizing", {
76
+ get: function () {
77
+ return this._isResizing;
78
+ },
79
+ set: function (value) {
80
+ this._isResizing = value;
81
+ },
82
+ enumerable: false,
83
+ configurable: true
84
+ });
85
+ return Resizeable;
86
+ }());
87
+ exports.default = Resizeable;
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "react-dialogger",
3
+ "version": "1.1.0",
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
+ "main": "index.js",
6
+ "author": "Sueleyman Topaloglu",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "lodash": "^4.17.21",
10
+ "lodash.isequal": "^4.5.0",
11
+ "notistack": "^3.0.2",
12
+ "react": "^18.2.0",
13
+ "react-dom": "^18.2.0",
14
+ "react-draggable": "^4.4.6",
15
+ "react-icons": "^5.5.0"
16
+ },
17
+ "scripts": {
18
+ "pb": "npm version patch && npm publish"
19
+ }
20
+ }
@@ -0,0 +1,42 @@
1
+ .circular-root {
2
+ display: inline-block;
3
+ color: #1976d2;
4
+ -webkit-animation: animation-rotate 1.4s linear infinite;
5
+ animation: animation-rotate 1.4s linear infinite;
6
+ }
7
+ .circular-root .circular {
8
+ display: block;
9
+ width: min-content;
10
+ }
11
+ .circular-root .circular .circular-circle {
12
+ stroke: currentColor;
13
+ stroke-dasharray: 80px, 200px;
14
+ stroke-dashoffset: 0;
15
+ -webkit-animation: animation-snake 1.4s ease-in-out infinite;
16
+ animation: animation-snake 1.4s ease-in-out infinite;
17
+ }
18
+
19
+ @keyframes animation-snake {
20
+ 0% {
21
+ stroke-dasharray: 1px, 200px;
22
+ stroke-dashoffset: 0;
23
+ }
24
+ 50% {
25
+ stroke-dasharray: 100px, 200px;
26
+ stroke-dashoffset: -15px;
27
+ }
28
+ 100% {
29
+ stroke-dasharray: 100px, 200px;
30
+ stroke-dashoffset: -125px;
31
+ }
32
+ }
33
+ @keyframes animation-rotate {
34
+ 0% {
35
+ -ms-transform: rotate(0deg);
36
+ transform: rotate(0deg);
37
+ }
38
+ 100% {
39
+ -ms-transform: rotate(360deg);
40
+ transform: rotate(360deg);
41
+ }
42
+ }