funda-ui 4.6.111 → 4.6.151
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/Chatbox/index.css +25 -1
- package/Chatbox/index.d.ts +6 -0
- package/Chatbox/index.js +64 -20
- package/Date/index.js +53 -47
- package/Select/index.d.ts +4 -4
- package/TagInput/index.d.ts +6 -0
- package/TagInput/index.js +6 -3
- package/lib/cjs/Chatbox/index.d.ts +6 -0
- package/lib/cjs/Chatbox/index.js +64 -20
- package/lib/cjs/Date/index.js +53 -47
- package/lib/cjs/Select/index.d.ts +4 -4
- package/lib/cjs/TagInput/index.d.ts +6 -0
- package/lib/cjs/TagInput/index.js +6 -3
- package/lib/css/Chatbox/index.css +25 -1
- package/lib/esm/Chatbox/index.scss +33 -2
- package/lib/esm/Chatbox/index.tsx +54 -1
- package/lib/esm/Date/index.tsx +60 -43
- package/lib/esm/Input/index.tsx +1 -0
- package/lib/esm/Select/index.tsx +4 -5
- package/lib/esm/TagInput/index.tsx +30 -10
- package/package.json +1 -1
package/lib/cjs/Chatbox/index.js
CHANGED
|
@@ -4213,7 +4213,7 @@ function src_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
4213
4213
|
|
|
4214
4214
|
|
|
4215
4215
|
var Chatbox = function Chatbox(props) {
|
|
4216
|
-
var _args$newChatButton;
|
|
4216
|
+
var _list, _args$newChatButton;
|
|
4217
4217
|
var chatId = useComId_default()().replace(/\-/g, '_');
|
|
4218
4218
|
|
|
4219
4219
|
// Store latest props in refs
|
|
@@ -4386,6 +4386,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4386
4386
|
newChatButton = currentProps.newChatButton,
|
|
4387
4387
|
maxHistoryLength = currentProps.maxHistoryLength,
|
|
4388
4388
|
customRequest = currentProps.customRequest,
|
|
4389
|
+
onQuestionClick = currentProps.onQuestionClick,
|
|
4389
4390
|
renderParser = currentProps.renderParser,
|
|
4390
4391
|
requestBodyFormatter = currentProps.requestBodyFormatter,
|
|
4391
4392
|
nameFormatter = currentProps.nameFormatter,
|
|
@@ -4451,6 +4452,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4451
4452
|
toolkitButtons: toolkitButtons,
|
|
4452
4453
|
newChatButton: newChatButton,
|
|
4453
4454
|
customRequest: customRequest,
|
|
4455
|
+
onQuestionClick: onQuestionClick,
|
|
4454
4456
|
renderParser: renderParser,
|
|
4455
4457
|
requestBodyFormatter: requestBodyFormatter,
|
|
4456
4458
|
nameFormatter: nameFormatter,
|
|
@@ -4459,6 +4461,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4459
4461
|
onChunk: onChunk,
|
|
4460
4462
|
onComplete: onComplete,
|
|
4461
4463
|
//
|
|
4464
|
+
defaultQuestionsRes: questions,
|
|
4462
4465
|
latestContextData: latestContextData,
|
|
4463
4466
|
questionNameRes: _questionName,
|
|
4464
4467
|
answerNameRes: _answerName,
|
|
@@ -4471,14 +4474,37 @@ var Chatbox = function Chatbox(props) {
|
|
|
4471
4474
|
};
|
|
4472
4475
|
};
|
|
4473
4476
|
|
|
4477
|
+
//================================================================
|
|
4478
|
+
// Custom Questions
|
|
4479
|
+
//================================================================
|
|
4480
|
+
var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.defaultQuestions),
|
|
4481
|
+
_useState18 = src_slicedToArray(_useState17, 2),
|
|
4482
|
+
questions = _useState18[0],
|
|
4483
|
+
setQuestions = _useState18[1];
|
|
4484
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
4485
|
+
if (props.defaultQuestions) {
|
|
4486
|
+
setQuestions(props.defaultQuestions);
|
|
4487
|
+
}
|
|
4488
|
+
}, [props.defaultQuestions]);
|
|
4489
|
+
var hasQuestion = function hasQuestion() {
|
|
4490
|
+
return args().defaultQuestionsRes && args().defaultQuestionsRes.list.length > 0;
|
|
4491
|
+
};
|
|
4492
|
+
var handleQuestionClick = function handleQuestionClick(text) {
|
|
4493
|
+
var _args$onQuestionClick, _args;
|
|
4494
|
+
if (inputContentRef.current) {
|
|
4495
|
+
inputContentRef.current.set(text);
|
|
4496
|
+
}
|
|
4497
|
+
(_args$onQuestionClick = (_args = args()).onQuestionClick) === null || _args$onQuestionClick === void 0 ? void 0 : _args$onQuestionClick.call(_args, text, exposedMethods());
|
|
4498
|
+
};
|
|
4499
|
+
|
|
4474
4500
|
//================================================================
|
|
4475
4501
|
// Custom buttons
|
|
4476
4502
|
//================================================================
|
|
4477
4503
|
var toolkitBtnsRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
4478
|
-
var
|
|
4479
|
-
|
|
4480
|
-
activeButtons =
|
|
4481
|
-
setActiveButtons =
|
|
4504
|
+
var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
|
|
4505
|
+
_useState20 = src_slicedToArray(_useState19, 2),
|
|
4506
|
+
activeButtons = _useState20[0],
|
|
4507
|
+
setActiveButtons = _useState20[1];
|
|
4482
4508
|
var closeDropdowns = function closeDropdowns() {
|
|
4483
4509
|
setActiveButtons(function (prev) {
|
|
4484
4510
|
var _args$toolkitButtons;
|
|
@@ -4516,10 +4542,10 @@ var Chatbox = function Chatbox(props) {
|
|
|
4516
4542
|
};
|
|
4517
4543
|
|
|
4518
4544
|
// options
|
|
4519
|
-
var
|
|
4520
|
-
|
|
4521
|
-
selectedOpt =
|
|
4522
|
-
setSelectedOpt =
|
|
4545
|
+
var _useState21 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
|
|
4546
|
+
_useState22 = src_slicedToArray(_useState21, 2),
|
|
4547
|
+
selectedOpt = _useState22[0],
|
|
4548
|
+
setSelectedOpt = _useState22[1];
|
|
4523
4549
|
var getButtonOptions = function getButtonOptions(btn) {
|
|
4524
4550
|
var options = [];
|
|
4525
4551
|
var index = 1;
|
|
@@ -4814,7 +4840,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4814
4840
|
var streamController = src_useStreamController({
|
|
4815
4841
|
onChunk: function () {
|
|
4816
4842
|
var _onChunk = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee2(chunk, index) {
|
|
4817
|
-
var _args$onChunk,
|
|
4843
|
+
var _args$onChunk, _args3;
|
|
4818
4844
|
var res;
|
|
4819
4845
|
return src_regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4820
4846
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -4831,7 +4857,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4831
4857
|
case 3:
|
|
4832
4858
|
res = _context2.sent;
|
|
4833
4859
|
//
|
|
4834
|
-
(_args$onChunk = (
|
|
4860
|
+
(_args$onChunk = (_args3 = args()).onChunk) === null || _args$onChunk === void 0 ? void 0 : _args$onChunk.call(_args3, inputContentRef.current, res, conversationHistory.current);
|
|
4835
4861
|
case 5:
|
|
4836
4862
|
case "end":
|
|
4837
4863
|
return _context2.stop();
|
|
@@ -4845,7 +4871,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4845
4871
|
}(),
|
|
4846
4872
|
onComplete: function () {
|
|
4847
4873
|
var _onComplete = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee3(lastContent) {
|
|
4848
|
-
var _args$onComplete,
|
|
4874
|
+
var _args$onComplete, _args5;
|
|
4849
4875
|
var res;
|
|
4850
4876
|
return src_regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4851
4877
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -4859,7 +4885,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4859
4885
|
displayMessage(args().answerNameRes, res);
|
|
4860
4886
|
|
|
4861
4887
|
//
|
|
4862
|
-
(_args$onComplete = (
|
|
4888
|
+
(_args$onComplete = (_args5 = args()).onComplete) === null || _args$onComplete === void 0 ? void 0 : _args$onComplete.call(_args5, inputContentRef.current, res, conversationHistory.current);
|
|
4863
4889
|
|
|
4864
4890
|
//
|
|
4865
4891
|
closeSSE();
|
|
@@ -4919,7 +4945,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
4919
4945
|
};
|
|
4920
4946
|
var sendMessage = /*#__PURE__*/function () {
|
|
4921
4947
|
var _ref2 = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee4() {
|
|
4922
|
-
var messageInput, message, inputMsg, res, _args$onChunk2,
|
|
4948
|
+
var messageInput, message, inputMsg, res, _args$onChunk2, _args7, _args$onComplete2, _args8, reply, replyRes;
|
|
4923
4949
|
return src_regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4924
4950
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4925
4951
|
case 0:
|
|
@@ -4999,8 +5025,8 @@ var Chatbox = function Chatbox(props) {
|
|
|
4999
5025
|
displayMessage(args().answerNameRes, replyRes); // Display AI reply
|
|
5000
5026
|
|
|
5001
5027
|
//
|
|
5002
|
-
(_args$onChunk2 = (
|
|
5003
|
-
(_args$onComplete2 = (
|
|
5028
|
+
(_args$onChunk2 = (_args7 = args()).onChunk) === null || _args$onChunk2 === void 0 ? void 0 : _args$onChunk2.call(_args7, inputContentRef.current, replyRes, conversationHistory.current);
|
|
5029
|
+
(_args$onComplete2 = (_args8 = args()).onComplete) === null || _args$onComplete2 === void 0 ? void 0 : _args$onComplete2.call(_args8, inputContentRef.current, replyRes, conversationHistory.current);
|
|
5004
5030
|
|
|
5005
5031
|
//reset SSE
|
|
5006
5032
|
closeSSE();
|
|
@@ -5299,7 +5325,7 @@ var Chatbox = function Chatbox(props) {
|
|
|
5299
5325
|
className: "".concat(args().prefix || 'custom-', "chatbox-container"),
|
|
5300
5326
|
ref: rootRef
|
|
5301
5327
|
}, msgList.length === 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
5302
|
-
className: "d-flex flex-column align-items-center justify-content-center h-50
|
|
5328
|
+
className: "d-flex flex-column align-items-center justify-content-center ".concat(hasQuestion() ? '' : 'h-50')
|
|
5303
5329
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("p", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5304
5330
|
width: "70px",
|
|
5305
5331
|
height: "70px",
|
|
@@ -5326,7 +5352,25 @@ var Chatbox = function Chatbox(props) {
|
|
|
5326
5352
|
dangerouslySetInnerHTML: {
|
|
5327
5353
|
__html: "".concat(args().noDataPlaceholder)
|
|
5328
5354
|
}
|
|
5329
|
-
}))
|
|
5355
|
+
}), hasQuestion() && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
5356
|
+
className: "default-questions"
|
|
5357
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
5358
|
+
className: "default-questions-title",
|
|
5359
|
+
dangerouslySetInnerHTML: {
|
|
5360
|
+
__html: "".concat(args().defaultQuestionsRes.title)
|
|
5361
|
+
}
|
|
5362
|
+
}), (_list = args().defaultQuestionsRes.list) === null || _list === void 0 ? void 0 : _list.map(function (question, index) {
|
|
5363
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
5364
|
+
key: index,
|
|
5365
|
+
className: "default-question-item",
|
|
5366
|
+
onClick: function onClick() {
|
|
5367
|
+
return handleQuestionClick(question);
|
|
5368
|
+
},
|
|
5369
|
+
dangerouslySetInnerHTML: {
|
|
5370
|
+
__html: "".concat(question)
|
|
5371
|
+
}
|
|
5372
|
+
});
|
|
5373
|
+
})))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
5330
5374
|
className: "messages",
|
|
5331
5375
|
ref: msgContainerRef
|
|
5332
5376
|
}, msgList.map(function (msg, index) {
|
|
@@ -5464,8 +5508,8 @@ var Chatbox = function Chatbox(props) {
|
|
|
5464
5508
|
}
|
|
5465
5509
|
},
|
|
5466
5510
|
onChange: function onChange(e) {
|
|
5467
|
-
var _args$onInputChange,
|
|
5468
|
-
(_args$onInputChange = (
|
|
5511
|
+
var _args$onInputChange, _args11;
|
|
5512
|
+
(_args$onInputChange = (_args11 = args()).onInputChange) === null || _args$onInputChange === void 0 ? void 0 : _args$onInputChange.call(_args11, inputContentRef.current, e.target.value);
|
|
5469
5513
|
},
|
|
5470
5514
|
rows: args().defaultRows || 3,
|
|
5471
5515
|
autoSize: true,
|
package/lib/cjs/Date/index.js
CHANGED
|
@@ -5002,6 +5002,9 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5002
5002
|
var defaultValueIsEmpty = function defaultValueIsEmpty(s) {
|
|
5003
5003
|
return typeof s === 'undefined' || s === null || s === 'null' || s === '';
|
|
5004
5004
|
};
|
|
5005
|
+
var propExist = function propExist(p) {
|
|
5006
|
+
return typeof p !== 'undefined' && p !== null && p !== '';
|
|
5007
|
+
};
|
|
5005
5008
|
|
|
5006
5009
|
// Localization
|
|
5007
5010
|
var _langHoursTitle = langHoursTitle || 'Hours';
|
|
@@ -5613,6 +5616,54 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5613
5616
|
}
|
|
5614
5617
|
return [_res, v];
|
|
5615
5618
|
}
|
|
5619
|
+
function tools() {
|
|
5620
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
5621
|
+
className: (0,cls.combinedCls)('date2d__control-tools', {
|
|
5622
|
+
'date2d__control-tools--hover-show-tools': SHOW_TOOLS_ENABLED
|
|
5623
|
+
})
|
|
5624
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
5625
|
+
tabIndex: -1,
|
|
5626
|
+
href: "#",
|
|
5627
|
+
className: (0,cls.combinedCls)('date2d__control-tools__close', {
|
|
5628
|
+
'd-none': HIDE_CLEAR_BTN_ENABLED || !dateDefaultValueExist
|
|
5629
|
+
}),
|
|
5630
|
+
onClick: function onClick(e) {
|
|
5631
|
+
e.preventDefault();
|
|
5632
|
+
e.stopPropagation(); // Avoid triggering pop-ups
|
|
5633
|
+
|
|
5634
|
+
clearAll();
|
|
5635
|
+
onClear === null || onClear === void 0 ? void 0 : onClear(getFullTimeData(''));
|
|
5636
|
+
}
|
|
5637
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5638
|
+
width: "12px",
|
|
5639
|
+
height: "12px",
|
|
5640
|
+
viewBox: "0 0 1024 1024"
|
|
5641
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5642
|
+
fill: "#000",
|
|
5643
|
+
d: "M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"
|
|
5644
|
+
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
5645
|
+
tabIndex: -1,
|
|
5646
|
+
href: "#",
|
|
5647
|
+
className: "date2d__control-tools__trigger",
|
|
5648
|
+
onClick: function onClick(e) {
|
|
5649
|
+
e.preventDefault();
|
|
5650
|
+
e.stopPropagation(); // Avoid triggering pop-ups
|
|
5651
|
+
|
|
5652
|
+
handleShow();
|
|
5653
|
+
}
|
|
5654
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5655
|
+
width: "14px",
|
|
5656
|
+
height: "14px",
|
|
5657
|
+
viewBox: "0 0 24 24",
|
|
5658
|
+
fill: "none"
|
|
5659
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5660
|
+
d: "M3 9H21M9 15L11 17L15 13M7 3V5M17 3V5M6.2 21H17.8C18.9201 21 19.4802 21 19.908 20.782C20.2843 20.5903 20.5903 20.2843 20.782 19.908C21 19.4802 21 18.9201 21 17.8V8.2C21 7.07989 21 6.51984 20.782 6.09202C20.5903 5.71569 20.2843 5.40973 19.908 5.21799C19.4802 5 18.9201 5 17.8 5H6.2C5.0799 5 4.51984 5 4.09202 5.21799C3.71569 5.40973 3.40973 5.71569 3.21799 6.09202C3 6.51984 3 7.07989 3 8.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z",
|
|
5661
|
+
stroke: "#000000",
|
|
5662
|
+
strokeWidth: "2",
|
|
5663
|
+
strokeLinecap: "round",
|
|
5664
|
+
strokeLinejoin: "round"
|
|
5665
|
+
}))));
|
|
5666
|
+
}
|
|
5616
5667
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
5617
5668
|
// update default value
|
|
5618
5669
|
//--------------
|
|
@@ -5931,54 +5982,9 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
5931
5982
|
setChangedVal(_full);
|
|
5932
5983
|
setTimeVal([splitVals[3], splitVals[4], _val]);
|
|
5933
5984
|
}
|
|
5934
|
-
}, attributes))) : null) : null)),
|
|
5985
|
+
}, attributes))) : null) : null), propExist(iconRight) ? tools() : null),
|
|
5935
5986
|
style: style
|
|
5936
|
-
}, attributes)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(
|
|
5937
|
-
className: (0,cls.combinedCls)('date2d__control-tools', {
|
|
5938
|
-
'date2d__control-tools--hover-show-tools': SHOW_TOOLS_ENABLED
|
|
5939
|
-
})
|
|
5940
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
5941
|
-
tabIndex: -1,
|
|
5942
|
-
href: "#",
|
|
5943
|
-
className: (0,cls.combinedCls)('date2d__control-tools__close', {
|
|
5944
|
-
'd-none': HIDE_CLEAR_BTN_ENABLED || !dateDefaultValueExist
|
|
5945
|
-
}),
|
|
5946
|
-
onClick: function onClick(e) {
|
|
5947
|
-
e.preventDefault();
|
|
5948
|
-
e.stopPropagation(); // Avoid triggering pop-ups
|
|
5949
|
-
|
|
5950
|
-
clearAll();
|
|
5951
|
-
onClear === null || onClear === void 0 ? void 0 : onClear(getFullTimeData(''));
|
|
5952
|
-
}
|
|
5953
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5954
|
-
width: "12px",
|
|
5955
|
-
height: "12px",
|
|
5956
|
-
viewBox: "0 0 1024 1024"
|
|
5957
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5958
|
-
fill: "#000",
|
|
5959
|
-
d: "M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"
|
|
5960
|
-
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
5961
|
-
tabIndex: -1,
|
|
5962
|
-
href: "#",
|
|
5963
|
-
className: "date2d__control-tools__trigger",
|
|
5964
|
-
onClick: function onClick(e) {
|
|
5965
|
-
e.preventDefault();
|
|
5966
|
-
e.stopPropagation(); // Avoid triggering pop-ups
|
|
5967
|
-
|
|
5968
|
-
handleShow();
|
|
5969
|
-
}
|
|
5970
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5971
|
-
width: "14px",
|
|
5972
|
-
height: "14px",
|
|
5973
|
-
viewBox: "0 0 24 24",
|
|
5974
|
-
fill: "none"
|
|
5975
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
5976
|
-
d: "M3 9H21M9 15L11 17L15 13M7 3V5M17 3V5M6.2 21H17.8C18.9201 21 19.4802 21 19.908 20.782C20.2843 20.5903 20.5903 20.2843 20.782 19.908C21 19.4802 21 18.9201 21 17.8V8.2C21 7.07989 21 6.51984 20.782 6.09202C20.5903 5.71569 20.2843 5.40973 19.908 5.21799C19.4802 5 18.9201 5 17.8 5H6.2C5.0799 5 4.51984 5 4.09202 5.21799C3.71569 5.40973 3.40973 5.71569 3.21799 6.09202C3 6.51984 3 7.07989 3 8.2V17.8C3 18.9201 3 19.4802 3.21799 19.908C3.40973 20.2843 3.71569 20.5903 4.09202 20.782C4.51984 21 5.07989 21 6.2 21Z",
|
|
5977
|
-
stroke: "#000000",
|
|
5978
|
-
strokeWidth: "2",
|
|
5979
|
-
strokeLinecap: "round",
|
|
5980
|
-
strokeLinejoin: "round"
|
|
5981
|
-
})))))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((dist_cjs_default()), {
|
|
5987
|
+
}, attributes)), !propExist(iconRight) ? tools() : null)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((dist_cjs_default()), {
|
|
5982
5988
|
show: isShow,
|
|
5983
5989
|
containerClassName: (0,cls.combinedCls)('Date', "Date--".concat(type))
|
|
5984
5990
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", _extends({
|
|
@@ -13,9 +13,9 @@ export interface OptionConfig {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
optgroup?: any[];
|
|
15
15
|
group?: boolean;
|
|
16
|
-
label:
|
|
17
|
-
listItemLabel?:
|
|
18
|
-
value:
|
|
16
|
+
label: string;
|
|
17
|
+
listItemLabel?: string;
|
|
18
|
+
value: string | number | boolean;
|
|
19
19
|
queryString: string | number;
|
|
20
20
|
callback?: () => void;
|
|
21
21
|
}
|
|
@@ -46,7 +46,7 @@ export declare type SelectProps = {
|
|
|
46
46
|
multiSelect?: MultiSelectConfig;
|
|
47
47
|
multiSelectEntireAreaTrigger?: boolean;
|
|
48
48
|
multiSelectSelectedItemOnlyStatus?: multiSelectSelectedItemOnlyStatusConfig;
|
|
49
|
-
renderSelectedValue?: (selectedData: MultiSelectControlValConfig, removeFunc: (e: React.MouseEvent) => void) =>
|
|
49
|
+
renderSelectedValue?: (selectedData: MultiSelectControlValConfig, removeFunc: (e: React.MouseEvent) => void) => React.ReactNode;
|
|
50
50
|
cleanTrigger?: CleanTriggerConfig;
|
|
51
51
|
defaultValue?: string | OptionConfig;
|
|
52
52
|
value?: string | OptionConfig;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export interface TagValConfig {
|
|
3
|
+
content: string;
|
|
4
|
+
id: number;
|
|
5
|
+
[key: string]: string | boolean | number;
|
|
6
|
+
}
|
|
2
7
|
export declare type TagInputProps = {
|
|
3
8
|
contentRef?: React.ForwardedRef<any>;
|
|
4
9
|
wrapperClassName?: string;
|
|
@@ -13,6 +18,7 @@ export declare type TagInputProps = {
|
|
|
13
18
|
required?: any;
|
|
14
19
|
readOnly?: any;
|
|
15
20
|
placeholder?: string;
|
|
21
|
+
renderSelectedValue?: (selectedData: TagValConfig[], removeFunc: (e: React.MouseEvent) => void) => React.ReactNode;
|
|
16
22
|
/** Whether to use square brackets to save result and initialize default value */
|
|
17
23
|
extractValueByBrackets?: boolean;
|
|
18
24
|
/** -- */
|
|
@@ -828,7 +828,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
828
828
|
/* harmony import */ var funda_utils_dist_cjs_convert__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(funda_utils_dist_cjs_convert__WEBPACK_IMPORTED_MODULE_3__);
|
|
829
829
|
/* harmony import */ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(188);
|
|
830
830
|
/* harmony import */ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__);
|
|
831
|
-
var _excluded = ["contentRef", "wrapperClassName", "maxTags", "disabled", "required", "placeholder", "readOnly", "value", "requiredLabel", "label", "name", "id", "autoComplete", "autoCapitalize", "spellCheck", "extractValueByBrackets", "minLength", "maxLength", "style", "tabIndex", "onChange", "onBlur", "onFocus"];
|
|
831
|
+
var _excluded = ["contentRef", "wrapperClassName", "maxTags", "disabled", "required", "placeholder", "renderSelectedValue", "readOnly", "value", "requiredLabel", "label", "name", "id", "autoComplete", "autoCapitalize", "spellCheck", "extractValueByBrackets", "minLength", "maxLength", "style", "tabIndex", "onChange", "onBlur", "onFocus"];
|
|
832
832
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
833
833
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
834
834
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -850,6 +850,7 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
850
850
|
disabled = props.disabled,
|
|
851
851
|
required = props.required,
|
|
852
852
|
placeholder = props.placeholder,
|
|
853
|
+
renderSelectedValue = props.renderSelectedValue,
|
|
853
854
|
readOnly = props.readOnly,
|
|
854
855
|
value = props.value,
|
|
855
856
|
requiredLabel = props.requiredLabel,
|
|
@@ -932,6 +933,8 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
932
933
|
}
|
|
933
934
|
function handleRemove(e) {
|
|
934
935
|
e.preventDefault();
|
|
936
|
+
e.stopPropagation(); /* REQUIRED */
|
|
937
|
+
|
|
935
938
|
var idToRemove = Number(e.currentTarget.dataset.item);
|
|
936
939
|
var newArray = items.filter(function (item) {
|
|
937
940
|
return item.id !== idToRemove;
|
|
@@ -1056,7 +1059,7 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
1056
1059
|
className: "tag-input__control-wrapper"
|
|
1057
1060
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("ul", {
|
|
1058
1061
|
className: "tag-input__list"
|
|
1059
|
-
}, items ? items.map(function (item, index) {
|
|
1062
|
+
}, typeof renderSelectedValue === 'function' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, renderSelectedValue(items, handleRemove)) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, items ? items.map(function (item, index) {
|
|
1060
1063
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
|
|
1061
1064
|
key: index
|
|
1062
1065
|
}, item.content, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
@@ -1072,7 +1075,7 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
|
|
|
1072
1075
|
fill: "#000",
|
|
1073
1076
|
d: "M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"
|
|
1074
1077
|
}))));
|
|
1075
|
-
}) : null), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1078
|
+
}) : null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
1076
1079
|
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.combinedCls)('tag-input__control', {
|
|
1077
1080
|
'disabled': disabled
|
|
1078
1081
|
}),
|
|
@@ -113,6 +113,8 @@
|
|
|
113
113
|
--custom-chatbox-toolkit-opt-border-color: #e9ecef;
|
|
114
114
|
--custom-chatbox-toolkit-opt-active-color: #c2dfff;
|
|
115
115
|
--custom-chatbox-toolkit-btn-radius: 20px;
|
|
116
|
+
--custom-chatbox-questions-bg: #f5f5f5;
|
|
117
|
+
--custom-chatbox-questions-hover-bg: #e9e9e9;
|
|
116
118
|
min-width: var(--custom-chatbox-w);
|
|
117
119
|
max-width: var(--custom-chatbox-w);
|
|
118
120
|
margin: auto;
|
|
@@ -132,6 +134,7 @@
|
|
|
132
134
|
/* new chat button */
|
|
133
135
|
/* toolkit buttons */
|
|
134
136
|
/* toolkit options */
|
|
137
|
+
/* default questions */
|
|
135
138
|
}
|
|
136
139
|
.custom-chatbox-container details {
|
|
137
140
|
font-style: italic;
|
|
@@ -434,7 +437,7 @@
|
|
|
434
437
|
display: flex;
|
|
435
438
|
align-items: center;
|
|
436
439
|
justify-content: space-between;
|
|
437
|
-
border: 1px solid
|
|
440
|
+
border: 1px solid var(--custom-chatbox-gray-color);
|
|
438
441
|
border-radius: var(--custom-chatbox-toolkit-btn-radius);
|
|
439
442
|
cursor: pointer;
|
|
440
443
|
}
|
|
@@ -489,3 +492,24 @@
|
|
|
489
492
|
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option:hover {
|
|
490
493
|
background-color: var(--custom-chatbox-toolkit-opt-active-color);
|
|
491
494
|
}
|
|
495
|
+
.custom-chatbox-container .default-questions-title {
|
|
496
|
+
margin-bottom: 0.5rem;
|
|
497
|
+
}
|
|
498
|
+
.custom-chatbox-container .default-questions {
|
|
499
|
+
padding: 15px;
|
|
500
|
+
width: 100%;
|
|
501
|
+
}
|
|
502
|
+
.custom-chatbox-container .default-question-item {
|
|
503
|
+
padding: 0.3rem 1rem;
|
|
504
|
+
margin-bottom: 0.2rem;
|
|
505
|
+
background-color: var(--custom-chatbox-questions-bg);
|
|
506
|
+
border-radius: 0.35rem;
|
|
507
|
+
cursor: pointer;
|
|
508
|
+
transition: all 0.3s ease;
|
|
509
|
+
}
|
|
510
|
+
.custom-chatbox-container .default-question-item:hover {
|
|
511
|
+
background-color: var(--custom-chatbox-questions-hover-bg);
|
|
512
|
+
}
|
|
513
|
+
.custom-chatbox-container .default-question-item:last-child {
|
|
514
|
+
margin-bottom: 0;
|
|
515
|
+
}
|
|
@@ -142,7 +142,8 @@
|
|
|
142
142
|
--custom-chatbox-toolkit-opt-border-color: #e9ecef;
|
|
143
143
|
--custom-chatbox-toolkit-opt-active-color: #c2dfff;
|
|
144
144
|
--custom-chatbox-toolkit-btn-radius: 20px;
|
|
145
|
-
|
|
145
|
+
--custom-chatbox-questions-bg: #f5f5f5;
|
|
146
|
+
--custom-chatbox-questions-hover-bg: #e9e9e9;
|
|
146
147
|
|
|
147
148
|
|
|
148
149
|
min-width: var(--custom-chatbox-w);
|
|
@@ -542,7 +543,7 @@
|
|
|
542
543
|
display: flex;
|
|
543
544
|
align-items: center;
|
|
544
545
|
justify-content: space-between;
|
|
545
|
-
border: 1px solid
|
|
546
|
+
border: 1px solid var(--custom-chatbox-gray-color);
|
|
546
547
|
border-radius: var(--custom-chatbox-toolkit-btn-radius);
|
|
547
548
|
cursor: pointer;
|
|
548
549
|
}
|
|
@@ -615,5 +616,35 @@
|
|
|
615
616
|
|
|
616
617
|
|
|
617
618
|
|
|
619
|
+
/* default questions */
|
|
620
|
+
.default-questions-title {
|
|
621
|
+
margin-bottom: .5rem;
|
|
622
|
+
}
|
|
623
|
+
.default-questions {
|
|
624
|
+
padding: 15px;
|
|
625
|
+
width: 100%;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
.default-question-item {
|
|
629
|
+
padding: .3rem 1rem;
|
|
630
|
+
margin-bottom: .2rem;
|
|
631
|
+
background-color: var(--custom-chatbox-questions-bg);
|
|
632
|
+
border-radius: 0.35rem;
|
|
633
|
+
cursor: pointer;
|
|
634
|
+
transition: all 0.3s ease;
|
|
635
|
+
|
|
636
|
+
&:hover {
|
|
637
|
+
background-color: var(--custom-chatbox-questions-hover-bg);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
&:last-child {
|
|
642
|
+
margin-bottom: 0;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
618
649
|
|
|
619
650
|
}
|
|
@@ -39,6 +39,13 @@ export type MessageDetail = {
|
|
|
39
39
|
tag: string; // such as '[reply]'
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
+
|
|
43
|
+
export type QuestionData = {
|
|
44
|
+
title: string;
|
|
45
|
+
list: Array<string>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
|
|
42
49
|
export interface FloatingButton {
|
|
43
50
|
label: string; // HTML string
|
|
44
51
|
value: string;
|
|
@@ -106,10 +113,12 @@ export type ChatboxProps = {
|
|
|
106
113
|
toolkitButtons?: FloatingButton[];
|
|
107
114
|
newChatButton?: FloatingButton;
|
|
108
115
|
customMethods?: CustomMethod[]; // [{"name": "method1", "func": "() => { console.log('test'); }"}, ...]
|
|
116
|
+
defaultQuestions?: QuestionData;
|
|
109
117
|
customRequest?: CustomRequestFunction;
|
|
110
118
|
renderParser?: (input: string) => Promise<string>;
|
|
111
119
|
requestBodyFormatter?: (body: any, contextData: Record<string, any>, conversationHistory: MessageDetail[]) => Promise<Record<string, any>>;
|
|
112
120
|
nameFormatter?: (input: string) => string;
|
|
121
|
+
onQuestionClick?: (text: string, methods: Record<string, Function>) => void;
|
|
113
122
|
onInputChange?: (controlRef: React.RefObject<any>, val: string) => any;
|
|
114
123
|
onInputCallback?: (input: string) => Promise<string>;
|
|
115
124
|
onChunk?: (controlRef: React.RefObject<any>, lastContent: string, conversationHistory: MessageDetail[]) => any;
|
|
@@ -279,6 +288,7 @@ const Chatbox = (props: ChatboxProps) => {
|
|
|
279
288
|
newChatButton,
|
|
280
289
|
maxHistoryLength,
|
|
281
290
|
customRequest,
|
|
291
|
+
onQuestionClick,
|
|
282
292
|
renderParser,
|
|
283
293
|
requestBodyFormatter,
|
|
284
294
|
nameFormatter,
|
|
@@ -352,6 +362,7 @@ const Chatbox = (props: ChatboxProps) => {
|
|
|
352
362
|
toolkitButtons,
|
|
353
363
|
newChatButton,
|
|
354
364
|
customRequest,
|
|
365
|
+
onQuestionClick,
|
|
355
366
|
renderParser,
|
|
356
367
|
requestBodyFormatter,
|
|
357
368
|
nameFormatter,
|
|
@@ -361,6 +372,7 @@ const Chatbox = (props: ChatboxProps) => {
|
|
|
361
372
|
onComplete,
|
|
362
373
|
|
|
363
374
|
//
|
|
375
|
+
defaultQuestionsRes: questions,
|
|
364
376
|
latestContextData,
|
|
365
377
|
questionNameRes: _questionName,
|
|
366
378
|
answerNameRes: _answerName,
|
|
@@ -375,6 +387,28 @@ const Chatbox = (props: ChatboxProps) => {
|
|
|
375
387
|
}
|
|
376
388
|
|
|
377
389
|
|
|
390
|
+
|
|
391
|
+
//================================================================
|
|
392
|
+
// Custom Questions
|
|
393
|
+
//================================================================
|
|
394
|
+
const [questions, setQuestions] = useState<QuestionData | undefined>(props.defaultQuestions);
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
if (props.defaultQuestions) {
|
|
397
|
+
setQuestions(props.defaultQuestions);
|
|
398
|
+
}
|
|
399
|
+
}, [props.defaultQuestions]);
|
|
400
|
+
const hasQuestion = () => {
|
|
401
|
+
return args().defaultQuestionsRes && (args().defaultQuestionsRes as QuestionData).list.length > 0;
|
|
402
|
+
};
|
|
403
|
+
const handleQuestionClick = (text: string) => {
|
|
404
|
+
if (inputContentRef.current) {
|
|
405
|
+
inputContentRef.current.set(text);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
args().onQuestionClick?.(text, exposedMethods());
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
|
|
378
412
|
//================================================================
|
|
379
413
|
// Custom buttons
|
|
380
414
|
//================================================================
|
|
@@ -1124,7 +1158,7 @@ const Chatbox = (props: ChatboxProps) => {
|
|
|
1124
1158
|
{/**------------- NO DATA -------------*/}
|
|
1125
1159
|
{msgList.length === 0 ? <>
|
|
1126
1160
|
|
|
1127
|
-
<div className=
|
|
1161
|
+
<div className={`d-flex flex-column align-items-center justify-content-center ${hasQuestion() ? '' : 'h-50'}`}>
|
|
1128
1162
|
<p>
|
|
1129
1163
|
<svg width="70px" height="70px" viewBox="0 0 24 24" fill="none">
|
|
1130
1164
|
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 13.5997 2.37562 15.1116 3.04346 16.4525C3.22094 16.8088 3.28001 17.2161 3.17712 17.6006L2.58151 19.8267C2.32295 20.793 3.20701 21.677 4.17335 21.4185L6.39939 20.8229C6.78393 20.72 7.19121 20.7791 7.54753 20.9565C8.88837 21.6244 10.4003 22 12 22Z" stroke="#858297" strokeWidth="1.5" />
|
|
@@ -1134,7 +1168,26 @@ const Chatbox = (props: ChatboxProps) => {
|
|
|
1134
1168
|
|
|
1135
1169
|
</p>
|
|
1136
1170
|
<p className="text-primary" dangerouslySetInnerHTML={{ __html: `${args().noDataPlaceholder}` }}></p>
|
|
1171
|
+
|
|
1172
|
+
{/** DEFAULT QUESTIONS */}
|
|
1173
|
+
{hasQuestion() && (
|
|
1174
|
+
<div className="default-questions">
|
|
1175
|
+
<div className="default-questions-title" dangerouslySetInnerHTML={{ __html: `${(args().defaultQuestionsRes as QuestionData).title}` }}></div>
|
|
1176
|
+
{(args().defaultQuestionsRes as QuestionData).list?.map((question: string, index: number) => (
|
|
1177
|
+
<div
|
|
1178
|
+
key={index}
|
|
1179
|
+
className="default-question-item"
|
|
1180
|
+
onClick={() => handleQuestionClick(question)}
|
|
1181
|
+
dangerouslySetInnerHTML={{ __html: `${question}` }}
|
|
1182
|
+
/>
|
|
1183
|
+
))}
|
|
1184
|
+
</div>
|
|
1185
|
+
)}
|
|
1186
|
+
{/** /DEFAULT QUESTIONS */}
|
|
1187
|
+
|
|
1137
1188
|
</div>
|
|
1189
|
+
|
|
1190
|
+
|
|
1138
1191
|
</> : null}
|
|
1139
1192
|
{/**------------- /NO DATA -------------*/}
|
|
1140
1193
|
|