@capillarytech/blaze-ui 1.0.3-alpha.6 → 1.0.3-alpha.8

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.
@@ -773,19 +773,14 @@ var _CapRow = _interopRequireDefault(__webpack_require__(7375));
773
773
  var _CapSpin = _interopRequireDefault(__webpack_require__(1549));
774
774
  var _CapTooltip = _interopRequireDefault(__webpack_require__(5636));
775
775
  var _CapTooltipWithInfo = _interopRequireDefault(__webpack_require__(2608));
776
+ var _constants = __webpack_require__(9788);
776
777
  var _styles = _interopRequireDefault(__webpack_require__(8263));
777
778
  var _jsxRuntime = __webpack_require__(4848);
778
- const _excluded = ["type", "options", "value", "onChange", "placeholder", "className", "style", "isError", "errorMessage", "containerClassName", "popoverClassName", "allowClear", "headerLabel", "onUpload", "uploadLabel", "tooltip", "bylineText", "disabled", "showUpload", "customPopupRender", "showSearch", "searchBasedOn", "onSearch", "searchDebounce", "onConfirm", "clearText", "noResultCustomText", "noResultCustomIcon", "readOnly", "staticValue", "onFooterDownloadChange", "onPopupScroll", "enableVirtualization", "virtualRowHeight", "resetSearch", "resetData"];
779
+ const _excluded = ["type", "options", "value", "onChange", "placeholder", "className", "style", "isError", "errorMessage", "containerClassName", "popoverClassName", "allowClear", "headerLabel", "onUpload", "uploadLabel", "tooltip", "bylineText", "disabled", "showUpload", "customPopupRender", "showSearch", "searchBasedOn", "onSearch", "searchDebounce", "onConfirm", "clearText", "noResultCustomText", "noResultCustomIcon", "readOnly", "staticValue", "onFooterDownloadChange", "onPopupScroll", "enableVirtualization", "virtualRowHeight", "resetSearch", "resetData", "fetchMissingOptions"];
779
780
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
780
781
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
781
782
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
782
783
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /* eslint-disable max-lines */
783
- const SELECT_TYPES = {
784
- SELECT: 'select',
785
- MULTI_SELECT: 'multiSelect',
786
- TREE_SELECT: 'treeSelect',
787
- MULTI_TREE_SELECT: 'multiTreeSelect'
788
- };
789
784
  const NoResult = _ref => {
790
785
  let {
791
786
  noResultCustomText,
@@ -803,7 +798,7 @@ const NoResult = _ref => {
803
798
  size: "m"
804
799
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
805
800
  className: _styles.default['cap-unified-select-no-result-text'],
806
- children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : 'No results found'
801
+ children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : _constants.DEFAULTS.NO_RESULT_TEXT
807
802
  })]
808
803
  });
809
804
  };
@@ -919,11 +914,11 @@ const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
919
914
  };
920
915
  const CapUnifiedSelect = _ref4 => {
921
916
  let {
922
- type = SELECT_TYPES.SELECT,
917
+ type = _constants.SELECT_TYPES.SELECT,
923
918
  options = [],
924
919
  value,
925
920
  onChange,
926
- placeholder = 'Select an option',
921
+ placeholder = _constants.DEFAULTS.PLACEHOLDER,
927
922
  className = '',
928
923
  style,
929
924
  isError = false,
@@ -933,7 +928,7 @@ const CapUnifiedSelect = _ref4 => {
933
928
  allowClear = false,
934
929
  headerLabel,
935
930
  onUpload,
936
- uploadLabel = 'Upload',
931
+ uploadLabel = _constants.DEFAULTS.UPLOAD_LABEL,
937
932
  tooltip,
938
933
  bylineText,
939
934
  disabled = false,
@@ -942,19 +937,20 @@ const CapUnifiedSelect = _ref4 => {
942
937
  showSearch = true,
943
938
  searchBasedOn = 'label',
944
939
  onSearch,
945
- searchDebounce = 300,
940
+ searchDebounce = _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE,
946
941
  onConfirm,
947
- clearText = 'Clear',
948
- noResultCustomText = 'No results found',
949
- noResultCustomIcon = 'warning',
942
+ clearText = _constants.DEFAULTS.CLEAR_TEXT,
943
+ noResultCustomText = _constants.DEFAULTS.NO_RESULT_TEXT,
944
+ noResultCustomIcon = _constants.DEFAULTS.NO_RESULT_ICON,
950
945
  readOnly = false,
951
946
  staticValue = true,
952
947
  onFooterDownloadChange,
953
948
  onPopupScroll,
954
949
  enableVirtualization = false,
955
- virtualRowHeight = 32,
956
- resetSearch = false,
957
- resetData
950
+ virtualRowHeight = _constants.DEFAULTS.VIRTUAL_ROW_HEIGHT,
951
+ resetSearch = true,
952
+ resetData,
953
+ fetchMissingOptions
958
954
  } = _ref4,
959
955
  rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
960
956
  const [searchText, setSearchText] = (0, _react.useState)('');
@@ -968,6 +964,12 @@ const CapUnifiedSelect = _ref4 => {
968
964
  const searchTimeoutRef = (0, _react.useRef)(null);
969
965
  const scrollContainerRef = (0, _react.useRef)(null);
970
966
  const scrollLoadingTimeoutRef = (0, _react.useRef)(null);
967
+ // Track if scroll handler is currently processing to prevent duplicate calls
968
+ const isScrollProcessingRef = (0, _react.useRef)(false);
969
+ // Throttle ref for scroll events
970
+ const scrollThrottleTimeoutRef = (0, _react.useRef)(null);
971
+ // Ref to track options for scroll handler (avoids recreating handleScroll)
972
+ const optionsRef = (0, _react.useRef)(options);
971
973
  // Cache of selected items from async results to preserve them during search
972
974
  const selectedItemsCacheRef = (0, _react.useRef)(new Map());
973
975
  // Track the last search query to detect when options update after search
@@ -994,6 +996,74 @@ const CapUnifiedSelect = _ref4 => {
994
996
  const resetDataCalledRef = (0, _react.useRef)(false);
995
997
  // Track when resetData was called to help clear loading state
996
998
  const resetDataCalledTimeRef = (0, _react.useRef)(null);
999
+ // Track if fetchMissingOptions was already called to prevent duplicate calls
1000
+ const fetchMissingOptionsCalledRef = (0, _react.useRef)(false);
1001
+ // Track the last missing values that were sent to prevent duplicate calls with same values
1002
+ const lastMissingValuesRef = (0, _react.useRef)('');
1003
+
1004
+ // Helper function to check if a value exists in options (recursive for tree structures)
1005
+ const findValueInOptions = (0, _react.useCallback)((opts, targetValue) => {
1006
+ for (const opt of opts) {
1007
+ if (opt.value === targetValue) {
1008
+ return true;
1009
+ }
1010
+ if (opt.children && opt.children.length > 0) {
1011
+ if (findValueInOptions(opt.children, targetValue)) {
1012
+ return true;
1013
+ }
1014
+ }
1015
+ }
1016
+ return false;
1017
+ }, []);
1018
+
1019
+ // Helper function to find missing selected values
1020
+ const findMissingValues = (0, _react.useCallback)((selectedValues, currentOptions) => {
1021
+ if (!selectedValues.length || !currentOptions.length) {
1022
+ return selectedValues;
1023
+ }
1024
+ return selectedValues.filter(val => !findValueInOptions(currentOptions, val));
1025
+ }, [findValueInOptions]);
1026
+
1027
+ // Check for missing options and call fetchMissingOptions if needed
1028
+ (0, _react.useEffect)(() => {
1029
+ // Only check if fetchMissingOptions is provided
1030
+ if (!fetchMissingOptions) {
1031
+ return;
1032
+ }
1033
+
1034
+ // Get current selected values
1035
+ const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
1036
+ if (selectedValues.length === 0) {
1037
+ // No selected values, reset the tracking
1038
+ fetchMissingOptionsCalledRef.current = false;
1039
+ lastMissingValuesRef.current = '';
1040
+ return;
1041
+ }
1042
+
1043
+ // Find missing values
1044
+ const missingValues = findMissingValues(selectedValues, options);
1045
+
1046
+ // If no missing values, reset tracking and return
1047
+ if (missingValues.length === 0) {
1048
+ fetchMissingOptionsCalledRef.current = false;
1049
+ lastMissingValuesRef.current = '';
1050
+ return;
1051
+ }
1052
+
1053
+ // Create a sorted string representation of missing values for comparison
1054
+ // Use slice() to avoid mutating the original array
1055
+ const missingValuesKey = [...missingValues].sort().join(',');
1056
+
1057
+ // Only call if:
1058
+ // 1. We haven't called it before, OR
1059
+ // 2. The missing values have changed (different values are missing now)
1060
+ if (!fetchMissingOptionsCalledRef.current || lastMissingValuesRef.current !== missingValuesKey) {
1061
+ fetchMissingOptionsCalledRef.current = true;
1062
+ lastMissingValuesRef.current = missingValuesKey;
1063
+ // Call the developer's function with missing values (pass a copy to avoid mutation)
1064
+ fetchMissingOptions([...missingValues]);
1065
+ }
1066
+ }, [value, options, fetchMissingOptions, findMissingValues]);
997
1067
  (0, _react.useEffect)(() => {
998
1068
  const isEqual = Array.isArray(value) && Array.isArray(tempValue) ? (value == null ? void 0 : value.length) === (tempValue == null ? void 0 : tempValue.length) && value.every(v => Array.isArray(tempValue) && tempValue.includes(v)) : value === tempValue;
999
1069
  if (!isEqual) {
@@ -1068,7 +1138,12 @@ const CapUnifiedSelect = _ref4 => {
1068
1138
  }, [options, orderedOptions, tempValue]);
1069
1139
 
1070
1140
  // Extract debounce timeout (extracted early for use in useEffects)
1071
- const debounceTimeout = searchDebounce != null ? searchDebounce : 300;
1141
+ const debounceTimeout = searchDebounce != null ? searchDebounce : _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE;
1142
+
1143
+ // Keep optionsRef in sync with options
1144
+ (0, _react.useEffect)(() => {
1145
+ optionsRef.current = options;
1146
+ }, [options]);
1072
1147
 
1073
1148
  // Cleanup timeouts on unmount
1074
1149
  (0, _react.useEffect)(() => {
@@ -1079,6 +1154,9 @@ const CapUnifiedSelect = _ref4 => {
1079
1154
  if (scrollLoadingTimeoutRef.current) {
1080
1155
  clearTimeout(scrollLoadingTimeoutRef.current);
1081
1156
  }
1157
+ if (scrollThrottleTimeoutRef.current) {
1158
+ clearTimeout(scrollThrottleTimeoutRef.current);
1159
+ }
1082
1160
  };
1083
1161
  }, []);
1084
1162
 
@@ -1101,8 +1179,8 @@ const CapUnifiedSelect = _ref4 => {
1101
1179
  const searchCleared = lastSearchQueryRef.current === '';
1102
1180
  const timeSinceCleared = searchClearedTimeRef.current ? Date.now() - searchClearedTimeRef.current : Infinity;
1103
1181
  const hasOptionsData = options.length > 0;
1104
- // Wait at least 200ms after search is cleared to allow API call to complete
1105
- const clearedSearchReady = searchCleared && hasOptionsData && timeSinceCleared > 200;
1182
+ // Wait at least SEARCH_CLEARED_TIMEOUT after search is cleared to allow API call to complete
1183
+ const clearedSearchReady = searchCleared && hasOptionsData && timeSinceCleared > _constants.TIMEOUTS.SEARCH_CLEARED_TIMEOUT;
1106
1184
  if (optionsChanged || clearedSearchReady) {
1107
1185
  // Options updated after search - data has arrived
1108
1186
  // Use a small delay to ensure state updates are processed
@@ -1113,7 +1191,7 @@ const CapUnifiedSelect = _ref4 => {
1113
1191
  if (searchCleared) {
1114
1192
  searchClearedTimeRef.current = null;
1115
1193
  }
1116
- }, 100);
1194
+ }, _constants.TIMEOUTS.SEARCH_STATE_UPDATE_DELAY);
1117
1195
  return () => clearTimeout(timeoutId);
1118
1196
  }
1119
1197
  prevOptionsRef.current = options;
@@ -1132,8 +1210,8 @@ const CapUnifiedSelect = _ref4 => {
1132
1210
  // For cleared search (empty string), use a shorter timeout since it should reload initial data quickly
1133
1211
  // For regular search, use debounce timeout + buffer
1134
1212
  const searchCleared = lastSearchQueryRef.current === '';
1135
- const timeoutDuration = searchCleared ? debounceTimeout + 300 // Shorter timeout for cleared search
1136
- : debounceTimeout + 500; // Longer timeout for regular search
1213
+ const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER // Shorter timeout for cleared search
1214
+ : debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER; // Longer timeout for regular search
1137
1215
 
1138
1216
  // Calculate timeout: debounce timeout + a small buffer for API response
1139
1217
  // This ensures we wait for the API call to complete before showing "No results"
@@ -1171,7 +1249,7 @@ const CapUnifiedSelect = _ref4 => {
1171
1249
  // Additional check: if enough time has passed since resetData was called
1172
1250
  // and we have options data, assume data has loaded even if comparison didn't detect change
1173
1251
  const timeSinceReset = resetDataCalledTimeRef.current ? Date.now() - resetDataCalledTimeRef.current : Infinity;
1174
- const hasDataAfterTimeout = currentOptions.length > 0 && timeSinceReset > 300 && timeSinceReset < 2000;
1252
+ const hasDataAfterTimeout = currentOptions.length > 0 && timeSinceReset > _constants.TIMEOUTS.RESET_DATA_MIN_TIME && timeSinceReset < _constants.TIMEOUTS.RESET_DATA_MAX_TIME;
1175
1253
 
1176
1254
  // If options changed or enough time has passed with data, clear the loading state
1177
1255
  if (optionsChanged || hasDataAfterTimeout) {
@@ -1198,8 +1276,7 @@ const CapUnifiedSelect = _ref4 => {
1198
1276
  prevOptionsBeforeResetRef.current = options;
1199
1277
  // Clear timestamp
1200
1278
  resetDataCalledTimeRef.current = null;
1201
- }, 1000); // 1 second timeout for resetData operations
1202
-
1279
+ }, _constants.TIMEOUTS.RESET_DATA_TIMEOUT);
1203
1280
  return () => clearTimeout(fallbackTimeout);
1204
1281
  }, [isResettingData, options]);
1205
1282
 
@@ -1252,6 +1329,8 @@ const CapUnifiedSelect = _ref4 => {
1252
1329
  if (optionsCountIncreased || optionsContentChanged) {
1253
1330
  // Options updated after scroll - data has arrived, clear loading overlay
1254
1331
  setIsLoadingOnScroll(false);
1332
+ // Reset processing flag to allow next scroll event
1333
+ isScrollProcessingRef.current = false;
1255
1334
  if (scrollLoadingTimeoutRef.current) {
1256
1335
  clearTimeout(scrollLoadingTimeoutRef.current);
1257
1336
  scrollLoadingTimeoutRef.current = null;
@@ -1312,11 +1391,11 @@ const CapUnifiedSelect = _ref4 => {
1312
1391
  // Clear loading state after a short delay (filtering is instant but we show feedback)
1313
1392
  searchTimeoutRef.current = setTimeout(() => {
1314
1393
  setIsSearching(false);
1315
- }, 150); // Brief delay to show loading indicator
1394
+ }, _constants.TIMEOUTS.STATIC_SEARCH_DELAY);
1316
1395
  }
1317
1396
  }, [onSearch, staticValue, debounceTimeout]);
1318
- const isMulti = (0, _react.useMemo)(() => type === SELECT_TYPES.MULTI_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1319
- const isTree = (0, _react.useMemo)(() => type === SELECT_TYPES.TREE_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1397
+ const isMulti = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.MULTI_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1398
+ const isTree = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.TREE_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1320
1399
 
1321
1400
  // Use options directly since pagination is handled by the developer
1322
1401
  const mergedOptions = (0, _react.useMemo)(() => {
@@ -1667,6 +1746,9 @@ const CapUnifiedSelect = _ref4 => {
1667
1746
  initialTempValueRef.current = value;
1668
1747
  hasInteractedRef.current = false;
1669
1748
  resetDataCalledRef.current = false;
1749
+ // Reset fetchMissingOptions tracking to allow re-checking when dropdown opens
1750
+ fetchMissingOptionsCalledRef.current = false;
1751
+ lastMissingValuesRef.current = '';
1670
1752
  // Clear any pending search timeouts
1671
1753
  if (searchTimeoutRef.current) {
1672
1754
  clearTimeout(searchTimeoutRef.current);
@@ -1677,10 +1759,15 @@ const CapUnifiedSelect = _ref4 => {
1677
1759
  clearTimeout(scrollLoadingTimeoutRef.current);
1678
1760
  scrollLoadingTimeoutRef.current = null;
1679
1761
  }
1762
+ if (scrollThrottleTimeoutRef.current) {
1763
+ clearTimeout(scrollThrottleTimeoutRef.current);
1764
+ scrollThrottleTimeoutRef.current = null;
1765
+ }
1680
1766
  // Reset loading states
1681
1767
  setIsSearching(false);
1682
1768
  searchClearedTimeRef.current = null; // Clear search cleared timestamp
1683
1769
  setIsLoadingOnScroll(false);
1770
+ isScrollProcessingRef.current = false;
1684
1771
  // Safety check: Clear isResettingData if it's still true when opening
1685
1772
  // This handles cases where options updated while dropdown was closed
1686
1773
  if (isResettingData) {
@@ -1706,10 +1793,15 @@ const CapUnifiedSelect = _ref4 => {
1706
1793
  }
1707
1794
  // Reset scroll loading state
1708
1795
  setIsLoadingOnScroll(false);
1796
+ isScrollProcessingRef.current = false;
1709
1797
  if (scrollLoadingTimeoutRef.current) {
1710
1798
  clearTimeout(scrollLoadingTimeoutRef.current);
1711
1799
  scrollLoadingTimeoutRef.current = null;
1712
1800
  }
1801
+ if (scrollThrottleTimeoutRef.current) {
1802
+ clearTimeout(scrollThrottleTimeoutRef.current);
1803
+ scrollThrottleTimeoutRef.current = null;
1804
+ }
1713
1805
  scrollContainerRef.current = null;
1714
1806
 
1715
1807
  // Only call resetData if user actually interacted (selected, searched, etc.)
@@ -1769,6 +1861,7 @@ const CapUnifiedSelect = _ref4 => {
1769
1861
 
1770
1862
  // Handle scroll event - automatically checks if scroll is near bottom
1771
1863
  // Developer handles hasMore and isLoading conditions in onPopupScroll callback
1864
+ // Using refs to avoid recreating the callback when options change
1772
1865
  const handleScroll = (0, _react.useCallback)(event => {
1773
1866
  if (!onPopupScroll) return;
1774
1867
  const target = event.target;
@@ -1779,74 +1872,83 @@ const CapUnifiedSelect = _ref4 => {
1779
1872
 
1780
1873
  // Only call onPopupScroll if scroll is near bottom
1781
1874
  // Developer will handle hasMore and isLoading checks inside the callback
1782
- if (!isNearBottom) return;
1875
+ if (!isNearBottom) {
1876
+ // Reset processing flag when not near bottom
1877
+ isScrollProcessingRef.current = false;
1878
+ return;
1879
+ }
1880
+
1881
+ // Prevent multiple scroll triggers while already processing
1882
+ // This ensures we don't trigger multiple API calls simultaneously
1883
+ if (isScrollProcessingRef.current) return;
1783
1884
 
1784
1885
  // Prevent multiple scroll triggers while already loading
1785
1886
  // This ensures loading state is managed properly and data loading completes
1786
1887
  if (isLoadingOnScroll) return;
1787
1888
 
1788
- // Store current options count and options reference before triggering load
1789
- // This helps detect when new data arrives
1790
- // Store the reference directly - we'll compare by length and last item
1791
- prevOptionsCountRef.current = options.length;
1792
- prevOptionsRefForScroll.current = options;
1793
- // Also store the count at scroll trigger time for orderedOptions update
1794
- scrollTriggerOptionsCountRef.current = options.length;
1795
-
1796
- // Show loading indicator when scrolling near bottom
1797
- // This happens before calling onPopupScroll to provide immediate feedback
1798
- setIsLoadingOnScroll(true);
1799
-
1800
- // Clear any existing timeout
1801
- if (scrollLoadingTimeoutRef.current) {
1802
- clearTimeout(scrollLoadingTimeoutRef.current);
1803
- scrollLoadingTimeoutRef.current = null;
1804
- }
1805
-
1806
- // Create a React synthetic event-like object with scroll information
1807
- // const syntheticEvent = {
1808
- // target: target,
1809
- // currentTarget: target,
1810
- // nativeEvent: event,
1811
- // bubbles: false,
1812
- // cancelable: false,
1813
- // defaultPrevented: false,
1814
- // eventPhase: 0,
1815
- // isTrusted: false,
1816
- // timeStamp: Date.now(),
1817
- // type: 'scroll',
1818
- // detail: 0,
1819
- // view: null,
1820
- // preventDefault: () => { },
1821
- // stopPropagation: () => { },
1822
- // stopImmediatePropagation: () => { },
1823
- // isDefaultPrevented: () => false,
1824
- // isPropagationStopped: () => false,
1825
- // } as unknown as React.UIEvent<HTMLElement>;
1826
-
1827
- // Mark as interacted when user scrolls (triggers data loading)
1828
- hasInteractedRef.current = true;
1889
+ // Throttle scroll events to prevent rapid-fire API calls
1890
+ // Clear any existing throttle timeout
1891
+ if (scrollThrottleTimeoutRef.current) {
1892
+ clearTimeout(scrollThrottleTimeoutRef.current);
1893
+ }
1829
1894
 
1830
- // Call the developer's scroll handler - component already checked scroll position
1831
- // Developer should check hasMore and isLoading inside the callback
1832
- // This triggers the async data loading
1833
- onPopupScroll();
1834
-
1835
- // Set a fallback timeout to clear loading if options don't change
1836
- // This prevents loading from staying forever if data never arrives
1837
- // Using a longer timeout (10 seconds) to give enough time for slow API calls
1838
- scrollLoadingTimeoutRef.current = setTimeout(() => {
1839
- // Only clear if still loading (options change detection might have cleared it already)
1840
- setIsLoadingOnScroll(prev => {
1841
- if (prev) {
1842
- // Clear the timeout reference when clearing loading state
1843
- scrollLoadingTimeoutRef.current = null;
1844
- return false;
1845
- }
1846
- return prev;
1847
- });
1848
- }, 10000); // 10 seconds fallback - much longer than the previous 500ms
1849
- }, [onPopupScroll, isLoadingOnScroll, options.length]);
1895
+ // Set processing flag immediately to prevent duplicate calls
1896
+ isScrollProcessingRef.current = true;
1897
+
1898
+ // Throttle the actual API call to prevent multiple rapid triggers
1899
+ scrollThrottleTimeoutRef.current = setTimeout(() => {
1900
+ // Double-check we're still near bottom and not loading
1901
+ const stillNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
1902
+ if (!stillNearBottom || isLoadingOnScroll) {
1903
+ isScrollProcessingRef.current = false;
1904
+ return;
1905
+ }
1906
+
1907
+ // Store current options count and options reference before triggering load
1908
+ // This helps detect when new data arrives
1909
+ // Use ref to get current options without depending on options.length
1910
+ const currentOptions = optionsRef.current;
1911
+ prevOptionsCountRef.current = currentOptions.length;
1912
+ prevOptionsRefForScroll.current = currentOptions;
1913
+ // Also store the count at scroll trigger time for orderedOptions update
1914
+ scrollTriggerOptionsCountRef.current = currentOptions.length;
1915
+
1916
+ // Show loading indicator when scrolling near bottom
1917
+ // This happens before calling onPopupScroll to provide immediate feedback
1918
+ setIsLoadingOnScroll(true);
1919
+
1920
+ // Clear any existing timeout
1921
+ if (scrollLoadingTimeoutRef.current) {
1922
+ clearTimeout(scrollLoadingTimeoutRef.current);
1923
+ scrollLoadingTimeoutRef.current = null;
1924
+ }
1925
+
1926
+ // Mark as interacted when user scrolls (triggers data loading)
1927
+ hasInteractedRef.current = true;
1928
+
1929
+ // Call the developer's scroll handler - component already checked scroll position
1930
+ // Developer should check hasMore and isLoading inside the callback
1931
+ // This triggers the async data loading
1932
+ onPopupScroll();
1933
+
1934
+ // Set a fallback timeout to clear loading if options don't change
1935
+ // This prevents loading from staying forever if data never arrives
1936
+ // Using a longer timeout (10 seconds) to give enough time for slow API calls
1937
+ scrollLoadingTimeoutRef.current = setTimeout(() => {
1938
+ // Only clear if still loading (options change detection might have cleared it already)
1939
+ setIsLoadingOnScroll(prev => {
1940
+ if (prev) {
1941
+ // Clear the timeout reference when clearing loading state
1942
+ scrollLoadingTimeoutRef.current = null;
1943
+ // Reset processing flag when loading times out
1944
+ isScrollProcessingRef.current = false;
1945
+ return false;
1946
+ }
1947
+ return prev;
1948
+ });
1949
+ }, _constants.TIMEOUTS.SCROLL_LOADING_TIMEOUT);
1950
+ }, 150); // 150ms throttle to prevent rapid-fire events
1951
+ }, [onPopupScroll, isLoadingOnScroll]);
1850
1952
 
1851
1953
  // Setup scroll listener for onPopupScroll
1852
1954
  (0, _react.useEffect)(() => {
@@ -1890,13 +1992,20 @@ const CapUnifiedSelect = _ref4 => {
1890
1992
  passive: true
1891
1993
  });
1892
1994
  }
1893
- }, 100);
1995
+ }, _constants.TIMEOUTS.SCROLL_CONTAINER_DELAY);
1894
1996
  return () => {
1895
1997
  clearTimeout(timeoutId);
1998
+ // Clear throttle timeout when cleaning up
1999
+ if (scrollThrottleTimeoutRef.current) {
2000
+ clearTimeout(scrollThrottleTimeoutRef.current);
2001
+ scrollThrottleTimeoutRef.current = null;
2002
+ }
1896
2003
  if (scrollContainerRef.current) {
1897
2004
  scrollContainerRef.current.removeEventListener('scroll', handleScroll);
1898
2005
  scrollContainerRef.current = null;
1899
2006
  }
2007
+ // Reset processing flag when listener is removed
2008
+ isScrollProcessingRef.current = false;
1900
2009
  };
1901
2010
  }, [onPopupScroll, dropdownOpen, handleScroll]);
1902
2011
  const renderHeader = (0, _react.useMemo)(() => {
@@ -2051,7 +2160,7 @@ const CapUnifiedSelect = _ref4 => {
2051
2160
  })]
2052
2161
  })]
2053
2162
  })
2054
- }), (type === SELECT_TYPES.SELECT || type === SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
2163
+ }), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
2055
2164
  className: _styles.default['cap-unified-select-tree-clear-container'],
2056
2165
  onClick: handleClearAll,
2057
2166
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -2139,7 +2248,7 @@ const CapUnifiedSelect = _ref4 => {
2139
2248
  popupMatchSelectWidth: false,
2140
2249
  disabled: disabled,
2141
2250
  filterTreeNode: false,
2142
- listHeight: 256,
2251
+ listHeight: _constants.DEFAULTS.LIST_HEIGHT,
2143
2252
  listItemHeight: virtualRowHeight,
2144
2253
  popupRender: renderCustomDropdown
2145
2254
  }, rest)), isError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -2945,7 +3054,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(1601);
2945
3054
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
2946
3055
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
2947
3056
  // Module
2948
- ___CSS_LOADER_EXPORT___.push([module.id, `.blaze-ui-cap-unified-select-header-wrapper{display:flex;align-items:center}.blaze-ui-cap-unified-select-header-wrapper.blaze-ui-disabled{opacity:.5;cursor:not-allowed}.blaze-ui-cap-unified-select-header-wrapper .blaze-ui-cap-unified-select-header-label{font-family:"Roboto",sans-serif;font-weight:500;font-size:1rem;line-height:1.429rem;letter-spacing:0}.blaze-ui-cap-unified-select-header-byline-text{font-family:"Roboto",sans-serif;font-weight:400;font-size:.857rem;letter-spacing:0;color:#97a0af}.blaze-ui-cap-unified-select-container{text-align:justify;min-width:13.786rem}.blaze-ui-cap-unified-select-container.blaze-ui-disabled{cursor:not-allowed}.blaze-ui-cap-unified-select-container.ant-select-focused .ant-select-selector{border:.071rem solid #091e42 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-more-text{cursor:pointer;color:#091e42;margin-right:.286rem;position:relative}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-suffix-icon{color:#7a869a}.blaze-ui-cap-unified-select-container .blaze-ui-cap-tooltip-with-info-icon{margin-top:.143rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly{pointer-events:none}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly .blaze-ui-cap-unified-select-more-text{pointer-events:auto}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select .ant-select-tree-treenode{padding-left:.286rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-selector{background-color:#fff;border-color:#ebecf0 !important;cursor:default}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-arrow{pointer-events:auto;color:#b3bac5}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:hover .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:active .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:focus .ant-select-selector{border-color:#ebecf0 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-status{color:#ea213a}.blaze-ui-cap-unified-select-container .ant-select-outlined:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-pagination-size-changer):hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-container .ant-select-selector{background-color:#fff !important;border:.071rem solid #7a869a !important;border-radius:.286rem !important}.blaze-ui-cap-unified-select-container .ant-select-selector .ant-select-selection-placeholder{pointer-events:unset;color:#97a0af;display:flex;align-items:center}.blaze-ui-cap-unified-select-container .ant-select-prefix{font-size:1rem;font-weight:400;color:#091e42;line-height:1.429rem}.blaze-ui-cap-unified-select-container .ant-input-affix-wrapper .ant-input-prefix{left:.857rem}.blaze-ui-cap-unified-select-container .ant-select-selector{border-color:#7a869a !important;box-shadow:none !important;outline:0}.blaze-ui-cap-unified-select-container .ant-btn-variant-solid:not(:disabled):not(.ant-btn-disabled):hover{background-color:#47af46}.blaze-ui-cap-unified-select-container .ant-select-dropdown{margin-top:-0.571rem !important;border-radius:.286rem;background-color:#fff;box-shadow:0 .286rem .571rem -0.143rem rgba(9,30,66,.15),0 0 .071rem 0 rgba(9,30,66,.1);max-height:25.714rem;overflow:visible}.blaze-ui-cap-unified-select-container .ant-select-outlined.ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item,.blaze-ui-cap-unified-select-container .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap{align-self:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container{border-bottom:.071rem solid #ebecf0 !important;line-height:2.857rem !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container .blaze-ui-cap-unified-select-search-icon{color:#b3bac5}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container{padding:.643rem 1.071rem;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container .blaze-ui-cap-unified-select-select-all-checkbox{display:contents !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container{cursor:pointer;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem;padding-left:1.143rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-icon{color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-label{margin-left:.857rem;color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container{display:flex;align-items:center;height:3.429rem;padding:.5rem;border-top:.071rem solid #ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group{display:flex;padding-left:.571rem;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button{background-color:#47af46;height:2.286rem;width:6.714rem;color:#fff}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:hover{background-color:#1f9a1d}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:disabled{background-color:#a1d8a0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-cancel-button{border:rgba(0,0,0,0);box-shadow:none;width:5.714rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-selected-count{display:flex;margin-left:auto;font-size:.857rem;font-weight:400;line-height:1.143rem;color:#5e6c84}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container{display:flex;justify-content:center;align-items:center;height:2.857rem;border-top:.071rem solid #ebecf0;cursor:pointer;color:#091e42}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container:hover{background-color:#ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container .blaze-ui-cap-unified-select-tree-clear-label{font-size:1rem;font-weight:400}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container{cursor:pointer;display:flex;align-items:center;margin-left:auto;padding-right:1.143rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container:hover{opacity:.8}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-icon{color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-label{margin-left:.857rem;color:#2466ea;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:.857rem;line-height:1.143rem;letter-spacing:0;text-align:right}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;color:#97a0af;font-size:1rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result .blaze-ui-cap-unified-select-no-result-text{font-weight:500}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;width:100%;gap:8px}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-more{display:flex;align-items:center;justify-content:center;padding:.857rem;border-top:.071rem solid #ebecf0;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-menu-wrapper{position:relative;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.8);z-index:10;gap:8px;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix{display:flex;justify-content:space-between;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle;flex:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{display:flex;align-items:center;flex-shrink:1;min-width:0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-end{display:flex;align-items:center;gap:.571rem;flex-shrink:0;margin-left:auto}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-suffix{display:flex;align-items:center;padding:0 .571rem;max-height:1.429rem;white-space:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon{margin-top:.357rem;color:#42526e}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon .blaze-ui-cap-icon{color:#42526e}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu{margin-top:0 !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu .ant-select-dropdown-menu-item{padding:.571rem 1.714rem !important;height:unset !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu-item-disabled{color:rgba(0,0,0,.25) !important;cursor:not-allowed !important;line-height:1.428rem !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0);height:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper:hover{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode{height:2.857rem;margin-bottom:0;display:flex;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode:hover{background-color:#fffbe6}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-selected{background-color:#f4f5f7 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled{cursor:not-allowed !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-unified-select-option-label{color:#b3bac5}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-icon{color:#b3bac5 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected{background-color:#f4f5f7}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-leaf .ant-select-tree-switcher-noop{display:none}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox{display:flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox .ant-select-tree-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem;display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner:hover{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{border-radius:0;padding-left:.214rem;width:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-title{width:100%;display:flex}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-indent{margin-left:.857rem;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher{display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher:not(.ant-select-tree-switcher-noop):hover:before{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher .ant-select-tree-switcher-icon{font-size:.857rem;margin-top:1.286rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-list-holder-inner{width:fit-content !important;min-width:100%}.blaze-ui-cap-unified-select-popup .ant-tree-select:hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-popup .ant-tree-select-focused .ant-select-selector,.blaze-ui-cap-unified-select-popup .ant-tree-select-open .ant-select-selector{border-color:#7a869a;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem}.blaze-ui-cap-unified-select-popup .ant-checkbox-wrapper:not(.ant-checkbox-wrapper-disabled):hover .ant-checkbox-checked:not(.ant-checkbox-disabled) .ant-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper{padding-left:.571rem;border:none;box-shadow:none;border-radius:0;border-bottom:.071rem solid rgba(0,0,0,0);transition:border-color .2s ease}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:hover{border-bottom:.071rem solid #7a869a !important;box-shadow:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:focus-within{border-bottom:.071rem solid #091e42 !important;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper .ant-input{border:none !important;box-shadow:none !important}`, ""]);
3057
+ ___CSS_LOADER_EXPORT___.push([module.id, `.blaze-ui-cap-unified-select-header-wrapper{display:flex;align-items:center}.blaze-ui-cap-unified-select-header-wrapper.blaze-ui-disabled{opacity:.5;cursor:not-allowed}.blaze-ui-cap-unified-select-header-wrapper .blaze-ui-cap-unified-select-header-label{font-family:"Roboto",sans-serif;font-weight:500;font-size:1rem;line-height:1.429rem;letter-spacing:0}.blaze-ui-cap-unified-select-header-byline-text{font-family:"Roboto",sans-serif;font-weight:400;font-size:.857rem;letter-spacing:0;color:#97a0af}.blaze-ui-cap-unified-select-container{text-align:justify;min-width:13.786rem}.blaze-ui-cap-unified-select-container.blaze-ui-disabled{cursor:not-allowed}.blaze-ui-cap-unified-select-container.ant-select-focused .ant-select-selector{border:.071rem solid #091e42 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-more-text{cursor:pointer;color:#091e42;margin-right:.286rem;position:relative}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-suffix-icon{color:#7a869a}.blaze-ui-cap-unified-select-container .blaze-ui-cap-tooltip-with-info-icon{margin-top:.143rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly{pointer-events:none}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select.blaze-ui-cap-unified-tree-select-readonly .blaze-ui-cap-unified-select-more-text{pointer-events:auto}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select .ant-select-tree-treenode{padding-left:.286rem}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-selector{background-color:#fff;border-color:#ebecf0 !important;cursor:default}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly .ant-select-arrow{pointer-events:auto;color:#b3bac5}.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:hover .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:active .ant-select-selector,.blaze-ui-cap-unified-select-container.blaze-ui-cap-unified-tree-select-readonly.ant-select-outlined:focus .ant-select-selector{border-color:#ebecf0 !important}.blaze-ui-cap-unified-select-container .blaze-ui-cap-unified-select-status{color:#ea213a}.blaze-ui-cap-unified-select-container .ant-select-outlined:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-pagination-size-changer):hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-container .ant-select-selector{background-color:#fff !important;border:.071rem solid #7a869a !important;border-radius:.286rem !important}.blaze-ui-cap-unified-select-container .ant-select-selector .ant-select-selection-placeholder{pointer-events:unset;color:#97a0af;display:flex;align-items:center}.blaze-ui-cap-unified-select-container .ant-select-prefix{font-size:1rem;font-weight:400;color:#091e42;line-height:1.429rem}.blaze-ui-cap-unified-select-container .ant-input-affix-wrapper .ant-input-prefix{left:.857rem}.blaze-ui-cap-unified-select-container .ant-select-selector{border-color:#7a869a !important;box-shadow:none !important;outline:0}.blaze-ui-cap-unified-select-container .ant-btn-variant-solid:not(:disabled):not(.ant-btn-disabled):hover{background-color:#47af46}.blaze-ui-cap-unified-select-container .ant-select-dropdown{margin-top:-0.571rem !important;border-radius:.286rem;background-color:#fff;box-shadow:0 .286rem .571rem -0.143rem rgba(9,30,66,.15),0 0 .071rem 0 rgba(9,30,66,.1);max-height:25.714rem;overflow:visible}.blaze-ui-cap-unified-select-container .ant-select-outlined.ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap .ant-select-selection-item,.blaze-ui-cap-unified-select-container .ant-select-selection-wrap .ant-select-selection-item{background:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-container .ant-select-multiple .ant-select-selection-wrap{align-self:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container{border-bottom:.071rem solid #ebecf0 !important;line-height:2.857rem !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-search-container .blaze-ui-cap-unified-select-search-icon{color:#b3bac5}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container{padding:.643rem 1.071rem;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-select-all-container .blaze-ui-cap-unified-select-select-all-checkbox{display:contents !important}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container{cursor:pointer;display:flex;align-items:center;border-bottom:.071rem solid #ebecf0;height:2.857rem;padding-left:1.143rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-icon{color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-upload-container .blaze-ui-cap-unified-select-upload-label{margin-left:.857rem;color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container{display:flex;align-items:center;height:3.429rem;padding:.5rem;border-top:.071rem solid #ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group{display:flex;padding-left:.571rem;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button{background-color:#47af46;height:2.286rem;width:6.714rem;color:#fff}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:hover{background-color:#1f9a1d}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-confirm-button:disabled{background-color:#a1d8a0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-cancel-button{border:rgba(0,0,0,0);box-shadow:none;width:5.714rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-confirm-container .blaze-ui-cap-unified-select-confirm-button-group .blaze-ui-cap-unified-select-selected-count{display:flex;margin-left:auto;font-size:.857rem;font-weight:400;line-height:1.143rem;color:#5e6c84}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container{display:flex;justify-content:center;align-items:center;height:2.857rem;border-top:.071rem solid #ebecf0;cursor:pointer;color:#091e42}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container:hover{background-color:#ebecf0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-tree-clear-container .blaze-ui-cap-unified-select-tree-clear-label{font-size:1rem;font-weight:400}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container{cursor:pointer;display:flex;align-items:center;margin-left:auto;padding-right:1.143rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container:hover{opacity:.8}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-icon{color:#2466ea}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-label{margin-left:.857rem;color:#2466ea;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:.857rem;line-height:1.143rem;letter-spacing:0;text-align:right}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;color:#97a0af;font-size:1rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result .blaze-ui-cap-unified-select-no-result-text{font-weight:500}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;width:100%;gap:.571rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-more{display:flex;align-items:center;justify-content:center;padding:.857rem;border-top:.071rem solid #ebecf0;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-menu-wrapper{position:relative;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.8);z-index:10;gap:.571rem;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix{display:flex;justify-content:start;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle;flex:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{display:flex;align-items:center;flex-shrink:1;min-width:0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-end{display:flex;align-items:center;gap:.571rem;flex-shrink:0;margin-left:auto}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-suffix{display:flex;align-items:center;padding:0 .571rem;max-height:1.429rem;white-space:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon{margin-top:.357rem;color:#42526e}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon .blaze-ui-cap-icon{color:#42526e}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu{margin-top:0 !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu .ant-select-dropdown-menu-item{padding:.571rem 1.714rem !important;height:unset !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu-item-disabled{color:rgba(0,0,0,.25) !important;cursor:not-allowed !important;line-height:1.428rem !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0);height:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper:hover{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode{height:2.857rem;margin-bottom:0;display:flex;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode:hover{background-color:#fffbe6}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-selected{background-color:#f4f5f7 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled{cursor:not-allowed !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-unified-select-option-label{color:#b3bac5}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-icon{color:#b3bac5 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected{background-color:#f4f5f7}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-leaf .ant-select-tree-switcher-noop{display:none}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox{display:flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox .ant-select-tree-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem;display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner:hover{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{border-radius:0;padding-left:.214rem;width:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-title{width:100%;display:flex}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-indent{margin-left:.857rem;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher{display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher:not(.ant-select-tree-switcher-noop):hover:before{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher .ant-select-tree-switcher-icon{font-size:.857rem;margin-top:1.286rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-list-holder-inner{width:fit-content !important;min-width:100%}.blaze-ui-cap-unified-select-popup .ant-tree-select:hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-popup .ant-tree-select-focused .ant-select-selector,.blaze-ui-cap-unified-select-popup .ant-tree-select-open .ant-select-selector{border-color:#7a869a;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem}.blaze-ui-cap-unified-select-popup .ant-checkbox-wrapper:not(.ant-checkbox-wrapper-disabled):hover .ant-checkbox-checked:not(.ant-checkbox-disabled) .ant-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper{padding-left:.571rem;border:none;box-shadow:none;border-radius:0;border-bottom:.071rem solid rgba(0,0,0,0);transition:border-color .2s ease}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:hover{border-bottom:.071rem solid #7a869a !important;box-shadow:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:focus-within{border-bottom:.071rem solid #091e42 !important;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper .ant-input{border:none !important;box-shadow:none !important}`, ""]);
2949
3058
  // Exports
2950
3059
  ___CSS_LOADER_EXPORT___.locals = {
2951
3060
  "cap-unified-select-header-wrapper": `blaze-ui-cap-unified-select-header-wrapper`,
@@ -2993,6 +3102,73 @@ ___CSS_LOADER_EXPORT___.locals = {
2993
3102
  module.exports = ___CSS_LOADER_EXPORT___;
2994
3103
 
2995
3104
 
3105
+ /***/ }),
3106
+
3107
+ /***/ 9788:
3108
+ /***/ ((__unused_webpack_module, exports) => {
3109
+
3110
+ "use strict";
3111
+
3112
+
3113
+ exports.__esModule = true;
3114
+ exports.TIMEOUTS = exports.SELECT_TYPES = exports.DEFAULTS = void 0;
3115
+ /**
3116
+ * Select type constants for CapUnifiedSelect component
3117
+ */
3118
+ const SELECT_TYPES = exports.SELECT_TYPES = {
3119
+ SELECT: 'select',
3120
+ MULTI_SELECT: 'multiSelect',
3121
+ TREE_SELECT: 'treeSelect',
3122
+ MULTI_TREE_SELECT: 'multiTreeSelect'
3123
+ };
3124
+ /**
3125
+ * Timeout constants (in milliseconds)
3126
+ */
3127
+ const TIMEOUTS = exports.TIMEOUTS = {
3128
+ /** Default search debounce timeout */
3129
+ DEFAULT_SEARCH_DEBOUNCE: 300,
3130
+ /** Delay for state updates after search */
3131
+ SEARCH_STATE_UPDATE_DELAY: 100,
3132
+ /** Minimum time since search was cleared to consider data ready */
3133
+ SEARCH_CLEARED_TIMEOUT: 200,
3134
+ /** Buffer time added to debounce for cleared search */
3135
+ SEARCH_CLEARED_BUFFER: 300,
3136
+ /** Buffer time added to debounce for regular search */
3137
+ SEARCH_REGULAR_BUFFER: 500,
3138
+ /** Brief delay to show loading indicator for static search */
3139
+ STATIC_SEARCH_DELAY: 150,
3140
+ /** Timeout for resetData fallback (1 second) */
3141
+ RESET_DATA_TIMEOUT: 1000,
3142
+ /** Minimum time since resetData was called to consider data ready */
3143
+ RESET_DATA_MIN_TIME: 300,
3144
+ /** Maximum time since resetData was called to consider data ready */
3145
+ RESET_DATA_MAX_TIME: 2000,
3146
+ /** Fallback timeout for scroll loading (10 seconds) */
3147
+ SCROLL_LOADING_TIMEOUT: 10000,
3148
+ /** Delay before setting up scroll container listener */
3149
+ SCROLL_CONTAINER_DELAY: 100
3150
+ };
3151
+
3152
+ /**
3153
+ * Default values for component props
3154
+ */
3155
+ const DEFAULTS = exports.DEFAULTS = {
3156
+ /** Default placeholder text */
3157
+ PLACEHOLDER: 'Select an option',
3158
+ /** Default upload button label */
3159
+ UPLOAD_LABEL: 'Upload',
3160
+ /** Default clear button text */
3161
+ CLEAR_TEXT: 'Clear',
3162
+ /** Default no results message */
3163
+ NO_RESULT_TEXT: 'No results found',
3164
+ /** Default no results icon */
3165
+ NO_RESULT_ICON: 'warning',
3166
+ /** Default virtual row height in pixels */
3167
+ VIRTUAL_ROW_HEIGHT: 32,
3168
+ /** Default list height in pixels */
3169
+ LIST_HEIGHT: 256
3170
+ };
3171
+
2996
3172
  /***/ })
2997
3173
 
2998
3174
  /******/ });