@algorithm-shift/design-system 1.3.125 → 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: {
@@ -5761,7 +5768,6 @@ var StagesComponent = ({
5761
5768
  return;
5762
5769
  }
5763
5770
  };
5764
- const lastStage = stages && stages.length > 0 ? stages[stages.length - 1][dataKey] : null;
5765
5771
  const isMobile = canvasMode === "mobile";
5766
5772
  const onStageClick = (stageKey) => {
5767
5773
  if (!stageKey || stageKey === activeStage) return;
@@ -5805,7 +5811,7 @@ var StagesComponent = ({
5805
5811
  setActiveRootStage(activeRoot);
5806
5812
  setActiveChildStage(activeChild);
5807
5813
  }, [currentStage, stages]);
5808
- const isAllStagesCompleted = isCompleted || activeRootStage?.[dataKey] === lastStage;
5814
+ const isAllStagesCompleted = isCompleted;
5809
5815
  const disabled = isAllStagesCompleted || loading || saving;
5810
5816
  const primaryColor = props.primaryColor || "#12715b";
5811
5817
  return /* @__PURE__ */ jsx61("div", { className, style, children: /* @__PURE__ */ jsxs38(
@@ -5857,7 +5863,8 @@ var StagesComponent = ({
5857
5863
  const isCurrentRootStage = activeRootStage?.[dataKey] === stage[dataKey];
5858
5864
  const stageHasChildren = Array.isArray(stage?.children) && stage.children.length > 0;
5859
5865
  const isCurrentChildStage = activeChildStage?.[dataKey] === activeStage;
5860
- const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage;
5866
+ const isNotParentSelected = activeChildStage?.[dataKey] !== activeRootStage?.[dataKey];
5867
+ const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage && isNotParentSelected;
5861
5868
  let stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
5862
5869
  let stageStyle = {
5863
5870
  borderColor: primaryColor,