funda-ui 4.7.625 → 4.7.711

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.
Files changed (90) hide show
  1. package/CascadingSelect/index.js +2 -2
  2. package/CascadingSelectE2E/index.js +2 -2
  3. package/Chatbox/index.js +3 -17
  4. package/Checkbox/index.js +3 -3
  5. package/ColorPicker/index.js +3 -18
  6. package/Date/index.js +3 -18
  7. package/EventCalendarTimeline/index.d.ts +2 -2
  8. package/EventCalendarTimeline/index.js +24 -6
  9. package/File/index.d.ts +9 -0
  10. package/File/index.js +245 -93
  11. package/Input/index.js +3 -18
  12. package/LiveSearch/index.js +3 -18
  13. package/NativeSelect/index.js +3 -3
  14. package/NumberInput/index.js +3 -18
  15. package/Popover/index.css +198 -0
  16. package/Popover/index.d.ts +4 -0
  17. package/Popover/index.js +1808 -0
  18. package/README.md +1 -0
  19. package/Radio/index.js +3 -3
  20. package/RangeSlider/index.js +3 -18
  21. package/SearchBar/index.js +3 -18
  22. package/Select/index.js +3 -2
  23. package/Switch/index.js +3 -3
  24. package/TagInput/index.css +31 -31
  25. package/TagInput/index.js +12 -23
  26. package/Textarea/index.js +3 -17
  27. package/Utils/usePageVisibility.d.ts +5 -0
  28. package/Utils/usePageVisibility.js +166 -0
  29. package/Utils/useSSE.d.ts +50 -0
  30. package/Utils/useSSE.js +235 -0
  31. package/all.d.ts +1 -0
  32. package/all.js +1 -0
  33. package/lib/cjs/CascadingSelect/index.js +2 -2
  34. package/lib/cjs/CascadingSelectE2E/index.js +2 -2
  35. package/lib/cjs/Chatbox/index.js +3 -17
  36. package/lib/cjs/Checkbox/index.js +3 -3
  37. package/lib/cjs/ColorPicker/index.js +3 -18
  38. package/lib/cjs/Date/index.js +3 -18
  39. package/lib/cjs/EventCalendarTimeline/index.d.ts +2 -2
  40. package/lib/cjs/EventCalendarTimeline/index.js +24 -6
  41. package/lib/cjs/File/index.d.ts +9 -0
  42. package/lib/cjs/File/index.js +245 -93
  43. package/lib/cjs/Input/index.js +3 -18
  44. package/lib/cjs/LiveSearch/index.js +3 -18
  45. package/lib/cjs/NativeSelect/index.js +3 -3
  46. package/lib/cjs/NumberInput/index.js +3 -18
  47. package/lib/cjs/Popover/index.d.ts +4 -0
  48. package/lib/cjs/Popover/index.js +1808 -0
  49. package/lib/cjs/Radio/index.js +3 -3
  50. package/lib/cjs/RangeSlider/index.js +3 -18
  51. package/lib/cjs/SearchBar/index.js +3 -18
  52. package/lib/cjs/Select/index.js +3 -2
  53. package/lib/cjs/Switch/index.js +3 -3
  54. package/lib/cjs/TagInput/index.js +12 -23
  55. package/lib/cjs/Textarea/index.js +3 -17
  56. package/lib/cjs/Utils/usePageVisibility.d.ts +5 -0
  57. package/lib/cjs/Utils/usePageVisibility.js +166 -0
  58. package/lib/cjs/Utils/useSSE.d.ts +50 -0
  59. package/lib/cjs/Utils/useSSE.js +235 -0
  60. package/lib/cjs/index.d.ts +1 -0
  61. package/lib/cjs/index.js +1 -0
  62. package/lib/css/Popover/index.css +198 -0
  63. package/lib/css/TagInput/index.css +31 -31
  64. package/lib/esm/CascadingSelect/index.tsx +2 -2
  65. package/lib/esm/CascadingSelectE2E/index.tsx +2 -2
  66. package/lib/esm/Checkbox/index.tsx +3 -3
  67. package/lib/esm/ColorPicker/index.tsx +4 -15
  68. package/lib/esm/EventCalendarTimeline/index.tsx +30 -13
  69. package/lib/esm/File/index.tsx +148 -23
  70. package/lib/esm/Input/index.tsx +6 -17
  71. package/lib/esm/ModalDialog/index.tsx +0 -1
  72. package/lib/esm/NativeSelect/index.tsx +3 -3
  73. package/lib/esm/NumberInput/index.tsx +7 -15
  74. package/lib/esm/Popover/Popover.tsx +251 -0
  75. package/lib/esm/Popover/PopoverClose.tsx +51 -0
  76. package/lib/esm/Popover/PopoverContent.tsx +72 -0
  77. package/lib/esm/Popover/PopoverTrigger.tsx +62 -0
  78. package/lib/esm/Popover/index.scss +272 -0
  79. package/lib/esm/Popover/index.tsx +4 -0
  80. package/lib/esm/Radio/index.tsx +3 -3
  81. package/lib/esm/SearchBar/index.tsx +8 -12
  82. package/lib/esm/Select/index.tsx +2 -2
  83. package/lib/esm/Switch/index.tsx +3 -3
  84. package/lib/esm/TagInput/index.scss +24 -24
  85. package/lib/esm/TagInput/index.tsx +13 -20
  86. package/lib/esm/Textarea/index.tsx +6 -14
  87. package/lib/esm/Utils/hooks/usePageVisibility.tsx +84 -0
  88. package/lib/esm/Utils/hooks/useSSE.tsx +134 -0
  89. package/lib/esm/index.js +1 -0
  90. package/package.json +1 -1
@@ -1587,7 +1587,7 @@ var Radio = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(funct
1587
1587
  }
1588
1588
  function handleFocus(event) {
1589
1589
  var _rootRef$current;
1590
- (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus');
1590
+ (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus-floating');
1591
1591
 
1592
1592
  //
1593
1593
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
@@ -1606,7 +1606,7 @@ var Radio = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(funct
1606
1606
 
1607
1607
  //----
1608
1608
  //remove focus style
1609
- (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus');
1609
+ (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus-floating');
1610
1610
 
1611
1611
  //
1612
1612
  if (typeof onChange === 'function') {
@@ -1620,7 +1620,7 @@ var Radio = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(funct
1620
1620
  var _rootRef$current3;
1621
1621
  //----
1622
1622
  //remove focus style
1623
- (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus');
1623
+ (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus-floating');
1624
1624
 
1625
1625
  //
1626
1626
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
@@ -1764,9 +1764,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1764
1764
  }
1765
1765
  }
1766
1766
  function handleFocus(event) {
1767
- var _rootRef$current;
1768
- (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus');
1769
-
1770
1767
  //
1771
1768
  if (valRef.current) {
1772
1769
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, onComposition, valRef.current);
@@ -1775,13 +1772,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1775
1772
  function handleChange(event, curVal) {
1776
1773
  setChangedVal(curVal);
1777
1774
 
1778
- //----
1779
- //remove focus style
1780
- if (curVal === '') {
1781
- var _rootRef$current2;
1782
- (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus');
1783
- }
1784
-
1785
1775
  //
1786
1776
  if (valRef.current) {
1787
1777
  onChange === null || onChange === void 0 ? void 0 : onChange(event, onComposition, valRef.current, curVal);
@@ -1798,13 +1788,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1798
1788
  var el = event.target;
1799
1789
  var val = event.target.value;
1800
1790
 
1801
- //----
1802
- //remove focus style
1803
- if (val === '') {
1804
- var _rootRef$current3;
1805
- (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus');
1806
- }
1807
-
1808
1791
  //
1809
1792
  if (valRef.current) {
1810
1793
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event, onComposition, valRef.current);
@@ -1902,7 +1885,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1902
1885
  }
1903
1886
  }, []);
1904
1887
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1905
- className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3 position-relative'),
1888
+ className: (0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)((0, funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3 position-relative'), {
1889
+ 'focus-floating': changedVal !== ''
1890
+ }),
1906
1891
  ref: rootRef
1907
1892
  }, label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, typeof label === 'string' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
1908
1893
  htmlFor: idRes,
@@ -573,9 +573,6 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
573
573
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(event);
574
574
  }
575
575
  function handleFocus(event) {
576
- var _rootRef$current;
577
- (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus');
578
-
579
576
  //
580
577
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, onComposition);
581
578
  }
@@ -583,13 +580,6 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
583
580
  var val = event.target.value;
584
581
  setChangedVal(val);
585
582
 
586
- //----
587
- //remove focus style
588
- if (val === '') {
589
- var _rootRef$current2;
590
- (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus');
591
- }
592
-
593
583
  //
594
584
  onChange === null || onChange === void 0 ? void 0 : onChange(event, onComposition);
595
585
  }
@@ -597,13 +587,6 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
597
587
  var el = event.target;
598
588
  var val = event.target.value;
599
589
 
600
- //----
601
- //remove focus style
602
- if (val === '') {
603
- var _rootRef$current3;
604
- (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus');
605
- }
606
-
607
590
  //
608
591
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event, onComposition);
609
592
  }
@@ -624,7 +607,9 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
624
607
  setChangedVal(value || '');
625
608
  }, [value]);
626
609
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
627
- className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3 position-relative'),
610
+ className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)((0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3 position-relative'), {
611
+ 'focus-floating': changedVal !== ''
612
+ }),
628
613
  ref: rootRef
629
614
  }, label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, typeof label === 'string' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
630
615
  htmlFor: idRes,
@@ -4975,12 +4975,13 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
4975
4975
  filteredHeight = listContainerHeightLimit(filteredHeight);
4976
4976
  if (parseFloat(oldHeight) > filteredHeight) {
4977
4977
  listContentRef.current.style.height = filteredHeight + 'px';
4978
- console.log('popwinContainerHeightAdjust - height changed to:', filteredHeight);
4978
+ // console.log('popwinContainerHeightAdjust - height changed to:', filteredHeight);
4979
4979
  } else {
4980
4980
  listContentRef.current.style.height = oldHeight + 'px';
4981
- console.log('popwinContainerHeightAdjust - height kept as:', oldHeight);
4981
+ // console.log('popwinContainerHeightAdjust - height kept as:', oldHeight);
4982
4982
  }
4983
4983
  }
4984
+
4984
4985
  function popwinNoMatchInit() {
4985
4986
  if (listContentRef.current === null) return;
4986
4987
  var _btnSelectAll = listContentRef.current.querySelector('.custom-select-multi__control-option-item--select-all');
@@ -540,7 +540,7 @@ var Switch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(func
540
540
 
541
541
  function handleFocus(event) {
542
542
  var _rootRef$current;
543
- (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus');
543
+ (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus-floating');
544
544
 
545
545
  //
546
546
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
@@ -552,7 +552,7 @@ var Switch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(func
552
552
 
553
553
  //----
554
554
  //remove focus style
555
- (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus');
555
+ (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus-floating');
556
556
 
557
557
  //
558
558
  if (typeof onChange === 'function') {
@@ -563,7 +563,7 @@ var Switch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(func
563
563
  var _rootRef$current3;
564
564
  //----
565
565
  //remove focus style
566
- (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus');
566
+ (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus-floating');
567
567
 
568
568
  //
569
569
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
@@ -1075,13 +1075,6 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1075
1075
  function handleChange(event) {
1076
1076
  var val = event.target.value;
1077
1077
 
1078
- //----
1079
- //remove focus style
1080
- if (val === '') {
1081
- var _rootRef$current;
1082
- (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.remove('focus');
1083
- }
1084
-
1085
1078
  //
1086
1079
  var _alreadyInItems = alreadyInItems;
1087
1080
  if (items && items.length > 0) {
@@ -1098,8 +1091,9 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1098
1091
  setUserInput(val);
1099
1092
  }
1100
1093
  function handleFocus(event) {
1101
- var _rootRef$current2;
1102
- (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.add('focus');
1094
+ var _rootRef$current;
1095
+ // tag style
1096
+ (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus-floating');
1103
1097
 
1104
1098
  //
1105
1099
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
@@ -1107,15 +1101,8 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1107
1101
  function handleBlur(event) {
1108
1102
  var el = event.target;
1109
1103
  var val = event.target.value;
1110
-
1111
- //----
1112
- //remove focus style
1113
- if (val === '') {
1114
- var _rootRef$current3;
1115
- (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus');
1116
- }
1117
-
1118
- //
1104
+ setUserInput('');
1105
+ setAlreadyInItems(false);
1119
1106
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
1120
1107
  }
1121
1108
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
@@ -1124,7 +1111,9 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1124
1111
  initDefaultValue(value);
1125
1112
  }, [value]);
1126
1113
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1127
- className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.combinedCls)('tag-input__wrapper', (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.clsWrite)(wrapperClassName, 'mb-3 position-relative')),
1114
+ className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.combinedCls)('taginput__wrapper', (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.clsWrite)(wrapperClassName, 'mb-3 position-relative'), {
1115
+ 'focus-floating': userInput !== ''
1116
+ }),
1128
1117
  ref: rootRef
1129
1118
  }, label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, typeof label === 'string' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
1130
1119
  htmlFor: "label-".concat(idRes),
@@ -1136,9 +1125,9 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1136
1125
  htmlFor: "label-".concat(idRes),
1137
1126
  className: "form-label"
1138
1127
  }, label)) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1139
- className: "tag-input__control-wrapper"
1128
+ className: "taginput__control-wrapper"
1140
1129
  }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("ul", {
1141
- className: "tag-input__list"
1130
+ className: "taginput__list"
1142
1131
  }, 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) {
1143
1132
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
1144
1133
  key: index
@@ -1156,7 +1145,7 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1156
1145
  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"
1157
1146
  }))));
1158
1147
  }) : null)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1159
- className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.combinedCls)('tag-input__control', {
1148
+ className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_4__.combinedCls)('taginput__control', {
1160
1149
  'disabled': disabled
1161
1150
  }),
1162
1151
  style: {
@@ -1171,7 +1160,7 @@ var TagInput = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1171
1160
  // Don't use "name", it's just a container to display the label
1172
1161
  ,
1173
1162
  "data-name": name !== null && name !== void 0 && name.match(/(\[.*?\])/gi) ? "".concat(name.split('[')[0], "-label[]") : "".concat(name, "-label"),
1174
- "data-tag-input": true,
1163
+ "data-taginput": true,
1175
1164
  autoComplete: typeof autoComplete === 'undefined' ? 'off' : autoComplete,
1176
1165
  autoCapitalize: typeof autoCapitalize === 'undefined' ? 'off' : autoCapitalize,
1177
1166
  spellCheck: typeof spellCheck === 'undefined' ? false : spellCheck,
@@ -1561,9 +1561,7 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1561
1561
  return typeof p !== 'undefined' && p !== null && p !== '';
1562
1562
  };
1563
1563
  function handleFocus(event) {
1564
- var _rootRef$current;
1565
1564
  var el = event.target;
1566
- (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus');
1567
1565
 
1568
1566
  //
1569
1567
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, valRef.current);
@@ -1571,13 +1569,6 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1571
1569
  function handleChange(event, curVal) {
1572
1570
  setChangedVal(curVal);
1573
1571
 
1574
- //----
1575
- //remove focus style
1576
- if (curVal === '') {
1577
- var _rootRef$current2;
1578
- (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.classList.remove('focus');
1579
- }
1580
-
1581
1572
  //
1582
1573
  onChange === null || onChange === void 0 ? void 0 : onChange(event, valRef.current, curVal);
1583
1574
 
@@ -1592,13 +1583,6 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1592
1583
  var el = event.target;
1593
1584
  var val = el.value;
1594
1585
 
1595
- //----
1596
- //remove focus style
1597
- if (val === '') {
1598
- var _rootRef$current3;
1599
- (_rootRef$current3 = rootRef.current) === null || _rootRef$current3 === void 0 ? void 0 : _rootRef$current3.classList.remove('focus');
1600
- }
1601
-
1602
1586
  //
1603
1587
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event, valRef.current);
1604
1588
 
@@ -1705,7 +1689,9 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1705
1689
  }
1706
1690
  }, []);
1707
1691
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1708
- className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__.clsWrite)(wrapperClassName, 'mb-3 position-relative'),
1692
+ className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__.combinedCls)((0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_3__.clsWrite)(wrapperClassName, 'mb-3 position-relative'), {
1693
+ 'focus-floating': changedVal !== ''
1694
+ }),
1709
1695
  ref: rootRef
1710
1696
  }, label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, typeof label === 'string' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
1711
1697
  htmlFor: idRes,
@@ -0,0 +1,5 @@
1
+ declare type VisibilityCallback = () => void;
2
+ declare type UsePageVisibility = (onVisible?: VisibilityCallback, onHidden?: VisibilityCallback, onPageInit?: VisibilityCallback) => void;
3
+ declare const usePageVisibility: UsePageVisibility;
4
+ export default usePageVisibility;
5
+ export { usePageVisibility };
@@ -0,0 +1,166 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["react"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["RPB"] = factory(require("react"));
8
+ else
9
+ root["RPB"] = factory(root["React"]);
10
+ })(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ 787:
16
+ /***/ ((module) => {
17
+
18
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
19
+
20
+ /***/ })
21
+
22
+ /******/ });
23
+ /************************************************************************/
24
+ /******/ // The module cache
25
+ /******/ var __webpack_module_cache__ = {};
26
+ /******/
27
+ /******/ // The require function
28
+ /******/ function __webpack_require__(moduleId) {
29
+ /******/ // Check if module is in cache
30
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
31
+ /******/ if (cachedModule !== undefined) {
32
+ /******/ return cachedModule.exports;
33
+ /******/ }
34
+ /******/ // Create a new module (and put it into the cache)
35
+ /******/ var module = __webpack_module_cache__[moduleId] = {
36
+ /******/ // no module.id needed
37
+ /******/ // no module.loaded needed
38
+ /******/ exports: {}
39
+ /******/ };
40
+ /******/
41
+ /******/ // Execute the module function
42
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
43
+ /******/
44
+ /******/ // Return the exports of the module
45
+ /******/ return module.exports;
46
+ /******/ }
47
+ /******/
48
+ /************************************************************************/
49
+ /******/ /* webpack/runtime/compat get default export */
50
+ /******/ (() => {
51
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
52
+ /******/ __webpack_require__.n = (module) => {
53
+ /******/ var getter = module && module.__esModule ?
54
+ /******/ () => (module['default']) :
55
+ /******/ () => (module);
56
+ /******/ __webpack_require__.d(getter, { a: getter });
57
+ /******/ return getter;
58
+ /******/ };
59
+ /******/ })();
60
+ /******/
61
+ /******/ /* webpack/runtime/define property getters */
62
+ /******/ (() => {
63
+ /******/ // define getter functions for harmony exports
64
+ /******/ __webpack_require__.d = (exports, definition) => {
65
+ /******/ for(var key in definition) {
66
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
67
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
68
+ /******/ }
69
+ /******/ }
70
+ /******/ };
71
+ /******/ })();
72
+ /******/
73
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
74
+ /******/ (() => {
75
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
76
+ /******/ })();
77
+ /******/
78
+ /******/ /* webpack/runtime/make namespace object */
79
+ /******/ (() => {
80
+ /******/ // define __esModule on exports
81
+ /******/ __webpack_require__.r = (exports) => {
82
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
83
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
84
+ /******/ }
85
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
86
+ /******/ };
87
+ /******/ })();
88
+ /******/
89
+ /************************************************************************/
90
+ var __webpack_exports__ = {};
91
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
92
+ (() => {
93
+ __webpack_require__.r(__webpack_exports__);
94
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
95
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
96
+ /* harmony export */ "usePageVisibility": () => (/* binding */ usePageVisibility)
97
+ /* harmony export */ });
98
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
99
+ /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
100
+ /**
101
+ * Watch for to know when a document becomes visible or hidden
102
+ * @param onVisible
103
+ * @param onHidden
104
+ * @param onPageInit executed once when the page first loads visibly
105
+ */
106
+ /*
107
+ @usage:
108
+
109
+ const App = () => {
110
+ usePageVisibility(
111
+ () => console.log("🍏 Page is now visible — current tab is active."),
112
+ () => console.log("🍎 Page is hidden — switched to another tab or minimized."),
113
+ () => console.log("🎬 Page initialized while visible.")
114
+ );
115
+
116
+ return <div>Try switching tabs to see the console output.</div>;
117
+ };
118
+
119
+ */
120
+
121
+ var usePageVisibility = function usePageVisibility(onVisible, onHidden, onPageInit) {
122
+ var visibleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(document.visibilityState === "visible");
123
+ var onVisibleRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onVisible);
124
+ var onHiddenRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onHidden);
125
+ var initialVisibleTriggeredRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
126
+ var onPageInitRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(onPageInit);
127
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
128
+ onVisibleRef.current = onVisible;
129
+ }, [onVisible]);
130
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
131
+ onHiddenRef.current = onHidden;
132
+ }, [onHidden]);
133
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
134
+ onPageInitRef.current = onPageInit;
135
+ }, [onPageInit]);
136
+ (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
137
+ var handleVisibilityChange = function handleVisibilityChange() {
138
+ var isVisible = document.visibilityState === "visible";
139
+ if (isVisible && !visibleRef.current) {
140
+ onVisibleRef.current && onVisibleRef.current();
141
+ }
142
+ if (!isVisible && visibleRef.current) {
143
+ onHiddenRef.current && onHiddenRef.current();
144
+ }
145
+ visibleRef.current = isVisible;
146
+ };
147
+
148
+ // It retains the original switching monitor, and can ensure that onPageInit will run when the first screen is loaded.
149
+ if (visibleRef.current && !initialVisibleTriggeredRef.current) {
150
+ initialVisibleTriggeredRef.current = true;
151
+ onPageInitRef.current && onPageInitRef.current();
152
+ }
153
+ document.addEventListener("visibilitychange", handleVisibilityChange);
154
+ return function () {
155
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
156
+ };
157
+ }, []);
158
+ };
159
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (usePageVisibility);
160
+
161
+ })();
162
+
163
+ /******/ return __webpack_exports__;
164
+ /******/ })()
165
+ ;
166
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * SSE
3
+ *
4
+ * @usage:
5
+ *
6
+ const App = () => {
7
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
8
+
9
+ return (
10
+ <div>
11
+ <p>Status: {connected ? '✅ Connected' : '❌ Disconnected'}</p>
12
+ <button onClick={disconnect}>Disconnect</button>
13
+ <button onClick={reconnect}>Reconnect</button>
14
+ {messages.map((m, i) => <div key={i}>{m}</div>)}
15
+ </div>
16
+ );
17
+ };
18
+
19
+ * It is recommended to use it in conjunction with usePageVisibility, because in HTTP mode,
20
+ * browsers allow a maximum of 6 connections; otherwise, other normal interfaces will be suspended and inaccessible.
21
+
22
+ import usePageVisibility from 'funda-ui/Utils/usePageVisibility';
23
+
24
+ const App = () => {
25
+ const { connected, messages, disconnect, reconnect } = useSSE('http://localhost:3000/sse');
26
+
27
+ // add new
28
+ usePageVisibility(
29
+ () => {
30
+ reconnect();
31
+ },
32
+ () => {
33
+ disconnect();
34
+ },
35
+ () => console.log("🎬 Page initialized while visible.")
36
+ );
37
+
38
+ return '';
39
+ };
40
+
41
+ */
42
+ declare const useSSE: (url: string | null | undefined, retryDelay?: number) => {
43
+ readonly connected: boolean;
44
+ readonly messages: string[];
45
+ readonly disconnect: () => void;
46
+ readonly reconnect: () => void;
47
+ readonly resetMessages: () => void;
48
+ };
49
+ export default useSSE;
50
+ export { useSSE };