@underverse-ui/underverse 1.0.82 → 1.0.83
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 +1 -1
- package/dist/index.cjs +284 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +284 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -822,11 +822,15 @@ interface DatePickerProps {
|
|
|
822
822
|
}
|
|
823
823
|
declare const DatePicker: React$1.FC<DatePickerProps>;
|
|
824
824
|
interface DateRangePickerProps {
|
|
825
|
+
id?: string;
|
|
825
826
|
startDate?: Date;
|
|
826
827
|
endDate?: Date;
|
|
827
|
-
onChange: (start: Date, end: Date) => void;
|
|
828
|
+
onChange: (start: Date | undefined, end: Date | undefined) => void;
|
|
828
829
|
placeholder?: string;
|
|
829
830
|
className?: string;
|
|
831
|
+
label?: string;
|
|
832
|
+
labelClassName?: string;
|
|
833
|
+
required?: boolean;
|
|
830
834
|
/** Disable selecting past dates (before today) */
|
|
831
835
|
disablePastDates?: boolean;
|
|
832
836
|
/** Minimum selectable date (inclusive). Compared by day in local timezone. */
|
package/dist/index.d.ts
CHANGED
|
@@ -822,11 +822,15 @@ interface DatePickerProps {
|
|
|
822
822
|
}
|
|
823
823
|
declare const DatePicker: React$1.FC<DatePickerProps>;
|
|
824
824
|
interface DateRangePickerProps {
|
|
825
|
+
id?: string;
|
|
825
826
|
startDate?: Date;
|
|
826
827
|
endDate?: Date;
|
|
827
|
-
onChange: (start: Date, end: Date) => void;
|
|
828
|
+
onChange: (start: Date | undefined, end: Date | undefined) => void;
|
|
828
829
|
placeholder?: string;
|
|
829
830
|
className?: string;
|
|
831
|
+
label?: string;
|
|
832
|
+
labelClassName?: string;
|
|
833
|
+
required?: boolean;
|
|
830
834
|
/** Disable selecting past dates (before today) */
|
|
831
835
|
disablePastDates?: boolean;
|
|
832
836
|
/** Minimum selectable date (inclusive). Compared by day in local timezone. */
|
package/dist/index.js
CHANGED
|
@@ -8568,10 +8568,27 @@ var DatePicker = ({
|
|
|
8568
8568
|
effectiveError && /* @__PURE__ */ jsx34("div", { className: "text-xs text-destructive", children: effectiveError })
|
|
8569
8569
|
] });
|
|
8570
8570
|
};
|
|
8571
|
-
var DateRangePicker = ({
|
|
8571
|
+
var DateRangePicker = ({
|
|
8572
|
+
id,
|
|
8573
|
+
startDate,
|
|
8574
|
+
endDate,
|
|
8575
|
+
onChange,
|
|
8576
|
+
placeholder = "Select date range...",
|
|
8577
|
+
className,
|
|
8578
|
+
label,
|
|
8579
|
+
labelClassName,
|
|
8580
|
+
required = false,
|
|
8581
|
+
disablePastDates = false,
|
|
8582
|
+
minDate,
|
|
8583
|
+
maxDate,
|
|
8584
|
+
size = "md"
|
|
8585
|
+
}) => {
|
|
8572
8586
|
const locale = useSmartLocale();
|
|
8573
8587
|
const t = useSmartTranslations("DatePicker");
|
|
8588
|
+
const tv = useSmartTranslations("ValidationInput");
|
|
8574
8589
|
const [isOpen, setIsOpen] = React28.useState(false);
|
|
8590
|
+
const [viewMode, setViewMode] = React28.useState("calendar");
|
|
8591
|
+
const [localRequiredError, setLocalRequiredError] = React28.useState();
|
|
8575
8592
|
const wheelContainerRef = React28.useRef(null);
|
|
8576
8593
|
const wheelDeltaRef = React28.useRef(0);
|
|
8577
8594
|
const sizeStyles8 = {
|
|
@@ -8643,6 +8660,16 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8643
8660
|
React28.useEffect(() => {
|
|
8644
8661
|
setTempEnd(normalizeToLocal(endDate));
|
|
8645
8662
|
}, [endDate]);
|
|
8663
|
+
React28.useEffect(() => {
|
|
8664
|
+
if (!isOpen) {
|
|
8665
|
+
setViewMode("calendar");
|
|
8666
|
+
}
|
|
8667
|
+
}, [isOpen]);
|
|
8668
|
+
React28.useEffect(() => {
|
|
8669
|
+
if (!required || startDate && endDate) {
|
|
8670
|
+
setLocalRequiredError(void 0);
|
|
8671
|
+
}
|
|
8672
|
+
}, [endDate, required, startDate]);
|
|
8646
8673
|
const isSameDay2 = (a, b) => {
|
|
8647
8674
|
if (!a || !b) return false;
|
|
8648
8675
|
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
@@ -8653,6 +8680,9 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8653
8680
|
const navigateMonth = React28.useCallback((direction) => {
|
|
8654
8681
|
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() + (direction === "next" ? 1 : -1), 1));
|
|
8655
8682
|
}, []);
|
|
8683
|
+
const navigateYearRange = React28.useCallback((direction) => {
|
|
8684
|
+
setViewDate((prev) => new Date(prev.getFullYear() + (direction === "next" ? 12 : -12), prev.getMonth(), 1));
|
|
8685
|
+
}, []);
|
|
8656
8686
|
const isElementVerticallyScrollable = (el) => {
|
|
8657
8687
|
const style = window.getComputedStyle(el);
|
|
8658
8688
|
const overflowY = style.overflowY;
|
|
@@ -8697,11 +8727,33 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8697
8727
|
setTempStart(localDate);
|
|
8698
8728
|
} else {
|
|
8699
8729
|
setTempEnd(localDate);
|
|
8730
|
+
setLocalRequiredError(void 0);
|
|
8700
8731
|
onChange(tempStart, localDate);
|
|
8701
8732
|
setIsOpen(false);
|
|
8702
8733
|
}
|
|
8703
8734
|
}
|
|
8704
8735
|
};
|
|
8736
|
+
const handleSelectToday = () => {
|
|
8737
|
+
const today = /* @__PURE__ */ new Date();
|
|
8738
|
+
today.setHours(0, 0, 0, 0);
|
|
8739
|
+
const localToday = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
8740
|
+
const isPastDate = disablePastDates && localToday < today;
|
|
8741
|
+
const isOutOfRange = !!minDay && localToday < minDay || !!maxDay && localToday > maxDay;
|
|
8742
|
+
if (isPastDate || isOutOfRange) return;
|
|
8743
|
+
setTempStart(localToday);
|
|
8744
|
+
setTempEnd(localToday);
|
|
8745
|
+
setHoveredDate(null);
|
|
8746
|
+
setLocalRequiredError(void 0);
|
|
8747
|
+
onChange(localToday, localToday);
|
|
8748
|
+
setIsOpen(false);
|
|
8749
|
+
};
|
|
8750
|
+
const handleClear = () => {
|
|
8751
|
+
setTempStart(null);
|
|
8752
|
+
setTempEnd(null);
|
|
8753
|
+
setHoveredDate(null);
|
|
8754
|
+
onChange(void 0, void 0);
|
|
8755
|
+
setIsOpen(false);
|
|
8756
|
+
};
|
|
8705
8757
|
const renderGrid = () => {
|
|
8706
8758
|
const nodes = [];
|
|
8707
8759
|
const daysInMonth = getDaysInMonth(viewDate);
|
|
@@ -8770,13 +8822,63 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8770
8822
|
}
|
|
8771
8823
|
return nodes;
|
|
8772
8824
|
};
|
|
8825
|
+
const renderMonthSelector = () => {
|
|
8826
|
+
const months = locale === "vi" ? ["Th1", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7", "Th8", "Th9", "Th10", "Th11", "Th12"] : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
8827
|
+
return /* @__PURE__ */ jsx34("div", { className: "grid grid-cols-3 gap-2 p-2", children: months.map((month, idx) => {
|
|
8828
|
+
const isSelected = viewDate.getMonth() === idx;
|
|
8829
|
+
return /* @__PURE__ */ jsx34(
|
|
8830
|
+
"button",
|
|
8831
|
+
{
|
|
8832
|
+
type: "button",
|
|
8833
|
+
onClick: () => {
|
|
8834
|
+
setViewDate(new Date(viewDate.getFullYear(), idx, 1));
|
|
8835
|
+
setViewMode("calendar");
|
|
8836
|
+
},
|
|
8837
|
+
className: cn(
|
|
8838
|
+
"py-2 px-3 rounded-lg text-sm font-medium transition-all duration-200",
|
|
8839
|
+
isSelected ? "bg-primary text-primary-foreground shadow-md" : "hover:bg-accent/80 text-foreground hover:scale-105"
|
|
8840
|
+
),
|
|
8841
|
+
children: month
|
|
8842
|
+
},
|
|
8843
|
+
month
|
|
8844
|
+
);
|
|
8845
|
+
}) });
|
|
8846
|
+
};
|
|
8847
|
+
const renderYearSelector = () => {
|
|
8848
|
+
const startYear = Math.floor(viewDate.getFullYear() / 12) * 12;
|
|
8849
|
+
const years = Array.from({ length: 12 }, (_, i) => startYear + i);
|
|
8850
|
+
return /* @__PURE__ */ jsx34("div", { className: "grid grid-cols-3 gap-2 p-2", children: years.map((year) => {
|
|
8851
|
+
const isSelected = viewDate.getFullYear() === year;
|
|
8852
|
+
return /* @__PURE__ */ jsx34(
|
|
8853
|
+
"button",
|
|
8854
|
+
{
|
|
8855
|
+
type: "button",
|
|
8856
|
+
onClick: () => {
|
|
8857
|
+
setViewDate(new Date(year, viewDate.getMonth(), 1));
|
|
8858
|
+
setViewMode("month");
|
|
8859
|
+
},
|
|
8860
|
+
className: cn(
|
|
8861
|
+
"py-2 px-3 rounded-lg text-sm font-medium transition-all duration-200",
|
|
8862
|
+
isSelected ? "bg-primary text-primary-foreground shadow-md" : "hover:bg-accent/80 text-foreground hover:scale-105"
|
|
8863
|
+
),
|
|
8864
|
+
children: year
|
|
8865
|
+
},
|
|
8866
|
+
year
|
|
8867
|
+
);
|
|
8868
|
+
}) });
|
|
8869
|
+
};
|
|
8870
|
+
const todayDate = React28.useMemo(() => {
|
|
8871
|
+
const today = /* @__PURE__ */ new Date();
|
|
8872
|
+
return new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
8873
|
+
}, []);
|
|
8874
|
+
const isTodayUnavailable = !!minDay && todayDate < minDay || !!maxDay && todayDate > maxDay;
|
|
8773
8875
|
const panel = /* @__PURE__ */ jsxs24("div", { ref: wheelContainerRef, className: "w-full", children: [
|
|
8774
8876
|
/* @__PURE__ */ jsxs24("div", { className: cn("flex items-center justify-between px-1", sizeStyles8[size].headerMargin), children: [
|
|
8775
8877
|
/* @__PURE__ */ jsx34(
|
|
8776
8878
|
"button",
|
|
8777
8879
|
{
|
|
8778
8880
|
type: "button",
|
|
8779
|
-
onClick: () => navigateMonth("prev"),
|
|
8881
|
+
onClick: () => viewMode === "year" ? navigateYearRange("prev") : navigateMonth("prev"),
|
|
8780
8882
|
className: cn(
|
|
8781
8883
|
"rounded-xl transition-all duration-200",
|
|
8782
8884
|
sizeStyles8[size].navButton,
|
|
@@ -8787,15 +8889,39 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8787
8889
|
children: /* @__PURE__ */ jsx34(ChevronLeft2, { className: sizeStyles8[size].navIcon })
|
|
8788
8890
|
}
|
|
8789
8891
|
),
|
|
8790
|
-
/* @__PURE__ */ jsxs24("div", { className: "flex
|
|
8791
|
-
/* @__PURE__ */ jsx34(
|
|
8792
|
-
|
|
8892
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1", children: [
|
|
8893
|
+
/* @__PURE__ */ jsx34(
|
|
8894
|
+
"button",
|
|
8895
|
+
{
|
|
8896
|
+
type: "button",
|
|
8897
|
+
onClick: () => setViewMode(viewMode === "month" ? "calendar" : "month"),
|
|
8898
|
+
className: cn(
|
|
8899
|
+
"rounded-lg px-2 py-0.5 font-bold transition-colors duration-200",
|
|
8900
|
+
size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm",
|
|
8901
|
+
viewMode === "month" ? "bg-primary/15 text-primary" : "text-foreground hover:bg-accent/50"
|
|
8902
|
+
),
|
|
8903
|
+
children: viewDate.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", { month: "long" })
|
|
8904
|
+
}
|
|
8905
|
+
),
|
|
8906
|
+
/* @__PURE__ */ jsx34(
|
|
8907
|
+
"button",
|
|
8908
|
+
{
|
|
8909
|
+
type: "button",
|
|
8910
|
+
onClick: () => setViewMode(viewMode === "year" ? "calendar" : "year"),
|
|
8911
|
+
className: cn(
|
|
8912
|
+
"rounded-lg px-2 py-0.5 font-medium transition-colors duration-200",
|
|
8913
|
+
size === "sm" ? "text-[10px]" : size === "lg" ? "text-sm" : "text-xs",
|
|
8914
|
+
viewMode === "year" ? "bg-primary/15 text-primary" : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
|
|
8915
|
+
),
|
|
8916
|
+
children: viewDate.getFullYear()
|
|
8917
|
+
}
|
|
8918
|
+
)
|
|
8793
8919
|
] }),
|
|
8794
8920
|
/* @__PURE__ */ jsx34(
|
|
8795
8921
|
"button",
|
|
8796
8922
|
{
|
|
8797
8923
|
type: "button",
|
|
8798
|
-
onClick: () => navigateMonth("next"),
|
|
8924
|
+
onClick: () => viewMode === "year" ? navigateYearRange("next") : navigateMonth("next"),
|
|
8799
8925
|
className: cn(
|
|
8800
8926
|
"rounded-xl transition-all duration-200",
|
|
8801
8927
|
sizeStyles8[size].navButton,
|
|
@@ -8807,82 +8933,167 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8807
8933
|
}
|
|
8808
8934
|
)
|
|
8809
8935
|
] }),
|
|
8810
|
-
|
|
8811
|
-
"div",
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
open: isOpen,
|
|
8830
|
-
onOpenChange: setIsOpen,
|
|
8831
|
-
placement: "bottom-start",
|
|
8832
|
-
contentWidth: size === "sm" ? 240 : 280,
|
|
8833
|
-
contentClassName: cn(
|
|
8834
|
-
"p-0",
|
|
8835
|
-
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
8836
|
-
"rounded-2xl md:rounded-3xl",
|
|
8837
|
-
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
8838
|
-
size === "sm" ? "p-3" : "p-5",
|
|
8839
|
-
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
8840
|
-
),
|
|
8841
|
-
trigger: /* @__PURE__ */ jsxs24(
|
|
8936
|
+
viewMode === "calendar" && /* @__PURE__ */ jsxs24(Fragment6, { children: [
|
|
8937
|
+
/* @__PURE__ */ jsx34("div", { className: cn("grid grid-cols-7 gap-1 px-0.5", size === "sm" ? "mb-1" : size === "lg" ? "mb-3" : "mb-2"), children: (locale === "vi" ? ["CN", "T2", "T3", "T4", "T5", "T6", "T7"] : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]).map((d, idx) => /* @__PURE__ */ jsx34(
|
|
8938
|
+
"div",
|
|
8939
|
+
{
|
|
8940
|
+
className: cn(
|
|
8941
|
+
"text-center font-bold uppercase tracking-wide",
|
|
8942
|
+
sizeStyles8[size].weekdayLabel,
|
|
8943
|
+
idx === 0 || idx === 6 ? "text-primary/70" : "text-muted-foreground/60"
|
|
8944
|
+
),
|
|
8945
|
+
children: d
|
|
8946
|
+
},
|
|
8947
|
+
d
|
|
8948
|
+
)) }),
|
|
8949
|
+
/* @__PURE__ */ jsx34("div", { className: "grid grid-cols-7 gap-0.5 p-1 rounded-xl bg-muted/20", children: renderGrid() })
|
|
8950
|
+
] }),
|
|
8951
|
+
viewMode === "month" && renderMonthSelector(),
|
|
8952
|
+
viewMode === "year" && renderYearSelector(),
|
|
8953
|
+
/* @__PURE__ */ jsxs24("div", { className: cn("flex items-center border-t border-border/50", sizeStyles8[size].footerMargin), children: [
|
|
8954
|
+
/* @__PURE__ */ jsxs24(
|
|
8842
8955
|
"button",
|
|
8843
8956
|
{
|
|
8844
8957
|
type: "button",
|
|
8958
|
+
onClick: handleSelectToday,
|
|
8959
|
+
disabled: isTodayUnavailable,
|
|
8845
8960
|
className: cn(
|
|
8846
|
-
"
|
|
8847
|
-
|
|
8848
|
-
"
|
|
8849
|
-
"
|
|
8850
|
-
"hover:
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
className
|
|
8961
|
+
"flex-1 font-semibold rounded-xl",
|
|
8962
|
+
"bg-linear-to-r from-primary/10 to-primary/5 border border-primary/30",
|
|
8963
|
+
"text-primary hover:from-primary/20 hover:to-primary/10 hover:border-primary/50",
|
|
8964
|
+
"transition-all duration-300 flex items-center justify-center",
|
|
8965
|
+
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-primary/10",
|
|
8966
|
+
sizeStyles8[size].actionButton,
|
|
8967
|
+
isTodayUnavailable && "opacity-50 cursor-not-allowed hover:scale-100 active:scale-100"
|
|
8854
8968
|
),
|
|
8855
8969
|
children: [
|
|
8856
|
-
/* @__PURE__ */
|
|
8857
|
-
|
|
8858
|
-
"div",
|
|
8859
|
-
{
|
|
8860
|
-
className: cn(
|
|
8861
|
-
"flex items-center justify-center transition-colors duration-300",
|
|
8862
|
-
isOpen ? "text-primary" : "text-muted-foreground group-hover:text-primary"
|
|
8863
|
-
),
|
|
8864
|
-
children: /* @__PURE__ */ jsx34(Calendar, { className: cn("transition-transform duration-300", size === "sm" ? "h-3 w-3" : "h-4 w-4", isOpen && "scale-110") })
|
|
8865
|
-
}
|
|
8866
|
-
),
|
|
8867
|
-
/* @__PURE__ */ jsx34(
|
|
8868
|
-
"span",
|
|
8869
|
-
{
|
|
8870
|
-
className: cn(
|
|
8871
|
-
"truncate font-medium transition-colors duration-200",
|
|
8872
|
-
!tempStart && !tempEnd && "text-muted-foreground",
|
|
8873
|
-
(tempStart || tempEnd) && "text-foreground"
|
|
8874
|
-
),
|
|
8875
|
-
children: label
|
|
8876
|
-
}
|
|
8877
|
-
)
|
|
8878
|
-
] }),
|
|
8879
|
-
/* @__PURE__ */ jsx34("span", { className: cn("transition-all duration-300 text-muted-foreground group-hover:text-foreground", isOpen && "rotate-180 text-primary"), children: /* @__PURE__ */ jsx34("svg", { className: cn(size === "sm" ? "h-3 w-3" : "h-4 w-4"), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ jsx34("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
8970
|
+
/* @__PURE__ */ jsx34(Sparkles2, { className: sizeStyles8[size].actionIcon }),
|
|
8971
|
+
t("today")
|
|
8880
8972
|
]
|
|
8881
8973
|
}
|
|
8882
8974
|
),
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8975
|
+
/* @__PURE__ */ jsxs24(
|
|
8976
|
+
"button",
|
|
8977
|
+
{
|
|
8978
|
+
type: "button",
|
|
8979
|
+
onClick: handleClear,
|
|
8980
|
+
className: cn(
|
|
8981
|
+
"flex-1 font-semibold rounded-xl",
|
|
8982
|
+
"bg-linear-to-r from-destructive/10 to-destructive/5 border border-destructive/30",
|
|
8983
|
+
"text-destructive hover:from-destructive/20 hover:to-destructive/10 hover:border-destructive/50",
|
|
8984
|
+
"transition-all duration-300 flex items-center justify-center",
|
|
8985
|
+
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-destructive/10",
|
|
8986
|
+
sizeStyles8[size].actionButton
|
|
8987
|
+
),
|
|
8988
|
+
children: [
|
|
8989
|
+
/* @__PURE__ */ jsx34(XIcon, { className: sizeStyles8[size].actionIcon }),
|
|
8990
|
+
t("clear")
|
|
8991
|
+
]
|
|
8992
|
+
}
|
|
8993
|
+
)
|
|
8994
|
+
] })
|
|
8995
|
+
] });
|
|
8996
|
+
const displayFormat = (date) => formatDateShort(date);
|
|
8997
|
+
const displayLabel = tempStart && tempEnd ? `${displayFormat(tempStart)} - ${displayFormat(tempEnd)}` : tempStart ? `${displayFormat(tempStart)} - ...` : placeholder;
|
|
8998
|
+
const effectiveError = localRequiredError;
|
|
8999
|
+
const autoId = useId6();
|
|
9000
|
+
const resolvedId = id ? String(id) : `daterangepicker-${autoId}`;
|
|
9001
|
+
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
9002
|
+
return /* @__PURE__ */ jsxs24("div", { className: cn("space-y-1.5", className), children: [
|
|
9003
|
+
label && /* @__PURE__ */ jsxs24(
|
|
9004
|
+
"label",
|
|
9005
|
+
{
|
|
9006
|
+
id: labelId,
|
|
9007
|
+
htmlFor: resolvedId,
|
|
9008
|
+
className: cn(size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm", "font-medium text-foreground", effectiveError && "text-destructive", labelClassName),
|
|
9009
|
+
children: [
|
|
9010
|
+
label,
|
|
9011
|
+
required && /* @__PURE__ */ jsx34("span", { className: "text-destructive ml-1", children: "*" })
|
|
9012
|
+
]
|
|
9013
|
+
}
|
|
9014
|
+
),
|
|
9015
|
+
/* @__PURE__ */ jsx34(
|
|
9016
|
+
"input",
|
|
9017
|
+
{
|
|
9018
|
+
tabIndex: -1,
|
|
9019
|
+
"aria-hidden": "true",
|
|
9020
|
+
value: startDate && endDate ? "selected" : "",
|
|
9021
|
+
onChange: () => {
|
|
9022
|
+
},
|
|
9023
|
+
required,
|
|
9024
|
+
onInvalid: (e) => {
|
|
9025
|
+
e.preventDefault();
|
|
9026
|
+
setLocalRequiredError(tv("required"));
|
|
9027
|
+
},
|
|
9028
|
+
className: "pointer-events-none absolute h-0 w-0 opacity-0"
|
|
9029
|
+
}
|
|
9030
|
+
),
|
|
9031
|
+
/* @__PURE__ */ jsx34(
|
|
9032
|
+
Popover,
|
|
9033
|
+
{
|
|
9034
|
+
open: isOpen,
|
|
9035
|
+
onOpenChange: setIsOpen,
|
|
9036
|
+
placement: "bottom-start",
|
|
9037
|
+
contentWidth: sizeStyles8[size].contentWidth,
|
|
9038
|
+
contentClassName: cn(
|
|
9039
|
+
"p-0",
|
|
9040
|
+
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
9041
|
+
"rounded-2xl md:rounded-3xl",
|
|
9042
|
+
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
9043
|
+
sizeStyles8[size].contentPadding,
|
|
9044
|
+
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
9045
|
+
),
|
|
9046
|
+
trigger: /* @__PURE__ */ jsxs24(
|
|
9047
|
+
"button",
|
|
9048
|
+
{
|
|
9049
|
+
id: resolvedId,
|
|
9050
|
+
type: "button",
|
|
9051
|
+
"aria-labelledby": labelId,
|
|
9052
|
+
"aria-required": required,
|
|
9053
|
+
"aria-invalid": !!effectiveError,
|
|
9054
|
+
className: cn(
|
|
9055
|
+
"group flex w-full items-center justify-between rounded-full border bg-background/80 backdrop-blur-sm",
|
|
9056
|
+
sizeStyles8[size].trigger,
|
|
9057
|
+
"border-border/60 hover:border-primary/40",
|
|
9058
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
9059
|
+
"hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
|
|
9060
|
+
"transition-all duration-300 ease-out",
|
|
9061
|
+
isOpen && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
|
|
9062
|
+
effectiveError && "border-destructive/60 focus-visible:ring-destructive/50 bg-destructive/5"
|
|
9063
|
+
),
|
|
9064
|
+
children: [
|
|
9065
|
+
/* @__PURE__ */ jsxs24("div", { className: cn("flex items-center", size === "sm" ? "gap-1.5" : "gap-2.5"), children: [
|
|
9066
|
+
/* @__PURE__ */ jsx34(
|
|
9067
|
+
"div",
|
|
9068
|
+
{
|
|
9069
|
+
className: cn(
|
|
9070
|
+
"flex items-center justify-center transition-colors duration-300",
|
|
9071
|
+
effectiveError ? "text-destructive" : isOpen ? "text-primary" : "text-muted-foreground group-hover:text-primary"
|
|
9072
|
+
),
|
|
9073
|
+
children: /* @__PURE__ */ jsx34(Calendar, { className: cn("transition-transform duration-300", sizeStyles8[size].calendarIcon, isOpen && "scale-110") })
|
|
9074
|
+
}
|
|
9075
|
+
),
|
|
9076
|
+
/* @__PURE__ */ jsx34(
|
|
9077
|
+
"span",
|
|
9078
|
+
{
|
|
9079
|
+
className: cn(
|
|
9080
|
+
"truncate font-medium transition-colors duration-200",
|
|
9081
|
+
!tempStart && !tempEnd && "text-muted-foreground",
|
|
9082
|
+
(tempStart || tempEnd) && "text-foreground"
|
|
9083
|
+
),
|
|
9084
|
+
children: displayLabel
|
|
9085
|
+
}
|
|
9086
|
+
)
|
|
9087
|
+
] }),
|
|
9088
|
+
/* @__PURE__ */ jsx34("span", { className: cn("transition-all duration-300 text-muted-foreground group-hover:text-foreground", isOpen && "rotate-180 text-primary"), children: /* @__PURE__ */ jsx34("svg", { className: cn(sizeStyles8[size].navIcon), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ jsx34("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
9089
|
+
]
|
|
9090
|
+
}
|
|
9091
|
+
),
|
|
9092
|
+
children: panel
|
|
9093
|
+
}
|
|
9094
|
+
),
|
|
9095
|
+
effectiveError && /* @__PURE__ */ jsx34("div", { className: "text-xs text-destructive", children: effectiveError })
|
|
9096
|
+
] });
|
|
8886
9097
|
};
|
|
8887
9098
|
var CompactDatePicker = ({ value, onChange, className }) => {
|
|
8888
9099
|
return /* @__PURE__ */ jsx34(
|