@algorithm-shift/design-system 1.3.123 → 1.3.125
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.css +17 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +210 -97
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +210 -97
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -520,14 +520,64 @@ var Shape_default = Shape;
|
|
|
520
520
|
|
|
521
521
|
// src/components/Basic/Typography/Typography.tsx
|
|
522
522
|
import React4 from "react";
|
|
523
|
+
|
|
524
|
+
// src/lib/dayjs-setup.ts
|
|
525
|
+
import dayjs from "dayjs";
|
|
526
|
+
import utc from "dayjs/plugin/utc";
|
|
527
|
+
dayjs.extend(utc);
|
|
528
|
+
var dayjs_setup_default = dayjs;
|
|
529
|
+
|
|
530
|
+
// src/lib/table/valueFormatter.ts
|
|
531
|
+
var valueFormatter = (value, format3, customFormatters = {}) => {
|
|
532
|
+
if (!format3) return value;
|
|
533
|
+
if (value == null || value === "" || value === void 0) return "-";
|
|
534
|
+
if (format3.startsWith("custom:")) {
|
|
535
|
+
const key = format3.replace("custom:", "");
|
|
536
|
+
return customFormatters[key] ? customFormatters[key](value) : value;
|
|
537
|
+
}
|
|
538
|
+
const [type, arg] = format3.split(":");
|
|
539
|
+
switch (type) {
|
|
540
|
+
case "date":
|
|
541
|
+
return dayjs_setup_default(value).format(arg || "YYYY-MM-DD");
|
|
542
|
+
case "datetimenumber":
|
|
543
|
+
return dayjs_setup_default(value).format("YYYY-MM-DD hh:mm");
|
|
544
|
+
case "datetime":
|
|
545
|
+
return dayjs_setup_default(value).format("DD MMM YYYY hh:mm A");
|
|
546
|
+
case "days":
|
|
547
|
+
return `${dayjs_setup_default().diff(dayjs_setup_default(value), "day")} days`;
|
|
548
|
+
case "months":
|
|
549
|
+
return `${dayjs_setup_default().diff(dayjs_setup_default(value), "month")} months`;
|
|
550
|
+
case "years":
|
|
551
|
+
return `${dayjs_setup_default().diff(dayjs_setup_default(value), "year")} years`;
|
|
552
|
+
case "time":
|
|
553
|
+
return dayjs_setup_default(value).format("HH:mm");
|
|
554
|
+
case "number":
|
|
555
|
+
return Number(value).toFixed(parseInt(arg || "2"));
|
|
556
|
+
case "currency":
|
|
557
|
+
return new Intl.NumberFormat("en-IN", {
|
|
558
|
+
style: "currency",
|
|
559
|
+
currency: arg || "INR"
|
|
560
|
+
}).format(Number(value));
|
|
561
|
+
case "uppercase":
|
|
562
|
+
return String(value).toUpperCase();
|
|
563
|
+
case "lowercase":
|
|
564
|
+
return String(value).toLowerCase();
|
|
565
|
+
default:
|
|
566
|
+
return value;
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
// src/components/Basic/Typography/Typography.tsx
|
|
523
571
|
var Typography = ({
|
|
524
572
|
className,
|
|
525
573
|
style,
|
|
526
574
|
tagName,
|
|
527
575
|
textContent,
|
|
528
|
-
onClick
|
|
576
|
+
onClick,
|
|
577
|
+
format: format3
|
|
529
578
|
}) => {
|
|
530
579
|
const Tag = tagName || "h1";
|
|
580
|
+
const formattedContent = format3 != null && format3 !== "" ? valueFormatter(textContent, format3) : textContent;
|
|
531
581
|
return React4.createElement(
|
|
532
582
|
Tag,
|
|
533
583
|
{
|
|
@@ -539,7 +589,7 @@ var Typography = ({
|
|
|
539
589
|
React4.createElement("span", {
|
|
540
590
|
key: "html",
|
|
541
591
|
className: "pointer-events-none",
|
|
542
|
-
dangerouslySetInnerHTML: { __html:
|
|
592
|
+
dangerouslySetInnerHTML: { __html: formattedContent || "--" }
|
|
543
593
|
})
|
|
544
594
|
]
|
|
545
595
|
);
|
|
@@ -2230,6 +2280,7 @@ function LazySelectDropdown({
|
|
|
2230
2280
|
}) {
|
|
2231
2281
|
const [isOpen, setIsOpen] = useState8(false);
|
|
2232
2282
|
const [searchTerm, setSearchTerm] = useState8("");
|
|
2283
|
+
const [highlightedIndex, setHighlightedIndex] = useState8(-1);
|
|
2233
2284
|
const dropdownRef = useRef5(null);
|
|
2234
2285
|
const observerTarget = useRef5(null);
|
|
2235
2286
|
const {
|
|
@@ -2254,11 +2305,19 @@ function LazySelectDropdown({
|
|
|
2254
2305
|
enforceStrictQueryParams
|
|
2255
2306
|
});
|
|
2256
2307
|
const selectedOption = useMemo4(() => lazyOptions.find((opt) => opt.value === value), [lazyOptions, value]);
|
|
2308
|
+
useEffect15(() => {
|
|
2309
|
+
if (!isOpen) {
|
|
2310
|
+
setHighlightedIndex(-1);
|
|
2311
|
+
} else if (lazyOptions.length > 0 && highlightedIndex === -1) {
|
|
2312
|
+
setHighlightedIndex(0);
|
|
2313
|
+
}
|
|
2314
|
+
}, [isOpen, lazyOptions.length, highlightedIndex]);
|
|
2257
2315
|
useEffect15(() => {
|
|
2258
2316
|
const handleClickOutside = (e) => {
|
|
2259
2317
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2260
2318
|
setIsOpen(false);
|
|
2261
2319
|
setSearchTerm("");
|
|
2320
|
+
setHighlightedIndex(-1);
|
|
2262
2321
|
}
|
|
2263
2322
|
};
|
|
2264
2323
|
document.addEventListener("mousedown", handleClickOutside);
|
|
@@ -2278,24 +2337,30 @@ function LazySelectDropdown({
|
|
|
2278
2337
|
const handleSearchChange = (e) => {
|
|
2279
2338
|
const term = e.target.value;
|
|
2280
2339
|
setSearchTerm(term);
|
|
2340
|
+
setHighlightedIndex(-1);
|
|
2281
2341
|
search(term);
|
|
2282
2342
|
};
|
|
2283
2343
|
const handleSelect = (optValue) => {
|
|
2284
2344
|
onChange?.(optValue, id || "");
|
|
2285
2345
|
setIsOpen(false);
|
|
2286
2346
|
setSearchTerm("");
|
|
2347
|
+
setHighlightedIndex(-1);
|
|
2287
2348
|
reset();
|
|
2288
2349
|
};
|
|
2289
2350
|
const handleFocus = () => {
|
|
2290
|
-
if (!disabled)
|
|
2291
|
-
|
|
2292
|
-
|
|
2351
|
+
if (!disabled) {
|
|
2352
|
+
setIsOpen(true);
|
|
2353
|
+
if (lazyOptions.length === 0) {
|
|
2354
|
+
loadPage(1, "");
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2293
2357
|
};
|
|
2294
2358
|
const handleRemoveSelection = (e) => {
|
|
2295
2359
|
e.preventDefault();
|
|
2296
2360
|
e.stopPropagation();
|
|
2297
2361
|
onChange?.("", id || "");
|
|
2298
2362
|
setSearchTerm("");
|
|
2363
|
+
setHighlightedIndex(-1);
|
|
2299
2364
|
reset();
|
|
2300
2365
|
search("");
|
|
2301
2366
|
};
|
|
@@ -2305,9 +2370,50 @@ function LazySelectDropdown({
|
|
|
2305
2370
|
onChange?.(option.value, id || "");
|
|
2306
2371
|
setIsOpen(false);
|
|
2307
2372
|
setSearchTerm("");
|
|
2373
|
+
setHighlightedIndex(-1);
|
|
2308
2374
|
reset();
|
|
2309
2375
|
}
|
|
2310
2376
|
};
|
|
2377
|
+
const handleKeyDown = (e) => {
|
|
2378
|
+
if (disabled || readOnly) return;
|
|
2379
|
+
if (!isOpen) {
|
|
2380
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
2381
|
+
e.preventDefault();
|
|
2382
|
+
setIsOpen(true);
|
|
2383
|
+
if (lazyOptions.length > 0) {
|
|
2384
|
+
setHighlightedIndex(0);
|
|
2385
|
+
}
|
|
2386
|
+
return;
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
switch (e.key) {
|
|
2390
|
+
case "ArrowDown":
|
|
2391
|
+
e.preventDefault();
|
|
2392
|
+
setHighlightedIndex(
|
|
2393
|
+
(prev) => prev < lazyOptions.length - 1 ? prev + 1 : 0
|
|
2394
|
+
);
|
|
2395
|
+
break;
|
|
2396
|
+
case "ArrowUp":
|
|
2397
|
+
e.preventDefault();
|
|
2398
|
+
setHighlightedIndex(
|
|
2399
|
+
(prev) => prev > 0 ? prev - 1 : lazyOptions.length - 1
|
|
2400
|
+
);
|
|
2401
|
+
break;
|
|
2402
|
+
case "Enter":
|
|
2403
|
+
e.preventDefault();
|
|
2404
|
+
if (highlightedIndex >= 0 && highlightedIndex < lazyOptions.length) {
|
|
2405
|
+
handleSelect(lazyOptions[highlightedIndex].value);
|
|
2406
|
+
}
|
|
2407
|
+
break;
|
|
2408
|
+
case "Escape":
|
|
2409
|
+
e.preventDefault();
|
|
2410
|
+
setIsOpen(false);
|
|
2411
|
+
setSearchTerm("");
|
|
2412
|
+
setHighlightedIndex(-1);
|
|
2413
|
+
reset();
|
|
2414
|
+
break;
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2311
2417
|
return /* @__PURE__ */ jsxs19("div", { ref: dropdownRef, className: "relative w-full", children: [
|
|
2312
2418
|
/* @__PURE__ */ jsx36(
|
|
2313
2419
|
"input",
|
|
@@ -2325,6 +2431,7 @@ function LazySelectDropdown({
|
|
|
2325
2431
|
value: isOpen ? searchTerm : selectedOption?.label || "",
|
|
2326
2432
|
onFocus: handleFocus,
|
|
2327
2433
|
onChange: handleSearchChange,
|
|
2434
|
+
onKeyDown: handleKeyDown,
|
|
2328
2435
|
readOnly: !isOpen || readOnly,
|
|
2329
2436
|
disabled,
|
|
2330
2437
|
autoComplete: "off"
|
|
@@ -2362,10 +2469,18 @@ function LazySelectDropdown({
|
|
|
2362
2469
|
lazyOptions.map((option, index) => /* @__PURE__ */ jsx36(
|
|
2363
2470
|
"div",
|
|
2364
2471
|
{
|
|
2365
|
-
|
|
2366
|
-
|
|
2472
|
+
tabIndex: 0,
|
|
2473
|
+
className: cn(
|
|
2474
|
+
"px-3 py-2 hover:bg-blue-50 cursor-pointer text-sm focus:outline-none",
|
|
2475
|
+
option.value === value ? "bg-blue-100" : "",
|
|
2476
|
+
index === highlightedIndex ? "bg-blue-200" : ""
|
|
2477
|
+
),
|
|
2478
|
+
onClick: () => handleSelect(option.value),
|
|
2479
|
+
onKeyDown: (e) => {
|
|
2480
|
+
if (e.key === "Enter") {
|
|
2481
|
+
handleSelect(option.value);
|
|
2482
|
+
}
|
|
2367
2483
|
},
|
|
2368
|
-
className: `px-3 py-2 hover:bg-blue-50 cursor-pointer text-sm ${option.value === value ? "bg-blue-100" : ""}`,
|
|
2369
2484
|
children: option.label
|
|
2370
2485
|
},
|
|
2371
2486
|
`${option.value}-${index}`
|
|
@@ -2386,9 +2501,7 @@ function LazySelectDropdown({
|
|
|
2386
2501
|
enableAddNewOption && searchTerm && /* @__PURE__ */ jsx36(
|
|
2387
2502
|
"div",
|
|
2388
2503
|
{
|
|
2389
|
-
onClick: () =>
|
|
2390
|
-
handleAddNewOption(searchTerm);
|
|
2391
|
-
},
|
|
2504
|
+
onClick: () => handleAddNewOption(searchTerm),
|
|
2392
2505
|
className: "mt-2 px-3 py-2 bg-green-50 hover:bg-green-100 cursor-pointer text-green-700 rounded text-sm",
|
|
2393
2506
|
children: `Add "${searchTerm}"`
|
|
2394
2507
|
}
|
|
@@ -3143,7 +3256,7 @@ function DateTimePicker({
|
|
|
3143
3256
|
};
|
|
3144
3257
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
3145
3258
|
const yearOptions = [];
|
|
3146
|
-
for (let y = currentYear -
|
|
3259
|
+
for (let y = currentYear - 90; y <= currentYear; y++) {
|
|
3147
3260
|
yearOptions.push(y);
|
|
3148
3261
|
}
|
|
3149
3262
|
const displayValue = React8.useMemo(() => {
|
|
@@ -3756,54 +3869,6 @@ import React10 from "react";
|
|
|
3756
3869
|
import * as LucideIcons2 from "lucide-react";
|
|
3757
3870
|
import { Star as Star2 } from "lucide-react";
|
|
3758
3871
|
import Image from "next/image";
|
|
3759
|
-
|
|
3760
|
-
// src/lib/dayjs-setup.ts
|
|
3761
|
-
import dayjs from "dayjs";
|
|
3762
|
-
import utc from "dayjs/plugin/utc";
|
|
3763
|
-
dayjs.extend(utc);
|
|
3764
|
-
var dayjs_setup_default = dayjs;
|
|
3765
|
-
|
|
3766
|
-
// src/lib/table/valueFormatter.ts
|
|
3767
|
-
var valueFormatter = (value, format3, customFormatters = {}) => {
|
|
3768
|
-
if (!format3) return value;
|
|
3769
|
-
if (value == null || value === "" || value === void 0) return "-";
|
|
3770
|
-
if (format3.startsWith("custom:")) {
|
|
3771
|
-
const key = format3.replace("custom:", "");
|
|
3772
|
-
return customFormatters[key] ? customFormatters[key](value) : value;
|
|
3773
|
-
}
|
|
3774
|
-
const [type, arg] = format3.split(":");
|
|
3775
|
-
switch (type) {
|
|
3776
|
-
case "date":
|
|
3777
|
-
return dayjs_setup_default(value).format(arg || "YYYY-MM-DD");
|
|
3778
|
-
case "datetimenumber":
|
|
3779
|
-
return dayjs_setup_default(value).format("YYYY-MM-DD hh:mm");
|
|
3780
|
-
case "datetime":
|
|
3781
|
-
return dayjs_setup_default(value).format("DD MMM YYYY hh:mm A");
|
|
3782
|
-
case "days":
|
|
3783
|
-
return `${dayjs_setup_default().diff(dayjs_setup_default(value), "day")} days`;
|
|
3784
|
-
case "months":
|
|
3785
|
-
return `${dayjs_setup_default().diff(dayjs_setup_default(value), "month")} months`;
|
|
3786
|
-
case "years":
|
|
3787
|
-
return `${dayjs_setup_default().diff(dayjs_setup_default(value), "year")} years`;
|
|
3788
|
-
case "time":
|
|
3789
|
-
return dayjs_setup_default(value).format("HH:mm");
|
|
3790
|
-
case "number":
|
|
3791
|
-
return Number(value).toFixed(parseInt(arg || "2"));
|
|
3792
|
-
case "currency":
|
|
3793
|
-
return new Intl.NumberFormat("en-IN", {
|
|
3794
|
-
style: "currency",
|
|
3795
|
-
currency: arg || "INR"
|
|
3796
|
-
}).format(Number(value));
|
|
3797
|
-
case "uppercase":
|
|
3798
|
-
return String(value).toUpperCase();
|
|
3799
|
-
case "lowercase":
|
|
3800
|
-
return String(value).toLowerCase();
|
|
3801
|
-
default:
|
|
3802
|
-
return value;
|
|
3803
|
-
}
|
|
3804
|
-
};
|
|
3805
|
-
|
|
3806
|
-
// src/lib/table/cellRendererFactory.tsx
|
|
3807
3872
|
import { Fragment as Fragment20, jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3808
3873
|
var getContrastColor = (bg) => {
|
|
3809
3874
|
let c = bg.trim().toUpperCase();
|
|
@@ -4622,7 +4687,7 @@ function DataTable({
|
|
|
4622
4687
|
return /* @__PURE__ */ jsxs30(
|
|
4623
4688
|
TableCell,
|
|
4624
4689
|
{
|
|
4625
|
-
className: `break-words whitespace-normal align-top ${
|
|
4690
|
+
className: `break-words whitespace-normal align-top ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2 ${meta2?.cellClass ?? ""}`,
|
|
4626
4691
|
style: {
|
|
4627
4692
|
width: cell.column.getSize(),
|
|
4628
4693
|
minWidth: cell.column.columnDef.minSize,
|
|
@@ -5620,6 +5685,30 @@ function TooltipTrigger({
|
|
|
5620
5685
|
}) {
|
|
5621
5686
|
return /* @__PURE__ */ jsx60(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
5622
5687
|
}
|
|
5688
|
+
function TooltipContent({
|
|
5689
|
+
className,
|
|
5690
|
+
sideOffset = 4,
|
|
5691
|
+
children,
|
|
5692
|
+
hideArrow,
|
|
5693
|
+
...props
|
|
5694
|
+
}) {
|
|
5695
|
+
return /* @__PURE__ */ jsx60(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs37(
|
|
5696
|
+
TooltipPrimitive.Content,
|
|
5697
|
+
{
|
|
5698
|
+
"data-slot": "tooltip-content",
|
|
5699
|
+
sideOffset,
|
|
5700
|
+
className: cn(
|
|
5701
|
+
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
5702
|
+
className
|
|
5703
|
+
),
|
|
5704
|
+
...props,
|
|
5705
|
+
children: [
|
|
5706
|
+
children,
|
|
5707
|
+
!hideArrow && /* @__PURE__ */ jsx60(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 rotate-45 rounded-[2px]" })
|
|
5708
|
+
]
|
|
5709
|
+
}
|
|
5710
|
+
) });
|
|
5711
|
+
}
|
|
5623
5712
|
|
|
5624
5713
|
// src/components/Navigation/Stages/Stages.tsx
|
|
5625
5714
|
import { jsx as jsx61, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
@@ -5677,6 +5766,9 @@ var StagesComponent = ({
|
|
|
5677
5766
|
const onStageClick = (stageKey) => {
|
|
5678
5767
|
if (!stageKey || stageKey === activeStage) return;
|
|
5679
5768
|
setActiveStage(stageKey);
|
|
5769
|
+
const { activeRoot, activeChild } = findStageContext(stages, stageKey);
|
|
5770
|
+
setActiveRootStage(activeRoot);
|
|
5771
|
+
setActiveChildStage(activeChild);
|
|
5680
5772
|
if (triggerOnClick) {
|
|
5681
5773
|
onStageChange?.(stageKey);
|
|
5682
5774
|
}
|
|
@@ -5749,50 +5841,71 @@ var StagesComponent = ({
|
|
|
5749
5841
|
disabled: true
|
|
5750
5842
|
},
|
|
5751
5843
|
index
|
|
5752
|
-
)) : (stages || [])?.length > 0 &&
|
|
5753
|
-
const
|
|
5754
|
-
const
|
|
5755
|
-
const
|
|
5756
|
-
const
|
|
5757
|
-
const
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5844
|
+
)) : (stages || [])?.length > 0 && (() => {
|
|
5845
|
+
const safeStages = stages ?? [];
|
|
5846
|
+
const activeRootKey = activeRootStage?.[dataKey];
|
|
5847
|
+
const isActiveStageTopLevel = safeStages.some((s) => s?.[dataKey] === activeStage);
|
|
5848
|
+
const activeIndexKey = isActiveStageTopLevel ? activeStage : activeRootKey ?? activeStage;
|
|
5849
|
+
const currentIndex = safeStages.findIndex((s) => s?.[dataKey] === activeIndexKey);
|
|
5850
|
+
const isOutcomeWon = activeChildStage?.is_won === true;
|
|
5851
|
+
const isOutcomeLost = activeChildStage?.is_won === false;
|
|
5852
|
+
const hasOutcome = isOutcomeWon || isOutcomeLost;
|
|
5853
|
+
const activeOutcomeClass = isOutcomeWon ? "bg-green-600 text-white shadow-md" : isOutcomeLost ? "bg-red-600 text-white shadow-md" : "";
|
|
5854
|
+
return safeStages.map((stage, index) => {
|
|
5855
|
+
const isCompletedStage = isAllStagesCompleted || index <= currentIndex;
|
|
5856
|
+
const showAsActive = isAllStagesCompleted ? index === safeStages.length - 1 : index === currentIndex;
|
|
5857
|
+
const isCurrentRootStage = activeRootStage?.[dataKey] === stage[dataKey];
|
|
5858
|
+
const stageHasChildren = Array.isArray(stage?.children) && stage.children.length > 0;
|
|
5859
|
+
const isCurrentChildStage = activeChildStage?.[dataKey] === activeStage;
|
|
5860
|
+
const showOutcomeForCurrentStage = showAsActive && hasOutcome && stageHasChildren && isCurrentRootStage && isCurrentChildStage;
|
|
5861
|
+
let stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
|
|
5862
|
+
let stageStyle = {
|
|
5863
|
+
borderColor: primaryColor,
|
|
5864
|
+
color: showAsActive ? "white" : primaryColor,
|
|
5865
|
+
backgroundColor: showAsActive ? primaryColor : "transparent"
|
|
5866
|
+
};
|
|
5867
|
+
if (stage.hasOwnProperty("isSuccess") && stage.isSuccess === false) {
|
|
5769
5868
|
stageColor = "bg-red-50 text-red-700 border-2 border-red-700";
|
|
5770
5869
|
stageStyle = { borderColor: "red", color: "red", backgroundColor: "transparent" };
|
|
5771
5870
|
}
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5871
|
+
if (showOutcomeForCurrentStage) {
|
|
5872
|
+
stageColor = isOutcomeWon ? "bg-green-600 text-white border-2 border-green-600" : "bg-red-600 text-white border-2 border-red-600";
|
|
5873
|
+
stageStyle = isOutcomeWon ? { borderColor: "#16a34a", color: "white", backgroundColor: "#16a34a" } : { borderColor: "#dc2626", color: "white", backgroundColor: "#dc2626" };
|
|
5874
|
+
}
|
|
5875
|
+
let stageLabel = stage[dataLabel];
|
|
5876
|
+
if (stage[dataKey] !== activeChildStage?.[dataKey] && activeRootStage?.[dataKey] === stage[dataKey]) {
|
|
5877
|
+
stageLabel = activeChildStage?.[dataLabel] || stageLabel;
|
|
5878
|
+
stageColor = `text-[${primaryColor}] border-2 border-[${primaryColor}]`;
|
|
5879
|
+
if (showOutcomeForCurrentStage) {
|
|
5880
|
+
stageColor = isOutcomeWon ? "bg-green-600 text-white border-2 border-green-600" : "bg-red-600 text-white border-2 border-red-600";
|
|
5881
|
+
stageStyle = isOutcomeWon ? { borderColor: "#16a34a", color: "white", backgroundColor: "#16a34a" } : { borderColor: "#dc2626", color: "white", backgroundColor: "#dc2626" };
|
|
5882
|
+
}
|
|
5883
|
+
}
|
|
5884
|
+
const stageKey = typeof stage[dataKey] === "string" ? stage[dataKey] : JSON.stringify(stage[dataKey]);
|
|
5885
|
+
return /* @__PURE__ */ jsx61(React12.Fragment, { children: /* @__PURE__ */ jsxs38(Tooltip, { delayDuration: 500, disableHoverableContent: true, children: [
|
|
5886
|
+
/* @__PURE__ */ jsx61(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx61(
|
|
5887
|
+
"button",
|
|
5888
|
+
{
|
|
5889
|
+
className: `
|
|
5779
5890
|
min-w-[70px] sm:min-w-[80px] w-full sm:w-auto px-3 sm:px-4 py-1.5 sm:py-2
|
|
5780
5891
|
rounded-full text-xs sm:text-sm font-medium transition-colors duration-200
|
|
5781
5892
|
whitespace-normal sm:whitespace-nowrap flex-shrink-0 max-w-[150px] text-ellipsis overflow-hidden
|
|
5782
|
-
${showAsActive ? `bg-[${primaryColor}] text-white shadow-md` : isCompletedStage ? stageColor : "bg-white border border-gray-200"}
|
|
5893
|
+
${showAsActive ? showOutcomeForCurrentStage ? activeOutcomeClass : `bg-[${primaryColor}] text-white shadow-md` : isCompletedStage ? stageColor : "bg-white border border-gray-200"}
|
|
5783
5894
|
${isMobile ? "flex-1 text-center py-2.5" : ""}
|
|
5784
5895
|
`,
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5896
|
+
onClick: () => {
|
|
5897
|
+
if (isAllStagesCompleted) return;
|
|
5898
|
+
onStageClick(stage[dataKey]);
|
|
5899
|
+
},
|
|
5900
|
+
style: stageStyle,
|
|
5901
|
+
children: stageLabel
|
|
5902
|
+
}
|
|
5903
|
+
) }),
|
|
5904
|
+
/* @__PURE__ */ jsx61(TooltipContent, { side: "top", sideOffset: 6, hideArrow: true, children: stageLabel }),
|
|
5905
|
+
!isMobile && index < safeStages.length - 1 && /* @__PURE__ */ jsx61("div", { className: "hidden sm:flex sm:flex-shrink-0 w-3 h-px bg-gray-300 sm:w-4" })
|
|
5906
|
+
] }, stageKey) }, stageKey);
|
|
5907
|
+
});
|
|
5908
|
+
})()
|
|
5796
5909
|
}
|
|
5797
5910
|
),
|
|
5798
5911
|
isShowBtn && /* @__PURE__ */ jsx61(
|