@capillarytech/blaze-ui 1.0.3-alpha.12 → 1.0.3-alpha.14

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
@@ -695,6 +695,102 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
695
695
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default()) && (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) ? (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) : undefined);
696
696
 
697
697
 
698
+ /***/ }),
699
+
700
+ /***/ 455:
701
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
702
+
703
+ "use strict";
704
+
705
+
706
+ exports.__esModule = true;
707
+ exports.SelectAllCheckbox = exports.NoResult = void 0;
708
+ var _antdV = __webpack_require__(4273);
709
+ var _classnames = _interopRequireDefault(__webpack_require__(6942));
710
+ var _react = _interopRequireDefault(__webpack_require__(9206));
711
+ var _CapIcon = _interopRequireDefault(__webpack_require__(8244));
712
+ var _CapLabel = _interopRequireDefault(__webpack_require__(3737));
713
+ var _CapRow = _interopRequireDefault(__webpack_require__(7375));
714
+ var _constants = __webpack_require__(9788);
715
+ var _styles = _interopRequireDefault(__webpack_require__(8263));
716
+ var _jsxRuntime = __webpack_require__(4848);
717
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
718
+ const NoResult = _ref => {
719
+ let {
720
+ noResultCustomText,
721
+ className,
722
+ showUpload,
723
+ options,
724
+ noResultCustomIcon
725
+ } = _ref;
726
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
727
+ className: (0, _classnames.default)(className, _styles.default['cap-unified-select-no-result']),
728
+ align: "middle",
729
+ gap: 8,
730
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
731
+ type: noResultCustomIcon,
732
+ size: "m"
733
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
734
+ className: _styles.default['cap-unified-select-no-result-text'],
735
+ children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : _constants.DEFAULTS.NO_RESULT_TEXT
736
+ })]
737
+ });
738
+ };
739
+
740
+ /**
741
+ * SelectAllCheckbox component for selecting/deselecting all available options
742
+ * Only shown for multi-select with static data
743
+ */
744
+ exports.NoResult = NoResult;
745
+ const SelectAllCheckbox = _ref2 => {
746
+ let {
747
+ currentItems,
748
+ tempValue,
749
+ setTempValue,
750
+ processTreeData,
751
+ disabled = false
752
+ } = _ref2;
753
+ const {
754
+ leafValues = []
755
+ } = processTreeData ? processTreeData(currentItems) : {};
756
+ const totalAvailable = leafValues.length;
757
+ const leafSet = new Set(leafValues);
758
+ const selectedInScope = Array.isArray(tempValue) ? tempValue.filter(v => leafSet.has(v)).length : 0;
759
+ const allChecked = totalAvailable > 0 && selectedInScope === totalAvailable;
760
+ const indeterminate = selectedInScope > 0 && selectedInScope < totalAvailable;
761
+ const handleChange = e => {
762
+ if (disabled) {
763
+ return;
764
+ }
765
+ if (e.target.checked) {
766
+ const merged = new Set(Array.isArray(tempValue) ? tempValue : []);
767
+ leafValues.forEach(v => merged.add(v));
768
+ setTempValue(Array.from(merged));
769
+ } else {
770
+ const toRemove = new Set(leafValues);
771
+ const next = (Array.isArray(tempValue) ? tempValue : []).filter(v => !toRemove.has(v));
772
+ setTempValue(next);
773
+ }
774
+ };
775
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
776
+ className: _styles.default['cap-unified-select-select-all-container'],
777
+ align: "middle",
778
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Checkbox, {
779
+ className: _styles.default['cap-unified-select-select-all-checkbox'],
780
+ checked: allChecked,
781
+ indeterminate: indeterminate,
782
+ onChange: handleChange,
783
+ disabled: disabled,
784
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
785
+ type: "label14",
786
+ className: _styles.default['cap-unified-select-select-all-label'],
787
+ children: "Select all"
788
+ })
789
+ })
790
+ });
791
+ };
792
+ exports.SelectAllCheckbox = SelectAllCheckbox;
793
+
698
794
  /***/ }),
699
795
 
700
796
  /***/ 540:
@@ -20394,146 +20490,17 @@ var _CapRow = _interopRequireDefault(__webpack_require__(7375));
20394
20490
  var _CapSpin = _interopRequireDefault(__webpack_require__(1549));
20395
20491
  var _CapTooltip = _interopRequireDefault(__webpack_require__(5636));
20396
20492
  var _CapTooltipWithInfo = _interopRequireDefault(__webpack_require__(2608));
20493
+ var _components = __webpack_require__(455);
20397
20494
  var _constants = __webpack_require__(9788);
20398
20495
  var _styles = _interopRequireDefault(__webpack_require__(8263));
20496
+ var _utils = __webpack_require__(8052);
20399
20497
  var _jsxRuntime = __webpack_require__(4848);
20400
20498
  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", "hasMore", "enableVirtualization", "virtualRowHeight", "resetSearch", "resetData", "fetchMissingOptions"];
20401
20499
  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); }
20402
20500
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20501
+ 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); }
20403
20502
  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; }
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 */
20405
- const NoResult = _ref => {
20406
- let {
20407
- noResultCustomText,
20408
- className,
20409
- showUpload,
20410
- options,
20411
- noResultCustomIcon
20412
- } = _ref;
20413
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
20414
- className: (0, _classnames.default)(className, _styles.default['cap-unified-select-no-result']),
20415
- align: "middle",
20416
- gap: 8,
20417
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
20418
- type: noResultCustomIcon,
20419
- size: "m"
20420
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
20421
- className: _styles.default['cap-unified-select-no-result-text'],
20422
- children: showUpload && (options == null ? void 0 : options.length) === 0 ? noResultCustomText : _constants.DEFAULTS.NO_RESULT_TEXT
20423
- })]
20424
- });
20425
- };
20426
- const SelectAllCheckbox = _ref2 => {
20427
- let {
20428
- currentItems,
20429
- tempValue,
20430
- setTempValue,
20431
- processTreeData
20432
- } = _ref2;
20433
- const {
20434
- leafValues = []
20435
- } = processTreeData ? processTreeData(currentItems) : {};
20436
- const totalAvailable = leafValues.length;
20437
- const leafSet = new Set(leafValues);
20438
- const selectedInScope = Array.isArray(tempValue) ? tempValue.filter(v => leafSet.has(v)).length : 0;
20439
- const allChecked = totalAvailable > 0 && selectedInScope === totalAvailable;
20440
- const indeterminate = selectedInScope > 0 && selectedInScope < totalAvailable;
20441
- const handleChange = e => {
20442
- if (e.target.checked) {
20443
- const merged = new Set(Array.isArray(tempValue) ? tempValue : []);
20444
- leafValues.forEach(v => merged.add(v));
20445
- setTempValue(Array.from(merged));
20446
- } else {
20447
- const toRemove = new Set(leafValues);
20448
- const next = (Array.isArray(tempValue) ? tempValue : []).filter(v => !toRemove.has(v));
20449
- setTempValue(next);
20450
- }
20451
- };
20452
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
20453
- className: _styles.default['cap-unified-select-select-all-container'],
20454
- align: "middle",
20455
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Checkbox, {
20456
- className: _styles.default['cap-unified-select-select-all-checkbox'],
20457
- checked: allChecked,
20458
- indeterminate: indeterminate,
20459
- onChange: handleChange,
20460
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
20461
- type: "label14",
20462
- className: _styles.default['cap-unified-select-select-all-label'],
20463
- children: "Select all"
20464
- })
20465
- })
20466
- });
20467
- };
20468
- const buildTreeMaps = nodes => {
20469
- const result = {
20470
- leafValues: [],
20471
- parentChildMap: {},
20472
- nodeMap: {}
20473
- };
20474
- if (!nodes) return result;
20475
- const traverse = items => {
20476
- items == null || items.forEach(item => {
20477
- if (item.value !== undefined) {
20478
- result.nodeMap[item.value] = item;
20479
- if (item != null && item.children && item.children.length > 0) {
20480
- result.parentChildMap[item.value] = item.children.map(child => child == null ? void 0 : child.value).filter(v => v !== undefined);
20481
- traverse(item.children);
20482
- } else {
20483
- result.leafValues.push(item.value);
20484
- }
20485
- }
20486
- });
20487
- };
20488
- traverse(nodes);
20489
- return result;
20490
- };
20491
- const countSelectedLeaves = (treeMaps, selectedValues) => {
20492
- var _treeMaps$leafValues;
20493
- if (!Array.isArray(selectedValues) || !(selectedValues != null && selectedValues.length)) return 0;
20494
- const expandedSet = new Set(selectedValues);
20495
- const processNode = value => {
20496
- var _treeMaps$parentChild;
20497
- const children = treeMaps == null || (_treeMaps$parentChild = treeMaps.parentChildMap) == null ? void 0 : _treeMaps$parentChild[value];
20498
- if (!children) return;
20499
- children == null || children.forEach(childValue => {
20500
- expandedSet.add(childValue);
20501
- processNode(childValue);
20502
- });
20503
- };
20504
- selectedValues == null || selectedValues.forEach(processNode);
20505
- return (treeMaps == null || (_treeMaps$leafValues = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues.reduce((count, leaf) => expandedSet.has(leaf) ? count + 1 : count, 0)) || 0;
20506
- };
20507
- const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
20508
- if (searchBasedOn === void 0) {
20509
- searchBasedOn = 'label';
20510
- }
20511
- if (!(data != null && data.length) || !search) return data;
20512
- const searchLower = search.toLowerCase();
20513
- const selectedSet = new Set(selectedValues || []);
20514
- const nodeMatchesSearch = node => {
20515
- var _node$value, _node$key, _ref3, _node$label;
20516
- const target = searchBasedOn === 'value' ? String((_node$value = node == null ? void 0 : node.value) != null ? _node$value : '') : searchBasedOn === 'key' ? String((_node$key = node == null ? void 0 : node.key) != null ? _node$key : '') : String((_ref3 = (_node$label = node == null ? void 0 : node.label) != null ? _node$label : node == null ? void 0 : node.title) != null ? _ref3 : '');
20517
- return target.toLowerCase().includes(searchLower);
20518
- };
20519
- const isNodeSelected = node => {
20520
- return node.value !== undefined && selectedSet.has(node.value);
20521
- };
20522
- const loop = items => items.reduce((acc, item) => {
20523
- var _item$children;
20524
- if (!item) return acc;
20525
- const children = item != null && (_item$children = item.children) != null && _item$children.length ? loop(item.children) : [];
20526
- // Include node if: matches search OR is selected OR has matching children
20527
- if (nodeMatchesSearch(item) || isNodeSelected(item) || children.length) {
20528
- acc.push(_extends({}, item, {
20529
- children
20530
- }));
20531
- }
20532
- return acc;
20533
- }, []);
20534
- return loop(data);
20535
- };
20536
- const CapUnifiedSelect = _ref4 => {
20503
+ const CapUnifiedSelect = _ref => {
20537
20504
  let {
20538
20505
  type = _constants.SELECT_TYPES.SELECT,
20539
20506
  options = [],
@@ -20573,134 +20540,79 @@ const CapUnifiedSelect = _ref4 => {
20573
20540
  resetSearch = true,
20574
20541
  resetData,
20575
20542
  fetchMissingOptions
20576
- } = _ref4,
20577
- rest = _objectWithoutPropertiesLoose(_ref4, _excluded);
20543
+ } = _ref,
20544
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
20578
20545
  const [searchText, setSearchText] = (0, _react.useState)('');
20579
20546
  const [tempValue, setTempValue] = (0, _react.useState)(value);
20580
20547
  const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
20581
20548
  const [isSearching, setIsSearching] = (0, _react.useState)(false);
20582
20549
  const [isLoadingOnScroll, setIsLoadingOnScroll] = (0, _react.useState)(false);
20583
20550
  const [isResettingData, setIsResettingData] = (0, _react.useState)(false);
20584
- // Store ordered options after confirm (selected items moved to top based on selection order)
20585
20551
  const [orderedOptions, setOrderedOptions] = (0, _react.useState)(null);
20586
20552
  const searchTimeoutRef = (0, _react.useRef)(null);
20587
20553
  const scrollContainerRef = (0, _react.useRef)(null);
20588
20554
  const scrollLoadingTimeoutRef = (0, _react.useRef)(null);
20589
- // Track if scroll handler is currently processing to prevent duplicate calls
20590
20555
  const isScrollProcessingRef = (0, _react.useRef)(false);
20591
- // Throttle ref for scroll events
20592
20556
  const scrollThrottleTimeoutRef = (0, _react.useRef)(null);
20593
- // Ref to track options for scroll handler (avoids recreating handleScroll)
20594
20557
  const optionsRef = (0, _react.useRef)(options);
20595
- // Cache of selected items from async results to preserve them during search
20596
20558
  const selectedItemsCacheRef = (0, _react.useRef)(new Map());
20597
- // Track the last search query to detect when options update after search
20598
20559
  const lastSearchQueryRef = (0, _react.useRef)('');
20599
- // Track when search was cleared to help clear loading state
20600
20560
  const searchClearedTimeRef = (0, _react.useRef)(null);
20601
- // Track previous options to detect when they change after a search
20602
20561
  const prevOptionsRef = (0, _react.useRef)(options);
20603
- // Track previous options before resetData is called to detect when options update
20604
20562
  const prevOptionsBeforeResetRef = (0, _react.useRef)(options);
20605
- // Track previous options count to detect when options change after scroll
20606
20563
  const prevOptionsCountRef = (0, _react.useRef)(options.length);
20607
- // Track previous options to detect when options change (even if count stays same)
20608
20564
  const prevOptionsRefForScroll = (0, _react.useRef)(options);
20609
- // Track options count when scroll was triggered (for orderedOptions update)
20610
20565
  const scrollTriggerOptionsCountRef = (0, _react.useRef)(options.length);
20611
- // Track if initial sort has been done (only sort once on initial load with selected values)
20612
20566
  const initialSortDoneRef = (0, _react.useRef)(false);
20613
- // Track if user has interacted with the dropdown during current session (selected, searched, etc.)
20614
20567
  const hasInteractedRef = (0, _react.useRef)(false);
20615
- // Track the initial tempValue when dropdown opens to detect if user made changes
20616
20568
  const initialTempValueRef = (0, _react.useRef)(value);
20617
- // Track if resetData was already called in the current session to prevent duplicate calls
20618
20569
  const resetDataCalledRef = (0, _react.useRef)(false);
20619
- // Track when resetData was called to help clear loading state
20620
20570
  const resetDataCalledTimeRef = (0, _react.useRef)(null);
20621
- // Track if fetchMissingOptions was already called to prevent duplicate calls
20622
20571
  const fetchMissingOptionsCalledRef = (0, _react.useRef)(false);
20623
- // Track the last missing values that were sent to prevent duplicate calls with same values
20624
20572
  const lastMissingValuesRef = (0, _react.useRef)('');
20625
-
20626
- // Helper function to check if a value exists in options (recursive for tree structures)
20627
- const findValueInOptions = (0, _react.useCallback)((opts, targetValue) => {
20628
- for (const opt of opts) {
20629
- if (opt.value === targetValue) {
20630
- return true;
20631
- }
20632
- if (opt.children && opt.children.length > 0) {
20633
- if (findValueInOptions(opt.children, targetValue)) {
20634
- return true;
20635
- }
20636
- }
20637
- }
20638
- return false;
20639
- }, []);
20640
-
20641
- // Helper function to find missing selected values
20642
- const findMissingValues = (0, _react.useCallback)((selectedValues, currentOptions) => {
20643
- if (!selectedValues.length || !currentOptions.length) {
20644
- return selectedValues;
20645
- }
20646
- return selectedValues.filter(val => !findValueInOptions(currentOptions, val));
20647
- }, [findValueInOptions]);
20648
-
20649
- // Check for missing options and call fetchMissingOptions if needed
20650
20573
  (0, _react.useEffect)(() => {
20651
- // Only check if fetchMissingOptions is provided
20652
20574
  if (!fetchMissingOptions) {
20653
20575
  return;
20654
20576
  }
20577
+ if (options.length === 0) {
20578
+ return;
20579
+ }
20655
20580
 
20656
- // Get current selected values
20581
+ // For API-driven data, don't fetch missing options during active search
20582
+ // Only fetch when there's no search query or search is cleared
20583
+ const hasActiveSearch = !staticValue && lastSearchQueryRef.current.trim().length > 0;
20584
+ if (hasActiveSearch) {
20585
+ return;
20586
+ }
20657
20587
  const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
20658
20588
  if (selectedValues.length === 0) {
20659
- // No selected values, reset the tracking
20660
20589
  fetchMissingOptionsCalledRef.current = false;
20661
20590
  lastMissingValuesRef.current = '';
20662
20591
  return;
20663
20592
  }
20664
-
20665
- // Find missing values
20666
- const missingValues = findMissingValues(selectedValues, options);
20667
-
20668
- // If no missing values, reset tracking and return
20593
+ const missingValues = (0, _utils.findMissingValues)(selectedValues, options);
20669
20594
  if (missingValues.length === 0) {
20670
20595
  fetchMissingOptionsCalledRef.current = false;
20671
20596
  lastMissingValuesRef.current = '';
20672
20597
  return;
20673
20598
  }
20674
-
20675
- // Create a sorted string representation of missing values for comparison
20676
- // Use slice() to avoid mutating the original array
20677
20599
  const missingValuesKey = [...missingValues].sort().join(',');
20678
-
20679
- // Only call if:
20680
- // 1. We haven't called it before, OR
20681
- // 2. The missing values have changed (different values are missing now)
20682
20600
  if (!fetchMissingOptionsCalledRef.current || lastMissingValuesRef.current !== missingValuesKey) {
20683
20601
  fetchMissingOptionsCalledRef.current = true;
20684
20602
  lastMissingValuesRef.current = missingValuesKey;
20685
- // Call the developer's function with missing values (pass a copy to avoid mutation)
20686
20603
  fetchMissingOptions([...missingValues]);
20687
20604
  }
20688
- }, [value, options, fetchMissingOptions, findMissingValues]);
20605
+ }, [value, options, fetchMissingOptions, staticValue]);
20689
20606
  (0, _react.useEffect)(() => {
20690
20607
  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;
20691
20608
  if (!isEqual) {
20692
20609
  setTempValue(value);
20693
- // Reset ordered options when value changes from outside
20694
20610
  setOrderedOptions(null);
20695
20611
  }
20696
20612
  // eslint-disable-next-line react-hooks/exhaustive-deps
20697
20613
  }, [value]);
20698
-
20699
- // Cache selected items when tempValue changes
20700
20614
  (0, _react.useEffect)(() => {
20701
20615
  const currentSelected = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
20702
-
20703
- // Store selected items in cache for persistence
20704
20616
  const findAndCacheOption = (opts, val) => {
20705
20617
  for (const opt of opts) {
20706
20618
  if (opt.value === val) {
@@ -20720,8 +20632,6 @@ const CapUnifiedSelect = _ref4 => {
20720
20632
  findAndCacheOption(options, val);
20721
20633
  }
20722
20634
  });
20723
-
20724
- // Clean up cache for unselected items
20725
20635
  const selectedSet = new Set(currentSelected);
20726
20636
  selectedItemsCacheRef.current.forEach((_, value) => {
20727
20637
  if (!selectedSet.has(value)) {
@@ -20729,15 +20639,9 @@ const CapUnifiedSelect = _ref4 => {
20729
20639
  }
20730
20640
  });
20731
20641
  }, [tempValue, options]);
20732
-
20733
- // Reset ordered options when options change, but only if it would invalidate the current ordering
20734
- // This prevents resetting when options are updated via onSearch/onScroll but selected items still exist
20735
20642
  (0, _react.useEffect)(() => {
20736
- // Only reset if we have orderedOptions and the current value's items are no longer in options
20737
20643
  if (orderedOptions) {
20738
20644
  const currentSelected = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
20739
-
20740
- // Check if all selected values still exist in the new options
20741
20645
  const checkValueExists = (opts, val) => {
20742
20646
  for (const opt of opts) {
20743
20647
  if (opt.value === val) return true;
@@ -20747,27 +20651,16 @@ const CapUnifiedSelect = _ref4 => {
20747
20651
  }
20748
20652
  return false;
20749
20653
  };
20750
-
20751
- // If any selected value is missing from new options, reset ordering
20752
20654
  const allSelectedStillExist = currentSelected.every(val => checkValueExists(options, val));
20753
20655
  if (!allSelectedStillExist) {
20754
20656
  setOrderedOptions(null);
20755
20657
  }
20756
- // Otherwise, keep the ordering even if options changed (e.g., via onSearch adding more items)
20757
- } else {
20758
- // No ordering set, nothing to reset
20759
20658
  }
20760
20659
  }, [options, orderedOptions, tempValue]);
20761
-
20762
- // Extract debounce timeout (extracted early for use in useEffects)
20763
20660
  const debounceTimeout = searchDebounce != null ? searchDebounce : _constants.TIMEOUTS.DEFAULT_SEARCH_DEBOUNCE;
20764
-
20765
- // Keep optionsRef in sync with options
20766
20661
  (0, _react.useEffect)(() => {
20767
20662
  optionsRef.current = options;
20768
20663
  }, [options]);
20769
-
20770
- // Cleanup timeouts on unmount
20771
20664
  (0, _react.useEffect)(() => {
20772
20665
  return () => {
20773
20666
  if (searchTimeoutRef.current) {
@@ -20781,35 +20674,21 @@ const CapUnifiedSelect = _ref4 => {
20781
20674
  }
20782
20675
  };
20783
20676
  }, []);
20784
-
20785
- // Detect when options update after a search to clear loading state
20786
- // This prevents showing "No results found" before data arrives
20787
20677
  (0, _react.useEffect)(() => {
20788
- // Only handle this for API-based searches (staticValue = false)
20789
- // Check if lastSearchQueryRef has been set (including empty string for cleared search)
20790
20678
  const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
20791
20679
  if (staticValue || !isSearching || !hasSearchQuery) {
20792
20680
  prevOptionsRef.current = options;
20793
20681
  return;
20794
20682
  }
20795
-
20796
- // Check if options actually changed (reference or content)
20797
20683
  const optionsChanged = prevOptionsRef.current !== options || prevOptionsRef.current.length !== options.length;
20798
-
20799
- // Also check if search was cleared (empty string) and enough time has passed
20800
- // This handles the case where clearing search reloads initial data that might be the same reference
20801
20684
  const searchCleared = lastSearchQueryRef.current === '';
20802
20685
  const timeSinceCleared = searchClearedTimeRef.current ? Date.now() - searchClearedTimeRef.current : Infinity;
20803
20686
  const hasOptionsData = options.length > 0;
20804
- // Wait at least SEARCH_CLEARED_TIMEOUT after search is cleared to allow API call to complete
20805
20687
  const clearedSearchReady = searchCleared && hasOptionsData && timeSinceCleared > _constants.TIMEOUTS.SEARCH_CLEARED_TIMEOUT;
20806
20688
  if (optionsChanged || clearedSearchReady) {
20807
- // Options updated after search - data has arrived
20808
- // Use a small delay to ensure state updates are processed
20809
20689
  const timeoutId = setTimeout(() => {
20810
20690
  setIsSearching(false);
20811
20691
  prevOptionsRef.current = options;
20812
- // Clear timestamp when search loading is cleared
20813
20692
  if (searchCleared) {
20814
20693
  searchClearedTimeRef.current = null;
20815
20694
  }
@@ -20818,91 +20697,50 @@ const CapUnifiedSelect = _ref4 => {
20818
20697
  }
20819
20698
  prevOptionsRef.current = options;
20820
20699
  }, [options, staticValue, isSearching]);
20821
-
20822
- // Fallback: Clear searching state after a reasonable timeout to prevent infinite loading
20823
- // This handles edge cases where options might not change reference but data has arrived
20824
- // Also handles error cases where options don't update after search
20825
20700
  (0, _react.useEffect)(() => {
20826
- // Check if lastSearchQueryRef has been set (including empty string for cleared search)
20827
20701
  const hasSearchQuery = lastSearchQueryRef.current !== null && lastSearchQueryRef.current !== undefined;
20828
20702
  if (!isSearching || staticValue || !hasSearchQuery) {
20829
20703
  return;
20830
20704
  }
20831
-
20832
- // For cleared search (empty string), use a shorter timeout since it should reload initial data quickly
20833
- // For regular search, use debounce timeout + buffer
20834
20705
  const searchCleared = lastSearchQueryRef.current === '';
20835
- const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER // Shorter timeout for cleared search
20836
- : debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER; // Longer timeout for regular search
20837
-
20838
- // Calculate timeout: debounce timeout + a small buffer for API response
20839
- // This ensures we wait for the API call to complete before showing "No results"
20840
- // For error cases where options don't update, this will clear loading state
20706
+ const timeoutDuration = searchCleared ? debounceTimeout + _constants.TIMEOUTS.SEARCH_CLEARED_BUFFER : debounceTimeout + _constants.TIMEOUTS.SEARCH_REGULAR_BUFFER;
20841
20707
  const fallbackTimeout = setTimeout(() => {
20842
20708
  setIsSearching(false);
20843
- searchClearedTimeRef.current = null; // Clear search cleared timestamp
20709
+ searchClearedTimeRef.current = null;
20844
20710
  }, timeoutDuration);
20845
20711
  return () => clearTimeout(fallbackTimeout);
20846
20712
  }, [isSearching, staticValue, debounceTimeout, options.length]);
20847
-
20848
- // Detect when options update after resetData is called to clear loading state
20849
20713
  (0, _react.useEffect)(() => {
20850
20714
  if (!isResettingData) {
20851
- // Update ref even when not resetting to keep it in sync
20852
20715
  prevOptionsBeforeResetRef.current = options;
20853
- // Clear timestamp when not resetting
20854
20716
  resetDataCalledTimeRef.current = null;
20855
20717
  return;
20856
20718
  }
20857
-
20858
- // Check if options actually changed (reference, length, or content)
20859
- // Compare against the options that existed before resetData was called
20860
20719
  const prevOptions = prevOptionsBeforeResetRef.current;
20861
20720
  const currentOptions = options;
20862
-
20863
- // More robust comparison: check reference, length, or any content differences
20864
- const optionsChanged = prevOptions !== currentOptions || prevOptions.length !== currentOptions.length ||
20865
- // Deep comparison: check if any option values or labels changed
20866
- prevOptions.length === currentOptions.length && prevOptions.length > 0 && prevOptions.some((prevOpt, idx) => {
20721
+ const optionsChanged = prevOptions !== currentOptions || prevOptions.length !== currentOptions.length || prevOptions.length === currentOptions.length && prevOptions.length > 0 && prevOptions.some((prevOpt, idx) => {
20867
20722
  const currentOpt = currentOptions[idx];
20868
20723
  return !currentOpt || prevOpt.value !== currentOpt.value || prevOpt.label !== currentOpt.label;
20869
20724
  });
20870
-
20871
- // Additional check: if enough time has passed since resetData was called
20872
- // and we have options data, assume data has loaded even if comparison didn't detect change
20873
20725
  const timeSinceReset = resetDataCalledTimeRef.current ? Date.now() - resetDataCalledTimeRef.current : Infinity;
20874
20726
  const hasDataAfterTimeout = currentOptions.length > 0 && timeSinceReset > _constants.TIMEOUTS.RESET_DATA_MIN_TIME && timeSinceReset < _constants.TIMEOUTS.RESET_DATA_MAX_TIME;
20875
-
20876
- // If options changed or enough time has passed with data, clear the loading state
20877
20727
  if (optionsChanged || hasDataAfterTimeout) {
20878
- // Options updated after resetData - data has arrived
20879
- // Clear immediately without delay for faster response
20880
20728
  setIsResettingData(false);
20881
20729
  prevOptionsBeforeResetRef.current = currentOptions;
20882
20730
  resetDataCalledTimeRef.current = null;
20883
20731
  }
20884
20732
  }, [options, isResettingData]);
20885
-
20886
- // Fallback: Clear resetData loading state after a reasonable timeout
20887
- // This handles edge cases where options might not change reference but data has arrived
20888
20733
  (0, _react.useEffect)(() => {
20889
20734
  if (!isResettingData) {
20890
20735
  return;
20891
20736
  }
20892
-
20893
- // Set a timeout to clear loading state if options don't update
20894
- // Reduced timeout to 1 second for faster recovery
20895
20737
  const fallbackTimeout = setTimeout(() => {
20896
20738
  setIsResettingData(false);
20897
- // Update ref to current options to prevent false positives in future comparisons
20898
20739
  prevOptionsBeforeResetRef.current = options;
20899
- // Clear timestamp
20900
20740
  resetDataCalledTimeRef.current = null;
20901
20741
  }, _constants.TIMEOUTS.RESET_DATA_TIMEOUT);
20902
20742
  return () => clearTimeout(fallbackTimeout);
20903
20743
  }, [isResettingData, options]);
20904
-
20905
- // Clear loading state when hasMore becomes false (all items exhausted)
20906
20744
  (0, _react.useEffect)(() => {
20907
20745
  if (!hasMore && isLoadingOnScroll) {
20908
20746
  setIsLoadingOnScroll(false);
@@ -20913,79 +20751,47 @@ const CapUnifiedSelect = _ref4 => {
20913
20751
  }
20914
20752
  }
20915
20753
  }, [hasMore, isLoadingOnScroll]);
20916
-
20917
- // Detect when options change after scroll to clear loading overlay
20918
20754
  (0, _react.useEffect)(() => {
20919
- // Always update refs when options change (when not loading)
20920
- // This ensures we track the current state for next scroll detection
20921
20755
  if (!isLoadingOnScroll) {
20922
20756
  prevOptionsCountRef.current = options.length;
20923
- // Store a reference to the options array for comparison
20924
- // We'll compare by length and last item to detect changes
20925
20757
  prevOptionsRefForScroll.current = options;
20926
20758
  }
20927
-
20928
- // Only check for changes if we're currently loading from scroll
20929
20759
  if (!isLoadingOnScroll || !onPopupScroll) {
20930
20760
  return;
20931
20761
  }
20932
-
20933
- // Check if options count increased (new data loaded via append)
20934
20762
  const optionsCountIncreased = options.length > prevOptionsCountRef.current;
20935
-
20936
- // Check if options content changed (even if count is same - replacement scenario)
20937
- // Compare the last option to detect if new data was appended
20938
20763
  const optionsContentChanged = (() => {
20939
20764
  const prevCount = prevOptionsCountRef.current;
20940
20765
  const currentCount = options.length;
20941
-
20942
- // If count changed, definitely content changed
20943
20766
  if (prevCount !== currentCount) {
20944
20767
  return true;
20945
20768
  }
20946
-
20947
- // If count is same, check if last option changed (indicates new data appended/replaced)
20948
20769
  if (currentCount > 0 && prevCount > 0 && prevOptionsRefForScroll.current.length > 0) {
20949
20770
  const prevOptions = prevOptionsRefForScroll.current;
20950
20771
  const lastPrevOption = prevOptions[prevOptions.length - 1];
20951
20772
  const lastCurrentOption = options[options.length - 1];
20952
-
20953
- // If last option is different, content changed
20954
20773
  if ((lastPrevOption == null ? void 0 : lastPrevOption.value) !== (lastCurrentOption == null ? void 0 : lastCurrentOption.value) || (lastPrevOption == null ? void 0 : lastPrevOption.label) !== (lastCurrentOption == null ? void 0 : lastCurrentOption.label)) {
20955
20774
  return true;
20956
20775
  }
20957
20776
  }
20958
20777
  return false;
20959
20778
  })();
20960
-
20961
- // Clear loading if options changed (either count increased or content changed)
20962
- // This handles both append (count increase) and replace (content change) scenarios
20963
20779
  if (optionsCountIncreased || optionsContentChanged) {
20964
- // Options updated after scroll - data has arrived, clear loading overlay
20965
20780
  setIsLoadingOnScroll(false);
20966
- // Reset processing flag to allow next scroll event
20967
20781
  isScrollProcessingRef.current = false;
20968
20782
  if (scrollLoadingTimeoutRef.current) {
20969
20783
  clearTimeout(scrollLoadingTimeoutRef.current);
20970
20784
  scrollLoadingTimeoutRef.current = null;
20971
20785
  }
20972
-
20973
- // Update refs to track the new state after options change
20974
- // This is critical for detecting subsequent scroll loads
20975
20786
  prevOptionsCountRef.current = options.length;
20976
20787
  prevOptionsRefForScroll.current = options;
20977
20788
  }
20978
20789
  }, [options, isLoadingOnScroll, onPopupScroll]);
20979
-
20980
- // Handle search with debouncing
20981
20790
  const handleSearch = (0, _react.useCallback)(query => {
20982
- // Clear existing timeout
20983
20791
  if (searchTimeoutRef.current) {
20984
20792
  clearTimeout(searchTimeoutRef.current);
20985
20793
  }
20986
20794
  const trimmedQuery = query.trim();
20987
-
20988
- // Track when search is cleared (empty string after having a query)
20989
20795
  const wasSearching = lastSearchQueryRef.current !== '';
20990
20796
  const isNowCleared = trimmedQuery === '';
20991
20797
  if (wasSearching && isNowCleared) {
@@ -20993,36 +20799,19 @@ const CapUnifiedSelect = _ref4 => {
20993
20799
  } else if (!isNowCleared) {
20994
20800
  searchClearedTimeRef.current = null;
20995
20801
  }
20996
-
20997
- // Track the search query to detect when options update
20998
20802
  lastSearchQueryRef.current = trimmedQuery;
20999
-
21000
- // Mark as interacted if user typed something (even if they clear it later)
21001
20803
  if (trimmedQuery.length > 0 || lastSearchQueryRef.current.length > 0) {
21002
20804
  hasInteractedRef.current = true;
21003
20805
  }
21004
-
21005
- // For API-based searches (staticValue = false), always call onSearch
21006
- // This allows the developer to reload all initial data when search is cleared
21007
20806
  if (!staticValue && onSearch) {
21008
- // Set loading state for both empty and non-empty queries
21009
20807
  setIsSearching(true);
21010
-
21011
- // Debounce the search callback
21012
20808
  searchTimeoutRef.current = setTimeout(() => {
21013
- // Send the search input (empty string when cleared, or the actual query)
21014
20809
  onSearch(trimmedQuery);
21015
- // For API-based searches, keep isSearching true until options update
21016
- // This prevents showing "No results found" before data arrives
21017
20810
  }, debounceTimeout);
21018
20811
  } else if (!trimmedQuery) {
21019
- // For static searches, if query is empty, just reset the state
21020
20812
  setIsSearching(false);
21021
20813
  } else {
21022
- // For static searches with content, show brief loading indicator
21023
- // Set loading state briefly to show user feedback
21024
20814
  setIsSearching(true);
21025
- // Clear loading state after a short delay (filtering is instant but we show feedback)
21026
20815
  searchTimeoutRef.current = setTimeout(() => {
21027
20816
  setIsSearching(false);
21028
20817
  }, _constants.TIMEOUTS.STATIC_SEARCH_DELAY);
@@ -21030,222 +20819,78 @@ const CapUnifiedSelect = _ref4 => {
21030
20819
  }, [onSearch, staticValue, debounceTimeout]);
21031
20820
  const isMulti = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.MULTI_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
21032
20821
  const isTree = (0, _react.useMemo)(() => type === _constants.SELECT_TYPES.TREE_SELECT || type === _constants.SELECT_TYPES.MULTI_TREE_SELECT, [type]);
21033
-
21034
- // Use options directly since pagination is handled by the developer
21035
20822
  const mergedOptions = (0, _react.useMemo)(() => {
21036
20823
  return options;
21037
20824
  }, [options]);
21038
-
21039
- // Helper function to reorder options based on selection order
21040
- // Selected items are moved to top in the order they were selected
21041
- // For tree structures, maintains parent-child relationships
21042
- // For flat lists, directly reorders items
21043
- // Works for all data types: flat lists, tree structures, nested trees
21044
- const reorderOptionsBySelection = (0, _react.useCallback)((opts, selectedOrder) => {
21045
- if (!Array.isArray(selectedOrder) || selectedOrder.length === 0 || !(opts != null && opts.length)) {
21046
- return opts;
21047
- }
21048
- const selectedSet = new Set(selectedOrder);
21049
- const selectedItems = [];
21050
- const unselectedItems = [];
21051
- const processedTopLevelValues = new Set();
21052
-
21053
- // Deep clone helper to avoid mutating original items
21054
- const deepCloneItem = item => {
21055
- return _extends({}, item, {
21056
- children: item.children ? item.children.map(deepCloneItem) : undefined
21057
- });
21058
- };
21059
-
21060
- // Find the top-level item that contains the selected value
21061
- // For flat lists, returns the item itself
21062
- // For tree structures, returns the top-level parent from opts
21063
- const findTopLevelItem = targetValue => {
21064
- // First, find which top-level item in opts contains this value
21065
- for (const topLevelItem of opts) {
21066
- // Check if this top-level item itself matches
21067
- if (topLevelItem.value === targetValue) {
21068
- return topLevelItem;
21069
- }
21070
-
21071
- // Recursively search in children
21072
- const searchInChildren = items => {
21073
- for (const item of items) {
21074
- if (item.value === targetValue) {
21075
- return true; // Found it
21076
- }
21077
- if (item.children && item.children.length > 0) {
21078
- if (searchInChildren(item.children)) {
21079
- return true;
21080
- }
21081
- }
21082
- }
21083
- return false;
21084
- };
21085
-
21086
- // If found in this top-level item's children, return the top-level item
21087
- if (topLevelItem.children && topLevelItem.children.length > 0) {
21088
- if (searchInChildren(topLevelItem.children)) {
21089
- return topLevelItem;
21090
- }
21091
- }
21092
- }
21093
- return null;
21094
- };
21095
-
21096
- // Check if an item or any of its descendants is selected
21097
- const hasSelectedDescendant = item => {
21098
- if (item.value !== undefined && selectedSet.has(item.value)) {
21099
- return true;
21100
- }
21101
- if (item.children && item.children.length > 0) {
21102
- return item.children.some(child => hasSelectedDescendant(child));
21103
- }
21104
- return false;
21105
- };
21106
-
21107
- // Collect selected items in selection order
21108
- selectedOrder.forEach(selectedVal => {
21109
- const topLevelItem = findTopLevelItem(selectedVal);
21110
- if (topLevelItem && topLevelItem.value !== undefined && !processedTopLevelValues.has(topLevelItem.value)) {
21111
- // Clone the item to avoid mutating the original
21112
- const clonedItem = deepCloneItem(topLevelItem);
21113
- selectedItems.push(clonedItem);
21114
- processedTopLevelValues.add(topLevelItem.value);
21115
- }
21116
- });
21117
-
21118
- // Collect unselected items maintaining original order
21119
- // For tree structures, only include top-level items that don't have any selected descendants
21120
- opts.forEach(item => {
21121
- if (item.value === undefined) {
21122
- // Item without value, include as-is
21123
- unselectedItems.push(deepCloneItem(item));
21124
- } else if (!processedTopLevelValues.has(item.value)) {
21125
- // Check if this item or any of its descendants is selected
21126
- if (!hasSelectedDescendant(item)) {
21127
- unselectedItems.push(deepCloneItem(item));
21128
- }
21129
- }
21130
- });
21131
-
21132
- // Return selected items first (in selection order), then unselected items
21133
- return [...selectedItems, ...unselectedItems];
21134
- }, []);
21135
-
21136
- // Track previous options count before fetchMissingOptions to detect when missing options are added
21137
20825
  const prevOptionsCountBeforeFetchMissingRef = (0, _react.useRef)(options.length);
21138
- // Track previous options before fetchMissingOptions to detect when missing options are added
21139
20826
  const prevOptionsBeforeFetchMissingRef = (0, _react.useRef)(options);
21140
-
21141
- // Update orderedOptions when new options are appended via scroll (when items are selected)
21142
- // This ensures new data appears even when items are selected
21143
20827
  (0, _react.useEffect)(() => {
21144
- // Only update if we have orderedOptions (items are selected), onPopupScroll is provided,
21145
- // and options increased from when scroll was triggered
21146
20828
  if (!orderedOptions || !onPopupScroll) {
21147
20829
  return;
21148
20830
  }
21149
20831
  const currentOptions = options;
21150
- // Compare against the count when scroll was triggered, not the current ref value
21151
- // This ensures we detect increases even if refs were updated in other useEffects
21152
20832
  const optionsCountIncreased = currentOptions.length > scrollTriggerOptionsCountRef.current;
21153
-
21154
- // Only update if options increased from scroll trigger time
21155
- // This prevents updating on other option changes (like search)
21156
20833
  if (optionsCountIncreased && scrollTriggerOptionsCountRef.current > 0) {
21157
20834
  const selectedValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
21158
20835
  if (selectedValues.length > 0) {
21159
- // Reorder the full options list (which now includes new options) to maintain selection order
21160
- // This will put selected items at top and append new unselected items at bottom
21161
- const reordered = reorderOptionsBySelection(currentOptions, selectedValues);
20836
+ const reordered = (0, _utils.reorderOptionsBySelection)(currentOptions, selectedValues);
21162
20837
  setOrderedOptions(reordered);
21163
- // Update the scroll trigger count for next scroll detection
21164
20838
  scrollTriggerOptionsCountRef.current = currentOptions.length;
21165
20839
  }
21166
20840
  }
21167
- }, [options, orderedOptions, onPopupScroll, tempValue, reorderOptionsBySelection]);
21168
-
21169
- // Update orderedOptions when new options are added via fetchMissingOptions (for paginated API-driven data)
21170
- // This handles the case when user selects items from paginated pages and confirms
21171
- // The fetchMissingOptions callback fetches the missing selected items, and we need to reorder them to top
21172
- // Also handles search cases and upload cases where selected items might not be in current options
20841
+ }, [options, orderedOptions, onPopupScroll, tempValue]);
21173
20842
  (0, _react.useEffect)(() => {
21174
- // Only handle if fetchMissingOptions is provided (indicates API-driven pagination)
21175
20843
  if (!fetchMissingOptions) {
21176
- // Update refs even when fetchMissingOptions is not provided
21177
20844
  prevOptionsCountBeforeFetchMissingRef.current = options.length;
21178
20845
  prevOptionsBeforeFetchMissingRef.current = options;
21179
20846
  return;
21180
20847
  }
20848
+
20849
+ // For API-driven data, don't reorder options during active search
20850
+ // Only reorder when there's no search query or search is cleared
20851
+ const hasActiveSearch = !staticValue && lastSearchQueryRef.current.trim().length > 0;
20852
+ if (hasActiveSearch) {
20853
+ return;
20854
+ }
21181
20855
  const currentOptions = options;
21182
20856
  const currentSelectedValues = Array.isArray(value) ? value : value ? [value] : [];
21183
20857
  const tempSelectedValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
21184
- // Use tempValue if available (during selection), otherwise use value (after confirm)
21185
20858
  const selectedValues = tempSelectedValues.length > 0 ? tempSelectedValues : currentSelectedValues;
21186
20859
  if (selectedValues.length === 0) {
21187
- // No selected values, update refs and return
21188
20860
  prevOptionsCountBeforeFetchMissingRef.current = currentOptions.length;
21189
20861
  prevOptionsBeforeFetchMissingRef.current = currentOptions;
21190
20862
  return;
21191
20863
  }
21192
-
21193
- // Check if options changed (count or content) after fetchMissingOptions was called
21194
20864
  const prevOptions = prevOptionsBeforeFetchMissingRef.current;
21195
20865
  const optionsCountIncreased = currentOptions.length > prevOptionsCountBeforeFetchMissingRef.current;
21196
20866
  const optionsChanged = prevOptions !== currentOptions || optionsCountIncreased;
21197
-
21198
- // Check if any previously missing selected values now exist in options
21199
- // This handles both cases: when fetchMissingOptions was called, and when options update for any reason
21200
20867
  const hasNewlyFetchedSelectedItems = (() => {
21201
20868
  if (selectedValues.length === 0 || !optionsChanged) {
21202
20869
  return false;
21203
20870
  }
21204
-
21205
- // Find which selected values were missing in previous options
21206
- const previouslyMissingValues = selectedValues.filter(val => !findValueInOptions(prevOptions, val));
20871
+ const previouslyMissingValues = selectedValues.filter(val => !(0, _utils.findValueInOptions)(prevOptions, val));
21207
20872
  if (previouslyMissingValues.length === 0) {
21208
20873
  return false;
21209
20874
  }
21210
-
21211
- // Check if any of those previously missing values now exist in current options
21212
- const nowPresentValues = previouslyMissingValues.filter(val => findValueInOptions(currentOptions, val));
20875
+ const nowPresentValues = previouslyMissingValues.filter(val => (0, _utils.findValueInOptions)(currentOptions, val));
21213
20876
  return nowPresentValues.length > 0;
21214
20877
  })();
21215
-
21216
- // Update orderedOptions if:
21217
- // 1. Options changed (increased or content changed) AND
21218
- // 2. Previously missing selected items are now present in options
21219
- // This works for both cases: when fetchMissingOptions was explicitly called, and when options update for other reasons
21220
20878
  if (optionsChanged && hasNewlyFetchedSelectedItems) {
21221
- // Reorder the full options list to put selected items at top
21222
- const reordered = reorderOptionsBySelection(currentOptions, selectedValues);
20879
+ const reordered = (0, _utils.reorderOptionsBySelection)(currentOptions, selectedValues);
21223
20880
  setOrderedOptions(reordered);
21224
20881
  }
21225
-
21226
- // Always update the previous options and count for next comparison
21227
- // This ensures we can detect when missing options are added in the future
21228
20882
  prevOptionsCountBeforeFetchMissingRef.current = currentOptions.length;
21229
20883
  prevOptionsBeforeFetchMissingRef.current = currentOptions;
21230
- }, [options, value, tempValue, fetchMissingOptions, reorderOptionsBySelection, findValueInOptions]);
21231
-
21232
- // Sort selected items to top on initial load (only once)
21233
- // This handles the case when user comes from another flow with pre-selected values
20884
+ }, [options, value, tempValue, fetchMissingOptions, staticValue]);
21234
20885
  (0, _react.useEffect)(() => {
21235
- // Only do this once, and only if we have options and selected values
21236
20886
  if (initialSortDoneRef.current || !(options != null && options.length)) {
21237
20887
  return;
21238
20888
  }
21239
-
21240
- // Check if there are selected values
21241
20889
  const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
21242
20890
  if (selectedValues.length === 0) {
21243
- // No selected values, mark as done
21244
20891
  initialSortDoneRef.current = true;
21245
20892
  return;
21246
20893
  }
21247
-
21248
- // Check if any selected values exist in options
21249
20894
  const checkValueExists = (opts, val) => {
21250
20895
  for (const opt of opts) {
21251
20896
  if (opt.value === val) return true;
@@ -21257,40 +20902,27 @@ const CapUnifiedSelect = _ref4 => {
21257
20902
  };
21258
20903
  const hasSelectedInOptions = selectedValues.some(val => checkValueExists(options, val));
21259
20904
  if (hasSelectedInOptions) {
21260
- // Reorder options to move selected items to top
21261
- const reordered = reorderOptionsBySelection(options, selectedValues);
20905
+ const reordered = (0, _utils.reorderOptionsBySelection)(options, selectedValues);
21262
20906
  setOrderedOptions(reordered);
21263
20907
  }
21264
-
21265
- // Mark as done - only sort once on initial load
21266
20908
  initialSortDoneRef.current = true;
21267
- }, [options, value, reorderOptionsBySelection]);
20909
+ }, [options, value]);
21268
20910
  const dataSource = (0, _react.useMemo)(() => {
21269
- // During search, use normal options (mergedOptions) to show filtered results without selected items at top
21270
- // When not searching, use ordered options if available (selected items at top), otherwise use merged options
21271
20911
  const sourceOptions = searchText.trim() ? mergedOptions : orderedOptions || mergedOptions;
21272
-
21273
- // Get current selected values to check for missing ones
21274
- // Use value prop (external state) instead of tempValue (internal state)
21275
- // This ensures we only create virtual options for values that are actually selected
21276
- // and not just temporarily selected during dropdown interaction
21277
20912
  const selectedValues = Array.isArray(value) ? value : value ? [value] : [];
21278
20913
  const hasSearchQuery = searchText.trim().length > 0;
21279
20914
 
21280
- // Find selected values that don't exist in the current options
21281
- // Only include missing values when not searching (so they're always visible)
21282
- // or when searching but they should still be shown
20915
+ // For API-driven data, don't append virtual options during search
20916
+ // Only show search results when searching
20917
+ const shouldAppendVirtualOptions = staticValue || !hasSearchQuery;
21283
20918
  const missingSelectedValues = [];
21284
- if (selectedValues.length > 0) {
20919
+ if (shouldAppendVirtualOptions && selectedValues.length > 0) {
21285
20920
  selectedValues.forEach(val => {
21286
- if (!findValueInOptions(sourceOptions, val)) {
20921
+ if (!(0, _utils.findValueInOptions)(sourceOptions, val)) {
21287
20922
  missingSelectedValues.push(val);
21288
20923
  }
21289
20924
  });
21290
20925
  }
21291
-
21292
- // Create virtual option nodes for missing selected values
21293
- // Use cached option data if available, otherwise create a simple node with value as label
21294
20926
  const virtualOptions = missingSelectedValues.map(val => {
21295
20927
  const cachedOption = selectedItemsCacheRef.current.get(val);
21296
20928
  return _extends({
@@ -21306,10 +20938,6 @@ const CapUnifiedSelect = _ref4 => {
21306
20938
  children: cachedOption.children
21307
20939
  });
21308
20940
  });
21309
-
21310
- // Combine source options with virtual options for missing selected values
21311
- // When not searching, add virtual options at the beginning so selected items appear first
21312
- // When searching, still include them if they match the search (handled by filterTreeData)
21313
20941
  const allOptions = hasSearchQuery ? [...sourceOptions, ...virtualOptions] : [...virtualOptions, ...sourceOptions];
21314
20942
  if (!(allOptions != null && allOptions.length)) return [];
21315
20943
  const enhanceOptions = opts => opts.map(opt => {
@@ -21366,20 +20994,13 @@ const CapUnifiedSelect = _ref4 => {
21366
20994
  }),
21367
20995
  label: opt == null ? void 0 : opt.label
21368
20996
  }));
21369
- }, [isTree, mergedOptions, orderedOptions, searchText, value, findValueInOptions]);
20997
+ }, [isTree, mergedOptions, orderedOptions, searchText, value, staticValue]);
21370
20998
  const filteredTree = (0, _react.useMemo)(() => {
21371
20999
  const selectedValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
21372
-
21373
- // If staticValue is true, use local filtering on existing options
21374
- // If staticValue is false, still use local filtering for immediate feedback,
21375
- // but onSearch callback will be triggered for parent to update options
21376
- // Always include selectedValues to ensure uploaded/selected items are visible
21377
- // This ensures that when dev uploads values, they remain visible in the dropdown
21378
- // even if they're not in the options array yet
21379
- return filterTreeData(dataSource, searchText.trim(), searchBasedOn, selectedValues.length > 0 ? selectedValues : undefined);
21000
+ return (0, _utils.filterTreeData)(dataSource, searchText.trim(), searchBasedOn, selectedValues.length > 0 ? selectedValues : undefined);
21380
21001
  }, [dataSource, searchText, searchBasedOn, tempValue]);
21381
- const treeMaps = (0, _react.useMemo)(() => buildTreeMaps(options), [options]);
21382
- const selectedLeafCount = (0, _react.useMemo)(() => countSelectedLeaves(treeMaps, Array.isArray(tempValue) ? tempValue : undefined), [treeMaps, tempValue]);
21002
+ const treeMaps = (0, _react.useMemo)(() => (0, _utils.buildTreeMaps)(options), [options]);
21003
+ const selectedLeafCount = (0, _react.useMemo)(() => (0, _utils.countSelectedLeaves)(treeMaps, Array.isArray(tempValue) ? tempValue : undefined), [treeMaps, tempValue]);
21383
21004
  const displayValue = dropdownOpen ? tempValue : value;
21384
21005
  const suffix = (0, _react.useMemo)(() => {
21385
21006
  const count = Array.isArray(displayValue) ? displayValue == null ? void 0 : displayValue.length : displayValue ? 1 : 0;
@@ -21414,27 +21035,22 @@ const CapUnifiedSelect = _ref4 => {
21414
21035
  if (isMulti && Array.isArray(displayValue) && (displayValue == null ? void 0 : displayValue.length) > 0) {
21415
21036
  var _treeMaps$nodeMap;
21416
21037
  const firstLeafValue = displayValue.find(val => {
21417
- var _treeMaps$leafValues2;
21418
- return treeMaps == null || (_treeMaps$leafValues2 = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues2.includes(val);
21038
+ var _treeMaps$leafValues;
21039
+ return treeMaps == null || (_treeMaps$leafValues = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues.includes(val);
21419
21040
  });
21420
21041
  return firstLeafValue ? (treeMaps == null || (_treeMaps$nodeMap = treeMaps.nodeMap) == null || (_treeMaps$nodeMap = _treeMaps$nodeMap[firstLeafValue]) == null ? void 0 : _treeMaps$nodeMap.label) || null : null;
21421
21042
  }
21422
21043
  return null;
21423
21044
  }, [isMulti, displayValue, treeMaps]);
21424
21045
  const handleConfirm = (0, _react.useCallback)(() => {
21425
- // Mark as interacted since user clicked confirm (explicit action)
21426
21046
  hasInteractedRef.current = true;
21427
-
21428
- // Reorder options based on selection order when confirm is clicked
21429
- // Use mergedOptions to include paginated options if they exist
21430
21047
  const optionsToReorder = mergedOptions;
21431
21048
  if (isMulti && Array.isArray(tempValue) && tempValue.length > 0) {
21432
- // Reorder the options (includes paginated if they exist)
21433
- const reordered = reorderOptionsBySelection(optionsToReorder, tempValue);
21049
+ const reordered = (0, _utils.reorderOptionsBySelection)(optionsToReorder, tempValue);
21434
21050
  setOrderedOptions(reordered);
21435
21051
  } else if (!isMulti && tempValue && !Array.isArray(tempValue)) {
21436
21052
  // For single select, move selected item to top
21437
- const reordered = reorderOptionsBySelection(optionsToReorder, [tempValue]);
21053
+ const reordered = (0, _utils.reorderOptionsBySelection)(optionsToReorder, [tempValue]);
21438
21054
  setOrderedOptions(reordered);
21439
21055
  } else {
21440
21056
  // No selection, reset to original order
@@ -21442,18 +21058,13 @@ const CapUnifiedSelect = _ref4 => {
21442
21058
  }
21443
21059
  onChange == null || onChange(tempValue);
21444
21060
  setDropdownOpen(false);
21445
- // Always clear searching state since search operation is complete
21446
21061
  setIsSearching(false);
21447
- searchClearedTimeRef.current = null; // Clear search cleared timestamp
21448
- // Clear search text on confirm only if resetSearch is true
21449
- // This allows users to keep their search when reopening the dropdown if desired
21062
+ searchClearedTimeRef.current = null;
21450
21063
  if (resetSearch) {
21451
21064
  setSearchText('');
21452
- lastSearchQueryRef.current = ''; // Clear search query ref
21065
+ lastSearchQueryRef.current = '';
21453
21066
  }
21454
- // Call resetData to allow developer to reload initial data
21455
- if (resetData) {
21456
- // Store current options before calling resetData to detect when they update
21067
+ if (resetData && mergedOptions.length > 0) {
21457
21068
  prevOptionsBeforeResetRef.current = mergedOptions;
21458
21069
  setIsResettingData(true);
21459
21070
  resetDataCalledRef.current = true;
@@ -21461,17 +21072,14 @@ const CapUnifiedSelect = _ref4 => {
21461
21072
  resetData();
21462
21073
  }
21463
21074
  onConfirm == null || onConfirm(tempValue);
21464
- }, [onChange, onConfirm, tempValue, resetSearch, isMulti, mergedOptions, reorderOptionsBySelection, resetData]);
21075
+ }, [onChange, onConfirm, tempValue, resetSearch, isMulti, mergedOptions, resetData]);
21465
21076
  const handleClearAll = (0, _react.useCallback)(() => {
21466
- // Mark as interacted since user clicked clear (explicit action)
21467
21077
  hasInteractedRef.current = true;
21468
21078
  const cleared = isMulti ? [] : undefined;
21469
21079
  setTempValue(cleared);
21470
21080
  onChange == null || onChange(cleared);
21471
21081
  setDropdownOpen(false);
21472
- // Call resetData to allow developer to reload initial data
21473
- if (resetData) {
21474
- // Store current options before calling resetData to detect when they update
21082
+ if (resetData && options.length > 0) {
21475
21083
  prevOptionsBeforeResetRef.current = options;
21476
21084
  setIsResettingData(true);
21477
21085
  resetDataCalledRef.current = true;
@@ -21480,25 +21088,19 @@ const CapUnifiedSelect = _ref4 => {
21480
21088
  }
21481
21089
  }, [isMulti, onChange, resetData, options]);
21482
21090
  const handleDropdownVisibilityChange = (0, _react.useCallback)(open => {
21483
- if (readOnly) {
21091
+ if (readOnly || disabled) {
21484
21092
  return;
21485
21093
  }
21486
21094
  if (open) {
21487
- // Reset interaction tracking when dropdown opens
21488
- // Store initial value (not tempValue) to detect if user makes changes
21489
- // This ensures we track changes from the actual selected value, not temporary state
21490
21095
  initialTempValueRef.current = value;
21491
21096
  hasInteractedRef.current = false;
21492
21097
  resetDataCalledRef.current = false;
21493
- // Reset fetchMissingOptions tracking to allow re-checking when dropdown opens
21494
21098
  fetchMissingOptionsCalledRef.current = false;
21495
21099
  lastMissingValuesRef.current = '';
21496
- // Clear any pending search timeouts
21497
21100
  if (searchTimeoutRef.current) {
21498
21101
  clearTimeout(searchTimeoutRef.current);
21499
21102
  searchTimeoutRef.current = null;
21500
21103
  }
21501
- // Clear any pending scroll loading timeouts
21502
21104
  if (scrollLoadingTimeoutRef.current) {
21503
21105
  clearTimeout(scrollLoadingTimeoutRef.current);
21504
21106
  scrollLoadingTimeoutRef.current = null;
@@ -21507,35 +21109,27 @@ const CapUnifiedSelect = _ref4 => {
21507
21109
  clearTimeout(scrollThrottleTimeoutRef.current);
21508
21110
  scrollThrottleTimeoutRef.current = null;
21509
21111
  }
21510
- // Reset loading states
21511
21112
  setIsSearching(false);
21512
- searchClearedTimeRef.current = null; // Clear search cleared timestamp
21113
+ searchClearedTimeRef.current = null;
21513
21114
  setIsLoadingOnScroll(false);
21514
21115
  isScrollProcessingRef.current = false;
21515
- // Safety check: Clear isResettingData if it's still true when opening
21516
- // This handles cases where options updated while dropdown was closed
21517
21116
  if (isResettingData) {
21518
21117
  setIsResettingData(false);
21519
- // Update ref to current options to prevent false positives
21520
21118
  prevOptionsBeforeResetRef.current = options;
21521
- // Clear timestamp
21522
21119
  resetDataCalledTimeRef.current = null;
21523
21120
  }
21524
21121
  } else {
21525
- // Dropdown is closing
21526
21122
  if (!customPopupRender) {
21527
21123
  onChange == null || onChange(tempValue);
21528
21124
  } else {
21529
21125
  setTempValue(value);
21530
21126
  }
21531
- // Clear search when closing (if enabled)
21532
21127
  if (resetSearch) {
21533
21128
  setSearchText('');
21534
21129
  setIsSearching(false);
21535
- lastSearchQueryRef.current = ''; // Clear search query ref
21536
- searchClearedTimeRef.current = null; // Clear search cleared timestamp
21130
+ lastSearchQueryRef.current = '';
21131
+ searchClearedTimeRef.current = null;
21537
21132
  }
21538
- // Reset scroll loading state
21539
21133
  setIsLoadingOnScroll(false);
21540
21134
  isScrollProcessingRef.current = false;
21541
21135
  if (scrollLoadingTimeoutRef.current) {
@@ -21547,35 +21141,25 @@ const CapUnifiedSelect = _ref4 => {
21547
21141
  scrollThrottleTimeoutRef.current = null;
21548
21142
  }
21549
21143
  scrollContainerRef.current = null;
21550
-
21551
- // Only call resetData if user actually interacted (selected, searched, etc.)
21552
- // and resetData hasn't been called already in this session
21553
- // This prevents multiple API calls when user just opens/closes without interaction
21554
- if (resetData && hasInteractedRef.current && !resetDataCalledRef.current) {
21555
- // Store current options before calling resetData to detect when they update
21144
+ if (resetData && hasInteractedRef.current && !resetDataCalledRef.current && options.length > 0) {
21556
21145
  prevOptionsBeforeResetRef.current = options;
21557
21146
  setIsResettingData(true);
21558
21147
  resetDataCalledRef.current = true;
21559
21148
  resetDataCalledTimeRef.current = Date.now();
21560
21149
  resetData();
21561
21150
  } else if (!hasInteractedRef.current) {
21562
- // User did nothing - reset everything as if it's a fresh load
21563
- // Clear any pending operations
21564
21151
  if (searchTimeoutRef.current) {
21565
21152
  clearTimeout(searchTimeoutRef.current);
21566
21153
  searchTimeoutRef.current = null;
21567
21154
  }
21568
21155
  setIsSearching(false);
21569
21156
  setIsResettingData(false);
21570
- // Reset search query ref
21571
21157
  lastSearchQueryRef.current = '';
21572
21158
  }
21573
-
21574
- // Reset interaction flag for next session
21575
21159
  hasInteractedRef.current = false;
21576
21160
  }
21577
21161
  setDropdownOpen(open);
21578
- }, [customPopupRender, value, onChange, tempValue, readOnly, resetSearch, resetData, options, isResettingData]);
21162
+ }, [customPopupRender, value, onChange, tempValue, readOnly, disabled, resetSearch, resetData, options, isResettingData]);
21579
21163
  const handleFooterDownload = (0, _react.useCallback)(() => {
21580
21164
  const currentValues = Array.isArray(tempValue) ? tempValue : tempValue ? [tempValue] : [];
21581
21165
  onFooterDownloadChange == null || onFooterDownloadChange(currentValues);
@@ -21587,151 +21171,80 @@ const CapUnifiedSelect = _ref4 => {
21587
21171
  const handleSearchChange = (0, _react.useCallback)(e => {
21588
21172
  const query = e.target.value;
21589
21173
  setSearchText(query);
21590
-
21591
- // Trigger search handler (handles debouncing and minLength check)
21592
21174
  handleSearch(query);
21593
21175
  }, [handleSearch]);
21594
21176
  const handleSearchKeyDown = (0, _react.useCallback)(e => {
21595
- // Stop propagation of backspace and delete keys to prevent TreeSelect from deselecting items
21596
- // The input itself will handle the deletion, we just need to prevent TreeSelect from handling it
21597
21177
  if (e.key === 'Backspace' || e.key === 'Delete') {
21598
21178
  e.stopPropagation();
21599
21179
  }
21600
- // Also stop Escape key to prevent dropdown from closing when clearing search
21601
21180
  if (e.key === 'Escape' && searchText.length > 0) {
21602
21181
  e.stopPropagation();
21603
21182
  }
21604
21183
  }, [searchText]);
21605
-
21606
- // Handle scroll event - automatically checks if scroll is near bottom
21607
- // Developer handles hasMore and isLoading conditions in onPopupScroll callback
21608
- // Using refs to avoid recreating the callback when options change
21609
21184
  const handleScroll = (0, _react.useCallback)(event => {
21610
21185
  if (!onPopupScroll) return;
21611
21186
  const target = event.target;
21612
21187
  if (!target) return;
21613
-
21614
- // Check if scroll is near bottom
21615
21188
  const isNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
21616
-
21617
- // Only call onPopupScroll if scroll is near bottom
21618
- // Developer will handle hasMore and isLoading checks inside the callback
21619
21189
  if (!isNearBottom) {
21620
- // Reset processing flag when not near bottom
21621
21190
  isScrollProcessingRef.current = false;
21622
21191
  return;
21623
21192
  }
21624
-
21625
- // Prevent multiple scroll triggers while already processing
21626
- // This ensures we don't trigger multiple API calls simultaneously
21627
21193
  if (isScrollProcessingRef.current) return;
21628
-
21629
- // Prevent multiple scroll triggers while already loading
21630
- // This ensures loading state is managed properly and data loading completes
21631
21194
  if (isLoadingOnScroll) return;
21632
-
21633
- // Don't trigger if there are no more items to load
21634
- // This prevents showing loading state when all items are exhausted
21635
21195
  if (!hasMore) {
21636
21196
  isScrollProcessingRef.current = false;
21637
21197
  return;
21638
21198
  }
21639
-
21640
- // Throttle scroll events to prevent rapid-fire API calls
21641
- // Clear any existing throttle timeout
21642
21199
  if (scrollThrottleTimeoutRef.current) {
21643
21200
  clearTimeout(scrollThrottleTimeoutRef.current);
21644
21201
  }
21645
-
21646
- // Set processing flag immediately to prevent duplicate calls
21647
21202
  isScrollProcessingRef.current = true;
21648
-
21649
- // Throttle the actual API call to prevent multiple rapid triggers
21650
21203
  scrollThrottleTimeoutRef.current = setTimeout(() => {
21651
- // Double-check we're still near bottom and not loading
21652
21204
  const stillNearBottom = Math.floor(target.scrollHeight - target.scrollTop) <= target.clientHeight;
21653
- // Also check if hasMore is still true (might have changed during throttle delay)
21654
21205
  if (!stillNearBottom || isLoadingOnScroll || !hasMore) {
21655
21206
  isScrollProcessingRef.current = false;
21656
21207
  return;
21657
21208
  }
21658
-
21659
- // Store current options count and options reference before triggering load
21660
- // This helps detect when new data arrives
21661
- // Use ref to get current options without depending on options.length
21662
21209
  const currentOptions = optionsRef.current;
21663
21210
  prevOptionsCountRef.current = currentOptions.length;
21664
21211
  prevOptionsRefForScroll.current = currentOptions;
21665
- // Also store the count at scroll trigger time for orderedOptions update
21666
21212
  scrollTriggerOptionsCountRef.current = currentOptions.length;
21667
-
21668
- // Show loading indicator when scrolling near bottom
21669
- // This happens before calling onPopupScroll to provide immediate feedback
21670
21213
  setIsLoadingOnScroll(true);
21671
-
21672
- // Clear any existing timeout
21673
21214
  if (scrollLoadingTimeoutRef.current) {
21674
21215
  clearTimeout(scrollLoadingTimeoutRef.current);
21675
21216
  scrollLoadingTimeoutRef.current = null;
21676
21217
  }
21677
-
21678
- // Mark as interacted when user scrolls (triggers data loading)
21679
21218
  hasInteractedRef.current = true;
21680
-
21681
- // Call the developer's scroll handler - component already checked scroll position
21682
- // Developer should check hasMore and isLoading inside the callback
21683
- // This triggers the async data loading
21684
21219
  onPopupScroll();
21685
-
21686
- // Set a fallback timeout to clear loading if options don't change
21687
- // This prevents loading from staying forever if data never arrives
21688
- // Using a longer timeout (10 seconds) to give enough time for slow API calls
21689
21220
  scrollLoadingTimeoutRef.current = setTimeout(() => {
21690
- // Only clear if still loading (options change detection might have cleared it already)
21691
21221
  setIsLoadingOnScroll(prev => {
21692
21222
  if (prev) {
21693
- // Clear the timeout reference when clearing loading state
21694
21223
  scrollLoadingTimeoutRef.current = null;
21695
- // Reset processing flag when loading times out
21696
21224
  isScrollProcessingRef.current = false;
21697
21225
  return false;
21698
21226
  }
21699
21227
  return prev;
21700
21228
  });
21701
21229
  }, _constants.TIMEOUTS.SCROLL_LOADING_TIMEOUT);
21702
- }, 150); // 150ms throttle to prevent rapid-fire events
21230
+ }, 150);
21703
21231
  }, [onPopupScroll, isLoadingOnScroll, hasMore]);
21704
-
21705
- // Setup scroll listener for onPopupScroll
21706
21232
  (0, _react.useEffect)(() => {
21707
21233
  if (!onPopupScroll || !dropdownOpen) return;
21708
-
21709
- // Use a small delay to ensure DOM is ready
21710
21234
  const timeoutId = setTimeout(() => {
21711
- // Find the scrollable container in the dropdown
21712
21235
  const findScrollContainer = () => {
21713
- // Try to find the Ant Design dropdown scroll container
21714
- // Look for dropdowns that are currently visible (not hidden)
21715
21236
  const dropdowns = document.querySelectorAll('.ant-select-dropdown:not(.ant-select-dropdown-hidden)');
21716
21237
  if (dropdowns.length === 0) return null;
21717
-
21718
- // Get the last opened dropdown (most recent)
21719
21238
  const dropdown = Array.from(dropdowns).pop();
21720
21239
  if (!dropdown) return null;
21721
-
21722
- // Look for the scrollable list container
21723
21240
  const treeList = dropdown.querySelector('.ant-select-tree-list-holder');
21724
21241
  if (treeList && treeList.scrollHeight > treeList.clientHeight) {
21725
21242
  return treeList;
21726
21243
  }
21727
-
21728
- // Try alternative selectors
21729
21244
  const virtualList = dropdown.querySelector('.rc-virtual-list-holder');
21730
21245
  if (virtualList && virtualList.scrollHeight > virtualList.clientHeight) {
21731
21246
  return virtualList;
21732
21247
  }
21733
-
21734
- // Fallback to dropdown itself if it's scrollable
21735
21248
  if (dropdown.scrollHeight > dropdown.clientHeight) {
21736
21249
  return dropdown;
21737
21250
  }
@@ -21747,7 +21260,6 @@ const CapUnifiedSelect = _ref4 => {
21747
21260
  }, _constants.TIMEOUTS.SCROLL_CONTAINER_DELAY);
21748
21261
  return () => {
21749
21262
  clearTimeout(timeoutId);
21750
- // Clear throttle timeout when cleaning up
21751
21263
  if (scrollThrottleTimeoutRef.current) {
21752
21264
  clearTimeout(scrollThrottleTimeoutRef.current);
21753
21265
  scrollThrottleTimeoutRef.current = null;
@@ -21756,7 +21268,6 @@ const CapUnifiedSelect = _ref4 => {
21756
21268
  scrollContainerRef.current.removeEventListener('scroll', handleScroll);
21757
21269
  scrollContainerRef.current = null;
21758
21270
  }
21759
- // Reset processing flag when listener is removed
21760
21271
  isScrollProcessingRef.current = false;
21761
21272
  };
21762
21273
  }, [onPopupScroll, dropdownOpen, handleScroll]);
@@ -21804,9 +21315,10 @@ const CapUnifiedSelect = _ref4 => {
21804
21315
  value: searchText,
21805
21316
  onChange: handleSearchChange,
21806
21317
  onKeyDown: handleSearchKeyDown,
21807
- allowClear: true
21318
+ allowClear: true,
21319
+ disabled: disabled
21808
21320
  })
21809
- }), isMulti && showUpload && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21321
+ }), isMulti && showUpload && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21810
21322
  className: _styles.default['cap-unified-select-upload-container'],
21811
21323
  align: "middle",
21812
21324
  onClick: handleUpload,
@@ -21819,11 +21331,12 @@ const CapUnifiedSelect = _ref4 => {
21819
21331
  className: _styles.default['cap-unified-select-upload-label'],
21820
21332
  children: uploadLabel
21821
21333
  })]
21822
- }), isMulti && staticValue && currentItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(SelectAllCheckbox, {
21334
+ }), isMulti && staticValue && currentItems.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectAllCheckbox, {
21823
21335
  currentItems: currentItems,
21824
21336
  tempValue: Array.isArray(tempValue) ? tempValue : undefined,
21825
21337
  setTempValue: val => setTempValue(val),
21826
- processTreeData: buildTreeMaps
21338
+ processTreeData: _utils.buildTreeMaps,
21339
+ disabled: disabled
21827
21340
  }), currentItems.length === 0 ? isSearching || isResettingData ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
21828
21341
  className: _styles.default['cap-unified-select-loading-container'],
21829
21342
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
@@ -21840,7 +21353,7 @@ const CapUnifiedSelect = _ref4 => {
21840
21353
  children: "Loading..."
21841
21354
  })
21842
21355
  })]
21843
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoResult, {
21356
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.NoResult, {
21844
21357
  noResultCustomText: noResultCustomText,
21845
21358
  className: className,
21846
21359
  showUpload: showUpload,
@@ -21890,15 +21403,16 @@ const CapUnifiedSelect = _ref4 => {
21890
21403
  size: "small",
21891
21404
  className: _styles.default['cap-unified-select-confirm-button'],
21892
21405
  onClick: handleConfirm,
21893
- disabled: selectedLeafCount === 0,
21406
+ disabled: disabled || selectedLeafCount === 0,
21894
21407
  children: "Confirm"
21895
21408
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Button, {
21896
21409
  type: "text",
21897
21410
  className: _styles.default['cap-unified-select-cancel-button'],
21898
21411
  size: "small",
21899
21412
  onClick: handleClearAll,
21413
+ disabled: disabled,
21900
21414
  children: clearText
21901
- }), onFooterDownloadChange && selectedLeafCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21415
+ }), onFooterDownloadChange && selectedLeafCount > 0 && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21902
21416
  className: _styles.default['cap-unified-select-footer-download-container'],
21903
21417
  align: "middle",
21904
21418
  onClick: handleFooterDownload,
@@ -21912,7 +21426,7 @@ const CapUnifiedSelect = _ref4 => {
21912
21426
  })]
21913
21427
  })]
21914
21428
  })
21915
- }), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21429
+ }), (type === _constants.SELECT_TYPES.SELECT || type === _constants.SELECT_TYPES.TREE_SELECT) && allowClear && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
21916
21430
  className: _styles.default['cap-unified-select-tree-clear-container'],
21917
21431
  onClick: handleClearAll,
21918
21432
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
@@ -21921,22 +21435,19 @@ const CapUnifiedSelect = _ref4 => {
21921
21435
  })
21922
21436
  })]
21923
21437
  });
21924
- }, [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, hasMore, isResettingData]);
21438
+ }, [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, hasMore, isResettingData, disabled]);
21925
21439
  const combinedClassName = (0, _react.useMemo)(() => (0, _classnames.default)(containerClassName, _styles.default['cap-unified-tree-select'], {
21926
21440
  [_styles.default['cap-unified-tree-select-readonly']]: readOnly
21927
21441
  }, className), [containerClassName, className, readOnly]);
21928
-
21929
- // Handle onChange for single select - detect clear button click and call resetData
21930
21442
  const handleSingleSelectChange = (0, _react.useCallback)(newValue => {
21931
- // Mark as interacted if value changed from initial
21443
+ if (disabled) {
21444
+ return;
21445
+ }
21932
21446
  if (newValue !== initialTempValueRef.current) {
21933
21447
  hasInteractedRef.current = true;
21934
21448
  }
21935
-
21936
- // If value is cleared (becomes undefined), call resetData
21937
21449
  if (newValue === undefined || newValue === null) {
21938
- if (resetData) {
21939
- // Store current options before calling resetData to detect when they update
21450
+ if (resetData && options.length > 0) {
21940
21451
  prevOptionsBeforeResetRef.current = options;
21941
21452
  setIsResettingData(true);
21942
21453
  resetDataCalledRef.current = true;
@@ -21945,20 +21456,18 @@ const CapUnifiedSelect = _ref4 => {
21945
21456
  }
21946
21457
  }
21947
21458
  onChange == null || onChange(newValue);
21948
- }, [onChange, resetData, options]);
21949
-
21950
- // Handle onChange for multi select - detect clear and call resetData
21459
+ }, [onChange, resetData, options, disabled]);
21951
21460
  const handleMultiSelectChange = (0, _react.useCallback)(newValue => {
21952
- // Mark as interacted if value changed from initial
21461
+ if (disabled) {
21462
+ return;
21463
+ }
21953
21464
  const initialValue = initialTempValueRef.current;
21954
21465
  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;
21955
21466
  if (hasChanged) {
21956
21467
  hasInteractedRef.current = true;
21957
21468
  }
21958
- // If value is cleared (becomes empty array or undefined), call resetData
21959
21469
  if (newValue === undefined || newValue === null || Array.isArray(newValue) && newValue.length === 0) {
21960
- if (resetData) {
21961
- // Store current options before calling resetData to detect when they update
21470
+ if (resetData && options.length > 0) {
21962
21471
  prevOptionsBeforeResetRef.current = options;
21963
21472
  setIsResettingData(true);
21964
21473
  resetDataCalledRef.current = true;
@@ -21967,7 +21476,7 @@ const CapUnifiedSelect = _ref4 => {
21967
21476
  }
21968
21477
  }
21969
21478
  setTempValue(newValue);
21970
- }, [resetData, options]);
21479
+ }, [resetData, options, disabled]);
21971
21480
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
21972
21481
  className: className,
21973
21482
  children: [renderHeader, /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.TreeSelect, _extends({
@@ -23435,6 +22944,233 @@ module.exports = domAPI;
23435
22944
 
23436
22945
  /***/ }),
23437
22946
 
22947
+ /***/ 8052:
22948
+ /***/ ((__unused_webpack_module, exports) => {
22949
+
22950
+ "use strict";
22951
+
22952
+
22953
+ exports.__esModule = true;
22954
+ exports.reorderOptionsBySelection = exports.findValueInOptions = exports.findMissingValues = exports.filterTreeData = exports.countSelectedLeaves = exports.buildTreeMaps = void 0;
22955
+ 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); }
22956
+ /**
22957
+ * Builds tree maps for efficient tree operations
22958
+ * Creates maps for leaf values, parent-child relationships, and node lookups
22959
+ */
22960
+ const buildTreeMaps = nodes => {
22961
+ const result = {
22962
+ leafValues: [],
22963
+ parentChildMap: {},
22964
+ nodeMap: {}
22965
+ };
22966
+ if (!nodes) return result;
22967
+ const traverse = items => {
22968
+ items == null || items.forEach(item => {
22969
+ if (item.value !== undefined) {
22970
+ result.nodeMap[item.value] = item;
22971
+ if (item != null && item.children && item.children.length > 0) {
22972
+ result.parentChildMap[item.value] = item.children.map(child => child == null ? void 0 : child.value).filter(v => v !== undefined);
22973
+ traverse(item.children);
22974
+ } else {
22975
+ result.leafValues.push(item.value);
22976
+ }
22977
+ }
22978
+ });
22979
+ };
22980
+ traverse(nodes);
22981
+ return result;
22982
+ };
22983
+
22984
+ /**
22985
+ * Counts the number of selected leaf nodes in a tree structure
22986
+ * Handles parent-child relationships by expanding selected parent nodes
22987
+ */
22988
+ exports.buildTreeMaps = buildTreeMaps;
22989
+ const countSelectedLeaves = (treeMaps, selectedValues) => {
22990
+ var _treeMaps$leafValues;
22991
+ if (!Array.isArray(selectedValues) || !(selectedValues != null && selectedValues.length)) return 0;
22992
+ const expandedSet = new Set(selectedValues);
22993
+ const processNode = value => {
22994
+ var _treeMaps$parentChild;
22995
+ const children = treeMaps == null || (_treeMaps$parentChild = treeMaps.parentChildMap) == null ? void 0 : _treeMaps$parentChild[value];
22996
+ if (!children) return;
22997
+ children == null || children.forEach(childValue => {
22998
+ expandedSet.add(childValue);
22999
+ processNode(childValue);
23000
+ });
23001
+ };
23002
+ selectedValues == null || selectedValues.forEach(processNode);
23003
+ return (treeMaps == null || (_treeMaps$leafValues = treeMaps.leafValues) == null ? void 0 : _treeMaps$leafValues.reduce((count, leaf) => expandedSet.has(leaf) ? count + 1 : count, 0)) || 0;
23004
+ };
23005
+
23006
+ /**
23007
+ * Filters tree data based on search query
23008
+ * Includes nodes that match search OR are selected OR have matching children
23009
+ * Supports searching by label, value, or key
23010
+ */
23011
+ exports.countSelectedLeaves = countSelectedLeaves;
23012
+ const filterTreeData = function (data, search, searchBasedOn, selectedValues) {
23013
+ if (searchBasedOn === void 0) {
23014
+ searchBasedOn = 'label';
23015
+ }
23016
+ if (!(data != null && data.length) || !search) return data;
23017
+ const searchLower = search.toLowerCase();
23018
+ const selectedSet = new Set(selectedValues || []);
23019
+ const nodeMatchesSearch = node => {
23020
+ var _node$value, _node$key, _ref, _node$label;
23021
+ const target = searchBasedOn === 'value' ? String((_node$value = node == null ? void 0 : node.value) != null ? _node$value : '') : searchBasedOn === 'key' ? String((_node$key = node == null ? void 0 : node.key) != null ? _node$key : '') : String((_ref = (_node$label = node == null ? void 0 : node.label) != null ? _node$label : node == null ? void 0 : node.title) != null ? _ref : '');
23022
+ return target.toLowerCase().includes(searchLower);
23023
+ };
23024
+ const isNodeSelected = node => {
23025
+ return node.value !== undefined && selectedSet.has(node.value);
23026
+ };
23027
+ const loop = items => items.reduce((acc, item) => {
23028
+ var _item$children;
23029
+ if (!item) return acc;
23030
+ const children = item != null && (_item$children = item.children) != null && _item$children.length ? loop(item.children) : [];
23031
+ // Include node if: matches search OR is selected OR has matching children
23032
+ if (nodeMatchesSearch(item) || isNodeSelected(item) || children.length) {
23033
+ acc.push(_extends({}, item, {
23034
+ children
23035
+ }));
23036
+ }
23037
+ return acc;
23038
+ }, []);
23039
+ return loop(data);
23040
+ };
23041
+
23042
+ /**
23043
+ * Checks if a value exists in options (recursive for tree structures)
23044
+ */
23045
+ exports.filterTreeData = filterTreeData;
23046
+ const findValueInOptions = (opts, targetValue) => {
23047
+ for (const opt of opts) {
23048
+ if (opt.value === targetValue) {
23049
+ return true;
23050
+ }
23051
+ if (opt.children && opt.children.length > 0) {
23052
+ if (findValueInOptions(opt.children, targetValue)) {
23053
+ return true;
23054
+ }
23055
+ }
23056
+ }
23057
+ return false;
23058
+ };
23059
+
23060
+ /**
23061
+ * Finds selected values that don't exist in the current options
23062
+ */
23063
+ exports.findValueInOptions = findValueInOptions;
23064
+ const findMissingValues = (selectedValues, currentOptions) => {
23065
+ if (!selectedValues.length || !currentOptions.length) {
23066
+ return selectedValues;
23067
+ }
23068
+ return selectedValues.filter(val => !findValueInOptions(currentOptions, val));
23069
+ };
23070
+
23071
+ /**
23072
+ * Reorders options based on selection order
23073
+ * Selected items are moved to top in the order they were selected
23074
+ * For tree structures, maintains parent-child relationships
23075
+ * For flat lists, directly reorders items
23076
+ * Works for all data types: flat lists, tree structures, nested trees
23077
+ */
23078
+ exports.findMissingValues = findMissingValues;
23079
+ const reorderOptionsBySelection = (opts, selectedOrder) => {
23080
+ if (!Array.isArray(selectedOrder) || selectedOrder.length === 0 || !(opts != null && opts.length)) {
23081
+ return opts;
23082
+ }
23083
+ const selectedSet = new Set(selectedOrder);
23084
+ const selectedItems = [];
23085
+ const unselectedItems = [];
23086
+ const processedTopLevelValues = new Set();
23087
+
23088
+ // Deep clone helper to avoid mutating original items
23089
+ const deepCloneItem = item => {
23090
+ return _extends({}, item, {
23091
+ children: item.children ? item.children.map(deepCloneItem) : undefined
23092
+ });
23093
+ };
23094
+
23095
+ // Find the top-level item that contains the selected value
23096
+ // For flat lists, returns the item itself
23097
+ // For tree structures, returns the top-level parent from opts
23098
+ const findTopLevelItem = targetValue => {
23099
+ // First, find which top-level item in opts contains this value
23100
+ for (const topLevelItem of opts) {
23101
+ // Check if this top-level item itself matches
23102
+ if (topLevelItem.value === targetValue) {
23103
+ return topLevelItem;
23104
+ }
23105
+
23106
+ // Recursively search in children
23107
+ const searchInChildren = items => {
23108
+ for (const item of items) {
23109
+ if (item.value === targetValue) {
23110
+ return true; // Found it
23111
+ }
23112
+ if (item.children && item.children.length > 0) {
23113
+ if (searchInChildren(item.children)) {
23114
+ return true;
23115
+ }
23116
+ }
23117
+ }
23118
+ return false;
23119
+ };
23120
+
23121
+ // If found in this top-level item's children, return the top-level item
23122
+ if (topLevelItem.children && topLevelItem.children.length > 0) {
23123
+ if (searchInChildren(topLevelItem.children)) {
23124
+ return topLevelItem;
23125
+ }
23126
+ }
23127
+ }
23128
+ return null;
23129
+ };
23130
+
23131
+ // Check if an item or any of its descendants is selected
23132
+ const hasSelectedDescendant = item => {
23133
+ if (item.value !== undefined && selectedSet.has(item.value)) {
23134
+ return true;
23135
+ }
23136
+ if (item.children && item.children.length > 0) {
23137
+ return item.children.some(child => hasSelectedDescendant(child));
23138
+ }
23139
+ return false;
23140
+ };
23141
+
23142
+ // Collect selected items in selection order
23143
+ selectedOrder.forEach(selectedVal => {
23144
+ const topLevelItem = findTopLevelItem(selectedVal);
23145
+ if (topLevelItem && topLevelItem.value !== undefined && !processedTopLevelValues.has(topLevelItem.value)) {
23146
+ // Clone the item to avoid mutating the original
23147
+ const clonedItem = deepCloneItem(topLevelItem);
23148
+ selectedItems.push(clonedItem);
23149
+ processedTopLevelValues.add(topLevelItem.value);
23150
+ }
23151
+ });
23152
+
23153
+ // Collect unselected items maintaining original order
23154
+ // For tree structures, only include top-level items that don't have any selected descendants
23155
+ opts.forEach(item => {
23156
+ if (item.value === undefined) {
23157
+ // Item without value, include as-is
23158
+ unselectedItems.push(deepCloneItem(item));
23159
+ } else if (!processedTopLevelValues.has(item.value)) {
23160
+ // Check if this item or any of its descendants is selected
23161
+ if (!hasSelectedDescendant(item)) {
23162
+ unselectedItems.push(deepCloneItem(item));
23163
+ }
23164
+ }
23165
+ });
23166
+
23167
+ // Return selected items first (in selection order), then unselected items
23168
+ return [...selectedItems, ...unselectedItems];
23169
+ };
23170
+ exports.reorderOptionsBySelection = reorderOptionsBySelection;
23171
+
23172
+ /***/ }),
23173
+
23438
23174
  /***/ 8244:
23439
23175
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
23440
23176
 
@@ -23731,7 +23467,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(1601);
23731
23467
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
23732
23468
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
23733
23469
  // Module
23734
- ___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;gap:.857rem;flex-wrap:nowrap}.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;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;line-height:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-label{color:#2466ea;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:.857rem;line-height:1.143rem;letter-spacing:0;white-space:nowrap;display:inline-flex;align-items:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;color:#97a0af;font-size:1rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result .blaze-ui-cap-unified-select-no-result-text{font-weight:500}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;width:100%;gap:.571rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-more{display:flex;align-items:center;justify-content:center;padding:.857rem;border-top:.071rem solid #ebecf0;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-menu-wrapper{position:relative;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.8);z-index:10;gap:.571rem;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix{display:flex;justify-content:start;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle;flex:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{display:flex;align-items:center;flex-shrink:1;min-width:0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-end{display:flex;align-items:center;gap:.571rem;flex-shrink:0;margin-left:auto}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-suffix{display:flex;align-items:center;padding:0 .571rem;max-height:1.429rem;white-space:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon{margin-top:.357rem;color:#42526e}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon .blaze-ui-cap-icon{color:#42526e}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu{margin-top:0 !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu .ant-select-dropdown-menu-item{padding:.571rem 1.714rem !important;height:unset !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu-item-disabled{color:rgba(0,0,0,.25) !important;cursor:not-allowed !important;line-height:1.428rem !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0);height:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper:hover{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode{height:2.857rem;margin-bottom:0;display:flex;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode:hover{background-color:#fffbe6}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-selected{background-color:#f4f5f7 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled{cursor:not-allowed !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-unified-select-option-label{color:#b3bac5}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-icon{color:#b3bac5 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected{background-color:#f4f5f7}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-leaf .ant-select-tree-switcher-noop{display:none}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox{display:flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox .ant-select-tree-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem;display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner:hover{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{border-radius:0;padding-left:.214rem;width:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-title{width:100%;display:flex}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-indent{margin-left:.857rem;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher{display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher:not(.ant-select-tree-switcher-noop):hover:before{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher .ant-select-tree-switcher-icon{font-size:.857rem;margin-top:1.286rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-list-holder-inner{width:fit-content !important;min-width:100%}.blaze-ui-cap-unified-select-popup .ant-tree-select:hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-popup .ant-tree-select-focused .ant-select-selector,.blaze-ui-cap-unified-select-popup .ant-tree-select-open .ant-select-selector{border-color:#7a869a;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem}.blaze-ui-cap-unified-select-popup .ant-checkbox-wrapper:not(.ant-checkbox-wrapper-disabled):hover .ant-checkbox-checked:not(.ant-checkbox-disabled) .ant-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper{padding-left:.571rem;border:none;box-shadow:none;border-radius:0;border-bottom:.071rem solid rgba(0,0,0,0);transition:border-color .2s ease}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:hover{border-bottom:.071rem solid #7a869a !important;box-shadow:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:focus-within{border-bottom:.071rem solid #091e42 !important;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper .ant-input{border:none !important;box-shadow:none !important}`, ""]);
23470
+ ___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 .blaze-ui-cap-unified-select-more-text{cursor:pointer;color:#091e42;margin-right:.286rem;position:relative}.blaze-ui-cap-unified-select-container.ant-select-disabled .blaze-ui-cap-unified-select-more-text{color:unset !important;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-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;color:unset !important}.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:unset !important;line-height:1.429rem}.blaze-ui-cap-unified-select-container .ant-select-disabled .ant-select-prefix{color:unset !important}.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;gap:.857rem;flex-wrap:nowrap}.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;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;line-height:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-footer-download-container .blaze-ui-cap-unified-select-footer-download-label{color:#2466ea;font-family:Roboto,sans-serif;font-weight:400;font-style:normal;font-size:.857rem;line-height:1.143rem;letter-spacing:0;white-space:nowrap;display:inline-flex;align-items:center}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;color:#97a0af;font-size:1rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-no-result .blaze-ui-cap-unified-select-no-result-text{font-weight:500}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:14.286rem;width:100%;gap:.571rem}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-more{display:flex;align-items:center;justify-content:center;padding:.857rem;border-top:.071rem solid #ebecf0;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-menu-wrapper{position:relative;width:100%}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-loading-overlay{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(255,255,255,.8);z-index:10;gap:.571rem;color:#97a0af}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix{display:flex;justify-content:start;align-items:center;width:100%;height:100%;line-height:1.5;vertical-align:middle;flex:1}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-label{display:flex;align-items:center;flex-shrink:1;min-width:0}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-end{display:flex;align-items:center;gap:.571rem;flex-shrink:0;margin-left:auto}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-unified-select-option-suffix{display:flex;align-items:center;padding:0 .571rem;max-height:1.429rem;white-space:nowrap}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon{margin-top:.357rem;color:#42526e}.blaze-ui-cap-unified-select-popup .blaze-ui-cap-unified-select-option-with-suffix .blaze-ui-cap-tooltip-with-info .blaze-ui-cap-tooltip-with-info-icon .blaze-ui-cap-icon{color:#42526e}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu{margin-top:0 !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu .ant-select-dropdown-menu-item{padding:.571rem 1.714rem !important;height:unset !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-dropdown .ant-select-dropdown-menu-item-disabled{color:rgba(0,0,0,.25) !important;cursor:not-allowed !important;line-height:1.428rem !important;font-size:1rem !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{background-color:rgba(0,0,0,0);height:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper:hover{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode{height:2.857rem;margin-bottom:0;display:flex;align-items:center;width:100%}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode:hover{background-color:#fffbe6}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-selected{background-color:#f4f5f7 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled{cursor:not-allowed !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-unified-select-option-label{color:#b3bac5}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-disabled .blaze-ui-cap-icon{color:#b3bac5 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode.ant-select-tree-treenode-selected{background-color:#f4f5f7}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-treenode-leaf .ant-select-tree-switcher-noop{display:none}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox{display:flex;align-items:center;justify-content:center;line-height:1;vertical-align:middle}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox .ant-select-tree-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem;display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner:hover{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-checkbox.ant-select-tree-checkbox-indeterminate .ant-select-tree-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper{border-radius:0;padding-left:.214rem;width:100%;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-node-content-wrapper .ant-select-tree-title{width:100%;display:flex}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-indent{margin-left:.857rem;display:flex;align-items:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher{display:flex;align-items:center;justify-content:center}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher:not(.ant-select-tree-switcher-noop):hover:before{background-color:rgba(0,0,0,0)}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-switcher .ant-select-tree-switcher-icon{font-size:.857rem;margin-top:1.286rem}.blaze-ui-cap-unified-select-popup .ant-select-tree .ant-select-tree-list-holder-inner{width:fit-content !important;min-width:100%}.blaze-ui-cap-unified-select-popup .ant-tree-select:hover .ant-select-selector{border-color:#7a869a}.blaze-ui-cap-unified-select-popup .ant-tree-select-focused .ant-select-selector,.blaze-ui-cap-unified-select-popup .ant-tree-select-open .ant-select-selector{border-color:#7a869a;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-checkbox-inner{height:1.286rem;width:1.286rem;border:.143rem solid #b3bac5;border-radius:.286rem}.blaze-ui-cap-unified-select-popup .ant-checkbox-wrapper:not(.ant-checkbox-wrapper-disabled):hover .ant-checkbox-checked:not(.ant-checkbox-disabled) .ant-checkbox-inner{background-color:#47af46;border:.143rem solid #47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner{background-color:#47af46 !important;border-color:#47af46 !important}.blaze-ui-cap-unified-select-popup .ant-checkbox-indeterminate .ant-checkbox-inner::after{content:"";position:absolute;top:50%;left:50%;width:.714rem;height:.143rem;background-color:#fff;transform:translate(-50%, -50%);border-radius:.071rem}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper{padding-left:.571rem;border:none;box-shadow:none;border-radius:0;border-bottom:.071rem solid rgba(0,0,0,0);transition:border-color .2s ease}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:hover{border-bottom:.071rem solid #7a869a !important;box-shadow:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper:focus-within{border-bottom:.071rem solid #091e42 !important;box-shadow:none;outline:none}.blaze-ui-cap-unified-select-popup .ant-input-affix-wrapper .ant-input{border:none !important;box-shadow:none !important}`, ""]);
23735
23471
  // Exports
23736
23472
  ___CSS_LOADER_EXPORT___.locals = {
23737
23473
  "cap-unified-select-header-wrapper": `blaze-ui-cap-unified-select-header-wrapper`,
@@ -23789,62 +23525,33 @@ module.exports = ___CSS_LOADER_EXPORT___;
23789
23525
 
23790
23526
  exports.__esModule = true;
23791
23527
  exports.TIMEOUTS = exports.SELECT_TYPES = exports.DEFAULTS = void 0;
23792
- /**
23793
- * Select type constants for CapUnifiedSelect component
23794
- */
23795
23528
  const SELECT_TYPES = exports.SELECT_TYPES = {
23796
23529
  SELECT: 'select',
23797
23530
  MULTI_SELECT: 'multiSelect',
23798
23531
  TREE_SELECT: 'treeSelect',
23799
23532
  MULTI_TREE_SELECT: 'multiTreeSelect'
23800
23533
  };
23801
- /**
23802
- * Timeout constants (in milliseconds)
23803
- */
23804
23534
  const TIMEOUTS = exports.TIMEOUTS = {
23805
- /** Default search debounce timeout */
23806
23535
  DEFAULT_SEARCH_DEBOUNCE: 300,
23807
- /** Delay for state updates after search */
23808
23536
  SEARCH_STATE_UPDATE_DELAY: 100,
23809
- /** Minimum time since search was cleared to consider data ready */
23810
23537
  SEARCH_CLEARED_TIMEOUT: 200,
23811
- /** Buffer time added to debounce for cleared search */
23812
23538
  SEARCH_CLEARED_BUFFER: 300,
23813
- /** Buffer time added to debounce for regular search */
23814
23539
  SEARCH_REGULAR_BUFFER: 500,
23815
- /** Brief delay to show loading indicator for static search */
23816
23540
  STATIC_SEARCH_DELAY: 150,
23817
- /** Timeout for resetData fallback (1 second) */
23818
23541
  RESET_DATA_TIMEOUT: 1000,
23819
- /** Minimum time since resetData was called to consider data ready */
23820
23542
  RESET_DATA_MIN_TIME: 300,
23821
- /** Maximum time since resetData was called to consider data ready */
23822
23543
  RESET_DATA_MAX_TIME: 2000,
23823
- /** Fallback timeout for scroll loading (10 seconds) */
23824
23544
  SCROLL_LOADING_TIMEOUT: 10000,
23825
- /** Delay before setting up scroll container listener */
23826
23545
  SCROLL_CONTAINER_DELAY: 100
23827
23546
  };
23828
-
23829
- /**
23830
- * Default values for component props
23831
- */
23832
23547
  const DEFAULTS = exports.DEFAULTS = {
23833
- /** Default placeholder text */
23834
23548
  PLACEHOLDER: 'Select an option',
23835
- /** Default upload button label */
23836
23549
  UPLOAD_LABEL: 'Upload',
23837
- /** Default clear button text */
23838
23550
  CLEAR_TEXT: 'Clear',
23839
- /** Default no results message */
23840
23551
  NO_RESULT_TEXT: 'No results found',
23841
- /** Default no results icon */
23842
23552
  NO_RESULT_ICON: 'warning',
23843
- /** Default virtual row height in pixels */
23844
23553
  VIRTUAL_ROW_HEIGHT: 32,
23845
- /** Default list height in pixels */
23846
23554
  LIST_HEIGHT: 256,
23847
- /** Default search input placeholder */
23848
23555
  SEARCH_PLACEHOLDER: 'Search'
23849
23556
  };
23850
23557