@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/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -8753,10 +8753,27 @@ var DatePicker = ({
|
|
|
8753
8753
|
effectiveError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-xs text-destructive", children: effectiveError })
|
|
8754
8754
|
] });
|
|
8755
8755
|
};
|
|
8756
|
-
var DateRangePicker = ({
|
|
8756
|
+
var DateRangePicker = ({
|
|
8757
|
+
id,
|
|
8758
|
+
startDate,
|
|
8759
|
+
endDate,
|
|
8760
|
+
onChange,
|
|
8761
|
+
placeholder = "Select date range...",
|
|
8762
|
+
className,
|
|
8763
|
+
label,
|
|
8764
|
+
labelClassName,
|
|
8765
|
+
required = false,
|
|
8766
|
+
disablePastDates = false,
|
|
8767
|
+
minDate,
|
|
8768
|
+
maxDate,
|
|
8769
|
+
size = "md"
|
|
8770
|
+
}) => {
|
|
8757
8771
|
const locale = useSmartLocale();
|
|
8758
8772
|
const t = useSmartTranslations("DatePicker");
|
|
8773
|
+
const tv = useSmartTranslations("ValidationInput");
|
|
8759
8774
|
const [isOpen, setIsOpen] = React28.useState(false);
|
|
8775
|
+
const [viewMode, setViewMode] = React28.useState("calendar");
|
|
8776
|
+
const [localRequiredError, setLocalRequiredError] = React28.useState();
|
|
8760
8777
|
const wheelContainerRef = React28.useRef(null);
|
|
8761
8778
|
const wheelDeltaRef = React28.useRef(0);
|
|
8762
8779
|
const sizeStyles8 = {
|
|
@@ -8828,6 +8845,16 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8828
8845
|
React28.useEffect(() => {
|
|
8829
8846
|
setTempEnd(normalizeToLocal(endDate));
|
|
8830
8847
|
}, [endDate]);
|
|
8848
|
+
React28.useEffect(() => {
|
|
8849
|
+
if (!isOpen) {
|
|
8850
|
+
setViewMode("calendar");
|
|
8851
|
+
}
|
|
8852
|
+
}, [isOpen]);
|
|
8853
|
+
React28.useEffect(() => {
|
|
8854
|
+
if (!required || startDate && endDate) {
|
|
8855
|
+
setLocalRequiredError(void 0);
|
|
8856
|
+
}
|
|
8857
|
+
}, [endDate, required, startDate]);
|
|
8831
8858
|
const isSameDay2 = (a, b) => {
|
|
8832
8859
|
if (!a || !b) return false;
|
|
8833
8860
|
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
@@ -8838,6 +8865,9 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8838
8865
|
const navigateMonth = React28.useCallback((direction) => {
|
|
8839
8866
|
setViewDate((prev) => new Date(prev.getFullYear(), prev.getMonth() + (direction === "next" ? 1 : -1), 1));
|
|
8840
8867
|
}, []);
|
|
8868
|
+
const navigateYearRange = React28.useCallback((direction) => {
|
|
8869
|
+
setViewDate((prev) => new Date(prev.getFullYear() + (direction === "next" ? 12 : -12), prev.getMonth(), 1));
|
|
8870
|
+
}, []);
|
|
8841
8871
|
const isElementVerticallyScrollable = (el) => {
|
|
8842
8872
|
const style = window.getComputedStyle(el);
|
|
8843
8873
|
const overflowY = style.overflowY;
|
|
@@ -8882,11 +8912,33 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8882
8912
|
setTempStart(localDate);
|
|
8883
8913
|
} else {
|
|
8884
8914
|
setTempEnd(localDate);
|
|
8915
|
+
setLocalRequiredError(void 0);
|
|
8885
8916
|
onChange(tempStart, localDate);
|
|
8886
8917
|
setIsOpen(false);
|
|
8887
8918
|
}
|
|
8888
8919
|
}
|
|
8889
8920
|
};
|
|
8921
|
+
const handleSelectToday = () => {
|
|
8922
|
+
const today = /* @__PURE__ */ new Date();
|
|
8923
|
+
today.setHours(0, 0, 0, 0);
|
|
8924
|
+
const localToday = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
8925
|
+
const isPastDate = disablePastDates && localToday < today;
|
|
8926
|
+
const isOutOfRange = !!minDay && localToday < minDay || !!maxDay && localToday > maxDay;
|
|
8927
|
+
if (isPastDate || isOutOfRange) return;
|
|
8928
|
+
setTempStart(localToday);
|
|
8929
|
+
setTempEnd(localToday);
|
|
8930
|
+
setHoveredDate(null);
|
|
8931
|
+
setLocalRequiredError(void 0);
|
|
8932
|
+
onChange(localToday, localToday);
|
|
8933
|
+
setIsOpen(false);
|
|
8934
|
+
};
|
|
8935
|
+
const handleClear = () => {
|
|
8936
|
+
setTempStart(null);
|
|
8937
|
+
setTempEnd(null);
|
|
8938
|
+
setHoveredDate(null);
|
|
8939
|
+
onChange(void 0, void 0);
|
|
8940
|
+
setIsOpen(false);
|
|
8941
|
+
};
|
|
8890
8942
|
const renderGrid = () => {
|
|
8891
8943
|
const nodes = [];
|
|
8892
8944
|
const daysInMonth = getDaysInMonth(viewDate);
|
|
@@ -8955,13 +9007,63 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8955
9007
|
}
|
|
8956
9008
|
return nodes;
|
|
8957
9009
|
};
|
|
9010
|
+
const renderMonthSelector = () => {
|
|
9011
|
+
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"];
|
|
9012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-3 gap-2 p-2", children: months.map((month, idx) => {
|
|
9013
|
+
const isSelected = viewDate.getMonth() === idx;
|
|
9014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9015
|
+
"button",
|
|
9016
|
+
{
|
|
9017
|
+
type: "button",
|
|
9018
|
+
onClick: () => {
|
|
9019
|
+
setViewDate(new Date(viewDate.getFullYear(), idx, 1));
|
|
9020
|
+
setViewMode("calendar");
|
|
9021
|
+
},
|
|
9022
|
+
className: cn(
|
|
9023
|
+
"py-2 px-3 rounded-lg text-sm font-medium transition-all duration-200",
|
|
9024
|
+
isSelected ? "bg-primary text-primary-foreground shadow-md" : "hover:bg-accent/80 text-foreground hover:scale-105"
|
|
9025
|
+
),
|
|
9026
|
+
children: month
|
|
9027
|
+
},
|
|
9028
|
+
month
|
|
9029
|
+
);
|
|
9030
|
+
}) });
|
|
9031
|
+
};
|
|
9032
|
+
const renderYearSelector = () => {
|
|
9033
|
+
const startYear = Math.floor(viewDate.getFullYear() / 12) * 12;
|
|
9034
|
+
const years = Array.from({ length: 12 }, (_, i) => startYear + i);
|
|
9035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-3 gap-2 p-2", children: years.map((year) => {
|
|
9036
|
+
const isSelected = viewDate.getFullYear() === year;
|
|
9037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9038
|
+
"button",
|
|
9039
|
+
{
|
|
9040
|
+
type: "button",
|
|
9041
|
+
onClick: () => {
|
|
9042
|
+
setViewDate(new Date(year, viewDate.getMonth(), 1));
|
|
9043
|
+
setViewMode("month");
|
|
9044
|
+
},
|
|
9045
|
+
className: cn(
|
|
9046
|
+
"py-2 px-3 rounded-lg text-sm font-medium transition-all duration-200",
|
|
9047
|
+
isSelected ? "bg-primary text-primary-foreground shadow-md" : "hover:bg-accent/80 text-foreground hover:scale-105"
|
|
9048
|
+
),
|
|
9049
|
+
children: year
|
|
9050
|
+
},
|
|
9051
|
+
year
|
|
9052
|
+
);
|
|
9053
|
+
}) });
|
|
9054
|
+
};
|
|
9055
|
+
const todayDate = React28.useMemo(() => {
|
|
9056
|
+
const today = /* @__PURE__ */ new Date();
|
|
9057
|
+
return new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
|
9058
|
+
}, []);
|
|
9059
|
+
const isTodayUnavailable = !!minDay && todayDate < minDay || !!maxDay && todayDate > maxDay;
|
|
8958
9060
|
const panel = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref: wheelContainerRef, className: "w-full", children: [
|
|
8959
9061
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("flex items-center justify-between px-1", sizeStyles8[size].headerMargin), children: [
|
|
8960
9062
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8961
9063
|
"button",
|
|
8962
9064
|
{
|
|
8963
9065
|
type: "button",
|
|
8964
|
-
onClick: () => navigateMonth("prev"),
|
|
9066
|
+
onClick: () => viewMode === "year" ? navigateYearRange("prev") : navigateMonth("prev"),
|
|
8965
9067
|
className: cn(
|
|
8966
9068
|
"rounded-xl transition-all duration-200",
|
|
8967
9069
|
sizeStyles8[size].navButton,
|
|
@@ -8972,15 +9074,39 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8972
9074
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react15.ChevronLeft, { className: sizeStyles8[size].navIcon })
|
|
8973
9075
|
}
|
|
8974
9076
|
),
|
|
8975
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex
|
|
8976
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8977
|
-
|
|
9077
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
9078
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9079
|
+
"button",
|
|
9080
|
+
{
|
|
9081
|
+
type: "button",
|
|
9082
|
+
onClick: () => setViewMode(viewMode === "month" ? "calendar" : "month"),
|
|
9083
|
+
className: cn(
|
|
9084
|
+
"rounded-lg px-2 py-0.5 font-bold transition-colors duration-200",
|
|
9085
|
+
size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm",
|
|
9086
|
+
viewMode === "month" ? "bg-primary/15 text-primary" : "text-foreground hover:bg-accent/50"
|
|
9087
|
+
),
|
|
9088
|
+
children: viewDate.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", { month: "long" })
|
|
9089
|
+
}
|
|
9090
|
+
),
|
|
9091
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9092
|
+
"button",
|
|
9093
|
+
{
|
|
9094
|
+
type: "button",
|
|
9095
|
+
onClick: () => setViewMode(viewMode === "year" ? "calendar" : "year"),
|
|
9096
|
+
className: cn(
|
|
9097
|
+
"rounded-lg px-2 py-0.5 font-medium transition-colors duration-200",
|
|
9098
|
+
size === "sm" ? "text-[10px]" : size === "lg" ? "text-sm" : "text-xs",
|
|
9099
|
+
viewMode === "year" ? "bg-primary/15 text-primary" : "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
|
|
9100
|
+
),
|
|
9101
|
+
children: viewDate.getFullYear()
|
|
9102
|
+
}
|
|
9103
|
+
)
|
|
8978
9104
|
] }),
|
|
8979
9105
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8980
9106
|
"button",
|
|
8981
9107
|
{
|
|
8982
9108
|
type: "button",
|
|
8983
|
-
onClick: () => navigateMonth("next"),
|
|
9109
|
+
onClick: () => viewMode === "year" ? navigateYearRange("next") : navigateMonth("next"),
|
|
8984
9110
|
className: cn(
|
|
8985
9111
|
"rounded-xl transition-all duration-200",
|
|
8986
9112
|
sizeStyles8[size].navButton,
|
|
@@ -8992,82 +9118,167 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
8992
9118
|
}
|
|
8993
9119
|
)
|
|
8994
9120
|
] }),
|
|
8995
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.
|
|
8996
|
-
"div",
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
open: isOpen,
|
|
9015
|
-
onOpenChange: setIsOpen,
|
|
9016
|
-
placement: "bottom-start",
|
|
9017
|
-
contentWidth: size === "sm" ? 240 : 280,
|
|
9018
|
-
contentClassName: cn(
|
|
9019
|
-
"p-0",
|
|
9020
|
-
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
9021
|
-
"rounded-2xl md:rounded-3xl",
|
|
9022
|
-
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
9023
|
-
size === "sm" ? "p-3" : "p-5",
|
|
9024
|
-
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
9025
|
-
),
|
|
9026
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9121
|
+
viewMode === "calendar" && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
9122
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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__ */ (0, import_jsx_runtime34.jsx)(
|
|
9123
|
+
"div",
|
|
9124
|
+
{
|
|
9125
|
+
className: cn(
|
|
9126
|
+
"text-center font-bold uppercase tracking-wide",
|
|
9127
|
+
sizeStyles8[size].weekdayLabel,
|
|
9128
|
+
idx === 0 || idx === 6 ? "text-primary/70" : "text-muted-foreground/60"
|
|
9129
|
+
),
|
|
9130
|
+
children: d
|
|
9131
|
+
},
|
|
9132
|
+
d
|
|
9133
|
+
)) }),
|
|
9134
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "grid grid-cols-7 gap-0.5 p-1 rounded-xl bg-muted/20", children: renderGrid() })
|
|
9135
|
+
] }),
|
|
9136
|
+
viewMode === "month" && renderMonthSelector(),
|
|
9137
|
+
viewMode === "year" && renderYearSelector(),
|
|
9138
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("flex items-center border-t border-border/50", sizeStyles8[size].footerMargin), children: [
|
|
9139
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9027
9140
|
"button",
|
|
9028
9141
|
{
|
|
9029
9142
|
type: "button",
|
|
9143
|
+
onClick: handleSelectToday,
|
|
9144
|
+
disabled: isTodayUnavailable,
|
|
9030
9145
|
className: cn(
|
|
9031
|
-
"
|
|
9032
|
-
|
|
9033
|
-
"
|
|
9034
|
-
"
|
|
9035
|
-
"hover:
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
className
|
|
9146
|
+
"flex-1 font-semibold rounded-xl",
|
|
9147
|
+
"bg-linear-to-r from-primary/10 to-primary/5 border border-primary/30",
|
|
9148
|
+
"text-primary hover:from-primary/20 hover:to-primary/10 hover:border-primary/50",
|
|
9149
|
+
"transition-all duration-300 flex items-center justify-center",
|
|
9150
|
+
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-primary/10",
|
|
9151
|
+
sizeStyles8[size].actionButton,
|
|
9152
|
+
isTodayUnavailable && "opacity-50 cursor-not-allowed hover:scale-100 active:scale-100"
|
|
9039
9153
|
),
|
|
9040
9154
|
children: [
|
|
9041
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.
|
|
9042
|
-
|
|
9043
|
-
"div",
|
|
9044
|
-
{
|
|
9045
|
-
className: cn(
|
|
9046
|
-
"flex items-center justify-center transition-colors duration-300",
|
|
9047
|
-
isOpen ? "text-primary" : "text-muted-foreground group-hover:text-primary"
|
|
9048
|
-
),
|
|
9049
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react15.Calendar, { className: cn("transition-transform duration-300", size === "sm" ? "h-3 w-3" : "h-4 w-4", isOpen && "scale-110") })
|
|
9050
|
-
}
|
|
9051
|
-
),
|
|
9052
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9053
|
-
"span",
|
|
9054
|
-
{
|
|
9055
|
-
className: cn(
|
|
9056
|
-
"truncate font-medium transition-colors duration-200",
|
|
9057
|
-
!tempStart && !tempEnd && "text-muted-foreground",
|
|
9058
|
-
(tempStart || tempEnd) && "text-foreground"
|
|
9059
|
-
),
|
|
9060
|
-
children: label
|
|
9061
|
-
}
|
|
9062
|
-
)
|
|
9063
|
-
] }),
|
|
9064
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: cn("transition-all duration-300 text-muted-foreground group-hover:text-foreground", isOpen && "rotate-180 text-primary"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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__ */ (0, import_jsx_runtime34.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
9155
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react15.Sparkles, { className: sizeStyles8[size].actionIcon }),
|
|
9156
|
+
t("today")
|
|
9065
9157
|
]
|
|
9066
9158
|
}
|
|
9067
9159
|
),
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9160
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9161
|
+
"button",
|
|
9162
|
+
{
|
|
9163
|
+
type: "button",
|
|
9164
|
+
onClick: handleClear,
|
|
9165
|
+
className: cn(
|
|
9166
|
+
"flex-1 font-semibold rounded-xl",
|
|
9167
|
+
"bg-linear-to-r from-destructive/10 to-destructive/5 border border-destructive/30",
|
|
9168
|
+
"text-destructive hover:from-destructive/20 hover:to-destructive/10 hover:border-destructive/50",
|
|
9169
|
+
"transition-all duration-300 flex items-center justify-center",
|
|
9170
|
+
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-destructive/10",
|
|
9171
|
+
sizeStyles8[size].actionButton
|
|
9172
|
+
),
|
|
9173
|
+
children: [
|
|
9174
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react15.X, { className: sizeStyles8[size].actionIcon }),
|
|
9175
|
+
t("clear")
|
|
9176
|
+
]
|
|
9177
|
+
}
|
|
9178
|
+
)
|
|
9179
|
+
] })
|
|
9180
|
+
] });
|
|
9181
|
+
const displayFormat = (date) => formatDateShort(date);
|
|
9182
|
+
const displayLabel = tempStart && tempEnd ? `${displayFormat(tempStart)} - ${displayFormat(tempEnd)}` : tempStart ? `${displayFormat(tempStart)} - ...` : placeholder;
|
|
9183
|
+
const effectiveError = localRequiredError;
|
|
9184
|
+
const autoId = (0, import_react19.useId)();
|
|
9185
|
+
const resolvedId = id ? String(id) : `daterangepicker-${autoId}`;
|
|
9186
|
+
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
9187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("space-y-1.5", className), children: [
|
|
9188
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9189
|
+
"label",
|
|
9190
|
+
{
|
|
9191
|
+
id: labelId,
|
|
9192
|
+
htmlFor: resolvedId,
|
|
9193
|
+
className: cn(size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm", "font-medium text-foreground", effectiveError && "text-destructive", labelClassName),
|
|
9194
|
+
children: [
|
|
9195
|
+
label,
|
|
9196
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
9197
|
+
]
|
|
9198
|
+
}
|
|
9199
|
+
),
|
|
9200
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9201
|
+
"input",
|
|
9202
|
+
{
|
|
9203
|
+
tabIndex: -1,
|
|
9204
|
+
"aria-hidden": "true",
|
|
9205
|
+
value: startDate && endDate ? "selected" : "",
|
|
9206
|
+
onChange: () => {
|
|
9207
|
+
},
|
|
9208
|
+
required,
|
|
9209
|
+
onInvalid: (e) => {
|
|
9210
|
+
e.preventDefault();
|
|
9211
|
+
setLocalRequiredError(tv("required"));
|
|
9212
|
+
},
|
|
9213
|
+
className: "pointer-events-none absolute h-0 w-0 opacity-0"
|
|
9214
|
+
}
|
|
9215
|
+
),
|
|
9216
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9217
|
+
Popover,
|
|
9218
|
+
{
|
|
9219
|
+
open: isOpen,
|
|
9220
|
+
onOpenChange: setIsOpen,
|
|
9221
|
+
placement: "bottom-start",
|
|
9222
|
+
contentWidth: sizeStyles8[size].contentWidth,
|
|
9223
|
+
contentClassName: cn(
|
|
9224
|
+
"p-0",
|
|
9225
|
+
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
9226
|
+
"rounded-2xl md:rounded-3xl",
|
|
9227
|
+
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
9228
|
+
sizeStyles8[size].contentPadding,
|
|
9229
|
+
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
9230
|
+
),
|
|
9231
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9232
|
+
"button",
|
|
9233
|
+
{
|
|
9234
|
+
id: resolvedId,
|
|
9235
|
+
type: "button",
|
|
9236
|
+
"aria-labelledby": labelId,
|
|
9237
|
+
"aria-required": required,
|
|
9238
|
+
"aria-invalid": !!effectiveError,
|
|
9239
|
+
className: cn(
|
|
9240
|
+
"group flex w-full items-center justify-between rounded-full border bg-background/80 backdrop-blur-sm",
|
|
9241
|
+
sizeStyles8[size].trigger,
|
|
9242
|
+
"border-border/60 hover:border-primary/40",
|
|
9243
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
9244
|
+
"hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
|
|
9245
|
+
"transition-all duration-300 ease-out",
|
|
9246
|
+
isOpen && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
|
|
9247
|
+
effectiveError && "border-destructive/60 focus-visible:ring-destructive/50 bg-destructive/5"
|
|
9248
|
+
),
|
|
9249
|
+
children: [
|
|
9250
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("flex items-center", size === "sm" ? "gap-1.5" : "gap-2.5"), children: [
|
|
9251
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9252
|
+
"div",
|
|
9253
|
+
{
|
|
9254
|
+
className: cn(
|
|
9255
|
+
"flex items-center justify-center transition-colors duration-300",
|
|
9256
|
+
effectiveError ? "text-destructive" : isOpen ? "text-primary" : "text-muted-foreground group-hover:text-primary"
|
|
9257
|
+
),
|
|
9258
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react15.Calendar, { className: cn("transition-transform duration-300", sizeStyles8[size].calendarIcon, isOpen && "scale-110") })
|
|
9259
|
+
}
|
|
9260
|
+
),
|
|
9261
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9262
|
+
"span",
|
|
9263
|
+
{
|
|
9264
|
+
className: cn(
|
|
9265
|
+
"truncate font-medium transition-colors duration-200",
|
|
9266
|
+
!tempStart && !tempEnd && "text-muted-foreground",
|
|
9267
|
+
(tempStart || tempEnd) && "text-foreground"
|
|
9268
|
+
),
|
|
9269
|
+
children: displayLabel
|
|
9270
|
+
}
|
|
9271
|
+
)
|
|
9272
|
+
] }),
|
|
9273
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: cn("transition-all duration-300 text-muted-foreground group-hover:text-foreground", isOpen && "rotate-180 text-primary"), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { className: cn(sizeStyles8[size].navIcon), fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
9274
|
+
]
|
|
9275
|
+
}
|
|
9276
|
+
),
|
|
9277
|
+
children: panel
|
|
9278
|
+
}
|
|
9279
|
+
),
|
|
9280
|
+
effectiveError && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-xs text-destructive", children: effectiveError })
|
|
9281
|
+
] });
|
|
9071
9282
|
};
|
|
9072
9283
|
var CompactDatePicker = ({ value, onChange, className }) => {
|
|
9073
9284
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|