@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.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: {
@@ -5940,7 +5947,8 @@ var StagesComponent = ({
5940
5947
  const isCurrentRootStage = activeRootStage?.[dataKey] === stage[dataKey];
5941
5948
  const stageHasChildren = Array.isArray(stage?.children) && stage.children.length > 0;
5942
5949
  const isCurrentChildStage = activeChildStage?.[dataKey] === activeStage;
5943
- const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage;
5950
+ const isNotParentSelected = activeChildStage?.[dataKey] !== activeRootStage?.[dataKey];
5951
+ const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage && isNotParentSelected;
5944
5952
  let stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
5945
5953
  let stageStyle = {
5946
5954
  borderColor: primaryColor,