@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.js CHANGED
@@ -2380,6 +2380,7 @@ function LazySelectDropdown({
2380
2380
  const [searchTerm, setSearchTerm] = (0, import_react22.useState)("");
2381
2381
  const [highlightedIndex, setHighlightedIndex] = (0, import_react22.useState)(-1);
2382
2382
  const dropdownRef = (0, import_react22.useRef)(null);
2383
+ const popupRef = (0, import_react22.useRef)(null);
2383
2384
  const observerTarget = (0, import_react22.useRef)(null);
2384
2385
  const {
2385
2386
  options: lazyOptions,
@@ -2411,15 +2412,20 @@ function LazySelectDropdown({
2411
2412
  }
2412
2413
  }, [isOpen, lazyOptions.length, highlightedIndex]);
2413
2414
  (0, import_react22.useEffect)(() => {
2414
- const handleClickOutside = (e) => {
2415
- if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
2415
+ const handleOutside = (e) => {
2416
+ const target = e.target;
2417
+ if (dropdownRef.current && !dropdownRef.current.contains(target) && (!popupRef.current || !popupRef.current.contains(target))) {
2416
2418
  setIsOpen(false);
2417
2419
  setSearchTerm("");
2418
2420
  setHighlightedIndex(-1);
2419
2421
  }
2420
2422
  };
2421
- document.addEventListener("mousedown", handleClickOutside);
2422
- return () => document.removeEventListener("mousedown", handleClickOutside);
2423
+ document.addEventListener("mousedown", handleOutside);
2424
+ document.addEventListener("focusin", handleOutside);
2425
+ return () => {
2426
+ document.removeEventListener("mousedown", handleOutside);
2427
+ document.removeEventListener("focusin", handleOutside);
2428
+ };
2423
2429
  }, []);
2424
2430
  (0, import_react22.useEffect)(() => {
2425
2431
  if (!isOpen || !hasMore || loading) return;
@@ -2549,6 +2555,7 @@ function LazySelectDropdown({
2549
2555
  isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
2550
2556
  "div",
2551
2557
  {
2558
+ ref: popupRef,
2552
2559
  onMouseDown: (e) => e.stopPropagation(),
2553
2560
  className: "absolute z-[900] w-fit mt-1 bg-white border border-gray-300 rounded-lg shadow-lg max-h-60 overflow-y-auto",
2554
2561
  style: {
@@ -5845,7 +5852,6 @@ var StagesComponent = ({
5845
5852
  return;
5846
5853
  }
5847
5854
  };
5848
- const lastStage = stages && stages.length > 0 ? stages[stages.length - 1][dataKey] : null;
5849
5855
  const isMobile = canvasMode === "mobile";
5850
5856
  const onStageClick = (stageKey) => {
5851
5857
  if (!stageKey || stageKey === activeStage) return;
@@ -5889,7 +5895,7 @@ var StagesComponent = ({
5889
5895
  setActiveRootStage(activeRoot);
5890
5896
  setActiveChildStage(activeChild);
5891
5897
  }, [currentStage, stages]);
5892
- const isAllStagesCompleted = isCompleted || activeRootStage?.[dataKey] === lastStage;
5898
+ const isAllStagesCompleted = isCompleted;
5893
5899
  const disabled = isAllStagesCompleted || loading || saving;
5894
5900
  const primaryColor = props.primaryColor || "#12715b";
5895
5901
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className, style, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
@@ -5941,7 +5947,8 @@ var StagesComponent = ({
5941
5947
  const isCurrentRootStage = activeRootStage?.[dataKey] === stage[dataKey];
5942
5948
  const stageHasChildren = Array.isArray(stage?.children) && stage.children.length > 0;
5943
5949
  const isCurrentChildStage = activeChildStage?.[dataKey] === activeStage;
5944
- const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage;
5950
+ const isNotParentSelected = activeChildStage?.[dataKey] !== activeRootStage?.[dataKey];
5951
+ const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage && isNotParentSelected;
5945
5952
  let stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
5946
5953
  let stageStyle = {
5947
5954
  borderColor: primaryColor,