@underverse-ui/underverse 0.1.34 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +799 -264
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -2
- package/dist/index.d.ts +52 -2
- package/dist/index.js +790 -256
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,6 +70,7 @@ var Button = forwardRef(
|
|
|
70
70
|
lockMs = 600,
|
|
71
71
|
asContainer = false,
|
|
72
72
|
noWrap = true,
|
|
73
|
+
noHoverOverlay = false,
|
|
73
74
|
...rest
|
|
74
75
|
}, ref) => {
|
|
75
76
|
const baseStyles = asContainer ? "relative inline-flex justify-center rounded-md font-medium transition-colors duration-150 ease-soft outline-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background active:translate-y-px" : "relative inline-flex items-center justify-center gap-2 rounded-md font-medium overflow-hidden transition-colors duration-150 ease-soft outline-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background active:translate-y-px";
|
|
@@ -131,7 +132,7 @@ var Button = forwardRef(
|
|
|
131
132
|
"aria-label": rest["aria-label"] || title,
|
|
132
133
|
...rest,
|
|
133
134
|
children: [
|
|
134
|
-
/* @__PURE__ */ jsx("span", { className: "absolute inset-0 bg-gradient-to-r from-primary-foreground/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200" }),
|
|
135
|
+
!noHoverOverlay && /* @__PURE__ */ jsx("span", { className: "absolute inset-0 bg-gradient-to-r from-primary-foreground/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-200" }),
|
|
135
136
|
loading2 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
136
137
|
/* @__PURE__ */ jsx(SpinnerIcon, { className: "w-4 h-4 animate-spin" }),
|
|
137
138
|
loadingText && /* @__PURE__ */ jsx("span", { className: "ml-2", "aria-live": "polite", children: loadingText }),
|
|
@@ -6751,78 +6752,610 @@ function ImageUpload({
|
|
|
6751
6752
|
|
|
6752
6753
|
// ../../components/ui/Carousel.tsx
|
|
6753
6754
|
import * as React27 from "react";
|
|
6754
|
-
import {
|
|
6755
|
+
import { ChevronLeft as ChevronLeft3, ChevronRight as ChevronRight5 } from "lucide-react";
|
|
6755
6756
|
import { Fragment as Fragment9, jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6756
|
-
function Carousel({
|
|
6757
|
+
function Carousel({
|
|
6758
|
+
children,
|
|
6759
|
+
autoScroll = true,
|
|
6760
|
+
autoScrollInterval = 5e3,
|
|
6761
|
+
animation = "slide",
|
|
6762
|
+
orientation = "horizontal",
|
|
6763
|
+
showArrows = true,
|
|
6764
|
+
showDots = true,
|
|
6765
|
+
showProgress = false,
|
|
6766
|
+
showThumbnails = false,
|
|
6767
|
+
loop = true,
|
|
6768
|
+
slidesToShow = 1,
|
|
6769
|
+
slidesToScroll = 1,
|
|
6770
|
+
className,
|
|
6771
|
+
containerClassName,
|
|
6772
|
+
slideClassName,
|
|
6773
|
+
onSlideChange,
|
|
6774
|
+
thumbnailRenderer,
|
|
6775
|
+
ariaLabel = "Carousel"
|
|
6776
|
+
}) {
|
|
6757
6777
|
const [currentIndex, setCurrentIndex] = React27.useState(0);
|
|
6758
|
-
const totalSlides = React27.Children.count(children);
|
|
6759
6778
|
const [isPaused, setIsPaused] = React27.useState(false);
|
|
6779
|
+
const [isDragging, setIsDragging] = React27.useState(false);
|
|
6780
|
+
const [startPos, setStartPos] = React27.useState(0);
|
|
6781
|
+
const [currentTranslate, setCurrentTranslate] = React27.useState(0);
|
|
6782
|
+
const [prevTranslate, setPrevTranslate] = React27.useState(0);
|
|
6783
|
+
const progressElRef = React27.useRef(null);
|
|
6784
|
+
const carouselRef = React27.useRef(null);
|
|
6785
|
+
const rafRef = React27.useRef(null);
|
|
6786
|
+
const totalSlides = React27.Children.count(children);
|
|
6787
|
+
const maxIndex = Math.max(0, totalSlides - slidesToShow);
|
|
6788
|
+
const isHorizontal = orientation === "horizontal";
|
|
6760
6789
|
const scrollPrev = React27.useCallback(() => {
|
|
6761
|
-
setCurrentIndex((prev) =>
|
|
6762
|
-
|
|
6790
|
+
setCurrentIndex((prev) => {
|
|
6791
|
+
if (prev === 0) {
|
|
6792
|
+
return loop ? maxIndex : 0;
|
|
6793
|
+
}
|
|
6794
|
+
return Math.max(0, prev - slidesToScroll);
|
|
6795
|
+
});
|
|
6796
|
+
}, [loop, maxIndex, slidesToScroll]);
|
|
6763
6797
|
const scrollNext = React27.useCallback(() => {
|
|
6764
|
-
setCurrentIndex((prev) =>
|
|
6765
|
-
|
|
6798
|
+
setCurrentIndex((prev) => {
|
|
6799
|
+
if (prev >= maxIndex) {
|
|
6800
|
+
return loop ? 0 : maxIndex;
|
|
6801
|
+
}
|
|
6802
|
+
return Math.min(maxIndex, prev + slidesToScroll);
|
|
6803
|
+
});
|
|
6804
|
+
}, [loop, maxIndex, slidesToScroll]);
|
|
6805
|
+
const scrollTo = React27.useCallback(
|
|
6806
|
+
(index) => {
|
|
6807
|
+
setCurrentIndex(Math.min(maxIndex, Math.max(0, index)));
|
|
6808
|
+
},
|
|
6809
|
+
[maxIndex]
|
|
6810
|
+
);
|
|
6766
6811
|
React27.useEffect(() => {
|
|
6767
|
-
|
|
6768
|
-
|
|
6812
|
+
const handleKeyDown = (e) => {
|
|
6813
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
6814
|
+
e.preventDefault();
|
|
6815
|
+
scrollPrev();
|
|
6816
|
+
} else if (e.key === "ArrowRight" || e.key === "ArrowDown") {
|
|
6817
|
+
e.preventDefault();
|
|
6818
|
+
scrollNext();
|
|
6819
|
+
} else if (e.key === "Home") {
|
|
6820
|
+
e.preventDefault();
|
|
6821
|
+
scrollTo(0);
|
|
6822
|
+
} else if (e.key === "End") {
|
|
6823
|
+
e.preventDefault();
|
|
6824
|
+
scrollTo(maxIndex);
|
|
6825
|
+
}
|
|
6826
|
+
};
|
|
6827
|
+
const carousel = carouselRef.current;
|
|
6828
|
+
if (carousel) {
|
|
6829
|
+
carousel.addEventListener("keydown", handleKeyDown);
|
|
6830
|
+
return () => carousel.removeEventListener("keydown", handleKeyDown);
|
|
6831
|
+
}
|
|
6832
|
+
}, [scrollPrev, scrollNext, scrollTo, maxIndex]);
|
|
6833
|
+
React27.useEffect(() => {
|
|
6834
|
+
const stop = () => {
|
|
6835
|
+
if (rafRef.current != null) {
|
|
6836
|
+
cancelAnimationFrame(rafRef.current);
|
|
6837
|
+
rafRef.current = null;
|
|
6838
|
+
}
|
|
6839
|
+
if (progressElRef.current) progressElRef.current.style.width = "0%";
|
|
6840
|
+
};
|
|
6841
|
+
if (!autoScroll || isPaused || totalSlides <= slidesToShow) {
|
|
6842
|
+
stop();
|
|
6843
|
+
return;
|
|
6844
|
+
}
|
|
6845
|
+
let start = performance.now();
|
|
6846
|
+
const tick = (now) => {
|
|
6847
|
+
const elapsed = now - start;
|
|
6848
|
+
const ratio = Math.min(1, elapsed / autoScrollInterval);
|
|
6849
|
+
if (progressElRef.current) {
|
|
6850
|
+
progressElRef.current.style.width = `${ratio * 100}%`;
|
|
6851
|
+
}
|
|
6852
|
+
if (ratio >= 1) {
|
|
6853
|
+
scrollNext();
|
|
6854
|
+
start = performance.now();
|
|
6855
|
+
}
|
|
6856
|
+
rafRef.current = requestAnimationFrame(tick);
|
|
6857
|
+
};
|
|
6858
|
+
rafRef.current = requestAnimationFrame(tick);
|
|
6859
|
+
return stop;
|
|
6860
|
+
}, [autoScroll, isPaused, totalSlides, slidesToShow, autoScrollInterval, scrollNext]);
|
|
6861
|
+
const getPositionX = (event) => {
|
|
6862
|
+
return event.type.includes("mouse") ? event.pageX : event.touches[0].clientX;
|
|
6863
|
+
};
|
|
6864
|
+
const getPositionY = (event) => {
|
|
6865
|
+
return event.type.includes("mouse") ? event.pageY : event.touches[0].clientY;
|
|
6866
|
+
};
|
|
6867
|
+
const touchStart = (event) => {
|
|
6868
|
+
setIsDragging(true);
|
|
6869
|
+
const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
|
|
6870
|
+
setStartPos(pos);
|
|
6871
|
+
setPrevTranslate(currentTranslate);
|
|
6872
|
+
};
|
|
6873
|
+
const touchMove = (event) => {
|
|
6874
|
+
if (!isDragging) return;
|
|
6875
|
+
const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
|
|
6876
|
+
const currentPosition = pos;
|
|
6877
|
+
setCurrentTranslate(prevTranslate + currentPosition - startPos);
|
|
6878
|
+
};
|
|
6879
|
+
const touchEnd = () => {
|
|
6880
|
+
if (!isDragging) return;
|
|
6881
|
+
setIsDragging(false);
|
|
6882
|
+
const movedBy = currentTranslate - prevTranslate;
|
|
6883
|
+
const threshold = 50;
|
|
6884
|
+
if (movedBy < -threshold && currentIndex < maxIndex) {
|
|
6769
6885
|
scrollNext();
|
|
6770
|
-
}
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6886
|
+
} else if (movedBy > threshold && currentIndex > 0) {
|
|
6887
|
+
scrollPrev();
|
|
6888
|
+
}
|
|
6889
|
+
setCurrentTranslate(0);
|
|
6890
|
+
setPrevTranslate(0);
|
|
6891
|
+
};
|
|
6892
|
+
React27.useEffect(() => {
|
|
6893
|
+
onSlideChange?.(currentIndex);
|
|
6894
|
+
}, [currentIndex, onSlideChange]);
|
|
6895
|
+
const getAnimationStyles = () => {
|
|
6896
|
+
const baseTransform = isHorizontal ? `translateX(-${currentIndex * (100 / slidesToShow)}%)` : `translateY(-${currentIndex * (100 / slidesToShow)}%)`;
|
|
6897
|
+
if (animation === "fade") {
|
|
6898
|
+
return {
|
|
6899
|
+
transition: "opacity 500ms ease-in-out"
|
|
6900
|
+
};
|
|
6901
|
+
}
|
|
6902
|
+
if (animation === "scale") {
|
|
6903
|
+
return {
|
|
6904
|
+
transform: baseTransform,
|
|
6905
|
+
transition: "transform 500ms ease-in-out, scale 500ms ease-in-out"
|
|
6906
|
+
};
|
|
6907
|
+
}
|
|
6908
|
+
return {
|
|
6909
|
+
transform: baseTransform,
|
|
6910
|
+
transition: isDragging ? "none" : "transform 500ms ease-in-out"
|
|
6911
|
+
};
|
|
6912
|
+
};
|
|
6913
|
+
const slideWidth = 100 / slidesToShow;
|
|
6914
|
+
return /* @__PURE__ */ jsxs30(
|
|
6915
|
+
"div",
|
|
6916
|
+
{
|
|
6917
|
+
ref: carouselRef,
|
|
6918
|
+
className: cn("relative w-full overflow-hidden focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded-lg", className),
|
|
6919
|
+
onMouseEnter: () => setIsPaused(true),
|
|
6920
|
+
onMouseLeave: () => setIsPaused(false),
|
|
6921
|
+
role: "region",
|
|
6922
|
+
"aria-label": ariaLabel,
|
|
6923
|
+
"aria-roledescription": "carousel",
|
|
6924
|
+
tabIndex: 0,
|
|
6925
|
+
children: [
|
|
6926
|
+
showProgress && autoScroll && /* @__PURE__ */ jsx35("div", { className: "absolute top-0 left-0 right-0 h-1 bg-muted z-20", children: /* @__PURE__ */ jsx35("div", { ref: progressElRef, className: "h-full bg-primary", style: { width: "0%" } }) }),
|
|
6927
|
+
/* @__PURE__ */ jsx35(
|
|
6928
|
+
"div",
|
|
6929
|
+
{
|
|
6930
|
+
className: cn("flex", isHorizontal ? "flex-row" : "flex-col", containerClassName),
|
|
6931
|
+
style: getAnimationStyles(),
|
|
6932
|
+
onTouchStart: touchStart,
|
|
6933
|
+
onTouchMove: touchMove,
|
|
6934
|
+
onTouchEnd: touchEnd,
|
|
6935
|
+
onMouseDown: touchStart,
|
|
6936
|
+
onMouseMove: touchMove,
|
|
6937
|
+
onMouseUp: touchEnd,
|
|
6938
|
+
onMouseLeave: touchEnd,
|
|
6939
|
+
role: "group",
|
|
6940
|
+
"aria-atomic": "false",
|
|
6941
|
+
"aria-live": autoScroll ? "off" : "polite",
|
|
6942
|
+
children: React27.Children.map(children, (child, idx) => /* @__PURE__ */ jsx35(
|
|
6943
|
+
"div",
|
|
6944
|
+
{
|
|
6945
|
+
className: cn(
|
|
6946
|
+
"flex-shrink-0",
|
|
6947
|
+
isHorizontal ? "h-full" : "w-full",
|
|
6948
|
+
animation === "fade" && idx !== currentIndex && "opacity-0",
|
|
6949
|
+
animation === "scale" && idx !== currentIndex && "scale-95",
|
|
6950
|
+
slideClassName
|
|
6951
|
+
),
|
|
6952
|
+
style: {
|
|
6953
|
+
[isHorizontal ? "width" : "height"]: `${slideWidth}%`
|
|
6954
|
+
},
|
|
6955
|
+
role: "group",
|
|
6956
|
+
"aria-roledescription": "slide",
|
|
6957
|
+
"aria-label": `${idx + 1} of ${totalSlides}`,
|
|
6958
|
+
"aria-hidden": idx < currentIndex || idx >= currentIndex + slidesToShow,
|
|
6959
|
+
children: child
|
|
6960
|
+
},
|
|
6961
|
+
idx
|
|
6962
|
+
))
|
|
6963
|
+
}
|
|
6964
|
+
),
|
|
6965
|
+
showArrows && totalSlides > slidesToShow && /* @__PURE__ */ jsxs30(Fragment9, { children: [
|
|
6966
|
+
/* @__PURE__ */ jsx35(
|
|
6967
|
+
Button_default,
|
|
6968
|
+
{
|
|
6969
|
+
onClick: scrollPrev,
|
|
6970
|
+
variant: "ghost",
|
|
6971
|
+
size: "icon",
|
|
6972
|
+
icon: ChevronLeft3,
|
|
6973
|
+
noHoverOverlay: true,
|
|
6974
|
+
disabled: !loop && currentIndex === 0,
|
|
6975
|
+
className: cn(
|
|
6976
|
+
"absolute top-1/2 -translate-y-1/2 hover:-translate-y-1/2 active:-translate-y-1/2 z-10 rounded-full will-change-transform backdrop-blur-0 hover:backdrop-blur-0 hover:bg-transparent border-0",
|
|
6977
|
+
isHorizontal ? "left-4" : "top-4 left-1/2 -translate-x-1/2 rotate-90"
|
|
6978
|
+
),
|
|
6979
|
+
"aria-label": "Previous slide"
|
|
6980
|
+
}
|
|
6981
|
+
),
|
|
6982
|
+
/* @__PURE__ */ jsx35(
|
|
6983
|
+
Button_default,
|
|
6984
|
+
{
|
|
6985
|
+
onClick: scrollNext,
|
|
6986
|
+
variant: "ghost",
|
|
6987
|
+
size: "icon",
|
|
6988
|
+
icon: ChevronRight5,
|
|
6989
|
+
noHoverOverlay: true,
|
|
6990
|
+
disabled: !loop && currentIndex >= maxIndex,
|
|
6991
|
+
className: cn(
|
|
6992
|
+
"absolute top-1/2 -translate-y-1/2 hover:-translate-y-1/2 active:-translate-y-1/2 z-10 rounded-full will-change-transform backdrop-blur-0 hover:backdrop-blur-0 hover:bg-transparent border-0",
|
|
6993
|
+
isHorizontal ? "right-4" : "bottom-4 left-1/2 -translate-x-1/2 rotate-90"
|
|
6994
|
+
),
|
|
6995
|
+
"aria-label": "Next slide"
|
|
6996
|
+
}
|
|
6997
|
+
)
|
|
6998
|
+
] }),
|
|
6999
|
+
showDots && totalSlides > slidesToShow && /* @__PURE__ */ jsx35(
|
|
7000
|
+
"div",
|
|
7001
|
+
{
|
|
7002
|
+
className: cn(
|
|
7003
|
+
"absolute flex gap-2 z-10",
|
|
7004
|
+
isHorizontal ? "bottom-4 left-1/2 -translate-x-1/2 flex-row" : "right-4 top-1/2 -translate-y-1/2 flex-col"
|
|
7005
|
+
),
|
|
7006
|
+
role: "tablist",
|
|
7007
|
+
"aria-label": "Carousel pagination",
|
|
7008
|
+
children: Array.from({ length: maxIndex + 1 }, (_, idx) => /* @__PURE__ */ jsx35(
|
|
7009
|
+
"button",
|
|
7010
|
+
{
|
|
7011
|
+
onClick: () => scrollTo(idx),
|
|
7012
|
+
className: cn(
|
|
7013
|
+
"rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
|
|
7014
|
+
isHorizontal ? "w-2 h-2" : "w-2 h-2",
|
|
7015
|
+
idx === currentIndex ? `bg-primary ${isHorizontal ? "w-6" : "h-6"}` : "bg-muted-foreground/50 hover:bg-muted-foreground/75"
|
|
7016
|
+
),
|
|
7017
|
+
"aria-label": `Go to slide ${idx + 1}`,
|
|
7018
|
+
"aria-selected": idx === currentIndex,
|
|
7019
|
+
role: "tab"
|
|
7020
|
+
},
|
|
7021
|
+
idx
|
|
7022
|
+
))
|
|
7023
|
+
}
|
|
7024
|
+
),
|
|
7025
|
+
showThumbnails && totalSlides > slidesToShow && /* @__PURE__ */ jsx35(
|
|
7026
|
+
"div",
|
|
7027
|
+
{
|
|
7028
|
+
className: cn(
|
|
7029
|
+
"absolute bottom-0 left-0 right-0 flex gap-2 p-4 bg-gradient-to-t from-black/50 to-transparent overflow-x-auto",
|
|
7030
|
+
isHorizontal ? "flex-row" : "flex-col"
|
|
7031
|
+
),
|
|
7032
|
+
children: React27.Children.map(children, (child, idx) => /* @__PURE__ */ jsx35(
|
|
7033
|
+
"button",
|
|
7034
|
+
{
|
|
7035
|
+
onClick: () => scrollTo(idx),
|
|
7036
|
+
className: cn(
|
|
7037
|
+
"flex-shrink-0 w-16 h-16 rounded-md overflow-hidden border-2 transition-all focus:outline-none focus:ring-2 focus:ring-primary",
|
|
7038
|
+
idx === currentIndex ? "border-primary scale-110" : "border-transparent opacity-70 hover:opacity-100"
|
|
7039
|
+
),
|
|
7040
|
+
"aria-label": `Thumbnail ${idx + 1}`,
|
|
7041
|
+
children: thumbnailRenderer ? thumbnailRenderer(child, idx) : child
|
|
7042
|
+
},
|
|
7043
|
+
idx
|
|
7044
|
+
))
|
|
7045
|
+
}
|
|
7046
|
+
)
|
|
7047
|
+
]
|
|
7048
|
+
}
|
|
7049
|
+
);
|
|
7050
|
+
}
|
|
7051
|
+
|
|
7052
|
+
// ../../components/ui/FallingIcons.tsx
|
|
7053
|
+
import React28 from "react";
|
|
7054
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7055
|
+
var DEFAULT_COUNT = 24;
|
|
7056
|
+
var DEFAULT_SPEED_RANGE = [6, 14];
|
|
7057
|
+
var DEFAULT_SIZE_RANGE = [14, 28];
|
|
7058
|
+
function FallingIcons({
|
|
7059
|
+
icon: Icon,
|
|
7060
|
+
imageUrl,
|
|
7061
|
+
count = DEFAULT_COUNT,
|
|
7062
|
+
className,
|
|
7063
|
+
areaClassName,
|
|
7064
|
+
colorClassName,
|
|
7065
|
+
zIndex = 10,
|
|
7066
|
+
speedRange = DEFAULT_SPEED_RANGE,
|
|
7067
|
+
sizeRange = DEFAULT_SIZE_RANGE,
|
|
7068
|
+
horizontalDrift = 24,
|
|
7069
|
+
spin = true,
|
|
7070
|
+
fullScreen = false,
|
|
7071
|
+
randomizeEachLoop = true,
|
|
7072
|
+
// Modern UI enhancements
|
|
7073
|
+
glow = false,
|
|
7074
|
+
glowColor = "currentColor",
|
|
7075
|
+
glowIntensity = 0.5,
|
|
7076
|
+
trail = false,
|
|
7077
|
+
trailLength = 3,
|
|
7078
|
+
physics,
|
|
7079
|
+
easingFunction = "linear"
|
|
7080
|
+
}) {
|
|
7081
|
+
const uid = React28.useId().replace(/[:]/g, "");
|
|
7082
|
+
const containerRef = React28.useRef(null);
|
|
7083
|
+
const [fallDist, setFallDist] = React28.useState(null);
|
|
7084
|
+
const idRef = React28.useRef(1);
|
|
7085
|
+
const gravity = physics?.gravity ?? 1;
|
|
7086
|
+
const windDirection = physics?.windDirection ?? 0;
|
|
7087
|
+
const windStrength = physics?.windStrength ?? 0;
|
|
7088
|
+
const physicsRotation = physics?.rotation ?? false;
|
|
7089
|
+
const easingMap = {
|
|
7090
|
+
linear: "linear",
|
|
7091
|
+
ease: "ease",
|
|
7092
|
+
"ease-in": "ease-in",
|
|
7093
|
+
"ease-out": "ease-out",
|
|
7094
|
+
"ease-in-out": "ease-in-out",
|
|
7095
|
+
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
7096
|
+
elastic: "cubic-bezier(0.175, 0.885, 0.32, 1.275)"
|
|
7097
|
+
};
|
|
7098
|
+
const makeParticle = React28.useCallback(() => {
|
|
7099
|
+
const rnd = (min, max) => min + Math.random() * (max - min);
|
|
7100
|
+
return {
|
|
7101
|
+
leftPct: rnd(0, 100),
|
|
7102
|
+
size: rnd(sizeRange[0], sizeRange[1]),
|
|
7103
|
+
fallDur: rnd(speedRange[0], speedRange[1]) / gravity,
|
|
7104
|
+
// Apply gravity to speed
|
|
7105
|
+
delay: rnd(-10, 0),
|
|
7106
|
+
driftAmp: rnd(horizontalDrift * 0.5, horizontalDrift) + windDirection * windStrength * 50,
|
|
7107
|
+
// Apply wind
|
|
7108
|
+
spinDur: rnd(2, 6),
|
|
7109
|
+
key: idRef.current++
|
|
7110
|
+
};
|
|
7111
|
+
}, [sizeRange, speedRange, horizontalDrift, gravity, windDirection, windStrength]);
|
|
7112
|
+
const [particles, setParticles] = React28.useState([]);
|
|
7113
|
+
React28.useEffect(() => {
|
|
7114
|
+
const arr = Array.from({ length: Math.max(0, count) }).map(() => makeParticle());
|
|
7115
|
+
setParticles(arr);
|
|
7116
|
+
}, [count, makeParticle]);
|
|
7117
|
+
React28.useEffect(() => {
|
|
7118
|
+
if (fullScreen) {
|
|
7119
|
+
const measure2 = () => setFallDist(window.innerHeight + 200);
|
|
7120
|
+
measure2();
|
|
7121
|
+
window.addEventListener("resize", measure2);
|
|
7122
|
+
return () => window.removeEventListener("resize", measure2);
|
|
7123
|
+
}
|
|
7124
|
+
const el = containerRef.current;
|
|
7125
|
+
if (!el) return;
|
|
7126
|
+
const measure = () => setFallDist(el.offsetHeight + 200);
|
|
7127
|
+
measure();
|
|
7128
|
+
const ResizeObserverCtor = window.ResizeObserver;
|
|
7129
|
+
if (ResizeObserverCtor) {
|
|
7130
|
+
const ro = new ResizeObserverCtor(measure);
|
|
7131
|
+
ro.observe(el);
|
|
7132
|
+
return () => ro.disconnect();
|
|
7133
|
+
}
|
|
7134
|
+
window.addEventListener("resize", measure);
|
|
7135
|
+
return () => window.removeEventListener("resize", measure);
|
|
7136
|
+
}, [fullScreen]);
|
|
7137
|
+
const FallName = `uv-fall-${uid}`;
|
|
7138
|
+
const SwayName = `uv-sway-${uid}`;
|
|
7139
|
+
const SpinName = `uv-spin-${uid}`;
|
|
7140
|
+
const PopName = `uv-pop-${uid}`;
|
|
7141
|
+
const PhysicsSpinName = `uv-physics-spin-${uid}`;
|
|
7142
|
+
const glowStyles = React28.useMemo(() => {
|
|
7143
|
+
if (!glow) return {};
|
|
7144
|
+
const intensity = Math.max(0, Math.min(1, glowIntensity));
|
|
7145
|
+
return {
|
|
7146
|
+
filter: `drop-shadow(0 0 ${4 * intensity}px ${glowColor}) drop-shadow(0 0 ${8 * intensity}px ${glowColor})`
|
|
7147
|
+
};
|
|
7148
|
+
}, [glow, glowColor, glowIntensity]);
|
|
7149
|
+
const FallbackIcon = React28.useMemo(() => (props) => /* @__PURE__ */ jsx36("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx36("circle", { cx: "12", cy: "12", r: "10" }) }), []);
|
|
7150
|
+
const TheIcon = imageUrl ? ({ className: imgClassName }) => /* @__PURE__ */ jsx36(
|
|
7151
|
+
"img",
|
|
7152
|
+
{
|
|
7153
|
+
src: imageUrl,
|
|
7154
|
+
alt: "",
|
|
7155
|
+
className: cn("w-full h-full object-cover rounded-sm", imgClassName),
|
|
7156
|
+
draggable: false
|
|
7157
|
+
}
|
|
7158
|
+
) : Icon || FallbackIcon;
|
|
7159
|
+
return /* @__PURE__ */ jsxs31(
|
|
7160
|
+
"div",
|
|
7161
|
+
{
|
|
7162
|
+
ref: containerRef,
|
|
7163
|
+
className: cn(
|
|
7164
|
+
fullScreen ? "fixed inset-0 overflow-hidden pointer-events-none" : "relative w-full h-full overflow-hidden",
|
|
7165
|
+
areaClassName
|
|
6785
7166
|
),
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
{
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
className: "absolute right-4 top-1/2 -translate-y-1/2 hover:-translate-y-1/2 z-10 rounded-full will-change-transform bg-background/80 hover:bg-background border-border/50 hover:border-border text-foreground"
|
|
7167
|
+
style: { zIndex },
|
|
7168
|
+
children: [
|
|
7169
|
+
/* @__PURE__ */ jsx36("style", { children: `
|
|
7170
|
+
@keyframes ${FallName} {
|
|
7171
|
+
0% { transform: translate3d(0, -10vh, 0); opacity: 0; }
|
|
7172
|
+
10% { opacity: 1; }
|
|
7173
|
+
100% { transform: translate3d(0, var(--fall, 120vh), 0); opacity: 0.95; }
|
|
6794
7174
|
}
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
7175
|
+
@keyframes ${SwayName} {
|
|
7176
|
+
0% { transform: translateX(0); }
|
|
7177
|
+
50% { transform: translateX(var(--amp, 16px)); }
|
|
7178
|
+
100% { transform: translateX(0); }
|
|
7179
|
+
}
|
|
7180
|
+
@keyframes ${SpinName} {
|
|
7181
|
+
0% { transform: rotate(0deg); }
|
|
7182
|
+
100% { transform: rotate(360deg); }
|
|
7183
|
+
}
|
|
7184
|
+
@keyframes ${PopName} {
|
|
7185
|
+
0% { opacity: 1; transform: scale(1); }
|
|
7186
|
+
100% { opacity: 0; transform: scale(0.3); }
|
|
7187
|
+
}
|
|
7188
|
+
@keyframes ${PhysicsSpinName} {
|
|
7189
|
+
0% { transform: rotate(0deg) scale(1); }
|
|
7190
|
+
25% { transform: rotate(90deg) scale(1.05); }
|
|
7191
|
+
50% { transform: rotate(180deg) scale(1); }
|
|
7192
|
+
75% { transform: rotate(270deg) scale(1.05); }
|
|
7193
|
+
100% { transform: rotate(360deg) scale(1); }
|
|
7194
|
+
}
|
|
7195
|
+
@media (prefers-reduced-motion: reduce) {
|
|
7196
|
+
.uv-falling-particle {
|
|
7197
|
+
animation-duration: 0.01ms !important;
|
|
7198
|
+
animation-iteration-count: 1 !important;
|
|
7199
|
+
}
|
|
7200
|
+
}
|
|
7201
|
+
` }),
|
|
7202
|
+
/* @__PURE__ */ jsx36(
|
|
7203
|
+
"div",
|
|
7204
|
+
{
|
|
7205
|
+
className: cn(
|
|
7206
|
+
"absolute inset-0 pointer-events-none",
|
|
7207
|
+
className
|
|
7208
|
+
),
|
|
7209
|
+
"aria-hidden": true,
|
|
7210
|
+
children: particles.map((p, i) => {
|
|
7211
|
+
const swayDuration = p.fallDur * (0.8 + i % 5 * 0.05);
|
|
7212
|
+
const spinDuration = Math.max(1, p.spinDur);
|
|
7213
|
+
const handlePop = () => {
|
|
7214
|
+
setParticles((prev) => {
|
|
7215
|
+
const next = prev.slice();
|
|
7216
|
+
const np = makeParticle();
|
|
7217
|
+
np.delay = -Math.random() * 8;
|
|
7218
|
+
next[i] = np;
|
|
7219
|
+
return next;
|
|
7220
|
+
});
|
|
7221
|
+
};
|
|
7222
|
+
const trailParticles = trail ? Array.from({ length: Math.min(5, Math.max(1, trailLength)) }) : [];
|
|
7223
|
+
return /* @__PURE__ */ jsxs31(React28.Fragment, { children: [
|
|
7224
|
+
trail && trailParticles.map((_, trailIndex) => {
|
|
7225
|
+
const trailDelay = p.delay - (trailIndex + 1) * 0.15;
|
|
7226
|
+
const trailOpacity = 1 - (trailIndex + 1) * (1 / (trailParticles.length + 1));
|
|
7227
|
+
const trailScale = 1 - (trailIndex + 1) * 0.15;
|
|
7228
|
+
return /* @__PURE__ */ jsx36(
|
|
7229
|
+
"span",
|
|
7230
|
+
{
|
|
7231
|
+
className: cn("absolute top-0 will-change-transform pointer-events-none uv-falling-particle", colorClassName),
|
|
7232
|
+
style: {
|
|
7233
|
+
left: `${p.leftPct}%`,
|
|
7234
|
+
animationDelay: `${trailDelay}s`,
|
|
7235
|
+
animationDuration: `${p.fallDur}s`,
|
|
7236
|
+
animationName: FallName,
|
|
7237
|
+
animationTimingFunction: easingMap[easingFunction] || "linear",
|
|
7238
|
+
animationIterationCount: "infinite",
|
|
7239
|
+
opacity: trailOpacity * 0.4,
|
|
7240
|
+
["--fall"]: `${fallDist ?? (typeof window !== "undefined" ? window.innerHeight + 200 : 1200)}px`
|
|
7241
|
+
},
|
|
7242
|
+
children: /* @__PURE__ */ jsx36(
|
|
7243
|
+
"span",
|
|
7244
|
+
{
|
|
7245
|
+
className: "inline-block uv-sway",
|
|
7246
|
+
style: {
|
|
7247
|
+
transform: `translateX(-50%) scale(${trailScale})`,
|
|
7248
|
+
animationName: SwayName,
|
|
7249
|
+
animationDuration: `${swayDuration}s`,
|
|
7250
|
+
animationTimingFunction: "ease-in-out",
|
|
7251
|
+
animationIterationCount: "infinite",
|
|
7252
|
+
["--amp"]: `${Math.round(p.driftAmp)}px`
|
|
7253
|
+
},
|
|
7254
|
+
children: /* @__PURE__ */ jsx36(
|
|
7255
|
+
"span",
|
|
7256
|
+
{
|
|
7257
|
+
className: "block",
|
|
7258
|
+
style: {
|
|
7259
|
+
width: p.size,
|
|
7260
|
+
height: p.size,
|
|
7261
|
+
...glowStyles
|
|
7262
|
+
},
|
|
7263
|
+
children: /* @__PURE__ */ jsx36(TheIcon, { className: cn("w-full h-full text-primary/70", colorClassName) })
|
|
7264
|
+
}
|
|
7265
|
+
)
|
|
7266
|
+
}
|
|
7267
|
+
)
|
|
7268
|
+
},
|
|
7269
|
+
`${p.key}-trail-${trailIndex}`
|
|
7270
|
+
);
|
|
7271
|
+
}),
|
|
7272
|
+
/* @__PURE__ */ jsx36(
|
|
7273
|
+
"span",
|
|
7274
|
+
{
|
|
7275
|
+
className: cn("absolute top-0 will-change-transform pointer-events-auto uv-falling-particle", colorClassName),
|
|
7276
|
+
style: {
|
|
7277
|
+
left: `${p.leftPct}%`,
|
|
7278
|
+
animationDelay: `${p.delay}s`,
|
|
7279
|
+
animationDuration: `${p.fallDur}s`,
|
|
7280
|
+
animationName: FallName,
|
|
7281
|
+
animationTimingFunction: easingMap[easingFunction] || "linear",
|
|
7282
|
+
animationIterationCount: "infinite",
|
|
7283
|
+
["--fall"]: `${fallDist ?? (typeof window !== "undefined" ? window.innerHeight + 200 : 1200)}px`
|
|
7284
|
+
},
|
|
7285
|
+
onMouseEnter: handlePop,
|
|
7286
|
+
onAnimationIteration: (ev) => {
|
|
7287
|
+
if (ev.currentTarget !== ev.target) return;
|
|
7288
|
+
if (!randomizeEachLoop) return;
|
|
7289
|
+
if (ev.animationName !== FallName) return;
|
|
7290
|
+
setParticles((prev) => {
|
|
7291
|
+
const next = prev.slice();
|
|
7292
|
+
const np = makeParticle();
|
|
7293
|
+
np.delay = -Math.random() * 4;
|
|
7294
|
+
next[i] = np;
|
|
7295
|
+
return next;
|
|
7296
|
+
});
|
|
7297
|
+
},
|
|
7298
|
+
children: /* @__PURE__ */ jsx36(
|
|
7299
|
+
"span",
|
|
7300
|
+
{
|
|
7301
|
+
className: "inline-block uv-sway",
|
|
7302
|
+
style: {
|
|
7303
|
+
transform: `translateX(-50%)`,
|
|
7304
|
+
animationName: SwayName,
|
|
7305
|
+
animationDuration: `${swayDuration}s`,
|
|
7306
|
+
animationTimingFunction: "ease-in-out",
|
|
7307
|
+
animationIterationCount: "infinite",
|
|
7308
|
+
["--amp"]: `${Math.round(p.driftAmp)}px`
|
|
7309
|
+
},
|
|
7310
|
+
children: /* @__PURE__ */ jsx36(
|
|
7311
|
+
"span",
|
|
7312
|
+
{
|
|
7313
|
+
className: cn(
|
|
7314
|
+
"block uv-spin hover:[animation:var(--popName)_0.35s_ease-out_forwards]",
|
|
7315
|
+
physicsRotation ? "[animation:var(--physicsSpinName)_var(--spinDur)_ease-in-out_infinite]" : spin && "[animation:var(--spinName)_var(--spinDur)_linear_infinite]"
|
|
7316
|
+
),
|
|
7317
|
+
style: {
|
|
7318
|
+
width: p.size,
|
|
7319
|
+
height: p.size,
|
|
7320
|
+
["--spinName"]: SpinName,
|
|
7321
|
+
["--physicsSpinName"]: PhysicsSpinName,
|
|
7322
|
+
["--spinDur"]: `${spinDuration}s`,
|
|
7323
|
+
["--popName"]: PopName,
|
|
7324
|
+
...glowStyles
|
|
7325
|
+
},
|
|
7326
|
+
children: /* @__PURE__ */ jsx36(TheIcon, { className: cn("w-full h-full text-primary/70", colorClassName) })
|
|
7327
|
+
}
|
|
7328
|
+
)
|
|
7329
|
+
}
|
|
7330
|
+
)
|
|
7331
|
+
}
|
|
7332
|
+
)
|
|
7333
|
+
] }, p.key);
|
|
7334
|
+
})
|
|
7335
|
+
}
|
|
7336
|
+
)
|
|
7337
|
+
]
|
|
7338
|
+
}
|
|
7339
|
+
);
|
|
6807
7340
|
}
|
|
6808
7341
|
|
|
6809
7342
|
// ../../components/ui/ClientOnly.tsx
|
|
6810
7343
|
import { useEffect as useEffect14, useState as useState25 } from "react";
|
|
6811
|
-
import { Fragment as Fragment10, jsx as
|
|
7344
|
+
import { Fragment as Fragment10, jsx as jsx37 } from "react/jsx-runtime";
|
|
6812
7345
|
function ClientOnly({ children, fallback = null }) {
|
|
6813
7346
|
const [hasMounted, setHasMounted] = useState25(false);
|
|
6814
7347
|
useEffect14(() => {
|
|
6815
7348
|
setHasMounted(true);
|
|
6816
7349
|
}, []);
|
|
6817
7350
|
if (!hasMounted) {
|
|
6818
|
-
return /* @__PURE__ */
|
|
7351
|
+
return /* @__PURE__ */ jsx37(Fragment10, { children: fallback });
|
|
6819
7352
|
}
|
|
6820
|
-
return /* @__PURE__ */
|
|
7353
|
+
return /* @__PURE__ */ jsx37(Fragment10, { children });
|
|
6821
7354
|
}
|
|
6822
7355
|
|
|
6823
7356
|
// ../../components/ui/Loading.tsx
|
|
6824
7357
|
import { Activity as Activity3 } from "lucide-react";
|
|
6825
|
-
import { jsx as
|
|
7358
|
+
import { jsx as jsx38, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6826
7359
|
var LoadingSpinner = ({
|
|
6827
7360
|
size = "md",
|
|
6828
7361
|
className,
|
|
@@ -6838,7 +7371,7 @@ var LoadingSpinner = ({
|
|
|
6838
7371
|
foreground: "text-foreground",
|
|
6839
7372
|
muted: "text-muted-foreground"
|
|
6840
7373
|
};
|
|
6841
|
-
return /* @__PURE__ */
|
|
7374
|
+
return /* @__PURE__ */ jsx38(
|
|
6842
7375
|
Activity3,
|
|
6843
7376
|
{
|
|
6844
7377
|
className: cn(
|
|
@@ -6859,7 +7392,7 @@ var LoadingDots = ({
|
|
|
6859
7392
|
foreground: "bg-foreground",
|
|
6860
7393
|
muted: "bg-muted-foreground"
|
|
6861
7394
|
};
|
|
6862
|
-
return /* @__PURE__ */
|
|
7395
|
+
return /* @__PURE__ */ jsx38("div", { className: cn("flex items-center space-x-1", className), children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx38(
|
|
6863
7396
|
"div",
|
|
6864
7397
|
{
|
|
6865
7398
|
className: cn(
|
|
@@ -6881,7 +7414,7 @@ var LoadingBar = ({
|
|
|
6881
7414
|
label
|
|
6882
7415
|
}) => {
|
|
6883
7416
|
const pct = progress ? Math.min(Math.max(progress, 0), 100) : void 0;
|
|
6884
|
-
return /* @__PURE__ */
|
|
7417
|
+
return /* @__PURE__ */ jsx38(
|
|
6885
7418
|
"div",
|
|
6886
7419
|
{
|
|
6887
7420
|
className: cn("w-full bg-muted rounded-full h-2", className),
|
|
@@ -6890,7 +7423,7 @@ var LoadingBar = ({
|
|
|
6890
7423
|
"aria-valuemax": pct === void 0 ? void 0 : 100,
|
|
6891
7424
|
"aria-valuenow": pct === void 0 ? void 0 : Math.round(pct),
|
|
6892
7425
|
"aria-label": label || "Loading",
|
|
6893
|
-
children: /* @__PURE__ */
|
|
7426
|
+
children: /* @__PURE__ */ jsx38(
|
|
6894
7427
|
"div",
|
|
6895
7428
|
{
|
|
6896
7429
|
className: cn(
|
|
@@ -6907,10 +7440,10 @@ var LoadingBar = ({
|
|
|
6907
7440
|
};
|
|
6908
7441
|
|
|
6909
7442
|
// ../../components/ui/Table.tsx
|
|
6910
|
-
import
|
|
6911
|
-
import { jsx as
|
|
6912
|
-
var Table =
|
|
6913
|
-
({ className, containerClassName, ...props }, ref) => /* @__PURE__ */
|
|
7443
|
+
import React29 from "react";
|
|
7444
|
+
import { jsx as jsx39, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7445
|
+
var Table = React29.forwardRef(
|
|
7446
|
+
({ className, containerClassName, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
6914
7447
|
"div",
|
|
6915
7448
|
{
|
|
6916
7449
|
className: cn(
|
|
@@ -6920,7 +7453,7 @@ var Table = React28.forwardRef(
|
|
|
6920
7453
|
"backdrop-blur-sm transition-all duration-300",
|
|
6921
7454
|
containerClassName
|
|
6922
7455
|
),
|
|
6923
|
-
children: /* @__PURE__ */
|
|
7456
|
+
children: /* @__PURE__ */ jsx39(
|
|
6924
7457
|
"table",
|
|
6925
7458
|
{
|
|
6926
7459
|
ref,
|
|
@@ -6932,8 +7465,8 @@ var Table = React28.forwardRef(
|
|
|
6932
7465
|
)
|
|
6933
7466
|
);
|
|
6934
7467
|
Table.displayName = "Table";
|
|
6935
|
-
var TableHeader =
|
|
6936
|
-
({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */
|
|
7468
|
+
var TableHeader = React29.forwardRef(
|
|
7469
|
+
({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ jsxs33(
|
|
6937
7470
|
"thead",
|
|
6938
7471
|
{
|
|
6939
7472
|
ref,
|
|
@@ -6951,7 +7484,7 @@ var TableHeader = React28.forwardRef(
|
|
|
6951
7484
|
)
|
|
6952
7485
|
);
|
|
6953
7486
|
TableHeader.displayName = "TableHeader";
|
|
6954
|
-
var TableBody =
|
|
7487
|
+
var TableBody = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
6955
7488
|
"tbody",
|
|
6956
7489
|
{
|
|
6957
7490
|
ref,
|
|
@@ -6960,7 +7493,7 @@ var TableBody = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
6960
7493
|
}
|
|
6961
7494
|
));
|
|
6962
7495
|
TableBody.displayName = "TableBody";
|
|
6963
|
-
var TableFooter =
|
|
7496
|
+
var TableFooter = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
6964
7497
|
"tfoot",
|
|
6965
7498
|
{
|
|
6966
7499
|
ref,
|
|
@@ -6972,7 +7505,7 @@ var TableFooter = React28.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6972
7505
|
}
|
|
6973
7506
|
));
|
|
6974
7507
|
TableFooter.displayName = "TableFooter";
|
|
6975
|
-
var TableRow =
|
|
7508
|
+
var TableRow = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
6976
7509
|
"tr",
|
|
6977
7510
|
{
|
|
6978
7511
|
ref,
|
|
@@ -6986,7 +7519,7 @@ var TableRow = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
6986
7519
|
}
|
|
6987
7520
|
));
|
|
6988
7521
|
TableRow.displayName = "TableRow";
|
|
6989
|
-
var TableHead =
|
|
7522
|
+
var TableHead = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
6990
7523
|
"th",
|
|
6991
7524
|
{
|
|
6992
7525
|
ref,
|
|
@@ -6998,7 +7531,7 @@ var TableHead = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
6998
7531
|
}
|
|
6999
7532
|
));
|
|
7000
7533
|
TableHead.displayName = "TableHead";
|
|
7001
|
-
var TableCell =
|
|
7534
|
+
var TableCell = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
7002
7535
|
"td",
|
|
7003
7536
|
{
|
|
7004
7537
|
ref,
|
|
@@ -7007,7 +7540,7 @@ var TableCell = React28.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
7007
7540
|
}
|
|
7008
7541
|
));
|
|
7009
7542
|
TableCell.displayName = "TableCell";
|
|
7010
|
-
var TableCaption =
|
|
7543
|
+
var TableCaption = React29.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
7011
7544
|
"caption",
|
|
7012
7545
|
{
|
|
7013
7546
|
ref,
|
|
@@ -7019,12 +7552,12 @@ TableCaption.displayName = "TableCaption";
|
|
|
7019
7552
|
|
|
7020
7553
|
// ../../components/ui/DataTable.tsx
|
|
7021
7554
|
import { Filter as FilterIcon } from "lucide-react";
|
|
7022
|
-
import
|
|
7555
|
+
import React30 from "react";
|
|
7023
7556
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
7024
|
-
import { jsx as
|
|
7557
|
+
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
7025
7558
|
function useDebounced(value, delay = 300) {
|
|
7026
|
-
const [debounced, setDebounced] =
|
|
7027
|
-
|
|
7559
|
+
const [debounced, setDebounced] = React30.useState(value);
|
|
7560
|
+
React30.useEffect(() => {
|
|
7028
7561
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
7029
7562
|
return () => clearTimeout(id);
|
|
7030
7563
|
}, [value, delay]);
|
|
@@ -7051,20 +7584,20 @@ function DataTable({
|
|
|
7051
7584
|
labels
|
|
7052
7585
|
}) {
|
|
7053
7586
|
const t = useTranslations7("Common");
|
|
7054
|
-
const [visibleCols, setVisibleCols] =
|
|
7055
|
-
const [filters, setFilters] =
|
|
7056
|
-
const [sort, setSort] =
|
|
7057
|
-
const [density, setDensity] =
|
|
7058
|
-
const [curPage, setCurPage] =
|
|
7059
|
-
const [curPageSize, setCurPageSize] =
|
|
7587
|
+
const [visibleCols, setVisibleCols] = React30.useState(() => columns.filter((c) => c.visible !== false).map((c) => c.key));
|
|
7588
|
+
const [filters, setFilters] = React30.useState({});
|
|
7589
|
+
const [sort, setSort] = React30.useState(null);
|
|
7590
|
+
const [density, setDensity] = React30.useState("normal");
|
|
7591
|
+
const [curPage, setCurPage] = React30.useState(page);
|
|
7592
|
+
const [curPageSize, setCurPageSize] = React30.useState(pageSize);
|
|
7060
7593
|
const debouncedFilters = useDebounced(filters, 350);
|
|
7061
|
-
|
|
7594
|
+
React30.useEffect(() => {
|
|
7062
7595
|
setCurPage(page);
|
|
7063
7596
|
}, [page]);
|
|
7064
|
-
|
|
7597
|
+
React30.useEffect(() => {
|
|
7065
7598
|
setCurPageSize(pageSize);
|
|
7066
7599
|
}, [pageSize]);
|
|
7067
|
-
|
|
7600
|
+
React30.useEffect(() => {
|
|
7068
7601
|
if (!onQueryChange) return;
|
|
7069
7602
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
7070
7603
|
}, [debouncedFilters, sort, curPage, curPageSize]);
|
|
@@ -7083,7 +7616,7 @@ function DataTable({
|
|
|
7083
7616
|
className: "h-8 w-full text-sm"
|
|
7084
7617
|
};
|
|
7085
7618
|
if (col.filter.type === "text") {
|
|
7086
|
-
return /* @__PURE__ */
|
|
7619
|
+
return /* @__PURE__ */ jsx40(
|
|
7087
7620
|
Input_default,
|
|
7088
7621
|
{
|
|
7089
7622
|
...commonProps,
|
|
@@ -7098,7 +7631,7 @@ function DataTable({
|
|
|
7098
7631
|
}
|
|
7099
7632
|
if (col.filter.type === "select") {
|
|
7100
7633
|
const options = col.filter.options || [];
|
|
7101
|
-
return /* @__PURE__ */
|
|
7634
|
+
return /* @__PURE__ */ jsx40(
|
|
7102
7635
|
Combobox,
|
|
7103
7636
|
{
|
|
7104
7637
|
options: ["", ...options],
|
|
@@ -7114,7 +7647,7 @@ function DataTable({
|
|
|
7114
7647
|
);
|
|
7115
7648
|
}
|
|
7116
7649
|
if (col.filter.type === "date") {
|
|
7117
|
-
return /* @__PURE__ */
|
|
7650
|
+
return /* @__PURE__ */ jsx40(
|
|
7118
7651
|
DatePicker,
|
|
7119
7652
|
{
|
|
7120
7653
|
placeholder: col.filter.placeholder || `Select ${String(col.title)}`,
|
|
@@ -7128,7 +7661,7 @@ function DataTable({
|
|
|
7128
7661
|
}
|
|
7129
7662
|
return null;
|
|
7130
7663
|
};
|
|
7131
|
-
const renderHeader = /* @__PURE__ */
|
|
7664
|
+
const renderHeader = /* @__PURE__ */ jsx40(TableRow, { children: visibleColumns.map((col, colIdx) => /* @__PURE__ */ jsx40(
|
|
7132
7665
|
TableHead,
|
|
7133
7666
|
{
|
|
7134
7667
|
style: { width: col.width },
|
|
@@ -7137,10 +7670,10 @@ function DataTable({
|
|
|
7137
7670
|
col.align === "center" && "text-center",
|
|
7138
7671
|
columnDividers && colIdx > 0 && "border-l border-border/60"
|
|
7139
7672
|
),
|
|
7140
|
-
children: /* @__PURE__ */
|
|
7141
|
-
/* @__PURE__ */
|
|
7142
|
-
/* @__PURE__ */
|
|
7143
|
-
col.sortable && /* @__PURE__ */
|
|
7673
|
+
children: /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between gap-2 select-none min-h-[2.5rem]", children: [
|
|
7674
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-1 min-w-0 flex-1", children: [
|
|
7675
|
+
/* @__PURE__ */ jsx40("span", { className: "truncate font-medium text-sm", children: col.title }),
|
|
7676
|
+
col.sortable && /* @__PURE__ */ jsx40(
|
|
7144
7677
|
"button",
|
|
7145
7678
|
{
|
|
7146
7679
|
className: cn(
|
|
@@ -7157,8 +7690,8 @@ function DataTable({
|
|
|
7157
7690
|
},
|
|
7158
7691
|
"aria-label": "Sort",
|
|
7159
7692
|
title: `Sort by ${String(col.title)}`,
|
|
7160
|
-
children: /* @__PURE__ */
|
|
7161
|
-
/* @__PURE__ */
|
|
7693
|
+
children: /* @__PURE__ */ jsxs34("svg", { width: "14", height: "14", viewBox: "0 0 20 20", fill: "none", className: "inline-block", children: [
|
|
7694
|
+
/* @__PURE__ */ jsx40(
|
|
7162
7695
|
"path",
|
|
7163
7696
|
{
|
|
7164
7697
|
d: "M7 8l3-3 3 3",
|
|
@@ -7169,7 +7702,7 @@ function DataTable({
|
|
|
7169
7702
|
opacity: sort?.key === col.key && sort.order === "asc" ? 1 : 0.4
|
|
7170
7703
|
}
|
|
7171
7704
|
),
|
|
7172
|
-
/* @__PURE__ */
|
|
7705
|
+
/* @__PURE__ */ jsx40(
|
|
7173
7706
|
"path",
|
|
7174
7707
|
{
|
|
7175
7708
|
d: "M7 12l3 3 3-3",
|
|
@@ -7184,11 +7717,11 @@ function DataTable({
|
|
|
7184
7717
|
}
|
|
7185
7718
|
)
|
|
7186
7719
|
] }),
|
|
7187
|
-
col.filter && /* @__PURE__ */
|
|
7720
|
+
col.filter && /* @__PURE__ */ jsx40(
|
|
7188
7721
|
Popover,
|
|
7189
7722
|
{
|
|
7190
7723
|
placement: "bottom-start",
|
|
7191
|
-
trigger: /* @__PURE__ */
|
|
7724
|
+
trigger: /* @__PURE__ */ jsx40(
|
|
7192
7725
|
"button",
|
|
7193
7726
|
{
|
|
7194
7727
|
className: cn(
|
|
@@ -7198,16 +7731,16 @@ function DataTable({
|
|
|
7198
7731
|
),
|
|
7199
7732
|
"aria-label": "Filter",
|
|
7200
7733
|
title: "Filter",
|
|
7201
|
-
children: /* @__PURE__ */
|
|
7734
|
+
children: /* @__PURE__ */ jsx40(FilterIcon, { className: "h-4 w-4" })
|
|
7202
7735
|
}
|
|
7203
7736
|
),
|
|
7204
|
-
children: /* @__PURE__ */
|
|
7205
|
-
/* @__PURE__ */
|
|
7737
|
+
children: /* @__PURE__ */ jsxs34("div", { className: "w-48 p-2 space-y-2", children: [
|
|
7738
|
+
/* @__PURE__ */ jsxs34("div", { className: "text-xs font-medium text-muted-foreground mb-2", children: [
|
|
7206
7739
|
"Filter ",
|
|
7207
7740
|
col.title
|
|
7208
7741
|
] }),
|
|
7209
7742
|
renderFilterControl(col),
|
|
7210
|
-
filters[col.key] && /* @__PURE__ */
|
|
7743
|
+
filters[col.key] && /* @__PURE__ */ jsx40(
|
|
7211
7744
|
"button",
|
|
7212
7745
|
{
|
|
7213
7746
|
onClick: () => {
|
|
@@ -7230,20 +7763,20 @@ function DataTable({
|
|
|
7230
7763
|
col.key
|
|
7231
7764
|
)) });
|
|
7232
7765
|
const isServerMode = Boolean(onQueryChange);
|
|
7233
|
-
const displayedData = isServerMode ? data :
|
|
7766
|
+
const displayedData = isServerMode ? data : React30.useMemo(() => {
|
|
7234
7767
|
const start = (curPage - 1) * curPageSize;
|
|
7235
7768
|
return data.slice(start, start + curPageSize);
|
|
7236
7769
|
}, [data, curPage, curPageSize]);
|
|
7237
7770
|
const totalItems = isServerMode ? total : data.length;
|
|
7238
|
-
return /* @__PURE__ */
|
|
7239
|
-
/* @__PURE__ */
|
|
7240
|
-
/* @__PURE__ */
|
|
7241
|
-
/* @__PURE__ */
|
|
7242
|
-
enableDensityToggle && /* @__PURE__ */
|
|
7771
|
+
return /* @__PURE__ */ jsxs34("div", { className: cn("space-y-2", className), children: [
|
|
7772
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
7773
|
+
/* @__PURE__ */ jsx40("div", { className: "text-sm text-muted-foreground", children: caption }),
|
|
7774
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-2", children: [
|
|
7775
|
+
enableDensityToggle && /* @__PURE__ */ jsx40(
|
|
7243
7776
|
DropdownMenu_default,
|
|
7244
7777
|
{
|
|
7245
|
-
trigger: /* @__PURE__ */
|
|
7246
|
-
/* @__PURE__ */
|
|
7778
|
+
trigger: /* @__PURE__ */ jsxs34(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
7779
|
+
/* @__PURE__ */ jsx40("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx40("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
|
|
7247
7780
|
labels?.density || t("density")
|
|
7248
7781
|
] }),
|
|
7249
7782
|
items: [
|
|
@@ -7253,11 +7786,11 @@ function DataTable({
|
|
|
7253
7786
|
]
|
|
7254
7787
|
}
|
|
7255
7788
|
),
|
|
7256
|
-
enableColumnVisibilityToggle && /* @__PURE__ */
|
|
7789
|
+
enableColumnVisibilityToggle && /* @__PURE__ */ jsx40(
|
|
7257
7790
|
DropdownMenu_default,
|
|
7258
7791
|
{
|
|
7259
|
-
trigger: /* @__PURE__ */
|
|
7260
|
-
/* @__PURE__ */
|
|
7792
|
+
trigger: /* @__PURE__ */ jsxs34(Button_default, { variant: "ghost", size: "sm", className: "h-8 px-2", children: [
|
|
7793
|
+
/* @__PURE__ */ jsx40("svg", { className: "w-4 h-4 mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx40(
|
|
7261
7794
|
"path",
|
|
7262
7795
|
{
|
|
7263
7796
|
strokeLinecap: "round",
|
|
@@ -7268,15 +7801,15 @@ function DataTable({
|
|
|
7268
7801
|
) }),
|
|
7269
7802
|
labels?.columns || t("columns")
|
|
7270
7803
|
] }),
|
|
7271
|
-
children: columns.map((c) => /* @__PURE__ */
|
|
7804
|
+
children: columns.map((c) => /* @__PURE__ */ jsxs34(
|
|
7272
7805
|
DropdownMenuItem,
|
|
7273
7806
|
{
|
|
7274
7807
|
onClick: () => {
|
|
7275
7808
|
setVisibleCols((prev) => prev.includes(c.key) ? prev.filter((k) => k !== c.key) : [...prev, c.key]);
|
|
7276
7809
|
},
|
|
7277
7810
|
children: [
|
|
7278
|
-
/* @__PURE__ */
|
|
7279
|
-
/* @__PURE__ */
|
|
7811
|
+
/* @__PURE__ */ jsx40("input", { type: "checkbox", className: "mr-2 rounded border-border", readOnly: true, checked: visibleCols.includes(c.key) }),
|
|
7812
|
+
/* @__PURE__ */ jsx40("span", { className: "truncate", children: c.title })
|
|
7280
7813
|
]
|
|
7281
7814
|
},
|
|
7282
7815
|
c.key
|
|
@@ -7286,17 +7819,17 @@ function DataTable({
|
|
|
7286
7819
|
toolbar
|
|
7287
7820
|
] })
|
|
7288
7821
|
] }),
|
|
7289
|
-
/* @__PURE__ */
|
|
7822
|
+
/* @__PURE__ */ jsx40("div", { className: cn("relative rounded-md border border-border/50 overflow-hidden", loading2 && "opacity-60 pointer-events-none"), children: /* @__PURE__ */ jsxs34(
|
|
7290
7823
|
Table,
|
|
7291
7824
|
{
|
|
7292
7825
|
containerClassName: "border-0 md:border-0 rounded-none md:rounded-none shadow-none bg-transparent",
|
|
7293
7826
|
className: "[&_thead]:sticky [&_thead]:top-0 [&_thead]:z-[5] [&_thead]:bg-background [&_thead]:backdrop-blur-sm",
|
|
7294
7827
|
children: [
|
|
7295
|
-
/* @__PURE__ */
|
|
7296
|
-
/* @__PURE__ */
|
|
7297
|
-
/* @__PURE__ */
|
|
7298
|
-
/* @__PURE__ */
|
|
7299
|
-
/* @__PURE__ */
|
|
7828
|
+
/* @__PURE__ */ jsx40(TableHeader, { children: renderHeader }),
|
|
7829
|
+
/* @__PURE__ */ jsx40(TableBody, { children: loading2 ? /* @__PURE__ */ jsx40(TableRow, { children: /* @__PURE__ */ jsx40(TableCell, { colSpan: visibleColumns.length, className: "text-center py-8", children: /* @__PURE__ */ jsxs34("div", { className: "flex items-center justify-center gap-2 text-muted-foreground", children: [
|
|
7830
|
+
/* @__PURE__ */ jsxs34("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
7831
|
+
/* @__PURE__ */ jsx40("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
7832
|
+
/* @__PURE__ */ jsx40(
|
|
7300
7833
|
"path",
|
|
7301
7834
|
{
|
|
7302
7835
|
className: "opacity-75",
|
|
@@ -7305,10 +7838,10 @@ function DataTable({
|
|
|
7305
7838
|
}
|
|
7306
7839
|
)
|
|
7307
7840
|
] }),
|
|
7308
|
-
/* @__PURE__ */
|
|
7309
|
-
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */
|
|
7841
|
+
/* @__PURE__ */ jsx40("span", { className: "text-sm", children: "Loading..." })
|
|
7842
|
+
] }) }) }) : !displayedData || displayedData.length === 0 ? /* @__PURE__ */ jsx40(TableRow, { children: /* @__PURE__ */ jsx40(TableCell, { colSpan: visibleColumns.length, className: "text-center py-6 text-muted-foreground", children: "No data" }) }) : displayedData.map((row, idx) => /* @__PURE__ */ jsx40(TableRow, { className: cn(densityRowClass, striped && idx % 2 === 0 && "bg-muted/30"), children: visibleColumns.map((col, colIdx) => {
|
|
7310
7843
|
const value = col.dataIndex ? row[col.dataIndex] : void 0;
|
|
7311
|
-
return /* @__PURE__ */
|
|
7844
|
+
return /* @__PURE__ */ jsx40(
|
|
7312
7845
|
TableCell,
|
|
7313
7846
|
{
|
|
7314
7847
|
className: cn(
|
|
@@ -7327,7 +7860,7 @@ function DataTable({
|
|
|
7327
7860
|
]
|
|
7328
7861
|
}
|
|
7329
7862
|
) }),
|
|
7330
|
-
totalItems > 0 && /* @__PURE__ */
|
|
7863
|
+
totalItems > 0 && /* @__PURE__ */ jsx40("div", { className: "border-t bg-muted/30 p-4 rounded-b-md", children: /* @__PURE__ */ jsx40(
|
|
7331
7864
|
Pagination,
|
|
7332
7865
|
{
|
|
7333
7866
|
page: curPage,
|
|
@@ -7349,10 +7882,10 @@ function DataTable({
|
|
|
7349
7882
|
var DataTable_default = DataTable;
|
|
7350
7883
|
|
|
7351
7884
|
// ../../components/ui/Form.tsx
|
|
7352
|
-
import * as
|
|
7885
|
+
import * as React32 from "react";
|
|
7353
7886
|
|
|
7354
7887
|
// ../../node_modules/react-hook-form/dist/index.esm.mjs
|
|
7355
|
-
import
|
|
7888
|
+
import React31 from "react";
|
|
7356
7889
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
7357
7890
|
var isDateObject = (value) => value instanceof Date;
|
|
7358
7891
|
var isNullOrUndefined = (value) => value == null;
|
|
@@ -7440,12 +7973,12 @@ var INPUT_VALIDATION_RULES = {
|
|
|
7440
7973
|
required: "required",
|
|
7441
7974
|
validate: "validate"
|
|
7442
7975
|
};
|
|
7443
|
-
var HookFormContext =
|
|
7976
|
+
var HookFormContext = React31.createContext(null);
|
|
7444
7977
|
HookFormContext.displayName = "HookFormContext";
|
|
7445
|
-
var useFormContext = () =>
|
|
7978
|
+
var useFormContext = () => React31.useContext(HookFormContext);
|
|
7446
7979
|
var FormProvider = (props) => {
|
|
7447
7980
|
const { children, ...data } = props;
|
|
7448
|
-
return
|
|
7981
|
+
return React31.createElement(HookFormContext.Provider, { value: data }, children);
|
|
7449
7982
|
};
|
|
7450
7983
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
7451
7984
|
const result = {
|
|
@@ -7465,12 +7998,12 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
7465
7998
|
}
|
|
7466
7999
|
return result;
|
|
7467
8000
|
};
|
|
7468
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
8001
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React31.useLayoutEffect : React31.useEffect;
|
|
7469
8002
|
function useFormState(props) {
|
|
7470
8003
|
const methods = useFormContext();
|
|
7471
8004
|
const { control = methods.control, disabled, name, exact } = props || {};
|
|
7472
|
-
const [formState, updateFormState] =
|
|
7473
|
-
const _localProxyFormState =
|
|
8005
|
+
const [formState, updateFormState] = React31.useState(control._formState);
|
|
8006
|
+
const _localProxyFormState = React31.useRef({
|
|
7474
8007
|
isDirty: false,
|
|
7475
8008
|
isLoading: false,
|
|
7476
8009
|
dirtyFields: false,
|
|
@@ -7491,10 +8024,10 @@ function useFormState(props) {
|
|
|
7491
8024
|
});
|
|
7492
8025
|
}
|
|
7493
8026
|
}), [name, disabled, exact]);
|
|
7494
|
-
|
|
8027
|
+
React31.useEffect(() => {
|
|
7495
8028
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
7496
8029
|
}, [control]);
|
|
7497
|
-
return
|
|
8030
|
+
return React31.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
|
|
7498
8031
|
}
|
|
7499
8032
|
var isString = (value) => typeof value === "string";
|
|
7500
8033
|
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
@@ -7543,12 +8076,12 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
7543
8076
|
function useWatch(props) {
|
|
7544
8077
|
const methods = useFormContext();
|
|
7545
8078
|
const { control = methods.control, name, defaultValue, disabled, exact, compute } = props || {};
|
|
7546
|
-
const _defaultValue =
|
|
7547
|
-
const _compute =
|
|
7548
|
-
const _computeFormValues =
|
|
8079
|
+
const _defaultValue = React31.useRef(defaultValue);
|
|
8080
|
+
const _compute = React31.useRef(compute);
|
|
8081
|
+
const _computeFormValues = React31.useRef(void 0);
|
|
7549
8082
|
_compute.current = compute;
|
|
7550
|
-
const defaultValueMemo =
|
|
7551
|
-
const [value, updateValue] =
|
|
8083
|
+
const defaultValueMemo = React31.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
|
|
8084
|
+
const [value, updateValue] = React31.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
7552
8085
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
7553
8086
|
name,
|
|
7554
8087
|
formState: {
|
|
@@ -7570,14 +8103,14 @@ function useWatch(props) {
|
|
|
7570
8103
|
}
|
|
7571
8104
|
}
|
|
7572
8105
|
}), [control, disabled, name, exact]);
|
|
7573
|
-
|
|
8106
|
+
React31.useEffect(() => control._removeUnmounted());
|
|
7574
8107
|
return value;
|
|
7575
8108
|
}
|
|
7576
8109
|
function useController(props) {
|
|
7577
8110
|
const methods = useFormContext();
|
|
7578
8111
|
const { name, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
7579
8112
|
const isArrayField = isNameInFieldArray(control._names.array, name);
|
|
7580
|
-
const defaultValueMemo =
|
|
8113
|
+
const defaultValueMemo = React31.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
|
|
7581
8114
|
const value = useWatch({
|
|
7582
8115
|
control,
|
|
7583
8116
|
name,
|
|
@@ -7589,15 +8122,15 @@ function useController(props) {
|
|
|
7589
8122
|
name,
|
|
7590
8123
|
exact: true
|
|
7591
8124
|
});
|
|
7592
|
-
const _props =
|
|
7593
|
-
const _previousNameRef =
|
|
7594
|
-
const _registerProps =
|
|
8125
|
+
const _props = React31.useRef(props);
|
|
8126
|
+
const _previousNameRef = React31.useRef(void 0);
|
|
8127
|
+
const _registerProps = React31.useRef(control.register(name, {
|
|
7595
8128
|
...props.rules,
|
|
7596
8129
|
value,
|
|
7597
8130
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
7598
8131
|
}));
|
|
7599
8132
|
_props.current = props;
|
|
7600
|
-
const fieldState =
|
|
8133
|
+
const fieldState = React31.useMemo(() => Object.defineProperties({}, {
|
|
7601
8134
|
invalid: {
|
|
7602
8135
|
enumerable: true,
|
|
7603
8136
|
get: () => !!get(formState.errors, name)
|
|
@@ -7619,21 +8152,21 @@ function useController(props) {
|
|
|
7619
8152
|
get: () => get(formState.errors, name)
|
|
7620
8153
|
}
|
|
7621
8154
|
}), [formState, name]);
|
|
7622
|
-
const onChange =
|
|
8155
|
+
const onChange = React31.useCallback((event) => _registerProps.current.onChange({
|
|
7623
8156
|
target: {
|
|
7624
8157
|
value: getEventValue(event),
|
|
7625
8158
|
name
|
|
7626
8159
|
},
|
|
7627
8160
|
type: EVENTS.CHANGE
|
|
7628
8161
|
}), [name]);
|
|
7629
|
-
const onBlur =
|
|
8162
|
+
const onBlur = React31.useCallback(() => _registerProps.current.onBlur({
|
|
7630
8163
|
target: {
|
|
7631
8164
|
value: get(control._formValues, name),
|
|
7632
8165
|
name
|
|
7633
8166
|
},
|
|
7634
8167
|
type: EVENTS.BLUR
|
|
7635
8168
|
}), [name, control._formValues]);
|
|
7636
|
-
const ref =
|
|
8169
|
+
const ref = React31.useCallback((elm) => {
|
|
7637
8170
|
const field2 = get(control._fields, name);
|
|
7638
8171
|
if (field2 && elm) {
|
|
7639
8172
|
field2._f.ref = {
|
|
@@ -7644,7 +8177,7 @@ function useController(props) {
|
|
|
7644
8177
|
};
|
|
7645
8178
|
}
|
|
7646
8179
|
}, [control._fields, name]);
|
|
7647
|
-
const field =
|
|
8180
|
+
const field = React31.useMemo(() => ({
|
|
7648
8181
|
name,
|
|
7649
8182
|
value,
|
|
7650
8183
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
@@ -7652,7 +8185,7 @@ function useController(props) {
|
|
|
7652
8185
|
onBlur,
|
|
7653
8186
|
ref
|
|
7654
8187
|
}), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
|
|
7655
|
-
|
|
8188
|
+
React31.useEffect(() => {
|
|
7656
8189
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
7657
8190
|
const previousName = _previousNameRef.current;
|
|
7658
8191
|
if (previousName && previousName !== name && !isArrayField) {
|
|
@@ -7682,13 +8215,13 @@ function useController(props) {
|
|
|
7682
8215
|
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
|
|
7683
8216
|
};
|
|
7684
8217
|
}, [name, control, isArrayField, shouldUnregister]);
|
|
7685
|
-
|
|
8218
|
+
React31.useEffect(() => {
|
|
7686
8219
|
control._setDisabledField({
|
|
7687
8220
|
disabled,
|
|
7688
8221
|
name
|
|
7689
8222
|
});
|
|
7690
8223
|
}, [disabled, name, control]);
|
|
7691
|
-
return
|
|
8224
|
+
return React31.useMemo(() => ({
|
|
7692
8225
|
field,
|
|
7693
8226
|
formState,
|
|
7694
8227
|
fieldState
|
|
@@ -9007,9 +9540,9 @@ function createFormControl(props = {}) {
|
|
|
9007
9540
|
};
|
|
9008
9541
|
}
|
|
9009
9542
|
function useForm(props = {}) {
|
|
9010
|
-
const _formControl =
|
|
9011
|
-
const _values =
|
|
9012
|
-
const [formState, updateFormState] =
|
|
9543
|
+
const _formControl = React31.useRef(void 0);
|
|
9544
|
+
const _values = React31.useRef(void 0);
|
|
9545
|
+
const [formState, updateFormState] = React31.useState({
|
|
9013
9546
|
isDirty: false,
|
|
9014
9547
|
isValidating: false,
|
|
9015
9548
|
isLoading: isFunction(props.defaultValues),
|
|
@@ -9058,8 +9591,8 @@ function useForm(props = {}) {
|
|
|
9058
9591
|
control._formState.isReady = true;
|
|
9059
9592
|
return sub;
|
|
9060
9593
|
}, [control]);
|
|
9061
|
-
|
|
9062
|
-
|
|
9594
|
+
React31.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
|
9595
|
+
React31.useEffect(() => {
|
|
9063
9596
|
if (props.mode) {
|
|
9064
9597
|
control._options.mode = props.mode;
|
|
9065
9598
|
}
|
|
@@ -9067,18 +9600,18 @@ function useForm(props = {}) {
|
|
|
9067
9600
|
control._options.reValidateMode = props.reValidateMode;
|
|
9068
9601
|
}
|
|
9069
9602
|
}, [control, props.mode, props.reValidateMode]);
|
|
9070
|
-
|
|
9603
|
+
React31.useEffect(() => {
|
|
9071
9604
|
if (props.errors) {
|
|
9072
9605
|
control._setErrors(props.errors);
|
|
9073
9606
|
control._focusError();
|
|
9074
9607
|
}
|
|
9075
9608
|
}, [control, props.errors]);
|
|
9076
|
-
|
|
9609
|
+
React31.useEffect(() => {
|
|
9077
9610
|
props.shouldUnregister && control._subjects.state.next({
|
|
9078
9611
|
values: control._getWatch()
|
|
9079
9612
|
});
|
|
9080
9613
|
}, [control, props.shouldUnregister]);
|
|
9081
|
-
|
|
9614
|
+
React31.useEffect(() => {
|
|
9082
9615
|
if (control._proxyFormState.isDirty) {
|
|
9083
9616
|
const isDirty = control._getDirty();
|
|
9084
9617
|
if (isDirty !== formState.isDirty) {
|
|
@@ -9088,7 +9621,7 @@ function useForm(props = {}) {
|
|
|
9088
9621
|
}
|
|
9089
9622
|
}
|
|
9090
9623
|
}, [control, formState.isDirty]);
|
|
9091
|
-
|
|
9624
|
+
React31.useEffect(() => {
|
|
9092
9625
|
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
9093
9626
|
control._reset(props.values, {
|
|
9094
9627
|
keepFieldsRef: true,
|
|
@@ -9100,7 +9633,7 @@ function useForm(props = {}) {
|
|
|
9100
9633
|
control._resetDefaultValues();
|
|
9101
9634
|
}
|
|
9102
9635
|
}, [control, props.values]);
|
|
9103
|
-
|
|
9636
|
+
React31.useEffect(() => {
|
|
9104
9637
|
if (!control._state.mount) {
|
|
9105
9638
|
control._setValid();
|
|
9106
9639
|
control._state.mount = true;
|
|
@@ -9117,8 +9650,8 @@ function useForm(props = {}) {
|
|
|
9117
9650
|
|
|
9118
9651
|
// ../../components/ui/Form.tsx
|
|
9119
9652
|
import { useTranslations as useTranslations8 } from "next-intl";
|
|
9120
|
-
import { jsx as
|
|
9121
|
-
var FormConfigContext =
|
|
9653
|
+
import { jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9654
|
+
var FormConfigContext = React32.createContext({ size: "md" });
|
|
9122
9655
|
var FormWrapper = ({
|
|
9123
9656
|
children,
|
|
9124
9657
|
onSubmit,
|
|
@@ -9131,24 +9664,24 @@ var FormWrapper = ({
|
|
|
9131
9664
|
const methods = useForm({
|
|
9132
9665
|
defaultValues: initialValues
|
|
9133
9666
|
});
|
|
9134
|
-
|
|
9667
|
+
React32.useEffect(() => {
|
|
9135
9668
|
if (initialValues) {
|
|
9136
9669
|
methods.reset(initialValues);
|
|
9137
9670
|
}
|
|
9138
9671
|
}, [JSON.stringify(initialValues)]);
|
|
9139
9672
|
const { validationSchema: _, ...formProps } = props;
|
|
9140
|
-
return /* @__PURE__ */
|
|
9673
|
+
return /* @__PURE__ */ jsx41(FormProvider, { ...methods, children: /* @__PURE__ */ jsx41(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx41("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
9141
9674
|
};
|
|
9142
9675
|
var Form = FormWrapper;
|
|
9143
|
-
var FormFieldContext =
|
|
9676
|
+
var FormFieldContext = React32.createContext({});
|
|
9144
9677
|
var FormField = ({
|
|
9145
9678
|
...props
|
|
9146
9679
|
}) => {
|
|
9147
|
-
return /* @__PURE__ */
|
|
9680
|
+
return /* @__PURE__ */ jsx41(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx41(Controller, { ...props }) });
|
|
9148
9681
|
};
|
|
9149
9682
|
var useFormField = () => {
|
|
9150
|
-
const fieldContext =
|
|
9151
|
-
const itemContext =
|
|
9683
|
+
const fieldContext = React32.useContext(FormFieldContext);
|
|
9684
|
+
const itemContext = React32.useContext(FormItemContext);
|
|
9152
9685
|
const { getFieldState, formState } = useFormContext();
|
|
9153
9686
|
if (!fieldContext) {
|
|
9154
9687
|
try {
|
|
@@ -9169,22 +9702,22 @@ var useFormField = () => {
|
|
|
9169
9702
|
...fieldState
|
|
9170
9703
|
};
|
|
9171
9704
|
};
|
|
9172
|
-
var FormItemContext =
|
|
9173
|
-
var FormItem =
|
|
9174
|
-
const id =
|
|
9175
|
-
return /* @__PURE__ */
|
|
9705
|
+
var FormItemContext = React32.createContext({});
|
|
9706
|
+
var FormItem = React32.forwardRef(({ className, ...props }, ref) => {
|
|
9707
|
+
const id = React32.useId();
|
|
9708
|
+
return /* @__PURE__ */ jsx41(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx41("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
9176
9709
|
});
|
|
9177
9710
|
FormItem.displayName = "FormItem";
|
|
9178
|
-
var FormLabel =
|
|
9711
|
+
var FormLabel = React32.forwardRef(({ className, ...props }, ref) => {
|
|
9179
9712
|
const { error, formItemId } = useFormField();
|
|
9180
|
-
const config =
|
|
9713
|
+
const config = React32.useContext(FormConfigContext);
|
|
9181
9714
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
9182
|
-
return /* @__PURE__ */
|
|
9715
|
+
return /* @__PURE__ */ jsx41(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props });
|
|
9183
9716
|
});
|
|
9184
9717
|
FormLabel.displayName = "FormLabel";
|
|
9185
|
-
var FormControl =
|
|
9718
|
+
var FormControl = React32.forwardRef(({ ...props }, ref) => {
|
|
9186
9719
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
9187
|
-
return /* @__PURE__ */
|
|
9720
|
+
return /* @__PURE__ */ jsx41(
|
|
9188
9721
|
"div",
|
|
9189
9722
|
{
|
|
9190
9723
|
ref,
|
|
@@ -9196,37 +9729,37 @@ var FormControl = React31.forwardRef(({ ...props }, ref) => {
|
|
|
9196
9729
|
);
|
|
9197
9730
|
});
|
|
9198
9731
|
FormControl.displayName = "FormControl";
|
|
9199
|
-
var FormDescription =
|
|
9732
|
+
var FormDescription = React32.forwardRef(({ className, ...props }, ref) => {
|
|
9200
9733
|
const { formDescriptionId } = useFormField();
|
|
9201
|
-
return /* @__PURE__ */
|
|
9734
|
+
return /* @__PURE__ */ jsx41("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
9202
9735
|
});
|
|
9203
9736
|
FormDescription.displayName = "FormDescription";
|
|
9204
|
-
var FormMessage =
|
|
9737
|
+
var FormMessage = React32.forwardRef(({ className, children, ...props }, ref) => {
|
|
9205
9738
|
const { error, formMessageId } = useFormField();
|
|
9206
9739
|
const body = error ? String(error?.message) : children;
|
|
9207
9740
|
if (!body) {
|
|
9208
9741
|
return null;
|
|
9209
9742
|
}
|
|
9210
|
-
return /* @__PURE__ */
|
|
9743
|
+
return /* @__PURE__ */ jsx41("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
9211
9744
|
});
|
|
9212
9745
|
FormMessage.displayName = "FormMessage";
|
|
9213
|
-
var FormInput =
|
|
9746
|
+
var FormInput = React32.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx41(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx41(
|
|
9214
9747
|
FormField,
|
|
9215
9748
|
{
|
|
9216
9749
|
name,
|
|
9217
|
-
render: ({ field }) => /* @__PURE__ */
|
|
9218
|
-
/* @__PURE__ */
|
|
9219
|
-
/* @__PURE__ */
|
|
9750
|
+
render: ({ field }) => /* @__PURE__ */ jsxs35(FormItem, { children: [
|
|
9751
|
+
/* @__PURE__ */ jsx41(FormControl, { children: /* @__PURE__ */ jsx41(Input_default, { size: props.size ?? size, ...field, ...props }) }),
|
|
9752
|
+
/* @__PURE__ */ jsx41(FormMessage, {})
|
|
9220
9753
|
] })
|
|
9221
9754
|
}
|
|
9222
9755
|
) }));
|
|
9223
9756
|
FormInput.displayName = "FormInput";
|
|
9224
|
-
var FormCheckbox =
|
|
9757
|
+
var FormCheckbox = React32.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ jsx41(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx41(
|
|
9225
9758
|
FormField,
|
|
9226
9759
|
{
|
|
9227
9760
|
name,
|
|
9228
|
-
render: ({ field }) => /* @__PURE__ */
|
|
9229
|
-
/* @__PURE__ */
|
|
9761
|
+
render: ({ field }) => /* @__PURE__ */ jsxs35(FormItem, { children: [
|
|
9762
|
+
/* @__PURE__ */ jsx41(FormControl, { children: /* @__PURE__ */ jsx41(
|
|
9230
9763
|
Checkbox,
|
|
9231
9764
|
{
|
|
9232
9765
|
ref,
|
|
@@ -9240,20 +9773,20 @@ var FormCheckbox = React31.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
9240
9773
|
...props
|
|
9241
9774
|
}
|
|
9242
9775
|
) }),
|
|
9243
|
-
/* @__PURE__ */
|
|
9776
|
+
/* @__PURE__ */ jsx41(FormMessage, {})
|
|
9244
9777
|
] })
|
|
9245
9778
|
}
|
|
9246
9779
|
) }));
|
|
9247
9780
|
FormCheckbox.displayName = "FormCheckbox";
|
|
9248
|
-
var FormActions =
|
|
9781
|
+
var FormActions = React32.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx41("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
9249
9782
|
FormActions.displayName = "FormActions";
|
|
9250
|
-
var FormSubmitButton =
|
|
9783
|
+
var FormSubmitButton = React32.forwardRef(({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ jsx41(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ jsx41(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) }));
|
|
9251
9784
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
9252
9785
|
|
|
9253
9786
|
// ../../components/ui/NotificationModal.tsx
|
|
9254
9787
|
import { ExternalLink } from "lucide-react";
|
|
9255
9788
|
import { useTranslations as useTranslations9 } from "next-intl";
|
|
9256
|
-
import { jsx as
|
|
9789
|
+
import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9257
9790
|
function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
|
|
9258
9791
|
const t = useTranslations9("Common");
|
|
9259
9792
|
if (!notification) return null;
|
|
@@ -9274,26 +9807,26 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
9274
9807
|
onClose();
|
|
9275
9808
|
}
|
|
9276
9809
|
};
|
|
9277
|
-
return /* @__PURE__ */
|
|
9810
|
+
return /* @__PURE__ */ jsx42(
|
|
9278
9811
|
Modal_default,
|
|
9279
9812
|
{
|
|
9280
9813
|
isOpen,
|
|
9281
9814
|
onClose,
|
|
9282
9815
|
title: titleText || t("notifications"),
|
|
9283
9816
|
size: "md",
|
|
9284
|
-
children: /* @__PURE__ */
|
|
9285
|
-
/* @__PURE__ */
|
|
9286
|
-
/* @__PURE__ */
|
|
9817
|
+
children: /* @__PURE__ */ jsxs36("div", { className: "space-y-4", children: [
|
|
9818
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2 pb-2 border-b border-border", children: [
|
|
9819
|
+
/* @__PURE__ */ jsx42("div", { className: cn(
|
|
9287
9820
|
"w-2 h-2 rounded-full",
|
|
9288
9821
|
!notification.is_read ? "bg-primary" : "bg-border"
|
|
9289
9822
|
) }),
|
|
9290
|
-
/* @__PURE__ */
|
|
9823
|
+
/* @__PURE__ */ jsx42("span", { className: "text-xs text-muted-foreground", children: !notification.is_read ? t("newNotification") : t("readStatus") })
|
|
9291
9824
|
] }),
|
|
9292
|
-
notification.title && /* @__PURE__ */
|
|
9293
|
-
notification.body && /* @__PURE__ */
|
|
9294
|
-
/* @__PURE__ */
|
|
9295
|
-
/* @__PURE__ */
|
|
9296
|
-
hasLink && /* @__PURE__ */
|
|
9825
|
+
notification.title && /* @__PURE__ */ jsx42("h3", { className: "text-lg font-semibold text-foreground", children: notification.title }),
|
|
9826
|
+
notification.body && /* @__PURE__ */ jsx42("div", { className: "text-sm text-muted-foreground whitespace-pre-wrap leading-relaxed", children: notification.body }),
|
|
9827
|
+
/* @__PURE__ */ jsx42("div", { className: "text-xs text-muted-foreground border-t border-border pt-2", children: formatTime2(notification.created_at) }),
|
|
9828
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex gap-2 justify-end pt-2", children: [
|
|
9829
|
+
hasLink && /* @__PURE__ */ jsxs36(
|
|
9297
9830
|
Button_default,
|
|
9298
9831
|
{
|
|
9299
9832
|
variant: "primary",
|
|
@@ -9301,12 +9834,12 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
9301
9834
|
onClick: handleLinkClick,
|
|
9302
9835
|
className: "gap-2",
|
|
9303
9836
|
children: [
|
|
9304
|
-
/* @__PURE__ */
|
|
9837
|
+
/* @__PURE__ */ jsx42(ExternalLink, { className: "w-4 h-4" }),
|
|
9305
9838
|
openLinkText || t("openLink")
|
|
9306
9839
|
]
|
|
9307
9840
|
}
|
|
9308
9841
|
),
|
|
9309
|
-
/* @__PURE__ */
|
|
9842
|
+
/* @__PURE__ */ jsx42(
|
|
9310
9843
|
Button_default,
|
|
9311
9844
|
{
|
|
9312
9845
|
variant: "ghost",
|
|
@@ -9328,10 +9861,10 @@ import { usePathname } from "next/navigation";
|
|
|
9328
9861
|
import { Phone } from "lucide-react";
|
|
9329
9862
|
|
|
9330
9863
|
// ../../node_modules/react-icons/lib/iconBase.mjs
|
|
9331
|
-
import
|
|
9864
|
+
import React34 from "react";
|
|
9332
9865
|
|
|
9333
9866
|
// ../../node_modules/react-icons/lib/iconContext.mjs
|
|
9334
|
-
import
|
|
9867
|
+
import React33 from "react";
|
|
9335
9868
|
var DefaultContext = {
|
|
9336
9869
|
color: void 0,
|
|
9337
9870
|
size: void 0,
|
|
@@ -9339,7 +9872,7 @@ var DefaultContext = {
|
|
|
9339
9872
|
style: void 0,
|
|
9340
9873
|
attr: void 0
|
|
9341
9874
|
};
|
|
9342
|
-
var IconContext =
|
|
9875
|
+
var IconContext = React33.createContext && /* @__PURE__ */ React33.createContext(DefaultContext);
|
|
9343
9876
|
|
|
9344
9877
|
// ../../node_modules/react-icons/lib/iconBase.mjs
|
|
9345
9878
|
var _excluded = ["attr", "size", "title"];
|
|
@@ -9428,12 +9961,12 @@ function _toPrimitive(t, r) {
|
|
|
9428
9961
|
return ("string" === r ? String : Number)(t);
|
|
9429
9962
|
}
|
|
9430
9963
|
function Tree2Element(tree) {
|
|
9431
|
-
return tree && tree.map((node, i) => /* @__PURE__ */
|
|
9964
|
+
return tree && tree.map((node, i) => /* @__PURE__ */ React34.createElement(node.tag, _objectSpread({
|
|
9432
9965
|
key: i
|
|
9433
9966
|
}, node.attr), Tree2Element(node.child)));
|
|
9434
9967
|
}
|
|
9435
9968
|
function GenIcon(data) {
|
|
9436
|
-
return (props) => /* @__PURE__ */
|
|
9969
|
+
return (props) => /* @__PURE__ */ React34.createElement(IconBase, _extends({
|
|
9437
9970
|
attr: _objectSpread({}, data.attr)
|
|
9438
9971
|
}, props), Tree2Element(data.child));
|
|
9439
9972
|
}
|
|
@@ -9448,7 +9981,7 @@ function IconBase(props) {
|
|
|
9448
9981
|
var className;
|
|
9449
9982
|
if (conf.className) className = conf.className;
|
|
9450
9983
|
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
9451
|
-
return /* @__PURE__ */
|
|
9984
|
+
return /* @__PURE__ */ React34.createElement("svg", _extends({
|
|
9452
9985
|
stroke: "currentColor",
|
|
9453
9986
|
fill: "currentColor",
|
|
9454
9987
|
strokeWidth: "0"
|
|
@@ -9460,9 +9993,9 @@ function IconBase(props) {
|
|
|
9460
9993
|
height: computedSize,
|
|
9461
9994
|
width: computedSize,
|
|
9462
9995
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9463
|
-
}), title && /* @__PURE__ */
|
|
9996
|
+
}), title && /* @__PURE__ */ React34.createElement("title", null, title), props.children);
|
|
9464
9997
|
};
|
|
9465
|
-
return IconContext !== void 0 ? /* @__PURE__ */
|
|
9998
|
+
return IconContext !== void 0 ? /* @__PURE__ */ React34.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
|
|
9466
9999
|
}
|
|
9467
10000
|
|
|
9468
10001
|
// ../../node_modules/react-icons/fa/index.mjs
|
|
@@ -9476,9 +10009,9 @@ function SiZalo(props) {
|
|
|
9476
10009
|
}
|
|
9477
10010
|
|
|
9478
10011
|
// ../../components/ui/FloatingContacts.tsx
|
|
9479
|
-
import { jsx as
|
|
10012
|
+
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9480
10013
|
function MessengerIcon(props) {
|
|
9481
|
-
return /* @__PURE__ */
|
|
10014
|
+
return /* @__PURE__ */ jsx43("svg", { viewBox: "0 0 24 24", width: 24, height: 24, "aria-hidden": "true", ...props, children: /* @__PURE__ */ jsx43(
|
|
9482
10015
|
"path",
|
|
9483
10016
|
{
|
|
9484
10017
|
d: "M12 2C6.477 2 2 6.145 2 11.235c0 2.93 1.35 5.542 3.464 7.25v3.515l3.344-1.836c.894.247 1.843.375 2.192.375 5.523 0 10-4.145 10-9.235S17.523 2 12 2zm.994 12.444l-2.563-2.73-5.004 2.73 5.507-5.84 2.626 2.729 4.942-2.729-5.508 5.84z",
|
|
@@ -9487,10 +10020,10 @@ function MessengerIcon(props) {
|
|
|
9487
10020
|
) });
|
|
9488
10021
|
}
|
|
9489
10022
|
function ZaloIcon(props) {
|
|
9490
|
-
return /* @__PURE__ */
|
|
10023
|
+
return /* @__PURE__ */ jsx43(SiZalo, { size: 20, ...props });
|
|
9491
10024
|
}
|
|
9492
10025
|
function InstagramIcon(props) {
|
|
9493
|
-
return /* @__PURE__ */
|
|
10026
|
+
return /* @__PURE__ */ jsx43(FaInstagram, { size: 20, ...props });
|
|
9494
10027
|
}
|
|
9495
10028
|
function FloatingContacts({ className }) {
|
|
9496
10029
|
const pathname = usePathname();
|
|
@@ -9525,8 +10058,8 @@ function FloatingContacts({ className }) {
|
|
|
9525
10058
|
external: true
|
|
9526
10059
|
}
|
|
9527
10060
|
];
|
|
9528
|
-
return /* @__PURE__ */
|
|
9529
|
-
/* @__PURE__ */
|
|
10061
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn("fixed bottom-6 right-4 z-[100000]", "flex flex-col items-end gap-3", className), "aria-label": "Quick contacts", children: [
|
|
10062
|
+
/* @__PURE__ */ jsx43(
|
|
9530
10063
|
Link2,
|
|
9531
10064
|
{
|
|
9532
10065
|
href: `tel:${hotline.replace(/\D/g, "")}`,
|
|
@@ -9537,10 +10070,10 @@ function FloatingContacts({ className }) {
|
|
|
9537
10070
|
"hover:scale-105 active:scale-95 transition-transform",
|
|
9538
10071
|
"bg-[#22c55e]"
|
|
9539
10072
|
),
|
|
9540
|
-
children: /* @__PURE__ */
|
|
10073
|
+
children: /* @__PURE__ */ jsx43(Phone, { className: "w-6 h-6" })
|
|
9541
10074
|
}
|
|
9542
10075
|
),
|
|
9543
|
-
moreItems.map(({ key, href, label, bg, Icon, external }) => /* @__PURE__ */
|
|
10076
|
+
moreItems.map(({ key, href, label, bg, Icon, external }) => /* @__PURE__ */ jsx43(
|
|
9544
10077
|
Link2,
|
|
9545
10078
|
{
|
|
9546
10079
|
href,
|
|
@@ -9552,7 +10085,7 @@ function FloatingContacts({ className }) {
|
|
|
9552
10085
|
"hover:scale-105 active:scale-95 transition-transform",
|
|
9553
10086
|
bg
|
|
9554
10087
|
),
|
|
9555
|
-
children: /* @__PURE__ */
|
|
10088
|
+
children: /* @__PURE__ */ jsx43(Icon, { className: "w-6 h-6" })
|
|
9556
10089
|
},
|
|
9557
10090
|
key
|
|
9558
10091
|
))
|
|
@@ -9561,7 +10094,7 @@ function FloatingContacts({ className }) {
|
|
|
9561
10094
|
|
|
9562
10095
|
// ../../components/ui/AccessDenied.tsx
|
|
9563
10096
|
import { Lock, ShieldAlert, Ban } from "lucide-react";
|
|
9564
|
-
import { jsx as
|
|
10097
|
+
import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9565
10098
|
var VARIANT_STYLES = {
|
|
9566
10099
|
destructive: { bg: "bg-destructive/5", border: "border-destructive/20", text: "text-destructive" },
|
|
9567
10100
|
warning: { bg: "bg-warning/5", border: "border-warning/20", text: "text-warning" },
|
|
@@ -9582,21 +10115,21 @@ function AccessDenied({
|
|
|
9582
10115
|
}) {
|
|
9583
10116
|
const styles = VARIANT_STYLES[variant];
|
|
9584
10117
|
const UsedIcon = Icon || DEFAULT_ICONS[variant];
|
|
9585
|
-
return /* @__PURE__ */
|
|
9586
|
-
/* @__PURE__ */
|
|
9587
|
-
/* @__PURE__ */
|
|
9588
|
-
/* @__PURE__ */
|
|
9589
|
-
/* @__PURE__ */
|
|
10118
|
+
return /* @__PURE__ */ jsx44(Card_default, { className: cn("p-8 text-center shadow-sm", styles.bg, styles.border, className), children: /* @__PURE__ */ jsxs38("div", { className: "flex flex-col items-center gap-4", children: [
|
|
10119
|
+
/* @__PURE__ */ jsx44("div", { className: cn("p-3 rounded-lg", styles.bg.replace("/5", "/10")), children: /* @__PURE__ */ jsx44(UsedIcon, { className: cn("w-8 h-8", styles.text) }) }),
|
|
10120
|
+
/* @__PURE__ */ jsxs38("div", { children: [
|
|
10121
|
+
/* @__PURE__ */ jsx44("h3", { className: cn("font-semibold mb-2", styles.text), children: title }),
|
|
10122
|
+
/* @__PURE__ */ jsx44("p", { className: cn(styles.text.replace("text-", "text-") + "/80", "text-sm"), children: description })
|
|
9590
10123
|
] }),
|
|
9591
|
-
children && /* @__PURE__ */
|
|
10124
|
+
children && /* @__PURE__ */ jsx44("div", { className: "mt-2 flex flex-wrap gap-2 justify-center", children })
|
|
9592
10125
|
] }) });
|
|
9593
10126
|
}
|
|
9594
10127
|
|
|
9595
10128
|
// ../../components/ui/ThemeToggleHeadless.tsx
|
|
9596
10129
|
import { Moon, Sun, Monitor } from "lucide-react";
|
|
9597
|
-
import { useEffect as useEffect16, useRef as
|
|
10130
|
+
import { useEffect as useEffect16, useRef as useRef11, useState as useState26 } from "react";
|
|
9598
10131
|
import { createPortal as createPortal9 } from "react-dom";
|
|
9599
|
-
import { Fragment as Fragment11, jsx as
|
|
10132
|
+
import { Fragment as Fragment11, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9600
10133
|
function ThemeToggleHeadless({
|
|
9601
10134
|
theme,
|
|
9602
10135
|
onChange,
|
|
@@ -9605,7 +10138,7 @@ function ThemeToggleHeadless({
|
|
|
9605
10138
|
}) {
|
|
9606
10139
|
const [isOpen, setIsOpen] = useState26(false);
|
|
9607
10140
|
const [mounted, setMounted] = useState26(false);
|
|
9608
|
-
const triggerRef =
|
|
10141
|
+
const triggerRef = useRef11(null);
|
|
9609
10142
|
const [dropdownPosition, setDropdownPosition] = useState26(null);
|
|
9610
10143
|
useEffect16(() => setMounted(true), []);
|
|
9611
10144
|
const themes = [
|
|
@@ -9625,8 +10158,8 @@ function ThemeToggleHeadless({
|
|
|
9625
10158
|
const top = rect.bottom + scrollTop + 8;
|
|
9626
10159
|
return { top, left, width };
|
|
9627
10160
|
};
|
|
9628
|
-
return /* @__PURE__ */
|
|
9629
|
-
/* @__PURE__ */
|
|
10161
|
+
return /* @__PURE__ */ jsxs39("div", { className: cn("relative", className), children: [
|
|
10162
|
+
/* @__PURE__ */ jsx45(
|
|
9630
10163
|
Button_default,
|
|
9631
10164
|
{
|
|
9632
10165
|
variant: "ghost",
|
|
@@ -9644,25 +10177,25 @@ function ThemeToggleHeadless({
|
|
|
9644
10177
|
"aria-haspopup": "menu",
|
|
9645
10178
|
"aria-expanded": isOpen,
|
|
9646
10179
|
"aria-label": labels?.heading ?? "Theme",
|
|
9647
|
-
children: /* @__PURE__ */
|
|
10180
|
+
children: /* @__PURE__ */ jsx45(CurrentIcon, { className: "h-5 w-5" })
|
|
9648
10181
|
}
|
|
9649
10182
|
),
|
|
9650
|
-
isOpen && /* @__PURE__ */
|
|
9651
|
-
typeof window !== "undefined" && createPortal9(/* @__PURE__ */
|
|
10183
|
+
isOpen && /* @__PURE__ */ jsxs39(Fragment11, { children: [
|
|
10184
|
+
typeof window !== "undefined" && createPortal9(/* @__PURE__ */ jsx45("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
9652
10185
|
typeof window !== "undefined" && dropdownPosition && createPortal9(
|
|
9653
|
-
/* @__PURE__ */
|
|
10186
|
+
/* @__PURE__ */ jsx45(
|
|
9654
10187
|
"div",
|
|
9655
10188
|
{
|
|
9656
10189
|
className: "z-[9999] bg-card border border-border rounded-lg shadow-lg overflow-hidden",
|
|
9657
10190
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
9658
10191
|
onMouseDown: (e) => e.stopPropagation(),
|
|
9659
10192
|
role: "menu",
|
|
9660
|
-
children: /* @__PURE__ */
|
|
9661
|
-
/* @__PURE__ */
|
|
10193
|
+
children: /* @__PURE__ */ jsxs39("div", { className: "p-2", children: [
|
|
10194
|
+
/* @__PURE__ */ jsx45("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border mb-2", children: labels?.heading ?? "Theme" }),
|
|
9662
10195
|
themes.map((opt) => {
|
|
9663
10196
|
const Icon = opt.icon;
|
|
9664
10197
|
const active = theme === opt.value;
|
|
9665
|
-
return /* @__PURE__ */
|
|
10198
|
+
return /* @__PURE__ */ jsxs39(
|
|
9666
10199
|
Button_default,
|
|
9667
10200
|
{
|
|
9668
10201
|
variant: "ghost",
|
|
@@ -9678,9 +10211,9 @@ function ThemeToggleHeadless({
|
|
|
9678
10211
|
role: "menuitemradio",
|
|
9679
10212
|
"aria-checked": active,
|
|
9680
10213
|
children: [
|
|
9681
|
-
/* @__PURE__ */
|
|
9682
|
-
/* @__PURE__ */
|
|
9683
|
-
active && /* @__PURE__ */
|
|
10214
|
+
/* @__PURE__ */ jsx45(Icon, { className: "h-4 w-4" }),
|
|
10215
|
+
/* @__PURE__ */ jsx45("span", { className: "flex-1 text-left", children: opt.label }),
|
|
10216
|
+
active && /* @__PURE__ */ jsx45("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
9684
10217
|
]
|
|
9685
10218
|
},
|
|
9686
10219
|
opt.value
|
|
@@ -9696,10 +10229,10 @@ function ThemeToggleHeadless({
|
|
|
9696
10229
|
}
|
|
9697
10230
|
|
|
9698
10231
|
// ../../components/ui/LanguageSwitcherHeadless.tsx
|
|
9699
|
-
import { useRef as
|
|
10232
|
+
import { useRef as useRef12, useState as useState27 } from "react";
|
|
9700
10233
|
import { createPortal as createPortal10 } from "react-dom";
|
|
9701
10234
|
import { Globe } from "lucide-react";
|
|
9702
|
-
import { Fragment as Fragment12, jsx as
|
|
10235
|
+
import { Fragment as Fragment12, jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9703
10236
|
function LanguageSwitcherHeadless({
|
|
9704
10237
|
locales,
|
|
9705
10238
|
currentLocale,
|
|
@@ -9709,7 +10242,7 @@ function LanguageSwitcherHeadless({
|
|
|
9709
10242
|
}) {
|
|
9710
10243
|
const [isOpen, setIsOpen] = useState27(false);
|
|
9711
10244
|
const [dropdownPosition, setDropdownPosition] = useState27(null);
|
|
9712
|
-
const triggerButtonRef =
|
|
10245
|
+
const triggerButtonRef = useRef12(null);
|
|
9713
10246
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
9714
10247
|
const calculatePosition = () => {
|
|
9715
10248
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -9721,8 +10254,8 @@ function LanguageSwitcherHeadless({
|
|
|
9721
10254
|
const top = rect.bottom + scrollTop + 8;
|
|
9722
10255
|
return { top, left, width };
|
|
9723
10256
|
};
|
|
9724
|
-
return /* @__PURE__ */
|
|
9725
|
-
/* @__PURE__ */
|
|
10257
|
+
return /* @__PURE__ */ jsxs40("div", { className: cn("relative", className), children: [
|
|
10258
|
+
/* @__PURE__ */ jsx46(
|
|
9726
10259
|
Button_default,
|
|
9727
10260
|
{
|
|
9728
10261
|
variant: "ghost",
|
|
@@ -9741,22 +10274,22 @@ function LanguageSwitcherHeadless({
|
|
|
9741
10274
|
"aria-expanded": isOpen,
|
|
9742
10275
|
"aria-label": labels?.heading ?? "Language",
|
|
9743
10276
|
title: labels?.heading ?? "Language",
|
|
9744
|
-
children: /* @__PURE__ */
|
|
10277
|
+
children: /* @__PURE__ */ jsx46(Globe, { className: "h-5 w-5" })
|
|
9745
10278
|
}
|
|
9746
10279
|
),
|
|
9747
|
-
isOpen && /* @__PURE__ */
|
|
9748
|
-
typeof window !== "undefined" && createPortal10(/* @__PURE__ */
|
|
10280
|
+
isOpen && /* @__PURE__ */ jsxs40(Fragment12, { children: [
|
|
10281
|
+
typeof window !== "undefined" && createPortal10(/* @__PURE__ */ jsx46("div", { className: "fixed inset-0 z-[9998]", onClick: () => setIsOpen(false) }), document.body),
|
|
9749
10282
|
typeof window !== "undefined" && dropdownPosition && createPortal10(
|
|
9750
|
-
/* @__PURE__ */
|
|
10283
|
+
/* @__PURE__ */ jsx46(
|
|
9751
10284
|
"div",
|
|
9752
10285
|
{
|
|
9753
10286
|
className: "z-[9999] bg-card border border-border rounded-lg shadow-lg overflow-hidden",
|
|
9754
10287
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
9755
10288
|
onMouseDown: (e) => e.stopPropagation(),
|
|
9756
10289
|
role: "menu",
|
|
9757
|
-
children: /* @__PURE__ */
|
|
9758
|
-
/* @__PURE__ */
|
|
9759
|
-
locales.map((language) => /* @__PURE__ */
|
|
10290
|
+
children: /* @__PURE__ */ jsxs40("div", { className: "p-2", children: [
|
|
10291
|
+
/* @__PURE__ */ jsx46("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border mb-2", children: labels?.heading ?? "Language" }),
|
|
10292
|
+
locales.map((language) => /* @__PURE__ */ jsxs40(
|
|
9760
10293
|
Button_default,
|
|
9761
10294
|
{
|
|
9762
10295
|
variant: "ghost",
|
|
@@ -9769,9 +10302,9 @@ function LanguageSwitcherHeadless({
|
|
|
9769
10302
|
role: "menuitemradio",
|
|
9770
10303
|
"aria-checked": currentLocale === language.code,
|
|
9771
10304
|
children: [
|
|
9772
|
-
language.flag && /* @__PURE__ */
|
|
9773
|
-
/* @__PURE__ */
|
|
9774
|
-
currentLocale === language.code && /* @__PURE__ */
|
|
10305
|
+
language.flag && /* @__PURE__ */ jsx46("span", { className: "text-lg", children: language.flag }),
|
|
10306
|
+
/* @__PURE__ */ jsx46("span", { className: "flex-1 text-left", children: language.name }),
|
|
10307
|
+
currentLocale === language.code && /* @__PURE__ */ jsx46("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
9775
10308
|
]
|
|
9776
10309
|
},
|
|
9777
10310
|
language.code
|
|
@@ -9943,6 +10476,7 @@ export {
|
|
|
9943
10476
|
DropdownMenu_default as DropdownMenu,
|
|
9944
10477
|
DropdownMenuItem,
|
|
9945
10478
|
DropdownMenuSeparator,
|
|
10479
|
+
FallingIcons,
|
|
9946
10480
|
FloatingContacts,
|
|
9947
10481
|
Form,
|
|
9948
10482
|
FormActions,
|