@underverse-ui/underverse 1.0.46 → 1.0.48
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/api-reference.json +9 -2
- package/dist/index.cjs +981 -953
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -8
- package/dist/index.d.ts +18 -8
- package/dist/index.js +740 -712
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -409,85 +409,103 @@ var PulseBadge = ({ speed = "normal", className, ...props }) => {
|
|
|
409
409
|
var Badge_default = Badge;
|
|
410
410
|
|
|
411
411
|
// src/components/Card.tsx
|
|
412
|
+
import React2 from "react";
|
|
412
413
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
413
414
|
var getPaddingInfo = (className) => {
|
|
414
415
|
if (!className) return { hasAll: false, hasX: false, hasY: false };
|
|
415
|
-
const hasAll =
|
|
416
|
-
const hasX = /\b(px|pl|pr|ps|pe)-/.test(className);
|
|
417
|
-
const hasY = /\b(py|pt|pb)-/.test(className);
|
|
416
|
+
const hasAll = /(?:^|\s)p-[\d[]/.test(className) || /(?:^|\s)(?:\w+:)?p-[\d[]/.test(className);
|
|
417
|
+
const hasX = /\b(?:\w+:)?(?:px|pl|pr|ps|pe)-/.test(className);
|
|
418
|
+
const hasY = /\b(?:\w+:)?(?:py|pt|pb)-/.test(className);
|
|
418
419
|
return { hasAll, hasX, hasY };
|
|
419
420
|
};
|
|
420
|
-
var Card = (
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
}
|
|
421
|
+
var Card = React2.forwardRef(
|
|
422
|
+
({
|
|
423
|
+
title,
|
|
424
|
+
description,
|
|
425
|
+
children,
|
|
426
|
+
footer,
|
|
427
|
+
className,
|
|
428
|
+
headerClassName,
|
|
429
|
+
footerClassName,
|
|
430
|
+
hoverable = false,
|
|
431
|
+
clickable = false,
|
|
432
|
+
innerClassName,
|
|
433
|
+
contentClassName,
|
|
434
|
+
noPadding = false,
|
|
435
|
+
onClick,
|
|
436
|
+
onKeyDown,
|
|
437
|
+
role,
|
|
438
|
+
tabIndex,
|
|
439
|
+
...rest
|
|
440
|
+
}, ref) => {
|
|
441
|
+
const isInteractive = clickable && typeof onClick === "function";
|
|
442
|
+
const padding = getPaddingInfo(contentClassName);
|
|
443
|
+
const skipAllPadding = noPadding || padding.hasAll;
|
|
444
|
+
const defaultPaddingX = !skipAllPadding && !padding.hasX ? "px-4 md:px-6 max-md:px-3" : "";
|
|
445
|
+
const defaultPaddingY = !skipAllPadding && !padding.hasY ? "pt-0 pb-4 md:pb-6 max-md:pb-3" : "";
|
|
446
|
+
return /* @__PURE__ */ jsx3(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
ref,
|
|
450
|
+
className: cn(
|
|
451
|
+
"group rounded-2xl md:rounded-3xl bg-card text-card-foreground transition-[transform,box-shadow,border-color,background-color] duration-300 ease-soft max-md:rounded-xl",
|
|
452
|
+
"border border-border shadow-sm backdrop-blur-sm",
|
|
453
|
+
hoverable && "md:hover:-translate-y-0.5 md:hover:border-primary/15 md:hover:shadow-md",
|
|
454
|
+
clickable && "cursor-pointer active:translate-y-px active:bg-accent/5 md:hover:bg-accent/5 md:hover:shadow-md",
|
|
455
|
+
className
|
|
456
456
|
),
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
457
|
+
onClick,
|
|
458
|
+
onKeyDown: (e) => {
|
|
459
|
+
onKeyDown?.(e);
|
|
460
|
+
if (e.defaultPrevented || !isInteractive) return;
|
|
461
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
e.currentTarget.click();
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
role: isInteractive ? role ?? "button" : role,
|
|
467
|
+
tabIndex: isInteractive ? tabIndex ?? 0 : tabIndex,
|
|
468
|
+
...rest,
|
|
469
|
+
children: /* @__PURE__ */ jsxs3("div", { className: cn("relative overflow-hidden rounded-2xl md:rounded-3xl max-md:rounded-xl", innerClassName), children: [
|
|
470
|
+
(hoverable || clickable) && /* @__PURE__ */ jsx3(
|
|
471
|
+
"div",
|
|
460
472
|
{
|
|
461
473
|
className: cn(
|
|
462
|
-
"
|
|
463
|
-
|
|
464
|
-
)
|
|
465
|
-
children: title
|
|
474
|
+
"pointer-events-none absolute inset-0 bg-linear-to-br from-primary/5 to-transparent opacity-0 transition-opacity duration-300",
|
|
475
|
+
"group-hover:opacity-100"
|
|
476
|
+
)
|
|
466
477
|
}
|
|
467
478
|
),
|
|
468
|
-
description && /* @__PURE__ */
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
479
|
+
(title || description) && /* @__PURE__ */ jsxs3("div", { className: cn("relative flex flex-col space-y-2 p-4 md:p-6 max-md:space-y-1.5 max-md:p-3", headerClassName), children: [
|
|
480
|
+
title && /* @__PURE__ */ jsx3(
|
|
481
|
+
"h3",
|
|
482
|
+
{
|
|
483
|
+
className: cn(
|
|
484
|
+
"text-base md:text-lg font-semibold leading-none tracking-tight transition-colors duration-200 max-md:text-sm",
|
|
485
|
+
hoverable && "group-hover:text-primary"
|
|
486
|
+
),
|
|
487
|
+
children: title
|
|
488
|
+
}
|
|
489
|
+
),
|
|
490
|
+
description && /* @__PURE__ */ jsx3("p", { className: "text-sm md:text-base text-muted-foreground leading-relaxed", children: description })
|
|
491
|
+
] }),
|
|
492
|
+
children && /* @__PURE__ */ jsx3("div", { className: cn("relative", defaultPaddingX, defaultPaddingY, contentClassName), children }),
|
|
493
|
+
footer && /* @__PURE__ */ jsx3("div", { className: cn("relative flex items-center p-4 md:p-6 pt-0 border-t border-border mt-4 max-md:mt-3 max-md:p-3 max-md:pt-0", footerClassName), children: footer })
|
|
494
|
+
] })
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
Card.displayName = "Card";
|
|
482
500
|
var Card_default = Card;
|
|
483
501
|
|
|
484
502
|
// src/components/CheckBox.tsx
|
|
485
|
-
import * as
|
|
503
|
+
import * as React3 from "react";
|
|
486
504
|
import { Check } from "lucide-react";
|
|
487
505
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
488
|
-
var Checkbox =
|
|
506
|
+
var Checkbox = React3.forwardRef(
|
|
489
507
|
({ className, label, labelClassName, containerClassName, checked, defaultChecked, onChange, ...props }, ref) => {
|
|
490
|
-
const [internalChecked, setInternalChecked] =
|
|
508
|
+
const [internalChecked, setInternalChecked] = React3.useState(defaultChecked ?? false);
|
|
491
509
|
const isControlled = checked !== void 0;
|
|
492
510
|
const isChecked = isControlled ? checked : internalChecked;
|
|
493
511
|
const handleChange = (e) => {
|
|
@@ -516,13 +534,13 @@ var Checkbox = React2.forwardRef(
|
|
|
516
534
|
Checkbox.displayName = "Checkbox";
|
|
517
535
|
|
|
518
536
|
// src/components/Input.tsx
|
|
519
|
-
import
|
|
537
|
+
import React6, { forwardRef as forwardRef3, useId, useState as useState3 } from "react";
|
|
520
538
|
|
|
521
539
|
// src/hooks/useSmartTranslations.tsx
|
|
522
|
-
import * as
|
|
540
|
+
import * as React5 from "react";
|
|
523
541
|
|
|
524
542
|
// src/contexts/TranslationContext.tsx
|
|
525
|
-
import * as
|
|
543
|
+
import * as React4 from "react";
|
|
526
544
|
|
|
527
545
|
// locales/en.json
|
|
528
546
|
var en_default = {
|
|
@@ -1406,9 +1424,9 @@ var defaultTranslations = {
|
|
|
1406
1424
|
ko: ko_default,
|
|
1407
1425
|
ja: ja_default
|
|
1408
1426
|
};
|
|
1409
|
-
var TranslationContext =
|
|
1427
|
+
var TranslationContext = React4.createContext(null);
|
|
1410
1428
|
var TranslationProvider = ({ children, locale = "en", translations }) => {
|
|
1411
|
-
const t =
|
|
1429
|
+
const t = React4.useCallback(
|
|
1412
1430
|
(namespace) => {
|
|
1413
1431
|
return (key) => {
|
|
1414
1432
|
const mergedTranslations = {
|
|
@@ -1436,7 +1454,7 @@ var TranslationProvider = ({ children, locale = "en", translations }) => {
|
|
|
1436
1454
|
return /* @__PURE__ */ jsx5(TranslationContext.Provider, { value: { locale, t }, children });
|
|
1437
1455
|
};
|
|
1438
1456
|
var useUnderverseTranslations = (namespace) => {
|
|
1439
|
-
const context =
|
|
1457
|
+
const context = React4.useContext(TranslationContext);
|
|
1440
1458
|
if (!context) {
|
|
1441
1459
|
return (key) => {
|
|
1442
1460
|
const parts = namespace.split(".");
|
|
@@ -1458,7 +1476,7 @@ var useUnderverseTranslations = (namespace) => {
|
|
|
1458
1476
|
return context.t(namespace);
|
|
1459
1477
|
};
|
|
1460
1478
|
var useUnderverseLocale = () => {
|
|
1461
|
-
const context =
|
|
1479
|
+
const context = React4.useContext(TranslationContext);
|
|
1462
1480
|
return context?.locale || "en";
|
|
1463
1481
|
};
|
|
1464
1482
|
|
|
@@ -1474,12 +1492,12 @@ try {
|
|
|
1474
1492
|
} catch {
|
|
1475
1493
|
nextIntlHooks = null;
|
|
1476
1494
|
}
|
|
1477
|
-
var ForceInternalContext =
|
|
1495
|
+
var ForceInternalContext = React5.createContext(false);
|
|
1478
1496
|
var ForceInternalTranslationsProvider = ({ children }) => {
|
|
1479
1497
|
return /* @__PURE__ */ jsx6(ForceInternalContext.Provider, { value: true, children });
|
|
1480
1498
|
};
|
|
1481
1499
|
function useSmartTranslations(namespace) {
|
|
1482
|
-
const forceInternal =
|
|
1500
|
+
const forceInternal = React5.useContext(ForceInternalContext);
|
|
1483
1501
|
const internalT = useUnderverseTranslations(namespace);
|
|
1484
1502
|
if (forceInternal || !nextIntlHooks?.useTranslations) {
|
|
1485
1503
|
return internalT;
|
|
@@ -1492,7 +1510,7 @@ function useSmartTranslations(namespace) {
|
|
|
1492
1510
|
}
|
|
1493
1511
|
}
|
|
1494
1512
|
function useSmartLocale() {
|
|
1495
|
-
const forceInternal =
|
|
1513
|
+
const forceInternal = React5.useContext(ForceInternalContext);
|
|
1496
1514
|
const internalLocale = useUnderverseLocale();
|
|
1497
1515
|
if (forceInternal || !nextIntlHooks?.useLocale) {
|
|
1498
1516
|
return internalLocale;
|
|
@@ -1799,7 +1817,7 @@ Input.displayName = "Input";
|
|
|
1799
1817
|
var SearchInput = forwardRef3(
|
|
1800
1818
|
({ onSearch, searchDelay = 300, placeholder = "Search\u2026", ...props }, ref) => {
|
|
1801
1819
|
const [searchValue, setSearchValue] = useState3(props.value || "");
|
|
1802
|
-
|
|
1820
|
+
React6.useEffect(() => {
|
|
1803
1821
|
if (!onSearch) return;
|
|
1804
1822
|
const timer = setTimeout(() => {
|
|
1805
1823
|
onSearch(searchValue);
|
|
@@ -1872,16 +1890,16 @@ var NumberInput = forwardRef3(
|
|
|
1872
1890
|
const n = Number(v);
|
|
1873
1891
|
return Number.isFinite(n) ? n : 0;
|
|
1874
1892
|
};
|
|
1875
|
-
const format =
|
|
1893
|
+
const format = React6.useCallback((n) => new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(n), [locale]);
|
|
1876
1894
|
const parse = (s) => {
|
|
1877
1895
|
const digits = (s || "").replace(/\D+/g, "");
|
|
1878
1896
|
return digits ? Number(digits) : NaN;
|
|
1879
1897
|
};
|
|
1880
|
-
const [displayValue, setDisplayValue] =
|
|
1898
|
+
const [displayValue, setDisplayValue] = React6.useState(
|
|
1881
1899
|
formatThousands ? value !== void 0 && value !== null && value !== "" ? format(toNumber(value)) : "" : String(value ?? "")
|
|
1882
1900
|
);
|
|
1883
1901
|
const currentValue = toNumber(value);
|
|
1884
|
-
|
|
1902
|
+
React6.useEffect(() => {
|
|
1885
1903
|
if (formatThousands) {
|
|
1886
1904
|
const next = value === "" || value === void 0 || value === null ? "" : format(toNumber(value));
|
|
1887
1905
|
setDisplayValue((prev) => prev === next ? prev : next);
|
|
@@ -2386,7 +2404,7 @@ TagInput.displayName = "TagInput";
|
|
|
2386
2404
|
var TagInput_default = TagInput;
|
|
2387
2405
|
|
|
2388
2406
|
// src/components/Switch.tsx
|
|
2389
|
-
import * as
|
|
2407
|
+
import * as React8 from "react";
|
|
2390
2408
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2391
2409
|
var Switch = ({
|
|
2392
2410
|
checked,
|
|
@@ -2399,7 +2417,7 @@ var Switch = ({
|
|
|
2399
2417
|
className,
|
|
2400
2418
|
...props
|
|
2401
2419
|
}) => {
|
|
2402
|
-
const [isPressed, setIsPressed] =
|
|
2420
|
+
const [isPressed, setIsPressed] = React8.useState(false);
|
|
2403
2421
|
const sizeClasses2 = {
|
|
2404
2422
|
sm: {
|
|
2405
2423
|
track: "w-8 h-4",
|
|
@@ -2417,7 +2435,7 @@ var Switch = ({
|
|
|
2417
2435
|
translate: "translate-x-6"
|
|
2418
2436
|
}
|
|
2419
2437
|
};
|
|
2420
|
-
const
|
|
2438
|
+
const variantClasses3 = {
|
|
2421
2439
|
default: {
|
|
2422
2440
|
active: "bg-primary border-primary",
|
|
2423
2441
|
inactive: "bg-input border-input"
|
|
@@ -2463,7 +2481,7 @@ var Switch = ({
|
|
|
2463
2481
|
{
|
|
2464
2482
|
className: cn(
|
|
2465
2483
|
"block w-full h-full rounded-full transition-colors duration-200 ease-out border",
|
|
2466
|
-
checked ?
|
|
2484
|
+
checked ? variantClasses3[variant].active : variantClasses3[variant].inactive
|
|
2467
2485
|
)
|
|
2468
2486
|
}
|
|
2469
2487
|
),
|
|
@@ -2494,13 +2512,13 @@ Switch.displayName = "Switch";
|
|
|
2494
2512
|
var Switch_default = Switch;
|
|
2495
2513
|
|
|
2496
2514
|
// src/components/label.tsx
|
|
2497
|
-
import * as
|
|
2515
|
+
import * as React9 from "react";
|
|
2498
2516
|
import { cva } from "class-variance-authority";
|
|
2499
2517
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
2500
2518
|
var labelVariants = cva(
|
|
2501
2519
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
2502
2520
|
);
|
|
2503
|
-
var Label =
|
|
2521
|
+
var Label = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
|
|
2504
2522
|
"label",
|
|
2505
2523
|
{
|
|
2506
2524
|
ref,
|
|
@@ -2512,7 +2530,7 @@ Label.displayName = "Label";
|
|
|
2512
2530
|
|
|
2513
2531
|
// src/components/SmartImage.tsx
|
|
2514
2532
|
import Image2 from "next/image";
|
|
2515
|
-
import
|
|
2533
|
+
import React10 from "react";
|
|
2516
2534
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2517
2535
|
var DEFAULT_FALLBACK = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Crect fill='%23f3f4f6' width='400' height='400'/%3E%3Cpath fill='%239ca3af' d='M160 150h80v60h-80z'/%3E%3Ccircle fill='%239ca3af' cx='180' cy='130' r='20'/%3E%3Cpath fill='%239ca3af' d='M120 240l60-60 40 40 40-30 60 50v40H120z'/%3E%3C/svg%3E";
|
|
2518
2536
|
var FAILED_SRCS = /* @__PURE__ */ new Set();
|
|
@@ -2551,8 +2569,8 @@ function SmartImage({
|
|
|
2551
2569
|
const normalized = `/${raw.replace(/^\.\/?/, "")}`;
|
|
2552
2570
|
return FAILED_SRCS.has(normalized) ? fallbackSrc : normalized;
|
|
2553
2571
|
};
|
|
2554
|
-
const [resolvedSrc, setResolvedSrc] =
|
|
2555
|
-
|
|
2572
|
+
const [resolvedSrc, setResolvedSrc] = React10.useState(() => normalize(src));
|
|
2573
|
+
React10.useEffect(() => {
|
|
2556
2574
|
setResolvedSrc(normalize(src));
|
|
2557
2575
|
}, [src]);
|
|
2558
2576
|
const handleError = () => {
|
|
@@ -2715,7 +2733,7 @@ var Avatar_default = Avatar;
|
|
|
2715
2733
|
// src/components/Skeleton.tsx
|
|
2716
2734
|
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2717
2735
|
var Skeleton = ({ className, width, height, variant = "rectangular", animation = "pulse", lines = 1 }) => {
|
|
2718
|
-
const
|
|
2736
|
+
const variantClasses3 = {
|
|
2719
2737
|
rectangular: "rounded-2xl md:rounded-3xl",
|
|
2720
2738
|
circular: "rounded-full",
|
|
2721
2739
|
rounded: "rounded-2xl md:rounded-3xl",
|
|
@@ -2732,7 +2750,7 @@ var Skeleton = ({ className, width, height, variant = "rectangular", animation =
|
|
|
2732
2750
|
{
|
|
2733
2751
|
className: cn(
|
|
2734
2752
|
"h-4 bg-muted",
|
|
2735
|
-
|
|
2753
|
+
variantClasses3[variant],
|
|
2736
2754
|
animationClasses[animation],
|
|
2737
2755
|
index === lines - 1 && "w-3/4"
|
|
2738
2756
|
// Last line is shorter
|
|
@@ -2745,7 +2763,7 @@ var Skeleton = ({ className, width, height, variant = "rectangular", animation =
|
|
|
2745
2763
|
index
|
|
2746
2764
|
)) });
|
|
2747
2765
|
}
|
|
2748
|
-
return /* @__PURE__ */ jsx13("div", { className: cn("bg-muted",
|
|
2766
|
+
return /* @__PURE__ */ jsx13("div", { className: cn("bg-muted", variantClasses3[variant], animationClasses[animation], className), style: { width, height } });
|
|
2749
2767
|
};
|
|
2750
2768
|
var SkeletonAvatar = ({ size = "md", className }) => {
|
|
2751
2769
|
const sizeClasses2 = {
|
|
@@ -2837,7 +2855,7 @@ var SkeletonTable = ({ rows = 5, columns = 4, className }) => {
|
|
|
2837
2855
|
var Skeleton_default = Skeleton;
|
|
2838
2856
|
|
|
2839
2857
|
// src/components/Progress.tsx
|
|
2840
|
-
import
|
|
2858
|
+
import React11 from "react";
|
|
2841
2859
|
import { Check as Check2, X as X3, Clock } from "lucide-react";
|
|
2842
2860
|
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2843
2861
|
var variantStyles2 = {
|
|
@@ -2871,8 +2889,8 @@ var Progress = ({
|
|
|
2871
2889
|
const percentage = Math.min(Math.max(value / max * 100, 0), 100);
|
|
2872
2890
|
const isComplete = status === "complete" || percentage >= 100;
|
|
2873
2891
|
const isError = status === "error";
|
|
2874
|
-
const labelId =
|
|
2875
|
-
const descId =
|
|
2892
|
+
const labelId = React11.useId();
|
|
2893
|
+
const descId = React11.useId();
|
|
2876
2894
|
const getStatusIcon = () => {
|
|
2877
2895
|
if (isComplete) return /* @__PURE__ */ jsx14(Check2, { className: "w-4 h-4 text-success" });
|
|
2878
2896
|
if (isError) return /* @__PURE__ */ jsx14(X3, { className: "w-4 h-4 text-destructive" });
|
|
@@ -3203,7 +3221,7 @@ var LoadingProgress = ({
|
|
|
3203
3221
|
};
|
|
3204
3222
|
|
|
3205
3223
|
// src/components/Modal.tsx
|
|
3206
|
-
import * as
|
|
3224
|
+
import * as React12 from "react";
|
|
3207
3225
|
import { createPortal } from "react-dom";
|
|
3208
3226
|
import { X as X4 } from "lucide-react";
|
|
3209
3227
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -3232,17 +3250,17 @@ var Modal = ({
|
|
|
3232
3250
|
width,
|
|
3233
3251
|
height
|
|
3234
3252
|
}) => {
|
|
3235
|
-
const [isMounted, setIsMounted] =
|
|
3236
|
-
const [isVisible, setIsVisible] =
|
|
3237
|
-
const [isAnimating, setIsAnimating] =
|
|
3238
|
-
const mouseDownTarget =
|
|
3239
|
-
const modalContentRef =
|
|
3240
|
-
|
|
3253
|
+
const [isMounted, setIsMounted] = React12.useState(false);
|
|
3254
|
+
const [isVisible, setIsVisible] = React12.useState(false);
|
|
3255
|
+
const [isAnimating, setIsAnimating] = React12.useState(true);
|
|
3256
|
+
const mouseDownTarget = React12.useRef(null);
|
|
3257
|
+
const modalContentRef = React12.useRef(null);
|
|
3258
|
+
React12.useEffect(() => {
|
|
3241
3259
|
setIsMounted(true);
|
|
3242
3260
|
return () => setIsMounted(false);
|
|
3243
3261
|
}, []);
|
|
3244
|
-
const animationRef =
|
|
3245
|
-
|
|
3262
|
+
const animationRef = React12.useRef(false);
|
|
3263
|
+
React12.useEffect(() => {
|
|
3246
3264
|
if (isOpen) {
|
|
3247
3265
|
if (animationRef.current) return;
|
|
3248
3266
|
animationRef.current = true;
|
|
@@ -3262,7 +3280,7 @@ var Modal = ({
|
|
|
3262
3280
|
}
|
|
3263
3281
|
}
|
|
3264
3282
|
}, [isOpen, isVisible]);
|
|
3265
|
-
|
|
3283
|
+
React12.useEffect(() => {
|
|
3266
3284
|
if (!isOpen || !closeOnEsc) return;
|
|
3267
3285
|
const handleEscape = (event) => {
|
|
3268
3286
|
if (event.key === "Escape") {
|
|
@@ -3272,7 +3290,7 @@ var Modal = ({
|
|
|
3272
3290
|
document.addEventListener("keydown", handleEscape);
|
|
3273
3291
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
3274
3292
|
}, [isOpen, closeOnEsc, onClose]);
|
|
3275
|
-
|
|
3293
|
+
React12.useEffect(() => {
|
|
3276
3294
|
if (isOpen) {
|
|
3277
3295
|
document.body.style.overflow = "hidden";
|
|
3278
3296
|
} else {
|
|
@@ -3562,7 +3580,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3562
3580
|
var Toast_default = ToastProvider;
|
|
3563
3581
|
|
|
3564
3582
|
// src/components/Tooltip.tsx
|
|
3565
|
-
import * as
|
|
3583
|
+
import * as React14 from "react";
|
|
3566
3584
|
import { createPortal as createPortal2 } from "react-dom";
|
|
3567
3585
|
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3568
3586
|
var variantStyles3 = {
|
|
@@ -3637,21 +3655,21 @@ var Tooltip = ({
|
|
|
3637
3655
|
disabled = false,
|
|
3638
3656
|
variant = "default"
|
|
3639
3657
|
}) => {
|
|
3640
|
-
const [isOpen, setIsOpen] =
|
|
3641
|
-
const [isMounted, setIsMounted] =
|
|
3642
|
-
const triggerRef =
|
|
3643
|
-
const positionerRef =
|
|
3644
|
-
const panelRef =
|
|
3645
|
-
const timeoutRef =
|
|
3646
|
-
const lastAppliedRef =
|
|
3647
|
-
|
|
3658
|
+
const [isOpen, setIsOpen] = React14.useState(false);
|
|
3659
|
+
const [isMounted, setIsMounted] = React14.useState(false);
|
|
3660
|
+
const triggerRef = React14.useRef(null);
|
|
3661
|
+
const positionerRef = React14.useRef(null);
|
|
3662
|
+
const panelRef = React14.useRef(null);
|
|
3663
|
+
const timeoutRef = React14.useRef(void 0);
|
|
3664
|
+
const lastAppliedRef = React14.useRef(null);
|
|
3665
|
+
React14.useEffect(() => {
|
|
3648
3666
|
setIsMounted(true);
|
|
3649
3667
|
}, []);
|
|
3650
3668
|
const delayOpen = typeof delay === "object" ? delay.open || 700 : delay;
|
|
3651
3669
|
const delayClose = typeof delay === "object" ? delay.close || 300 : delay;
|
|
3652
3670
|
const offset = 8;
|
|
3653
3671
|
const padding = 8;
|
|
3654
|
-
const updatePosition =
|
|
3672
|
+
const updatePosition = React14.useCallback(() => {
|
|
3655
3673
|
const triggerEl = triggerRef.current;
|
|
3656
3674
|
const positionerEl = positionerRef.current;
|
|
3657
3675
|
const panelEl = panelRef.current;
|
|
@@ -3700,10 +3718,10 @@ var Tooltip = ({
|
|
|
3700
3718
|
const handleBlur = () => {
|
|
3701
3719
|
setIsOpen(false);
|
|
3702
3720
|
};
|
|
3703
|
-
|
|
3721
|
+
React14.useEffect(() => {
|
|
3704
3722
|
return () => clearTimeout(timeoutRef.current);
|
|
3705
3723
|
}, []);
|
|
3706
|
-
|
|
3724
|
+
React14.useLayoutEffect(() => {
|
|
3707
3725
|
if (!isOpen) {
|
|
3708
3726
|
lastAppliedRef.current = null;
|
|
3709
3727
|
return;
|
|
@@ -3720,7 +3738,7 @@ var Tooltip = ({
|
|
|
3720
3738
|
cancelAnimationFrame(raf2);
|
|
3721
3739
|
};
|
|
3722
3740
|
}, [isOpen, updatePosition]);
|
|
3723
|
-
|
|
3741
|
+
React14.useEffect(() => {
|
|
3724
3742
|
if (!isOpen) return;
|
|
3725
3743
|
let raf = 0;
|
|
3726
3744
|
const handler = () => {
|
|
@@ -3738,7 +3756,7 @@ var Tooltip = ({
|
|
|
3738
3756
|
document.removeEventListener("scroll", handler, true);
|
|
3739
3757
|
};
|
|
3740
3758
|
}, [isOpen, updatePosition]);
|
|
3741
|
-
|
|
3759
|
+
React14.useEffect(() => {
|
|
3742
3760
|
if (!isOpen) return;
|
|
3743
3761
|
if (typeof ResizeObserver === "undefined") return;
|
|
3744
3762
|
const ro = new ResizeObserver(() => updatePosition());
|
|
@@ -3750,7 +3768,7 @@ var Tooltip = ({
|
|
|
3750
3768
|
return children;
|
|
3751
3769
|
}
|
|
3752
3770
|
return /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
3753
|
-
|
|
3771
|
+
React14.cloneElement(children, {
|
|
3754
3772
|
ref: (node) => {
|
|
3755
3773
|
triggerRef.current = node;
|
|
3756
3774
|
assignRef(children.props?.ref, node);
|
|
@@ -3814,7 +3832,7 @@ var Tooltip = ({
|
|
|
3814
3832
|
};
|
|
3815
3833
|
|
|
3816
3834
|
// src/components/Popover.tsx
|
|
3817
|
-
import * as
|
|
3835
|
+
import * as React15 from "react";
|
|
3818
3836
|
import { createPortal as createPortal3 } from "react-dom";
|
|
3819
3837
|
|
|
3820
3838
|
// src/utils/animations.ts
|
|
@@ -4109,14 +4127,14 @@ var Popover = ({
|
|
|
4109
4127
|
contentWidth
|
|
4110
4128
|
}) => {
|
|
4111
4129
|
const isControlled = open !== void 0;
|
|
4112
|
-
const [internalOpen, setInternalOpen] =
|
|
4113
|
-
const triggerRef =
|
|
4114
|
-
const positionerRef =
|
|
4115
|
-
const panelRef =
|
|
4116
|
-
const lastAppliedRef =
|
|
4130
|
+
const [internalOpen, setInternalOpen] = React15.useState(false);
|
|
4131
|
+
const triggerRef = React15.useRef(null);
|
|
4132
|
+
const positionerRef = React15.useRef(null);
|
|
4133
|
+
const panelRef = React15.useRef(null);
|
|
4134
|
+
const lastAppliedRef = React15.useRef(null);
|
|
4117
4135
|
useShadCNAnimations();
|
|
4118
4136
|
const isOpen = isControlled ? open : internalOpen;
|
|
4119
|
-
const setIsOpen =
|
|
4137
|
+
const setIsOpen = React15.useCallback(
|
|
4120
4138
|
(next) => {
|
|
4121
4139
|
if (!isControlled) setInternalOpen(next);
|
|
4122
4140
|
onOpenChange?.(next);
|
|
@@ -4125,8 +4143,8 @@ var Popover = ({
|
|
|
4125
4143
|
);
|
|
4126
4144
|
const offset = 4;
|
|
4127
4145
|
const padding = 8;
|
|
4128
|
-
const initialPlacement =
|
|
4129
|
-
const updatePosition =
|
|
4146
|
+
const initialPlacement = React15.useMemo(() => normalizePlacement(placement), [placement]);
|
|
4147
|
+
const updatePosition = React15.useCallback(() => {
|
|
4130
4148
|
const triggerEl = triggerRef.current;
|
|
4131
4149
|
const positionerEl = positionerRef.current;
|
|
4132
4150
|
const panelEl = panelRef.current;
|
|
@@ -4163,7 +4181,7 @@ var Popover = ({
|
|
|
4163
4181
|
if (positionerEl.style.visibility !== "visible") positionerEl.style.visibility = "visible";
|
|
4164
4182
|
if (positionerEl.style.pointerEvents !== "auto") positionerEl.style.pointerEvents = "auto";
|
|
4165
4183
|
}, [placement, matchTriggerWidth, contentWidth]);
|
|
4166
|
-
|
|
4184
|
+
React15.useLayoutEffect(() => {
|
|
4167
4185
|
if (!isOpen) return;
|
|
4168
4186
|
updatePosition();
|
|
4169
4187
|
let raf1 = 0;
|
|
@@ -4177,7 +4195,7 @@ var Popover = ({
|
|
|
4177
4195
|
cancelAnimationFrame(raf2);
|
|
4178
4196
|
};
|
|
4179
4197
|
}, [isOpen, updatePosition]);
|
|
4180
|
-
|
|
4198
|
+
React15.useEffect(() => {
|
|
4181
4199
|
if (!isOpen) return;
|
|
4182
4200
|
let raf = 0;
|
|
4183
4201
|
const tick = () => {
|
|
@@ -4187,7 +4205,7 @@ var Popover = ({
|
|
|
4187
4205
|
raf = window.requestAnimationFrame(tick);
|
|
4188
4206
|
return () => window.cancelAnimationFrame(raf);
|
|
4189
4207
|
}, [isOpen, updatePosition]);
|
|
4190
|
-
|
|
4208
|
+
React15.useEffect(() => {
|
|
4191
4209
|
if (!isOpen) return;
|
|
4192
4210
|
let raf = 0;
|
|
4193
4211
|
const handler = () => {
|
|
@@ -4205,7 +4223,7 @@ var Popover = ({
|
|
|
4205
4223
|
document.removeEventListener("scroll", handler, true);
|
|
4206
4224
|
};
|
|
4207
4225
|
}, [isOpen, updatePosition]);
|
|
4208
|
-
|
|
4226
|
+
React15.useEffect(() => {
|
|
4209
4227
|
if (!isOpen) return;
|
|
4210
4228
|
if (typeof ResizeObserver === "undefined") return;
|
|
4211
4229
|
const ro = new ResizeObserver(() => updatePosition());
|
|
@@ -4213,13 +4231,13 @@ var Popover = ({
|
|
|
4213
4231
|
if (triggerRef.current) ro.observe(triggerRef.current);
|
|
4214
4232
|
return () => ro.disconnect();
|
|
4215
4233
|
}, [isOpen, updatePosition]);
|
|
4216
|
-
|
|
4234
|
+
React15.useLayoutEffect(() => {
|
|
4217
4235
|
if (!isOpen) {
|
|
4218
4236
|
lastAppliedRef.current = null;
|
|
4219
4237
|
return;
|
|
4220
4238
|
}
|
|
4221
4239
|
}, [isOpen]);
|
|
4222
|
-
|
|
4240
|
+
React15.useEffect(() => {
|
|
4223
4241
|
if (!isOpen) return;
|
|
4224
4242
|
const handleClickOutside = (event) => {
|
|
4225
4243
|
const target = event.target;
|
|
@@ -4304,7 +4322,7 @@ var Popover = ({
|
|
|
4304
4322
|
return /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
4305
4323
|
(() => {
|
|
4306
4324
|
const triggerEl = trigger;
|
|
4307
|
-
return
|
|
4325
|
+
return React15.cloneElement(triggerEl, {
|
|
4308
4326
|
ref: (node) => {
|
|
4309
4327
|
triggerRef.current = node;
|
|
4310
4328
|
assignRef2(triggerEl.props?.ref, node);
|
|
@@ -4330,7 +4348,7 @@ var Popover = ({
|
|
|
4330
4348
|
};
|
|
4331
4349
|
|
|
4332
4350
|
// src/components/Sheet.tsx
|
|
4333
|
-
import * as
|
|
4351
|
+
import * as React16 from "react";
|
|
4334
4352
|
import { createPortal as createPortal4 } from "react-dom";
|
|
4335
4353
|
import { X as X6 } from "lucide-react";
|
|
4336
4354
|
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
@@ -4410,13 +4428,13 @@ var Sheet = ({
|
|
|
4410
4428
|
header,
|
|
4411
4429
|
footer
|
|
4412
4430
|
}) => {
|
|
4413
|
-
const [mounted, setMounted] =
|
|
4414
|
-
const [isAnimating, setIsAnimating] =
|
|
4415
|
-
const [isVisible, setIsVisible] =
|
|
4416
|
-
|
|
4431
|
+
const [mounted, setMounted] = React16.useState(false);
|
|
4432
|
+
const [isAnimating, setIsAnimating] = React16.useState(true);
|
|
4433
|
+
const [isVisible, setIsVisible] = React16.useState(false);
|
|
4434
|
+
React16.useEffect(() => {
|
|
4417
4435
|
setMounted(true);
|
|
4418
4436
|
}, []);
|
|
4419
|
-
|
|
4437
|
+
React16.useEffect(() => {
|
|
4420
4438
|
if (!closeOnEscape) return;
|
|
4421
4439
|
const handleEscape = (e) => {
|
|
4422
4440
|
if (e.key === "Escape" && open) {
|
|
@@ -4426,7 +4444,7 @@ var Sheet = ({
|
|
|
4426
4444
|
document.addEventListener("keydown", handleEscape);
|
|
4427
4445
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
4428
4446
|
}, [open, closeOnEscape, onOpenChange]);
|
|
4429
|
-
|
|
4447
|
+
React16.useEffect(() => {
|
|
4430
4448
|
if (open) {
|
|
4431
4449
|
document.body.style.overflow = "hidden";
|
|
4432
4450
|
} else {
|
|
@@ -4436,7 +4454,7 @@ var Sheet = ({
|
|
|
4436
4454
|
document.body.style.overflow = "unset";
|
|
4437
4455
|
};
|
|
4438
4456
|
}, [open]);
|
|
4439
|
-
|
|
4457
|
+
React16.useEffect(() => {
|
|
4440
4458
|
if (open) {
|
|
4441
4459
|
setIsVisible(true);
|
|
4442
4460
|
setIsAnimating(true);
|
|
@@ -4623,7 +4641,7 @@ var Alert = ({ title, description, variant = "default", className, icon, dismiss
|
|
|
4623
4641
|
var Alert_default = Alert;
|
|
4624
4642
|
|
|
4625
4643
|
// src/components/GlobalLoading.tsx
|
|
4626
|
-
import
|
|
4644
|
+
import React17, { useEffect as useEffect6, useState as useState12 } from "react";
|
|
4627
4645
|
import { Activity as Activity2 } from "lucide-react";
|
|
4628
4646
|
|
|
4629
4647
|
// src/utils/loading.ts
|
|
@@ -4728,7 +4746,7 @@ var InlineLoading = ({ isLoading, text, className, size = "md" }) => {
|
|
|
4728
4746
|
] });
|
|
4729
4747
|
};
|
|
4730
4748
|
var ButtonLoading = ({ isLoading, children, className, disabled, loadingText }) => {
|
|
4731
|
-
const child =
|
|
4749
|
+
const child = React17.isValidElement(children) ? React17.cloneElement(children, {
|
|
4732
4750
|
disabled: (children.props?.disabled ?? false) || disabled || isLoading,
|
|
4733
4751
|
"aria-busy": isLoading || void 0
|
|
4734
4752
|
}) : children;
|
|
@@ -4742,7 +4760,7 @@ var ButtonLoading = ({ isLoading, children, className, disabled, loadingText })
|
|
|
4742
4760
|
};
|
|
4743
4761
|
|
|
4744
4762
|
// src/components/Breadcrumb.tsx
|
|
4745
|
-
import * as
|
|
4763
|
+
import * as React18 from "react";
|
|
4746
4764
|
import { ChevronRight, Home, MoreHorizontal } from "lucide-react";
|
|
4747
4765
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
4748
4766
|
var NextLink = null;
|
|
@@ -4789,8 +4807,8 @@ var Breadcrumb = ({
|
|
|
4789
4807
|
homeHref = "/",
|
|
4790
4808
|
collapsible = true
|
|
4791
4809
|
}) => {
|
|
4792
|
-
const [isCollapsed, setIsCollapsed] =
|
|
4793
|
-
|
|
4810
|
+
const [isCollapsed, setIsCollapsed] = React18.useState(false);
|
|
4811
|
+
React18.useEffect(() => {
|
|
4794
4812
|
if (collapsible && items.length > maxItems) {
|
|
4795
4813
|
setIsCollapsed(true);
|
|
4796
4814
|
}
|
|
@@ -4808,7 +4826,7 @@ var Breadcrumb = ({
|
|
|
4808
4826
|
const SeparatorComponent = separator;
|
|
4809
4827
|
return /* @__PURE__ */ jsx22(SeparatorComponent, { className: cn("text-muted-foreground", sizeStyles5[size].icon) });
|
|
4810
4828
|
};
|
|
4811
|
-
const processedItems =
|
|
4829
|
+
const processedItems = React18.useMemo(() => {
|
|
4812
4830
|
let finalItems = [...items];
|
|
4813
4831
|
if (showHome && finalItems[0]?.href !== homeHref) {
|
|
4814
4832
|
finalItems.unshift({
|
|
@@ -4881,20 +4899,23 @@ var Breadcrumb = ({
|
|
|
4881
4899
|
var Breadcrumb_default = Breadcrumb;
|
|
4882
4900
|
|
|
4883
4901
|
// src/components/Tab.tsx
|
|
4884
|
-
import * as
|
|
4902
|
+
import * as React19 from "react";
|
|
4885
4903
|
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
4886
4904
|
var sizeStyles6 = {
|
|
4887
4905
|
sm: {
|
|
4888
4906
|
tab: "py-1.5 px-3 text-xs",
|
|
4889
|
-
|
|
4907
|
+
contentGap: "mt-3",
|
|
4908
|
+
contentPadding: "p-3"
|
|
4890
4909
|
},
|
|
4891
4910
|
md: {
|
|
4892
4911
|
tab: "py-2.5 px-4 text-sm",
|
|
4893
|
-
|
|
4912
|
+
contentGap: "mt-4",
|
|
4913
|
+
contentPadding: "p-4"
|
|
4894
4914
|
},
|
|
4895
4915
|
lg: {
|
|
4896
4916
|
tab: "py-3 px-6 text-base",
|
|
4897
|
-
|
|
4917
|
+
contentGap: "mt-6",
|
|
4918
|
+
contentPadding: "p-6"
|
|
4898
4919
|
}
|
|
4899
4920
|
};
|
|
4900
4921
|
var variantStyles5 = {
|
|
@@ -4933,16 +4954,20 @@ var Tabs = ({
|
|
|
4933
4954
|
tabs,
|
|
4934
4955
|
defaultValue,
|
|
4935
4956
|
className,
|
|
4957
|
+
contentClassName,
|
|
4936
4958
|
variant = "default",
|
|
4937
4959
|
size = "md",
|
|
4938
4960
|
orientation = "horizontal",
|
|
4939
4961
|
onTabChange,
|
|
4940
|
-
stretch = false
|
|
4962
|
+
stretch = false,
|
|
4963
|
+
noContentCard = false,
|
|
4964
|
+
noContentPadding = false,
|
|
4965
|
+
animateContent = true
|
|
4941
4966
|
}) => {
|
|
4942
|
-
const [active, setActive] =
|
|
4943
|
-
const [underlineStyle, setUnderlineStyle] =
|
|
4944
|
-
const tabRefs =
|
|
4945
|
-
const baseId =
|
|
4967
|
+
const [active, setActive] = React19.useState(defaultValue || tabs[0]?.value);
|
|
4968
|
+
const [underlineStyle, setUnderlineStyle] = React19.useState({});
|
|
4969
|
+
const tabRefs = React19.useRef([]);
|
|
4970
|
+
const baseId = React19.useMemo(() => {
|
|
4946
4971
|
const key = tabs.map((t) => t.value).join("-");
|
|
4947
4972
|
return `tabs-${key || "default"}`;
|
|
4948
4973
|
}, [tabs]);
|
|
@@ -4950,10 +4975,10 @@ var Tabs = ({
|
|
|
4950
4975
|
setActive(value);
|
|
4951
4976
|
onTabChange?.(value);
|
|
4952
4977
|
};
|
|
4953
|
-
|
|
4978
|
+
React19.useEffect(() => {
|
|
4954
4979
|
if (variant === "underline" && orientation === "horizontal") {
|
|
4955
|
-
const
|
|
4956
|
-
const activeTab2 = tabRefs.current[
|
|
4980
|
+
const activeIndex2 = tabs.findIndex((tab) => tab.value === active);
|
|
4981
|
+
const activeTab2 = tabRefs.current[activeIndex2];
|
|
4957
4982
|
if (activeTab2) {
|
|
4958
4983
|
const { offsetLeft, offsetWidth } = activeTab2;
|
|
4959
4984
|
setUnderlineStyle({
|
|
@@ -4964,19 +4989,29 @@ var Tabs = ({
|
|
|
4964
4989
|
}
|
|
4965
4990
|
}, [active, variant, orientation, tabs]);
|
|
4966
4991
|
const containerClasses = cn(
|
|
4967
|
-
"
|
|
4968
|
-
orientation === "horizontal" ? "flex space-x-1 overflow-x-auto" : "flex flex-col space-y-1",
|
|
4992
|
+
"relative",
|
|
4993
|
+
orientation === "horizontal" ? "w-full flex space-x-1 overflow-x-auto" : "flex flex-col space-y-1 shrink-0",
|
|
4969
4994
|
variantStyles5[variant].container,
|
|
4970
4995
|
className
|
|
4971
4996
|
);
|
|
4972
|
-
const
|
|
4973
|
-
|
|
4997
|
+
const activeIndex = tabs.findIndex((tab) => tab.value === active);
|
|
4998
|
+
const activeTab = activeIndex >= 0 ? tabs[activeIndex] : tabs[0];
|
|
4999
|
+
const panelId = `${baseId}-panel-${activeIndex >= 0 ? activeIndex : 0}`;
|
|
5000
|
+
const tabId = `${baseId}-tab-${activeIndex >= 0 ? activeIndex : 0}`;
|
|
5001
|
+
const contentWrapperClasses = cn(
|
|
5002
|
+
orientation === "horizontal" && sizeStyles6[size].contentGap,
|
|
5003
|
+
orientation === "vertical" && "flex-1 min-w-0",
|
|
5004
|
+
!noContentPadding && sizeStyles6[size].contentPadding,
|
|
5005
|
+
!noContentCard ? "bg-card rounded-2xl md:rounded-3xl border border-border/60 shadow-sm text-card-foreground backdrop-blur-sm" : "text-foreground",
|
|
5006
|
+
contentClassName
|
|
5007
|
+
);
|
|
5008
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn("w-full", orientation === "vertical" && "flex items-start gap-6"), children: [
|
|
4974
5009
|
/* @__PURE__ */ jsxs19("div", { className: containerClasses, role: "tablist", "aria-orientation": orientation, children: [
|
|
4975
5010
|
tabs.map((tab, index) => {
|
|
4976
5011
|
const isActive = active === tab.value;
|
|
4977
5012
|
const Icon = tab.icon;
|
|
4978
|
-
const
|
|
4979
|
-
const
|
|
5013
|
+
const tabId2 = `${baseId}-tab-${index}`;
|
|
5014
|
+
const panelId2 = `${baseId}-panel-${index}`;
|
|
4980
5015
|
return /* @__PURE__ */ jsxs19(
|
|
4981
5016
|
"button",
|
|
4982
5017
|
{
|
|
@@ -5004,9 +5039,9 @@ var Tabs = ({
|
|
|
5004
5039
|
stretch && orientation === "horizontal" && "flex-1 justify-center"
|
|
5005
5040
|
),
|
|
5006
5041
|
role: "tab",
|
|
5007
|
-
id:
|
|
5042
|
+
id: tabId2,
|
|
5008
5043
|
"aria-selected": isActive,
|
|
5009
|
-
"aria-controls":
|
|
5044
|
+
"aria-controls": panelId2,
|
|
5010
5045
|
tabIndex: isActive ? 0 : -1,
|
|
5011
5046
|
onKeyDown: (e) => {
|
|
5012
5047
|
const count = tabs.length;
|
|
@@ -5042,17 +5077,10 @@ var Tabs = ({
|
|
|
5042
5077
|
"div",
|
|
5043
5078
|
{
|
|
5044
5079
|
role: "tabpanel",
|
|
5045
|
-
id:
|
|
5046
|
-
"aria-labelledby":
|
|
5047
|
-
className: cn(
|
|
5048
|
-
|
|
5049
|
-
"backdrop-blur-sm",
|
|
5050
|
-
"max-md:bg-transparent max-md:border-0 max-md:shadow-none max-md:rounded-none max-md:backdrop-blur-none",
|
|
5051
|
-
sizeStyles6[size].content,
|
|
5052
|
-
orientation === "vertical" && "flex-1"
|
|
5053
|
-
),
|
|
5054
|
-
tabIndex: 0,
|
|
5055
|
-
children: activeTab?.content
|
|
5080
|
+
id: panelId,
|
|
5081
|
+
"aria-labelledby": tabId,
|
|
5082
|
+
className: cn("transition-all duration-200", contentWrapperClasses),
|
|
5083
|
+
children: animateContent ? /* @__PURE__ */ jsx23("div", { className: "animate-fade-in", children: activeTab?.content }, activeTab?.value) : activeTab?.content
|
|
5056
5084
|
}
|
|
5057
5085
|
)
|
|
5058
5086
|
] });
|
|
@@ -5064,11 +5092,11 @@ var PillTabs = ({ contained = true, ...props }) => {
|
|
|
5064
5092
|
return /* @__PURE__ */ jsx23(Tabs, { ...props, variant: "pills", className: cn(contained && "max-w-fit", props.className) });
|
|
5065
5093
|
};
|
|
5066
5094
|
var VerticalTabs = ({ sidebarWidth = "w-48", className, ...props }) => {
|
|
5067
|
-
return /* @__PURE__ */ jsx23("div", { className: cn("
|
|
5095
|
+
return /* @__PURE__ */ jsx23("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx23(Tabs, { ...props, orientation: "vertical", variant: "card", className: sidebarWidth }) });
|
|
5068
5096
|
};
|
|
5069
5097
|
|
|
5070
5098
|
// src/components/DropdownMenu.tsx
|
|
5071
|
-
import
|
|
5099
|
+
import React20, { useState as useState15 } from "react";
|
|
5072
5100
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5073
5101
|
var DropdownMenu = ({
|
|
5074
5102
|
trigger,
|
|
@@ -5083,17 +5111,17 @@ var DropdownMenu = ({
|
|
|
5083
5111
|
items
|
|
5084
5112
|
}) => {
|
|
5085
5113
|
const [internalOpen, setInternalOpen] = useState15(false);
|
|
5086
|
-
const triggerRef =
|
|
5087
|
-
const menuRef =
|
|
5088
|
-
const itemsRef =
|
|
5114
|
+
const triggerRef = React20.useRef(null);
|
|
5115
|
+
const menuRef = React20.useRef(null);
|
|
5116
|
+
const itemsRef = React20.useRef([]);
|
|
5089
5117
|
const [activeIndex, setActiveIndex] = useState15(-1);
|
|
5090
5118
|
useShadCNAnimations();
|
|
5091
5119
|
const open = isOpen !== void 0 ? isOpen : internalOpen;
|
|
5092
5120
|
const setOpen = onOpenChange || setInternalOpen;
|
|
5093
|
-
|
|
5121
|
+
React20.useEffect(() => {
|
|
5094
5122
|
if (open) setActiveIndex(-1);
|
|
5095
5123
|
}, [open]);
|
|
5096
|
-
|
|
5124
|
+
React20.useEffect(() => {
|
|
5097
5125
|
if (!open) return;
|
|
5098
5126
|
const handleKeyNav = (e) => {
|
|
5099
5127
|
const active = document.activeElement;
|
|
@@ -5167,7 +5195,7 @@ var DropdownMenu = ({
|
|
|
5167
5195
|
index
|
|
5168
5196
|
);
|
|
5169
5197
|
}) : children });
|
|
5170
|
-
const enhancedTrigger =
|
|
5198
|
+
const enhancedTrigger = React20.cloneElement(trigger, {
|
|
5171
5199
|
ref: triggerRef,
|
|
5172
5200
|
"aria-haspopup": "menu",
|
|
5173
5201
|
"aria-expanded": open,
|
|
@@ -5276,11 +5304,11 @@ var SelectDropdown = ({ options, value, onChange, placeholder = "Select...", cla
|
|
|
5276
5304
|
var DropdownMenu_default = DropdownMenu;
|
|
5277
5305
|
|
|
5278
5306
|
// src/components/Pagination.tsx
|
|
5279
|
-
import * as
|
|
5307
|
+
import * as React23 from "react";
|
|
5280
5308
|
import { ChevronLeft, ChevronRight as ChevronRight2, ChevronsLeft, ChevronsRight } from "lucide-react";
|
|
5281
5309
|
|
|
5282
5310
|
// src/components/Combobox.tsx
|
|
5283
|
-
import * as
|
|
5311
|
+
import * as React22 from "react";
|
|
5284
5312
|
import { useId as useId3 } from "react";
|
|
5285
5313
|
import { ChevronDown, Search as Search3, SearchX, Check as Check3, X as X8 } from "lucide-react";
|
|
5286
5314
|
|
|
@@ -5583,23 +5611,23 @@ var Combobox = ({
|
|
|
5583
5611
|
helperText,
|
|
5584
5612
|
useOverlayScrollbar = false
|
|
5585
5613
|
}) => {
|
|
5586
|
-
const [open, setOpen] =
|
|
5587
|
-
const [query, setQuery] =
|
|
5588
|
-
const [activeIndex, setActiveIndex] =
|
|
5614
|
+
const [open, setOpen] = React22.useState(false);
|
|
5615
|
+
const [query, setQuery] = React22.useState("");
|
|
5616
|
+
const [activeIndex, setActiveIndex] = React22.useState(null);
|
|
5589
5617
|
useShadCNAnimations();
|
|
5590
|
-
const listRef =
|
|
5591
|
-
const inputRef =
|
|
5592
|
-
const optionsViewportRef =
|
|
5618
|
+
const listRef = React22.useRef([]);
|
|
5619
|
+
const inputRef = React22.useRef(null);
|
|
5620
|
+
const optionsViewportRef = React22.useRef(null);
|
|
5593
5621
|
useOverlayScrollbarTarget(optionsViewportRef, { enabled: useOverlayScrollbar });
|
|
5594
5622
|
const autoId = useId3();
|
|
5595
5623
|
const resolvedId = id ? String(id) : `combobox-${autoId}`;
|
|
5596
5624
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
5597
5625
|
const enableSearch = options.length > 10;
|
|
5598
|
-
const filteredOptions =
|
|
5626
|
+
const filteredOptions = React22.useMemo(
|
|
5599
5627
|
() => enableSearch ? options.filter((o) => getOptionLabel(o).toLowerCase().includes(query.trim().toLowerCase())) : options,
|
|
5600
5628
|
[options, query, enableSearch]
|
|
5601
5629
|
);
|
|
5602
|
-
const triggerRef =
|
|
5630
|
+
const triggerRef = React22.useRef(null);
|
|
5603
5631
|
const handleSelect = (option) => {
|
|
5604
5632
|
if (getOptionDisabled(option)) return;
|
|
5605
5633
|
const val = getOptionValue(option);
|
|
@@ -5614,7 +5642,7 @@ var Combobox = ({
|
|
|
5614
5642
|
onChange(null);
|
|
5615
5643
|
setOpen(false);
|
|
5616
5644
|
};
|
|
5617
|
-
|
|
5645
|
+
React22.useEffect(() => {
|
|
5618
5646
|
if (!open) {
|
|
5619
5647
|
setQuery("");
|
|
5620
5648
|
setActiveIndex(null);
|
|
@@ -5627,7 +5655,7 @@ var Combobox = ({
|
|
|
5627
5655
|
const selectedOption = findOptionByValue(options, value);
|
|
5628
5656
|
const displayValue = selectedOption ? getOptionLabel(selectedOption) : "";
|
|
5629
5657
|
const selectedIcon = selectedOption ? getOptionIcon(selectedOption) : void 0;
|
|
5630
|
-
const groupedOptions =
|
|
5658
|
+
const groupedOptions = React22.useMemo(() => {
|
|
5631
5659
|
if (!groupBy) return null;
|
|
5632
5660
|
const groups = {};
|
|
5633
5661
|
filteredOptions.forEach((opt) => {
|
|
@@ -5973,7 +6001,7 @@ var Pagination = ({
|
|
|
5973
6001
|
labels
|
|
5974
6002
|
}) => {
|
|
5975
6003
|
const t = useSmartTranslations("Pagination");
|
|
5976
|
-
|
|
6004
|
+
React23.useEffect(() => {
|
|
5977
6005
|
if (disabled) return;
|
|
5978
6006
|
const handleKey = (e) => {
|
|
5979
6007
|
if (e.target && e.target.tagName === "INPUT") return;
|
|
@@ -6276,17 +6304,17 @@ var CompactPagination = ({ page, totalPages, onChange, className, disabled = fal
|
|
|
6276
6304
|
};
|
|
6277
6305
|
|
|
6278
6306
|
// src/components/Section.tsx
|
|
6279
|
-
import
|
|
6307
|
+
import React24 from "react";
|
|
6280
6308
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
6281
6309
|
var gradientDirectionMap = {
|
|
6282
|
-
"to-r": "
|
|
6283
|
-
"to-l": "
|
|
6284
|
-
"to-b": "
|
|
6285
|
-
"to-t": "
|
|
6286
|
-
"to-br": "
|
|
6287
|
-
"to-bl": "
|
|
6288
|
-
"to-tr": "
|
|
6289
|
-
"to-tl": "
|
|
6310
|
+
"to-r": "to right",
|
|
6311
|
+
"to-l": "to left",
|
|
6312
|
+
"to-b": "to bottom",
|
|
6313
|
+
"to-t": "to top",
|
|
6314
|
+
"to-br": "to bottom right",
|
|
6315
|
+
"to-bl": "to bottom left",
|
|
6316
|
+
"to-tr": "to top right",
|
|
6317
|
+
"to-tl": "to top left"
|
|
6290
6318
|
};
|
|
6291
6319
|
var spacingClasses = {
|
|
6292
6320
|
none: "",
|
|
@@ -6297,50 +6325,50 @@ var spacingClasses = {
|
|
|
6297
6325
|
};
|
|
6298
6326
|
var paddingXClasses = {
|
|
6299
6327
|
none: "",
|
|
6300
|
-
sm: "px-
|
|
6328
|
+
sm: "px-3 md:px-4",
|
|
6301
6329
|
md: "px-4 md:px-6",
|
|
6302
|
-
lg: "px-
|
|
6303
|
-
xl: "px-
|
|
6330
|
+
lg: "px-5 md:px-8",
|
|
6331
|
+
xl: "px-6 md:px-12"
|
|
6304
6332
|
};
|
|
6305
|
-
var
|
|
6333
|
+
var variantClasses = {
|
|
6334
|
+
default: "bg-background",
|
|
6335
|
+
muted: "bg-muted/30",
|
|
6336
|
+
primary: "bg-primary/5",
|
|
6337
|
+
accent: "bg-accent/10",
|
|
6338
|
+
gradient: ""
|
|
6339
|
+
};
|
|
6340
|
+
var Section = React24.forwardRef(
|
|
6306
6341
|
({
|
|
6307
6342
|
children,
|
|
6308
6343
|
className,
|
|
6344
|
+
as: Tag = "section",
|
|
6309
6345
|
variant = "default",
|
|
6310
6346
|
spacing = "none",
|
|
6311
6347
|
paddingX = "none",
|
|
6312
6348
|
contained = false,
|
|
6349
|
+
containerClassName,
|
|
6313
6350
|
outlined = false,
|
|
6314
|
-
gradientFrom = "
|
|
6315
|
-
gradientTo = "
|
|
6351
|
+
gradientFrom = "oklch(0.7 0.15 280 / 20%)",
|
|
6352
|
+
gradientTo = "oklch(0.7 0.2 200 / 20%)",
|
|
6316
6353
|
gradientDirection = "to-br",
|
|
6354
|
+
style,
|
|
6317
6355
|
...props
|
|
6318
6356
|
}, ref) => {
|
|
6319
|
-
const
|
|
6320
|
-
default: "bg-background",
|
|
6321
|
-
muted: "bg-muted/30",
|
|
6322
|
-
primary: "bg-primary/5",
|
|
6323
|
-
accent: "bg-accent/10",
|
|
6324
|
-
gradient: ""
|
|
6325
|
-
};
|
|
6326
|
-
const getGradientClasses = () => {
|
|
6327
|
-
if (variant !== "gradient") return "";
|
|
6328
|
-
return cn(gradientDirectionMap[gradientDirection], gradientFrom, gradientTo);
|
|
6329
|
-
};
|
|
6357
|
+
const gradientStyle = variant === "gradient" ? { backgroundImage: `linear-gradient(${gradientDirectionMap[gradientDirection]}, ${gradientFrom}, ${gradientTo})` } : {};
|
|
6330
6358
|
return /* @__PURE__ */ jsx28(
|
|
6331
|
-
|
|
6359
|
+
Tag,
|
|
6332
6360
|
{
|
|
6333
6361
|
ref,
|
|
6334
6362
|
className: cn(
|
|
6335
|
-
variant
|
|
6363
|
+
variant !== "gradient" && variantClasses[variant],
|
|
6336
6364
|
spacingClasses[spacing],
|
|
6337
|
-
paddingXClasses[paddingX],
|
|
6365
|
+
!contained && paddingXClasses[paddingX],
|
|
6338
6366
|
outlined && "rounded-2xl md:rounded-3xl border border-border/60 max-md:rounded-xl",
|
|
6339
|
-
contained && "container mx-auto",
|
|
6340
6367
|
className
|
|
6341
6368
|
),
|
|
6369
|
+
style: { ...gradientStyle, ...style },
|
|
6342
6370
|
...props,
|
|
6343
|
-
children
|
|
6371
|
+
children: contained ? /* @__PURE__ */ jsx28("div", { className: cn("container mx-auto", paddingXClasses[paddingX], containerClassName), children }) : children
|
|
6344
6372
|
}
|
|
6345
6373
|
);
|
|
6346
6374
|
}
|
|
@@ -6351,7 +6379,7 @@ var Section_default = Section;
|
|
|
6351
6379
|
// src/components/ScrollArea.tsx
|
|
6352
6380
|
import { forwardRef as forwardRef6, useRef as useRef9 } from "react";
|
|
6353
6381
|
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
6354
|
-
var
|
|
6382
|
+
var variantClasses2 = {
|
|
6355
6383
|
default: "bg-background",
|
|
6356
6384
|
muted: "bg-muted/30",
|
|
6357
6385
|
primary: "bg-primary/5",
|
|
@@ -6367,7 +6395,7 @@ var ScrollArea = forwardRef6(
|
|
|
6367
6395
|
ref,
|
|
6368
6396
|
className: cn(
|
|
6369
6397
|
"relative overflow-hidden rounded-2xl md:rounded-3xl",
|
|
6370
|
-
|
|
6398
|
+
variantClasses2[variant],
|
|
6371
6399
|
outlined && "border border-border/60",
|
|
6372
6400
|
className
|
|
6373
6401
|
),
|
|
@@ -6618,7 +6646,7 @@ function formatDateSmart(date, locale = "en") {
|
|
|
6618
6646
|
|
|
6619
6647
|
// src/components/DatePicker.tsx
|
|
6620
6648
|
import { Calendar, ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3, Sparkles as Sparkles2, X as XIcon } from "lucide-react";
|
|
6621
|
-
import * as
|
|
6649
|
+
import * as React26 from "react";
|
|
6622
6650
|
import { useId as useId4 } from "react";
|
|
6623
6651
|
import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6624
6652
|
var DatePicker = ({
|
|
@@ -6641,19 +6669,19 @@ var DatePicker = ({
|
|
|
6641
6669
|
}) => {
|
|
6642
6670
|
const t = useSmartTranslations("DatePicker");
|
|
6643
6671
|
const locale = useSmartLocale();
|
|
6644
|
-
const [isOpen, setIsOpen] =
|
|
6645
|
-
const [viewDate, setViewDate] =
|
|
6646
|
-
const [viewMode, setViewMode] =
|
|
6647
|
-
const triggerRef =
|
|
6648
|
-
const wheelContainerRef =
|
|
6649
|
-
const wheelDeltaRef =
|
|
6650
|
-
const normalizeToLocalDay =
|
|
6672
|
+
const [isOpen, setIsOpen] = React26.useState(false);
|
|
6673
|
+
const [viewDate, setViewDate] = React26.useState(value || /* @__PURE__ */ new Date());
|
|
6674
|
+
const [viewMode, setViewMode] = React26.useState("calendar");
|
|
6675
|
+
const triggerRef = React26.useRef(null);
|
|
6676
|
+
const wheelContainerRef = React26.useRef(null);
|
|
6677
|
+
const wheelDeltaRef = React26.useRef(0);
|
|
6678
|
+
const normalizeToLocalDay = React26.useCallback((date) => {
|
|
6651
6679
|
if (!date) return null;
|
|
6652
6680
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
6653
6681
|
}, []);
|
|
6654
|
-
const minDay =
|
|
6655
|
-
const maxDay =
|
|
6656
|
-
const isDateDisabled =
|
|
6682
|
+
const minDay = React26.useMemo(() => normalizeToLocalDay(minDate), [minDate, normalizeToLocalDay]);
|
|
6683
|
+
const maxDay = React26.useMemo(() => normalizeToLocalDay(maxDate), [maxDate, normalizeToLocalDay]);
|
|
6684
|
+
const isDateDisabled = React26.useCallback(
|
|
6657
6685
|
(date) => {
|
|
6658
6686
|
const day = normalizeToLocalDay(date);
|
|
6659
6687
|
if (!day) return false;
|
|
@@ -6722,14 +6750,14 @@ var DatePicker = ({
|
|
|
6722
6750
|
footerMargin: "mt-5 pt-4 gap-2.5"
|
|
6723
6751
|
}
|
|
6724
6752
|
};
|
|
6725
|
-
|
|
6753
|
+
React26.useEffect(() => {
|
|
6726
6754
|
if (value) {
|
|
6727
6755
|
setViewDate(value);
|
|
6728
6756
|
} else {
|
|
6729
6757
|
setViewDate(/* @__PURE__ */ new Date());
|
|
6730
6758
|
}
|
|
6731
6759
|
}, [value]);
|
|
6732
|
-
|
|
6760
|
+
React26.useEffect(() => {
|
|
6733
6761
|
if (!isOpen) {
|
|
6734
6762
|
setViewMode("calendar");
|
|
6735
6763
|
}
|
|
@@ -6758,7 +6786,7 @@ var DatePicker = ({
|
|
|
6758
6786
|
const getFirstDayOfMonth = (date) => {
|
|
6759
6787
|
return new Date(date.getFullYear(), date.getMonth(), 1).getDay();
|
|
6760
6788
|
};
|
|
6761
|
-
const navigateMonth =
|
|
6789
|
+
const navigateMonth = React26.useCallback((direction) => {
|
|
6762
6790
|
setViewDate((prev) => {
|
|
6763
6791
|
const newDate = new Date(prev);
|
|
6764
6792
|
newDate.setMonth(prev.getMonth() + (direction === "next" ? 1 : -1));
|
|
@@ -6772,7 +6800,7 @@ var DatePicker = ({
|
|
|
6772
6800
|
const node = el;
|
|
6773
6801
|
return node.scrollHeight > node.clientHeight + 1;
|
|
6774
6802
|
};
|
|
6775
|
-
|
|
6803
|
+
React26.useEffect(() => {
|
|
6776
6804
|
if (!isOpen) return;
|
|
6777
6805
|
const container = wheelContainerRef.current;
|
|
6778
6806
|
if (!container) return;
|
|
@@ -7148,9 +7176,9 @@ var DatePicker = ({
|
|
|
7148
7176
|
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false, minDate, maxDate, size = "md" }) => {
|
|
7149
7177
|
const locale = useSmartLocale();
|
|
7150
7178
|
const t = useSmartTranslations("DatePicker");
|
|
7151
|
-
const [isOpen, setIsOpen] =
|
|
7152
|
-
const wheelContainerRef =
|
|
7153
|
-
const wheelDeltaRef =
|
|
7179
|
+
const [isOpen, setIsOpen] = React26.useState(false);
|
|
7180
|
+
const wheelContainerRef = React26.useRef(null);
|
|
7181
|
+
const wheelDeltaRef = React26.useRef(0);
|
|
7154
7182
|
const sizeStyles8 = {
|
|
7155
7183
|
sm: {
|
|
7156
7184
|
trigger: "px-2.5 py-1.5 text-sm h-8 md:h-7 md:text-xs md:py-1",
|
|
@@ -7208,16 +7236,16 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
7208
7236
|
if (!date) return null;
|
|
7209
7237
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
7210
7238
|
};
|
|
7211
|
-
const minDay =
|
|
7212
|
-
const maxDay =
|
|
7213
|
-
const [viewDate, setViewDate] =
|
|
7214
|
-
const [tempStart, setTempStart] =
|
|
7215
|
-
const [tempEnd, setTempEnd] =
|
|
7216
|
-
const [hoveredDate, setHoveredDate] =
|
|
7217
|
-
|
|
7239
|
+
const minDay = React26.useMemo(() => normalizeToLocal(minDate), [minDate]);
|
|
7240
|
+
const maxDay = React26.useMemo(() => normalizeToLocal(maxDate), [maxDate]);
|
|
7241
|
+
const [viewDate, setViewDate] = React26.useState(startDate || /* @__PURE__ */ new Date());
|
|
7242
|
+
const [tempStart, setTempStart] = React26.useState(normalizeToLocal(startDate));
|
|
7243
|
+
const [tempEnd, setTempEnd] = React26.useState(normalizeToLocal(endDate));
|
|
7244
|
+
const [hoveredDate, setHoveredDate] = React26.useState(null);
|
|
7245
|
+
React26.useEffect(() => {
|
|
7218
7246
|
setTempStart(normalizeToLocal(startDate));
|
|
7219
7247
|
}, [startDate]);
|
|
7220
|
-
|
|
7248
|
+
React26.useEffect(() => {
|
|
7221
7249
|
setTempEnd(normalizeToLocal(endDate));
|
|
7222
7250
|
}, [endDate]);
|
|
7223
7251
|
const isSameDay2 = (a, b) => {
|
|
@@ -7227,7 +7255,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
7227
7255
|
const inRange = (d, s, e) => d > s && d < e;
|
|
7228
7256
|
const getDaysInMonth = (d) => new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();
|
|
7229
7257
|
const getFirstDayOfMonth = (d) => new Date(d.getFullYear(), d.getMonth(), 1).getDay();
|
|
7230
|
-
const navigateMonth =
|
|
7258
|
+
const navigateMonth = React26.useCallback((direction) => {
|
|
7231
7259
|
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() + (direction === "next" ? 1 : -1), 1));
|
|
7232
7260
|
}, []);
|
|
7233
7261
|
const isElementVerticallyScrollable = (el) => {
|
|
@@ -7237,7 +7265,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
7237
7265
|
const node = el;
|
|
7238
7266
|
return node.scrollHeight > node.clientHeight + 1;
|
|
7239
7267
|
};
|
|
7240
|
-
|
|
7268
|
+
React26.useEffect(() => {
|
|
7241
7269
|
if (!isOpen) return;
|
|
7242
7270
|
const container = wheelContainerRef.current;
|
|
7243
7271
|
if (!container) return;
|
|
@@ -7475,15 +7503,15 @@ var CompactDatePicker = ({ value, onChange, className }) => {
|
|
|
7475
7503
|
};
|
|
7476
7504
|
|
|
7477
7505
|
// src/components/DateTimePicker.tsx
|
|
7478
|
-
import * as
|
|
7506
|
+
import * as React30 from "react";
|
|
7479
7507
|
import { Calendar as CalendarIcon, X as X11 } from "lucide-react";
|
|
7480
7508
|
|
|
7481
7509
|
// src/components/Calendar.tsx
|
|
7482
7510
|
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight4 } from "lucide-react";
|
|
7483
|
-
import * as
|
|
7511
|
+
import * as React28 from "react";
|
|
7484
7512
|
|
|
7485
7513
|
// src/components/MonthYearPicker.tsx
|
|
7486
|
-
import * as
|
|
7514
|
+
import * as React27 from "react";
|
|
7487
7515
|
import { Calendar as Calendar2, X as X9, Check as Check4, ChevronDown as ChevronDown2 } from "lucide-react";
|
|
7488
7516
|
import { jsx as jsx32, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7489
7517
|
var DEFAULT_MONTH_NAMES = [
|
|
@@ -7526,20 +7554,20 @@ function WheelColumn({
|
|
|
7526
7554
|
}) {
|
|
7527
7555
|
const height = itemHeight * WHEEL_VISIBLE_ITEMS;
|
|
7528
7556
|
const paddingY = (height - itemHeight) / 2;
|
|
7529
|
-
const rafRef =
|
|
7530
|
-
const lastVirtualIndexRef =
|
|
7531
|
-
const wheelDeltaRef =
|
|
7532
|
-
const scrollEndTimeoutRef =
|
|
7533
|
-
const suppressScrollSelectUntilRef =
|
|
7534
|
-
const suppressItemClickUntilRef =
|
|
7535
|
-
const dragRef =
|
|
7536
|
-
const draggingRef =
|
|
7537
|
-
const inertialRef =
|
|
7538
|
-
const inertiaRafRef =
|
|
7539
|
-
const inertiaVelocityRef =
|
|
7540
|
-
const inertiaLastTimeRef =
|
|
7541
|
-
const moveSamplesRef =
|
|
7542
|
-
const ui =
|
|
7557
|
+
const rafRef = React27.useRef(0);
|
|
7558
|
+
const lastVirtualIndexRef = React27.useRef(null);
|
|
7559
|
+
const wheelDeltaRef = React27.useRef(0);
|
|
7560
|
+
const scrollEndTimeoutRef = React27.useRef(null);
|
|
7561
|
+
const suppressScrollSelectUntilRef = React27.useRef(0);
|
|
7562
|
+
const suppressItemClickUntilRef = React27.useRef(0);
|
|
7563
|
+
const dragRef = React27.useRef(null);
|
|
7564
|
+
const draggingRef = React27.useRef(false);
|
|
7565
|
+
const inertialRef = React27.useRef(false);
|
|
7566
|
+
const inertiaRafRef = React27.useRef(null);
|
|
7567
|
+
const inertiaVelocityRef = React27.useRef(0);
|
|
7568
|
+
const inertiaLastTimeRef = React27.useRef(0);
|
|
7569
|
+
const moveSamplesRef = React27.useRef([]);
|
|
7570
|
+
const ui = React27.useMemo(() => {
|
|
7543
7571
|
if (size === "sm") {
|
|
7544
7572
|
return {
|
|
7545
7573
|
columnWidth: column === "month" ? "min-w-24 max-w-32" : "min-w-16 max-w-20",
|
|
@@ -7566,9 +7594,9 @@ function WheelColumn({
|
|
|
7566
7594
|
fadeHeight: "h-12"
|
|
7567
7595
|
};
|
|
7568
7596
|
}, [size, column]);
|
|
7569
|
-
const baseOffset =
|
|
7570
|
-
const extendedItems =
|
|
7571
|
-
const getNearestVirtualIndex =
|
|
7597
|
+
const baseOffset = React27.useMemo(() => loop ? items.length : 0, [items.length, loop]);
|
|
7598
|
+
const extendedItems = React27.useMemo(() => loop ? [...items, ...items, ...items] : items, [items, loop]);
|
|
7599
|
+
const getNearestVirtualIndex = React27.useCallback(
|
|
7572
7600
|
(realIndex, fromVirtual) => {
|
|
7573
7601
|
const len = items.length;
|
|
7574
7602
|
if (len <= 0) return 0;
|
|
@@ -7587,7 +7615,7 @@ function WheelColumn({
|
|
|
7587
7615
|
},
|
|
7588
7616
|
[items.length, loop]
|
|
7589
7617
|
);
|
|
7590
|
-
|
|
7618
|
+
React27.useLayoutEffect(() => {
|
|
7591
7619
|
const el = scrollRef.current;
|
|
7592
7620
|
if (!el) return;
|
|
7593
7621
|
const maxVirtual = Math.max(0, extendedItems.length - 1);
|
|
@@ -7615,7 +7643,7 @@ function WheelColumn({
|
|
|
7615
7643
|
cancelAnimationFrame(rafRef.current);
|
|
7616
7644
|
};
|
|
7617
7645
|
}, [animate, baseOffset, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
7618
|
-
|
|
7646
|
+
React27.useEffect(() => {
|
|
7619
7647
|
const el = scrollRef.current;
|
|
7620
7648
|
if (!el) return;
|
|
7621
7649
|
const lastWheelSignRef = { current: 0 };
|
|
@@ -7703,13 +7731,13 @@ function WheelColumn({
|
|
|
7703
7731
|
}, 120);
|
|
7704
7732
|
});
|
|
7705
7733
|
};
|
|
7706
|
-
const currentVirtual =
|
|
7734
|
+
const currentVirtual = React27.useMemo(() => {
|
|
7707
7735
|
if (!loop || items.length <= 0) return valueIndex;
|
|
7708
7736
|
const fallback = baseOffset + valueIndex;
|
|
7709
7737
|
const from = lastVirtualIndexRef.current ?? fallback;
|
|
7710
7738
|
return getNearestVirtualIndex(valueIndex, from);
|
|
7711
7739
|
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
7712
|
-
const commitFromScrollTop =
|
|
7740
|
+
const commitFromScrollTop = React27.useCallback(
|
|
7713
7741
|
(behavior) => {
|
|
7714
7742
|
const el = scrollRef.current;
|
|
7715
7743
|
if (!el) return;
|
|
@@ -7787,7 +7815,7 @@ function WheelColumn({
|
|
|
7787
7815
|
if (dt > 0) inertiaVelocityRef.current = (el.scrollTop - oldest.top) / dt;
|
|
7788
7816
|
}
|
|
7789
7817
|
};
|
|
7790
|
-
const startInertia =
|
|
7818
|
+
const startInertia = React27.useCallback(() => {
|
|
7791
7819
|
const el = scrollRef.current;
|
|
7792
7820
|
if (!el) return;
|
|
7793
7821
|
if (items.length <= 0) return;
|
|
@@ -7978,22 +8006,22 @@ function MonthYearPicker({
|
|
|
7978
8006
|
};
|
|
7979
8007
|
const isControlled = value !== void 0;
|
|
7980
8008
|
const initial = parseValue(isControlled ? value : defaultValue) ?? { month: now.getMonth(), year: currentYear };
|
|
7981
|
-
const [open, setOpen] =
|
|
7982
|
-
const [parts, setParts] =
|
|
7983
|
-
const [focusedColumn, setFocusedColumn] =
|
|
7984
|
-
const monthScrollRef =
|
|
7985
|
-
const yearScrollRef =
|
|
7986
|
-
|
|
8009
|
+
const [open, setOpen] = React27.useState(false);
|
|
8010
|
+
const [parts, setParts] = React27.useState(initial);
|
|
8011
|
+
const [focusedColumn, setFocusedColumn] = React27.useState(null);
|
|
8012
|
+
const monthScrollRef = React27.useRef(null);
|
|
8013
|
+
const yearScrollRef = React27.useRef(null);
|
|
8014
|
+
React27.useEffect(() => {
|
|
7987
8015
|
if (isControlled) {
|
|
7988
8016
|
const parsed = parseValue(value);
|
|
7989
8017
|
if (parsed) setParts(parsed);
|
|
7990
8018
|
}
|
|
7991
8019
|
}, [value, isControlled]);
|
|
7992
|
-
const years =
|
|
8020
|
+
const years = React27.useMemo(() => {
|
|
7993
8021
|
return Array.from({ length: resolvedMaxYear - resolvedMinYear + 1 }, (_, i) => resolvedMinYear + i);
|
|
7994
8022
|
}, [resolvedMinYear, resolvedMaxYear]);
|
|
7995
|
-
const months =
|
|
7996
|
-
const isDateInRange =
|
|
8023
|
+
const months = React27.useMemo(() => Array.from({ length: 12 }, (_, i) => i), []);
|
|
8024
|
+
const isDateInRange = React27.useCallback(
|
|
7997
8025
|
(month, year) => {
|
|
7998
8026
|
if (minDate) {
|
|
7999
8027
|
const minMonth = minDate.getMonth();
|
|
@@ -8009,7 +8037,7 @@ function MonthYearPicker({
|
|
|
8009
8037
|
},
|
|
8010
8038
|
[minDate, maxDate]
|
|
8011
8039
|
);
|
|
8012
|
-
const emit =
|
|
8040
|
+
const emit = React27.useCallback(
|
|
8013
8041
|
(next) => {
|
|
8014
8042
|
if (!next) {
|
|
8015
8043
|
onChange?.(void 0);
|
|
@@ -8021,7 +8049,7 @@ function MonthYearPicker({
|
|
|
8021
8049
|
},
|
|
8022
8050
|
[isDateInRange, onChange]
|
|
8023
8051
|
);
|
|
8024
|
-
const tryUpdate =
|
|
8052
|
+
const tryUpdate = React27.useCallback(
|
|
8025
8053
|
(next) => {
|
|
8026
8054
|
if (!isDateInRange(next.month, next.year)) return false;
|
|
8027
8055
|
setParts(next);
|
|
@@ -8412,12 +8440,12 @@ function Calendar3({
|
|
|
8412
8440
|
...rest
|
|
8413
8441
|
}) {
|
|
8414
8442
|
const isControlledMonth = month != null;
|
|
8415
|
-
const [view, setView] =
|
|
8416
|
-
|
|
8443
|
+
const [view, setView] = React28.useState(() => month ?? defaultMonth ?? /* @__PURE__ */ new Date());
|
|
8444
|
+
React28.useEffect(() => {
|
|
8417
8445
|
if (isControlledMonth && month) setView(month);
|
|
8418
8446
|
}, [isControlledMonth, month]);
|
|
8419
8447
|
const isControlledValue = value !== void 0;
|
|
8420
|
-
const [internal, setInternal] =
|
|
8448
|
+
const [internal, setInternal] = React28.useState(defaultValue);
|
|
8421
8449
|
const selected = isControlledValue ? value : internal;
|
|
8422
8450
|
const goByView = (delta) => {
|
|
8423
8451
|
const next = display === "week" ? addDays(view, delta * 7) : addMonths(view, delta);
|
|
@@ -8429,7 +8457,7 @@ function Calendar3({
|
|
|
8429
8457
|
const weekdays = rotate(weekNames, weekStartsOn);
|
|
8430
8458
|
const days = getMonthGrid(view, weekStartsOn);
|
|
8431
8459
|
const today = /* @__PURE__ */ new Date();
|
|
8432
|
-
const byDay =
|
|
8460
|
+
const byDay = React28.useMemo(() => {
|
|
8433
8461
|
const map = /* @__PURE__ */ new Map();
|
|
8434
8462
|
for (const e of events) {
|
|
8435
8463
|
const d = toDate(e.date);
|
|
@@ -8441,11 +8469,11 @@ function Calendar3({
|
|
|
8441
8469
|
}, [events]);
|
|
8442
8470
|
const effectiveEnableEventSheet = enableEventSheet ?? !!renderEventSheet;
|
|
8443
8471
|
const isEventSheetOpenControlled = eventSheetOpen !== void 0;
|
|
8444
|
-
const [internalEventSheetOpen, setInternalEventSheetOpen] =
|
|
8472
|
+
const [internalEventSheetOpen, setInternalEventSheetOpen] = React28.useState(false);
|
|
8445
8473
|
const activeEventSheetOpen = isEventSheetOpenControlled ? !!eventSheetOpen : internalEventSheetOpen;
|
|
8446
8474
|
const isSelectedEventControlled = selectedEventId !== void 0;
|
|
8447
|
-
const [internalSelectedEventRef, setInternalSelectedEventRef] =
|
|
8448
|
-
const setEventSheetOpen =
|
|
8475
|
+
const [internalSelectedEventRef, setInternalSelectedEventRef] = React28.useState(null);
|
|
8476
|
+
const setEventSheetOpen = React28.useCallback(
|
|
8449
8477
|
(open) => {
|
|
8450
8478
|
if (!isEventSheetOpenControlled) setInternalEventSheetOpen(open);
|
|
8451
8479
|
onEventSheetOpenChange?.(open);
|
|
@@ -8456,7 +8484,7 @@ function Calendar3({
|
|
|
8456
8484
|
},
|
|
8457
8485
|
[isEventSheetOpenControlled, isSelectedEventControlled, onEventSheetOpenChange, onSelectedEventIdChange]
|
|
8458
8486
|
);
|
|
8459
|
-
const selectedEventRef =
|
|
8487
|
+
const selectedEventRef = React28.useMemo(() => {
|
|
8460
8488
|
if (isSelectedEventControlled && selectedEventId != null) {
|
|
8461
8489
|
const ev = events.find((e) => e.id === selectedEventId);
|
|
8462
8490
|
if (!ev) return null;
|
|
@@ -8466,7 +8494,7 @@ function Calendar3({
|
|
|
8466
8494
|
}
|
|
8467
8495
|
return internalSelectedEventRef;
|
|
8468
8496
|
}, [events, internalSelectedEventRef, isSelectedEventControlled, selectedEventId]);
|
|
8469
|
-
const selectedEvent =
|
|
8497
|
+
const selectedEvent = React28.useMemo(() => {
|
|
8470
8498
|
if (!selectedEventRef) return null;
|
|
8471
8499
|
const list = byDay.get(selectedEventRef.dayKey) || [];
|
|
8472
8500
|
if (selectedEventRef.eventId != null) {
|
|
@@ -8475,13 +8503,13 @@ function Calendar3({
|
|
|
8475
8503
|
const idx = selectedEventRef.index ?? -1;
|
|
8476
8504
|
return idx >= 0 && idx < list.length ? list[idx] : null;
|
|
8477
8505
|
}, [byDay, selectedEventRef]);
|
|
8478
|
-
const selectedEventDate =
|
|
8506
|
+
const selectedEventDate = React28.useMemo(() => {
|
|
8479
8507
|
if (!selectedEventRef) return null;
|
|
8480
8508
|
const [y, m, d] = selectedEventRef.dayKey.split("-").map((x) => Number(x));
|
|
8481
8509
|
if (!Number.isFinite(y) || !Number.isFinite(m) || !Number.isFinite(d)) return null;
|
|
8482
8510
|
return new Date(y, m, d);
|
|
8483
8511
|
}, [selectedEventRef]);
|
|
8484
|
-
const handleEventActivate =
|
|
8512
|
+
const handleEventActivate = React28.useCallback(
|
|
8485
8513
|
(event, date, dayKey, index) => {
|
|
8486
8514
|
onEventClick?.(event, date);
|
|
8487
8515
|
onSelectedEventIdChange?.(event.id ?? void 0);
|
|
@@ -8534,7 +8562,7 @@ function Calendar3({
|
|
|
8534
8562
|
}
|
|
8535
8563
|
}
|
|
8536
8564
|
};
|
|
8537
|
-
const isDateDisabled =
|
|
8565
|
+
const isDateDisabled = React28.useCallback(
|
|
8538
8566
|
(d) => {
|
|
8539
8567
|
if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
|
|
8540
8568
|
if (maxDate && d > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
|
|
@@ -8568,7 +8596,7 @@ function Calendar3({
|
|
|
8568
8596
|
card: "border border-border/50 rounded-3xl bg-linear-to-br from-card via-background/95 to-card shadow-lg hover:shadow-xl transition-shadow duration-300 backdrop-blur-md",
|
|
8569
8597
|
minimal: "bg-transparent"
|
|
8570
8598
|
};
|
|
8571
|
-
const weekDays =
|
|
8599
|
+
const weekDays = React28.useMemo(() => {
|
|
8572
8600
|
const s = startOfWeek(view, weekStartsOn);
|
|
8573
8601
|
return Array.from({ length: 7 }, (_, i) => addDays(s, i));
|
|
8574
8602
|
}, [view, weekStartsOn]);
|
|
@@ -8589,7 +8617,7 @@ function Calendar3({
|
|
|
8589
8617
|
const holidayMatch = isHoliday(d, holidays);
|
|
8590
8618
|
const isHolidayDay = highlightHolidays && !!holidayMatch;
|
|
8591
8619
|
const customDay = renderDay?.({ date: d, isCurrentMonth: inMonth, isToday: isToday2, isSelected: selectedDay, events: dayEvents });
|
|
8592
|
-
if (customDay) return /* @__PURE__ */ jsx33(
|
|
8620
|
+
if (customDay) return /* @__PURE__ */ jsx33(React28.Fragment, { children: customDay }, `${monthLabel}-${idx}`);
|
|
8593
8621
|
if (cellMode === "events") {
|
|
8594
8622
|
const limit = Math.max(0, maxEventsPerDay);
|
|
8595
8623
|
const visibleEvents = dayEvents.slice(0, limit);
|
|
@@ -8708,9 +8736,9 @@ function Calendar3({
|
|
|
8708
8736
|
}) })
|
|
8709
8737
|
] });
|
|
8710
8738
|
};
|
|
8711
|
-
const minBound =
|
|
8712
|
-
const maxBound =
|
|
8713
|
-
const prevDisabled =
|
|
8739
|
+
const minBound = React28.useMemo(() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()) : void 0, [minDate]);
|
|
8740
|
+
const maxBound = React28.useMemo(() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()) : void 0, [maxDate]);
|
|
8741
|
+
const prevDisabled = React28.useMemo(() => {
|
|
8714
8742
|
if (!minBound) return false;
|
|
8715
8743
|
if (display === "week") {
|
|
8716
8744
|
const start = startOfWeek(view, weekStartsOn);
|
|
@@ -8720,7 +8748,7 @@ function Calendar3({
|
|
|
8720
8748
|
const prevEnd = endOfMonth(addMonths(view, -1));
|
|
8721
8749
|
return prevEnd < minBound;
|
|
8722
8750
|
}, [display, view, weekStartsOn, minBound]);
|
|
8723
|
-
const nextDisabled =
|
|
8751
|
+
const nextDisabled = React28.useMemo(() => {
|
|
8724
8752
|
if (!maxBound) return false;
|
|
8725
8753
|
if (display === "week") {
|
|
8726
8754
|
const start = startOfWeek(view, weekStartsOn);
|
|
@@ -8797,7 +8825,7 @@ function Calendar3({
|
|
|
8797
8825
|
const holidayMatch = isHoliday(d, holidays);
|
|
8798
8826
|
const isHolidayDay = highlightHolidays && !!holidayMatch;
|
|
8799
8827
|
const customDay = renderDay?.({ date: d, isCurrentMonth: inMonth, isToday: isToday2, isSelected: selectedDay, events: dayEvents });
|
|
8800
|
-
if (customDay) return /* @__PURE__ */ jsx33(
|
|
8828
|
+
if (customDay) return /* @__PURE__ */ jsx33(React28.Fragment, { children: customDay }, `wd-${idx}`);
|
|
8801
8829
|
if (cellMode === "events") {
|
|
8802
8830
|
const limit = Math.max(0, maxEventsPerDay);
|
|
8803
8831
|
const visibleEvents = dayEvents.slice(0, limit);
|
|
@@ -8908,7 +8936,7 @@ function Calendar3({
|
|
|
8908
8936
|
`wd-${idx}`
|
|
8909
8937
|
);
|
|
8910
8938
|
}) })
|
|
8911
|
-
] }) : /* @__PURE__ */ jsx33("div", { className: cn(months > 1 ? "grid md:grid-cols-2 lg:grid-cols-3 gap-4" : ""), children: Array.from({ length: Math.max(1, months) }, (_, i) => /* @__PURE__ */ jsx33(
|
|
8939
|
+
] }) : /* @__PURE__ */ jsx33("div", { className: cn(months > 1 ? "grid md:grid-cols-2 lg:grid-cols-3 gap-4" : ""), children: Array.from({ length: Math.max(1, months) }, (_, i) => /* @__PURE__ */ jsx33(React28.Fragment, { children: renderMonth(addMonths(view, i)) }, `cal-month-${view.getFullYear()}-${view.getMonth()}-${i}`)) }),
|
|
8912
8940
|
effectiveEnableEventSheet && selectedEvent && selectedEventDate ? /* @__PURE__ */ jsx33(
|
|
8913
8941
|
Sheet,
|
|
8914
8942
|
{
|
|
@@ -8938,7 +8966,7 @@ function Calendar3({
|
|
|
8938
8966
|
}
|
|
8939
8967
|
|
|
8940
8968
|
// src/components/TimePicker.tsx
|
|
8941
|
-
import * as
|
|
8969
|
+
import * as React29 from "react";
|
|
8942
8970
|
import { Clock as Clock2, X as X10, Check as Check5, Sun, Moon, Sunset, Coffee } from "lucide-react";
|
|
8943
8971
|
import { Fragment as Fragment9, jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8944
8972
|
var pad = (n) => n.toString().padStart(2, "0");
|
|
@@ -8965,21 +8993,21 @@ function WheelColumn2({
|
|
|
8965
8993
|
}) {
|
|
8966
8994
|
const height = itemHeight * WHEEL_VISIBLE_ITEMS2;
|
|
8967
8995
|
const paddingY = (height - itemHeight) / 2;
|
|
8968
|
-
const rafRef =
|
|
8969
|
-
const lastVirtualIndexRef =
|
|
8970
|
-
const wheelDeltaRef =
|
|
8971
|
-
const scrollEndTimeoutRef =
|
|
8972
|
-
const suppressScrollSelectUntilRef =
|
|
8973
|
-
const suppressItemClickUntilRef =
|
|
8974
|
-
const dragRef =
|
|
8975
|
-
const draggingRef =
|
|
8976
|
-
const inertialRef =
|
|
8977
|
-
const inertiaRafRef =
|
|
8978
|
-
const inertiaVelocityRef =
|
|
8979
|
-
const inertiaLastTimeRef =
|
|
8980
|
-
const moveSamplesRef =
|
|
8996
|
+
const rafRef = React29.useRef(0);
|
|
8997
|
+
const lastVirtualIndexRef = React29.useRef(null);
|
|
8998
|
+
const wheelDeltaRef = React29.useRef(0);
|
|
8999
|
+
const scrollEndTimeoutRef = React29.useRef(null);
|
|
9000
|
+
const suppressScrollSelectUntilRef = React29.useRef(0);
|
|
9001
|
+
const suppressItemClickUntilRef = React29.useRef(0);
|
|
9002
|
+
const dragRef = React29.useRef(null);
|
|
9003
|
+
const draggingRef = React29.useRef(false);
|
|
9004
|
+
const inertialRef = React29.useRef(false);
|
|
9005
|
+
const inertiaRafRef = React29.useRef(null);
|
|
9006
|
+
const inertiaVelocityRef = React29.useRef(0);
|
|
9007
|
+
const inertiaLastTimeRef = React29.useRef(0);
|
|
9008
|
+
const moveSamplesRef = React29.useRef([]);
|
|
8981
9009
|
const loop = true;
|
|
8982
|
-
const ui =
|
|
9010
|
+
const ui = React29.useMemo(() => {
|
|
8983
9011
|
if (size === "sm") {
|
|
8984
9012
|
return {
|
|
8985
9013
|
columnWidth: "min-w-16 max-w-21",
|
|
@@ -9006,9 +9034,9 @@ function WheelColumn2({
|
|
|
9006
9034
|
fadeHeight: "h-12"
|
|
9007
9035
|
};
|
|
9008
9036
|
}, [size]);
|
|
9009
|
-
const baseOffset =
|
|
9010
|
-
const extendedItems =
|
|
9011
|
-
const getNearestVirtualIndex =
|
|
9037
|
+
const baseOffset = React29.useMemo(() => loop ? items.length : 0, [items.length, loop]);
|
|
9038
|
+
const extendedItems = React29.useMemo(() => loop ? [...items, ...items, ...items] : items, [items, loop]);
|
|
9039
|
+
const getNearestVirtualIndex = React29.useCallback(
|
|
9012
9040
|
(realIndex, fromVirtual) => {
|
|
9013
9041
|
const len = items.length;
|
|
9014
9042
|
if (len <= 0) return 0;
|
|
@@ -9027,7 +9055,7 @@ function WheelColumn2({
|
|
|
9027
9055
|
},
|
|
9028
9056
|
[items.length, loop]
|
|
9029
9057
|
);
|
|
9030
|
-
|
|
9058
|
+
React29.useLayoutEffect(() => {
|
|
9031
9059
|
const el = scrollRef.current;
|
|
9032
9060
|
if (!el) return;
|
|
9033
9061
|
const maxVirtual = Math.max(0, extendedItems.length - 1);
|
|
@@ -9055,7 +9083,7 @@ function WheelColumn2({
|
|
|
9055
9083
|
cancelAnimationFrame(rafRef.current);
|
|
9056
9084
|
};
|
|
9057
9085
|
}, [animate, baseOffset, extendedItems.length, getNearestVirtualIndex, itemHeight, loop, scrollRef, valueIndex]);
|
|
9058
|
-
|
|
9086
|
+
React29.useEffect(() => {
|
|
9059
9087
|
const el = scrollRef.current;
|
|
9060
9088
|
if (!el) return;
|
|
9061
9089
|
const lastWheelSignRef = { current: 0 };
|
|
@@ -9143,13 +9171,13 @@ function WheelColumn2({
|
|
|
9143
9171
|
}, 120);
|
|
9144
9172
|
});
|
|
9145
9173
|
};
|
|
9146
|
-
const currentVirtual =
|
|
9174
|
+
const currentVirtual = React29.useMemo(() => {
|
|
9147
9175
|
if (!loop || items.length <= 0) return valueIndex;
|
|
9148
9176
|
const fallback = baseOffset + valueIndex;
|
|
9149
9177
|
const from = lastVirtualIndexRef.current ?? fallback;
|
|
9150
9178
|
return getNearestVirtualIndex(valueIndex, from);
|
|
9151
9179
|
}, [baseOffset, getNearestVirtualIndex, items.length, loop, valueIndex]);
|
|
9152
|
-
const commitFromScrollTop =
|
|
9180
|
+
const commitFromScrollTop = React29.useCallback(
|
|
9153
9181
|
(behavior) => {
|
|
9154
9182
|
const el = scrollRef.current;
|
|
9155
9183
|
if (!el) return;
|
|
@@ -9227,7 +9255,7 @@ function WheelColumn2({
|
|
|
9227
9255
|
if (dt > 0) inertiaVelocityRef.current = (el.scrollTop - oldest.top) / dt;
|
|
9228
9256
|
}
|
|
9229
9257
|
};
|
|
9230
|
-
const startInertia =
|
|
9258
|
+
const startInertia = React29.useCallback(() => {
|
|
9231
9259
|
const el = scrollRef.current;
|
|
9232
9260
|
if (!el) return;
|
|
9233
9261
|
if (items.length <= 0) return;
|
|
@@ -9429,20 +9457,20 @@ function TimePicker({
|
|
|
9429
9457
|
const isControlled = value !== void 0;
|
|
9430
9458
|
const now = /* @__PURE__ */ new Date();
|
|
9431
9459
|
const initial = parseTime(isControlled ? value : defaultValue, format, includeSeconds) || (format === "12" ? { h: now.getHours() % 12 || 12, m: now.getMinutes(), s: now.getSeconds(), p: now.getHours() >= 12 ? "PM" : "AM" } : { h: now.getHours(), m: now.getMinutes(), s: now.getSeconds() });
|
|
9432
|
-
const [open, setOpen] =
|
|
9433
|
-
const [parts, setParts] =
|
|
9434
|
-
const [manualInput, setManualInput] =
|
|
9435
|
-
const [focusedColumn, setFocusedColumn] =
|
|
9436
|
-
const hourScrollRef =
|
|
9437
|
-
const minuteScrollRef =
|
|
9438
|
-
const secondScrollRef =
|
|
9439
|
-
|
|
9460
|
+
const [open, setOpen] = React29.useState(false);
|
|
9461
|
+
const [parts, setParts] = React29.useState(initial);
|
|
9462
|
+
const [manualInput, setManualInput] = React29.useState("");
|
|
9463
|
+
const [focusedColumn, setFocusedColumn] = React29.useState(null);
|
|
9464
|
+
const hourScrollRef = React29.useRef(null);
|
|
9465
|
+
const minuteScrollRef = React29.useRef(null);
|
|
9466
|
+
const secondScrollRef = React29.useRef(null);
|
|
9467
|
+
React29.useEffect(() => {
|
|
9440
9468
|
if (isControlled) {
|
|
9441
9469
|
const parsed = parseTime(value, format, includeSeconds);
|
|
9442
9470
|
if (parsed) setParts(parsed);
|
|
9443
9471
|
}
|
|
9444
9472
|
}, [value, isControlled, format, includeSeconds]);
|
|
9445
|
-
const isTimeDisabled =
|
|
9473
|
+
const isTimeDisabled = React29.useCallback(
|
|
9446
9474
|
(timeStr) => {
|
|
9447
9475
|
if (!disabledTimes) return false;
|
|
9448
9476
|
if (typeof disabledTimes === "function") return disabledTimes(timeStr);
|
|
@@ -9452,7 +9480,7 @@ function TimePicker({
|
|
|
9452
9480
|
);
|
|
9453
9481
|
const resolvedMinTime = minTime ?? min;
|
|
9454
9482
|
const resolvedMaxTime = maxTime ?? max;
|
|
9455
|
-
const toSeconds =
|
|
9483
|
+
const toSeconds = React29.useCallback(
|
|
9456
9484
|
(p) => {
|
|
9457
9485
|
let h = p.h;
|
|
9458
9486
|
if (format === "12") {
|
|
@@ -9464,7 +9492,7 @@ function TimePicker({
|
|
|
9464
9492
|
},
|
|
9465
9493
|
[format, includeSeconds]
|
|
9466
9494
|
);
|
|
9467
|
-
const isTimeInRange =
|
|
9495
|
+
const isTimeInRange = React29.useCallback(
|
|
9468
9496
|
(timeStr) => {
|
|
9469
9497
|
if (!resolvedMinTime && !resolvedMaxTime) return true;
|
|
9470
9498
|
const parsed = parseTime(timeStr, format, includeSeconds);
|
|
@@ -9482,7 +9510,7 @@ function TimePicker({
|
|
|
9482
9510
|
},
|
|
9483
9511
|
[format, includeSeconds, resolvedMaxTime, resolvedMinTime, toSeconds]
|
|
9484
9512
|
);
|
|
9485
|
-
const canEmit =
|
|
9513
|
+
const canEmit = React29.useCallback(
|
|
9486
9514
|
(next) => {
|
|
9487
9515
|
const timeStr = next ? formatTime2(next, format, includeSeconds) : void 0;
|
|
9488
9516
|
if (!timeStr) return true;
|
|
@@ -9492,7 +9520,7 @@ function TimePicker({
|
|
|
9492
9520
|
},
|
|
9493
9521
|
[format, includeSeconds, isTimeDisabled, isTimeInRange]
|
|
9494
9522
|
);
|
|
9495
|
-
const emit =
|
|
9523
|
+
const emit = React29.useCallback(
|
|
9496
9524
|
(next) => {
|
|
9497
9525
|
const timeStr = next ? formatTime2(next, format, includeSeconds) : void 0;
|
|
9498
9526
|
if (!canEmit(next)) return;
|
|
@@ -9500,7 +9528,7 @@ function TimePicker({
|
|
|
9500
9528
|
},
|
|
9501
9529
|
[canEmit, format, includeSeconds, onChange]
|
|
9502
9530
|
);
|
|
9503
|
-
const tryUpdate =
|
|
9531
|
+
const tryUpdate = React29.useCallback(
|
|
9504
9532
|
(next) => {
|
|
9505
9533
|
if (!canEmit(next)) return false;
|
|
9506
9534
|
setParts(next);
|
|
@@ -10064,7 +10092,7 @@ var DateTimePicker = ({
|
|
|
10064
10092
|
}) => {
|
|
10065
10093
|
const t = useSmartTranslations("DateTimePicker");
|
|
10066
10094
|
const locale = useSmartLocale();
|
|
10067
|
-
const [open, setOpen] =
|
|
10095
|
+
const [open, setOpen] = React30.useState(false);
|
|
10068
10096
|
const sizeStyles8 = {
|
|
10069
10097
|
sm: {
|
|
10070
10098
|
trigger: "h-8 px-2.5 py-1.5 text-sm md:h-7 md:text-xs",
|
|
@@ -10097,9 +10125,9 @@ var DateTimePicker = ({
|
|
|
10097
10125
|
gap: "gap-4"
|
|
10098
10126
|
}
|
|
10099
10127
|
};
|
|
10100
|
-
const [tempDate, setTempDate] =
|
|
10101
|
-
const [calendarMonth, setCalendarMonth] =
|
|
10102
|
-
|
|
10128
|
+
const [tempDate, setTempDate] = React30.useState(value);
|
|
10129
|
+
const [calendarMonth, setCalendarMonth] = React30.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
10130
|
+
React30.useEffect(() => {
|
|
10103
10131
|
setTempDate(value);
|
|
10104
10132
|
setCalendarMonth(value ?? /* @__PURE__ */ new Date());
|
|
10105
10133
|
}, [value, open]);
|
|
@@ -10292,7 +10320,7 @@ var DateTimePicker = ({
|
|
|
10292
10320
|
};
|
|
10293
10321
|
|
|
10294
10322
|
// src/components/CalendarTimeline/CalendarTimeline.tsx
|
|
10295
|
-
import * as
|
|
10323
|
+
import * as React36 from "react";
|
|
10296
10324
|
import { Plus as Plus2 } from "lucide-react";
|
|
10297
10325
|
|
|
10298
10326
|
// src/components/CalendarTimeline/date.ts
|
|
@@ -10532,10 +10560,10 @@ function intervalPack(items) {
|
|
|
10532
10560
|
}
|
|
10533
10561
|
|
|
10534
10562
|
// src/components/CalendarTimeline/hooks.ts
|
|
10535
|
-
import * as
|
|
10563
|
+
import * as React31 from "react";
|
|
10536
10564
|
function useHorizontalScrollSync(args) {
|
|
10537
10565
|
const { bodyRef, headerRef, leftRef } = args;
|
|
10538
|
-
|
|
10566
|
+
React31.useEffect(() => {
|
|
10539
10567
|
const body = bodyRef.current;
|
|
10540
10568
|
const header = headerRef.current;
|
|
10541
10569
|
const left = leftRef?.current ?? null;
|
|
@@ -10593,9 +10621,9 @@ function lowerBound(arr, target) {
|
|
|
10593
10621
|
function useVirtualVariableRows(args) {
|
|
10594
10622
|
const { enabled, overscan, rowHeights, scrollRef } = args;
|
|
10595
10623
|
const itemCount = rowHeights.length;
|
|
10596
|
-
const [viewportHeight, setViewportHeight] =
|
|
10597
|
-
const [scrollTop, setScrollTop] =
|
|
10598
|
-
|
|
10624
|
+
const [viewportHeight, setViewportHeight] = React31.useState(0);
|
|
10625
|
+
const [scrollTop, setScrollTop] = React31.useState(0);
|
|
10626
|
+
React31.useEffect(() => {
|
|
10599
10627
|
if (!enabled) {
|
|
10600
10628
|
setViewportHeight(0);
|
|
10601
10629
|
return;
|
|
@@ -10608,7 +10636,7 @@ function useVirtualVariableRows(args) {
|
|
|
10608
10636
|
ro.observe(el);
|
|
10609
10637
|
return () => ro.disconnect();
|
|
10610
10638
|
}, [enabled, scrollRef]);
|
|
10611
|
-
|
|
10639
|
+
React31.useEffect(() => {
|
|
10612
10640
|
if (!enabled) {
|
|
10613
10641
|
setScrollTop(0);
|
|
10614
10642
|
return;
|
|
@@ -10633,7 +10661,7 @@ function useVirtualVariableRows(args) {
|
|
|
10633
10661
|
el.removeEventListener("scroll", onScroll);
|
|
10634
10662
|
};
|
|
10635
10663
|
}, [enabled, scrollRef]);
|
|
10636
|
-
const prefix =
|
|
10664
|
+
const prefix = React31.useMemo(() => {
|
|
10637
10665
|
const out = new Array(itemCount + 1);
|
|
10638
10666
|
out[0] = 0;
|
|
10639
10667
|
for (let i = 0; i < itemCount; i++) {
|
|
@@ -10641,7 +10669,7 @@ function useVirtualVariableRows(args) {
|
|
|
10641
10669
|
}
|
|
10642
10670
|
return out;
|
|
10643
10671
|
}, [itemCount, rowHeights]);
|
|
10644
|
-
return
|
|
10672
|
+
return React31.useMemo(() => {
|
|
10645
10673
|
if (!enabled) {
|
|
10646
10674
|
return { startIndex: 0, endIndex: itemCount, topSpacer: 0, bottomSpacer: 0, totalHeight: prefix[itemCount] ?? 0 };
|
|
10647
10675
|
}
|
|
@@ -10657,8 +10685,8 @@ function useVirtualVariableRows(args) {
|
|
|
10657
10685
|
}, [enabled, itemCount, overscan, prefix, scrollTop, viewportHeight]);
|
|
10658
10686
|
}
|
|
10659
10687
|
function useClientWidth(ref) {
|
|
10660
|
-
const [width, setWidth] =
|
|
10661
|
-
|
|
10688
|
+
const [width, setWidth] = React31.useState(0);
|
|
10689
|
+
React31.useEffect(() => {
|
|
10662
10690
|
const el = ref.current;
|
|
10663
10691
|
if (!el) return;
|
|
10664
10692
|
const update = () => setWidth(el.clientWidth);
|
|
@@ -10881,7 +10909,7 @@ function resourcesById(resources) {
|
|
|
10881
10909
|
}
|
|
10882
10910
|
|
|
10883
10911
|
// src/components/CalendarTimeline/CalendarTimelineHeader.tsx
|
|
10884
|
-
import * as
|
|
10912
|
+
import * as React32 from "react";
|
|
10885
10913
|
import { Calendar as Calendar4, CalendarDays, CalendarRange, ChevronLeft as ChevronLeft4, ChevronRight as ChevronRight5, GripVertical, Plus } from "lucide-react";
|
|
10886
10914
|
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
10887
10915
|
var VIEW_ICONS = {
|
|
@@ -10912,7 +10940,7 @@ function CalendarTimelineHeader(props) {
|
|
|
10912
10940
|
headerRef,
|
|
10913
10941
|
slotHeaderNodes
|
|
10914
10942
|
} = props;
|
|
10915
|
-
const resolvedAvailableViews =
|
|
10943
|
+
const resolvedAvailableViews = React32.useMemo(
|
|
10916
10944
|
() => availableViews?.length ? availableViews : ["month", "week", "day", "sprint"],
|
|
10917
10945
|
[availableViews]
|
|
10918
10946
|
);
|
|
@@ -10920,22 +10948,22 @@ function CalendarTimelineHeader(props) {
|
|
|
10920
10948
|
const showLeftColumn = showResourceColumn ?? true;
|
|
10921
10949
|
const dt = useSmartTranslations("DateTimePicker");
|
|
10922
10950
|
const locale = useSmartLocale();
|
|
10923
|
-
const [todayOpen, setTodayOpen] =
|
|
10924
|
-
const [tempDate, setTempDate] =
|
|
10925
|
-
const [calendarMonth, setCalendarMonth] =
|
|
10926
|
-
|
|
10951
|
+
const [todayOpen, setTodayOpen] = React32.useState(false);
|
|
10952
|
+
const [tempDate, setTempDate] = React32.useState(() => now);
|
|
10953
|
+
const [calendarMonth, setCalendarMonth] = React32.useState(() => now);
|
|
10954
|
+
React32.useEffect(() => {
|
|
10927
10955
|
if (!todayOpen) return;
|
|
10928
10956
|
setTempDate(now);
|
|
10929
10957
|
setCalendarMonth(now);
|
|
10930
10958
|
}, [now, todayOpen]);
|
|
10931
|
-
const monthLabel =
|
|
10959
|
+
const monthLabel = React32.useCallback(
|
|
10932
10960
|
(date) => date.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", {
|
|
10933
10961
|
month: "long",
|
|
10934
10962
|
year: "numeric"
|
|
10935
10963
|
}),
|
|
10936
10964
|
[locale]
|
|
10937
10965
|
);
|
|
10938
|
-
const weekdays =
|
|
10966
|
+
const weekdays = React32.useMemo(() => {
|
|
10939
10967
|
switch (locale) {
|
|
10940
10968
|
case "vi":
|
|
10941
10969
|
return ["CN", "T2", "T3", "T4", "T5", "T6", "T7"];
|
|
@@ -10947,12 +10975,12 @@ function CalendarTimelineHeader(props) {
|
|
|
10947
10975
|
return ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
10948
10976
|
}
|
|
10949
10977
|
}, [locale]);
|
|
10950
|
-
const getTimeString =
|
|
10978
|
+
const getTimeString = React32.useCallback((date) => {
|
|
10951
10979
|
const h = date.getHours();
|
|
10952
10980
|
const m = date.getMinutes();
|
|
10953
10981
|
return `${h.toString().padStart(2, "0")}:${m.toString().padStart(2, "0")}`;
|
|
10954
10982
|
}, []);
|
|
10955
|
-
const handleDateSelect =
|
|
10983
|
+
const handleDateSelect = React32.useCallback((date) => {
|
|
10956
10984
|
if (!(date instanceof Date)) return;
|
|
10957
10985
|
setTempDate((prev) => {
|
|
10958
10986
|
const next = new Date(date);
|
|
@@ -10960,7 +10988,7 @@ function CalendarTimelineHeader(props) {
|
|
|
10960
10988
|
return next;
|
|
10961
10989
|
});
|
|
10962
10990
|
}, []);
|
|
10963
|
-
const handleTimeChange =
|
|
10991
|
+
const handleTimeChange = React32.useCallback((timeStr) => {
|
|
10964
10992
|
if (!timeStr) return;
|
|
10965
10993
|
const [hStr, mStr] = timeStr.split(":");
|
|
10966
10994
|
const h = parseInt(hStr, 10);
|
|
@@ -10972,7 +11000,7 @@ function CalendarTimelineHeader(props) {
|
|
|
10972
11000
|
return next;
|
|
10973
11001
|
});
|
|
10974
11002
|
}, []);
|
|
10975
|
-
const applyDateTime =
|
|
11003
|
+
const applyDateTime = React32.useCallback(() => {
|
|
10976
11004
|
onApplyDateTime(tempDate);
|
|
10977
11005
|
setTodayOpen(false);
|
|
10978
11006
|
}, [onApplyDateTime, tempDate]);
|
|
@@ -11235,9 +11263,9 @@ function ResourceRowCell(props) {
|
|
|
11235
11263
|
}
|
|
11236
11264
|
|
|
11237
11265
|
// src/components/CalendarTimeline/CalendarTimelineGridOverlay.tsx
|
|
11238
|
-
import * as
|
|
11266
|
+
import * as React33 from "react";
|
|
11239
11267
|
import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
11240
|
-
var CalendarTimelineGridOverlay =
|
|
11268
|
+
var CalendarTimelineGridOverlay = React33.memo(function CalendarTimelineGridOverlay2(props) {
|
|
11241
11269
|
const {
|
|
11242
11270
|
gridWidth,
|
|
11243
11271
|
height,
|
|
@@ -11285,12 +11313,12 @@ var CalendarTimelineGridOverlay = React32.memo(function CalendarTimelineGridOver
|
|
|
11285
11313
|
});
|
|
11286
11314
|
|
|
11287
11315
|
// src/components/CalendarTimeline/CalendarTimelineSlotHeaderCell.tsx
|
|
11288
|
-
import * as
|
|
11316
|
+
import * as React34 from "react";
|
|
11289
11317
|
import { Dot } from "lucide-react";
|
|
11290
11318
|
import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
11291
|
-
var CalendarTimelineSlotHeaderCell =
|
|
11319
|
+
var CalendarTimelineSlotHeaderCell = React34.memo(function CalendarTimelineSlotHeaderCell2(props) {
|
|
11292
11320
|
const { width, activeView, isToday: isToday2, label, ariaLabel, borderClassName, dayHeaderMarks, idx, className } = props;
|
|
11293
|
-
const content =
|
|
11321
|
+
const content = React34.useMemo(() => {
|
|
11294
11322
|
if (activeView === "day" && dayHeaderMarks) {
|
|
11295
11323
|
if (dayHeaderMarks.showEllipsis[idx]) return /* @__PURE__ */ jsx40("span", { className: "text-xs text-muted-foreground/70 select-none", children: "\u2026" });
|
|
11296
11324
|
if (!dayHeaderMarks.showTime[idx]) return null;
|
|
@@ -11313,7 +11341,7 @@ var CalendarTimelineSlotHeaderCell = React33.memo(function CalendarTimelineSlotH
|
|
|
11313
11341
|
});
|
|
11314
11342
|
|
|
11315
11343
|
// src/components/CalendarTimeline/internal-hooks.ts
|
|
11316
|
-
import * as
|
|
11344
|
+
import * as React35 from "react";
|
|
11317
11345
|
function useTimelineSlots(args) {
|
|
11318
11346
|
const {
|
|
11319
11347
|
activeView,
|
|
@@ -11328,7 +11356,7 @@ function useTimelineSlots(args) {
|
|
|
11328
11356
|
formatters,
|
|
11329
11357
|
dueDateSprint
|
|
11330
11358
|
} = args;
|
|
11331
|
-
const { slots, range } =
|
|
11359
|
+
const { slots, range } = React35.useMemo(() => {
|
|
11332
11360
|
const { start, end, slotStarts: slotStarts2 } = computeSlotStarts({
|
|
11333
11361
|
view: activeView,
|
|
11334
11362
|
date: activeDate,
|
|
@@ -11383,18 +11411,18 @@ function useTimelineSlots(args) {
|
|
|
11383
11411
|
const match = matchSprintDef(s, idx);
|
|
11384
11412
|
if (match && sprintRangeText) {
|
|
11385
11413
|
const rangeText = sprintRangeText(match.startMs, match.endMs);
|
|
11386
|
-
return
|
|
11414
|
+
return React35.createElement(
|
|
11387
11415
|
"span",
|
|
11388
11416
|
{ className: "inline-flex flex-col items-center leading-tight" },
|
|
11389
|
-
|
|
11390
|
-
|
|
11417
|
+
React35.createElement("span", { className: "text-[11px] font-semibold text-foreground truncate max-w-32" }, match.title),
|
|
11418
|
+
React35.createElement("span", { className: "text-[10px] font-medium text-muted-foreground/70" }, rangeText)
|
|
11391
11419
|
);
|
|
11392
11420
|
}
|
|
11393
|
-
return
|
|
11421
|
+
return React35.createElement(
|
|
11394
11422
|
"span",
|
|
11395
11423
|
{ className: "inline-flex flex-col items-center leading-tight" },
|
|
11396
|
-
|
|
11397
|
-
|
|
11424
|
+
React35.createElement("span", { className: "text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70" }, "S"),
|
|
11425
|
+
React35.createElement("span", { className: "text-sm font-semibold text-foreground" }, String(idx + 1).padStart(2, "0"))
|
|
11398
11426
|
);
|
|
11399
11427
|
})(),
|
|
11400
11428
|
isToday: (() => {
|
|
@@ -11422,9 +11450,9 @@ function useTimelineSlots(args) {
|
|
|
11422
11450
|
weekStartsOn,
|
|
11423
11451
|
workHours
|
|
11424
11452
|
]);
|
|
11425
|
-
const slotStarts =
|
|
11426
|
-
const todaySlotIdx =
|
|
11427
|
-
const weekendSlotIdxs =
|
|
11453
|
+
const slotStarts = React35.useMemo(() => slots.map((s) => s.start), [slots]);
|
|
11454
|
+
const todaySlotIdx = React35.useMemo(() => slots.findIndex((s) => s.isToday), [slots]);
|
|
11455
|
+
const weekendSlotIdxs = React35.useMemo(() => {
|
|
11428
11456
|
const out = [];
|
|
11429
11457
|
for (let i = 0; i < slots.length; i++) if (slots[i]?.isWeekend) out.push(i);
|
|
11430
11458
|
return out;
|
|
@@ -11433,16 +11461,16 @@ function useTimelineSlots(args) {
|
|
|
11433
11461
|
}
|
|
11434
11462
|
function useNormalizedEvents(args) {
|
|
11435
11463
|
const { events, range, activeView, resolvedTimeZone, resources } = args;
|
|
11436
|
-
const normalizedEvents =
|
|
11464
|
+
const normalizedEvents = React35.useMemo(() => {
|
|
11437
11465
|
return normalizeEvents({ events, range, view: activeView, timeZone: resolvedTimeZone });
|
|
11438
11466
|
}, [activeView, events, range, resolvedTimeZone]);
|
|
11439
|
-
const eventsByResource =
|
|
11440
|
-
const resourceById =
|
|
11467
|
+
const eventsByResource = React35.useMemo(() => eventsByResourceId(normalizedEvents), [normalizedEvents]);
|
|
11468
|
+
const resourceById = React35.useMemo(() => resourcesById(resources), [resources]);
|
|
11441
11469
|
return { normalizedEvents, eventsByResource, resourceById };
|
|
11442
11470
|
}
|
|
11443
11471
|
function useDayHeaderMarks(args) {
|
|
11444
11472
|
const { enabled, activeView, normalizedEvents, slotStarts, slotCount } = args;
|
|
11445
|
-
return
|
|
11473
|
+
return React35.useMemo(() => {
|
|
11446
11474
|
if (!enabled) return null;
|
|
11447
11475
|
if (activeView !== "day") return null;
|
|
11448
11476
|
const n = slotCount;
|
|
@@ -11477,14 +11505,14 @@ function useSlotMetrics(args) {
|
|
|
11477
11505
|
dayHeaderSmart,
|
|
11478
11506
|
daySlotCompression
|
|
11479
11507
|
} = args;
|
|
11480
|
-
const fixedSlotWidth =
|
|
11508
|
+
const fixedSlotWidth = React35.useMemo(() => {
|
|
11481
11509
|
const baseSlotWidth = activeView === "month" || activeView === "day" ? effectiveSlotMinWidth * 3 : effectiveSlotMinWidth;
|
|
11482
11510
|
if (activeView !== "week") return baseSlotWidth;
|
|
11483
11511
|
if (bodyClientWidth <= 0) return baseSlotWidth;
|
|
11484
11512
|
if (slotsLength <= 0) return baseSlotWidth;
|
|
11485
11513
|
return Math.max(baseSlotWidth, bodyClientWidth / slotsLength);
|
|
11486
11514
|
}, [activeView, bodyClientWidth, effectiveSlotMinWidth, slotsLength]);
|
|
11487
|
-
const slotMetrics =
|
|
11515
|
+
const slotMetrics = React35.useMemo(() => {
|
|
11488
11516
|
const n = slotsLength;
|
|
11489
11517
|
const widths = new Array(n).fill(fixedSlotWidth);
|
|
11490
11518
|
const isAdaptiveView = activeView === "month" || activeView === "day";
|
|
@@ -11614,7 +11642,7 @@ function useSlotMetrics(args) {
|
|
|
11614
11642
|
}
|
|
11615
11643
|
function useLayoutsByResource(args) {
|
|
11616
11644
|
const { eventsByResource, preview, slotStarts, slotsLength, slotLefts, getResourceRowHeight, laneGap, lanePaddingY, effectiveMaxLanesPerRow, eventHeight } = args;
|
|
11617
|
-
return
|
|
11645
|
+
return React35.useMemo(() => {
|
|
11618
11646
|
const map = /* @__PURE__ */ new Map();
|
|
11619
11647
|
for (const [resourceId, list] of eventsByResource.entries()) {
|
|
11620
11648
|
const mapped = list.map((ev) => {
|
|
@@ -11661,9 +11689,9 @@ function lowerBound2(arr, target) {
|
|
|
11661
11689
|
}
|
|
11662
11690
|
function useVisibleSlotRange(args) {
|
|
11663
11691
|
const { enabled, overscan, scrollRef, slotLefts, slotCount } = args;
|
|
11664
|
-
const [scrollLeft, setScrollLeft] =
|
|
11665
|
-
const [viewportWidth, setViewportWidth] =
|
|
11666
|
-
|
|
11692
|
+
const [scrollLeft, setScrollLeft] = React35.useState(0);
|
|
11693
|
+
const [viewportWidth, setViewportWidth] = React35.useState(0);
|
|
11694
|
+
React35.useEffect(() => {
|
|
11667
11695
|
if (!enabled) return;
|
|
11668
11696
|
const el = scrollRef.current;
|
|
11669
11697
|
if (!el) return;
|
|
@@ -11690,7 +11718,7 @@ function useVisibleSlotRange(args) {
|
|
|
11690
11718
|
el.removeEventListener("scroll", onScroll);
|
|
11691
11719
|
};
|
|
11692
11720
|
}, [enabled, scrollRef]);
|
|
11693
|
-
return
|
|
11721
|
+
return React35.useMemo(() => {
|
|
11694
11722
|
if (!enabled) return { startIdx: 0, endIdx: slotCount };
|
|
11695
11723
|
if (slotCount <= 0) return { startIdx: 0, endIdx: 0 };
|
|
11696
11724
|
if (viewportWidth <= 0) return { startIdx: 0, endIdx: slotCount };
|
|
@@ -11787,14 +11815,14 @@ function CalendarTimeline({
|
|
|
11787
11815
|
}) {
|
|
11788
11816
|
const t = useSmartTranslations("CalendarTimeline");
|
|
11789
11817
|
const detectedLocale = useSmartLocale();
|
|
11790
|
-
const resolvedLocale =
|
|
11791
|
-
const resolvedTimeZone =
|
|
11818
|
+
const resolvedLocale = React36.useMemo(() => localeToBCP47(locale ?? detectedLocale), [locale, detectedLocale]);
|
|
11819
|
+
const resolvedTimeZone = React36.useMemo(() => timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC", [timeZone]);
|
|
11792
11820
|
const effectiveEnableEventSheet = enableEventSheet ?? Boolean(renderEventSheet);
|
|
11793
11821
|
const isViewOnly = interactions?.mode === "view";
|
|
11794
11822
|
const isControlledSelectedEventId = selectedEventId !== void 0;
|
|
11795
|
-
const [internalSelectedEventId, setInternalSelectedEventId] =
|
|
11823
|
+
const [internalSelectedEventId, setInternalSelectedEventId] = React36.useState(defaultSelectedEventId ?? null);
|
|
11796
11824
|
const activeSelectedEventId = isControlledSelectedEventId ? selectedEventId : internalSelectedEventId;
|
|
11797
|
-
const setSelectedEventId =
|
|
11825
|
+
const setSelectedEventId = React36.useCallback(
|
|
11798
11826
|
(next) => {
|
|
11799
11827
|
if (!isControlledSelectedEventId) setInternalSelectedEventId(next);
|
|
11800
11828
|
onSelectedEventIdChange?.(next);
|
|
@@ -11802,9 +11830,9 @@ function CalendarTimeline({
|
|
|
11802
11830
|
[isControlledSelectedEventId, onSelectedEventIdChange]
|
|
11803
11831
|
);
|
|
11804
11832
|
const isControlledEventSheetOpen = eventSheetOpen !== void 0;
|
|
11805
|
-
const [internalEventSheetOpen, setInternalEventSheetOpen] =
|
|
11833
|
+
const [internalEventSheetOpen, setInternalEventSheetOpen] = React36.useState(defaultEventSheetOpen ?? false);
|
|
11806
11834
|
const activeEventSheetOpen = isControlledEventSheetOpen ? Boolean(eventSheetOpen) : internalEventSheetOpen;
|
|
11807
|
-
const setEventSheetOpen =
|
|
11835
|
+
const setEventSheetOpen = React36.useCallback(
|
|
11808
11836
|
(next) => {
|
|
11809
11837
|
if (!isControlledEventSheetOpen) setInternalEventSheetOpen(next);
|
|
11810
11838
|
onEventSheetOpenChange?.(next);
|
|
@@ -11813,12 +11841,12 @@ function CalendarTimeline({
|
|
|
11813
11841
|
[isControlledEventSheetOpen, onEventSheetOpenChange, setSelectedEventId]
|
|
11814
11842
|
);
|
|
11815
11843
|
const showResourceColumn = !hideResourceColumn;
|
|
11816
|
-
const sizeConfig =
|
|
11844
|
+
const sizeConfig = React36.useMemo(() => getSizeConfig(size), [size]);
|
|
11817
11845
|
const densityClass = sizeConfig.densityClass;
|
|
11818
11846
|
const eventHeight = sizeConfig.eventHeight;
|
|
11819
11847
|
const laneGap = sizeConfig.laneGap;
|
|
11820
11848
|
const lanePaddingY = sizeConfig.lanePaddingY;
|
|
11821
|
-
const canResizeColumn =
|
|
11849
|
+
const canResizeColumn = React36.useMemo(() => {
|
|
11822
11850
|
const cfg = enableLayoutResize;
|
|
11823
11851
|
if (!cfg) return false;
|
|
11824
11852
|
if (isViewOnly) return false;
|
|
@@ -11826,7 +11854,7 @@ function CalendarTimeline({
|
|
|
11826
11854
|
if (cfg === true) return true;
|
|
11827
11855
|
return cfg.column !== false;
|
|
11828
11856
|
}, [enableLayoutResize, isViewOnly, showResourceColumn]);
|
|
11829
|
-
const canResizeRow =
|
|
11857
|
+
const canResizeRow = React36.useMemo(() => {
|
|
11830
11858
|
const cfg = enableLayoutResize;
|
|
11831
11859
|
if (!cfg) return false;
|
|
11832
11860
|
if (isViewOnly) return false;
|
|
@@ -11835,19 +11863,19 @@ function CalendarTimeline({
|
|
|
11835
11863
|
return cfg.row !== false;
|
|
11836
11864
|
}, [enableLayoutResize, isViewOnly, showResourceColumn]);
|
|
11837
11865
|
const isControlledResourceColumnWidth = resourceColumnWidth !== void 0;
|
|
11838
|
-
const [internalResourceColumnWidth, setInternalResourceColumnWidth] =
|
|
11866
|
+
const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React36.useState(() => {
|
|
11839
11867
|
const init = defaultResourceColumnWidth ?? sizeConfig.resourceColumnWidth;
|
|
11840
11868
|
return typeof init === "number" ? init : sizeConfig.resourceColumnWidth;
|
|
11841
11869
|
});
|
|
11842
|
-
|
|
11870
|
+
React36.useEffect(() => {
|
|
11843
11871
|
if (isControlledResourceColumnWidth) return;
|
|
11844
11872
|
if (defaultResourceColumnWidth == null) return;
|
|
11845
11873
|
setInternalResourceColumnWidth(defaultResourceColumnWidth);
|
|
11846
11874
|
}, [defaultResourceColumnWidth, isControlledResourceColumnWidth]);
|
|
11847
11875
|
const effectiveResourceColumnWidth = showResourceColumn ? isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth : 0;
|
|
11848
11876
|
const isControlledRowHeight = rowHeight !== void 0;
|
|
11849
|
-
const [internalRowHeight, setInternalRowHeight] =
|
|
11850
|
-
|
|
11877
|
+
const [internalRowHeight, setInternalRowHeight] = React36.useState(() => defaultRowHeight ?? sizeConfig.rowHeight);
|
|
11878
|
+
React36.useEffect(() => {
|
|
11851
11879
|
if (isControlledRowHeight) return;
|
|
11852
11880
|
if (defaultRowHeight == null) return;
|
|
11853
11881
|
setInternalRowHeight(defaultRowHeight);
|
|
@@ -11858,14 +11886,14 @@ function CalendarTimeline({
|
|
|
11858
11886
|
const colMax = maxResourceColumnWidth ?? 520;
|
|
11859
11887
|
const rowMin = minRowHeight ?? 36;
|
|
11860
11888
|
const rowMax = maxRowHeight ?? 120;
|
|
11861
|
-
const viewList =
|
|
11862
|
-
const availableViews =
|
|
11889
|
+
const viewList = React36.useMemo(() => Array.isArray(view) ? view : void 0, [view]);
|
|
11890
|
+
const availableViews = React36.useMemo(() => {
|
|
11863
11891
|
if (onlyView) return [onlyView];
|
|
11864
11892
|
if (viewList?.length) return viewList;
|
|
11865
11893
|
return ["month", "week", "day", "sprint"];
|
|
11866
11894
|
}, [onlyView, viewList]);
|
|
11867
11895
|
const isControlledView = view !== void 0 && !Array.isArray(view);
|
|
11868
|
-
const [internalView, setInternalView] =
|
|
11896
|
+
const [internalView, setInternalView] = React36.useState(() => {
|
|
11869
11897
|
if (onlyView) return onlyView;
|
|
11870
11898
|
if (viewList?.length) {
|
|
11871
11899
|
if (defaultView && viewList.includes(defaultView)) return defaultView;
|
|
@@ -11874,13 +11902,13 @@ function CalendarTimeline({
|
|
|
11874
11902
|
return defaultView ?? "month";
|
|
11875
11903
|
});
|
|
11876
11904
|
const activeView = onlyView ? onlyView : isControlledView ? view : internalView;
|
|
11877
|
-
|
|
11905
|
+
React36.useEffect(() => {
|
|
11878
11906
|
if (onlyView || isControlledView) return;
|
|
11879
11907
|
if (!availableViews.includes(internalView)) {
|
|
11880
11908
|
setInternalView(availableViews[0] ?? "month");
|
|
11881
11909
|
}
|
|
11882
11910
|
}, [availableViews, internalView, isControlledView, onlyView]);
|
|
11883
|
-
const effectiveSlotMinWidth =
|
|
11911
|
+
const effectiveSlotMinWidth = React36.useMemo(() => {
|
|
11884
11912
|
if (slotMinWidth == null) {
|
|
11885
11913
|
if (activeView === "month" && monthEventStyle === "compact") {
|
|
11886
11914
|
return clamp5(Math.round(sizeConfig.slotMinWidth * 0.55), 32, sizeConfig.slotMinWidth);
|
|
@@ -11892,17 +11920,17 @@ function CalendarTimeline({
|
|
|
11892
11920
|
return baseSlotMinWidth;
|
|
11893
11921
|
}, [activeView, baseSlotMinWidth, monthEventStyle, sizeConfig.slotMinWidth, slotMinWidth]);
|
|
11894
11922
|
const isControlledDate = date !== void 0;
|
|
11895
|
-
const [internalDate, setInternalDate] =
|
|
11923
|
+
const [internalDate, setInternalDate] = React36.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
|
|
11896
11924
|
const activeDate = isControlledDate ? date : internalDate;
|
|
11897
|
-
const resolvedNow =
|
|
11898
|
-
const formatToken =
|
|
11925
|
+
const resolvedNow = React36.useMemo(() => now ?? /* @__PURE__ */ new Date(), [now]);
|
|
11926
|
+
const formatToken = React36.useCallback((key, params) => {
|
|
11899
11927
|
let message = t(key);
|
|
11900
11928
|
for (const [name, value] of Object.entries(params)) {
|
|
11901
11929
|
message = message.replaceAll(`{${name}}`, String(value));
|
|
11902
11930
|
}
|
|
11903
11931
|
return message;
|
|
11904
11932
|
}, [t]);
|
|
11905
|
-
const l =
|
|
11933
|
+
const l = React36.useMemo(
|
|
11906
11934
|
() => ({
|
|
11907
11935
|
today: labels?.today ?? t("today"),
|
|
11908
11936
|
prev: labels?.prev ?? t("prev"),
|
|
@@ -11925,7 +11953,7 @@ function CalendarTimeline({
|
|
|
11925
11953
|
}),
|
|
11926
11954
|
[formatToken, labels, t]
|
|
11927
11955
|
);
|
|
11928
|
-
const setView =
|
|
11956
|
+
const setView = React36.useCallback(
|
|
11929
11957
|
(next) => {
|
|
11930
11958
|
if (onlyView) return;
|
|
11931
11959
|
if (!availableViews.includes(next)) return;
|
|
@@ -11934,14 +11962,14 @@ function CalendarTimeline({
|
|
|
11934
11962
|
},
|
|
11935
11963
|
[availableViews, isControlledView, onViewChange, onlyView]
|
|
11936
11964
|
);
|
|
11937
|
-
const setDate =
|
|
11965
|
+
const setDate = React36.useCallback(
|
|
11938
11966
|
(next) => {
|
|
11939
11967
|
if (!isControlledDate) setInternalDate(next);
|
|
11940
11968
|
onDateChange?.(next);
|
|
11941
11969
|
},
|
|
11942
11970
|
[isControlledDate, onDateChange]
|
|
11943
11971
|
);
|
|
11944
|
-
const navigate =
|
|
11972
|
+
const navigate = React36.useCallback(
|
|
11945
11973
|
(dir) => {
|
|
11946
11974
|
const base = activeDate;
|
|
11947
11975
|
if (activeView === "month") {
|
|
@@ -11960,17 +11988,17 @@ function CalendarTimeline({
|
|
|
11960
11988
|
},
|
|
11961
11989
|
[activeDate, activeView, resolvedTimeZone, setDate]
|
|
11962
11990
|
);
|
|
11963
|
-
const [internalCollapsed, setInternalCollapsed] =
|
|
11991
|
+
const [internalCollapsed, setInternalCollapsed] = React36.useState(() => defaultGroupCollapsed ?? {});
|
|
11964
11992
|
const collapsed = groupCollapsed ?? internalCollapsed;
|
|
11965
|
-
const setCollapsed =
|
|
11993
|
+
const setCollapsed = React36.useCallback(
|
|
11966
11994
|
(next) => {
|
|
11967
11995
|
if (!groupCollapsed) setInternalCollapsed(next);
|
|
11968
11996
|
onGroupCollapsedChange?.(next);
|
|
11969
11997
|
},
|
|
11970
11998
|
[groupCollapsed, onGroupCollapsedChange]
|
|
11971
11999
|
);
|
|
11972
|
-
const rows =
|
|
11973
|
-
const groupResourceCounts =
|
|
12000
|
+
const rows = React36.useMemo(() => buildRows({ resources, groups, collapsed }), [resources, groups, collapsed]);
|
|
12001
|
+
const groupResourceCounts = React36.useMemo(() => getGroupResourceCounts(resources), [resources]);
|
|
11974
12002
|
const { slots, range, slotStarts, todaySlotIdx, weekendSlotIdxs } = useTimelineSlots({
|
|
11975
12003
|
activeView,
|
|
11976
12004
|
activeDate,
|
|
@@ -11984,12 +12012,12 @@ function CalendarTimeline({
|
|
|
11984
12012
|
formatters,
|
|
11985
12013
|
dueDateSprint
|
|
11986
12014
|
});
|
|
11987
|
-
|
|
12015
|
+
React36.useEffect(() => {
|
|
11988
12016
|
onRangeChange?.(range);
|
|
11989
12017
|
}, [range.start, range.end, onRangeChange]);
|
|
11990
|
-
const leftRef =
|
|
11991
|
-
const bodyRef =
|
|
11992
|
-
const headerRef =
|
|
12018
|
+
const leftRef = React36.useRef(null);
|
|
12019
|
+
const bodyRef = React36.useRef(null);
|
|
12020
|
+
const headerRef = React36.useRef(null);
|
|
11993
12021
|
const bodyClientWidth = useClientWidth(bodyRef);
|
|
11994
12022
|
const { normalizedEvents, eventsByResource, resourceById } = useNormalizedEvents({
|
|
11995
12023
|
events,
|
|
@@ -12021,16 +12049,16 @@ function CalendarTimeline({
|
|
|
12021
12049
|
slotLefts,
|
|
12022
12050
|
slotCount: slots.length
|
|
12023
12051
|
});
|
|
12024
|
-
const selectedEvent =
|
|
12052
|
+
const selectedEvent = React36.useMemo(() => {
|
|
12025
12053
|
if (!activeSelectedEventId) return null;
|
|
12026
12054
|
const found = normalizedEvents.find((e) => e.id === activeSelectedEventId);
|
|
12027
12055
|
return found ?? null;
|
|
12028
12056
|
}, [activeSelectedEventId, normalizedEvents]);
|
|
12029
|
-
const selectedResource =
|
|
12057
|
+
const selectedResource = React36.useMemo(() => {
|
|
12030
12058
|
if (!selectedEvent) return void 0;
|
|
12031
12059
|
return resourceById.get(selectedEvent.resourceId);
|
|
12032
12060
|
}, [resourceById, selectedEvent]);
|
|
12033
|
-
const selectedTimeText =
|
|
12061
|
+
const selectedTimeText = React36.useMemo(() => {
|
|
12034
12062
|
if (!selectedEvent) return "";
|
|
12035
12063
|
return formatters?.eventTime?.({
|
|
12036
12064
|
start: selectedEvent._start,
|
|
@@ -12040,7 +12068,7 @@ function CalendarTimeline({
|
|
|
12040
12068
|
view: activeView
|
|
12041
12069
|
}) ?? defaultEventTime({ start: selectedEvent._start, end: selectedEvent._end, locale: resolvedLocale, timeZone: resolvedTimeZone, view: activeView });
|
|
12042
12070
|
}, [activeView, formatters, resolvedLocale, resolvedTimeZone, selectedEvent]);
|
|
12043
|
-
|
|
12071
|
+
React36.useEffect(() => {
|
|
12044
12072
|
if (!effectiveEnableEventSheet) return;
|
|
12045
12073
|
if (activeEventSheetOpen && activeSelectedEventId && !selectedEvent) {
|
|
12046
12074
|
setEventSheetOpen(false);
|
|
@@ -12050,24 +12078,24 @@ function CalendarTimeline({
|
|
|
12050
12078
|
const virt = virtualization == null ? rows.length > 60 : Boolean(virtualization.enabled);
|
|
12051
12079
|
const overscan = virtualization?.overscan ?? 8;
|
|
12052
12080
|
const isControlledRowHeights = rowHeights !== void 0;
|
|
12053
|
-
const [internalRowHeights, setInternalRowHeights] =
|
|
12054
|
-
|
|
12081
|
+
const [internalRowHeights, setInternalRowHeights] = React36.useState(() => defaultRowHeights ?? {});
|
|
12082
|
+
React36.useEffect(() => {
|
|
12055
12083
|
if (isControlledRowHeights) return;
|
|
12056
12084
|
if (!defaultRowHeights) return;
|
|
12057
12085
|
setInternalRowHeights(defaultRowHeights);
|
|
12058
12086
|
}, [defaultRowHeights, isControlledRowHeights]);
|
|
12059
12087
|
const activeRowHeights = isControlledRowHeights ? rowHeights : internalRowHeights;
|
|
12060
|
-
const autoRowHeightCfg =
|
|
12088
|
+
const autoRowHeightCfg = React36.useMemo(() => {
|
|
12061
12089
|
if (!autoRowHeight) return null;
|
|
12062
12090
|
return autoRowHeight === true ? {} : autoRowHeight;
|
|
12063
12091
|
}, [autoRowHeight]);
|
|
12064
|
-
const effectiveMaxLanesPerRow =
|
|
12092
|
+
const effectiveMaxLanesPerRow = React36.useMemo(() => {
|
|
12065
12093
|
if (!autoRowHeightCfg) return maxLanesPerRow;
|
|
12066
12094
|
const maxLanes = autoRowHeightCfg.maxLanesPerRow;
|
|
12067
12095
|
if (typeof maxLanes === "number" && Number.isFinite(maxLanes) && maxLanes > 0) return Math.floor(maxLanes);
|
|
12068
12096
|
return Number.POSITIVE_INFINITY;
|
|
12069
12097
|
}, [autoRowHeightCfg, maxLanesPerRow]);
|
|
12070
|
-
const autoRowHeightsByResource =
|
|
12098
|
+
const autoRowHeightsByResource = React36.useMemo(() => {
|
|
12071
12099
|
if (!autoRowHeightCfg) return null;
|
|
12072
12100
|
const maxRowHeight2 = autoRowHeightCfg.maxRowHeight;
|
|
12073
12101
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -12085,7 +12113,7 @@ function CalendarTimeline({
|
|
|
12085
12113
|
}
|
|
12086
12114
|
return out;
|
|
12087
12115
|
}, [autoRowHeightCfg, eventHeight, eventsByResource, laneGap, lanePaddingY, slotStarts, slots.length, effectiveMaxLanesPerRow]);
|
|
12088
|
-
const getResourceRowHeight =
|
|
12116
|
+
const getResourceRowHeight = React36.useCallback(
|
|
12089
12117
|
(resourceId) => {
|
|
12090
12118
|
const h = activeRowHeights[resourceId];
|
|
12091
12119
|
const base = typeof h === "number" && Number.isFinite(h) && h > 0 ? h : effectiveRowHeight;
|
|
@@ -12095,7 +12123,7 @@ function CalendarTimeline({
|
|
|
12095
12123
|
},
|
|
12096
12124
|
[activeRowHeights, autoRowHeightsByResource, effectiveRowHeight]
|
|
12097
12125
|
);
|
|
12098
|
-
const setRowHeightForResource =
|
|
12126
|
+
const setRowHeightForResource = React36.useCallback(
|
|
12099
12127
|
(resourceId, height) => {
|
|
12100
12128
|
const clamped = clamp5(Math.round(height), rowMin, rowMax);
|
|
12101
12129
|
onRowHeightChange?.(clamped);
|
|
@@ -12112,7 +12140,7 @@ function CalendarTimeline({
|
|
|
12112
12140
|
},
|
|
12113
12141
|
[activeRowHeights, isControlledRowHeights, onRowHeightChange, onRowHeightsChange, rowMax, rowMin]
|
|
12114
12142
|
);
|
|
12115
|
-
const rowHeightsArray =
|
|
12143
|
+
const rowHeightsArray = React36.useMemo(() => {
|
|
12116
12144
|
return rows.map((r) => {
|
|
12117
12145
|
if (r.kind === "resource") return getResourceRowHeight(r.resource.id);
|
|
12118
12146
|
return sizeConfig.groupRowHeight;
|
|
@@ -12128,13 +12156,13 @@ function CalendarTimeline({
|
|
|
12128
12156
|
const endRow = virt ? virtualResult.endIndex : rows.length;
|
|
12129
12157
|
const topSpacer = virt ? virtualResult.topSpacer : 0;
|
|
12130
12158
|
const bottomSpacer = virt ? virtualResult.bottomSpacer : 0;
|
|
12131
|
-
const renderedRowsHeight =
|
|
12159
|
+
const renderedRowsHeight = React36.useMemo(() => {
|
|
12132
12160
|
let h = 0;
|
|
12133
12161
|
for (let i = startRow; i < endRow; i++) h += rowHeightsArray[i] ?? effectiveRowHeight;
|
|
12134
12162
|
return h;
|
|
12135
12163
|
}, [effectiveRowHeight, endRow, rowHeightsArray, startRow]);
|
|
12136
|
-
const resizeRef =
|
|
12137
|
-
const setResourceColumnWidth =
|
|
12164
|
+
const resizeRef = React36.useRef(null);
|
|
12165
|
+
const setResourceColumnWidth = React36.useCallback(
|
|
12138
12166
|
(next) => {
|
|
12139
12167
|
const clamped = clamp5(Math.round(next), colMin, colMax);
|
|
12140
12168
|
if (!isControlledResourceColumnWidth) setInternalResourceColumnWidth(clamped);
|
|
@@ -12142,7 +12170,7 @@ function CalendarTimeline({
|
|
|
12142
12170
|
},
|
|
12143
12171
|
[colMax, colMin, isControlledResourceColumnWidth, onResourceColumnWidthChange]
|
|
12144
12172
|
);
|
|
12145
|
-
const startResize =
|
|
12173
|
+
const startResize = React36.useCallback(
|
|
12146
12174
|
(mode, e, args) => {
|
|
12147
12175
|
if (e.button !== 0 || e.ctrlKey) return;
|
|
12148
12176
|
resizeRef.current = {
|
|
@@ -12185,7 +12213,7 @@ function CalendarTimeline({
|
|
|
12185
12213
|
},
|
|
12186
12214
|
[setResourceColumnWidth, setRowHeightForResource]
|
|
12187
12215
|
);
|
|
12188
|
-
|
|
12216
|
+
React36.useEffect(() => {
|
|
12189
12217
|
return () => {
|
|
12190
12218
|
if (!resizeRef.current) return;
|
|
12191
12219
|
resizeRef.current = null;
|
|
@@ -12193,7 +12221,7 @@ function CalendarTimeline({
|
|
|
12193
12221
|
document.body.style.userSelect = "";
|
|
12194
12222
|
};
|
|
12195
12223
|
}, []);
|
|
12196
|
-
const beginResizeColumn =
|
|
12224
|
+
const beginResizeColumn = React36.useCallback(
|
|
12197
12225
|
(e) => {
|
|
12198
12226
|
if (!canResizeColumn) return;
|
|
12199
12227
|
if (typeof effectiveResourceColumnWidth !== "number") return;
|
|
@@ -12201,7 +12229,7 @@ function CalendarTimeline({
|
|
|
12201
12229
|
},
|
|
12202
12230
|
[canResizeColumn, effectiveResourceColumnWidth, effectiveRowHeight, startResize]
|
|
12203
12231
|
);
|
|
12204
|
-
const beginResizeResourceRow =
|
|
12232
|
+
const beginResizeResourceRow = React36.useCallback(
|
|
12205
12233
|
(resourceId) => (e) => {
|
|
12206
12234
|
if (!canResizeRow) return;
|
|
12207
12235
|
startResize("row", e, {
|
|
@@ -12212,7 +12240,7 @@ function CalendarTimeline({
|
|
|
12212
12240
|
},
|
|
12213
12241
|
[canResizeRow, effectiveResourceColumnWidth, getResourceRowHeight, startResize]
|
|
12214
12242
|
);
|
|
12215
|
-
const title =
|
|
12243
|
+
const title = React36.useMemo(() => {
|
|
12216
12244
|
if (activeView === "month") {
|
|
12217
12245
|
return formatters?.monthTitle?.(activeDate, { locale: resolvedLocale, timeZone: resolvedTimeZone }) ?? defaultMonthTitle(activeDate, resolvedLocale, resolvedTimeZone);
|
|
12218
12246
|
}
|
|
@@ -12239,11 +12267,11 @@ function CalendarTimeline({
|
|
|
12239
12267
|
}, [activeDate, activeView, formatToken, formatters, l.sprint, l.week, range.end, range.start, resolvedLocale, resolvedTimeZone, slots.length]);
|
|
12240
12268
|
const createMode = interactions?.createMode ?? "drag";
|
|
12241
12269
|
const canCreate = !isViewOnly && (interactions?.creatable ?? false) && !!onCreateEvent;
|
|
12242
|
-
const [createOpen, setCreateOpen] =
|
|
12243
|
-
const [createResourceId, setCreateResourceId] =
|
|
12244
|
-
const [createStartIdx, setCreateStartIdx] =
|
|
12245
|
-
const [createEndIdx, setCreateEndIdx] =
|
|
12246
|
-
const resourceOptions =
|
|
12270
|
+
const [createOpen, setCreateOpen] = React36.useState(false);
|
|
12271
|
+
const [createResourceId, setCreateResourceId] = React36.useState(null);
|
|
12272
|
+
const [createStartIdx, setCreateStartIdx] = React36.useState(0);
|
|
12273
|
+
const [createEndIdx, setCreateEndIdx] = React36.useState(1);
|
|
12274
|
+
const resourceOptions = React36.useMemo(() => {
|
|
12247
12275
|
return resources.map((r) => ({
|
|
12248
12276
|
label: typeof r.label === "string" ? r.label : r.id,
|
|
12249
12277
|
value: r.id,
|
|
@@ -12251,7 +12279,7 @@ function CalendarTimeline({
|
|
|
12251
12279
|
disabled: r.disabled ?? false
|
|
12252
12280
|
}));
|
|
12253
12281
|
}, [resources]);
|
|
12254
|
-
const formatCreateBoundaryLabel =
|
|
12282
|
+
const formatCreateBoundaryLabel = React36.useMemo(() => {
|
|
12255
12283
|
const timeFmt = getDtf(resolvedLocale, resolvedTimeZone, { hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
|
|
12256
12284
|
const dayFmt = getDtf(resolvedLocale, resolvedTimeZone, { weekday: "short", month: "short", day: "numeric" });
|
|
12257
12285
|
const yearFmt = getDtf(resolvedLocale, resolvedTimeZone, { year: "numeric" });
|
|
@@ -12299,7 +12327,7 @@ function CalendarTimeline({
|
|
|
12299
12327
|
return dayFmt.format(d);
|
|
12300
12328
|
};
|
|
12301
12329
|
}, [activeView, dueDateSprint, l.sprint, resolvedLocale, resolvedTimeZone, slotStarts, slotStarts.length]);
|
|
12302
|
-
const openCreate =
|
|
12330
|
+
const openCreate = React36.useCallback(() => {
|
|
12303
12331
|
if (!canCreate) return;
|
|
12304
12332
|
if (activeEventSheetOpen) setEventSheetOpen(false);
|
|
12305
12333
|
const firstResource = resources.find((r) => !r.disabled)?.id ?? resources[0]?.id ?? null;
|
|
@@ -12331,13 +12359,13 @@ function CalendarTimeline({
|
|
|
12331
12359
|
slotStarts,
|
|
12332
12360
|
slots.length
|
|
12333
12361
|
]);
|
|
12334
|
-
|
|
12362
|
+
React36.useEffect(() => {
|
|
12335
12363
|
setCreateEndIdx((prev) => Math.min(slots.length, Math.max(prev, createStartIdx + 1)));
|
|
12336
12364
|
}, [createStartIdx, slots.length]);
|
|
12337
|
-
const createStartOptions =
|
|
12365
|
+
const createStartOptions = React36.useMemo(() => {
|
|
12338
12366
|
return slotStarts.map((d, idx) => ({ label: formatCreateBoundaryLabel(d, { kind: "start", boundaryIdx: idx }), value: idx }));
|
|
12339
12367
|
}, [formatCreateBoundaryLabel, slotStarts]);
|
|
12340
|
-
const createEndOptions =
|
|
12368
|
+
const createEndOptions = React36.useMemo(() => {
|
|
12341
12369
|
const out = [];
|
|
12342
12370
|
for (let idx = createStartIdx + 1; idx <= slotStarts.length; idx++) {
|
|
12343
12371
|
const boundary = idx >= slotStarts.length ? range.end : slotStarts[idx];
|
|
@@ -12345,7 +12373,7 @@ function CalendarTimeline({
|
|
|
12345
12373
|
}
|
|
12346
12374
|
return out;
|
|
12347
12375
|
}, [createStartIdx, formatCreateBoundaryLabel, range.end, slotStarts]);
|
|
12348
|
-
const commitCreate =
|
|
12376
|
+
const commitCreate = React36.useCallback(() => {
|
|
12349
12377
|
if (!onCreateEvent) return;
|
|
12350
12378
|
if (!createResourceId) return;
|
|
12351
12379
|
const start = slotStarts[clamp5(createStartIdx, 0, Math.max(0, slotStarts.length - 1))];
|
|
@@ -12356,38 +12384,38 @@ function CalendarTimeline({
|
|
|
12356
12384
|
onCreateEvent({ resourceId: createResourceId, start, end: endBoundary });
|
|
12357
12385
|
setCreateOpen(false);
|
|
12358
12386
|
}, [createEndIdx, createResourceId, createStartIdx, onCreateEvent, range.end, slotStarts]);
|
|
12359
|
-
const dragRef =
|
|
12360
|
-
const [preview, setPreviewState] =
|
|
12361
|
-
const previewRef =
|
|
12362
|
-
const setPreview =
|
|
12387
|
+
const dragRef = React36.useRef(null);
|
|
12388
|
+
const [preview, setPreviewState] = React36.useState(null);
|
|
12389
|
+
const previewRef = React36.useRef(null);
|
|
12390
|
+
const setPreview = React36.useCallback((next) => {
|
|
12363
12391
|
previewRef.current = next;
|
|
12364
12392
|
setPreviewState(next);
|
|
12365
12393
|
}, []);
|
|
12366
|
-
const suppressNextEventClickRef =
|
|
12367
|
-
const [hoverCell, setHoverCellState] =
|
|
12368
|
-
const hoverCellRef =
|
|
12369
|
-
const setHoverCell =
|
|
12394
|
+
const suppressNextEventClickRef = React36.useRef(false);
|
|
12395
|
+
const [hoverCell, setHoverCellState] = React36.useState(null);
|
|
12396
|
+
const hoverCellRef = React36.useRef(null);
|
|
12397
|
+
const setHoverCell = React36.useCallback((next) => {
|
|
12370
12398
|
hoverCellRef.current = next;
|
|
12371
12399
|
setHoverCellState(next);
|
|
12372
12400
|
}, []);
|
|
12373
|
-
const autoScrollStateRef =
|
|
12401
|
+
const autoScrollStateRef = React36.useRef({
|
|
12374
12402
|
dir: 0,
|
|
12375
12403
|
speed: 0,
|
|
12376
12404
|
lastClientX: 0,
|
|
12377
12405
|
lastClientY: 0
|
|
12378
12406
|
});
|
|
12379
|
-
const autoScrollRafRef =
|
|
12380
|
-
const dragPreviewRafRef =
|
|
12381
|
-
const dragPreviewPointRef =
|
|
12382
|
-
const hoverCellRafRef =
|
|
12383
|
-
const hoverCellPendingRef =
|
|
12384
|
-
const stopAutoScroll =
|
|
12407
|
+
const autoScrollRafRef = React36.useRef(null);
|
|
12408
|
+
const dragPreviewRafRef = React36.useRef(null);
|
|
12409
|
+
const dragPreviewPointRef = React36.useRef(null);
|
|
12410
|
+
const hoverCellRafRef = React36.useRef(null);
|
|
12411
|
+
const hoverCellPendingRef = React36.useRef(null);
|
|
12412
|
+
const stopAutoScroll = React36.useCallback(() => {
|
|
12385
12413
|
if (autoScrollRafRef.current != null) cancelAnimationFrame(autoScrollRafRef.current);
|
|
12386
12414
|
autoScrollRafRef.current = null;
|
|
12387
12415
|
autoScrollStateRef.current.dir = 0;
|
|
12388
12416
|
autoScrollStateRef.current.speed = 0;
|
|
12389
12417
|
}, []);
|
|
12390
|
-
const getPointerContext =
|
|
12418
|
+
const getPointerContext = React36.useCallback(
|
|
12391
12419
|
(clientX, clientY, opts) => {
|
|
12392
12420
|
const body = bodyRef.current;
|
|
12393
12421
|
if (!body) return null;
|
|
@@ -12405,7 +12433,7 @@ function CalendarTimeline({
|
|
|
12405
12433
|
},
|
|
12406
12434
|
[xToSlotIdx]
|
|
12407
12435
|
);
|
|
12408
|
-
const slotToDate =
|
|
12436
|
+
const slotToDate = React36.useCallback(
|
|
12409
12437
|
(slotIdx) => {
|
|
12410
12438
|
const start = slotStarts[clamp5(slotIdx, 0, slotStarts.length - 1)];
|
|
12411
12439
|
if (activeView === "day") {
|
|
@@ -12419,7 +12447,7 @@ function CalendarTimeline({
|
|
|
12419
12447
|
},
|
|
12420
12448
|
[activeView, dayTimeStepMinutes, resolvedTimeZone, slotStarts]
|
|
12421
12449
|
);
|
|
12422
|
-
const updateDragPreview =
|
|
12450
|
+
const updateDragPreview = React36.useCallback(
|
|
12423
12451
|
(clientX, clientY) => {
|
|
12424
12452
|
const drag = dragRef.current;
|
|
12425
12453
|
if (!drag) return;
|
|
@@ -12463,13 +12491,13 @@ function CalendarTimeline({
|
|
|
12463
12491
|
},
|
|
12464
12492
|
[getPointerContext, range.end, range.start, slotToDate, slots.length]
|
|
12465
12493
|
);
|
|
12466
|
-
const flushDragPreview =
|
|
12494
|
+
const flushDragPreview = React36.useCallback(() => {
|
|
12467
12495
|
dragPreviewRafRef.current = null;
|
|
12468
12496
|
const point = dragPreviewPointRef.current;
|
|
12469
12497
|
if (!point) return;
|
|
12470
12498
|
updateDragPreview(point.x, point.y);
|
|
12471
12499
|
}, [updateDragPreview]);
|
|
12472
|
-
const scheduleDragPreview =
|
|
12500
|
+
const scheduleDragPreview = React36.useCallback(
|
|
12473
12501
|
(clientX, clientY) => {
|
|
12474
12502
|
dragPreviewPointRef.current = { x: clientX, y: clientY };
|
|
12475
12503
|
if (dragPreviewRafRef.current != null) return;
|
|
@@ -12477,7 +12505,7 @@ function CalendarTimeline({
|
|
|
12477
12505
|
},
|
|
12478
12506
|
[flushDragPreview]
|
|
12479
12507
|
);
|
|
12480
|
-
const applyHoverCell =
|
|
12508
|
+
const applyHoverCell = React36.useCallback(
|
|
12481
12509
|
(next) => {
|
|
12482
12510
|
const prev = hoverCellRef.current;
|
|
12483
12511
|
const same = prev == null && next == null || prev != null && next != null && prev.resourceId === next.resourceId && prev.slotIdx === next.slotIdx && Math.abs(prev.y - next.y) <= 0.5;
|
|
@@ -12486,11 +12514,11 @@ function CalendarTimeline({
|
|
|
12486
12514
|
},
|
|
12487
12515
|
[setHoverCell]
|
|
12488
12516
|
);
|
|
12489
|
-
const flushHoverCell =
|
|
12517
|
+
const flushHoverCell = React36.useCallback(() => {
|
|
12490
12518
|
hoverCellRafRef.current = null;
|
|
12491
12519
|
applyHoverCell(hoverCellPendingRef.current);
|
|
12492
12520
|
}, [applyHoverCell]);
|
|
12493
|
-
const scheduleHoverCell =
|
|
12521
|
+
const scheduleHoverCell = React36.useCallback(
|
|
12494
12522
|
(next) => {
|
|
12495
12523
|
hoverCellPendingRef.current = next;
|
|
12496
12524
|
if (hoverCellRafRef.current != null) return;
|
|
@@ -12498,7 +12526,7 @@ function CalendarTimeline({
|
|
|
12498
12526
|
},
|
|
12499
12527
|
[flushHoverCell]
|
|
12500
12528
|
);
|
|
12501
|
-
const autoScrollTick =
|
|
12529
|
+
const autoScrollTick = React36.useCallback(() => {
|
|
12502
12530
|
const drag = dragRef.current;
|
|
12503
12531
|
const body = bodyRef.current;
|
|
12504
12532
|
const st = autoScrollStateRef.current;
|
|
@@ -12517,7 +12545,7 @@ function CalendarTimeline({
|
|
|
12517
12545
|
updateDragPreview(st.lastClientX, st.lastClientY);
|
|
12518
12546
|
autoScrollRafRef.current = requestAnimationFrame(autoScrollTick);
|
|
12519
12547
|
}, [stopAutoScroll, updateDragPreview]);
|
|
12520
|
-
const updateAutoScrollFromPointer =
|
|
12548
|
+
const updateAutoScrollFromPointer = React36.useCallback(
|
|
12521
12549
|
(clientX, clientY) => {
|
|
12522
12550
|
const body = bodyRef.current;
|
|
12523
12551
|
if (!body) return;
|
|
@@ -12548,8 +12576,8 @@ function CalendarTimeline({
|
|
|
12548
12576
|
},
|
|
12549
12577
|
[autoScrollTick, stopAutoScroll]
|
|
12550
12578
|
);
|
|
12551
|
-
|
|
12552
|
-
|
|
12579
|
+
React36.useEffect(() => stopAutoScroll, [stopAutoScroll]);
|
|
12580
|
+
React36.useEffect(() => {
|
|
12553
12581
|
return () => {
|
|
12554
12582
|
if (dragPreviewRafRef.current != null) cancelAnimationFrame(dragPreviewRafRef.current);
|
|
12555
12583
|
if (hoverCellRafRef.current != null) cancelAnimationFrame(hoverCellRafRef.current);
|
|
@@ -12696,7 +12724,7 @@ function CalendarTimeline({
|
|
|
12696
12724
|
}
|
|
12697
12725
|
setPreview(null);
|
|
12698
12726
|
};
|
|
12699
|
-
const onBodyPointerLeave =
|
|
12727
|
+
const onBodyPointerLeave = React36.useCallback(() => {
|
|
12700
12728
|
hoverCellPendingRef.current = null;
|
|
12701
12729
|
if (hoverCellRafRef.current != null) {
|
|
12702
12730
|
cancelAnimationFrame(hoverCellRafRef.current);
|
|
@@ -12723,7 +12751,7 @@ function CalendarTimeline({
|
|
|
12723
12751
|
}
|
|
12724
12752
|
);
|
|
12725
12753
|
};
|
|
12726
|
-
const slotHeaderNodes =
|
|
12754
|
+
const slotHeaderNodes = React36.useMemo(() => {
|
|
12727
12755
|
const startIdx = colVirtEnabled ? visibleSlots.startIdx : 0;
|
|
12728
12756
|
const endIdx = colVirtEnabled ? visibleSlots.endIdx : slots.length;
|
|
12729
12757
|
const leftSpacer = startIdx > 0 ? slotLefts[startIdx] ?? 0 : 0;
|
|
@@ -13048,7 +13076,7 @@ function CalendarTimeline({
|
|
|
13048
13076
|
]
|
|
13049
13077
|
}
|
|
13050
13078
|
);
|
|
13051
|
-
if (!enableEventTooltips) return /* @__PURE__ */ jsx41(
|
|
13079
|
+
if (!enableEventTooltips) return /* @__PURE__ */ jsx41(React36.Fragment, { children: block }, ev.id);
|
|
13052
13080
|
const tooltipContent = /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-0.5", children: [
|
|
13053
13081
|
/* @__PURE__ */ jsx41("div", { className: "font-semibold", children: tooltipTitle }),
|
|
13054
13082
|
/* @__PURE__ */ jsx41("div", { className: "text-xs opacity-80", children: timeText }),
|
|
@@ -13204,7 +13232,7 @@ function CalendarTimeline({
|
|
|
13204
13232
|
}
|
|
13205
13233
|
|
|
13206
13234
|
// src/components/MultiCombobox.tsx
|
|
13207
|
-
import * as
|
|
13235
|
+
import * as React37 from "react";
|
|
13208
13236
|
import { useId as useId5 } from "react";
|
|
13209
13237
|
import { ChevronDown as ChevronDown4, Search as Search4, Check as Check6, SearchX as SearchX2, Loader2 as Loader24, X as X12, Sparkles as Sparkles3 } from "lucide-react";
|
|
13210
13238
|
import { Fragment as Fragment13, jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
@@ -13241,29 +13269,29 @@ var MultiCombobox = ({
|
|
|
13241
13269
|
maxTagsVisible = 3,
|
|
13242
13270
|
useOverlayScrollbar = false
|
|
13243
13271
|
}) => {
|
|
13244
|
-
const [query, setQuery] =
|
|
13245
|
-
const [open, setOpen] =
|
|
13246
|
-
const [activeIndex, setActiveIndex] =
|
|
13247
|
-
const inputRef =
|
|
13248
|
-
const listRef =
|
|
13249
|
-
const optionsListRef =
|
|
13272
|
+
const [query, setQuery] = React37.useState("");
|
|
13273
|
+
const [open, setOpen] = React37.useState(false);
|
|
13274
|
+
const [activeIndex, setActiveIndex] = React37.useState(null);
|
|
13275
|
+
const inputRef = React37.useRef(null);
|
|
13276
|
+
const listRef = React37.useRef([]);
|
|
13277
|
+
const optionsListRef = React37.useRef(null);
|
|
13250
13278
|
useOverlayScrollbarTarget(optionsListRef, { enabled: useOverlayScrollbar });
|
|
13251
|
-
const triggerRef =
|
|
13279
|
+
const triggerRef = React37.useRef(null);
|
|
13252
13280
|
useShadCNAnimations();
|
|
13253
|
-
const normalizedOptions =
|
|
13281
|
+
const normalizedOptions = React37.useMemo(
|
|
13254
13282
|
() => options.map(
|
|
13255
13283
|
(o) => typeof o === "string" ? { value: o, label: o } : { value: o.value, label: o.label, icon: o.icon, description: o.description, disabled: o.disabled, group: o.group }
|
|
13256
13284
|
),
|
|
13257
13285
|
[options]
|
|
13258
13286
|
);
|
|
13259
13287
|
const enableSearch = normalizedOptions.length > 10;
|
|
13260
|
-
const filtered =
|
|
13288
|
+
const filtered = React37.useMemo(
|
|
13261
13289
|
() => enableSearch ? normalizedOptions.filter(
|
|
13262
13290
|
(opt) => opt.label.toLowerCase().includes(query.trim().toLowerCase()) || opt.description?.toLowerCase().includes(query.trim().toLowerCase())
|
|
13263
13291
|
) : normalizedOptions,
|
|
13264
13292
|
[normalizedOptions, query, enableSearch]
|
|
13265
13293
|
);
|
|
13266
|
-
const groupedOptions =
|
|
13294
|
+
const groupedOptions = React37.useMemo(() => {
|
|
13267
13295
|
if (!groupBy) return null;
|
|
13268
13296
|
const groups = /* @__PURE__ */ new Map();
|
|
13269
13297
|
filtered.forEach((opt) => {
|
|
@@ -13299,7 +13327,7 @@ var MultiCombobox = ({
|
|
|
13299
13327
|
const handleClearAll = () => {
|
|
13300
13328
|
onChange([]);
|
|
13301
13329
|
};
|
|
13302
|
-
|
|
13330
|
+
React37.useEffect(() => {
|
|
13303
13331
|
if (open && enableSearch) {
|
|
13304
13332
|
setTimeout(() => {
|
|
13305
13333
|
inputRef.current?.focus();
|
|
@@ -13523,7 +13551,7 @@ var MultiCombobox = ({
|
|
|
13523
13551
|
/* @__PURE__ */ jsx42("div", { className: cn("flex items-center gap-1.5 flex-1 overflow-hidden", size === "sm" ? "min-h-4" : size === "lg" ? "min-h-8" : "min-h-6"), children: value.length > 0 ? showTags ? /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
13524
13552
|
visibleTags.map((option) => {
|
|
13525
13553
|
if (renderTag) {
|
|
13526
|
-
return /* @__PURE__ */ jsx42(
|
|
13554
|
+
return /* @__PURE__ */ jsx42(React37.Fragment, { children: renderTag(option, () => handleRemove(option.value)) }, option.value);
|
|
13527
13555
|
}
|
|
13528
13556
|
return /* @__PURE__ */ jsxs34(
|
|
13529
13557
|
"span",
|
|
@@ -13666,17 +13694,17 @@ var MultiCombobox = ({
|
|
|
13666
13694
|
};
|
|
13667
13695
|
|
|
13668
13696
|
// src/components/RadioGroup.tsx
|
|
13669
|
-
import * as
|
|
13697
|
+
import * as React38 from "react";
|
|
13670
13698
|
import { jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
13671
|
-
var RadioGroupContext =
|
|
13699
|
+
var RadioGroupContext = React38.createContext(void 0);
|
|
13672
13700
|
var useRadioGroup = () => {
|
|
13673
|
-
const context =
|
|
13701
|
+
const context = React38.useContext(RadioGroupContext);
|
|
13674
13702
|
if (!context) {
|
|
13675
13703
|
throw new Error("RadioGroupItem must be used within a RadioGroup");
|
|
13676
13704
|
}
|
|
13677
13705
|
return context;
|
|
13678
13706
|
};
|
|
13679
|
-
var RadioGroup =
|
|
13707
|
+
var RadioGroup = React38.forwardRef(
|
|
13680
13708
|
({
|
|
13681
13709
|
value,
|
|
13682
13710
|
defaultValue,
|
|
@@ -13692,7 +13720,7 @@ var RadioGroup = React37.forwardRef(
|
|
|
13692
13720
|
error = false,
|
|
13693
13721
|
errorMessage
|
|
13694
13722
|
}, ref) => {
|
|
13695
|
-
const [internalValue, setInternalValue] =
|
|
13723
|
+
const [internalValue, setInternalValue] = React38.useState(defaultValue || "");
|
|
13696
13724
|
const isControlled = value !== void 0;
|
|
13697
13725
|
const currentValue = isControlled ? value : internalValue;
|
|
13698
13726
|
const handleValueChange = (newValue) => {
|
|
@@ -13703,7 +13731,7 @@ var RadioGroup = React37.forwardRef(
|
|
|
13703
13731
|
onValueChange?.(newValue);
|
|
13704
13732
|
}
|
|
13705
13733
|
};
|
|
13706
|
-
const uniqueId =
|
|
13734
|
+
const uniqueId = React38.useId();
|
|
13707
13735
|
const radioName = name || `radio-group-${uniqueId}`;
|
|
13708
13736
|
return /* @__PURE__ */ jsx43(
|
|
13709
13737
|
RadioGroupContext.Provider,
|
|
@@ -13761,7 +13789,7 @@ var sizeStyles7 = {
|
|
|
13761
13789
|
padding: "p-4"
|
|
13762
13790
|
}
|
|
13763
13791
|
};
|
|
13764
|
-
var RadioGroupItem =
|
|
13792
|
+
var RadioGroupItem = React38.forwardRef(
|
|
13765
13793
|
({ value, id, disabled, className, children, label, labelClassName, description, icon }, ref) => {
|
|
13766
13794
|
const { value: selectedValue, onValueChange, name, disabled: groupDisabled, size = "md", variant = "default" } = useRadioGroup();
|
|
13767
13795
|
const isDisabled = disabled || groupDisabled;
|
|
@@ -13939,7 +13967,7 @@ var RadioGroupItem = React37.forwardRef(
|
|
|
13939
13967
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
13940
13968
|
|
|
13941
13969
|
// src/components/Slider.tsx
|
|
13942
|
-
import * as
|
|
13970
|
+
import * as React39 from "react";
|
|
13943
13971
|
import { Fragment as Fragment14, jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
13944
13972
|
var SIZE_STYLES = {
|
|
13945
13973
|
sm: {
|
|
@@ -13962,7 +13990,7 @@ var SIZE_STYLES = {
|
|
|
13962
13990
|
}
|
|
13963
13991
|
};
|
|
13964
13992
|
var clamp6 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
13965
|
-
var Slider =
|
|
13993
|
+
var Slider = React39.forwardRef(
|
|
13966
13994
|
({
|
|
13967
13995
|
className,
|
|
13968
13996
|
mode = "single",
|
|
@@ -13997,17 +14025,17 @@ var Slider = React38.forwardRef(
|
|
|
13997
14025
|
...props
|
|
13998
14026
|
}, ref) => {
|
|
13999
14027
|
const isRange = mode === "range";
|
|
14000
|
-
const trackRef =
|
|
14001
|
-
const [internalValue, setInternalValue] =
|
|
14002
|
-
const [internalRange, setInternalRange] =
|
|
14028
|
+
const trackRef = React39.useRef(null);
|
|
14029
|
+
const [internalValue, setInternalValue] = React39.useState(defaultValue);
|
|
14030
|
+
const [internalRange, setInternalRange] = React39.useState(() => {
|
|
14003
14031
|
if (defaultRangeValue) return defaultRangeValue;
|
|
14004
14032
|
const v = clamp6(defaultValue, min, max);
|
|
14005
14033
|
return [min, v];
|
|
14006
14034
|
});
|
|
14007
|
-
const [activeThumb, setActiveThumb] =
|
|
14008
|
-
const dragRef =
|
|
14009
|
-
const [isHovering, setIsHovering] =
|
|
14010
|
-
const [isDragging, setIsDragging] =
|
|
14035
|
+
const [activeThumb, setActiveThumb] = React39.useState(null);
|
|
14036
|
+
const dragRef = React39.useRef(null);
|
|
14037
|
+
const [isHovering, setIsHovering] = React39.useState(false);
|
|
14038
|
+
const [isDragging, setIsDragging] = React39.useState(false);
|
|
14011
14039
|
const isControlled = value !== void 0;
|
|
14012
14040
|
const currentValue = isControlled ? value : internalValue;
|
|
14013
14041
|
const isRangeControlled = rangeValue !== void 0;
|
|
@@ -14015,7 +14043,7 @@ var Slider = React38.forwardRef(
|
|
|
14015
14043
|
const rangeMin = clamp6(currentRange[0] ?? min, min, max);
|
|
14016
14044
|
const rangeMax = clamp6(currentRange[1] ?? max, min, max);
|
|
14017
14045
|
const normalizedRange = rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin];
|
|
14018
|
-
const handleSingleChange =
|
|
14046
|
+
const handleSingleChange = React39.useCallback(
|
|
14019
14047
|
(e) => {
|
|
14020
14048
|
const newValue = Number(e.target.value);
|
|
14021
14049
|
if (!isControlled) {
|
|
@@ -14026,14 +14054,14 @@ var Slider = React38.forwardRef(
|
|
|
14026
14054
|
},
|
|
14027
14055
|
[isControlled, onChange, onValueChange]
|
|
14028
14056
|
);
|
|
14029
|
-
const emitRange =
|
|
14057
|
+
const emitRange = React39.useCallback(
|
|
14030
14058
|
(next) => {
|
|
14031
14059
|
onRangeChange?.(next);
|
|
14032
14060
|
onRangeValueChange?.(next);
|
|
14033
14061
|
},
|
|
14034
14062
|
[onRangeChange, onRangeValueChange]
|
|
14035
14063
|
);
|
|
14036
|
-
const handleRangeChange =
|
|
14064
|
+
const handleRangeChange = React39.useCallback(
|
|
14037
14065
|
(thumb) => (e) => {
|
|
14038
14066
|
const nextVal = Number(e.target.value);
|
|
14039
14067
|
const [curMin, curMax] = normalizedRange;
|
|
@@ -14048,7 +14076,7 @@ var Slider = React38.forwardRef(
|
|
|
14048
14076
|
const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
|
|
14049
14077
|
const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
|
|
14050
14078
|
const sizeStyles8 = SIZE_STYLES[size];
|
|
14051
|
-
const displayValue =
|
|
14079
|
+
const displayValue = React39.useMemo(() => {
|
|
14052
14080
|
if (isRange) {
|
|
14053
14081
|
const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
|
|
14054
14082
|
const b = formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString();
|
|
@@ -14056,7 +14084,7 @@ var Slider = React38.forwardRef(
|
|
|
14056
14084
|
}
|
|
14057
14085
|
return formatValue ? formatValue(currentValue) : currentValue.toString();
|
|
14058
14086
|
}, [currentValue, formatValue, isRange, normalizedRange]);
|
|
14059
|
-
const quantize =
|
|
14087
|
+
const quantize = React39.useCallback(
|
|
14060
14088
|
(v) => {
|
|
14061
14089
|
const stepped = Math.round((v - min) / step) * step + min;
|
|
14062
14090
|
const fixed = Number(stepped.toFixed(10));
|
|
@@ -14064,7 +14092,7 @@ var Slider = React38.forwardRef(
|
|
|
14064
14092
|
},
|
|
14065
14093
|
[max, min, step]
|
|
14066
14094
|
);
|
|
14067
|
-
const valueFromClientX =
|
|
14095
|
+
const valueFromClientX = React39.useCallback(
|
|
14068
14096
|
(clientX) => {
|
|
14069
14097
|
const el = trackRef.current;
|
|
14070
14098
|
if (!el) return min;
|
|
@@ -14320,7 +14348,7 @@ Slider.displayName = "Slider";
|
|
|
14320
14348
|
|
|
14321
14349
|
// src/components/OverlayControls.tsx
|
|
14322
14350
|
import { Dot as Dot2, Maximize2, Pause, Play, RotateCcw, RotateCw, Volume2, VolumeX } from "lucide-react";
|
|
14323
|
-
import
|
|
14351
|
+
import React40 from "react";
|
|
14324
14352
|
import { Fragment as Fragment15, jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
14325
14353
|
function OverlayControls({
|
|
14326
14354
|
mode,
|
|
@@ -14351,24 +14379,24 @@ function OverlayControls({
|
|
|
14351
14379
|
}) {
|
|
14352
14380
|
const hoverClasses = showOnHover ? "opacity-0 pointer-events-none group-hover:opacity-100 group-hover:pointer-events-auto" : "opacity-100 pointer-events-auto";
|
|
14353
14381
|
const showControlsBar = mode === "review";
|
|
14354
|
-
const [rateOpen, setRateOpen] =
|
|
14355
|
-
const rateWrapRef =
|
|
14356
|
-
const [controlsVisible, setControlsVisible] =
|
|
14357
|
-
const hideTimerRef =
|
|
14358
|
-
const [previewData, setPreviewData] =
|
|
14359
|
-
const sliderRef =
|
|
14360
|
-
const [isDragging, setIsDragging] =
|
|
14361
|
-
const [dragValue, setDragValue] =
|
|
14362
|
-
|
|
14382
|
+
const [rateOpen, setRateOpen] = React40.useState(false);
|
|
14383
|
+
const rateWrapRef = React40.useRef(null);
|
|
14384
|
+
const [controlsVisible, setControlsVisible] = React40.useState(true);
|
|
14385
|
+
const hideTimerRef = React40.useRef(null);
|
|
14386
|
+
const [previewData, setPreviewData] = React40.useState(null);
|
|
14387
|
+
const sliderRef = React40.useRef(null);
|
|
14388
|
+
const [isDragging, setIsDragging] = React40.useState(false);
|
|
14389
|
+
const [dragValue, setDragValue] = React40.useState(value);
|
|
14390
|
+
React40.useEffect(() => {
|
|
14363
14391
|
if (!isDragging) {
|
|
14364
14392
|
setDragValue(value);
|
|
14365
14393
|
}
|
|
14366
14394
|
}, [value, isDragging]);
|
|
14367
|
-
const [keyboardFeedback, setKeyboardFeedback] =
|
|
14368
|
-
const feedbackTimerRef =
|
|
14369
|
-
const seekAccumulatorRef =
|
|
14370
|
-
const seekAccumulatorTimerRef =
|
|
14371
|
-
|
|
14395
|
+
const [keyboardFeedback, setKeyboardFeedback] = React40.useState(null);
|
|
14396
|
+
const feedbackTimerRef = React40.useRef(null);
|
|
14397
|
+
const seekAccumulatorRef = React40.useRef(0);
|
|
14398
|
+
const seekAccumulatorTimerRef = React40.useRef(null);
|
|
14399
|
+
React40.useEffect(() => {
|
|
14372
14400
|
const onDocDown = (e) => {
|
|
14373
14401
|
if (!rateOpen) return;
|
|
14374
14402
|
const wrap = rateWrapRef.current;
|
|
@@ -14379,7 +14407,7 @@ function OverlayControls({
|
|
|
14379
14407
|
document.addEventListener("mousedown", onDocDown);
|
|
14380
14408
|
return () => document.removeEventListener("mousedown", onDocDown);
|
|
14381
14409
|
}, [rateOpen]);
|
|
14382
|
-
|
|
14410
|
+
React40.useEffect(() => {
|
|
14383
14411
|
if (!autoHide || showOnHover) return;
|
|
14384
14412
|
const resetTimer = () => {
|
|
14385
14413
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
@@ -14417,7 +14445,7 @@ function OverlayControls({
|
|
|
14417
14445
|
seekAccumulatorRef.current = 0;
|
|
14418
14446
|
}, 1e3);
|
|
14419
14447
|
};
|
|
14420
|
-
|
|
14448
|
+
React40.useEffect(() => {
|
|
14421
14449
|
if (!enableKeyboardShortcuts) return;
|
|
14422
14450
|
const handleKeyDown = (e) => {
|
|
14423
14451
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) return;
|
|
@@ -15981,7 +16009,7 @@ function FileUpload({
|
|
|
15981
16009
|
}
|
|
15982
16010
|
|
|
15983
16011
|
// src/components/Carousel.tsx
|
|
15984
|
-
import * as
|
|
16012
|
+
import * as React42 from "react";
|
|
15985
16013
|
import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight7 } from "lucide-react";
|
|
15986
16014
|
import { Fragment as Fragment18, jsx as jsx49, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
15987
16015
|
function Carousel({
|
|
@@ -16004,19 +16032,19 @@ function Carousel({
|
|
|
16004
16032
|
thumbnailRenderer,
|
|
16005
16033
|
ariaLabel = "Carousel"
|
|
16006
16034
|
}) {
|
|
16007
|
-
const [currentIndex, setCurrentIndex] =
|
|
16008
|
-
const [isPaused, setIsPaused] =
|
|
16009
|
-
const [isDragging, setIsDragging] =
|
|
16010
|
-
const [startPos, setStartPos] =
|
|
16011
|
-
const [currentTranslate, setCurrentTranslate] =
|
|
16012
|
-
const [prevTranslate, setPrevTranslate] =
|
|
16013
|
-
const progressElRef =
|
|
16014
|
-
const carouselRef =
|
|
16015
|
-
const rafRef =
|
|
16016
|
-
const totalSlides =
|
|
16035
|
+
const [currentIndex, setCurrentIndex] = React42.useState(0);
|
|
16036
|
+
const [isPaused, setIsPaused] = React42.useState(false);
|
|
16037
|
+
const [isDragging, setIsDragging] = React42.useState(false);
|
|
16038
|
+
const [startPos, setStartPos] = React42.useState(0);
|
|
16039
|
+
const [currentTranslate, setCurrentTranslate] = React42.useState(0);
|
|
16040
|
+
const [prevTranslate, setPrevTranslate] = React42.useState(0);
|
|
16041
|
+
const progressElRef = React42.useRef(null);
|
|
16042
|
+
const carouselRef = React42.useRef(null);
|
|
16043
|
+
const rafRef = React42.useRef(null);
|
|
16044
|
+
const totalSlides = React42.Children.count(children);
|
|
16017
16045
|
const maxIndex = Math.max(0, totalSlides - slidesToShow);
|
|
16018
16046
|
const isHorizontal = orientation === "horizontal";
|
|
16019
|
-
const scrollPrev =
|
|
16047
|
+
const scrollPrev = React42.useCallback(() => {
|
|
16020
16048
|
setCurrentIndex((prev) => {
|
|
16021
16049
|
if (prev === 0) {
|
|
16022
16050
|
return loop ? maxIndex : 0;
|
|
@@ -16024,7 +16052,7 @@ function Carousel({
|
|
|
16024
16052
|
return Math.max(0, prev - slidesToScroll);
|
|
16025
16053
|
});
|
|
16026
16054
|
}, [loop, maxIndex, slidesToScroll]);
|
|
16027
|
-
const scrollNext =
|
|
16055
|
+
const scrollNext = React42.useCallback(() => {
|
|
16028
16056
|
setCurrentIndex((prev) => {
|
|
16029
16057
|
if (prev >= maxIndex) {
|
|
16030
16058
|
return loop ? 0 : maxIndex;
|
|
@@ -16032,13 +16060,13 @@ function Carousel({
|
|
|
16032
16060
|
return Math.min(maxIndex, prev + slidesToScroll);
|
|
16033
16061
|
});
|
|
16034
16062
|
}, [loop, maxIndex, slidesToScroll]);
|
|
16035
|
-
const scrollTo =
|
|
16063
|
+
const scrollTo = React42.useCallback(
|
|
16036
16064
|
(index) => {
|
|
16037
16065
|
setCurrentIndex(Math.min(maxIndex, Math.max(0, index)));
|
|
16038
16066
|
},
|
|
16039
16067
|
[maxIndex]
|
|
16040
16068
|
);
|
|
16041
|
-
|
|
16069
|
+
React42.useEffect(() => {
|
|
16042
16070
|
const handleKeyDown = (e) => {
|
|
16043
16071
|
if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
16044
16072
|
e.preventDefault();
|
|
@@ -16060,7 +16088,7 @@ function Carousel({
|
|
|
16060
16088
|
return () => carousel.removeEventListener("keydown", handleKeyDown);
|
|
16061
16089
|
}
|
|
16062
16090
|
}, [scrollPrev, scrollNext, scrollTo, maxIndex]);
|
|
16063
|
-
|
|
16091
|
+
React42.useEffect(() => {
|
|
16064
16092
|
const stop = () => {
|
|
16065
16093
|
if (rafRef.current != null) {
|
|
16066
16094
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -16119,7 +16147,7 @@ function Carousel({
|
|
|
16119
16147
|
setCurrentTranslate(0);
|
|
16120
16148
|
setPrevTranslate(0);
|
|
16121
16149
|
};
|
|
16122
|
-
|
|
16150
|
+
React42.useEffect(() => {
|
|
16123
16151
|
onSlideChange?.(currentIndex);
|
|
16124
16152
|
}, [currentIndex, onSlideChange]);
|
|
16125
16153
|
const getAnimationStyles2 = () => {
|
|
@@ -16172,7 +16200,7 @@ function Carousel({
|
|
|
16172
16200
|
role: "group",
|
|
16173
16201
|
"aria-atomic": "false",
|
|
16174
16202
|
"aria-live": autoScroll ? "off" : "polite",
|
|
16175
|
-
children:
|
|
16203
|
+
children: React42.Children.map(children, (child, idx) => /* @__PURE__ */ jsx49(
|
|
16176
16204
|
"div",
|
|
16177
16205
|
{
|
|
16178
16206
|
className: cn(
|
|
@@ -16262,7 +16290,7 @@ function Carousel({
|
|
|
16262
16290
|
"absolute bottom-0 left-0 right-0 flex gap-2 p-4 bg-linear-to-t from-black/50 to-transparent overflow-x-auto",
|
|
16263
16291
|
isHorizontal ? "flex-row" : "flex-col"
|
|
16264
16292
|
),
|
|
16265
|
-
children:
|
|
16293
|
+
children: React42.Children.map(children, (child, idx) => /* @__PURE__ */ jsx49(
|
|
16266
16294
|
"button",
|
|
16267
16295
|
{
|
|
16268
16296
|
onClick: () => scrollTo(idx),
|
|
@@ -16283,7 +16311,7 @@ function Carousel({
|
|
|
16283
16311
|
}
|
|
16284
16312
|
|
|
16285
16313
|
// src/components/FallingIcons.tsx
|
|
16286
|
-
import
|
|
16314
|
+
import React43 from "react";
|
|
16287
16315
|
import { jsx as jsx50, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
16288
16316
|
var DEFAULT_COUNT = 24;
|
|
16289
16317
|
var DEFAULT_SPEED_RANGE = [6, 14];
|
|
@@ -16311,10 +16339,10 @@ function FallingIcons({
|
|
|
16311
16339
|
physics,
|
|
16312
16340
|
easingFunction = "linear"
|
|
16313
16341
|
}) {
|
|
16314
|
-
const uid =
|
|
16315
|
-
const containerRef =
|
|
16316
|
-
const [fallDist, setFallDist] =
|
|
16317
|
-
const idRef =
|
|
16342
|
+
const uid = React43.useId().replace(/[:]/g, "");
|
|
16343
|
+
const containerRef = React43.useRef(null);
|
|
16344
|
+
const [fallDist, setFallDist] = React43.useState(null);
|
|
16345
|
+
const idRef = React43.useRef(1);
|
|
16318
16346
|
const gravity = physics?.gravity ?? 1;
|
|
16319
16347
|
const windDirection = physics?.windDirection ?? 0;
|
|
16320
16348
|
const windStrength = physics?.windStrength ?? 0;
|
|
@@ -16328,7 +16356,7 @@ function FallingIcons({
|
|
|
16328
16356
|
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
16329
16357
|
elastic: "cubic-bezier(0.175, 0.885, 0.32, 1.275)"
|
|
16330
16358
|
};
|
|
16331
|
-
const makeParticle =
|
|
16359
|
+
const makeParticle = React43.useCallback(() => {
|
|
16332
16360
|
const rnd = (min, max) => min + Math.random() * (max - min);
|
|
16333
16361
|
return {
|
|
16334
16362
|
leftPct: rnd(0, 100),
|
|
@@ -16342,12 +16370,12 @@ function FallingIcons({
|
|
|
16342
16370
|
key: idRef.current++
|
|
16343
16371
|
};
|
|
16344
16372
|
}, [sizeRange, speedRange, horizontalDrift, gravity, windDirection, windStrength]);
|
|
16345
|
-
const [particles, setParticles] =
|
|
16346
|
-
|
|
16373
|
+
const [particles, setParticles] = React43.useState([]);
|
|
16374
|
+
React43.useEffect(() => {
|
|
16347
16375
|
const arr = Array.from({ length: Math.max(0, count) }).map(() => makeParticle());
|
|
16348
16376
|
setParticles(arr);
|
|
16349
16377
|
}, [count, makeParticle]);
|
|
16350
|
-
|
|
16378
|
+
React43.useEffect(() => {
|
|
16351
16379
|
if (fullScreen) {
|
|
16352
16380
|
const measure2 = () => setFallDist(window.innerHeight + 200);
|
|
16353
16381
|
measure2();
|
|
@@ -16372,14 +16400,14 @@ function FallingIcons({
|
|
|
16372
16400
|
const SpinName = `uv-spin-${uid}`;
|
|
16373
16401
|
const PopName = `uv-pop-${uid}`;
|
|
16374
16402
|
const PhysicsSpinName = `uv-physics-spin-${uid}`;
|
|
16375
|
-
const glowStyles =
|
|
16403
|
+
const glowStyles = React43.useMemo(() => {
|
|
16376
16404
|
if (!glow) return {};
|
|
16377
16405
|
const intensity = Math.max(0, Math.min(1, glowIntensity));
|
|
16378
16406
|
return {
|
|
16379
16407
|
filter: `drop-shadow(0 0 ${4 * intensity}px ${glowColor}) drop-shadow(0 0 ${8 * intensity}px ${glowColor})`
|
|
16380
16408
|
};
|
|
16381
16409
|
}, [glow, glowColor, glowIntensity]);
|
|
16382
|
-
const FallbackIcon =
|
|
16410
|
+
const FallbackIcon = React43.useMemo(
|
|
16383
16411
|
() => (props) => /* @__PURE__ */ jsx50("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx50("circle", { cx: "12", cy: "12", r: "10" }) }),
|
|
16384
16412
|
[]
|
|
16385
16413
|
);
|
|
@@ -16437,7 +16465,7 @@ function FallingIcons({
|
|
|
16437
16465
|
});
|
|
16438
16466
|
};
|
|
16439
16467
|
const trailParticles = trail ? Array.from({ length: Math.min(5, Math.max(1, trailLength)) }) : [];
|
|
16440
|
-
return /* @__PURE__ */ jsxs42(
|
|
16468
|
+
return /* @__PURE__ */ jsxs42(React43.Fragment, { children: [
|
|
16441
16469
|
trail && trailParticles.map((_, trailIndex) => {
|
|
16442
16470
|
const trailDelay = p.delay - (trailIndex + 1) * 0.15;
|
|
16443
16471
|
const trailOpacity = 1 - (trailIndex + 1) * (1 / (trailParticles.length + 1));
|
|
@@ -16555,7 +16583,7 @@ function FallingIcons({
|
|
|
16555
16583
|
}
|
|
16556
16584
|
|
|
16557
16585
|
// src/components/List.tsx
|
|
16558
|
-
import * as
|
|
16586
|
+
import * as React44 from "react";
|
|
16559
16587
|
import { ChevronRight as ChevronRight8 } from "lucide-react";
|
|
16560
16588
|
import { Fragment as Fragment19, jsx as jsx51, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
16561
16589
|
var SIZE_STYLES2 = {
|
|
@@ -16581,7 +16609,7 @@ var ListItemSkeleton = ({ size }) => {
|
|
|
16581
16609
|
] })
|
|
16582
16610
|
] });
|
|
16583
16611
|
};
|
|
16584
|
-
var ListRoot =
|
|
16612
|
+
var ListRoot = React44.forwardRef(
|
|
16585
16613
|
({
|
|
16586
16614
|
as = "ul",
|
|
16587
16615
|
ordered,
|
|
@@ -16601,9 +16629,9 @@ var ListRoot = React43.forwardRef(
|
|
|
16601
16629
|
...rest
|
|
16602
16630
|
}, ref) => {
|
|
16603
16631
|
const Comp = ordered ? "ol" : as;
|
|
16604
|
-
const childCount =
|
|
16632
|
+
const childCount = React44.Children.count(children);
|
|
16605
16633
|
const hasChildren = childCount > 0;
|
|
16606
|
-
const
|
|
16634
|
+
const variantClasses3 = {
|
|
16607
16635
|
plain: "",
|
|
16608
16636
|
outlined: "rounded-2xl md:rounded-3xl bg-card text-card-foreground border border-border shadow-sm max-md:rounded-xl",
|
|
16609
16637
|
soft: "rounded-2xl md:rounded-3xl bg-muted/40 border border-border/60 max-md:rounded-xl",
|
|
@@ -16617,14 +16645,14 @@ var ListRoot = React43.forwardRef(
|
|
|
16617
16645
|
Comp,
|
|
16618
16646
|
{
|
|
16619
16647
|
ref,
|
|
16620
|
-
className: cn("group/list",
|
|
16648
|
+
className: cn("group/list", variantClasses3[variant], inset && "p-1.5 md:p-2 max-md:p-1", divided && "divide-y divide-border/60", className),
|
|
16621
16649
|
...rest,
|
|
16622
16650
|
children: Array.from({ length: loadingCount }).map((_, i) => /* @__PURE__ */ jsx51(ListItemSkeleton, { size }, i))
|
|
16623
16651
|
}
|
|
16624
16652
|
);
|
|
16625
16653
|
}
|
|
16626
16654
|
if (!hasChildren && emptyText) {
|
|
16627
|
-
return /* @__PURE__ */ jsx51(Comp, { ref, className: cn("group/list",
|
|
16655
|
+
return /* @__PURE__ */ jsx51(Comp, { ref, className: cn("group/list", variantClasses3[variant], inset && "p-1.5 md:p-2 max-md:p-1", className), ...rest, children: /* @__PURE__ */ jsx51("div", { className: "text-center py-8 text-muted-foreground text-sm", children: emptyText }) });
|
|
16628
16656
|
}
|
|
16629
16657
|
return /* @__PURE__ */ jsx51(
|
|
16630
16658
|
Comp,
|
|
@@ -16632,21 +16660,21 @@ var ListRoot = React43.forwardRef(
|
|
|
16632
16660
|
ref,
|
|
16633
16661
|
className: cn(
|
|
16634
16662
|
"group/list",
|
|
16635
|
-
|
|
16663
|
+
variantClasses3[variant],
|
|
16636
16664
|
inset && "p-1.5 md:p-2 max-md:p-1",
|
|
16637
16665
|
divided && "divide-y divide-border/60",
|
|
16638
16666
|
variant === "striped" && "[&>*:nth-child(even)]:bg-muted/30",
|
|
16639
16667
|
className
|
|
16640
16668
|
),
|
|
16641
16669
|
...rest,
|
|
16642
|
-
children:
|
|
16643
|
-
if (!
|
|
16670
|
+
children: React44.Children.map(children, (child, idx) => {
|
|
16671
|
+
if (!React44.isValidElement(child)) return child;
|
|
16644
16672
|
const childClass = cn(
|
|
16645
16673
|
child.props?.className,
|
|
16646
16674
|
hoverable && variant !== "flush" && "hover:bg-accent/50 focus:bg-accent/60 focus:outline-none transition-colors",
|
|
16647
16675
|
variant === "flush" && "hover:bg-accent/30"
|
|
16648
16676
|
);
|
|
16649
|
-
return
|
|
16677
|
+
return React44.cloneElement(child, {
|
|
16650
16678
|
className: childClass,
|
|
16651
16679
|
// Pass global item class to contentClassName of ListItem
|
|
16652
16680
|
contentClassName: cn(itemClassName, child.props?.contentClassName),
|
|
@@ -16661,7 +16689,7 @@ var ListRoot = React43.forwardRef(
|
|
|
16661
16689
|
}
|
|
16662
16690
|
);
|
|
16663
16691
|
ListRoot.displayName = "List";
|
|
16664
|
-
var ListItem =
|
|
16692
|
+
var ListItem = React44.forwardRef(
|
|
16665
16693
|
({
|
|
16666
16694
|
as = "li",
|
|
16667
16695
|
selected = false,
|
|
@@ -16684,7 +16712,7 @@ var ListItem = React43.forwardRef(
|
|
|
16684
16712
|
children,
|
|
16685
16713
|
...rest
|
|
16686
16714
|
}, ref) => {
|
|
16687
|
-
const [internalExpanded, setInternalExpanded] =
|
|
16715
|
+
const [internalExpanded, setInternalExpanded] = React44.useState(false);
|
|
16688
16716
|
const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
16689
16717
|
const sizeAttr = rest["data-size"];
|
|
16690
16718
|
const resolvedSize = sizeAttr && ["xs", "sm", "md", "lg"].includes(sizeAttr) ? sizeAttr : "md";
|
|
@@ -16752,7 +16780,7 @@ var List = Object.assign(ListRoot, { Item: ListItem });
|
|
|
16752
16780
|
var List_default = List;
|
|
16753
16781
|
|
|
16754
16782
|
// src/components/Watermark.tsx
|
|
16755
|
-
import * as
|
|
16783
|
+
import * as React45 from "react";
|
|
16756
16784
|
import { createPortal as createPortal5 } from "react-dom";
|
|
16757
16785
|
import { Fragment as Fragment20, jsx as jsx52, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
16758
16786
|
var PRESETS2 = {
|
|
@@ -16764,8 +16792,8 @@ var PRESETS2 = {
|
|
|
16764
16792
|
internal: { text: "INTERNAL USE ONLY", color: "rgba(156, 163, 175, 0.15)", rotate: -22, fontSize: 13, fontWeight: "600" }
|
|
16765
16793
|
};
|
|
16766
16794
|
function useWatermarkDataURL(opts) {
|
|
16767
|
-
const [url, setUrl] =
|
|
16768
|
-
|
|
16795
|
+
const [url, setUrl] = React45.useState(null);
|
|
16796
|
+
React45.useEffect(() => {
|
|
16769
16797
|
let cancelled = false;
|
|
16770
16798
|
const text = opts.text;
|
|
16771
16799
|
const image = opts.image;
|
|
@@ -16942,9 +16970,9 @@ var Watermark = ({
|
|
|
16942
16970
|
children,
|
|
16943
16971
|
...rest
|
|
16944
16972
|
}) => {
|
|
16945
|
-
const [visible, setVisible] =
|
|
16946
|
-
const [isDark, setIsDark] =
|
|
16947
|
-
|
|
16973
|
+
const [visible, setVisible] = React45.useState(true);
|
|
16974
|
+
const [isDark, setIsDark] = React45.useState(false);
|
|
16975
|
+
React45.useEffect(() => {
|
|
16948
16976
|
if (!darkMode) return;
|
|
16949
16977
|
const checkDarkMode = () => {
|
|
16950
16978
|
const isDarkMode = document.documentElement.classList.contains("dark") || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -17046,7 +17074,7 @@ var Watermark = ({
|
|
|
17046
17074
|
var Watermark_default = Watermark;
|
|
17047
17075
|
|
|
17048
17076
|
// src/components/Timeline.tsx
|
|
17049
|
-
import * as
|
|
17077
|
+
import * as React46 from "react";
|
|
17050
17078
|
import { ChevronDown as ChevronDown6 } from "lucide-react";
|
|
17051
17079
|
import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
17052
17080
|
var SIZE_STYLE = {
|
|
@@ -17099,7 +17127,7 @@ var STATUS_COLOR = {
|
|
|
17099
17127
|
error: "bg-destructive",
|
|
17100
17128
|
info: "bg-info"
|
|
17101
17129
|
};
|
|
17102
|
-
var TimelineContext =
|
|
17130
|
+
var TimelineContext = React46.createContext(null);
|
|
17103
17131
|
var LINE_STYLE_MAP = {
|
|
17104
17132
|
solid: "border-solid",
|
|
17105
17133
|
dashed: "border-dashed",
|
|
@@ -17127,7 +17155,7 @@ var Marker = ({ index, last, size, color, status = "default", lineColor, lineSty
|
|
|
17127
17155
|
!last && showLine && /* @__PURE__ */ jsx53("div", { className: cn("flex-1 border-l-2", LINE_STYLE_MAP[lineStyle]), style: { borderColor: lineColor || "hsl(var(--border))" } })
|
|
17128
17156
|
] });
|
|
17129
17157
|
};
|
|
17130
|
-
var TimelineRoot =
|
|
17158
|
+
var TimelineRoot = React46.forwardRef(
|
|
17131
17159
|
({
|
|
17132
17160
|
align = "left",
|
|
17133
17161
|
variant = "default",
|
|
@@ -17157,7 +17185,7 @@ var TimelineRoot = React45.forwardRef(
|
|
|
17157
17185
|
}
|
|
17158
17186
|
);
|
|
17159
17187
|
TimelineRoot.displayName = "Timeline";
|
|
17160
|
-
var TimelineItem =
|
|
17188
|
+
var TimelineItem = React46.forwardRef(
|
|
17161
17189
|
({
|
|
17162
17190
|
title,
|
|
17163
17191
|
description,
|
|
@@ -17176,11 +17204,11 @@ var TimelineItem = React45.forwardRef(
|
|
|
17176
17204
|
children,
|
|
17177
17205
|
...rest
|
|
17178
17206
|
}, ref) => {
|
|
17179
|
-
const ctx =
|
|
17207
|
+
const ctx = React46.useContext(TimelineContext);
|
|
17180
17208
|
const idx = rest["data-index"];
|
|
17181
17209
|
const isLast = Boolean(rest["data-last"]);
|
|
17182
17210
|
const sz = SIZE_STYLE[ctx.size];
|
|
17183
|
-
const [internalExpanded, setInternalExpanded] =
|
|
17211
|
+
const [internalExpanded, setInternalExpanded] = React46.useState(false);
|
|
17184
17212
|
const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
17185
17213
|
const toggleExpanded = () => {
|
|
17186
17214
|
const newExpanded = !isExpanded;
|
|
@@ -17191,7 +17219,7 @@ var TimelineItem = React45.forwardRef(
|
|
|
17191
17219
|
}
|
|
17192
17220
|
};
|
|
17193
17221
|
const padding = ctx.dense ? sz.densePadY : sz.padY;
|
|
17194
|
-
const
|
|
17222
|
+
const variantClasses3 = {
|
|
17195
17223
|
default: "",
|
|
17196
17224
|
outlined: "rounded-xl border border-border bg-card shadow-sm px-4 py-3",
|
|
17197
17225
|
card: "rounded-2xl border border-border bg-card shadow-md px-5 py-4",
|
|
@@ -17199,7 +17227,7 @@ var TimelineItem = React45.forwardRef(
|
|
|
17199
17227
|
modern: "rounded-xl bg-linear-to-r from-card to-muted/20 border border-border/50 px-5 py-4 backdrop-blur-sm",
|
|
17200
17228
|
gradient: "rounded-2xl bg-linear-to-br from-primary/10 via-card to-accent/10 border border-primary/20 px-5 py-4 shadow-lg"
|
|
17201
17229
|
};
|
|
17202
|
-
const contentBox = /* @__PURE__ */ jsxs45("div", { className: cn("min-w-0 flex-1",
|
|
17230
|
+
const contentBox = /* @__PURE__ */ jsxs45("div", { className: cn("min-w-0 flex-1", variantClasses3[ctx.variant]), children: [
|
|
17203
17231
|
/* @__PURE__ */ jsxs45("div", { className: "flex items-start justify-between gap-2", children: [
|
|
17204
17232
|
/* @__PURE__ */ jsxs45("div", { className: "flex-1 min-w-0", children: [
|
|
17205
17233
|
title && /* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-2", children: [
|
|
@@ -17322,7 +17350,7 @@ var Timeline = Object.assign(TimelineRoot, { Item: TimelineItem });
|
|
|
17322
17350
|
var Timeline_default = Timeline;
|
|
17323
17351
|
|
|
17324
17352
|
// src/components/ColorPicker.tsx
|
|
17325
|
-
import * as
|
|
17353
|
+
import * as React47 from "react";
|
|
17326
17354
|
import { Pipette, X as X15, Copy, Check as Check9, Palette, History } from "lucide-react";
|
|
17327
17355
|
import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
17328
17356
|
var clamp7 = (n, min, max) => Math.max(min, Math.min(max, n));
|
|
@@ -17516,12 +17544,12 @@ function ColorPicker({
|
|
|
17516
17544
|
}) {
|
|
17517
17545
|
const isControlled = value !== void 0;
|
|
17518
17546
|
const initial = parseAnyColor(isControlled ? value : defaultValue) || { r: 79, g: 70, b: 229, a: 1 };
|
|
17519
|
-
const [rgba, setRgba] =
|
|
17520
|
-
const [open, setOpen] =
|
|
17521
|
-
const [text, setText] =
|
|
17522
|
-
const [copied, setCopied] =
|
|
17523
|
-
const [recentColors, setRecentColors] =
|
|
17524
|
-
|
|
17547
|
+
const [rgba, setRgba] = React47.useState(initial);
|
|
17548
|
+
const [open, setOpen] = React47.useState(false);
|
|
17549
|
+
const [text, setText] = React47.useState(() => formatOutput(initial, withAlpha, format));
|
|
17550
|
+
const [copied, setCopied] = React47.useState(false);
|
|
17551
|
+
const [recentColors, setRecentColors] = React47.useState([]);
|
|
17552
|
+
React47.useEffect(() => {
|
|
17525
17553
|
if (isControlled) {
|
|
17526
17554
|
const parsed = parseAnyColor(value);
|
|
17527
17555
|
if (parsed) {
|
|
@@ -18197,7 +18225,7 @@ var MusicPlayer = ({
|
|
|
18197
18225
|
var MusicPlayer_default = MusicPlayer;
|
|
18198
18226
|
|
|
18199
18227
|
// src/components/Grid.tsx
|
|
18200
|
-
import
|
|
18228
|
+
import React49, { useId as useId8 } from "react";
|
|
18201
18229
|
import { Fragment as Fragment21, jsx as jsx56, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
18202
18230
|
var BP_MIN = {
|
|
18203
18231
|
sm: 640,
|
|
@@ -18237,7 +18265,7 @@ function getVariantClasses(variant = "default", outlined) {
|
|
|
18237
18265
|
};
|
|
18238
18266
|
return variants[variant] || "";
|
|
18239
18267
|
}
|
|
18240
|
-
var GridRoot =
|
|
18268
|
+
var GridRoot = React49.forwardRef(
|
|
18241
18269
|
({
|
|
18242
18270
|
columns,
|
|
18243
18271
|
rows,
|
|
@@ -18321,7 +18349,7 @@ var GridRoot = React48.forwardRef(
|
|
|
18321
18349
|
}
|
|
18322
18350
|
);
|
|
18323
18351
|
GridRoot.displayName = "Grid";
|
|
18324
|
-
var GridItem =
|
|
18352
|
+
var GridItem = React49.forwardRef(
|
|
18325
18353
|
({
|
|
18326
18354
|
colSpan,
|
|
18327
18355
|
rowSpan,
|
|
@@ -20133,7 +20161,7 @@ var LoadingBar = ({
|
|
|
20133
20161
|
};
|
|
20134
20162
|
|
|
20135
20163
|
// src/components/Table.tsx
|
|
20136
|
-
import
|
|
20164
|
+
import React58 from "react";
|
|
20137
20165
|
import { jsx as jsx67, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
20138
20166
|
var TABLE_BASE_CLASS = "w-full caption-bottom text-sm";
|
|
20139
20167
|
var TABLE_CONTAINER_BASE_CLASS = [
|
|
@@ -20151,8 +20179,8 @@ function assignRef3(ref, value) {
|
|
|
20151
20179
|
ref.current = value;
|
|
20152
20180
|
}
|
|
20153
20181
|
}
|
|
20154
|
-
var TableContainer =
|
|
20155
|
-
const containerRef =
|
|
20182
|
+
var TableContainer = React58.forwardRef(({ className, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20183
|
+
const containerRef = React58.useRef(null);
|
|
20156
20184
|
useOverlayScrollbarTarget(containerRef, { enabled: useOverlayScrollbar });
|
|
20157
20185
|
return /* @__PURE__ */ jsx67(
|
|
20158
20186
|
"div",
|
|
@@ -20167,7 +20195,7 @@ var TableContainer = React57.forwardRef(({ className, useOverlayScrollbar = fals
|
|
|
20167
20195
|
);
|
|
20168
20196
|
});
|
|
20169
20197
|
TableContainer.displayName = "TableContainer";
|
|
20170
|
-
var Table =
|
|
20198
|
+
var Table = React58.forwardRef(
|
|
20171
20199
|
({ className, containerClassName, disableContainer = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20172
20200
|
if (disableContainer) {
|
|
20173
20201
|
return /* @__PURE__ */ jsx67("table", { ref, className: cn(TABLE_BASE_CLASS, className), ...props });
|
|
@@ -20176,16 +20204,16 @@ var Table = React57.forwardRef(
|
|
|
20176
20204
|
}
|
|
20177
20205
|
);
|
|
20178
20206
|
Table.displayName = "Table";
|
|
20179
|
-
var TableHeader =
|
|
20207
|
+
var TableHeader = React58.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ jsxs58("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border", "bg-muted", className), ...props, children: [
|
|
20180
20208
|
children,
|
|
20181
20209
|
filterRow
|
|
20182
20210
|
] }));
|
|
20183
20211
|
TableHeader.displayName = "TableHeader";
|
|
20184
|
-
var TableBody =
|
|
20212
|
+
var TableBody = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
20185
20213
|
TableBody.displayName = "TableBody";
|
|
20186
|
-
var TableFooter =
|
|
20214
|
+
var TableFooter = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
20187
20215
|
TableFooter.displayName = "TableFooter";
|
|
20188
|
-
var TableRow =
|
|
20216
|
+
var TableRow = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67(
|
|
20189
20217
|
"tr",
|
|
20190
20218
|
{
|
|
20191
20219
|
ref,
|
|
@@ -20199,7 +20227,7 @@ var TableRow = React57.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
20199
20227
|
}
|
|
20200
20228
|
));
|
|
20201
20229
|
TableRow.displayName = "TableRow";
|
|
20202
|
-
var TableHead =
|
|
20230
|
+
var TableHead = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67(
|
|
20203
20231
|
"th",
|
|
20204
20232
|
{
|
|
20205
20233
|
ref,
|
|
@@ -20208,13 +20236,13 @@ var TableHead = React57.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
20208
20236
|
}
|
|
20209
20237
|
));
|
|
20210
20238
|
TableHead.displayName = "TableHead";
|
|
20211
|
-
var TableCell =
|
|
20239
|
+
var TableCell = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
20212
20240
|
TableCell.displayName = "TableCell";
|
|
20213
|
-
var TableCaption =
|
|
20241
|
+
var TableCaption = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx67("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
20214
20242
|
TableCaption.displayName = "TableCaption";
|
|
20215
20243
|
|
|
20216
20244
|
// src/components/DataTable/DataTable.tsx
|
|
20217
|
-
import
|
|
20245
|
+
import React67 from "react";
|
|
20218
20246
|
|
|
20219
20247
|
// src/components/DataTable/components/DataTableBody.tsx
|
|
20220
20248
|
import { jsx as jsx68, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
@@ -20286,7 +20314,7 @@ function DataTableBodyRows({
|
|
|
20286
20314
|
}
|
|
20287
20315
|
|
|
20288
20316
|
// src/components/DataTable/components/DataTableHeader.tsx
|
|
20289
|
-
import
|
|
20317
|
+
import React59 from "react";
|
|
20290
20318
|
import { Filter as FilterIcon } from "lucide-react";
|
|
20291
20319
|
import { Fragment as Fragment26, jsx as jsx69, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
20292
20320
|
function DataTableHeader({
|
|
@@ -20306,7 +20334,7 @@ function DataTableHeader({
|
|
|
20306
20334
|
getStickyHeaderCellStyle,
|
|
20307
20335
|
t
|
|
20308
20336
|
}) {
|
|
20309
|
-
const renderFilterControl =
|
|
20337
|
+
const renderFilterControl = React59.useCallback(
|
|
20310
20338
|
(col) => {
|
|
20311
20339
|
if (!col.filter) return null;
|
|
20312
20340
|
const key = col.key;
|
|
@@ -20359,7 +20387,7 @@ function DataTableHeader({
|
|
|
20359
20387
|
},
|
|
20360
20388
|
[filters, setCurPage, setFilters, size]
|
|
20361
20389
|
);
|
|
20362
|
-
const renderHeaderContent =
|
|
20390
|
+
const renderHeaderContent = React59.useCallback(
|
|
20363
20391
|
(col, isLeaf) => {
|
|
20364
20392
|
if (!isLeaf) {
|
|
20365
20393
|
return /* @__PURE__ */ jsx69(
|
|
@@ -20522,7 +20550,7 @@ function DataTableHeader({
|
|
|
20522
20550
|
}
|
|
20523
20551
|
|
|
20524
20552
|
// src/components/DataTable/components/Pagination.tsx
|
|
20525
|
-
import
|
|
20553
|
+
import React60 from "react";
|
|
20526
20554
|
import { jsx as jsx70, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
20527
20555
|
function DataTablePagination({
|
|
20528
20556
|
totalItems,
|
|
@@ -20541,7 +20569,7 @@ function DataTablePagination({
|
|
|
20541
20569
|
const pageBtnClass = size === "sm" ? "h-6 min-w-6 px-1.5 rounded-full text-[11px] font-medium transition-colors" : size === "lg" ? "h-8 min-w-8 px-2.5 rounded-full text-sm font-medium transition-colors" : "h-7 min-w-7 px-2 rounded-full text-xs font-medium transition-colors";
|
|
20542
20570
|
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20543
20571
|
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20544
|
-
const pages =
|
|
20572
|
+
const pages = React60.useMemo(() => {
|
|
20545
20573
|
const result = [];
|
|
20546
20574
|
if (totalPages <= 5) {
|
|
20547
20575
|
for (let i = 1; i <= totalPages; i++) result.push(i);
|
|
@@ -20616,7 +20644,7 @@ function DataTablePagination({
|
|
|
20616
20644
|
}
|
|
20617
20645
|
|
|
20618
20646
|
// src/components/DataTable/components/Toolbar.tsx
|
|
20619
|
-
import
|
|
20647
|
+
import React61 from "react";
|
|
20620
20648
|
|
|
20621
20649
|
// src/components/DataTable/utils/headers.ts
|
|
20622
20650
|
function isLeafColumn(col) {
|
|
@@ -20737,7 +20765,7 @@ function DataTableToolbar({
|
|
|
20737
20765
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
20738
20766
|
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
20739
20767
|
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
20740
|
-
const leafCols =
|
|
20768
|
+
const leafCols = React61.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20741
20769
|
return /* @__PURE__ */ jsxs62("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
20742
20770
|
/* @__PURE__ */ jsx71("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
20743
20771
|
/* @__PURE__ */ jsxs62("div", { className: "flex items-center gap-2", children: [
|
|
@@ -20805,10 +20833,10 @@ function DataTableToolbar({
|
|
|
20805
20833
|
}
|
|
20806
20834
|
|
|
20807
20835
|
// src/components/DataTable/hooks/useDebounced.ts
|
|
20808
|
-
import
|
|
20836
|
+
import React62 from "react";
|
|
20809
20837
|
function useDebounced(value, delay = 300) {
|
|
20810
|
-
const [debounced, setDebounced] =
|
|
20811
|
-
|
|
20838
|
+
const [debounced, setDebounced] = React62.useState(value);
|
|
20839
|
+
React62.useEffect(() => {
|
|
20812
20840
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
20813
20841
|
return () => clearTimeout(id);
|
|
20814
20842
|
}, [value, delay]);
|
|
@@ -20816,7 +20844,7 @@ function useDebounced(value, delay = 300) {
|
|
|
20816
20844
|
}
|
|
20817
20845
|
|
|
20818
20846
|
// src/components/DataTable/hooks/useDataTableModel.ts
|
|
20819
|
-
import
|
|
20847
|
+
import React63 from "react";
|
|
20820
20848
|
|
|
20821
20849
|
// src/components/DataTable/utils/columns.ts
|
|
20822
20850
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -20844,22 +20872,22 @@ function useDataTableModel({
|
|
|
20844
20872
|
isServerMode,
|
|
20845
20873
|
total
|
|
20846
20874
|
}) {
|
|
20847
|
-
const visibleColsSet =
|
|
20848
|
-
const allLeafColumns =
|
|
20849
|
-
const columnMap =
|
|
20875
|
+
const visibleColsSet = React63.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
20876
|
+
const allLeafColumns = React63.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20877
|
+
const columnMap = React63.useMemo(() => {
|
|
20850
20878
|
return new Map(allLeafColumns.map((column) => [column.key, column]));
|
|
20851
20879
|
}, [allLeafColumns]);
|
|
20852
|
-
const visibleColumns =
|
|
20880
|
+
const visibleColumns = React63.useMemo(() => {
|
|
20853
20881
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
20854
20882
|
}, [columns, visibleColsSet]);
|
|
20855
|
-
const leafColumns =
|
|
20883
|
+
const leafColumns = React63.useMemo(() => {
|
|
20856
20884
|
return getLeafColumnsWithFixedInheritance(visibleColumns);
|
|
20857
20885
|
}, [visibleColumns]);
|
|
20858
|
-
const headerRows =
|
|
20859
|
-
const totalColumnsWidth =
|
|
20886
|
+
const headerRows = React63.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
20887
|
+
const totalColumnsWidth = React63.useMemo(() => {
|
|
20860
20888
|
return leafColumns.reduce((sum, column) => sum + getColumnWidth(column), 0);
|
|
20861
20889
|
}, [leafColumns]);
|
|
20862
|
-
const processedData =
|
|
20890
|
+
const processedData = React63.useMemo(() => {
|
|
20863
20891
|
if (isServerMode) return data;
|
|
20864
20892
|
let result = [...data];
|
|
20865
20893
|
if (Object.keys(filters).length > 0) {
|
|
@@ -20891,7 +20919,7 @@ function useDataTableModel({
|
|
|
20891
20919
|
return result;
|
|
20892
20920
|
}, [columnMap, data, filters, isServerMode, sort]);
|
|
20893
20921
|
const totalItems = isServerMode ? total : processedData.length;
|
|
20894
|
-
const displayedData =
|
|
20922
|
+
const displayedData = React63.useMemo(() => {
|
|
20895
20923
|
if (isServerMode) return data;
|
|
20896
20924
|
const start = (curPage - 1) * curPageSize;
|
|
20897
20925
|
return processedData.slice(start, start + curPageSize);
|
|
@@ -20907,13 +20935,13 @@ function useDataTableModel({
|
|
|
20907
20935
|
}
|
|
20908
20936
|
|
|
20909
20937
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
20910
|
-
import
|
|
20938
|
+
import React65 from "react";
|
|
20911
20939
|
|
|
20912
20940
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
20913
|
-
import
|
|
20941
|
+
import React64 from "react";
|
|
20914
20942
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
20915
|
-
const loadedFromStorage =
|
|
20916
|
-
const [curPageSize, setCurPageSize] =
|
|
20943
|
+
const loadedFromStorage = React64.useRef(false);
|
|
20944
|
+
const [curPageSize, setCurPageSize] = React64.useState(() => {
|
|
20917
20945
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
20918
20946
|
try {
|
|
20919
20947
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -20928,11 +20956,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
20928
20956
|
}
|
|
20929
20957
|
return pageSize;
|
|
20930
20958
|
});
|
|
20931
|
-
const hasMounted =
|
|
20932
|
-
|
|
20959
|
+
const hasMounted = React64.useRef(false);
|
|
20960
|
+
React64.useEffect(() => {
|
|
20933
20961
|
hasMounted.current = true;
|
|
20934
20962
|
}, []);
|
|
20935
|
-
|
|
20963
|
+
React64.useEffect(() => {
|
|
20936
20964
|
if (typeof window === "undefined" || !storageKey) return;
|
|
20937
20965
|
if (!hasMounted.current) return;
|
|
20938
20966
|
try {
|
|
@@ -20940,7 +20968,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
20940
20968
|
} catch {
|
|
20941
20969
|
}
|
|
20942
20970
|
}, [curPageSize, storageKey]);
|
|
20943
|
-
|
|
20971
|
+
React64.useEffect(() => {
|
|
20944
20972
|
if (storageKey && loadedFromStorage.current) return;
|
|
20945
20973
|
setCurPageSize(pageSize);
|
|
20946
20974
|
}, [pageSize, storageKey]);
|
|
@@ -20960,17 +20988,17 @@ function useDataTableState({
|
|
|
20960
20988
|
size,
|
|
20961
20989
|
storageKey
|
|
20962
20990
|
}) {
|
|
20963
|
-
const allLeafColumns =
|
|
20964
|
-
const defaultVisibleLeafKeys =
|
|
20965
|
-
const knownLeafKeysRef =
|
|
20966
|
-
const [headerAlign, setHeaderAlign] =
|
|
20967
|
-
const [visibleCols, setVisibleCols] =
|
|
20968
|
-
const [filters, setFilters] =
|
|
20969
|
-
const [sort, setSort] =
|
|
20970
|
-
const [density, setDensity] =
|
|
20971
|
-
const [curPage, setCurPage] =
|
|
20991
|
+
const allLeafColumns = React65.useMemo(() => getLeafColumns(columns), [columns]);
|
|
20992
|
+
const defaultVisibleLeafKeys = React65.useMemo(() => allLeafColumns.filter((column) => column.visible !== false).map((column) => column.key), [allLeafColumns]);
|
|
20993
|
+
const knownLeafKeysRef = React65.useRef(new Set(defaultVisibleLeafKeys));
|
|
20994
|
+
const [headerAlign, setHeaderAlign] = React65.useState("left");
|
|
20995
|
+
const [visibleCols, setVisibleCols] = React65.useState(defaultVisibleLeafKeys);
|
|
20996
|
+
const [filters, setFilters] = React65.useState({});
|
|
20997
|
+
const [sort, setSort] = React65.useState(null);
|
|
20998
|
+
const [density, setDensity] = React65.useState(() => SIZE_TO_DENSITY[size]);
|
|
20999
|
+
const [curPage, setCurPage] = React65.useState(page);
|
|
20972
21000
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
20973
|
-
|
|
21001
|
+
React65.useEffect(() => {
|
|
20974
21002
|
const knownLeafKeys = knownLeafKeysRef.current;
|
|
20975
21003
|
setVisibleCols((prev) => {
|
|
20976
21004
|
const prevSet = new Set(prev);
|
|
@@ -20978,10 +21006,10 @@ function useDataTableState({
|
|
|
20978
21006
|
});
|
|
20979
21007
|
knownLeafKeysRef.current = new Set(allLeafColumns.map((column) => column.key));
|
|
20980
21008
|
}, [allLeafColumns]);
|
|
20981
|
-
|
|
21009
|
+
React65.useEffect(() => {
|
|
20982
21010
|
setCurPage(page);
|
|
20983
21011
|
}, [page]);
|
|
20984
|
-
|
|
21012
|
+
React65.useEffect(() => {
|
|
20985
21013
|
setDensity(SIZE_TO_DENSITY[size]);
|
|
20986
21014
|
}, [size]);
|
|
20987
21015
|
return {
|
|
@@ -21003,7 +21031,7 @@ function useDataTableState({
|
|
|
21003
21031
|
}
|
|
21004
21032
|
|
|
21005
21033
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21006
|
-
import
|
|
21034
|
+
import React66 from "react";
|
|
21007
21035
|
|
|
21008
21036
|
// src/components/DataTable/utils/sticky.ts
|
|
21009
21037
|
function buildStickyLayout(visibleColumns) {
|
|
@@ -21050,8 +21078,8 @@ function resolveGroupStickyPosition(column, positions) {
|
|
|
21050
21078
|
|
|
21051
21079
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21052
21080
|
function useStickyColumns(visibleColumns) {
|
|
21053
|
-
const { positions, leftBoundaryKey, rightBoundaryKey } =
|
|
21054
|
-
const getStickyColumnStyle =
|
|
21081
|
+
const { positions, leftBoundaryKey, rightBoundaryKey } = React66.useMemo(() => buildStickyLayout(visibleColumns), [visibleColumns]);
|
|
21082
|
+
const getStickyColumnStyle = React66.useCallback(
|
|
21055
21083
|
(col) => {
|
|
21056
21084
|
const pos = resolveStickyPosition(col, positions);
|
|
21057
21085
|
if (!pos) return {};
|
|
@@ -21062,7 +21090,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21062
21090
|
},
|
|
21063
21091
|
[positions]
|
|
21064
21092
|
);
|
|
21065
|
-
const getBoundaryShadowClass =
|
|
21093
|
+
const getBoundaryShadowClass = React66.useCallback(
|
|
21066
21094
|
(col) => {
|
|
21067
21095
|
if (col.fixed === "left" && col.key === leftBoundaryKey) {
|
|
21068
21096
|
return "border-r border-border/80 shadow-[10px_0_16px_-10px_rgba(0,0,0,0.55)]";
|
|
@@ -21074,14 +21102,14 @@ function useStickyColumns(visibleColumns) {
|
|
|
21074
21102
|
},
|
|
21075
21103
|
[leftBoundaryKey, rightBoundaryKey]
|
|
21076
21104
|
);
|
|
21077
|
-
const getStickyHeaderClass =
|
|
21105
|
+
const getStickyHeaderClass = React66.useCallback(
|
|
21078
21106
|
(col) => {
|
|
21079
21107
|
if (!col.fixed) return "";
|
|
21080
21108
|
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50 !bg-muted");
|
|
21081
21109
|
},
|
|
21082
21110
|
[getBoundaryShadowClass]
|
|
21083
21111
|
);
|
|
21084
|
-
const getStickyCellClass =
|
|
21112
|
+
const getStickyCellClass = React66.useCallback(
|
|
21085
21113
|
(col, isStripedRow) => {
|
|
21086
21114
|
if (!col.fixed) return "";
|
|
21087
21115
|
return cn(
|
|
@@ -21094,7 +21122,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21094
21122
|
},
|
|
21095
21123
|
[getBoundaryShadowClass]
|
|
21096
21124
|
);
|
|
21097
|
-
const getStickyHeaderCellStyle =
|
|
21125
|
+
const getStickyHeaderCellStyle = React66.useCallback(
|
|
21098
21126
|
(headerCell) => {
|
|
21099
21127
|
const col = headerCell.column;
|
|
21100
21128
|
if (headerCell.isLeaf) {
|
|
@@ -21241,7 +21269,7 @@ function DataTable({
|
|
|
21241
21269
|
size,
|
|
21242
21270
|
storageKey
|
|
21243
21271
|
});
|
|
21244
|
-
|
|
21272
|
+
React67.useEffect(() => {
|
|
21245
21273
|
if (process.env.NODE_ENV === "development") {
|
|
21246
21274
|
const warnings = validateColumns(columns);
|
|
21247
21275
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
@@ -21249,8 +21277,8 @@ function DataTable({
|
|
|
21249
21277
|
}, [columns]);
|
|
21250
21278
|
const debouncedFilters = useDebounced(filters, 350);
|
|
21251
21279
|
const isServerMode = Boolean(onQueryChange);
|
|
21252
|
-
const hasEmittedQuery =
|
|
21253
|
-
|
|
21280
|
+
const hasEmittedQuery = React67.useRef(false);
|
|
21281
|
+
React67.useEffect(() => {
|
|
21254
21282
|
if (!onQueryChange) return;
|
|
21255
21283
|
if (!hasEmittedQuery.current) {
|
|
21256
21284
|
hasEmittedQuery.current = true;
|
|
@@ -21258,7 +21286,7 @@ function DataTable({
|
|
|
21258
21286
|
}
|
|
21259
21287
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
21260
21288
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
21261
|
-
|
|
21289
|
+
React67.useEffect(() => {
|
|
21262
21290
|
if (process.env.NODE_ENV !== "development" || rowKey) return;
|
|
21263
21291
|
const hasQueryFeatures = columns.some((column) => column.sortable || column.filter) || Boolean(pageSizeOptions?.length) || isServerMode;
|
|
21264
21292
|
if (!hasQueryFeatures) return;
|
|
@@ -21286,7 +21314,7 @@ function DataTable({
|
|
|
21286
21314
|
if (typeof rowKey === "function") return String(rowKey(row));
|
|
21287
21315
|
return String(row[rowKey]);
|
|
21288
21316
|
};
|
|
21289
|
-
const viewportRef =
|
|
21317
|
+
const viewportRef = React67.useRef(null);
|
|
21290
21318
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
21291
21319
|
return /* @__PURE__ */ jsxs63("div", { className: cn("space-y-2", className), children: [
|
|
21292
21320
|
/* @__PURE__ */ jsx72(
|
|
@@ -21392,10 +21420,10 @@ function DataTable({
|
|
|
21392
21420
|
var DataTable_default = DataTable;
|
|
21393
21421
|
|
|
21394
21422
|
// src/components/Form.tsx
|
|
21395
|
-
import * as
|
|
21423
|
+
import * as React68 from "react";
|
|
21396
21424
|
import { Controller, FormProvider, useFormContext, useForm } from "react-hook-form";
|
|
21397
21425
|
import { jsx as jsx73, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
21398
|
-
var FormConfigContext =
|
|
21426
|
+
var FormConfigContext = React68.createContext({ size: "md" });
|
|
21399
21427
|
var FormWrapper = ({
|
|
21400
21428
|
children,
|
|
21401
21429
|
onSubmit,
|
|
@@ -21408,7 +21436,7 @@ var FormWrapper = ({
|
|
|
21408
21436
|
const methods = useForm({
|
|
21409
21437
|
defaultValues: initialValues
|
|
21410
21438
|
});
|
|
21411
|
-
|
|
21439
|
+
React68.useEffect(() => {
|
|
21412
21440
|
if (initialValues) {
|
|
21413
21441
|
methods.reset(initialValues);
|
|
21414
21442
|
}
|
|
@@ -21417,15 +21445,15 @@ var FormWrapper = ({
|
|
|
21417
21445
|
return /* @__PURE__ */ jsx73(FormProvider, { ...methods, children: /* @__PURE__ */ jsx73(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx73("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
21418
21446
|
};
|
|
21419
21447
|
var Form = FormWrapper;
|
|
21420
|
-
var FormFieldContext =
|
|
21448
|
+
var FormFieldContext = React68.createContext({});
|
|
21421
21449
|
var FormField = ({
|
|
21422
21450
|
...props
|
|
21423
21451
|
}) => {
|
|
21424
21452
|
return /* @__PURE__ */ jsx73(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx73(Controller, { ...props }) });
|
|
21425
21453
|
};
|
|
21426
21454
|
var useFormField = () => {
|
|
21427
|
-
const fieldContext =
|
|
21428
|
-
const itemContext =
|
|
21455
|
+
const fieldContext = React68.useContext(FormFieldContext);
|
|
21456
|
+
const itemContext = React68.useContext(FormItemContext);
|
|
21429
21457
|
const { getFieldState, formState } = useFormContext();
|
|
21430
21458
|
if (!fieldContext) {
|
|
21431
21459
|
try {
|
|
@@ -21446,16 +21474,16 @@ var useFormField = () => {
|
|
|
21446
21474
|
...fieldState
|
|
21447
21475
|
};
|
|
21448
21476
|
};
|
|
21449
|
-
var FormItemContext =
|
|
21450
|
-
var FormItem =
|
|
21451
|
-
const id =
|
|
21477
|
+
var FormItemContext = React68.createContext({});
|
|
21478
|
+
var FormItem = React68.forwardRef(({ className, ...props }, ref) => {
|
|
21479
|
+
const id = React68.useId();
|
|
21452
21480
|
return /* @__PURE__ */ jsx73(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx73("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
21453
21481
|
});
|
|
21454
21482
|
FormItem.displayName = "FormItem";
|
|
21455
|
-
var FormLabel =
|
|
21483
|
+
var FormLabel = React68.forwardRef(
|
|
21456
21484
|
({ className, children, required, ...props }, ref) => {
|
|
21457
21485
|
const { error, formItemId } = useFormField();
|
|
21458
|
-
const config =
|
|
21486
|
+
const config = React68.useContext(FormConfigContext);
|
|
21459
21487
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
21460
21488
|
return /* @__PURE__ */ jsxs64(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
21461
21489
|
children,
|
|
@@ -21464,7 +21492,7 @@ var FormLabel = React67.forwardRef(
|
|
|
21464
21492
|
}
|
|
21465
21493
|
);
|
|
21466
21494
|
FormLabel.displayName = "FormLabel";
|
|
21467
|
-
var FormControl =
|
|
21495
|
+
var FormControl = React68.forwardRef(({ ...props }, ref) => {
|
|
21468
21496
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
21469
21497
|
return /* @__PURE__ */ jsx73(
|
|
21470
21498
|
"div",
|
|
@@ -21478,12 +21506,12 @@ var FormControl = React67.forwardRef(({ ...props }, ref) => {
|
|
|
21478
21506
|
);
|
|
21479
21507
|
});
|
|
21480
21508
|
FormControl.displayName = "FormControl";
|
|
21481
|
-
var FormDescription =
|
|
21509
|
+
var FormDescription = React68.forwardRef(({ className, ...props }, ref) => {
|
|
21482
21510
|
const { formDescriptionId } = useFormField();
|
|
21483
21511
|
return /* @__PURE__ */ jsx73("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
21484
21512
|
});
|
|
21485
21513
|
FormDescription.displayName = "FormDescription";
|
|
21486
|
-
var FormMessage =
|
|
21514
|
+
var FormMessage = React68.forwardRef(({ className, children, ...props }, ref) => {
|
|
21487
21515
|
const { error, formMessageId } = useFormField();
|
|
21488
21516
|
const body = error ? String(error?.message) : children;
|
|
21489
21517
|
if (!body) {
|
|
@@ -21492,7 +21520,7 @@ var FormMessage = React67.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
21492
21520
|
return /* @__PURE__ */ jsx73("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
21493
21521
|
});
|
|
21494
21522
|
FormMessage.displayName = "FormMessage";
|
|
21495
|
-
var FormInput =
|
|
21523
|
+
var FormInput = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(
|
|
21496
21524
|
FormField,
|
|
21497
21525
|
{
|
|
21498
21526
|
name,
|
|
@@ -21503,7 +21531,7 @@ var FormInput = React67.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
|
|
|
21503
21531
|
}
|
|
21504
21532
|
) }));
|
|
21505
21533
|
FormInput.displayName = "FormInput";
|
|
21506
|
-
var FormCheckbox =
|
|
21534
|
+
var FormCheckbox = React68.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(
|
|
21507
21535
|
FormField,
|
|
21508
21536
|
{
|
|
21509
21537
|
name,
|
|
@@ -21527,9 +21555,9 @@ var FormCheckbox = React67.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
21527
21555
|
}
|
|
21528
21556
|
) }));
|
|
21529
21557
|
FormCheckbox.displayName = "FormCheckbox";
|
|
21530
|
-
var FormActions =
|
|
21558
|
+
var FormActions = React68.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx73("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
21531
21559
|
FormActions.displayName = "FormActions";
|
|
21532
|
-
var FormSubmitButton =
|
|
21560
|
+
var FormSubmitButton = React68.forwardRef(
|
|
21533
21561
|
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ jsx73(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx73(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
|
|
21534
21562
|
);
|
|
21535
21563
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
@@ -21820,7 +21848,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
21820
21848
|
};
|
|
21821
21849
|
|
|
21822
21850
|
// ../../lib/i18n/translation-adapter.tsx
|
|
21823
|
-
import * as
|
|
21851
|
+
import * as React70 from "react";
|
|
21824
21852
|
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
21825
21853
|
var defaultTranslations2 = {
|
|
21826
21854
|
en: {
|
|
@@ -22168,9 +22196,9 @@ var defaultTranslations2 = {
|
|
|
22168
22196
|
}
|
|
22169
22197
|
}
|
|
22170
22198
|
};
|
|
22171
|
-
var TranslationContext2 =
|
|
22199
|
+
var TranslationContext2 = React70.createContext(null);
|
|
22172
22200
|
var UnderverseProvider = ({ children, locale = "en", translations }) => {
|
|
22173
|
-
const t =
|
|
22201
|
+
const t = React70.useCallback(
|
|
22174
22202
|
(namespace) => {
|
|
22175
22203
|
return (key) => {
|
|
22176
22204
|
const mergedTranslations = {
|
|
@@ -22236,7 +22264,7 @@ function getInternalTranslation(namespace, locale) {
|
|
|
22236
22264
|
};
|
|
22237
22265
|
}
|
|
22238
22266
|
function useTranslations(namespace) {
|
|
22239
|
-
const underverseContext =
|
|
22267
|
+
const underverseContext = React70.useContext(TranslationContext2);
|
|
22240
22268
|
if (underverseContext) {
|
|
22241
22269
|
return (key, params) => {
|
|
22242
22270
|
const result = underverseContext.t(namespace)(key);
|
|
@@ -22253,7 +22281,7 @@ function useTranslations(namespace) {
|
|
|
22253
22281
|
return getInternalTranslation(namespace, "en");
|
|
22254
22282
|
}
|
|
22255
22283
|
function useLocale() {
|
|
22256
|
-
const underverseContext =
|
|
22284
|
+
const underverseContext = React70.useContext(TranslationContext2);
|
|
22257
22285
|
if (underverseContext) {
|
|
22258
22286
|
return underverseContext.locale;
|
|
22259
22287
|
}
|
|
@@ -22272,7 +22300,7 @@ function useLocale() {
|
|
|
22272
22300
|
}
|
|
22273
22301
|
|
|
22274
22302
|
// src/components/UEditor/UEditor.tsx
|
|
22275
|
-
import
|
|
22303
|
+
import React79, { useEffect as useEffect37, useImperativeHandle as useImperativeHandle3, useMemo as useMemo29, useRef as useRef36 } from "react";
|
|
22276
22304
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
22277
22305
|
|
|
22278
22306
|
// src/components/UEditor/extensions.ts
|
|
@@ -23878,7 +23906,7 @@ function buildUEditorExtensions({
|
|
|
23878
23906
|
}
|
|
23879
23907
|
|
|
23880
23908
|
// src/components/UEditor/toolbar.tsx
|
|
23881
|
-
import
|
|
23909
|
+
import React77, { useRef as useRef34, useState as useState52 } from "react";
|
|
23882
23910
|
import {
|
|
23883
23911
|
AlignCenter,
|
|
23884
23912
|
AlignJustify,
|
|
@@ -24271,7 +24299,7 @@ function fileToDataUrl2(file) {
|
|
|
24271
24299
|
reader.readAsDataURL(file);
|
|
24272
24300
|
});
|
|
24273
24301
|
}
|
|
24274
|
-
var ToolbarButton =
|
|
24302
|
+
var ToolbarButton = React77.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
24275
24303
|
const button = /* @__PURE__ */ jsx85(
|
|
24276
24304
|
"button",
|
|
24277
24305
|
{
|
|
@@ -25476,7 +25504,7 @@ async function prepareUEditorContentForSave({
|
|
|
25476
25504
|
|
|
25477
25505
|
// src/components/UEditor/UEditor.tsx
|
|
25478
25506
|
import { jsx as jsx87, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
25479
|
-
var UEditor =
|
|
25507
|
+
var UEditor = React79.forwardRef(({
|
|
25480
25508
|
content = "",
|
|
25481
25509
|
onChange,
|
|
25482
25510
|
onHtmlChange,
|