@capillarytech/blaze-ui 1.0.3-alpha.5 → 1.0.3-alpha.7

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,20 +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", "resetSearchOnConfirm", "clearSearchOnClose", "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"];
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
- 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); } // react-virtualized is installed for future use
783
- // import { List, AutoSizer } from 'react-virtualized';
784
- const SELECT_TYPES = {
785
- SELECT: 'select',
786
- MULTI_SELECT: 'multiSelect',
787
- TREE_SELECT: 'treeSelect',
788
- MULTI_TREE_SELECT: 'multiTreeSelect'
789
- };
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 */
790
784
  const NoResult = _ref => {
791
785
  let {
792
786
  noResultCustomText,
@@ -804,7 +798,7 @@ const NoResult = _ref => {
804
798
  size: "m"
805
799
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
806
800
  className: _styles.default['cap-unified-select-no-result-text'],
807
- 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
808
802
  })]
809
803
  });
810
804
  };
@@ -920,11 +914,11 @@ const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
920
914
  };
921
915
  const CapUnifiedSelect = _ref4 => {
922
916
  let {
923
- type = SELECT_TYPES.SELECT,
917
+ type = _constants.SELECT_TYPES.SELECT,
924
918
  options = [],
925
919
  value,
926
920
  onChange,
927
- placeholder = 'Select an option',
921
+ placeholder = _constants.DEFAULTS.PLACEHOLDER,
928
922
  className = '',
929
923
  style,
930
924
  isError = false,
@@ -934,7 +928,7 @@ const CapUnifiedSelect = _ref4 => {
934
928
  allowClear = false,
935
929
  headerLabel,
936
930
  onUpload,
937
- uploadLabel = 'Upload',
931
+ uploadLabel = _constants.DEFAULTS.UPLOAD_LABEL,
938
932
  tooltip,
939
933
  bylineText,
940
934
  disabled = false,
@@ -943,19 +937,18 @@ const CapUnifiedSelect = _ref4 => {
943
937
  showSearch = true,
944
938
  searchBasedOn = 'label',
945
939
  onSearch,
946
- searchDebounce = 300,
940
+ searchDebounce = _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE,
947
941
  onConfirm,
948
- clearText = 'Clear',
949
- noResultCustomText = 'No results found',
950
- noResultCustomIcon = 'warning',
942
+ clearText = _constants.DEFAULTS.CLEAR_TEXT,
943
+ noResultCustomText = _constants.DEFAULTS.NO_RESULT_TEXT,
944
+ noResultCustomIcon = _constants.DEFAULTS.NO_RESULT_ICON,
951
945
  readOnly = false,
952
946
  staticValue = true,
953
947
  onFooterDownloadChange,
954
948
  onPopupScroll,
955
949
  enableVirtualization = false,
956
- virtualRowHeight = 32,
957
- resetSearchOnConfirm = true,
958
- clearSearchOnClose = true,
950
+ virtualRowHeight = _constants.DEFAULTS.VIRTUAL_ROW_HEIGHT,
951
+ resetSearch = true,
959
952
  resetData
960
953
  } = _ref4,
961
954
  rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
@@ -964,17 +957,28 @@ const CapUnifiedSelect = _ref4 => {
964
957
  const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
965
958
  const [isSearching, setIsSearching] = (0, _react.useState)(false);
966
959
  const [isLoadingOnScroll, setIsLoadingOnScroll] = (0, _react.useState)(false);
960
+ const [isResettingData, setIsResettingData] = (0, _react.useState)(false);
967
961
  // Store ordered options after confirm (selected items moved to top based on selection order)
968
962
  const [orderedOptions, setOrderedOptions] = (0, _react.useState)(null);
969
963
  const searchTimeoutRef = (0, _react.useRef)(null);
970
964
  const scrollContainerRef = (0, _react.useRef)(null);
971
965
  const scrollLoadingTimeoutRef = (0, _react.useRef)(null);
966
+ // Track if scroll handler is currently processing to prevent duplicate calls
967
+ const isScrollProcessingRef = (0, _react.useRef)(false);
968
+ // Throttle ref for scroll events
969
+ const scrollThrottleTimeoutRef = (0, _react.useRef)(null);
970
+ // Ref to track options for scroll handler (avoids recreating handleScroll)
971
+ const optionsRef = (0, _react.useRef)(options);
972
972
  // Cache of selected items from async results to preserve them during search
973
973
  const selectedItemsCacheRef = (0, _react.useRef)(new Map());
974
974
  // Track the last search query to detect when options update after search
975
975
  const lastSearchQueryRef = (0, _react.useRef)('');
976
+ // Track when search was cleared to help clear loading state
977
+ const searchClearedTimeRef = (0, _react.useRef)(null);
976
978
  // Track previous options to detect when they change after a search
977
979
  const prevOptionsRef = (0, _react.useRef)(options);
980
+ // Track previous options before resetData is called to detect when options update
981
+ const prevOptionsBeforeResetRef = (0, _react.useRef)(options);
978
982
  // Track previous options count to detect when options change after scroll
979
983
  const prevOptionsCountRef = (0, _react.useRef)(options.length);
980
984
  // Track previous options to detect when options change (even if count stays same)
@@ -983,6 +987,14 @@ const CapUnifiedSelect = _ref4 => {
983
987
  const scrollTriggerOptionsCountRef = (0, _react.useRef)(options.length);
984
988
  // Track if initial sort has been done (only sort once on initial load with selected values)
985
989
  const initialSortDoneRef = (0, _react.useRef)(false);
990
+ // Track if user has interacted with the dropdown during current session (selected, searched, etc.)
991
+ const hasInteractedRef = (0, _react.useRef)(false);
992
+ // Track the initial tempValue when dropdown opens to detect if user made changes
993
+ const initialTempValueRef = (0, _react.useRef)(value);
994
+ // Track if resetData was already called in the current session to prevent duplicate calls
995
+ const resetDataCalledRef = (0, _react.useRef)(false);
996
+ // Track when resetData was called to help clear loading state
997
+ const resetDataCalledTimeRef = (0, _react.useRef)(null);
986
998
  (0, _react.useEffect)(() => {
987
999
  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;
988
1000
  if (!isEqual) {
@@ -1057,7 +1069,12 @@ const CapUnifiedSelect = _ref4 => {
1057
1069
  }, [options, orderedOptions, tempValue]);
1058
1070
 
1059
1071
  // Extract debounce timeout (extracted early for use in useEffects)
1060
- const debounceTimeout = searchDebounce != null ? searchDebounce : 300;
1072
+ const debounceTimeout = searchDebounce != null ? searchDebounce : _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE;
1073
+
1074
+ // Keep optionsRef in sync with options
1075
+ (0, _react.useEffect)(() => {
1076
+ optionsRef.current = options;
1077
+ }, [options]);
1061
1078
 
1062
1079
  // Cleanup timeouts on unmount
1063
1080
  (0, _react.useEffect)(() => {
@@ -1068,6 +1085,9 @@ const CapUnifiedSelect = _ref4 => {
1068
1085
  if (scrollLoadingTimeoutRef.current) {
1069
1086
  clearTimeout(scrollLoadingTimeoutRef.current);
1070
1087
  }
1088
+ if (scrollThrottleTimeoutRef.current) {
1089
+ clearTimeout(scrollThrottleTimeoutRef.current);
1090
+ }
1071
1091
  };
1072
1092
  }, []);
1073
1093
 
@@ -1075,20 +1095,34 @@ const CapUnifiedSelect = _ref4 => {
1075
1095
  // This prevents showing "No results found" before data arrives
1076
1096
  (0, _react.useEffect)(() => {
1077
1097
  // Only handle this for API-based searches (staticValue = false)
1078
- if (staticValue || !isSearching || !lastSearchQueryRef.current) {
1098
+ // Check if lastSearchQueryRef has been set (including empty string for cleared search)
1099
+ const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
1100
+ if (staticValue || !isSearching || !hasSearchQuery) {
1079
1101
  prevOptionsRef.current = options;
1080
1102
  return;
1081
1103
  }
1082
1104
 
1083
1105
  // Check if options actually changed (reference or content)
1084
1106
  const optionsChanged = prevOptionsRef.current !== options || prevOptionsRef.current.length !== options.length;
1085
- if (optionsChanged) {
1107
+
1108
+ // Also check if search was cleared (empty string) and enough time has passed
1109
+ // This handles the case where clearing search reloads initial data that might be the same reference
1110
+ const searchCleared = lastSearchQueryRef.current === '';
1111
+ const timeSinceCleared = searchClearedTimeRef.current ? Date.now() - searchClearedTimeRef.current : Infinity;
1112
+ const hasOptionsData = options.length > 0;
1113
+ // Wait at least SEARCH_CLEARED_TIMEOUT after search is cleared to allow API call to complete
1114
+ const clearedSearchReady = searchCleared && hasOptionsData && timeSinceCleared > _constants.TIMEOUTS.SEARCH_CLEARED_TIMEOUT;
1115
+ if (optionsChanged || clearedSearchReady) {
1086
1116
  // Options updated after search - data has arrived
1087
1117
  // Use a small delay to ensure state updates are processed
1088
1118
  const timeoutId = setTimeout(() => {
1089
1119
  setIsSearching(false);
1090
1120
  prevOptionsRef.current = options;
1091
- }, 100);
1121
+ // Clear timestamp when search loading is cleared
1122
+ if (searchCleared) {
1123
+ searchClearedTimeRef.current = null;
1124
+ }
1125
+ }, _constants.TIMEOUTS.SEARCH_STATE_UPDATE_DELAY);
1092
1126
  return () => clearTimeout(timeoutId);
1093
1127
  }
1094
1128
  prevOptionsRef.current = options;
@@ -1098,20 +1132,85 @@ const CapUnifiedSelect = _ref4 => {
1098
1132
  // This handles edge cases where options might not change reference but data has arrived
1099
1133
  // Also handles error cases where options don't update after search
1100
1134
  (0, _react.useEffect)(() => {
1101
- if (!isSearching || staticValue || !lastSearchQueryRef.current) {
1135
+ // Check if lastSearchQueryRef has been set (including empty string for cleared search)
1136
+ const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
1137
+ if (!isSearching || staticValue || !hasSearchQuery) {
1102
1138
  return;
1103
1139
  }
1104
1140
 
1141
+ // For cleared search (empty string), use a shorter timeout since it should reload initial data quickly
1142
+ // For regular search, use debounce timeout + buffer
1143
+ const searchCleared = lastSearchQueryRef.current === '';
1144
+ const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER // Shorter timeout for cleared search
1145
+ : debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER; // Longer timeout for regular search
1146
+
1105
1147
  // Calculate timeout: debounce timeout + a small buffer for API response
1106
1148
  // This ensures we wait for the API call to complete before showing "No results"
1107
1149
  // For error cases where options don't update, this will clear loading state
1108
1150
  const fallbackTimeout = setTimeout(() => {
1109
1151
  setIsSearching(false);
1110
- }, debounceTimeout + 500); // debounce timeout + 500ms buffer
1111
-
1152
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
1153
+ }, timeoutDuration);
1112
1154
  return () => clearTimeout(fallbackTimeout);
1113
1155
  }, [isSearching, staticValue, debounceTimeout, options.length]);
1114
1156
 
1157
+ // Detect when options update after resetData is called to clear loading state
1158
+ (0, _react.useEffect)(() => {
1159
+ if (!isResettingData) {
1160
+ // Update ref even when not resetting to keep it in sync
1161
+ prevOptionsBeforeResetRef.current = options;
1162
+ // Clear timestamp when not resetting
1163
+ resetDataCalledTimeRef.current = null;
1164
+ return;
1165
+ }
1166
+
1167
+ // Check if options actually changed (reference, length, or content)
1168
+ // Compare against the options that existed before resetData was called
1169
+ const prevOptions = prevOptionsBeforeResetRef.current;
1170
+ const currentOptions = options;
1171
+
1172
+ // More robust comparison: check reference, length, or any content differences
1173
+ const optionsChanged = prevOptions !== currentOptions || prevOptions.length !== currentOptions.length ||
1174
+ // Deep comparison: check if any option values or labels changed
1175
+ prevOptions.length === currentOptions.length && prevOptions.length > 0 && prevOptions.some((prevOpt, idx) => {
1176
+ const currentOpt = currentOptions[idx];
1177
+ return !currentOpt || prevOpt.value !== currentOpt.value || prevOpt.label !== currentOpt.label;
1178
+ });
1179
+
1180
+ // Additional check: if enough time has passed since resetData was called
1181
+ // and we have options data, assume data has loaded even if comparison didn't detect change
1182
+ const timeSinceReset = resetDataCalledTimeRef.current ? Date.now() - resetDataCalledTimeRef.current : Infinity;
1183
+ const hasDataAfterTimeout = currentOptions.length > 0 && timeSinceReset > _constants.TIMEOUTS.RESET_DATA_MIN_TIME && timeSinceReset < _constants.TIMEOUTS.RESET_DATA_MAX_TIME;
1184
+
1185
+ // If options changed or enough time has passed with data, clear the loading state
1186
+ if (optionsChanged || hasDataAfterTimeout) {
1187
+ // Options updated after resetData - data has arrived
1188
+ // Clear immediately without delay for faster response
1189
+ setIsResettingData(false);
1190
+ prevOptionsBeforeResetRef.current = currentOptions;
1191
+ resetDataCalledTimeRef.current = null;
1192
+ }
1193
+ }, [options, isResettingData]);
1194
+
1195
+ // Fallback: Clear resetData loading state after a reasonable timeout
1196
+ // This handles edge cases where options might not change reference but data has arrived
1197
+ (0, _react.useEffect)(() => {
1198
+ if (!isResettingData) {
1199
+ return;
1200
+ }
1201
+
1202
+ // Set a timeout to clear loading state if options don't update
1203
+ // Reduced timeout to 1 second for faster recovery
1204
+ const fallbackTimeout = setTimeout(() => {
1205
+ setIsResettingData(false);
1206
+ // Update ref to current options to prevent false positives in future comparisons
1207
+ prevOptionsBeforeResetRef.current = options;
1208
+ // Clear timestamp
1209
+ resetDataCalledTimeRef.current = null;
1210
+ }, _constants.TIMEOUTS.RESET_DATA_TIMEOUT);
1211
+ return () => clearTimeout(fallbackTimeout);
1212
+ }, [isResettingData, options]);
1213
+
1115
1214
  // Detect when options change after scroll to clear loading overlay
1116
1215
  (0, _react.useEffect)(() => {
1117
1216
  // Always update refs when options change (when not loading)
@@ -1161,6 +1260,8 @@ const CapUnifiedSelect = _ref4 => {
1161
1260
  if (optionsCountIncreased || optionsContentChanged) {
1162
1261
  // Options updated after scroll - data has arrived, clear loading overlay
1163
1262
  setIsLoadingOnScroll(false);
1263
+ // Reset processing flag to allow next scroll event
1264
+ isScrollProcessingRef.current = false;
1164
1265
  if (scrollLoadingTimeoutRef.current) {
1165
1266
  clearTimeout(scrollLoadingTimeoutRef.current);
1166
1267
  scrollLoadingTimeoutRef.current = null;
@@ -1181,9 +1282,23 @@ const CapUnifiedSelect = _ref4 => {
1181
1282
  }
1182
1283
  const trimmedQuery = query.trim();
1183
1284
 
1285
+ // Track when search is cleared (empty string after having a query)
1286
+ const wasSearching = lastSearchQueryRef.current !== '';
1287
+ const isNowCleared = trimmedQuery === '';
1288
+ if (wasSearching && isNowCleared) {
1289
+ searchClearedTimeRef.current = Date.now();
1290
+ } else if (!isNowCleared) {
1291
+ searchClearedTimeRef.current = null;
1292
+ }
1293
+
1184
1294
  // Track the search query to detect when options update
1185
1295
  lastSearchQueryRef.current = trimmedQuery;
1186
1296
 
1297
+ // Mark as interacted if user typed something (even if they clear it later)
1298
+ if (trimmedQuery.length > 0 || lastSearchQueryRef.current.length > 0) {
1299
+ hasInteractedRef.current = true;
1300
+ }
1301
+
1187
1302
  // For API-based searches (staticValue = false), always call onSearch
1188
1303
  // This allows the developer to reload all initial data when search is cleared
1189
1304
  if (!staticValue && onSearch) {
@@ -1201,12 +1316,17 @@ const CapUnifiedSelect = _ref4 => {
1201
1316
  // For static searches, if query is empty, just reset the state
1202
1317
  setIsSearching(false);
1203
1318
  } else {
1204
- // For static searches with content, filtering is instant
1205
- setIsSearching(false);
1319
+ // For static searches with content, show brief loading indicator
1320
+ // Set loading state briefly to show user feedback
1321
+ setIsSearching(true);
1322
+ // Clear loading state after a short delay (filtering is instant but we show feedback)
1323
+ searchTimeoutRef.current = setTimeout(() => {
1324
+ setIsSearching(false);
1325
+ }, _constants.TIMEOUTS.STATIC_SEARCH_DELAY);
1206
1326
  }
1207
1327
  }, [onSearch, staticValue, debounceTimeout]);
1208
- const isMulti = (0, _react.useMemo)(() => type === SELECT_TYPES.MULTI_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1209
- const isTree = (0, _react.useMemo)(() => type === SELECT_TYPES.TREE_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1328
+ const isMulti = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.MULTI_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1329
+ const isTree = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.TREE_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
1210
1330
 
1211
1331
  // Use options directly since pagination is handled by the developer
1212
1332
  const mergedOptions = (0, _react.useMemo)(() => {
@@ -1382,17 +1502,24 @@ const CapUnifiedSelect = _ref4 => {
1382
1502
  const enhanceOptions = opts => opts.map(opt => {
1383
1503
  const decoratedTitle = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
1384
1504
  className: _styles.default['cap-unified-select-option-with-suffix'],
1385
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
1386
- type: "label14",
1505
+ justify: "space-between",
1506
+ align: "middle",
1507
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1387
1508
  className: _styles.default['cap-unified-select-option-label'],
1388
- children: opt == null ? void 0 : opt.label
1389
- }), (opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1390
- className: _styles.default['cap-unified-select-option-suffix'],
1391
- children: [opt == null ? void 0 : opt.optionSuffix, ' ', (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1392
- title: opt == null ? void 0 : opt.optionSuffixInfo
1509
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
1510
+ type: "label14",
1511
+ children: opt == null ? void 0 : opt.label
1512
+ })
1513
+ }), ((opt == null ? void 0 : opt.optionSuffix) || (opt == null ? void 0 : opt.optionTooltipInfo)) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1514
+ className: _styles.default['cap-unified-select-option-end'],
1515
+ children: [(opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1516
+ className: _styles.default['cap-unified-select-option-suffix'],
1517
+ children: [opt == null ? void 0 : opt.optionSuffix, (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1518
+ title: opt == null ? void 0 : opt.optionSuffixInfo
1519
+ })]
1520
+ }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1521
+ title: opt == null ? void 0 : opt.optionTooltipInfo
1393
1522
  })]
1394
- }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1395
- title: opt == null ? void 0 : opt.optionTooltipInfo
1396
1523
  })]
1397
1524
  });
1398
1525
  return _extends({}, opt, {
@@ -1404,17 +1531,24 @@ const CapUnifiedSelect = _ref4 => {
1404
1531
  return isTree ? enhanceOptions(sourceOptions) : sourceOptions.map(opt => _extends({}, opt, {
1405
1532
  title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
1406
1533
  className: _styles.default['cap-unified-select-option-with-suffix'],
1407
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
1408
- type: "label14",
1534
+ justify: "space-between",
1535
+ align: "middle",
1536
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1409
1537
  className: _styles.default['cap-unified-select-option-label'],
1410
- children: opt == null ? void 0 : opt.label
1411
- }), (opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1412
- className: _styles.default['cap-unified-select-option-suffix'],
1413
- children: [opt == null ? void 0 : opt.optionSuffix, ' ', (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1414
- title: opt == null ? void 0 : opt.optionSuffixInfo
1538
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
1539
+ type: "label14",
1540
+ children: opt == null ? void 0 : opt.label
1541
+ })
1542
+ }), ((opt == null ? void 0 : opt.optionSuffix) || (opt == null ? void 0 : opt.optionTooltipInfo)) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1543
+ className: _styles.default['cap-unified-select-option-end'],
1544
+ children: [(opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
1545
+ className: _styles.default['cap-unified-select-option-suffix'],
1546
+ children: [opt == null ? void 0 : opt.optionSuffix, (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1547
+ title: opt == null ? void 0 : opt.optionSuffixInfo
1548
+ })]
1549
+ }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1550
+ title: opt == null ? void 0 : opt.optionTooltipInfo
1415
1551
  })]
1416
- }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
1417
- title: opt == null ? void 0 : opt.optionTooltipInfo
1418
1552
  })]
1419
1553
  }),
1420
1554
  label: opt == null ? void 0 : opt.label
@@ -1475,6 +1609,9 @@ const CapUnifiedSelect = _ref4 => {
1475
1609
  return null;
1476
1610
  }, [isMulti, displayValue, treeMaps]);
1477
1611
  const handleConfirm = (0, _react.useCallback)(() => {
1612
+ // Mark as interacted since user clicked confirm (explicit action)
1613
+ hasInteractedRef.current = true;
1614
+
1478
1615
  // Reorder options based on selection order when confirm is clicked
1479
1616
  // Use mergedOptions to include paginated options if they exist
1480
1617
  const optionsToReorder = mergedOptions;
@@ -1494,51 +1631,135 @@ const CapUnifiedSelect = _ref4 => {
1494
1631
  setDropdownOpen(false);
1495
1632
  // Always clear searching state since search operation is complete
1496
1633
  setIsSearching(false);
1497
- // Clear search text on confirm only if resetSearchOnConfirm is true
1634
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
1635
+ // Clear search text on confirm only if resetSearch is true
1498
1636
  // This allows users to keep their search when reopening the dropdown if desired
1499
- if (resetSearchOnConfirm) {
1637
+ if (resetSearch) {
1500
1638
  setSearchText('');
1501
1639
  lastSearchQueryRef.current = ''; // Clear search query ref
1502
1640
  }
1503
1641
  // Call resetData to allow developer to reload initial data
1504
- resetData == null || resetData();
1642
+ if (resetData) {
1643
+ // Store current options before calling resetData to detect when they update
1644
+ prevOptionsBeforeResetRef.current = mergedOptions;
1645
+ setIsResettingData(true);
1646
+ resetDataCalledRef.current = true;
1647
+ resetDataCalledTimeRef.current = Date.now();
1648
+ resetData();
1649
+ }
1505
1650
  onConfirm == null || onConfirm(tempValue);
1506
- }, [onChange, onConfirm, tempValue, resetSearchOnConfirm, isMulti, mergedOptions, reorderOptionsBySelection, resetData]);
1651
+ }, [onChange, onConfirm, tempValue, resetSearch, isMulti, mergedOptions, reorderOptionsBySelection, resetData]);
1507
1652
  const handleClearAll = (0, _react.useCallback)(() => {
1653
+ // Mark as interacted since user clicked clear (explicit action)
1654
+ hasInteractedRef.current = true;
1508
1655
  const cleared = isMulti ? [] : undefined;
1509
1656
  setTempValue(cleared);
1510
1657
  onChange == null || onChange(cleared);
1511
1658
  setDropdownOpen(false);
1512
1659
  // Call resetData to allow developer to reload initial data
1513
- resetData == null || resetData();
1514
- }, [isMulti, onChange, resetData]);
1660
+ if (resetData) {
1661
+ // Store current options before calling resetData to detect when they update
1662
+ prevOptionsBeforeResetRef.current = options;
1663
+ setIsResettingData(true);
1664
+ resetDataCalledRef.current = true;
1665
+ resetDataCalledTimeRef.current = Date.now();
1666
+ resetData();
1667
+ }
1668
+ }, [isMulti, onChange, resetData, options]);
1515
1669
  const handleDropdownVisibilityChange = (0, _react.useCallback)(open => {
1516
1670
  if (readOnly) {
1517
1671
  return;
1518
1672
  }
1519
- if (!open) {
1673
+ if (open) {
1674
+ // Reset interaction tracking when dropdown opens
1675
+ // Store initial value (not tempValue) to detect if user makes changes
1676
+ // This ensures we track changes from the actual selected value, not temporary state
1677
+ initialTempValueRef.current = value;
1678
+ hasInteractedRef.current = false;
1679
+ resetDataCalledRef.current = false;
1680
+ // Clear any pending search timeouts
1681
+ if (searchTimeoutRef.current) {
1682
+ clearTimeout(searchTimeoutRef.current);
1683
+ searchTimeoutRef.current = null;
1684
+ }
1685
+ // Clear any pending scroll loading timeouts
1686
+ if (scrollLoadingTimeoutRef.current) {
1687
+ clearTimeout(scrollLoadingTimeoutRef.current);
1688
+ scrollLoadingTimeoutRef.current = null;
1689
+ }
1690
+ if (scrollThrottleTimeoutRef.current) {
1691
+ clearTimeout(scrollThrottleTimeoutRef.current);
1692
+ scrollThrottleTimeoutRef.current = null;
1693
+ }
1694
+ // Reset loading states
1695
+ setIsSearching(false);
1696
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
1697
+ setIsLoadingOnScroll(false);
1698
+ isScrollProcessingRef.current = false;
1699
+ // Safety check: Clear isResettingData if it's still true when opening
1700
+ // This handles cases where options updated while dropdown was closed
1701
+ if (isResettingData) {
1702
+ setIsResettingData(false);
1703
+ // Update ref to current options to prevent false positives
1704
+ prevOptionsBeforeResetRef.current = options;
1705
+ // Clear timestamp
1706
+ resetDataCalledTimeRef.current = null;
1707
+ }
1708
+ } else {
1709
+ // Dropdown is closing
1520
1710
  if (!customPopupRender) {
1521
1711
  onChange == null || onChange(tempValue);
1522
1712
  } else {
1523
1713
  setTempValue(value);
1524
1714
  }
1525
1715
  // Clear search when closing (if enabled)
1526
- if (clearSearchOnClose) {
1716
+ if (resetSearch) {
1527
1717
  setSearchText('');
1528
1718
  setIsSearching(false);
1529
1719
  lastSearchQueryRef.current = ''; // Clear search query ref
1720
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
1530
1721
  }
1531
1722
  // Reset scroll loading state
1532
1723
  setIsLoadingOnScroll(false);
1724
+ isScrollProcessingRef.current = false;
1533
1725
  if (scrollLoadingTimeoutRef.current) {
1534
1726
  clearTimeout(scrollLoadingTimeoutRef.current);
1727
+ scrollLoadingTimeoutRef.current = null;
1728
+ }
1729
+ if (scrollThrottleTimeoutRef.current) {
1730
+ clearTimeout(scrollThrottleTimeoutRef.current);
1731
+ scrollThrottleTimeoutRef.current = null;
1535
1732
  }
1536
1733
  scrollContainerRef.current = null;
1537
- // Call resetData to allow developer to reload initial data when dropdown closes
1538
- resetData == null || resetData();
1734
+
1735
+ // Only call resetData if user actually interacted (selected, searched, etc.)
1736
+ // and resetData hasn't been called already in this session
1737
+ // This prevents multiple API calls when user just opens/closes without interaction
1738
+ if (resetData && hasInteractedRef.current && !resetDataCalledRef.current) {
1739
+ // Store current options before calling resetData to detect when they update
1740
+ prevOptionsBeforeResetRef.current = options;
1741
+ setIsResettingData(true);
1742
+ resetDataCalledRef.current = true;
1743
+ resetDataCalledTimeRef.current = Date.now();
1744
+ resetData();
1745
+ } else if (!hasInteractedRef.current) {
1746
+ // User did nothing - reset everything as if it's a fresh load
1747
+ // Clear any pending operations
1748
+ if (searchTimeoutRef.current) {
1749
+ clearTimeout(searchTimeoutRef.current);
1750
+ searchTimeoutRef.current = null;
1751
+ }
1752
+ setIsSearching(false);
1753
+ setIsResettingData(false);
1754
+ // Reset search query ref
1755
+ lastSearchQueryRef.current = '';
1756
+ }
1757
+
1758
+ // Reset interaction flag for next session
1759
+ hasInteractedRef.current = false;
1539
1760
  }
1540
1761
  setDropdownOpen(open);
1541
- }, [customPopupRender, value, onChange, tempValue, readOnly, clearSearchOnClose, resetData]);
1762
+ }, [customPopupRender, value, onChange, tempValue, readOnly, resetSearch, resetData, options]);
1542
1763
  const handleFooterDownload = (0, _react.useCallback)(() => {
1543
1764
  const currentValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
1544
1765
  onFooterDownloadChange == null || onFooterDownloadChange(currentValues);
@@ -1568,6 +1789,7 @@ const CapUnifiedSelect = _ref4 => {
1568
1789
 
1569
1790
  // Handle scroll event - automatically checks if scroll is near bottom
1570
1791
  // Developer handles hasMore and isLoading conditions in onPopupScroll callback
1792
+ // Using refs to avoid recreating the callback when options change
1571
1793
  const handleScroll = (0, _react.useCallback)(event => {
1572
1794
  if (!onPopupScroll) return;
1573
1795
  const target = event.target;
@@ -1578,71 +1800,83 @@ const CapUnifiedSelect = _ref4 => {
1578
1800
 
1579
1801
  // Only call onPopupScroll if scroll is near bottom
1580
1802
  // Developer will handle hasMore and isLoading checks inside the callback
1581
- if (!isNearBottom) return;
1803
+ if (!isNearBottom) {
1804
+ // Reset processing flag when not near bottom
1805
+ isScrollProcessingRef.current = false;
1806
+ return;
1807
+ }
1808
+
1809
+ // Prevent multiple scroll triggers while already processing
1810
+ // This ensures we don't trigger multiple API calls simultaneously
1811
+ if (isScrollProcessingRef.current) return;
1582
1812
 
1583
1813
  // Prevent multiple scroll triggers while already loading
1584
1814
  // This ensures loading state is managed properly and data loading completes
1585
1815
  if (isLoadingOnScroll) return;
1586
1816
 
1587
- // Store current options count and options reference before triggering load
1588
- // This helps detect when new data arrives
1589
- // Store the reference directly - we'll compare by length and last item
1590
- prevOptionsCountRef.current = options.length;
1591
- prevOptionsRefForScroll.current = options;
1592
- // Also store the count at scroll trigger time for orderedOptions update
1593
- scrollTriggerOptionsCountRef.current = options.length;
1594
-
1595
- // Show loading indicator when scrolling near bottom
1596
- // This happens before calling onPopupScroll to provide immediate feedback
1597
- setIsLoadingOnScroll(true);
1598
-
1599
- // Clear any existing timeout
1600
- if (scrollLoadingTimeoutRef.current) {
1601
- clearTimeout(scrollLoadingTimeoutRef.current);
1602
- scrollLoadingTimeoutRef.current = null;
1817
+ // Throttle scroll events to prevent rapid-fire API calls
1818
+ // Clear any existing throttle timeout
1819
+ if (scrollThrottleTimeoutRef.current) {
1820
+ clearTimeout(scrollThrottleTimeoutRef.current);
1603
1821
  }
1604
1822
 
1605
- // Create a React synthetic event-like object with scroll information
1606
- // const syntheticEvent = {
1607
- // target: target,
1608
- // currentTarget: target,
1609
- // nativeEvent: event,
1610
- // bubbles: false,
1611
- // cancelable: false,
1612
- // defaultPrevented: false,
1613
- // eventPhase: 0,
1614
- // isTrusted: false,
1615
- // timeStamp: Date.now(),
1616
- // type: 'scroll',
1617
- // detail: 0,
1618
- // view: null,
1619
- // preventDefault: () => { },
1620
- // stopPropagation: () => { },
1621
- // stopImmediatePropagation: () => { },
1622
- // isDefaultPrevented: () => false,
1623
- // isPropagationStopped: () => false,
1624
- // } as unknown as React.UIEvent<HTMLElement>;
1625
-
1626
- // Call the developer's scroll handler - component already checked scroll position
1627
- // Developer should check hasMore and isLoading inside the callback
1628
- // This triggers the async data loading
1629
- onPopupScroll();
1630
-
1631
- // Set a fallback timeout to clear loading if options don't change
1632
- // This prevents loading from staying forever if data never arrives
1633
- // Using a longer timeout (10 seconds) to give enough time for slow API calls
1634
- scrollLoadingTimeoutRef.current = setTimeout(() => {
1635
- // Only clear if still loading (options change detection might have cleared it already)
1636
- setIsLoadingOnScroll(prev => {
1637
- if (prev) {
1638
- // Clear the timeout reference when clearing loading state
1639
- scrollLoadingTimeoutRef.current = null;
1640
- return false;
1641
- }
1642
- return prev;
1643
- });
1644
- }, 10000); // 10 seconds fallback - much longer than the previous 500ms
1645
- }, [onPopupScroll, isLoadingOnScroll, options.length]);
1823
+ // Set processing flag immediately to prevent duplicate calls
1824
+ isScrollProcessingRef.current = true;
1825
+
1826
+ // Throttle the actual API call to prevent multiple rapid triggers
1827
+ scrollThrottleTimeoutRef.current = setTimeout(() => {
1828
+ // Double-check we're still near bottom and not loading
1829
+ const stillNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
1830
+ if (!stillNearBottom || isLoadingOnScroll) {
1831
+ isScrollProcessingRef.current = false;
1832
+ return;
1833
+ }
1834
+
1835
+ // Store current options count and options reference before triggering load
1836
+ // This helps detect when new data arrives
1837
+ // Use ref to get current options without depending on options.length
1838
+ const currentOptions = optionsRef.current;
1839
+ prevOptionsCountRef.current = currentOptions.length;
1840
+ prevOptionsRefForScroll.current = currentOptions;
1841
+ // Also store the count at scroll trigger time for orderedOptions update
1842
+ scrollTriggerOptionsCountRef.current = currentOptions.length;
1843
+
1844
+ // Show loading indicator when scrolling near bottom
1845
+ // This happens before calling onPopupScroll to provide immediate feedback
1846
+ setIsLoadingOnScroll(true);
1847
+
1848
+ // Clear any existing timeout
1849
+ if (scrollLoadingTimeoutRef.current) {
1850
+ clearTimeout(scrollLoadingTimeoutRef.current);
1851
+ scrollLoadingTimeoutRef.current = null;
1852
+ }
1853
+
1854
+ // Mark as interacted when user scrolls (triggers data loading)
1855
+ hasInteractedRef.current = true;
1856
+
1857
+ // Call the developer's scroll handler - component already checked scroll position
1858
+ // Developer should check hasMore and isLoading inside the callback
1859
+ // This triggers the async data loading
1860
+ onPopupScroll();
1861
+
1862
+ // Set a fallback timeout to clear loading if options don't change
1863
+ // This prevents loading from staying forever if data never arrives
1864
+ // Using a longer timeout (10 seconds) to give enough time for slow API calls
1865
+ scrollLoadingTimeoutRef.current = setTimeout(() => {
1866
+ // Only clear if still loading (options change detection might have cleared it already)
1867
+ setIsLoadingOnScroll(prev => {
1868
+ if (prev) {
1869
+ // Clear the timeout reference when clearing loading state
1870
+ scrollLoadingTimeoutRef.current = null;
1871
+ // Reset processing flag when loading times out
1872
+ isScrollProcessingRef.current = false;
1873
+ return false;
1874
+ }
1875
+ return prev;
1876
+ });
1877
+ }, _constants.TIMEOUTS.SCROLL_LOADING_TIMEOUT);
1878
+ }, 150); // 150ms throttle to prevent rapid-fire events
1879
+ }, [onPopupScroll, isLoadingOnScroll]);
1646
1880
 
1647
1881
  // Setup scroll listener for onPopupScroll
1648
1882
  (0, _react.useEffect)(() => {
@@ -1686,13 +1920,20 @@ const CapUnifiedSelect = _ref4 => {
1686
1920
  passive: true
1687
1921
  });
1688
1922
  }
1689
- }, 100);
1923
+ }, _constants.TIMEOUTS.SCROLL_CONTAINER_DELAY);
1690
1924
  return () => {
1691
1925
  clearTimeout(timeoutId);
1926
+ // Clear throttle timeout when cleaning up
1927
+ if (scrollThrottleTimeoutRef.current) {
1928
+ clearTimeout(scrollThrottleTimeoutRef.current);
1929
+ scrollThrottleTimeoutRef.current = null;
1930
+ }
1692
1931
  if (scrollContainerRef.current) {
1693
1932
  scrollContainerRef.current.removeEventListener('scroll', handleScroll);
1694
1933
  scrollContainerRef.current = null;
1695
1934
  }
1935
+ // Reset processing flag when listener is removed
1936
+ isScrollProcessingRef.current = false;
1696
1937
  };
1697
1938
  }, [onPopupScroll, dropdownOpen, handleScroll]);
1698
1939
  const renderHeader = (0, _react.useMemo)(() => {
@@ -1759,7 +2000,7 @@ const CapUnifiedSelect = _ref4 => {
1759
2000
  tempValue: Array.isArray(tempValue) ? tempValue : undefined,
1760
2001
  setTempValue: val => setTempValue(val),
1761
2002
  processTreeData: buildTreeMaps
1762
- }), currentItems.length === 0 ? isSearching ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2003
+ }), currentItems.length === 0 ? isSearching || isResettingData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1763
2004
  className: _styles.default['cap-unified-select-loading-container'],
1764
2005
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
1765
2006
  align: "middle",
@@ -1783,7 +2024,23 @@ const CapUnifiedSelect = _ref4 => {
1783
2024
  noResultCustomIcon: noResultCustomIcon
1784
2025
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1785
2026
  className: _styles.default['cap-unified-select-menu-wrapper'],
1786
- children: [menu, isLoadingOnScroll && onPopupScroll && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2027
+ children: [menu, (isSearching || isResettingData) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
2028
+ className: _styles.default['cap-unified-select-loading-overlay'],
2029
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
2030
+ align: "middle",
2031
+ justify: "center",
2032
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSpin.default, {
2033
+ size: "small"
2034
+ })
2035
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
2036
+ align: "middle",
2037
+ justify: "center",
2038
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
2039
+ type: "label14",
2040
+ children: "Loading..."
2041
+ })
2042
+ })]
2043
+ }), isLoadingOnScroll && onPopupScroll && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1787
2044
  className: _styles.default['cap-unified-select-loading-overlay'],
1788
2045
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
1789
2046
  align: "middle",
@@ -1831,7 +2088,7 @@ const CapUnifiedSelect = _ref4 => {
1831
2088
  })]
1832
2089
  })]
1833
2090
  })
1834
- }), (type === SELECT_TYPES.SELECT || type === SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
2091
+ }), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
1835
2092
  className: _styles.default['cap-unified-select-tree-clear-container'],
1836
2093
  onClick: handleClearAll,
1837
2094
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -1840,28 +2097,53 @@ const CapUnifiedSelect = _ref4 => {
1840
2097
  })
1841
2098
  })]
1842
2099
  });
1843
- }, [customPopupRender, filteredTree, searchText, isMulti, showUpload, uploadLabel, handleUpload, noResultCustomText, noResultCustomIcon, options, type, tempValue, handleConfirm, handleClearAll, popoverClassName, className, selectedLeafCount, clearText, allowClear, staticValue, showSearch, onFooterDownloadChange, handleFooterDownload, isSearching, handleSearchChange, handleSearchKeyDown, isLoadingOnScroll, onPopupScroll]);
2100
+ }, [customPopupRender, filteredTree, searchText, isMulti, showUpload, uploadLabel, handleUpload, noResultCustomText, noResultCustomIcon, options, type, tempValue, handleConfirm, handleClearAll, popoverClassName, className, selectedLeafCount, clearText, allowClear, staticValue, showSearch, onFooterDownloadChange, handleFooterDownload, isSearching, handleSearchChange, handleSearchKeyDown, isLoadingOnScroll, onPopupScroll, isResettingData]);
1844
2101
  const combinedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(containerClassName, _styles.default['cap-unified-tree-select'], {
1845
2102
  [_styles.default['cap-unified-tree-select-readonly']]: readOnly
1846
2103
  }, className), [containerClassName, className, readOnly]);
1847
2104
 
1848
2105
  // Handle onChange for single select - detect clear button click and call resetData
1849
2106
  const handleSingleSelectChange = (0, _react.useCallback)(newValue => {
2107
+ // Mark as interacted if value changed from initial
2108
+ if (newValue !== initialTempValueRef.current) {
2109
+ hasInteractedRef.current = true;
2110
+ }
2111
+
1850
2112
  // If value is cleared (becomes undefined), call resetData
1851
2113
  if (newValue === undefined || newValue === null) {
1852
- resetData == null || resetData();
2114
+ if (resetData) {
2115
+ // Store current options before calling resetData to detect when they update
2116
+ prevOptionsBeforeResetRef.current = options;
2117
+ setIsResettingData(true);
2118
+ resetDataCalledRef.current = true;
2119
+ resetDataCalledTimeRef.current = Date.now();
2120
+ resetData();
2121
+ }
1853
2122
  }
1854
2123
  onChange == null || onChange(newValue);
1855
- }, [onChange, resetData]);
2124
+ }, [onChange, resetData, options]);
1856
2125
 
1857
2126
  // Handle onChange for multi select - detect clear and call resetData
1858
2127
  const handleMultiSelectChange = (0, _react.useCallback)(newValue => {
2128
+ // Mark as interacted if value changed from initial
2129
+ const initialValue = initialTempValueRef.current;
2130
+ const hasChanged = Array.isArray(newValue) && Array.isArray(initialValue) ? newValue.length !== initialValue.length || !newValue.every(v => initialValue.includes(v)) || !initialValue.every(v => newValue.includes(v)) : newValue !== initialValue;
2131
+ if (hasChanged) {
2132
+ hasInteractedRef.current = true;
2133
+ }
1859
2134
  // If value is cleared (becomes empty array or undefined), call resetData
1860
2135
  if (newValue === undefined || newValue === null || Array.isArray(newValue) && newValue.length === 0) {
1861
- resetData == null || resetData();
2136
+ if (resetData) {
2137
+ // Store current options before calling resetData to detect when they update
2138
+ prevOptionsBeforeResetRef.current = options;
2139
+ setIsResettingData(true);
2140
+ resetDataCalledRef.current = true;
2141
+ resetDataCalledTimeRef.current = Date.now();
2142
+ resetData();
2143
+ }
1862
2144
  }
1863
2145
  setTempValue(newValue);
1864
- }, [resetData]);
2146
+ }, [resetData, options]);
1865
2147
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
1866
2148
  className: className,
1867
2149
  children: [renderHeader, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.TreeSelect, _extends({
@@ -1894,7 +2176,7 @@ const CapUnifiedSelect = _ref4 => {
1894
2176
  popupMatchSelectWidth: false,
1895
2177
  disabled: disabled,
1896
2178
  filterTreeNode: false,
1897
- listHeight: 256,
2179
+ listHeight: _constants.DEFAULTS.LIST_HEIGHT,
1898
2180
  listItemHeight: virtualRowHeight,
1899
2181
  popupRender: renderCustomDropdown
1900
2182
  }, rest)), isError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -2700,7 +2982,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(1601);
2700
2982
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
2701
2983
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
2702
2984
  // Module
2703
- ___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:flex-start;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{flex:1;display:flex;align-items:center}.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;margin-left:.571rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info{margin-left:auto}.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}.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}.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}`, ""]);
2985
+ ___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;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}`, ""]);
2704
2986
  // Exports
2705
2987
  ___CSS_LOADER_EXPORT___.locals = {
2706
2988
  "cap-unified-select-header-wrapper": `blaze-ui-cap-unified-select-header-wrapper`,
@@ -2740,6 +3022,7 @@ ___CSS_LOADER_EXPORT___.locals = {
2740
3022
  "cap-unified-select-loading-overlay": `blaze-ui-cap-unified-select-loading-overlay`,
2741
3023
  "cap-unified-select-option-with-suffix": `blaze-ui-cap-unified-select-option-with-suffix`,
2742
3024
  "cap-unified-select-option-label": `blaze-ui-cap-unified-select-option-label`,
3025
+ "cap-unified-select-option-end": `blaze-ui-cap-unified-select-option-end`,
2743
3026
  "cap-unified-select-option-suffix": `blaze-ui-cap-unified-select-option-suffix`,
2744
3027
  "cap-tooltip-with-info": `blaze-ui-cap-tooltip-with-info`,
2745
3028
  "cap-icon": `blaze-ui-cap-icon`
@@ -2747,6 +3030,73 @@ ___CSS_LOADER_EXPORT___.locals = {
2747
3030
  module.exports = ___CSS_LOADER_EXPORT___;
2748
3031
 
2749
3032
 
3033
+ /***/ }),
3034
+
3035
+ /***/ 9788:
3036
+ /***/ ((__unused_webpack_module, exports) => {
3037
+
3038
+ "use strict";
3039
+
3040
+
3041
+ exports.__esModule = true;
3042
+ exports.TIMEOUTS = exports.SELECT_TYPES = exports.DEFAULTS = void 0;
3043
+ /**
3044
+ * Select type constants for CapUnifiedSelect component
3045
+ */
3046
+ const SELECT_TYPES = exports.SELECT_TYPES = {
3047
+ SELECT: 'select',
3048
+ MULTI_SELECT: 'multiSelect',
3049
+ TREE_SELECT: 'treeSelect',
3050
+ MULTI_TREE_SELECT: 'multiTreeSelect'
3051
+ };
3052
+ /**
3053
+ * Timeout constants (in milliseconds)
3054
+ */
3055
+ const TIMEOUTS = exports.TIMEOUTS = {
3056
+ /** Default search debounce timeout */
3057
+ DEFAULT_SEARCH_DEBOUNCE: 300,
3058
+ /** Delay for state updates after search */
3059
+ SEARCH_STATE_UPDATE_DELAY: 100,
3060
+ /** Minimum time since search was cleared to consider data ready */
3061
+ SEARCH_CLEARED_TIMEOUT: 200,
3062
+ /** Buffer time added to debounce for cleared search */
3063
+ SEARCH_CLEARED_BUFFER: 300,
3064
+ /** Buffer time added to debounce for regular search */
3065
+ SEARCH_REGULAR_BUFFER: 500,
3066
+ /** Brief delay to show loading indicator for static search */
3067
+ STATIC_SEARCH_DELAY: 150,
3068
+ /** Timeout for resetData fallback (1 second) */
3069
+ RESET_DATA_TIMEOUT: 1000,
3070
+ /** Minimum time since resetData was called to consider data ready */
3071
+ RESET_DATA_MIN_TIME: 300,
3072
+ /** Maximum time since resetData was called to consider data ready */
3073
+ RESET_DATA_MAX_TIME: 2000,
3074
+ /** Fallback timeout for scroll loading (10 seconds) */
3075
+ SCROLL_LOADING_TIMEOUT: 10000,
3076
+ /** Delay before setting up scroll container listener */
3077
+ SCROLL_CONTAINER_DELAY: 100
3078
+ };
3079
+
3080
+ /**
3081
+ * Default values for component props
3082
+ */
3083
+ const DEFAULTS = exports.DEFAULTS = {
3084
+ /** Default placeholder text */
3085
+ PLACEHOLDER: 'Select an option',
3086
+ /** Default upload button label */
3087
+ UPLOAD_LABEL: 'Upload',
3088
+ /** Default clear button text */
3089
+ CLEAR_TEXT: 'Clear',
3090
+ /** Default no results message */
3091
+ NO_RESULT_TEXT: 'No results found',
3092
+ /** Default no results icon */
3093
+ NO_RESULT_ICON: 'warning',
3094
+ /** Default virtual row height in pixels */
3095
+ VIRTUAL_ROW_HEIGHT: 32,
3096
+ /** Default list height in pixels */
3097
+ LIST_HEIGHT: 256
3098
+ };
3099
+
2750
3100
  /***/ })
2751
3101
 
2752
3102
  /******/ });