@algorithm-shift/design-system 1.3.126 → 1.3.127

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/dist/index.mjs CHANGED
@@ -2282,6 +2282,7 @@ function LazySelectDropdown({
2282
2282
  const [searchTerm, setSearchTerm] = useState8("");
2283
2283
  const [highlightedIndex, setHighlightedIndex] = useState8(-1);
2284
2284
  const dropdownRef = useRef5(null);
2285
+ const popupRef = useRef5(null);
2285
2286
  const observerTarget = useRef5(null);
2286
2287
  const {
2287
2288
  options: lazyOptions,
@@ -2313,15 +2314,20 @@ function LazySelectDropdown({
2313
2314
  }
2314
2315
  }, [isOpen, lazyOptions.length, highlightedIndex]);
2315
2316
  useEffect15(() => {
2316
- const handleClickOutside = (e) => {
2317
- if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
2317
+ const handleOutside = (e) => {
2318
+ const target = e.target;
2319
+ if (dropdownRef.current && !dropdownRef.current.contains(target) && (!popupRef.current || !popupRef.current.contains(target))) {
2318
2320
  setIsOpen(false);
2319
2321
  setSearchTerm("");
2320
2322
  setHighlightedIndex(-1);
2321
2323
  }
2322
2324
  };
2323
- document.addEventListener("mousedown", handleClickOutside);
2324
- return () => document.removeEventListener("mousedown", handleClickOutside);
2325
+ document.addEventListener("mousedown", handleOutside);
2326
+ document.addEventListener("focusin", handleOutside);
2327
+ return () => {
2328
+ document.removeEventListener("mousedown", handleOutside);
2329
+ document.removeEventListener("focusin", handleOutside);
2330
+ };
2325
2331
  }, []);
2326
2332
  useEffect15(() => {
2327
2333
  if (!isOpen || !hasMore || loading) return;
@@ -2451,6 +2457,7 @@ function LazySelectDropdown({
2451
2457
  isOpen && !disabled && /* @__PURE__ */ jsx36(Portal_default, { children: /* @__PURE__ */ jsx36(
2452
2458
  "div",
2453
2459
  {
2460
+ ref: popupRef,
2454
2461
  onMouseDown: (e) => e.stopPropagation(),
2455
2462
  className: "absolute z-[900] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
2456
2463
  style: {
@@ -5856,7 +5863,8 @@ var StagesComponent = ({
5856
5863
  const isCurrentRootStage = activeRootStage?.[dataKey] === stage[dataKey];
5857
5864
  const stageHasChildren = Array.isArray(stage?.children) && stage.children.length > 0;
5858
5865
  const isCurrentChildStage = activeChildStage?.[dataKey] === activeStage;
5859
- const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage;
5866
+ const isNotParentSelected = activeChildStage?.[dataKey] !== activeRootStage?.[dataKey];
5867
+ const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage && isNotParentSelected;
5860
5868
  let stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
5861
5869
  let stageStyle = {
5862
5870
  borderColor: primaryColor,