tenjin-ui-kit 0.3.72-dev-1 → 0.3.73
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/common/hooks/apiHooks.js +91 -199
- package/common/hooks/newApiHook.js +127 -258
- package/common/utils/security/index.js +2 -2
- package/common/utils/security/securityConfig.js +1 -2
- package/components/Canvas.js +172 -101
- package/components/DragBox/index.js +21 -31
- package/components/InputWithChip/index.js +178 -83
- package/components/RightContext/index.js +17 -41
- package/components/WorkFlow.js +19 -29
- package/components/WorkFlowBuilder.js +32 -56
- package/components/alert/Style.js +11 -14
- package/components/alert/index.js +8 -14
- package/components/attachment/index.js +26 -31
- package/components/authenticationProvider/AuthError.js +3 -4
- package/components/authenticationProvider/AuthLoader.js +3 -4
- package/components/authenticationProvider/index.js +58 -130
- package/components/avatar/index.js +24 -23
- package/components/avatar/styles.js +76 -77
- package/components/breadCrumbs/index.js +64 -89
- package/components/breadCrumbs/style.js +1 -4
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +7 -6
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +7 -6
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +8 -7
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +8 -7
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +16 -19
- package/components/browsingTestCaseLayout/index.js +30 -46
- package/components/button/index.js +47 -58
- package/components/chatBotModal/index.js +40 -61
- package/components/checkBox/index.js +8 -10
- package/components/combobox/index.js +66 -100
- package/components/divider/index.js +9 -18
- package/components/editableField/index.js +19 -46
- package/components/error/index.js +6 -12
- package/components/errorBoundary/index.js +74 -98
- package/components/fileUploader/index.js +46 -58
- package/components/fileUploader/style.js +46 -49
- package/components/filter/ValueSelector.js +149 -245
- package/components/filter/index.js +45 -71
- package/components/iconButton/index.js +3 -4
- package/components/input/index.js +60 -74
- package/components/layout/index.js +36 -49
- package/components/layout/main/index.js +13 -14
- package/components/layout/main/style.js +11 -14
- package/components/layout/pageContent/index.js +8 -7
- package/components/layout/sidebar/FlatMenu.js +51 -47
- package/components/layout/sidebar/GroupedIconMenu.js +169 -194
- package/components/layout/sidebar/GroupedMenu.js +45 -50
- package/components/layout/sidebar/ProjectMenu.js +165 -185
- package/components/layout/sidebar/index.js +27 -26
- package/components/layout/sidebar/style.js +138 -143
- package/components/layout/topBar/ProjectTopbar.js +91 -208
- package/components/layout/topBar/UserAvatar.js +53 -69
- package/components/layout/topBar/index.js +23 -41
- package/components/loader/index.js +9 -12
- package/components/menu/index.js +23 -42
- package/components/modal/Modal.js +5 -6
- package/components/modal/index.js +16 -20
- package/components/modal/style.js +53 -56
- package/components/optionMenu/index.js +32 -47
- package/components/pagination/index.js +23 -43
- package/components/pagination/style.js +25 -28
- package/components/paginationUpdated/index.js +22 -29
- package/components/paper/index.js +20 -22
- package/components/paper/style.js +24 -27
- package/components/reactSelect/index.js +64 -97
- package/components/reactSelect/style.js +131 -151
- package/components/richTextEditor/index.js +24 -48
- package/components/select/GroupedSelect.js +96 -99
- package/components/select/SimpleSelect.js +61 -103
- package/components/select/index.js +56 -69
- package/components/simpleSelect/index.js +18 -22
- package/components/sort/index.js +23 -36
- package/components/switch/index.js +14 -15
- package/components/switch/style.js +29 -32
- package/components/switch/switch.js +30 -47
- package/components/table/ReactTable.js +59 -83
- package/components/table/SimpleTable.js +67 -91
- package/components/table/index.js +300 -206
- package/components/text/index.js +22 -30
- package/components/timeStamp/index.js +4 -9
- package/components/timeStamp/style.js +12 -15
- package/components/topBar/index.js +86 -102
- package/components/tree/index.js +30 -58
- package/components/tree/style.js +20 -23
- package/components/valuePicker/ValueSelector.js +78 -160
- package/components/valuePicker/index.js +30 -50
- package/components/wrapperLayout/layout/index.js +8 -7
- package/components/wrapperLayout/main/index.js +8 -7
- package/components/wrapperLayout/main/pageContainer/index.js +6 -5
- package/components/wrapperLayout/main/sideBar/index.js +171 -175
- package/components/wrapperLayout/main/sideBar/style.js +177 -183
- package/components/wrapperLayout/topBar/UserAvatar.js +6 -5
- package/components/wrapperLayout/topBar/avatar.js +15 -18
- package/components/wrapperLayout/topBar/index.js +115 -107
- package/components/wrapperLayout/topBar/menuIcon.js +6 -5
- package/components/wrapperLayout/topBar/style.js +63 -64
- package/http/index.js +92 -188
- package/index.js +53 -55
- package/package.json +3 -3
- package/templates/listPage/index.js +168 -196
- package/themes/default.js +5 -7
- package/themes/defaultSmall.js +2 -3
- package/themes/responsiveTheme.js +6 -8
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -15,65 +14,53 @@ var _material = require("@mui/material");
|
|
|
15
14
|
var _bs = require("react-icons/bs");
|
|
16
15
|
var _iconButton = _interopRequireDefault(require("../iconButton"));
|
|
17
16
|
var _text = _interopRequireDefault(require("../text"));
|
|
18
|
-
function _interopRequireDefault(
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
leftHandle = _ref.leftHandle,
|
|
32
|
-
onlyRightHandle = _ref.onlyRightHandle,
|
|
33
|
-
leftHandelerDetails = _ref.leftHandelerDetails;
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
20
|
+
|
|
21
|
+
const BrowsingTestCaseLayout = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
collapse,
|
|
24
|
+
hasExtraContent,
|
|
25
|
+
children,
|
|
26
|
+
leftHandle,
|
|
27
|
+
onlyRightHandle,
|
|
28
|
+
leftHandelerDetails
|
|
29
|
+
} = _ref;
|
|
34
30
|
// return <div className="browsing-test-case-layout">{children}</div>;
|
|
35
31
|
// console.log("Browser", children);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
boxAWidth = _useState4[0],
|
|
43
|
-
setBoxAWidth = _useState4[1];
|
|
44
|
-
var _useState5 = (0, _react.useState)(true),
|
|
45
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
46
|
-
expand = _useState6[0],
|
|
47
|
-
setExpand = _useState6[1];
|
|
48
|
-
var wrapperRef = (0, _react.useRef)(null);
|
|
49
|
-
var boxARef = (0, _react.useRef)(null);
|
|
50
|
-
var handleMouseDown = function handleMouseDown(e) {
|
|
32
|
+
const [isHandlerDragging, setIsHandlerDragging] = (0, _react.useState)(false);
|
|
33
|
+
const [boxAWidth, setBoxAWidth] = (0, _react.useState)(200);
|
|
34
|
+
const [expand, setExpand] = (0, _react.useState)(true);
|
|
35
|
+
const wrapperRef = (0, _react.useRef)(null);
|
|
36
|
+
const boxARef = (0, _react.useRef)(null);
|
|
37
|
+
const handleMouseDown = e => {
|
|
51
38
|
setIsHandlerDragging(true);
|
|
52
39
|
};
|
|
53
|
-
|
|
40
|
+
const handleMouseMove = e => {
|
|
54
41
|
if (!isHandlerDragging) {
|
|
55
42
|
return false;
|
|
56
43
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
const containerOffsetLeft = wrapperRef.current.offsetLeft;
|
|
45
|
+
const pointerRelativeXpos = e.clientX - containerOffsetLeft;
|
|
46
|
+
const boxAminWidth = 60;
|
|
60
47
|
setBoxAWidth(Math.max(boxAminWidth, pointerRelativeXpos - 8));
|
|
61
48
|
};
|
|
62
|
-
|
|
49
|
+
const handleMouseUp = e => {
|
|
63
50
|
setIsHandlerDragging(false);
|
|
64
51
|
};
|
|
65
|
-
_react.default.useEffect(
|
|
52
|
+
_react.default.useEffect(() => {
|
|
66
53
|
if (collapse) {
|
|
67
54
|
setExpand(false);
|
|
68
55
|
} else {
|
|
69
56
|
setExpand(true);
|
|
70
57
|
}
|
|
71
58
|
}, [collapse]);
|
|
72
|
-
_react.default.useEffect(
|
|
59
|
+
_react.default.useEffect(() => {
|
|
73
60
|
if (expand) {
|
|
74
61
|
document.addEventListener("mousemove", handleMouseMove);
|
|
75
62
|
document.addEventListener("mouseup", handleMouseUp);
|
|
76
|
-
return
|
|
63
|
+
return () => {
|
|
77
64
|
document.removeEventListener("mousemove", handleMouseMove);
|
|
78
65
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
79
66
|
};
|
|
@@ -81,7 +68,7 @@ var BrowsingTestCaseLayout = function BrowsingTestCaseLayout(_ref) {
|
|
|
81
68
|
setBoxAWidth(50);
|
|
82
69
|
}
|
|
83
70
|
}, [isHandlerDragging, expand]);
|
|
84
|
-
document.documentElement.style.setProperty("--box-width",
|
|
71
|
+
document.documentElement.style.setProperty("--box-width", `${boxAWidth}px`);
|
|
85
72
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
86
73
|
class: "wrapper",
|
|
87
74
|
ref: wrapperRef
|
|
@@ -123,9 +110,7 @@ var BrowsingTestCaseLayout = function BrowsingTestCaseLayout(_ref) {
|
|
|
123
110
|
height: "20px"
|
|
124
111
|
}
|
|
125
112
|
}),
|
|
126
|
-
onClick:
|
|
127
|
-
return setExpand(!expand);
|
|
128
|
-
}
|
|
113
|
+
onClick: () => setExpand(!expand)
|
|
129
114
|
}), " "), /*#__PURE__*/_react.default.createElement("div", {
|
|
130
115
|
class: "handler",
|
|
131
116
|
onMouseDown: handleMouseDown
|
|
@@ -183,5 +168,4 @@ BrowsingTestCaseLayout.TreeViewContent = _Index.default;
|
|
|
183
168
|
BrowsingTestCaseLayout.TreeViewHeader = _Index2.default;
|
|
184
169
|
BrowsingTestCaseLayout.DetailsViewContent = _DetailsViewContent.default;
|
|
185
170
|
BrowsingTestCaseLayout.DetailsViewHeader = _DetailsViewHeader.default;
|
|
186
|
-
var _default = BrowsingTestCaseLayout;
|
|
187
|
-
exports.default = _default;
|
|
171
|
+
var _default = exports.default = BrowsingTestCaseLayout;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -11,51 +10,44 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
|
|
13
12
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
14
|
-
var
|
|
15
|
-
function
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
color = props.color,
|
|
34
|
-
fixedWidth = props.fixedWidth,
|
|
35
|
-
type = props.type;
|
|
36
|
-
var _ = props.loading,
|
|
37
|
-
propsSansLoading = _objectWithoutProperties(props, _excluded);
|
|
38
|
-
var handleClick = function handleClick(e) {
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
const Button = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
loading,
|
|
19
|
+
loadingText,
|
|
20
|
+
children,
|
|
21
|
+
size,
|
|
22
|
+
onClick,
|
|
23
|
+
color,
|
|
24
|
+
fixedWidth,
|
|
25
|
+
type
|
|
26
|
+
} = props;
|
|
27
|
+
const {
|
|
28
|
+
loading: _,
|
|
29
|
+
...propsSansLoading
|
|
30
|
+
} = props;
|
|
31
|
+
const handleClick = e => {
|
|
39
32
|
if (loading) {
|
|
40
33
|
e.preventDefault();
|
|
41
34
|
} else {
|
|
42
35
|
onClick && onClick(e);
|
|
43
36
|
}
|
|
44
37
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var handleMenuClick = function handleMenuClick(event) {
|
|
38
|
+
const {
|
|
39
|
+
menuItems,
|
|
40
|
+
setSelectedMenu
|
|
41
|
+
} = props;
|
|
42
|
+
const [anchorEl, setAnchorEl] = _react.default.useState(null);
|
|
43
|
+
const open = Boolean(anchorEl);
|
|
44
|
+
const handleMenuClick = event => {
|
|
53
45
|
setAnchorEl(event.currentTarget);
|
|
54
46
|
};
|
|
55
|
-
|
|
47
|
+
const handleClose = e => {
|
|
56
48
|
setAnchorEl(null);
|
|
57
49
|
};
|
|
58
|
-
|
|
50
|
+
const handleMenuItemClick = value => {
|
|
59
51
|
setSelectedMenu(value);
|
|
60
52
|
handleClose();
|
|
61
53
|
};
|
|
@@ -77,24 +69,20 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
77
69
|
id: "basic-menu",
|
|
78
70
|
anchorEl: anchorEl,
|
|
79
71
|
open: open,
|
|
80
|
-
onClose:
|
|
81
|
-
return handleClose(e);
|
|
82
|
-
},
|
|
72
|
+
onClose: e => handleClose(e),
|
|
83
73
|
MenuListProps: {
|
|
84
74
|
"aria-labelledby": "basic-button"
|
|
85
75
|
},
|
|
86
76
|
sx: {
|
|
87
77
|
mt: "0.7rem"
|
|
88
78
|
}
|
|
89
|
-
}, menuItems &&
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, item.item);
|
|
97
|
-
})))) : /*#__PURE__*/_react.default.createElement(_material.Button, _extends({
|
|
79
|
+
}, menuItems && menuItems?.map((item, key) => /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
|
|
80
|
+
onClick: e => {
|
|
81
|
+
handleClose(e);
|
|
82
|
+
handleMenuItemClick(item);
|
|
83
|
+
},
|
|
84
|
+
key: item.item
|
|
85
|
+
}, item.item)))) : /*#__PURE__*/_react.default.createElement(_material.Button, _extends({
|
|
98
86
|
ref: ref,
|
|
99
87
|
onClick: handleClick
|
|
100
88
|
}, props, {
|
|
@@ -106,16 +94,18 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
106
94
|
size: size,
|
|
107
95
|
loadingText: loadingText
|
|
108
96
|
}), loadingText && {
|
|
109
|
-
loadingText
|
|
97
|
+
loadingText
|
|
110
98
|
}) : children));
|
|
111
99
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
100
|
+
const ButtonLoader = _ref => {
|
|
101
|
+
let {
|
|
102
|
+
buttonColor,
|
|
103
|
+
size,
|
|
104
|
+
loadingText
|
|
105
|
+
} = _ref;
|
|
106
|
+
const theme = (0, _styles.useTheme)();
|
|
107
|
+
const resolvedButtonColor = theme.palette[buttonColor] ? theme.palette[buttonColor].main : theme.palette.primary.main;
|
|
108
|
+
const textColor = theme.palette.getContrastText(resolvedButtonColor);
|
|
119
109
|
return /*#__PURE__*/_react.default.createElement(_material.CircularProgress, {
|
|
120
110
|
size: size === "small" ? 20 : size === "large" ? 24 : 22,
|
|
121
111
|
sx: {
|
|
@@ -136,5 +126,4 @@ Button.propTypes = {
|
|
|
136
126
|
onClick: _propTypes.default.func,
|
|
137
127
|
color: _propTypes.default.string
|
|
138
128
|
};
|
|
139
|
-
var _default = Button;
|
|
140
|
-
exports.default = _default;
|
|
129
|
+
var _default = exports.default = Button;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -13,34 +12,24 @@ var _fa = require("react-icons/fa");
|
|
|
13
12
|
var _fi = require("react-icons/fi");
|
|
14
13
|
var _input = _interopRequireDefault(require("../input"));
|
|
15
14
|
var _text = _interopRequireDefault(require("../text"));
|
|
16
|
-
function _interopRequireDefault(
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var _useState = (0, _react.useState)(false),
|
|
35
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
-
isFullscreen = _useState2[0],
|
|
37
|
-
setIsFullscreen = _useState2[1];
|
|
38
|
-
var messagesEndRef = (0, _react.useRef)(null);
|
|
39
|
-
var theme = (0, _material.useTheme)();
|
|
40
|
-
var isNotExpanded = (0, _material.useMediaQuery)(theme === null || theme === void 0 ? void 0 : (_theme$breakpoints = theme.breakpoints) === null || _theme$breakpoints === void 0 ? void 0 : _theme$breakpoints.down("sm"));
|
|
41
|
-
(0, _react.useEffect)(function () {
|
|
42
|
-
var _messagesEndRef$curre;
|
|
43
|
-
messagesEndRef === null || messagesEndRef === void 0 ? void 0 : (_messagesEndRef$curre = messagesEndRef.current) === null || _messagesEndRef$curre === void 0 ? void 0 : _messagesEndRef$curre.scrollIntoView({
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
+
const ChatBotModal = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
open,
|
|
20
|
+
onClose,
|
|
21
|
+
messages,
|
|
22
|
+
inputValue,
|
|
23
|
+
setInputValue,
|
|
24
|
+
handleSend,
|
|
25
|
+
loading
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [isFullscreen, setIsFullscreen] = (0, _react.useState)(false);
|
|
28
|
+
const messagesEndRef = (0, _react.useRef)(null);
|
|
29
|
+
const theme = (0, _material.useTheme)();
|
|
30
|
+
const isNotExpanded = (0, _material.useMediaQuery)(theme?.breakpoints?.down("sm"));
|
|
31
|
+
(0, _react.useEffect)(() => {
|
|
32
|
+
messagesEndRef?.current?.scrollIntoView({
|
|
44
33
|
behavior: "smooth"
|
|
45
34
|
});
|
|
46
35
|
}, [messages]);
|
|
@@ -104,11 +93,7 @@ var ChatBotModal = function ChatBotModal(_ref) {
|
|
|
104
93
|
variant: "h6",
|
|
105
94
|
semibold: true
|
|
106
95
|
}, "Chat with Tenjin"), /*#__PURE__*/_react.default.createElement(_material.Box, null, /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
107
|
-
onClick:
|
|
108
|
-
return setIsFullscreen(function (prev) {
|
|
109
|
-
return !prev;
|
|
110
|
-
});
|
|
111
|
-
},
|
|
96
|
+
onClick: () => setIsFullscreen(prev => !prev),
|
|
112
97
|
size: "small"
|
|
113
98
|
}, isFullscreen ? /*#__PURE__*/_react.default.createElement(_fi.FiMinimize, null) : /*#__PURE__*/_react.default.createElement(_fa.FaExpand, null)), /*#__PURE__*/_react.default.createElement(_material.IconButton, {
|
|
114
99
|
onClick: onClose,
|
|
@@ -126,24 +111,22 @@ var ChatBotModal = function ChatBotModal(_ref) {
|
|
|
126
111
|
position: "relative",
|
|
127
112
|
zIndex: 1
|
|
128
113
|
}
|
|
129
|
-
}, messages
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, msg.text);
|
|
146
|
-
}), loading && /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
114
|
+
}, messages?.map((msg, idx) => /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
115
|
+
key: idx,
|
|
116
|
+
sx: {
|
|
117
|
+
alignSelf: msg.sender === "user" ? "flex-end" : "flex-start",
|
|
118
|
+
backgroundColor: "#f5f5f5",
|
|
119
|
+
color: "#000",
|
|
120
|
+
px: 2,
|
|
121
|
+
py: 1,
|
|
122
|
+
borderRadius: 2,
|
|
123
|
+
boxShadow: 1,
|
|
124
|
+
maxWidth: "80%",
|
|
125
|
+
fontSize: "0.9rem",
|
|
126
|
+
wordBreak: "break-word",
|
|
127
|
+
whiteSpace: "pre-wrap"
|
|
128
|
+
}
|
|
129
|
+
}, msg.text)), loading && /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
147
130
|
sx: {
|
|
148
131
|
alignSelf: "flex-start",
|
|
149
132
|
backgroundColor: "#f5f5f5",
|
|
@@ -175,12 +158,9 @@ var ChatBotModal = function ChatBotModal(_ref) {
|
|
|
175
158
|
fullWidth: true,
|
|
176
159
|
placeholder: "Type your message...",
|
|
177
160
|
value: inputValue,
|
|
178
|
-
onChange:
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
onKeyDown: function onKeyDown(e) {
|
|
183
|
-
if ((e === null || e === void 0 ? void 0 : e.key) === "Enter") handleSend();
|
|
161
|
+
onChange: e => setInputValue(e?.target?.value),
|
|
162
|
+
onKeyDown: e => {
|
|
163
|
+
if (e?.key === "Enter") handleSend();
|
|
184
164
|
},
|
|
185
165
|
sx: {
|
|
186
166
|
fontSize: "0.9rem",
|
|
@@ -193,8 +173,7 @@ var ChatBotModal = function ChatBotModal(_ref) {
|
|
|
193
173
|
ml: 1
|
|
194
174
|
},
|
|
195
175
|
color: "primary",
|
|
196
|
-
disabled: !
|
|
176
|
+
disabled: !inputValue?.trim()
|
|
197
177
|
}, /*#__PURE__*/_react.default.createElement(_Send.default, null))))));
|
|
198
178
|
};
|
|
199
|
-
var _default = ChatBotModal;
|
|
200
|
-
exports.default = _default;
|
|
179
|
+
var _default = exports.default = ChatBotModal;
|
|
@@ -7,14 +7,13 @@ exports.default = void 0;
|
|
|
7
7
|
var _material = require("@mui/material");
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _text = _interopRequireDefault(require("../text"));
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
+
const CheckBox = props => {
|
|
13
|
+
const {
|
|
14
|
+
label,
|
|
15
|
+
...rest
|
|
16
|
+
} = props;
|
|
18
17
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControlLabel, _extends({
|
|
19
18
|
control: /*#__PURE__*/_react.default.createElement(_material.Checkbox, rest),
|
|
20
19
|
label: /*#__PURE__*/_react.default.createElement(_text.default, null, label)
|
|
@@ -26,5 +25,4 @@ CheckBox.defaultProps = {
|
|
|
26
25
|
defaultChecked: true,
|
|
27
26
|
labelPlacement: "right"
|
|
28
27
|
};
|
|
29
|
-
var _default = CheckBox;
|
|
30
|
-
exports.default = _default;
|
|
28
|
+
var _default = exports.default = CheckBox;
|