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.
- package/README.md +303 -0
- package/components/CircularProgress.d.ts +8 -0
- package/components/CircularProgress.js +50 -0
- package/components/DialogActionBase.d.ts +44 -0
- package/components/DialogActionBase.js +222 -0
- package/components/DialogBase.d.ts +132 -0
- package/components/DialogBase.js +880 -0
- package/components/Futures/DialogCloseAction.d.ts +3 -0
- package/components/Futures/DialogCloseAction.js +54 -0
- package/components/Futures/DialogFullscreenAction.d.ts +3 -0
- package/components/Futures/DialogFullscreenAction.js +60 -0
- package/components/Futures/DialogHeaderActionsWrapper.d.ts +3 -0
- package/components/Futures/DialogHeaderActionsWrapper.js +11 -0
- package/components/Futures/DialogProcessing.d.ts +3 -0
- package/components/Futures/DialogProcessing.js +41 -0
- package/components/Futures/index.d.ts +4 -0
- package/components/Futures/index.js +11 -0
- package/components/RippleButton.d.ts +15 -0
- package/components/RippleButton.js +81 -0
- package/components/icons/CloseIcon.d.ts +6 -0
- package/components/icons/CloseIcon.js +23 -0
- package/components/icons/FullscreenExitIcon.d.ts +6 -0
- package/components/icons/FullscreenExitIcon.js +23 -0
- package/components/icons/FullscreenIcon.d.ts +6 -0
- package/components/icons/FullscreenIcon.js +23 -0
- package/components/icons/ResizeIcon.d.ts +6 -0
- package/components/icons/ResizeIcon.js +14 -0
- package/hooks/useDialogOptions.d.ts +3 -0
- package/hooks/useDialogOptions.js +82 -0
- package/index.d.ts +8 -0
- package/index.js +25 -0
- package/models/Dialog.d.ts +44 -0
- package/models/Dialog.js +142 -0
- package/models/DialogAction.d.ts +54 -0
- package/models/DialogAction.js +277 -0
- package/models/Resizeable.d.ts +21 -0
- package/models/Resizeable.js +87 -0
- package/package.json +20 -0
- package/styles/circular-progress.css +42 -0
- package/styles/dialog.action.css +234 -0
- package/styles/dialog.css +336 -0
- package/types/DialogActionTypes.d.ts +66 -0
- package/types/DialogActionTypes.js +3 -0
- package/types/DialogTypes.d.ts +128 -0
- package/types/DialogTypes.js +2 -0
- package/types/SizePosTypes.d.ts +5 -0
- package/types/SizePosTypes.js +2 -0
- package/types/index.d.ts +4 -0
- package/types/index.js +2 -0
- package/types/types.d.ts +58 -0
- package/types/types.js +2 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DialogCloseAction = void 0;
|
30
|
+
var CloseIcon_1 = __importDefault(require("../icons/CloseIcon"));
|
31
|
+
var React = __importStar(require("react"));
|
32
|
+
var react_1 = require("react");
|
33
|
+
var DialogBase_1 = require("../DialogBase");
|
34
|
+
// const DialogCloseAction = ({dialog}:{dialog: React.RefObject<IDialogRef> | undefined}) => {
|
35
|
+
// const DialogCloseAction = ({dialog, newProps}:{dialog: IDialogDef | undefined, newProps?: any}) => {
|
36
|
+
var DialogCloseAction = function () {
|
37
|
+
var _a, _b, _c, _d;
|
38
|
+
var dialogHeaderContext = (0, react_1.useContext)(DialogBase_1.DialogHeaderFooterContext);
|
39
|
+
var _dialog = dialogHeaderContext.dialog;
|
40
|
+
// console.log('DialogCloseAction_props', dialogHeaderContext);
|
41
|
+
// return <div className={'close-icon-wrapper'} onClick={event => apiRef.current.close()} >
|
42
|
+
return React.createElement("div", { className: 'close-icon-wrapper', onClick: function (event) {
|
43
|
+
// props.dialog.close()
|
44
|
+
_dialog.close();
|
45
|
+
} },
|
46
|
+
React.createElement(CloseIcon_1.default
|
47
|
+
// size={apiRef.current.dialogOptions.base.headerControllerIcons?.size ?? 24 }
|
48
|
+
// color={apiRef.current.dialogOptions.base.headerControllerIcons?.color ?? null }
|
49
|
+
, {
|
50
|
+
// size={apiRef.current.dialogOptions.base.headerControllerIcons?.size ?? 24 }
|
51
|
+
// color={apiRef.current.dialogOptions.base.headerControllerIcons?.color ?? null }
|
52
|
+
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 }));
|
53
|
+
};
|
54
|
+
exports.DialogCloseAction = DialogCloseAction;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DialogFullscreenAction = void 0;
|
30
|
+
var React = __importStar(require("react"));
|
31
|
+
var FullscreenExitIcon_1 = __importDefault(require("../icons/FullscreenExitIcon"));
|
32
|
+
var FullscreenIcon_1 = __importDefault(require("../icons/FullscreenIcon"));
|
33
|
+
var react_1 = require("react");
|
34
|
+
var DialogBase_1 = require("../DialogBase");
|
35
|
+
// const DialogFullscreenAction = ({dialog}:{dialog: React.RefObject<IDialogRef> | undefined}) => {
|
36
|
+
var DialogFullscreenAction = function () {
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
38
|
+
var dialogHeaderContext = (0, react_1.useContext)(DialogBase_1.DialogHeaderFooterContext);
|
39
|
+
var _dialog = dialogHeaderContext.dialog;
|
40
|
+
return React.createElement("div", { className: 'fullscreen-icon-wrapper', onClick: function (event) {
|
41
|
+
event.stopPropagation();
|
42
|
+
_dialog.switchFullScreen();
|
43
|
+
} }, _dialog.state.fullscreenMode ?
|
44
|
+
React.createElement(FullscreenExitIcon_1.default
|
45
|
+
// size={apiRef.current.dialogOptions.base.headerControllerIcons?.size ?? 24 }
|
46
|
+
// color={apiRef.current.dialogOptions.base.headerControllerIcons?.color ?? null }
|
47
|
+
, {
|
48
|
+
// size={apiRef.current.dialogOptions.base.headerControllerIcons?.size ?? 24 }
|
49
|
+
// color={apiRef.current.dialogOptions.base.headerControllerIcons?.color ?? null }
|
50
|
+
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 })
|
51
|
+
:
|
52
|
+
React.createElement(FullscreenIcon_1.default
|
53
|
+
// size={apiRef.current.dialogOptions.base.headerControllerIcons?.size ?? 24 }
|
54
|
+
// color={apiRef.current.dialogOptions.base.headerControllerIcons?.color ?? null }
|
55
|
+
, {
|
56
|
+
// size={apiRef.current.dialogOptions.base.headerControllerIcons?.size ?? 24 }
|
57
|
+
// color={apiRef.current.dialogOptions.base.headerControllerIcons?.color ?? null }
|
58
|
+
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 }));
|
59
|
+
};
|
60
|
+
exports.DialogFullscreenAction = DialogFullscreenAction;
|
@@ -0,0 +1,11 @@
|
|
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.DialogHeaderActionsWrapper = void 0;
|
7
|
+
var react_1 = __importDefault(require("react"));
|
8
|
+
var DialogHeaderActionsWrapper = function (props) {
|
9
|
+
return (react_1.default.createElement("div", { className: 'header-actions-wrapper' }, props.children));
|
10
|
+
};
|
11
|
+
exports.DialogHeaderActionsWrapper = DialogHeaderActionsWrapper;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
|
+
};
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
+
exports.DialogProcessing = void 0;
|
30
|
+
var CircularProgress_1 = __importDefault(require("../CircularProgress"));
|
31
|
+
var React = __importStar(require("react"));
|
32
|
+
var react_1 = require("react");
|
33
|
+
var DialogBase_1 = require("../DialogBase");
|
34
|
+
var DialogProcessing = function () {
|
35
|
+
var _a, _b, _c;
|
36
|
+
var dialogHeaderContext = (0, react_1.useContext)(DialogBase_1.DialogHeaderFooterContext);
|
37
|
+
var _dialog = dialogHeaderContext.dialog;
|
38
|
+
console.log('_dialog_isInProcess', _dialog.isInProcess());
|
39
|
+
return React.createElement(CircularProgress_1.default, { size: (_a = _dialog.dialogOptions.progress.size) !== null && _a !== void 0 ? _a : 20, inProcess: _dialog.isInProcess(), color: (_c = (_b = _dialog.dialogOptions.progress) === null || _b === void 0 ? void 0 : _b.color) !== null && _c !== void 0 ? _c : '#399aec' });
|
40
|
+
};
|
41
|
+
exports.DialogProcessing = DialogProcessing;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.DialogHeaderActionsWrapper = exports.DialogFullscreenAction = exports.DialogProcessing = exports.DialogCloseAction = void 0;
|
4
|
+
var DialogCloseAction_1 = require("./DialogCloseAction");
|
5
|
+
Object.defineProperty(exports, "DialogCloseAction", { enumerable: true, get: function () { return DialogCloseAction_1.DialogCloseAction; } });
|
6
|
+
var DialogProcessing_1 = require("./DialogProcessing");
|
7
|
+
Object.defineProperty(exports, "DialogProcessing", { enumerable: true, get: function () { return DialogProcessing_1.DialogProcessing; } });
|
8
|
+
var DialogFullscreenAction_1 = require("./DialogFullscreenAction");
|
9
|
+
Object.defineProperty(exports, "DialogFullscreenAction", { enumerable: true, get: function () { return DialogFullscreenAction_1.DialogFullscreenAction; } });
|
10
|
+
var DialogHeaderActionsWrapper_1 = require("./DialogHeaderActionsWrapper");
|
11
|
+
Object.defineProperty(exports, "DialogHeaderActionsWrapper", { enumerable: true, get: function () { return DialogHeaderActionsWrapper_1.DialogHeaderActionsWrapper; } });
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { CSSProperties, ReactComponentElement } from "react";
|
3
|
+
import { TBVariant, TBColor } from '../types/DialogActionTypes';
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
5
|
+
variant: TBVariant;
|
6
|
+
color: TBColor;
|
7
|
+
children: (buttonRef: HTMLButtonElement) => string | ReactComponentElement<any>;
|
8
|
+
disabled: boolean;
|
9
|
+
onClick: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
10
|
+
innerRef: React.RefObject<any>;
|
11
|
+
style?: CSSProperties;
|
12
|
+
baseStyle?: CSSProperties;
|
13
|
+
fontFamily?: string;
|
14
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
15
|
+
export default _default;
|
@@ -0,0 +1,81 @@
|
|
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 (mod) {
|
30
|
+
if (mod && mod.__esModule) return mod;
|
31
|
+
var result = {};
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
+
__setModuleDefault(result, mod);
|
34
|
+
return result;
|
35
|
+
};
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
37
|
+
var React = __importStar(require("react"));
|
38
|
+
var react_1 = require("react");
|
39
|
+
exports.default = React.forwardRef(function (_a, ref) {
|
40
|
+
var variant = _a.variant, color = _a.color, children = _a.children, disabled = _a.disabled, onClick = _a.onClick, style = _a.style, baseStyle = _a.baseStyle, innerRef = _a.innerRef, fontFamily = _a.fontFamily;
|
41
|
+
var _b = React.useState({ x: -1, y: -1 }), coords = _b[0], setCoords = _b[1];
|
42
|
+
var _c = React.useState(false), isRippling = _c[0], setIsRippling = _c[1];
|
43
|
+
// const buttonRef = React.useRef<HTMLButtonElement>(null)
|
44
|
+
React.useEffect(function () {
|
45
|
+
if (coords.x !== -1 && coords.y !== -1) {
|
46
|
+
setIsRippling(true);
|
47
|
+
setTimeout(function () { return setIsRippling(false); }, 300);
|
48
|
+
}
|
49
|
+
else
|
50
|
+
setIsRippling(false);
|
51
|
+
}, [coords]);
|
52
|
+
React.useEffect(function () {
|
53
|
+
if (!isRippling)
|
54
|
+
setCoords({ x: -1, y: -1 });
|
55
|
+
}, [isRippling]);
|
56
|
+
var rippleEffect = function (refButton, x, y) {
|
57
|
+
// const rect = refButton.current.getBoundingClientRect();
|
58
|
+
refButton.current.style.opacity = '.5';
|
59
|
+
setTimeout(function () {
|
60
|
+
refButton.current.style.opacity = '1';
|
61
|
+
}, 150);
|
62
|
+
// setCoords({ x: rect.x + rect.width / 2, y: rect.y + rect.height / 2 });
|
63
|
+
// setCoords({ x: rect.x, y: rect.y });
|
64
|
+
};
|
65
|
+
(0, react_1.useImperativeHandle)(innerRef, function () { return ({
|
66
|
+
rippleEffect: rippleEffect
|
67
|
+
}); });
|
68
|
+
console.log('Ripple_button_style', style);
|
69
|
+
return (React.createElement("button", {
|
70
|
+
// ref={buttonRef}
|
71
|
+
ref: ref, disabled: disabled, className: "ripple-button ripple-button-".concat(variant, " ripple-button-").concat(color, " ").concat(disabled ? 'ripple-button-disabled' : ''), onClick: function (e) {
|
72
|
+
//@ts-ignore
|
73
|
+
var rect = e.target.getBoundingClientRect();
|
74
|
+
setCoords({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
75
|
+
setTimeout(function () {
|
76
|
+
onClick && onClick(e);
|
77
|
+
}, 200);
|
78
|
+
}, style: __assign(__assign(__assign({}, baseStyle), style), { fontFamily: fontFamily }) },
|
79
|
+
isRippling && React.createElement("span", { className: "ripple", style: { left: coords.x, top: coords.y } }),
|
80
|
+
React.createElement("span", { className: "content" }, children(ref.current))));
|
81
|
+
});
|
@@ -0,0 +1,23 @@
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
var react_1 = __importDefault(require("react"));
|
18
|
+
exports.default = (function (_a) {
|
19
|
+
var size = _a.size, color = _a.color;
|
20
|
+
return react_1.default.createElement("div", { className: 'close-icon', style: __assign({ fill: color }, size ? { width: size } : null) },
|
21
|
+
react_1.default.createElement("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "CloseIcon" },
|
22
|
+
react_1.default.createElement("path", { d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" })));
|
23
|
+
});
|
@@ -0,0 +1,23 @@
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
var react_1 = __importDefault(require("react"));
|
18
|
+
exports.default = (function (_a) {
|
19
|
+
var size = _a.size, color = _a.color;
|
20
|
+
return react_1.default.createElement("div", { className: 'fullscreen-exit-icon', style: __assign({ fill: color }, size ? { width: size } : null) },
|
21
|
+
react_1.default.createElement("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "FullscreenExitIcon" },
|
22
|
+
react_1.default.createElement("path", { d: "M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z" })));
|
23
|
+
});
|
@@ -0,0 +1,23 @@
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
var react_1 = __importDefault(require("react"));
|
18
|
+
exports.default = (function (_a) {
|
19
|
+
var size = _a.size, color = _a.color;
|
20
|
+
return react_1.default.createElement("div", { className: 'fullscreen-icon', style: __assign({ fill: color }, size ? { width: size } : null) },
|
21
|
+
react_1.default.createElement("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "FullscreenIcon", color: color },
|
22
|
+
react_1.default.createElement("path", { d: "M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z" })));
|
23
|
+
});
|
@@ -0,0 +1,14 @@
|
|
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
|
+
var react_1 = __importDefault(require("react"));
|
7
|
+
exports.default = (function (_a) {
|
8
|
+
var size = _a.size, color = _a.color;
|
9
|
+
return react_1.default.createElement("div", { className: 'resizable-handle-icon', style: {
|
10
|
+
fill: color
|
11
|
+
} },
|
12
|
+
react_1.default.createElement("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ArrowBackIosNewIcon" },
|
13
|
+
react_1.default.createElement("path", { d: "M17.77 3.77 16 2 6 12l10 10 1.77-1.77L9.54 12z" })));
|
14
|
+
});
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useDialogOptions = void 0;
|
4
|
+
var initialOptions = {
|
5
|
+
backdrop: {
|
6
|
+
backgroundColor: '#282828',
|
7
|
+
opacity: .6,
|
8
|
+
hideOnClick: false
|
9
|
+
},
|
10
|
+
base: {
|
11
|
+
style: {
|
12
|
+
backgroundColor: "white",
|
13
|
+
boxShadow: '0 0 20px #000000'
|
14
|
+
},
|
15
|
+
closeable: false,
|
16
|
+
initialAnchor: { vertical: "center", horizontal: "center" },
|
17
|
+
draggable: false
|
18
|
+
},
|
19
|
+
progress: {
|
20
|
+
color: 'red',
|
21
|
+
size: 30
|
22
|
+
},
|
23
|
+
snackbar: {
|
24
|
+
anchorOrigin: { vertical: "top", horizontal: "center" },
|
25
|
+
autoHideDuration: 3000,
|
26
|
+
maxSnack: 3,
|
27
|
+
busyMessage: 'Please wait...'
|
28
|
+
},
|
29
|
+
slot: {
|
30
|
+
action: null
|
31
|
+
},
|
32
|
+
slotProps: {
|
33
|
+
action: {}
|
34
|
+
}
|
35
|
+
};
|
36
|
+
window["dialogOptions"] = initialOptions;
|
37
|
+
var useDialogOptions = (function (options) {
|
38
|
+
var _a, _b;
|
39
|
+
var _dialogOptions = window["dialogOptions"];
|
40
|
+
if (options.backdrop) {
|
41
|
+
Object.keys(options.backdrop).forEach(function (objectKey) {
|
42
|
+
_dialogOptions.backdrop[objectKey] = options.backdrop[objectKey];
|
43
|
+
});
|
44
|
+
}
|
45
|
+
if (options.base) {
|
46
|
+
Object.keys(options.base).forEach(function (objectKey) {
|
47
|
+
_dialogOptions.base[objectKey] = options.base[objectKey];
|
48
|
+
});
|
49
|
+
}
|
50
|
+
if (options.progress) {
|
51
|
+
Object.keys(options.progress).forEach(function (objectKey) {
|
52
|
+
_dialogOptions.progress[objectKey] = options.progress[objectKey];
|
53
|
+
});
|
54
|
+
}
|
55
|
+
if (options.snackbar) {
|
56
|
+
Object.keys(options.snackbar).forEach(function (objectKey) {
|
57
|
+
_dialogOptions.snackbar[objectKey] = options.snackbar[objectKey];
|
58
|
+
});
|
59
|
+
}
|
60
|
+
if (options.slot) {
|
61
|
+
Object.keys((_a = options === null || options === void 0 ? void 0 : options.slot) !== null && _a !== void 0 ? _a : {}).forEach(function (objectKey) {
|
62
|
+
_dialogOptions.slot[objectKey] = options.slot[objectKey];
|
63
|
+
});
|
64
|
+
}
|
65
|
+
if (options.slotProps) {
|
66
|
+
console.log('options', options);
|
67
|
+
Object.keys((_b = options === null || options === void 0 ? void 0 : options.slotProps) !== null && _b !== void 0 ? _b : {}).forEach(function (objectKey) {
|
68
|
+
_dialogOptions.slotProps[objectKey] = options.slotProps[objectKey];
|
69
|
+
});
|
70
|
+
}
|
71
|
+
/*const existsEl = document.querySelector('script#ais_react_dialog_options');
|
72
|
+
if(existsEl) return;
|
73
|
+
const scriptElement = document.createElement('script');
|
74
|
+
scriptElement.id = 'ais_react_dialog_options';
|
75
|
+
// Set the script source or include the script content
|
76
|
+
scriptElement.textContent = 'const dialogOptions = ' + JSON.stringify(dialogOptions); // Or set the content: scriptElement.textContent = '...';
|
77
|
+
// Append the script element to the head of the document
|
78
|
+
document.head.appendChild(scriptElement);
|
79
|
+
*/
|
80
|
+
window["dialogOptions"] = _dialogOptions;
|
81
|
+
});
|
82
|
+
exports.useDialogOptions = useDialogOptions;
|
package/index.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
import './styles/dialog.scss';
|
2
|
+
import './styles/dialog.action.scss';
|
3
|
+
import './styles/circular-progress.scss';
|
4
|
+
export { default as Dialog } from "./models/Dialog";
|
5
|
+
export { default } from "./models/Dialog";
|
6
|
+
export { DialogProcessing, DialogCloseAction, DialogFullscreenAction, DialogHeaderActionsWrapper } from "./components/Futures";
|
7
|
+
export { DialogAction, ActionProgress } from "./models/DialogAction";
|
8
|
+
export { useDialogOptions } from "./hooks/useDialogOptions";
|
package/index.js
ADDED
@@ -0,0 +1,25 @@
|
|
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.useDialogOptions = exports.ActionProgress = exports.DialogAction = exports.DialogHeaderActionsWrapper = exports.DialogFullscreenAction = exports.DialogCloseAction = exports.DialogProcessing = exports.default = exports.Dialog = void 0;
|
7
|
+
require("./styles/dialog.css");
|
8
|
+
require("./styles/dialog.action.css");
|
9
|
+
require("./styles/circular-progress.css");
|
10
|
+
// Models
|
11
|
+
var Dialog_1 = require("./models/Dialog");
|
12
|
+
Object.defineProperty(exports, "Dialog", { enumerable: true, get: function () { return __importDefault(Dialog_1).default; } });
|
13
|
+
var Dialog_2 = require("./models/Dialog");
|
14
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Dialog_2).default; } });
|
15
|
+
var Futures_1 = require("./components/Futures");
|
16
|
+
Object.defineProperty(exports, "DialogProcessing", { enumerable: true, get: function () { return Futures_1.DialogProcessing; } });
|
17
|
+
Object.defineProperty(exports, "DialogCloseAction", { enumerable: true, get: function () { return Futures_1.DialogCloseAction; } });
|
18
|
+
Object.defineProperty(exports, "DialogFullscreenAction", { enumerable: true, get: function () { return Futures_1.DialogFullscreenAction; } });
|
19
|
+
Object.defineProperty(exports, "DialogHeaderActionsWrapper", { enumerable: true, get: function () { return Futures_1.DialogHeaderActionsWrapper; } });
|
20
|
+
var DialogAction_1 = require("./models/DialogAction");
|
21
|
+
Object.defineProperty(exports, "DialogAction", { enumerable: true, get: function () { return DialogAction_1.DialogAction; } });
|
22
|
+
Object.defineProperty(exports, "ActionProgress", { enumerable: true, get: function () { return DialogAction_1.ActionProgress; } });
|
23
|
+
// Hooks
|
24
|
+
var useDialogOptions_1 = require("./hooks/useDialogOptions");
|
25
|
+
Object.defineProperty(exports, "useDialogOptions", { enumerable: true, get: function () { return useDialogOptions_1.useDialogOptions; } });
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import { DialogAction } from "./DialogAction";
|
3
|
+
import DialogBase from "../components/DialogBase";
|
4
|
+
import { TInitialHolder, TAccessFrom, ComponentOrderPositions, ISnackbarAnchor, DialogValues } from "../types/types";
|
5
|
+
import { IDialogSize, TDialogStateListenerCallbackType, DialogOptionsType, IDialogDef, TDialogCallbackNodeFn, TDialogCallbackVoidFn } from "../types/DialogTypes";
|
6
|
+
declare class Dialog extends DialogBase {
|
7
|
+
constructor(dialogRef?: React.RefObject<IDialogDef | undefined | null> | null, options?: DialogOptionsType);
|
8
|
+
/**
|
9
|
+
* @deprecated
|
10
|
+
* @see dialogOptions.snackbar.anchorOrigin */
|
11
|
+
snackbarAnchor(anchor?: ISnackbarAnchor): this;
|
12
|
+
set accessFrom(accessFrom: TAccessFrom);
|
13
|
+
get accessFrom(): TAccessFrom;
|
14
|
+
setHeader(header: TDialogCallbackNodeFn): this;
|
15
|
+
setBody(body: TDialogCallbackNodeFn): this;
|
16
|
+
addActions(actions: Array<DialogAction>): this;
|
17
|
+
addAction(action: DialogAction): this;
|
18
|
+
/**
|
19
|
+
* Only from init */
|
20
|
+
stateListener(listener: TDialogStateListenerCallbackType): this;
|
21
|
+
/** @deprecated use Dialog Options */
|
22
|
+
setSize: (size: IDialogSize) => this;
|
23
|
+
/**
|
24
|
+
* @deprecated
|
25
|
+
* @info Dialog ordering after of before Reference Dom Element
|
26
|
+
* This method is deprecated and will be removed in a future release.
|
27
|
+
* Please use an alternative approach for setting dialog ordering or layout.
|
28
|
+
* The dialog ordering functionality will be managed differently in future versions.
|
29
|
+
*/
|
30
|
+
setOrder: (position: ComponentOrderPositions, component: HTMLElement) => this;
|
31
|
+
/**
|
32
|
+
* @deprecated
|
33
|
+
* @link initialValues */
|
34
|
+
initialState(state: {
|
35
|
+
[k: string]: any;
|
36
|
+
}): this;
|
37
|
+
initialValues(values: DialogValues): this;
|
38
|
+
initialHolder(holder: TInitialHolder): this;
|
39
|
+
getDom: () => HTMLDivElement;
|
40
|
+
onClose(callback: () => void): this;
|
41
|
+
keyboardListener(listener: (key: string, dialog: IDialogDef) => void): this;
|
42
|
+
show: (callback?: TDialogCallbackVoidFn) => void;
|
43
|
+
}
|
44
|
+
export default Dialog;
|