funda-ui 4.6.101 → 4.6.111

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.
@@ -938,63 +938,63 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
938
938
  _ref$maxHeight = _ref.maxHeight,
939
939
  maxHeight = _ref$maxHeight === void 0 ? 0 : _ref$maxHeight,
940
940
  cb = _ref.cb;
941
- var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),
941
+ var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
942
942
  _useState2 = _slicedToArray(_useState, 2),
943
- defaultRowHeight = _useState2[0],
944
- setDefaultRowHeight = _useState2[1];
945
- var _useState3 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
946
- _useState4 = _slicedToArray(_useState3, 2),
947
- defaultRowHeightInit = _useState4[0],
948
- setDefaultRowHeightInit = _useState4[1];
943
+ defaultRowHeightInit = _useState2[0],
944
+ setDefaultRowHeightInit = _useState2[1];
949
945
 
950
946
  // Reset function to restore default height
951
947
  var reset = (0, react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () {
952
- if (el && defaultRowHeight > 0) {
953
- el.style.height = defaultRowHeight + "px";
954
-
955
- // Get current dimensions after reset
956
- var style = el.currentStyle || window.getComputedStyle(el);
957
- var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
958
- cb === null || cb === void 0 ? void 0 : cb([_controlWidth, defaultRowHeight]);
959
- }
960
- }, [el, defaultRowHeight, cb]);
948
+ if (!el) return;
949
+ var scrollHeight = el.scrollHeight;
950
+ el.style.height = scrollHeight + "px";
951
+
952
+ // Get current dimensions after reset
953
+ var style = window.getComputedStyle(el);
954
+ var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
955
+ cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
956
+ }, [el, cb]);
961
957
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
962
- if (el) {
963
- var style = el.currentStyle || window.getComputedStyle(el);
964
- var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
965
-
966
- // initialize default row height
967
- if (el.scrollHeight > 0 && !defaultRowHeightInit) {
968
- var _defaultRowHeight = el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth);
969
- if (maxHeight != 0 && _defaultRowHeight >= maxHeight) {
970
- _defaultRowHeight = maxHeight;
971
- }
972
- setDefaultRowHeight(_defaultRowHeight);
973
- setDefaultRowHeightInit(true);
958
+ if (!el) return;
959
+
960
+ // Initialize default height
961
+ if (!defaultRowHeightInit) {
962
+ el.style.height = 'auto';
963
+ var initialHeight = el.scrollHeight;
964
+ setDefaultRowHeightInit(true);
965
+
966
+ // If the height is 0, set it to "auto"
967
+ if (initialHeight === 0) {
968
+ el.style.height = "auto";
969
+ } else {
970
+ el.style.height = initialHeight + "px";
974
971
  }
972
+ }
975
973
 
976
- // restore default row height
977
- if (defaultRowHeight > 0) {
978
- el.style.height = defaultRowHeight + "px";
979
- }
974
+ // Get dimensions
975
+ var style = window.getComputedStyle(el);
976
+ var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
980
977
 
981
- // reset the height momentarily to get the correct scrollHeight for the textarea
982
- var scrollHeight = el.scrollHeight;
978
+ // Calculate height
979
+ el.style.height = 'auto';
980
+ var finalHeight = el.scrollHeight;
983
981
 
984
- // then set the height directly, outside of the render loop
985
- // Trying to set this with state or a ref will product an incorrect value.
982
+ // Apply max height limit if needed
983
+ if (maxHeight > 0 && finalHeight > maxHeight) {
984
+ finalHeight = maxHeight;
985
+ }
986
986
 
987
- // !!! Compare initial height and changed height
988
- if (scrollHeight > defaultRowHeight && defaultRowHeight > 0) {
989
- var _scrollHeight = scrollHeight;
990
- if (maxHeight != 0 && _scrollHeight >= maxHeight) {
991
- _scrollHeight = maxHeight;
992
- }
993
- el.style.height = _scrollHeight + "px";
994
- }
995
- cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
987
+ // Set final height
988
+ // If the height is 0, set it to "auto"
989
+ if (finalHeight === 0) {
990
+ el.style.height = "auto";
991
+ } else {
992
+ el.style.height = finalHeight + "px";
996
993
  }
997
- }, [el, value]);
994
+
995
+ // Callback
996
+ cb === null || cb === void 0 ? void 0 : cb([_controlWidth, finalHeight]);
997
+ }, [el, value, maxHeight, defaultRowHeightInit]);
998
998
  return {
999
999
  reset: reset
1000
1000
  };
@@ -1013,8 +1013,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1013
1013
  /***/
1014
1014
  },
1015
1015
 
1016
- /***/85: /***/function _(module, exports, __nested_webpack_require_39872__) {
1017
- /* module decorator */module = __nested_webpack_require_39872__.nmd(module);
1016
+ /***/85: /***/function _(module, exports, __nested_webpack_require_39270__) {
1017
+ /* module decorator */module = __nested_webpack_require_39270__.nmd(module);
1018
1018
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
1019
1019
  function _typeof(obj) {
1020
1020
  "@babel/helpers - typeof";
@@ -1026,7 +1026,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1026
1026
  }, _typeof(obj);
1027
1027
  }
1028
1028
  (function webpackUniversalModuleDefinition(root, factory) {
1029
- if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_39872__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_39872__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1029
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_39270__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_39270__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1030
1030
  })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
1031
1031
  return (/******/function () {
1032
1032
  // webpackBootstrap
@@ -1186,8 +1186,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1186
1186
  /***/
1187
1187
  },
1188
1188
 
1189
- /***/702: /***/function _(module, exports, __nested_webpack_require_47960__) {
1190
- /* module decorator */module = __nested_webpack_require_47960__.nmd(module);
1189
+ /***/702: /***/function _(module, exports, __nested_webpack_require_47358__) {
1190
+ /* module decorator */module = __nested_webpack_require_47358__.nmd(module);
1191
1191
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
1192
1192
  function _typeof(obj) {
1193
1193
  "@babel/helpers - typeof";
@@ -1199,7 +1199,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1199
1199
  }, _typeof(obj);
1200
1200
  }
1201
1201
  (function webpackUniversalModuleDefinition(root, factory) {
1202
- if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_47960__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_47960__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1202
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory(__nested_webpack_require_47358__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__nested_webpack_require_47358__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = factory, __WEBPACK_AMD_DEFINE_RESULT__ = typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? __WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__) : __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
1203
1203
  })(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
1204
1204
  return (/******/function () {
1205
1205
  // webpackBootstrap
@@ -1400,7 +1400,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1400
1400
  /******/
1401
1401
  /******/ // The require function
1402
1402
  /******/
1403
- function __nested_webpack_require_57581__(moduleId) {
1403
+ function __nested_webpack_require_56979__(moduleId) {
1404
1404
  /******/ // Check if module is in cache
1405
1405
  /******/var cachedModule = __webpack_module_cache__[moduleId];
1406
1406
  /******/
@@ -1419,7 +1419,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1419
1419
  /******/
1420
1420
  /******/ // Execute the module function
1421
1421
  /******/
1422
- __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_57581__);
1422
+ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_56979__);
1423
1423
  /******/
1424
1424
  /******/ // Flag the module as loaded
1425
1425
  /******/
@@ -1436,14 +1436,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1436
1436
  /******/
1437
1437
  (function () {
1438
1438
  /******/ // getDefaultExport function for compatibility with non-harmony modules
1439
- /******/__nested_webpack_require_57581__.n = function (module) {
1439
+ /******/__nested_webpack_require_56979__.n = function (module) {
1440
1440
  /******/var getter = module && module.__esModule ? /******/function () {
1441
1441
  return module['default'];
1442
1442
  } : /******/function () {
1443
1443
  return module;
1444
1444
  };
1445
1445
  /******/
1446
- __nested_webpack_require_57581__.d(getter, {
1446
+ __nested_webpack_require_56979__.d(getter, {
1447
1447
  a: getter
1448
1448
  });
1449
1449
  /******/
@@ -1457,9 +1457,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1457
1457
  /******/
1458
1458
  (function () {
1459
1459
  /******/ // define getter functions for harmony exports
1460
- /******/__nested_webpack_require_57581__.d = function (exports, definition) {
1460
+ /******/__nested_webpack_require_56979__.d = function (exports, definition) {
1461
1461
  /******/for (var key in definition) {
1462
- /******/if (__nested_webpack_require_57581__.o(definition, key) && !__nested_webpack_require_57581__.o(exports, key)) {
1462
+ /******/if (__nested_webpack_require_56979__.o(definition, key) && !__nested_webpack_require_56979__.o(exports, key)) {
1463
1463
  /******/Object.defineProperty(exports, key, {
1464
1464
  enumerable: true,
1465
1465
  get: definition[key]
@@ -1476,7 +1476,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1476
1476
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
1477
1477
  /******/
1478
1478
  (function () {
1479
- /******/__nested_webpack_require_57581__.o = function (obj, prop) {
1479
+ /******/__nested_webpack_require_56979__.o = function (obj, prop) {
1480
1480
  return Object.prototype.hasOwnProperty.call(obj, prop);
1481
1481
  };
1482
1482
  /******/
@@ -1486,7 +1486,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1486
1486
  /******/
1487
1487
  (function () {
1488
1488
  /******/ // define __esModule on exports
1489
- /******/__nested_webpack_require_57581__.r = function (exports) {
1489
+ /******/__nested_webpack_require_56979__.r = function (exports) {
1490
1490
  /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1491
1491
  /******/Object.defineProperty(exports, Symbol.toStringTag, {
1492
1492
  value: 'Module'
@@ -1505,7 +1505,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1505
1505
  /******/ /* webpack/runtime/node module decorator */
1506
1506
  /******/
1507
1507
  (function () {
1508
- /******/__nested_webpack_require_57581__.nmd = function (module) {
1508
+ /******/__nested_webpack_require_56979__.nmd = function (module) {
1509
1509
  /******/module.paths = [];
1510
1510
  /******/
1511
1511
  if (!module.children) module.children = [];
@@ -1522,38 +1522,38 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1522
1522
  (function () {
1523
1523
  "use strict";
1524
1524
 
1525
- __nested_webpack_require_57581__.r(__webpack_exports__);
1525
+ __nested_webpack_require_56979__.r(__webpack_exports__);
1526
1526
  /* harmony export */
1527
- __nested_webpack_require_57581__.d(__webpack_exports__, {
1527
+ __nested_webpack_require_56979__.d(__webpack_exports__, {
1528
1528
  /* harmony export */"default": function _default() {
1529
1529
  return __WEBPACK_DEFAULT_EXPORT__;
1530
1530
  }
1531
1531
  /* harmony export */
1532
1532
  });
1533
1533
  /* harmony import */
1534
- var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_57581__(787);
1534
+ var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_56979__(787);
1535
1535
  /* harmony import */
1536
- var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_57581__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1536
+ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_56979__.n(react__WEBPACK_IMPORTED_MODULE_0__);
1537
1537
  /* harmony import */
1538
- var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_57581__(85);
1538
+ var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_56979__(85);
1539
1539
  /* harmony import */
1540
- var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__);
1540
+ var funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1__);
1541
1541
  /* harmony import */
1542
- var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_57581__(372);
1542
+ var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_56979__(372);
1543
1543
  /* harmony import */
1544
- var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__);
1544
+ var funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_useAutosizeTextArea__WEBPACK_IMPORTED_MODULE_2__);
1545
1545
  /* harmony import */
1546
- var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_57581__(188);
1546
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_56979__(188);
1547
1547
  /* harmony import */
1548
- var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__);
1548
+ var funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__);
1549
1549
  /* harmony import */
1550
- var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_57581__(954);
1550
+ var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_56979__(954);
1551
1551
  /* harmony import */
1552
- var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__);
1552
+ var funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_inputsCalculation__WEBPACK_IMPORTED_MODULE_4__);
1553
1553
  /* harmony import */
1554
- var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_57581__(702);
1554
+ var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_56979__(702);
1555
1555
  /* harmony import */
1556
- var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__nested_webpack_require_57581__.n(funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__);
1556
+ var funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__nested_webpack_require_56979__.n(funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_5__);
1557
1557
  var _excluded = ["contentRef", "wrapperClassName", "controlClassName", "controlExClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "cols", "rows", "disabled", "required", "placeholder", "autoSize", "autoSizeMaxHeight", "iconLeft", "iconRight", "aiPredict", "aiPredictRemainingTextRGB", "aiPredictConfirmKey", "aiPredictFetchFuncAsync", "aiPredictFetchFuncMethod", "aiPredictFetchFuncMethodParams", "aiPredictFetchCallback", "readOnly", "defaultValue", "value", "requiredLabel", "label", "name", "id", "minLength", "maxLength", "style", "tabIndex", "onChangeCallback", "onInputCallback", "onKeyPressedCallback", "onChange", "onBlur", "onFocus", "onPressEnter", "onKeyDown", "onKeyUp", "onResize"];
1558
1558
  function _regeneratorRuntime() {
1559
1559
  "use strict";
@@ -2513,6 +2513,133 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2513
2513
 
2514
2514
  /***/ }),
2515
2515
 
2516
+ /***/ 959:
2517
+ /***/ (function(module, exports, __webpack_require__) {
2518
+
2519
+ /* module decorator */ module = __webpack_require__.nmd(module);
2520
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;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); }
2521
+ (function webpackUniversalModuleDefinition(root, factory) {
2522
+ if (( false ? 0 : _typeof(exports)) === 'object' && ( false ? 0 : _typeof(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
2523
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
2524
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
2525
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
2526
+ })(this, function () {
2527
+ return (/******/function () {
2528
+ // webpackBootstrap
2529
+ /******/
2530
+ "use strict";
2531
+
2532
+ /******/ // The require scope
2533
+ /******/
2534
+ var __nested_webpack_require_987__ = {};
2535
+ /******/
2536
+ /************************************************************************/
2537
+ /******/ /* webpack/runtime/define property getters */
2538
+ /******/
2539
+ (function () {
2540
+ /******/ // define getter functions for harmony exports
2541
+ /******/__nested_webpack_require_987__.d = function (exports, definition) {
2542
+ /******/for (var key in definition) {
2543
+ /******/if (__nested_webpack_require_987__.o(definition, key) && !__nested_webpack_require_987__.o(exports, key)) {
2544
+ /******/Object.defineProperty(exports, key, {
2545
+ enumerable: true,
2546
+ get: definition[key]
2547
+ });
2548
+ /******/
2549
+ }
2550
+ /******/
2551
+ }
2552
+ /******/
2553
+ };
2554
+ /******/
2555
+ })();
2556
+ /******/
2557
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
2558
+ /******/
2559
+ (function () {
2560
+ /******/__nested_webpack_require_987__.o = function (obj, prop) {
2561
+ return Object.prototype.hasOwnProperty.call(obj, prop);
2562
+ };
2563
+ /******/
2564
+ })();
2565
+ /******/
2566
+ /******/ /* webpack/runtime/make namespace object */
2567
+ /******/
2568
+ (function () {
2569
+ /******/ // define __esModule on exports
2570
+ /******/__nested_webpack_require_987__.r = function (exports) {
2571
+ /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
2572
+ /******/Object.defineProperty(exports, Symbol.toStringTag, {
2573
+ value: 'Module'
2574
+ });
2575
+ /******/
2576
+ }
2577
+ /******/
2578
+ Object.defineProperty(exports, '__esModule', {
2579
+ value: true
2580
+ });
2581
+ /******/
2582
+ };
2583
+ /******/
2584
+ })();
2585
+ /******/
2586
+ /************************************************************************/
2587
+ var __webpack_exports__ = {};
2588
+ __nested_webpack_require_987__.r(__webpack_exports__);
2589
+ /* harmony export */
2590
+ __nested_webpack_require_987__.d(__webpack_exports__, {
2591
+ /* harmony export */"htmlDecode": function htmlDecode() {
2592
+ return (/* binding */_htmlDecode
2593
+ );
2594
+ },
2595
+ /* harmony export */"htmlEncode": function htmlEncode() {
2596
+ return (/* binding */_htmlEncode
2597
+ );
2598
+ }
2599
+ /* harmony export */
2600
+ });
2601
+ /**
2602
+ * HTML entities encode
2603
+ *
2604
+ * @param {String} str Input text
2605
+ * @return {String} Filtered text
2606
+ */
2607
+ function _htmlEncode(str) {
2608
+ return str.replace(/[&<>'"]/g, function (tag) {
2609
+ return {
2610
+ '&': '&amp;',
2611
+ '<': '&lt;',
2612
+ '>': '&gt;',
2613
+ "'": '&#39;',
2614
+ '"': '&quot;'
2615
+ }[tag];
2616
+ });
2617
+ }
2618
+
2619
+ /**
2620
+ * HTML entities decode
2621
+ *
2622
+ * @param {String} str Input text
2623
+ * @return {String} Filtered text
2624
+ */
2625
+ function _htmlDecode() {
2626
+ var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
2627
+ var entities = [['amp', '&'], ['apos', '\''], ['#x27', '\''], ['#x2F', '/'], ['#39', '\''], ['#47', '/'], ['lt', '<'], ['gt', '>'], ['nbsp', ' '], ['quot', '"'], ['#60', '<'], ['#62', '>']];
2628
+ for (var i = 0, max = entities.length; i < max; i++) {
2629
+ str = str.replace(new RegExp('&' + entities[i][0] + ';', 'g'), entities[i][1]);
2630
+ }
2631
+ return str;
2632
+ }
2633
+
2634
+ /******/
2635
+ return __webpack_exports__;
2636
+ /******/
2637
+ }()
2638
+ );
2639
+ });
2640
+
2641
+ /***/ }),
2642
+
2516
2643
  /***/ 761:
2517
2644
  /***/ (function(module, exports, __webpack_require__) {
2518
2645
 
@@ -3433,6 +3560,8 @@ var useThrottle_default = /*#__PURE__*/__webpack_require__.n(useThrottle);
3433
3560
  // EXTERNAL MODULE: ../Utils/dist/cjs/useClickOutside.js
3434
3561
  var useClickOutside = __webpack_require__(761);
3435
3562
  var useClickOutside_default = /*#__PURE__*/__webpack_require__.n(useClickOutside);
3563
+ // EXTERNAL MODULE: ../Utils/dist/cjs/sanitize.js
3564
+ var sanitize = __webpack_require__(959);
3436
3565
  ;// CONCATENATED MODULE: ./src/PureLoader.tsx
3437
3566
 
3438
3567
  var PureLoader = function PureLoader(props) {
@@ -3658,40 +3787,6 @@ function isStreamResponse(response) {
3658
3787
  return response.body instanceof ReadableStream;
3659
3788
  }
3660
3789
  ;
3661
-
3662
- /**
3663
- * HTML entities encode
3664
- *
3665
- * @param {String} str Input text
3666
- * @return {String} Filtered text
3667
- */
3668
- function htmlEncode(str) {
3669
- return str.replace(/[&<>'"]/g, function (tag) {
3670
- return {
3671
- '&': '&amp;',
3672
- '<': '&lt;',
3673
- '>': '&gt;',
3674
- "'": '&#39;',
3675
- '"': '&quot;'
3676
- }[tag];
3677
- });
3678
- }
3679
-
3680
- /**
3681
- * HTML entities decode
3682
- *
3683
- * @param {String} str Input text
3684
- * @return {String} Filtered text
3685
- */
3686
- function htmlDecode(str) {
3687
- var res = '';
3688
- var entities = [['amp', '&'], ['apos', '\''], ['#x27', '\''], ['#x2F', '/'], ['#39', '\''], ['#47', '/'], ['lt', '<'], ['gt', '>'], ['nbsp', ' '], ['quot', '"'], ['#60', '<'], ['#62', '>']];
3689
- for (var i = 0, max = entities.length; i < max; i++) {
3690
- str = str.replace(new RegExp('&' + entities[i][0] + ';', 'g'), entities[i][1]);
3691
- }
3692
- res = str;
3693
- return res;
3694
- }
3695
3790
  ;// CONCATENATED MODULE: ./src/useStreamController.tsx
3696
3791
  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); }
3697
3792
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
@@ -4111,6 +4206,7 @@ function src_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4111
4206
 
4112
4207
 
4113
4208
 
4209
+
4114
4210
  // loader
4115
4211
 
4116
4212
 
@@ -4266,6 +4362,7 @@ var Chatbox = function Chatbox(props) {
4266
4362
  return {};
4267
4363
  }
4268
4364
  var debug = currentProps.debug,
4365
+ defaultRows = currentProps.defaultRows,
4269
4366
  prefix = currentProps.prefix,
4270
4367
  contentRef = currentProps.contentRef,
4271
4368
  model = currentProps.model,
@@ -4333,6 +4430,7 @@ var Chatbox = function Chatbox(props) {
4333
4430
  var responseExtractPath = responseExtractor.split('.');
4334
4431
  return {
4335
4432
  debug: debug,
4433
+ defaultRows: defaultRows,
4336
4434
  prefix: prefix,
4337
4435
  contentRef: contentRef,
4338
4436
  model: model,
@@ -4832,7 +4930,7 @@ var Chatbox = function Chatbox(props) {
4832
4930
  return _context4.abrupt("return");
4833
4931
  case 2:
4834
4932
  messageInput = msInput.current;
4835
- message = htmlEncode(messageInput.value); // It fires in real time as the user enters
4933
+ message = (0,sanitize.htmlEncode)(messageInput.value); // It fires in real time as the user enters
4836
4934
  // Sanitizing input is the process of securing/cleaning/filtering input data.
4837
4935
  if (!(typeof args().onInputCallback === 'function')) {
4838
4936
  _context4.next = 8;
@@ -5356,8 +5454,12 @@ var Chatbox = function Chatbox(props) {
5356
5454
  placeholder: args().placeholder,
5357
5455
  disabled: loading ? true : false,
5358
5456
  onKeyDown: function onKeyDown(event) {
5359
- if (event.key === 'Enter') {
5360
- event.preventDefault();
5457
+ // line breaks
5458
+ if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {
5459
+ return;
5460
+ }
5461
+ if (event.key === 'Enter' && !event.shiftKey && !event.ctrlKey && !event.metaKey) {
5462
+ event.preventDefault(); // Prevent line breaks
5361
5463
  handleClickSafe();
5362
5464
  }
5363
5465
  },
@@ -5365,7 +5467,7 @@ var Chatbox = function Chatbox(props) {
5365
5467
  var _args$onInputChange, _args10;
5366
5468
  (_args$onInputChange = (_args10 = args()).onInputChange) === null || _args$onInputChange === void 0 ? void 0 : _args$onInputChange.call(_args10, inputContentRef.current, e.target.value);
5367
5469
  },
5368
- rows: 3,
5470
+ rows: args().defaultRows || 3,
5369
5471
  autoSize: true,
5370
5472
  autoSizeMaxHeight: 200
5371
5473
  }), loading ? /*#__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("button", {