@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.
package/index.js CHANGED
@@ -20394,20 +20394,14 @@ var _CapRow = _interopRequireDefault(__webpack_require__(7375));
20394
20394
  var _CapSpin = _interopRequireDefault(__webpack_require__(1549));
20395
20395
  var _CapTooltip = _interopRequireDefault(__webpack_require__(5636));
20396
20396
  var _CapTooltipWithInfo = _interopRequireDefault(__webpack_require__(2608));
20397
+ var _constants = __webpack_require__(9788);
20397
20398
  var _styles = _interopRequireDefault(__webpack_require__(8263));
20398
20399
  var _jsxRuntime = __webpack_require__(4848);
20399
- 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"];
20400
+ 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"];
20400
20401
  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); }
20401
20402
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20402
20403
  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; }
20403
- 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
20404
- // import { List, AutoSizer } from 'react-virtualized';
20405
- const SELECT_TYPES = {
20406
- SELECT: 'select',
20407
- MULTI_SELECT: 'multiSelect',
20408
- TREE_SELECT: 'treeSelect',
20409
- MULTI_TREE_SELECT: 'multiTreeSelect'
20410
- };
20404
+ 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 */
20411
20405
  const NoResult = _ref => {
20412
20406
  let {
20413
20407
  noResultCustomText,
@@ -20425,7 +20419,7 @@ const NoResult = _ref => {
20425
20419
  size: "m"
20426
20420
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
20427
20421
  className: _styles.default['cap-unified-select-no-result-text'],
20428
- children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : 'No results found'
20422
+ children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : _constants.DEFAULTS.NO_RESULT_TEXT
20429
20423
  })]
20430
20424
  });
20431
20425
  };
@@ -20541,11 +20535,11 @@ const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
20541
20535
  };
20542
20536
  const CapUnifiedSelect = _ref4 => {
20543
20537
  let {
20544
- type = SELECT_TYPES.SELECT,
20538
+ type = _constants.SELECT_TYPES.SELECT,
20545
20539
  options = [],
20546
20540
  value,
20547
20541
  onChange,
20548
- placeholder = 'Select an option',
20542
+ placeholder = _constants.DEFAULTS.PLACEHOLDER,
20549
20543
  className = '',
20550
20544
  style,
20551
20545
  isError = false,
@@ -20555,7 +20549,7 @@ const CapUnifiedSelect = _ref4 => {
20555
20549
  allowClear = false,
20556
20550
  headerLabel,
20557
20551
  onUpload,
20558
- uploadLabel = 'Upload',
20552
+ uploadLabel = _constants.DEFAULTS.UPLOAD_LABEL,
20559
20553
  tooltip,
20560
20554
  bylineText,
20561
20555
  disabled = false,
@@ -20564,19 +20558,18 @@ const CapUnifiedSelect = _ref4 => {
20564
20558
  showSearch = true,
20565
20559
  searchBasedOn = 'label',
20566
20560
  onSearch,
20567
- searchDebounce = 300,
20561
+ searchDebounce = _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE,
20568
20562
  onConfirm,
20569
- clearText = 'Clear',
20570
- noResultCustomText = 'No results found',
20571
- noResultCustomIcon = 'warning',
20563
+ clearText = _constants.DEFAULTS.CLEAR_TEXT,
20564
+ noResultCustomText = _constants.DEFAULTS.NO_RESULT_TEXT,
20565
+ noResultCustomIcon = _constants.DEFAULTS.NO_RESULT_ICON,
20572
20566
  readOnly = false,
20573
20567
  staticValue = true,
20574
20568
  onFooterDownloadChange,
20575
20569
  onPopupScroll,
20576
20570
  enableVirtualization = false,
20577
- virtualRowHeight = 32,
20578
- resetSearchOnConfirm = true,
20579
- clearSearchOnClose = true,
20571
+ virtualRowHeight = _constants.DEFAULTS.VIRTUAL_ROW_HEIGHT,
20572
+ resetSearch = true,
20580
20573
  resetData
20581
20574
  } = _ref4,
20582
20575
  rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
@@ -20585,17 +20578,28 @@ const CapUnifiedSelect = _ref4 => {
20585
20578
  const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
20586
20579
  const [isSearching, setIsSearching] = (0, _react.useState)(false);
20587
20580
  const [isLoadingOnScroll, setIsLoadingOnScroll] = (0, _react.useState)(false);
20581
+ const [isResettingData, setIsResettingData] = (0, _react.useState)(false);
20588
20582
  // Store ordered options after confirm (selected items moved to top based on selection order)
20589
20583
  const [orderedOptions, setOrderedOptions] = (0, _react.useState)(null);
20590
20584
  const searchTimeoutRef = (0, _react.useRef)(null);
20591
20585
  const scrollContainerRef = (0, _react.useRef)(null);
20592
20586
  const scrollLoadingTimeoutRef = (0, _react.useRef)(null);
20587
+ // Track if scroll handler is currently processing to prevent duplicate calls
20588
+ const isScrollProcessingRef = (0, _react.useRef)(false);
20589
+ // Throttle ref for scroll events
20590
+ const scrollThrottleTimeoutRef = (0, _react.useRef)(null);
20591
+ // Ref to track options for scroll handler (avoids recreating handleScroll)
20592
+ const optionsRef = (0, _react.useRef)(options);
20593
20593
  // Cache of selected items from async results to preserve them during search
20594
20594
  const selectedItemsCacheRef = (0, _react.useRef)(new Map());
20595
20595
  // Track the last search query to detect when options update after search
20596
20596
  const lastSearchQueryRef = (0, _react.useRef)('');
20597
+ // Track when search was cleared to help clear loading state
20598
+ const searchClearedTimeRef = (0, _react.useRef)(null);
20597
20599
  // Track previous options to detect when they change after a search
20598
20600
  const prevOptionsRef = (0, _react.useRef)(options);
20601
+ // Track previous options before resetData is called to detect when options update
20602
+ const prevOptionsBeforeResetRef = (0, _react.useRef)(options);
20599
20603
  // Track previous options count to detect when options change after scroll
20600
20604
  const prevOptionsCountRef = (0, _react.useRef)(options.length);
20601
20605
  // Track previous options to detect when options change (even if count stays same)
@@ -20604,6 +20608,14 @@ const CapUnifiedSelect = _ref4 => {
20604
20608
  const scrollTriggerOptionsCountRef = (0, _react.useRef)(options.length);
20605
20609
  // Track if initial sort has been done (only sort once on initial load with selected values)
20606
20610
  const initialSortDoneRef = (0, _react.useRef)(false);
20611
+ // Track if user has interacted with the dropdown during current session (selected, searched, etc.)
20612
+ const hasInteractedRef = (0, _react.useRef)(false);
20613
+ // Track the initial tempValue when dropdown opens to detect if user made changes
20614
+ const initialTempValueRef = (0, _react.useRef)(value);
20615
+ // Track if resetData was already called in the current session to prevent duplicate calls
20616
+ const resetDataCalledRef = (0, _react.useRef)(false);
20617
+ // Track when resetData was called to help clear loading state
20618
+ const resetDataCalledTimeRef = (0, _react.useRef)(null);
20607
20619
  (0, _react.useEffect)(() => {
20608
20620
  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;
20609
20621
  if (!isEqual) {
@@ -20678,7 +20690,12 @@ const CapUnifiedSelect = _ref4 => {
20678
20690
  }, [options, orderedOptions, tempValue]);
20679
20691
 
20680
20692
  // Extract debounce timeout (extracted early for use in useEffects)
20681
- const debounceTimeout = searchDebounce != null ? searchDebounce : 300;
20693
+ const debounceTimeout = searchDebounce != null ? searchDebounce : _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE;
20694
+
20695
+ // Keep optionsRef in sync with options
20696
+ (0, _react.useEffect)(() => {
20697
+ optionsRef.current = options;
20698
+ }, [options]);
20682
20699
 
20683
20700
  // Cleanup timeouts on unmount
20684
20701
  (0, _react.useEffect)(() => {
@@ -20689,6 +20706,9 @@ const CapUnifiedSelect = _ref4 => {
20689
20706
  if (scrollLoadingTimeoutRef.current) {
20690
20707
  clearTimeout(scrollLoadingTimeoutRef.current);
20691
20708
  }
20709
+ if (scrollThrottleTimeoutRef.current) {
20710
+ clearTimeout(scrollThrottleTimeoutRef.current);
20711
+ }
20692
20712
  };
20693
20713
  }, []);
20694
20714
 
@@ -20696,20 +20716,34 @@ const CapUnifiedSelect = _ref4 => {
20696
20716
  // This prevents showing "No results found" before data arrives
20697
20717
  (0, _react.useEffect)(() => {
20698
20718
  // Only handle this for API-based searches (staticValue = false)
20699
- if (staticValue || !isSearching || !lastSearchQueryRef.current) {
20719
+ // Check if lastSearchQueryRef has been set (including empty string for cleared search)
20720
+ const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
20721
+ if (staticValue || !isSearching || !hasSearchQuery) {
20700
20722
  prevOptionsRef.current = options;
20701
20723
  return;
20702
20724
  }
20703
20725
 
20704
20726
  // Check if options actually changed (reference or content)
20705
20727
  const optionsChanged = prevOptionsRef.current !== options || prevOptionsRef.current.length !== options.length;
20706
- if (optionsChanged) {
20728
+
20729
+ // Also check if search was cleared (empty string) and enough time has passed
20730
+ // This handles the case where clearing search reloads initial data that might be the same reference
20731
+ const searchCleared = lastSearchQueryRef.current === '';
20732
+ const timeSinceCleared = searchClearedTimeRef.current ? Date.now() - searchClearedTimeRef.current : Infinity;
20733
+ const hasOptionsData = options.length > 0;
20734
+ // Wait at least SEARCH_CLEARED_TIMEOUT after search is cleared to allow API call to complete
20735
+ const clearedSearchReady = searchCleared && hasOptionsData && timeSinceCleared > _constants.TIMEOUTS.SEARCH_CLEARED_TIMEOUT;
20736
+ if (optionsChanged || clearedSearchReady) {
20707
20737
  // Options updated after search - data has arrived
20708
20738
  // Use a small delay to ensure state updates are processed
20709
20739
  const timeoutId = setTimeout(() => {
20710
20740
  setIsSearching(false);
20711
20741
  prevOptionsRef.current = options;
20712
- }, 100);
20742
+ // Clear timestamp when search loading is cleared
20743
+ if (searchCleared) {
20744
+ searchClearedTimeRef.current = null;
20745
+ }
20746
+ }, _constants.TIMEOUTS.SEARCH_STATE_UPDATE_DELAY);
20713
20747
  return () => clearTimeout(timeoutId);
20714
20748
  }
20715
20749
  prevOptionsRef.current = options;
@@ -20719,20 +20753,85 @@ const CapUnifiedSelect = _ref4 => {
20719
20753
  // This handles edge cases where options might not change reference but data has arrived
20720
20754
  // Also handles error cases where options don't update after search
20721
20755
  (0, _react.useEffect)(() => {
20722
- if (!isSearching || staticValue || !lastSearchQueryRef.current) {
20756
+ // Check if lastSearchQueryRef has been set (including empty string for cleared search)
20757
+ const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
20758
+ if (!isSearching || staticValue || !hasSearchQuery) {
20723
20759
  return;
20724
20760
  }
20725
20761
 
20762
+ // For cleared search (empty string), use a shorter timeout since it should reload initial data quickly
20763
+ // For regular search, use debounce timeout + buffer
20764
+ const searchCleared = lastSearchQueryRef.current === '';
20765
+ const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER // Shorter timeout for cleared search
20766
+ : debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER; // Longer timeout for regular search
20767
+
20726
20768
  // Calculate timeout: debounce timeout + a small buffer for API response
20727
20769
  // This ensures we wait for the API call to complete before showing "No results"
20728
20770
  // For error cases where options don't update, this will clear loading state
20729
20771
  const fallbackTimeout = setTimeout(() => {
20730
20772
  setIsSearching(false);
20731
- }, debounceTimeout + 500); // debounce timeout + 500ms buffer
20732
-
20773
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
20774
+ }, timeoutDuration);
20733
20775
  return () => clearTimeout(fallbackTimeout);
20734
20776
  }, [isSearching, staticValue, debounceTimeout, options.length]);
20735
20777
 
20778
+ // Detect when options update after resetData is called to clear loading state
20779
+ (0, _react.useEffect)(() => {
20780
+ if (!isResettingData) {
20781
+ // Update ref even when not resetting to keep it in sync
20782
+ prevOptionsBeforeResetRef.current = options;
20783
+ // Clear timestamp when not resetting
20784
+ resetDataCalledTimeRef.current = null;
20785
+ return;
20786
+ }
20787
+
20788
+ // Check if options actually changed (reference, length, or content)
20789
+ // Compare against the options that existed before resetData was called
20790
+ const prevOptions = prevOptionsBeforeResetRef.current;
20791
+ const currentOptions = options;
20792
+
20793
+ // More robust comparison: check reference, length, or any content differences
20794
+ const optionsChanged = prevOptions !== currentOptions || prevOptions.length !== currentOptions.length ||
20795
+ // Deep comparison: check if any option values or labels changed
20796
+ prevOptions.length === currentOptions.length && prevOptions.length > 0 && prevOptions.some((prevOpt, idx) => {
20797
+ const currentOpt = currentOptions[idx];
20798
+ return !currentOpt || prevOpt.value !== currentOpt.value || prevOpt.label !== currentOpt.label;
20799
+ });
20800
+
20801
+ // Additional check: if enough time has passed since resetData was called
20802
+ // and we have options data, assume data has loaded even if comparison didn't detect change
20803
+ const timeSinceReset = resetDataCalledTimeRef.current ? Date.now() - resetDataCalledTimeRef.current : Infinity;
20804
+ const hasDataAfterTimeout = currentOptions.length > 0 && timeSinceReset > _constants.TIMEOUTS.RESET_DATA_MIN_TIME && timeSinceReset < _constants.TIMEOUTS.RESET_DATA_MAX_TIME;
20805
+
20806
+ // If options changed or enough time has passed with data, clear the loading state
20807
+ if (optionsChanged || hasDataAfterTimeout) {
20808
+ // Options updated after resetData - data has arrived
20809
+ // Clear immediately without delay for faster response
20810
+ setIsResettingData(false);
20811
+ prevOptionsBeforeResetRef.current = currentOptions;
20812
+ resetDataCalledTimeRef.current = null;
20813
+ }
20814
+ }, [options, isResettingData]);
20815
+
20816
+ // Fallback: Clear resetData loading state after a reasonable timeout
20817
+ // This handles edge cases where options might not change reference but data has arrived
20818
+ (0, _react.useEffect)(() => {
20819
+ if (!isResettingData) {
20820
+ return;
20821
+ }
20822
+
20823
+ // Set a timeout to clear loading state if options don't update
20824
+ // Reduced timeout to 1 second for faster recovery
20825
+ const fallbackTimeout = setTimeout(() => {
20826
+ setIsResettingData(false);
20827
+ // Update ref to current options to prevent false positives in future comparisons
20828
+ prevOptionsBeforeResetRef.current = options;
20829
+ // Clear timestamp
20830
+ resetDataCalledTimeRef.current = null;
20831
+ }, _constants.TIMEOUTS.RESET_DATA_TIMEOUT);
20832
+ return () => clearTimeout(fallbackTimeout);
20833
+ }, [isResettingData, options]);
20834
+
20736
20835
  // Detect when options change after scroll to clear loading overlay
20737
20836
  (0, _react.useEffect)(() => {
20738
20837
  // Always update refs when options change (when not loading)
@@ -20782,6 +20881,8 @@ const CapUnifiedSelect = _ref4 => {
20782
20881
  if (optionsCountIncreased || optionsContentChanged) {
20783
20882
  // Options updated after scroll - data has arrived, clear loading overlay
20784
20883
  setIsLoadingOnScroll(false);
20884
+ // Reset processing flag to allow next scroll event
20885
+ isScrollProcessingRef.current = false;
20785
20886
  if (scrollLoadingTimeoutRef.current) {
20786
20887
  clearTimeout(scrollLoadingTimeoutRef.current);
20787
20888
  scrollLoadingTimeoutRef.current = null;
@@ -20802,9 +20903,23 @@ const CapUnifiedSelect = _ref4 => {
20802
20903
  }
20803
20904
  const trimmedQuery = query.trim();
20804
20905
 
20906
+ // Track when search is cleared (empty string after having a query)
20907
+ const wasSearching = lastSearchQueryRef.current !== '';
20908
+ const isNowCleared = trimmedQuery === '';
20909
+ if (wasSearching && isNowCleared) {
20910
+ searchClearedTimeRef.current = Date.now();
20911
+ } else if (!isNowCleared) {
20912
+ searchClearedTimeRef.current = null;
20913
+ }
20914
+
20805
20915
  // Track the search query to detect when options update
20806
20916
  lastSearchQueryRef.current = trimmedQuery;
20807
20917
 
20918
+ // Mark as interacted if user typed something (even if they clear it later)
20919
+ if (trimmedQuery.length > 0 || lastSearchQueryRef.current.length > 0) {
20920
+ hasInteractedRef.current = true;
20921
+ }
20922
+
20808
20923
  // For API-based searches (staticValue = false), always call onSearch
20809
20924
  // This allows the developer to reload all initial data when search is cleared
20810
20925
  if (!staticValue && onSearch) {
@@ -20822,12 +20937,17 @@ const CapUnifiedSelect = _ref4 => {
20822
20937
  // For static searches, if query is empty, just reset the state
20823
20938
  setIsSearching(false);
20824
20939
  } else {
20825
- // For static searches with content, filtering is instant
20826
- setIsSearching(false);
20940
+ // For static searches with content, show brief loading indicator
20941
+ // Set loading state briefly to show user feedback
20942
+ setIsSearching(true);
20943
+ // Clear loading state after a short delay (filtering is instant but we show feedback)
20944
+ searchTimeoutRef.current = setTimeout(() => {
20945
+ setIsSearching(false);
20946
+ }, _constants.TIMEOUTS.STATIC_SEARCH_DELAY);
20827
20947
  }
20828
20948
  }, [onSearch, staticValue, debounceTimeout]);
20829
- const isMulti = (0, _react.useMemo)(() => type === SELECT_TYPES.MULTI_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
20830
- const isTree = (0, _react.useMemo)(() => type === SELECT_TYPES.TREE_SELECT || type === SELECT_TYPES.MULTI_TREE_SELECT, [type]);
20949
+ const isMulti = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.MULTI_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
20950
+ const isTree = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.TREE_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
20831
20951
 
20832
20952
  // Use options directly since pagination is handled by the developer
20833
20953
  const mergedOptions = (0, _react.useMemo)(() => {
@@ -21003,17 +21123,24 @@ const CapUnifiedSelect = _ref4 => {
21003
21123
  const enhanceOptions = opts => opts.map(opt => {
21004
21124
  const decoratedTitle = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21005
21125
  className: _styles.default['cap-unified-select-option-with-suffix'],
21006
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
21007
- type: "label14",
21126
+ justify: "space-between",
21127
+ align: "middle",
21128
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
21008
21129
  className: _styles.default['cap-unified-select-option-label'],
21009
- children: opt == null ? void 0 : opt.label
21010
- }), (opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21011
- className: _styles.default['cap-unified-select-option-suffix'],
21012
- children: [opt == null ? void 0 : opt.optionSuffix, ' ', (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21013
- title: opt == null ? void 0 : opt.optionSuffixInfo
21130
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
21131
+ type: "label14",
21132
+ children: opt == null ? void 0 : opt.label
21133
+ })
21134
+ }), ((opt == null ? void 0 : opt.optionSuffix) || (opt == null ? void 0 : opt.optionTooltipInfo)) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21135
+ className: _styles.default['cap-unified-select-option-end'],
21136
+ children: [(opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
21137
+ className: _styles.default['cap-unified-select-option-suffix'],
21138
+ children: [opt == null ? void 0 : opt.optionSuffix, (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21139
+ title: opt == null ? void 0 : opt.optionSuffixInfo
21140
+ })]
21141
+ }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21142
+ title: opt == null ? void 0 : opt.optionTooltipInfo
21014
21143
  })]
21015
- }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21016
- title: opt == null ? void 0 : opt.optionTooltipInfo
21017
21144
  })]
21018
21145
  });
21019
21146
  return _extends({}, opt, {
@@ -21025,17 +21152,24 @@ const CapUnifiedSelect = _ref4 => {
21025
21152
  return isTree ? enhanceOptions(sourceOptions) : sourceOptions.map(opt => _extends({}, opt, {
21026
21153
  title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21027
21154
  className: _styles.default['cap-unified-select-option-with-suffix'],
21028
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
21029
- type: "label14",
21155
+ justify: "space-between",
21156
+ align: "middle",
21157
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
21030
21158
  className: _styles.default['cap-unified-select-option-label'],
21031
- children: opt == null ? void 0 : opt.label
21032
- }), (opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21033
- className: _styles.default['cap-unified-select-option-suffix'],
21034
- children: [opt == null ? void 0 : opt.optionSuffix, ' ', (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21035
- title: opt == null ? void 0 : opt.optionSuffixInfo
21159
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
21160
+ type: "label14",
21161
+ children: opt == null ? void 0 : opt.label
21162
+ })
21163
+ }), ((opt == null ? void 0 : opt.optionSuffix) || (opt == null ? void 0 : opt.optionTooltipInfo)) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21164
+ className: _styles.default['cap-unified-select-option-end'],
21165
+ children: [(opt == null ? void 0 : opt.optionSuffix) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
21166
+ className: _styles.default['cap-unified-select-option-suffix'],
21167
+ children: [opt == null ? void 0 : opt.optionSuffix, (opt == null ? void 0 : opt.optionSuffixInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21168
+ title: opt == null ? void 0 : opt.optionSuffixInfo
21169
+ })]
21170
+ }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21171
+ title: opt == null ? void 0 : opt.optionTooltipInfo
21036
21172
  })]
21037
- }), (opt == null ? void 0 : opt.optionTooltipInfo) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapTooltipWithInfo.default, {
21038
- title: opt == null ? void 0 : opt.optionTooltipInfo
21039
21173
  })]
21040
21174
  }),
21041
21175
  label: opt == null ? void 0 : opt.label
@@ -21096,6 +21230,9 @@ const CapUnifiedSelect = _ref4 => {
21096
21230
  return null;
21097
21231
  }, [isMulti, displayValue, treeMaps]);
21098
21232
  const handleConfirm = (0, _react.useCallback)(() => {
21233
+ // Mark as interacted since user clicked confirm (explicit action)
21234
+ hasInteractedRef.current = true;
21235
+
21099
21236
  // Reorder options based on selection order when confirm is clicked
21100
21237
  // Use mergedOptions to include paginated options if they exist
21101
21238
  const optionsToReorder = mergedOptions;
@@ -21115,51 +21252,135 @@ const CapUnifiedSelect = _ref4 => {
21115
21252
  setDropdownOpen(false);
21116
21253
  // Always clear searching state since search operation is complete
21117
21254
  setIsSearching(false);
21118
- // Clear search text on confirm only if resetSearchOnConfirm is true
21255
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
21256
+ // Clear search text on confirm only if resetSearch is true
21119
21257
  // This allows users to keep their search when reopening the dropdown if desired
21120
- if (resetSearchOnConfirm) {
21258
+ if (resetSearch) {
21121
21259
  setSearchText('');
21122
21260
  lastSearchQueryRef.current = ''; // Clear search query ref
21123
21261
  }
21124
21262
  // Call resetData to allow developer to reload initial data
21125
- resetData == null || resetData();
21263
+ if (resetData) {
21264
+ // Store current options before calling resetData to detect when they update
21265
+ prevOptionsBeforeResetRef.current = mergedOptions;
21266
+ setIsResettingData(true);
21267
+ resetDataCalledRef.current = true;
21268
+ resetDataCalledTimeRef.current = Date.now();
21269
+ resetData();
21270
+ }
21126
21271
  onConfirm == null || onConfirm(tempValue);
21127
- }, [onChange, onConfirm, tempValue, resetSearchOnConfirm, isMulti, mergedOptions, reorderOptionsBySelection, resetData]);
21272
+ }, [onChange, onConfirm, tempValue, resetSearch, isMulti, mergedOptions, reorderOptionsBySelection, resetData]);
21128
21273
  const handleClearAll = (0, _react.useCallback)(() => {
21274
+ // Mark as interacted since user clicked clear (explicit action)
21275
+ hasInteractedRef.current = true;
21129
21276
  const cleared = isMulti ? [] : undefined;
21130
21277
  setTempValue(cleared);
21131
21278
  onChange == null || onChange(cleared);
21132
21279
  setDropdownOpen(false);
21133
21280
  // Call resetData to allow developer to reload initial data
21134
- resetData == null || resetData();
21135
- }, [isMulti, onChange, resetData]);
21281
+ if (resetData) {
21282
+ // Store current options before calling resetData to detect when they update
21283
+ prevOptionsBeforeResetRef.current = options;
21284
+ setIsResettingData(true);
21285
+ resetDataCalledRef.current = true;
21286
+ resetDataCalledTimeRef.current = Date.now();
21287
+ resetData();
21288
+ }
21289
+ }, [isMulti, onChange, resetData, options]);
21136
21290
  const handleDropdownVisibilityChange = (0, _react.useCallback)(open => {
21137
21291
  if (readOnly) {
21138
21292
  return;
21139
21293
  }
21140
- if (!open) {
21294
+ if (open) {
21295
+ // Reset interaction tracking when dropdown opens
21296
+ // Store initial value (not tempValue) to detect if user makes changes
21297
+ // This ensures we track changes from the actual selected value, not temporary state
21298
+ initialTempValueRef.current = value;
21299
+ hasInteractedRef.current = false;
21300
+ resetDataCalledRef.current = false;
21301
+ // Clear any pending search timeouts
21302
+ if (searchTimeoutRef.current) {
21303
+ clearTimeout(searchTimeoutRef.current);
21304
+ searchTimeoutRef.current = null;
21305
+ }
21306
+ // Clear any pending scroll loading timeouts
21307
+ if (scrollLoadingTimeoutRef.current) {
21308
+ clearTimeout(scrollLoadingTimeoutRef.current);
21309
+ scrollLoadingTimeoutRef.current = null;
21310
+ }
21311
+ if (scrollThrottleTimeoutRef.current) {
21312
+ clearTimeout(scrollThrottleTimeoutRef.current);
21313
+ scrollThrottleTimeoutRef.current = null;
21314
+ }
21315
+ // Reset loading states
21316
+ setIsSearching(false);
21317
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
21318
+ setIsLoadingOnScroll(false);
21319
+ isScrollProcessingRef.current = false;
21320
+ // Safety check: Clear isResettingData if it's still true when opening
21321
+ // This handles cases where options updated while dropdown was closed
21322
+ if (isResettingData) {
21323
+ setIsResettingData(false);
21324
+ // Update ref to current options to prevent false positives
21325
+ prevOptionsBeforeResetRef.current = options;
21326
+ // Clear timestamp
21327
+ resetDataCalledTimeRef.current = null;
21328
+ }
21329
+ } else {
21330
+ // Dropdown is closing
21141
21331
  if (!customPopupRender) {
21142
21332
  onChange == null || onChange(tempValue);
21143
21333
  } else {
21144
21334
  setTempValue(value);
21145
21335
  }
21146
21336
  // Clear search when closing (if enabled)
21147
- if (clearSearchOnClose) {
21337
+ if (resetSearch) {
21148
21338
  setSearchText('');
21149
21339
  setIsSearching(false);
21150
21340
  lastSearchQueryRef.current = ''; // Clear search query ref
21341
+ searchClearedTimeRef.current = null; // Clear search cleared timestamp
21151
21342
  }
21152
21343
  // Reset scroll loading state
21153
21344
  setIsLoadingOnScroll(false);
21345
+ isScrollProcessingRef.current = false;
21154
21346
  if (scrollLoadingTimeoutRef.current) {
21155
21347
  clearTimeout(scrollLoadingTimeoutRef.current);
21348
+ scrollLoadingTimeoutRef.current = null;
21349
+ }
21350
+ if (scrollThrottleTimeoutRef.current) {
21351
+ clearTimeout(scrollThrottleTimeoutRef.current);
21352
+ scrollThrottleTimeoutRef.current = null;
21156
21353
  }
21157
21354
  scrollContainerRef.current = null;
21158
- // Call resetData to allow developer to reload initial data when dropdown closes
21159
- resetData == null || resetData();
21355
+
21356
+ // Only call resetData if user actually interacted (selected, searched, etc.)
21357
+ // and resetData hasn't been called already in this session
21358
+ // This prevents multiple API calls when user just opens/closes without interaction
21359
+ if (resetData && hasInteractedRef.current && !resetDataCalledRef.current) {
21360
+ // Store current options before calling resetData to detect when they update
21361
+ prevOptionsBeforeResetRef.current = options;
21362
+ setIsResettingData(true);
21363
+ resetDataCalledRef.current = true;
21364
+ resetDataCalledTimeRef.current = Date.now();
21365
+ resetData();
21366
+ } else if (!hasInteractedRef.current) {
21367
+ // User did nothing - reset everything as if it's a fresh load
21368
+ // Clear any pending operations
21369
+ if (searchTimeoutRef.current) {
21370
+ clearTimeout(searchTimeoutRef.current);
21371
+ searchTimeoutRef.current = null;
21372
+ }
21373
+ setIsSearching(false);
21374
+ setIsResettingData(false);
21375
+ // Reset search query ref
21376
+ lastSearchQueryRef.current = '';
21377
+ }
21378
+
21379
+ // Reset interaction flag for next session
21380
+ hasInteractedRef.current = false;
21160
21381
  }
21161
21382
  setDropdownOpen(open);
21162
- }, [customPopupRender, value, onChange, tempValue, readOnly, clearSearchOnClose, resetData]);
21383
+ }, [customPopupRender, value, onChange, tempValue, readOnly, resetSearch, resetData, options]);
21163
21384
  const handleFooterDownload = (0, _react.useCallback)(() => {
21164
21385
  const currentValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
21165
21386
  onFooterDownloadChange == null || onFooterDownloadChange(currentValues);
@@ -21189,6 +21410,7 @@ const CapUnifiedSelect = _ref4 => {
21189
21410
 
21190
21411
  // Handle scroll event - automatically checks if scroll is near bottom
21191
21412
  // Developer handles hasMore and isLoading conditions in onPopupScroll callback
21413
+ // Using refs to avoid recreating the callback when options change
21192
21414
  const handleScroll = (0, _react.useCallback)(event => {
21193
21415
  if (!onPopupScroll) return;
21194
21416
  const target = event.target;
@@ -21199,71 +21421,83 @@ const CapUnifiedSelect = _ref4 => {
21199
21421
 
21200
21422
  // Only call onPopupScroll if scroll is near bottom
21201
21423
  // Developer will handle hasMore and isLoading checks inside the callback
21202
- if (!isNearBottom) return;
21424
+ if (!isNearBottom) {
21425
+ // Reset processing flag when not near bottom
21426
+ isScrollProcessingRef.current = false;
21427
+ return;
21428
+ }
21429
+
21430
+ // Prevent multiple scroll triggers while already processing
21431
+ // This ensures we don't trigger multiple API calls simultaneously
21432
+ if (isScrollProcessingRef.current) return;
21203
21433
 
21204
21434
  // Prevent multiple scroll triggers while already loading
21205
21435
  // This ensures loading state is managed properly and data loading completes
21206
21436
  if (isLoadingOnScroll) return;
21207
21437
 
21208
- // Store current options count and options reference before triggering load
21209
- // This helps detect when new data arrives
21210
- // Store the reference directly - we'll compare by length and last item
21211
- prevOptionsCountRef.current = options.length;
21212
- prevOptionsRefForScroll.current = options;
21213
- // Also store the count at scroll trigger time for orderedOptions update
21214
- scrollTriggerOptionsCountRef.current = options.length;
21215
-
21216
- // Show loading indicator when scrolling near bottom
21217
- // This happens before calling onPopupScroll to provide immediate feedback
21218
- setIsLoadingOnScroll(true);
21219
-
21220
- // Clear any existing timeout
21221
- if (scrollLoadingTimeoutRef.current) {
21222
- clearTimeout(scrollLoadingTimeoutRef.current);
21223
- scrollLoadingTimeoutRef.current = null;
21224
- }
21225
-
21226
- // Create a React synthetic event-like object with scroll information
21227
- // const syntheticEvent = {
21228
- // target: target,
21229
- // currentTarget: target,
21230
- // nativeEvent: event,
21231
- // bubbles: false,
21232
- // cancelable: false,
21233
- // defaultPrevented: false,
21234
- // eventPhase: 0,
21235
- // isTrusted: false,
21236
- // timeStamp: Date.now(),
21237
- // type: 'scroll',
21238
- // detail: 0,
21239
- // view: null,
21240
- // preventDefault: () => { },
21241
- // stopPropagation: () => { },
21242
- // stopImmediatePropagation: () => { },
21243
- // isDefaultPrevented: () => false,
21244
- // isPropagationStopped: () => false,
21245
- // } as unknown as React.UIEvent<HTMLElement>;
21246
-
21247
- // Call the developer's scroll handler - component already checked scroll position
21248
- // Developer should check hasMore and isLoading inside the callback
21249
- // This triggers the async data loading
21250
- onPopupScroll();
21251
-
21252
- // Set a fallback timeout to clear loading if options don't change
21253
- // This prevents loading from staying forever if data never arrives
21254
- // Using a longer timeout (10 seconds) to give enough time for slow API calls
21255
- scrollLoadingTimeoutRef.current = setTimeout(() => {
21256
- // Only clear if still loading (options change detection might have cleared it already)
21257
- setIsLoadingOnScroll(prev => {
21258
- if (prev) {
21259
- // Clear the timeout reference when clearing loading state
21260
- scrollLoadingTimeoutRef.current = null;
21261
- return false;
21262
- }
21263
- return prev;
21264
- });
21265
- }, 10000); // 10 seconds fallback - much longer than the previous 500ms
21266
- }, [onPopupScroll, isLoadingOnScroll, options.length]);
21438
+ // Throttle scroll events to prevent rapid-fire API calls
21439
+ // Clear any existing throttle timeout
21440
+ if (scrollThrottleTimeoutRef.current) {
21441
+ clearTimeout(scrollThrottleTimeoutRef.current);
21442
+ }
21443
+
21444
+ // Set processing flag immediately to prevent duplicate calls
21445
+ isScrollProcessingRef.current = true;
21446
+
21447
+ // Throttle the actual API call to prevent multiple rapid triggers
21448
+ scrollThrottleTimeoutRef.current = setTimeout(() => {
21449
+ // Double-check we're still near bottom and not loading
21450
+ const stillNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
21451
+ if (!stillNearBottom || isLoadingOnScroll) {
21452
+ isScrollProcessingRef.current = false;
21453
+ return;
21454
+ }
21455
+
21456
+ // Store current options count and options reference before triggering load
21457
+ // This helps detect when new data arrives
21458
+ // Use ref to get current options without depending on options.length
21459
+ const currentOptions = optionsRef.current;
21460
+ prevOptionsCountRef.current = currentOptions.length;
21461
+ prevOptionsRefForScroll.current = currentOptions;
21462
+ // Also store the count at scroll trigger time for orderedOptions update
21463
+ scrollTriggerOptionsCountRef.current = currentOptions.length;
21464
+
21465
+ // Show loading indicator when scrolling near bottom
21466
+ // This happens before calling onPopupScroll to provide immediate feedback
21467
+ setIsLoadingOnScroll(true);
21468
+
21469
+ // Clear any existing timeout
21470
+ if (scrollLoadingTimeoutRef.current) {
21471
+ clearTimeout(scrollLoadingTimeoutRef.current);
21472
+ scrollLoadingTimeoutRef.current = null;
21473
+ }
21474
+
21475
+ // Mark as interacted when user scrolls (triggers data loading)
21476
+ hasInteractedRef.current = true;
21477
+
21478
+ // Call the developer's scroll handler - component already checked scroll position
21479
+ // Developer should check hasMore and isLoading inside the callback
21480
+ // This triggers the async data loading
21481
+ onPopupScroll();
21482
+
21483
+ // Set a fallback timeout to clear loading if options don't change
21484
+ // This prevents loading from staying forever if data never arrives
21485
+ // Using a longer timeout (10 seconds) to give enough time for slow API calls
21486
+ scrollLoadingTimeoutRef.current = setTimeout(() => {
21487
+ // Only clear if still loading (options change detection might have cleared it already)
21488
+ setIsLoadingOnScroll(prev => {
21489
+ if (prev) {
21490
+ // Clear the timeout reference when clearing loading state
21491
+ scrollLoadingTimeoutRef.current = null;
21492
+ // Reset processing flag when loading times out
21493
+ isScrollProcessingRef.current = false;
21494
+ return false;
21495
+ }
21496
+ return prev;
21497
+ });
21498
+ }, _constants.TIMEOUTS.SCROLL_LOADING_TIMEOUT);
21499
+ }, 150); // 150ms throttle to prevent rapid-fire events
21500
+ }, [onPopupScroll, isLoadingOnScroll]);
21267
21501
 
21268
21502
  // Setup scroll listener for onPopupScroll
21269
21503
  (0, _react.useEffect)(() => {
@@ -21307,13 +21541,20 @@ const CapUnifiedSelect = _ref4 => {
21307
21541
  passive: true
21308
21542
  });
21309
21543
  }
21310
- }, 100);
21544
+ }, _constants.TIMEOUTS.SCROLL_CONTAINER_DELAY);
21311
21545
  return () => {
21312
21546
  clearTimeout(timeoutId);
21547
+ // Clear throttle timeout when cleaning up
21548
+ if (scrollThrottleTimeoutRef.current) {
21549
+ clearTimeout(scrollThrottleTimeoutRef.current);
21550
+ scrollThrottleTimeoutRef.current = null;
21551
+ }
21313
21552
  if (scrollContainerRef.current) {
21314
21553
  scrollContainerRef.current.removeEventListener('scroll', handleScroll);
21315
21554
  scrollContainerRef.current = null;
21316
21555
  }
21556
+ // Reset processing flag when listener is removed
21557
+ isScrollProcessingRef.current = false;
21317
21558
  };
21318
21559
  }, [onPopupScroll, dropdownOpen, handleScroll]);
21319
21560
  const renderHeader = (0, _react.useMemo)(() => {
@@ -21380,7 +21621,7 @@ const CapUnifiedSelect = _ref4 => {
21380
21621
  tempValue: Array.isArray(tempValue) ? tempValue : undefined,
21381
21622
  setTempValue: val => setTempValue(val),
21382
21623
  processTreeData: buildTreeMaps
21383
- }), currentItems.length === 0 ? isSearching ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21624
+ }), currentItems.length === 0 ? isSearching || isResettingData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21384
21625
  className: _styles.default['cap-unified-select-loading-container'],
21385
21626
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21386
21627
  align: "middle",
@@ -21404,7 +21645,23 @@ const CapUnifiedSelect = _ref4 => {
21404
21645
  noResultCustomIcon: noResultCustomIcon
21405
21646
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21406
21647
  className: _styles.default['cap-unified-select-menu-wrapper'],
21407
- children: [menu, isLoadingOnScroll && onPopupScroll && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21648
+ children: [menu, (isSearching || isResettingData) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21649
+ className: _styles.default['cap-unified-select-loading-overlay'],
21650
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21651
+ align: "middle",
21652
+ justify: "center",
21653
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSpin.default, {
21654
+ size: "small"
21655
+ })
21656
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21657
+ align: "middle",
21658
+ justify: "center",
21659
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
21660
+ type: "label14",
21661
+ children: "Loading..."
21662
+ })
21663
+ })]
21664
+ }), isLoadingOnScroll && onPopupScroll && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21408
21665
  className: _styles.default['cap-unified-select-loading-overlay'],
21409
21666
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21410
21667
  align: "middle",
@@ -21452,7 +21709,7 @@ const CapUnifiedSelect = _ref4 => {
21452
21709
  })]
21453
21710
  })]
21454
21711
  })
21455
- }), (type === SELECT_TYPES.SELECT || type === SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21712
+ }), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21456
21713
  className: _styles.default['cap-unified-select-tree-clear-container'],
21457
21714
  onClick: handleClearAll,
21458
21715
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -21461,28 +21718,53 @@ const CapUnifiedSelect = _ref4 => {
21461
21718
  })
21462
21719
  })]
21463
21720
  });
21464
- }, [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]);
21721
+ }, [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]);
21465
21722
  const combinedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(containerClassName, _styles.default['cap-unified-tree-select'], {
21466
21723
  [_styles.default['cap-unified-tree-select-readonly']]: readOnly
21467
21724
  }, className), [containerClassName, className, readOnly]);
21468
21725
 
21469
21726
  // Handle onChange for single select - detect clear button click and call resetData
21470
21727
  const handleSingleSelectChange = (0, _react.useCallback)(newValue => {
21728
+ // Mark as interacted if value changed from initial
21729
+ if (newValue !== initialTempValueRef.current) {
21730
+ hasInteractedRef.current = true;
21731
+ }
21732
+
21471
21733
  // If value is cleared (becomes undefined), call resetData
21472
21734
  if (newValue === undefined || newValue === null) {
21473
- resetData == null || resetData();
21735
+ if (resetData) {
21736
+ // Store current options before calling resetData to detect when they update
21737
+ prevOptionsBeforeResetRef.current = options;
21738
+ setIsResettingData(true);
21739
+ resetDataCalledRef.current = true;
21740
+ resetDataCalledTimeRef.current = Date.now();
21741
+ resetData();
21742
+ }
21474
21743
  }
21475
21744
  onChange == null || onChange(newValue);
21476
- }, [onChange, resetData]);
21745
+ }, [onChange, resetData, options]);
21477
21746
 
21478
21747
  // Handle onChange for multi select - detect clear and call resetData
21479
21748
  const handleMultiSelectChange = (0, _react.useCallback)(newValue => {
21749
+ // Mark as interacted if value changed from initial
21750
+ const initialValue = initialTempValueRef.current;
21751
+ 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;
21752
+ if (hasChanged) {
21753
+ hasInteractedRef.current = true;
21754
+ }
21480
21755
  // If value is cleared (becomes empty array or undefined), call resetData
21481
21756
  if (newValue === undefined || newValue === null || Array.isArray(newValue) && newValue.length === 0) {
21482
- resetData == null || resetData();
21757
+ if (resetData) {
21758
+ // Store current options before calling resetData to detect when they update
21759
+ prevOptionsBeforeResetRef.current = options;
21760
+ setIsResettingData(true);
21761
+ resetDataCalledRef.current = true;
21762
+ resetDataCalledTimeRef.current = Date.now();
21763
+ resetData();
21764
+ }
21483
21765
  }
21484
21766
  setTempValue(newValue);
21485
- }, [resetData]);
21767
+ }, [resetData, options]);
21486
21768
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21487
21769
  className: className,
21488
21770
  children: [renderHeader, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.TreeSelect, _extends({
@@ -21515,7 +21797,7 @@ const CapUnifiedSelect = _ref4 => {
21515
21797
  popupMatchSelectWidth: false,
21516
21798
  disabled: disabled,
21517
21799
  filterTreeNode: false,
21518
- listHeight: 256,
21800
+ listHeight: _constants.DEFAULTS.LIST_HEIGHT,
21519
21801
  listItemHeight: virtualRowHeight,
21520
21802
  popupRender: renderCustomDropdown
21521
21803
  }, rest)), isError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -23246,7 +23528,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(1601);
23246
23528
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
23247
23529
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
23248
23530
  // Module
23249
- ___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}`, ""]);
23531
+ ___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}`, ""]);
23250
23532
  // Exports
23251
23533
  ___CSS_LOADER_EXPORT___.locals = {
23252
23534
  "cap-unified-select-header-wrapper": `blaze-ui-cap-unified-select-header-wrapper`,
@@ -23286,6 +23568,7 @@ ___CSS_LOADER_EXPORT___.locals = {
23286
23568
  "cap-unified-select-loading-overlay": `blaze-ui-cap-unified-select-loading-overlay`,
23287
23569
  "cap-unified-select-option-with-suffix": `blaze-ui-cap-unified-select-option-with-suffix`,
23288
23570
  "cap-unified-select-option-label": `blaze-ui-cap-unified-select-option-label`,
23571
+ "cap-unified-select-option-end": `blaze-ui-cap-unified-select-option-end`,
23289
23572
  "cap-unified-select-option-suffix": `blaze-ui-cap-unified-select-option-suffix`,
23290
23573
  "cap-tooltip-with-info": `blaze-ui-cap-tooltip-with-info`,
23291
23574
  "cap-icon": `blaze-ui-cap-icon`
@@ -23293,6 +23576,73 @@ ___CSS_LOADER_EXPORT___.locals = {
23293
23576
  module.exports = ___CSS_LOADER_EXPORT___;
23294
23577
 
23295
23578
 
23579
+ /***/ }),
23580
+
23581
+ /***/ 9788:
23582
+ /***/ ((__unused_webpack_module, exports) => {
23583
+
23584
+ "use strict";
23585
+
23586
+
23587
+ exports.__esModule = true;
23588
+ exports.TIMEOUTS = exports.SELECT_TYPES = exports.DEFAULTS = void 0;
23589
+ /**
23590
+ * Select type constants for CapUnifiedSelect component
23591
+ */
23592
+ const SELECT_TYPES = exports.SELECT_TYPES = {
23593
+ SELECT: 'select',
23594
+ MULTI_SELECT: 'multiSelect',
23595
+ TREE_SELECT: 'treeSelect',
23596
+ MULTI_TREE_SELECT: 'multiTreeSelect'
23597
+ };
23598
+ /**
23599
+ * Timeout constants (in milliseconds)
23600
+ */
23601
+ const TIMEOUTS = exports.TIMEOUTS = {
23602
+ /** Default search debounce timeout */
23603
+ DEFAULT_SEARCH_DEBOUNCE: 300,
23604
+ /** Delay for state updates after search */
23605
+ SEARCH_STATE_UPDATE_DELAY: 100,
23606
+ /** Minimum time since search was cleared to consider data ready */
23607
+ SEARCH_CLEARED_TIMEOUT: 200,
23608
+ /** Buffer time added to debounce for cleared search */
23609
+ SEARCH_CLEARED_BUFFER: 300,
23610
+ /** Buffer time added to debounce for regular search */
23611
+ SEARCH_REGULAR_BUFFER: 500,
23612
+ /** Brief delay to show loading indicator for static search */
23613
+ STATIC_SEARCH_DELAY: 150,
23614
+ /** Timeout for resetData fallback (1 second) */
23615
+ RESET_DATA_TIMEOUT: 1000,
23616
+ /** Minimum time since resetData was called to consider data ready */
23617
+ RESET_DATA_MIN_TIME: 300,
23618
+ /** Maximum time since resetData was called to consider data ready */
23619
+ RESET_DATA_MAX_TIME: 2000,
23620
+ /** Fallback timeout for scroll loading (10 seconds) */
23621
+ SCROLL_LOADING_TIMEOUT: 10000,
23622
+ /** Delay before setting up scroll container listener */
23623
+ SCROLL_CONTAINER_DELAY: 100
23624
+ };
23625
+
23626
+ /**
23627
+ * Default values for component props
23628
+ */
23629
+ const DEFAULTS = exports.DEFAULTS = {
23630
+ /** Default placeholder text */
23631
+ PLACEHOLDER: 'Select an option',
23632
+ /** Default upload button label */
23633
+ UPLOAD_LABEL: 'Upload',
23634
+ /** Default clear button text */
23635
+ CLEAR_TEXT: 'Clear',
23636
+ /** Default no results message */
23637
+ NO_RESULT_TEXT: 'No results found',
23638
+ /** Default no results icon */
23639
+ NO_RESULT_ICON: 'warning',
23640
+ /** Default virtual row height in pixels */
23641
+ VIRTUAL_ROW_HEIGHT: 32,
23642
+ /** Default list height in pixels */
23643
+ LIST_HEIGHT: 256
23644
+ };
23645
+
23296
23646
  /***/ }),
23297
23647
 
23298
23648
  /***/ 9819: