funda-ui 4.6.111 → 4.6.222
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 +95 -14
- package/Chatbox/index.d.ts +7 -0
- package/Chatbox/index.js +406 -279
- 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 +7 -0
- package/lib/cjs/Chatbox/index.js +406 -279
- 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 +95 -14
- package/lib/esm/Chatbox/PureLoader.tsx +4 -2
- package/lib/esm/Chatbox/TypingEffect.tsx +12 -41
- package/lib/esm/Chatbox/index.scss +125 -25
- package/lib/esm/Chatbox/index.tsx +120 -30
- package/lib/esm/Chatbox/utils/func.ts +52 -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/lib/esm/Textarea/index.tsx +0 -2
- package/package.json +1 -1
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
|
}),
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/*=================== Chatbox (Loading) =================*/
|
|
2
2
|
.custom-chatbox-loader-container {
|
|
3
|
+
--custom-chatbox-loader-color: #b9caf7;
|
|
4
|
+
--custom-chatbox-loader-color2: #0d6efd;
|
|
3
5
|
width: 130px;
|
|
4
6
|
text-align: start;
|
|
5
7
|
}
|
|
6
8
|
.custom-chatbox-loader-container .custom-chatbox-loader {
|
|
7
9
|
height: 4px;
|
|
8
10
|
width: 100%;
|
|
9
|
-
--c: no-repeat linear-gradient(var(--
|
|
10
|
-
background: var(--c), var(--c),
|
|
11
|
+
--c: no-repeat linear-gradient(var(--custom-chatbox-loader-color2) 0 0);
|
|
12
|
+
background: var(--c), var(--c), var(--custom-chatbox-loader-color);
|
|
11
13
|
background-size: 60% 100%;
|
|
12
|
-
animation:
|
|
14
|
+
animation: loader-move 3s infinite;
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
.dark-mode .custom-chatbox-loader-container .custom-chatbox-loader,
|
|
16
|
-
[data-bs-theme=dark] .custom-chatbox-loader-container .custom-chatbox-loader {
|
|
17
|
-
--c: no-repeat linear-gradient(var(--bs-primary) 0 0);
|
|
18
|
-
background: var(--c), var(--c), #8692b5;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes cssAnim--loadermove {
|
|
16
|
+
@keyframes loader-move {
|
|
22
17
|
0% {
|
|
23
18
|
background-position: -150% 0, -150% 0;
|
|
24
19
|
}
|
|
@@ -29,6 +24,29 @@
|
|
|
29
24
|
background-position: 250% 0, 250% 0;
|
|
30
25
|
}
|
|
31
26
|
}
|
|
27
|
+
|
|
28
|
+
.custom-chatbox-mini-loader {
|
|
29
|
+
--custom-chatbox-miniloader-color: rgba(0,0,0,.5);
|
|
30
|
+
width: 15px;
|
|
31
|
+
height: 15px;
|
|
32
|
+
margin: 0.5rem;
|
|
33
|
+
margin-bottom: 0;
|
|
34
|
+
border: 3px dotted var(--custom-chatbox-miniloader-color);
|
|
35
|
+
border-radius: 50%;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
position: relative;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
animation: mini-loader-spin 1s linear infinite;
|
|
40
|
+
}
|
|
41
|
+
@keyframes mini-loader-spin {
|
|
42
|
+
0% {
|
|
43
|
+
transform: rotate(0deg);
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: rotate(360deg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
32
50
|
/*=================== Chatbox (Core) =================*/
|
|
33
51
|
.custom-chatbox-circle {
|
|
34
52
|
--custom-chatbox-circle-color: #5A5EB9;
|
|
@@ -113,6 +131,10 @@
|
|
|
113
131
|
--custom-chatbox-toolkit-opt-border-color: #e9ecef;
|
|
114
132
|
--custom-chatbox-toolkit-opt-active-color: #c2dfff;
|
|
115
133
|
--custom-chatbox-toolkit-btn-radius: 20px;
|
|
134
|
+
--custom-chatbox-questions-bg: #f5f5f5;
|
|
135
|
+
--custom-chatbox-questions-hover-bg: #e9e9e9;
|
|
136
|
+
--custom-chatbox-content-html-elem-border-color: #ddd;
|
|
137
|
+
--custom-chatbox-content-html-elem-bg: rgba(0,0,0,.05);
|
|
116
138
|
min-width: var(--custom-chatbox-w);
|
|
117
139
|
max-width: var(--custom-chatbox-w);
|
|
118
140
|
margin: auto;
|
|
@@ -132,6 +154,7 @@
|
|
|
132
154
|
/* new chat button */
|
|
133
155
|
/* toolkit buttons */
|
|
134
156
|
/* toolkit options */
|
|
157
|
+
/* default questions */
|
|
135
158
|
}
|
|
136
159
|
.custom-chatbox-container details {
|
|
137
160
|
font-style: italic;
|
|
@@ -139,6 +162,8 @@
|
|
|
139
162
|
padding: 0;
|
|
140
163
|
font-size: 0.75rem;
|
|
141
164
|
margin-bottom: 0.5rem;
|
|
165
|
+
background: var(--custom-chatbox-msg-bg);
|
|
166
|
+
padding: 0.5rem;
|
|
142
167
|
}
|
|
143
168
|
.custom-chatbox-container summary {
|
|
144
169
|
cursor: pointer;
|
|
@@ -168,7 +193,7 @@
|
|
|
168
193
|
font-size: 0.75rem;
|
|
169
194
|
}
|
|
170
195
|
.custom-chatbox-container .messages {
|
|
171
|
-
height: calc(100% -
|
|
196
|
+
height: calc(100% - 110px);
|
|
172
197
|
overflow-y: auto;
|
|
173
198
|
margin-bottom: 10px;
|
|
174
199
|
font-size: 13px;
|
|
@@ -213,6 +238,33 @@
|
|
|
213
238
|
margin-top: 0.3rem;
|
|
214
239
|
display: inline-block;
|
|
215
240
|
text-align: start;
|
|
241
|
+
/* Custom HTML Styles */
|
|
242
|
+
}
|
|
243
|
+
.custom-chatbox-container .messages .qa-content .table-container {
|
|
244
|
+
overflow-x: auto;
|
|
245
|
+
margin-bottom: 0.5rem;
|
|
246
|
+
}
|
|
247
|
+
.custom-chatbox-container .messages .qa-content .table-container::-webkit-scrollbar {
|
|
248
|
+
height: 10px;
|
|
249
|
+
}
|
|
250
|
+
.custom-chatbox-container .messages .qa-content .table-container::-webkit-scrollbar-thumb {
|
|
251
|
+
background: rgba(0, 0, 0, 0.2);
|
|
252
|
+
}
|
|
253
|
+
.custom-chatbox-container .messages .qa-content .table-container table {
|
|
254
|
+
width: 100%;
|
|
255
|
+
border-collapse: collapse;
|
|
256
|
+
border-radius: 0.35rem;
|
|
257
|
+
}
|
|
258
|
+
.custom-chatbox-container .messages .qa-content .table-container table thead {
|
|
259
|
+
background: var(--custom-chatbox-content-html-elem-bg);
|
|
260
|
+
}
|
|
261
|
+
.custom-chatbox-container .messages .qa-content .table-container table thead tr {
|
|
262
|
+
white-space: nowrap;
|
|
263
|
+
}
|
|
264
|
+
.custom-chatbox-container .messages .qa-content .table-container table th, .custom-chatbox-container .messages .qa-content .table-container table td {
|
|
265
|
+
padding: 0.25rem;
|
|
266
|
+
text-align: left;
|
|
267
|
+
border: 1px solid var(--custom-chatbox-content-html-elem-border-color);
|
|
216
268
|
}
|
|
217
269
|
.custom-chatbox-container .messages .request {
|
|
218
270
|
text-align: end;
|
|
@@ -229,6 +281,8 @@
|
|
|
229
281
|
}
|
|
230
282
|
.custom-chatbox-container .messages .reply .qa-content {
|
|
231
283
|
width: var(--custom-chatbox-content-w);
|
|
284
|
+
background: transparent;
|
|
285
|
+
padding-top: 0;
|
|
232
286
|
}
|
|
233
287
|
.custom-chatbox-container .msg-dotted-loader-container {
|
|
234
288
|
font-weight: normal;
|
|
@@ -370,6 +424,11 @@
|
|
|
370
424
|
}
|
|
371
425
|
.custom-chatbox-container .newchat-btn {
|
|
372
426
|
text-align: center;
|
|
427
|
+
position: absolute;
|
|
428
|
+
bottom: 95px;
|
|
429
|
+
left: 50%;
|
|
430
|
+
transform: translateX(-50%);
|
|
431
|
+
z-index: 1;
|
|
373
432
|
}
|
|
374
433
|
.custom-chatbox-container .newchat-btn > button {
|
|
375
434
|
padding: 3px 6px;
|
|
@@ -434,7 +493,7 @@
|
|
|
434
493
|
display: flex;
|
|
435
494
|
align-items: center;
|
|
436
495
|
justify-content: space-between;
|
|
437
|
-
border: 1px solid
|
|
496
|
+
border: 1px solid var(--custom-chatbox-gray-color);
|
|
438
497
|
border-radius: var(--custom-chatbox-toolkit-btn-radius);
|
|
439
498
|
cursor: pointer;
|
|
440
499
|
}
|
|
@@ -459,6 +518,7 @@
|
|
|
459
518
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
|
|
460
519
|
margin-bottom: 10px;
|
|
461
520
|
max-height: 300px;
|
|
521
|
+
min-width: 120px;
|
|
462
522
|
overflow-y: auto;
|
|
463
523
|
animation: dropupAnimation 0.2s ease;
|
|
464
524
|
position: absolute;
|
|
@@ -486,6 +546,27 @@
|
|
|
486
546
|
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option.cancel {
|
|
487
547
|
color: var(--custom-chatbox-gray-color);
|
|
488
548
|
}
|
|
489
|
-
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option:hover {
|
|
549
|
+
.custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option.selected:not(.cancel), .custom-chatbox-container .toolkit-select-wrapper .toolkit-select-option:hover {
|
|
490
550
|
background-color: var(--custom-chatbox-toolkit-opt-active-color);
|
|
491
551
|
}
|
|
552
|
+
.custom-chatbox-container .default-questions-title {
|
|
553
|
+
margin-bottom: 0.5rem;
|
|
554
|
+
}
|
|
555
|
+
.custom-chatbox-container .default-questions {
|
|
556
|
+
padding: 15px;
|
|
557
|
+
width: 100%;
|
|
558
|
+
}
|
|
559
|
+
.custom-chatbox-container .default-question-item {
|
|
560
|
+
padding: 0.3rem 1rem;
|
|
561
|
+
margin-bottom: 0.2rem;
|
|
562
|
+
background-color: var(--custom-chatbox-questions-bg);
|
|
563
|
+
border-radius: 0.35rem;
|
|
564
|
+
cursor: pointer;
|
|
565
|
+
transition: all 0.3s ease;
|
|
566
|
+
}
|
|
567
|
+
.custom-chatbox-container .default-question-item:hover {
|
|
568
|
+
background-color: var(--custom-chatbox-questions-hover-bg);
|
|
569
|
+
}
|
|
570
|
+
.custom-chatbox-container .default-question-item:last-child {
|
|
571
|
+
margin-bottom: 0;
|
|
572
|
+
}
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
type PureLoaderProps = {
|
|
5
|
+
prefix?: string;
|
|
5
6
|
txt?: React.ReactNode;
|
|
6
7
|
center?: boolean;
|
|
7
8
|
customClassName?: string;
|
|
@@ -12,6 +13,7 @@ type PureLoaderProps = {
|
|
|
12
13
|
const PureLoader = (props: PureLoaderProps) => {
|
|
13
14
|
|
|
14
15
|
const {
|
|
16
|
+
prefix = 'custom-',
|
|
15
17
|
txt,
|
|
16
18
|
center,
|
|
17
19
|
customClassName
|
|
@@ -21,11 +23,11 @@ const PureLoader = (props: PureLoaderProps) => {
|
|
|
21
23
|
return (
|
|
22
24
|
<>
|
|
23
25
|
|
|
24
|
-
<div className={
|
|
26
|
+
<div className={`${prefix}chatbox-loader-container ${customClassName || ''}`}>
|
|
25
27
|
<div className="row g-0 align-items-center">
|
|
26
28
|
<div className={center ? 'text-center' : ''}><small>{txt || txt === '' ? txt : 'Loading...'}</small></div>
|
|
27
29
|
<div>
|
|
28
|
-
<div className="
|
|
30
|
+
<div className="${prefix}chatbox-loader"></div>
|
|
29
31
|
</div>
|
|
30
32
|
</div>
|
|
31
33
|
</div>
|
|
@@ -1,57 +1,28 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// extract
|
|
4
|
+
import { extractHtmlTags } from './utils/func';
|
|
5
|
+
import type { HtmlTagPlaceholder } from './utils/func';
|
|
6
|
+
|
|
7
|
+
export interface TypingEffectProps {
|
|
4
8
|
content: string; // The content to display
|
|
5
9
|
speed: number; // Speed of typing in milliseconds
|
|
6
10
|
onComplete?: () => void; // Callback when typing is complete
|
|
7
11
|
onUpdate?: () => void; // Callback when typing
|
|
8
12
|
}
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
original: string;
|
|
12
|
-
placeholder: string;
|
|
13
|
-
type: 'img' | 'svg';
|
|
14
|
-
}
|
|
14
|
+
|
|
15
15
|
const TypingEffect: React.FC<TypingEffectProps> = ({ content, speed, onComplete, onUpdate }) => {
|
|
16
16
|
const [displayedContent, setDisplayedContent] = useState<string>('');
|
|
17
17
|
const [index, setIndex] = useState<number>(0);
|
|
18
|
-
const [
|
|
18
|
+
const [htmlTagPlaceholder, setHtmlTagPlaceholders] = useState<HtmlTagPlaceholder[]>([]);
|
|
19
19
|
const [processedContent, setProcessedContent] = useState<string>('');
|
|
20
20
|
|
|
21
21
|
// Extract and replace image tags
|
|
22
22
|
useEffect(() => {
|
|
23
|
-
const
|
|
24
|
-
const placeholders: ImagePlaceholder[] = [];
|
|
25
|
-
let processedHtml = html;
|
|
26
|
-
|
|
27
|
-
// <img>
|
|
28
|
-
processedHtml = processedHtml.replace(/<img[^>]*>/g, (match) => {
|
|
29
|
-
const placeholder = `[IMG_${placeholders.length}]`;
|
|
30
|
-
placeholders.push({
|
|
31
|
-
original: match,
|
|
32
|
-
placeholder,
|
|
33
|
-
type: 'img'
|
|
34
|
-
});
|
|
35
|
-
return placeholder;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// <svg>
|
|
39
|
-
processedHtml = processedHtml.replace(/<svg[^>]*>[\s\S]*?<\/svg>/g, (match) => {
|
|
40
|
-
const placeholder = `[SVG_${placeholders.length}]`;
|
|
41
|
-
placeholders.push({
|
|
42
|
-
original: match,
|
|
43
|
-
placeholder,
|
|
44
|
-
type: 'svg'
|
|
45
|
-
});
|
|
46
|
-
return placeholder;
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return { processedHtml, placeholders };
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const { processedHtml, placeholders } = extractImages(content);
|
|
23
|
+
const { processedHtml, placeholders } = extractHtmlTags(content);
|
|
53
24
|
setProcessedContent(processedHtml);
|
|
54
|
-
|
|
25
|
+
setHtmlTagPlaceholders(placeholders);
|
|
55
26
|
}, [content]);
|
|
56
27
|
|
|
57
28
|
// Handle typing effects
|
|
@@ -61,7 +32,7 @@ const TypingEffect: React.FC<TypingEffectProps> = ({ content, speed, onComplete,
|
|
|
61
32
|
let newContent = processedContent.substring(0, index + 1);
|
|
62
33
|
|
|
63
34
|
// Replace the completed placeholder
|
|
64
|
-
|
|
35
|
+
htmlTagPlaceholder.forEach(({ original, placeholder }) => {
|
|
65
36
|
if (newContent.includes(placeholder)) {
|
|
66
37
|
newContent = newContent.replace(placeholder, original);
|
|
67
38
|
}
|
|
@@ -77,9 +48,9 @@ const TypingEffect: React.FC<TypingEffectProps> = ({ content, speed, onComplete,
|
|
|
77
48
|
}, speed);
|
|
78
49
|
|
|
79
50
|
return () => clearInterval(timer);
|
|
80
|
-
}, [processedContent, index, speed, onComplete, onUpdate,
|
|
51
|
+
}, [processedContent, index, speed, onComplete, onUpdate, htmlTagPlaceholder]);
|
|
81
52
|
|
|
82
|
-
return <
|
|
53
|
+
return <div dangerouslySetInnerHTML={{ __html: displayedContent }} />;
|
|
83
54
|
};
|
|
84
55
|
|
|
85
56
|
export default TypingEffect;
|