@underverse-ui/underverse 0.2.61 → 0.2.63
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 +168 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +205 -111
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -205,8 +205,8 @@ var VARIANT_STYLES_BTN = {
|
|
|
205
205
|
ghost: "bg-transparent hover:bg-accent/20 hover:text-accent-foreground backdrop-blur-sm transition-colors",
|
|
206
206
|
// Link: chỉ văn bản
|
|
207
207
|
link: "text-primary bg-transparent underline-offset-4 hover:underline hover:text-primary/85 transition-colors",
|
|
208
|
-
// Gradient:
|
|
209
|
-
gradient: "bg-linear-to-r from-primary via-
|
|
208
|
+
// Gradient: smooth gradient từ primary → secondary (cùng tone)
|
|
209
|
+
gradient: "bg-linear-to-r from-primary via-primary/80 to-secondary text-primary-foreground hover:opacity-90 shadow-md border-0"
|
|
210
210
|
};
|
|
211
211
|
var SIZE_STYLES_BTN = {
|
|
212
212
|
sm: "px-3 py-1.5 text-sm h-8 min-w-8 md:px-2.5 md:py-1 md:h-7 md:text-xs",
|
|
@@ -5740,6 +5740,7 @@ var DatePicker = ({
|
|
|
5740
5740
|
const locale = useLocale();
|
|
5741
5741
|
const [isOpen, setIsOpen] = React23.useState(false);
|
|
5742
5742
|
const [viewDate, setViewDate] = React23.useState(value || /* @__PURE__ */ new Date());
|
|
5743
|
+
const [viewMode, setViewMode] = React23.useState("calendar");
|
|
5743
5744
|
const triggerRef = React23.useRef(null);
|
|
5744
5745
|
const wheelContainerRef = React23.useRef(null);
|
|
5745
5746
|
const wheelDeltaRef = React23.useRef(0);
|
|
@@ -5751,6 +5752,11 @@ var DatePicker = ({
|
|
|
5751
5752
|
setViewDate(/* @__PURE__ */ new Date());
|
|
5752
5753
|
}
|
|
5753
5754
|
}, [value]);
|
|
5755
|
+
React23.useEffect(() => {
|
|
5756
|
+
if (!isOpen) {
|
|
5757
|
+
setViewMode("calendar");
|
|
5758
|
+
}
|
|
5759
|
+
}, [isOpen]);
|
|
5754
5760
|
const handleDateSelect = (date) => {
|
|
5755
5761
|
let selectedDate;
|
|
5756
5762
|
if (value && (value.getHours() !== 0 || value.getMinutes() !== 0 || value.getSeconds() !== 0)) {
|
|
@@ -5859,13 +5865,64 @@ var DatePicker = ({
|
|
|
5859
5865
|
}
|
|
5860
5866
|
return days;
|
|
5861
5867
|
};
|
|
5868
|
+
const renderMonthSelector = () => {
|
|
5869
|
+
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"];
|
|
5870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-3 gap-2 p-2", children: months.map((month, idx) => {
|
|
5871
|
+
const isSelected = viewDate.getMonth() === idx;
|
|
5872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5873
|
+
"button",
|
|
5874
|
+
{
|
|
5875
|
+
type: "button",
|
|
5876
|
+
onClick: () => {
|
|
5877
|
+
setViewDate(new Date(viewDate.getFullYear(), idx, 1));
|
|
5878
|
+
setViewMode("calendar");
|
|
5879
|
+
},
|
|
5880
|
+
className: cn(
|
|
5881
|
+
"py-2 px-3 rounded-lg text-sm font-medium transition-all duration-200",
|
|
5882
|
+
isSelected ? "bg-primary text-primary-foreground shadow-md" : "hover:bg-accent/80 text-foreground hover:scale-105"
|
|
5883
|
+
),
|
|
5884
|
+
children: month
|
|
5885
|
+
},
|
|
5886
|
+
month
|
|
5887
|
+
);
|
|
5888
|
+
}) });
|
|
5889
|
+
};
|
|
5890
|
+
const renderYearSelector = () => {
|
|
5891
|
+
const currentYear = viewDate.getFullYear();
|
|
5892
|
+
const startYear = Math.floor(currentYear / 12) * 12;
|
|
5893
|
+
const years = Array.from({ length: 12 }, (_, i) => startYear + i);
|
|
5894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-3 gap-2 p-2", children: years.map((year) => {
|
|
5895
|
+
const isSelected = viewDate.getFullYear() === year;
|
|
5896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5897
|
+
"button",
|
|
5898
|
+
{
|
|
5899
|
+
type: "button",
|
|
5900
|
+
onClick: () => {
|
|
5901
|
+
setViewDate(new Date(year, viewDate.getMonth(), 1));
|
|
5902
|
+
setViewMode("month");
|
|
5903
|
+
},
|
|
5904
|
+
className: cn(
|
|
5905
|
+
"py-2 px-3 rounded-lg text-sm font-medium transition-all duration-200",
|
|
5906
|
+
isSelected ? "bg-primary text-primary-foreground shadow-md" : "hover:bg-accent/80 text-foreground hover:scale-105"
|
|
5907
|
+
),
|
|
5908
|
+
children: year
|
|
5909
|
+
},
|
|
5910
|
+
year
|
|
5911
|
+
);
|
|
5912
|
+
}) });
|
|
5913
|
+
};
|
|
5914
|
+
const navigateYearRange = (direction) => {
|
|
5915
|
+
const currentYear = viewDate.getFullYear();
|
|
5916
|
+
const offset = direction === "next" ? 12 : -12;
|
|
5917
|
+
setViewDate(new Date(currentYear + offset, viewDate.getMonth(), 1));
|
|
5918
|
+
};
|
|
5862
5919
|
const datePickerContent = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref: wheelContainerRef, "data-datepicker": true, className: "w-full", children: [
|
|
5863
5920
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center justify-between mb-4 px-1", children: [
|
|
5864
5921
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5865
5922
|
"button",
|
|
5866
5923
|
{
|
|
5867
5924
|
type: "button",
|
|
5868
|
-
onClick: () => navigateMonth("prev"),
|
|
5925
|
+
onClick: () => viewMode === "year" ? navigateYearRange("prev") : navigateMonth("prev"),
|
|
5869
5926
|
className: cn(
|
|
5870
5927
|
"p-2 rounded-xl transition-all duration-200",
|
|
5871
5928
|
"bg-muted/50 hover:bg-muted text-muted-foreground hover:text-foreground",
|
|
@@ -5875,15 +5932,37 @@ var DatePicker = ({
|
|
|
5875
5932
|
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.ChevronLeft, { className: "h-4 w-4" })
|
|
5876
5933
|
}
|
|
5877
5934
|
),
|
|
5878
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex
|
|
5879
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5880
|
-
|
|
5935
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5937
|
+
"button",
|
|
5938
|
+
{
|
|
5939
|
+
type: "button",
|
|
5940
|
+
onClick: () => setViewMode(viewMode === "month" ? "calendar" : "month"),
|
|
5941
|
+
className: cn(
|
|
5942
|
+
"text-sm font-bold transition-all duration-200 px-2 py-1 rounded-lg",
|
|
5943
|
+
viewMode === "month" ? "bg-primary/15 text-primary" : "text-foreground hover:bg-accent/50"
|
|
5944
|
+
),
|
|
5945
|
+
children: viewDate.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", { month: "long" })
|
|
5946
|
+
}
|
|
5947
|
+
),
|
|
5948
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5949
|
+
"button",
|
|
5950
|
+
{
|
|
5951
|
+
type: "button",
|
|
5952
|
+
onClick: () => setViewMode(viewMode === "year" ? "calendar" : "year"),
|
|
5953
|
+
className: cn(
|
|
5954
|
+
"text-sm font-bold transition-all duration-200 px-2 py-1 rounded-lg",
|
|
5955
|
+
viewMode === "year" ? "bg-primary/15 text-primary" : "text-foreground hover:bg-accent/50"
|
|
5956
|
+
),
|
|
5957
|
+
children: viewDate.getFullYear()
|
|
5958
|
+
}
|
|
5959
|
+
)
|
|
5881
5960
|
] }),
|
|
5882
5961
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5883
5962
|
"button",
|
|
5884
5963
|
{
|
|
5885
5964
|
type: "button",
|
|
5886
|
-
onClick: () => navigateMonth("next"),
|
|
5965
|
+
onClick: () => viewMode === "year" ? navigateYearRange("next") : navigateMonth("next"),
|
|
5887
5966
|
className: cn(
|
|
5888
5967
|
"p-2 rounded-xl transition-all duration-200",
|
|
5889
5968
|
"bg-muted/50 hover:bg-muted text-muted-foreground hover:text-foreground",
|
|
@@ -5894,22 +5973,26 @@ var DatePicker = ({
|
|
|
5894
5973
|
}
|
|
5895
5974
|
)
|
|
5896
5975
|
] }),
|
|
5897
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5976
|
+
viewMode === "calendar" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
5977
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("grid grid-cols-7 gap-1 mb-2 px-0.5"), children: (weekdayLabels || (locale === "vi" ? ["CN", "T2", "T3", "T4", "T5", "T6", "T7"] : ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"])).map(
|
|
5978
|
+
(day, idx) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
5979
|
+
"div",
|
|
5980
|
+
{
|
|
5981
|
+
className: cn(
|
|
5982
|
+
"text-center font-bold uppercase tracking-wide",
|
|
5983
|
+
size === "sm" ? "text-[9px] py-1" : "text-[10px] py-1.5",
|
|
5984
|
+
idx === 0 || idx === 6 ? "text-primary/70" : "text-muted-foreground/60"
|
|
5985
|
+
),
|
|
5986
|
+
children: day
|
|
5987
|
+
},
|
|
5988
|
+
day
|
|
5989
|
+
)
|
|
5990
|
+
) }),
|
|
5991
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-7 gap-1 p-1 rounded-xl bg-muted/20", children: renderCalendar() })
|
|
5992
|
+
] }),
|
|
5993
|
+
viewMode === "month" && renderMonthSelector(),
|
|
5994
|
+
viewMode === "year" && renderYearSelector(),
|
|
5995
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn("flex items-center gap-2 mt-4 pt-3 border-t border-border/50", size === "sm" && "mt-3 pt-2 gap-1.5"), children: [
|
|
5913
5996
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5914
5997
|
"button",
|
|
5915
5998
|
{
|
|
@@ -5919,14 +6002,15 @@ var DatePicker = ({
|
|
|
5919
6002
|
handleDateSelect(today);
|
|
5920
6003
|
},
|
|
5921
6004
|
className: cn(
|
|
5922
|
-
"flex-1
|
|
6005
|
+
"flex-1 font-semibold rounded-xl",
|
|
5923
6006
|
"bg-linear-to-r from-primary/10 to-primary/5 border border-primary/30",
|
|
5924
6007
|
"text-primary hover:from-primary/20 hover:to-primary/10 hover:border-primary/50",
|
|
5925
|
-
"transition-all duration-300 flex items-center justify-center
|
|
5926
|
-
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-primary/10"
|
|
6008
|
+
"transition-all duration-300 flex items-center justify-center",
|
|
6009
|
+
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-primary/10",
|
|
6010
|
+
size === "sm" ? "px-2 py-1 text-[10px] gap-1" : "px-3 py-2 text-xs gap-2"
|
|
5927
6011
|
),
|
|
5928
6012
|
children: [
|
|
5929
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Sparkles, { className: "w-3.5 h-3.5" }),
|
|
6013
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Sparkles, { className: size === "sm" ? "w-2.5 h-2.5" : "w-3.5 h-3.5" }),
|
|
5930
6014
|
todayLabel || t("today")
|
|
5931
6015
|
]
|
|
5932
6016
|
}
|
|
@@ -5941,14 +6025,15 @@ var DatePicker = ({
|
|
|
5941
6025
|
setViewDate(/* @__PURE__ */ new Date());
|
|
5942
6026
|
},
|
|
5943
6027
|
className: cn(
|
|
5944
|
-
"flex-1
|
|
6028
|
+
"flex-1 font-semibold rounded-xl",
|
|
5945
6029
|
"bg-linear-to-r from-destructive/10 to-destructive/5 border border-destructive/30",
|
|
5946
6030
|
"text-destructive hover:from-destructive/20 hover:to-destructive/10 hover:border-destructive/50",
|
|
5947
|
-
"transition-all duration-300 flex items-center justify-center
|
|
5948
|
-
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-destructive/10"
|
|
6031
|
+
"transition-all duration-300 flex items-center justify-center",
|
|
6032
|
+
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-destructive/10",
|
|
6033
|
+
size === "sm" ? "px-2 py-1 text-[10px] gap-1" : "px-3 py-2 text-xs gap-2"
|
|
5949
6034
|
),
|
|
5950
6035
|
children: [
|
|
5951
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.X, { className: "w-3.5 h-3.5" }),
|
|
6036
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.X, { className: size === "sm" ? "w-2.5 h-2.5" : "w-3.5 h-3.5" }),
|
|
5952
6037
|
clearLabel || t("clear")
|
|
5953
6038
|
]
|
|
5954
6039
|
}
|
|
@@ -6081,20 +6166,25 @@ var DatePicker = ({
|
|
|
6081
6166
|
)
|
|
6082
6167
|
] });
|
|
6083
6168
|
};
|
|
6084
|
-
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false }) => {
|
|
6169
|
+
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false, size = "md" }) => {
|
|
6085
6170
|
const locale = useLocale();
|
|
6171
|
+
const t = useTranslations("DatePicker");
|
|
6086
6172
|
const [isOpen, setIsOpen] = React23.useState(false);
|
|
6087
6173
|
const wheelContainerRef = React23.useRef(null);
|
|
6088
6174
|
const wheelDeltaRef = React23.useRef(0);
|
|
6175
|
+
const normalizeToLocal = (date) => {
|
|
6176
|
+
if (!date) return null;
|
|
6177
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
6178
|
+
};
|
|
6089
6179
|
const [viewDate, setViewDate] = React23.useState(startDate || /* @__PURE__ */ new Date());
|
|
6090
|
-
const [tempStart, setTempStart] = React23.useState(startDate
|
|
6091
|
-
const [tempEnd, setTempEnd] = React23.useState(endDate
|
|
6180
|
+
const [tempStart, setTempStart] = React23.useState(normalizeToLocal(startDate));
|
|
6181
|
+
const [tempEnd, setTempEnd] = React23.useState(normalizeToLocal(endDate));
|
|
6092
6182
|
const [hoveredDate, setHoveredDate] = React23.useState(null);
|
|
6093
6183
|
React23.useEffect(() => {
|
|
6094
|
-
setTempStart(startDate
|
|
6184
|
+
setTempStart(normalizeToLocal(startDate));
|
|
6095
6185
|
}, [startDate]);
|
|
6096
6186
|
React23.useEffect(() => {
|
|
6097
|
-
setTempEnd(endDate
|
|
6187
|
+
setTempEnd(normalizeToLocal(endDate));
|
|
6098
6188
|
}, [endDate]);
|
|
6099
6189
|
const isSameDay2 = (a, b) => {
|
|
6100
6190
|
if (!a || !b) return false;
|
|
@@ -6195,7 +6285,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6195
6285
|
onMouseEnter: () => !isPastDate && tempStart && !tempEnd && setHoveredDate(date),
|
|
6196
6286
|
onMouseLeave: () => tempStart && !tempEnd && setHoveredDate(null),
|
|
6197
6287
|
className: cn(
|
|
6198
|
-
"
|
|
6288
|
+
"transition-all duration-200 focus:outline-none relative font-medium",
|
|
6289
|
+
size === "sm" ? "w-6 h-6 text-xs" : "w-8 h-8 text-sm",
|
|
6199
6290
|
// Disabled/past date state
|
|
6200
6291
|
isPastDate && "opacity-30 cursor-not-allowed text-muted-foreground",
|
|
6201
6292
|
// Default state
|
|
@@ -6221,24 +6312,25 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6221
6312
|
return nodes;
|
|
6222
6313
|
};
|
|
6223
6314
|
const panel = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref: wheelContainerRef, className: "w-full", children: [
|
|
6224
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center justify-between mb-
|
|
6315
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn("flex items-center justify-between px-1", size === "sm" ? "mb-2" : "mb-4"), children: [
|
|
6225
6316
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6226
6317
|
"button",
|
|
6227
6318
|
{
|
|
6228
6319
|
type: "button",
|
|
6229
6320
|
onClick: () => navigateMonth("prev"),
|
|
6230
6321
|
className: cn(
|
|
6231
|
-
"
|
|
6322
|
+
"rounded-xl transition-all duration-200",
|
|
6323
|
+
size === "sm" ? "p-1.5" : "p-2",
|
|
6232
6324
|
"bg-muted/50 hover:bg-muted text-muted-foreground hover:text-foreground",
|
|
6233
6325
|
"hover:scale-110 active:scale-95 hover:shadow-md",
|
|
6234
6326
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50"
|
|
6235
6327
|
),
|
|
6236
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.ChevronLeft, { className: "h-4 w-4" })
|
|
6328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.ChevronLeft, { className: cn(size === "sm" ? "h-3 w-3" : "h-4 w-4") })
|
|
6237
6329
|
}
|
|
6238
6330
|
),
|
|
6239
6331
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
6240
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-sm
|
|
6241
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-
|
|
6332
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: cn("font-bold text-foreground", size === "sm" ? "text-xs" : "text-sm"), children: viewDate.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", { month: "long" }) }),
|
|
6333
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: cn("text-muted-foreground font-medium", size === "sm" ? "text-[10px]" : "text-xs"), children: viewDate.getFullYear() })
|
|
6242
6334
|
] }),
|
|
6243
6335
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6244
6336
|
"button",
|
|
@@ -6246,20 +6338,22 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6246
6338
|
type: "button",
|
|
6247
6339
|
onClick: () => navigateMonth("next"),
|
|
6248
6340
|
className: cn(
|
|
6249
|
-
"
|
|
6341
|
+
"rounded-xl transition-all duration-200",
|
|
6342
|
+
size === "sm" ? "p-1.5" : "p-2",
|
|
6250
6343
|
"bg-muted/50 hover:bg-muted text-muted-foreground hover:text-foreground",
|
|
6251
6344
|
"hover:scale-110 active:scale-95 hover:shadow-md",
|
|
6252
6345
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50"
|
|
6253
6346
|
),
|
|
6254
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.ChevronRight, { className: "h-4 w-4" })
|
|
6347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.ChevronRight, { className: cn(size === "sm" ? "h-3 w-3" : "h-4 w-4") })
|
|
6255
6348
|
}
|
|
6256
6349
|
)
|
|
6257
6350
|
] }),
|
|
6258
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grid grid-cols-7 gap-1
|
|
6351
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("grid grid-cols-7 gap-1 px-0.5", size === "sm" ? "mb-1" : "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_runtime29.jsx)(
|
|
6259
6352
|
"div",
|
|
6260
6353
|
{
|
|
6261
6354
|
className: cn(
|
|
6262
|
-
"text-
|
|
6355
|
+
"text-center font-bold uppercase tracking-wide",
|
|
6356
|
+
size === "sm" ? "text-[8px] py-1" : "text-[10px] py-1.5",
|
|
6263
6357
|
idx === 0 || idx === 6 ? "text-primary/70" : "text-muted-foreground/60"
|
|
6264
6358
|
),
|
|
6265
6359
|
children: d
|
|
@@ -6276,13 +6370,13 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6276
6370
|
open: isOpen,
|
|
6277
6371
|
onOpenChange: setIsOpen,
|
|
6278
6372
|
placement: "bottom-start",
|
|
6279
|
-
contentWidth: 280,
|
|
6373
|
+
contentWidth: size === "sm" ? 240 : 280,
|
|
6280
6374
|
contentClassName: cn(
|
|
6281
6375
|
"p-0",
|
|
6282
6376
|
"backdrop-blur-xl bg-popover/95 border-border/40 shadow-2xl",
|
|
6283
6377
|
"rounded-2xl",
|
|
6284
6378
|
"max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto overscroll-contain",
|
|
6285
|
-
"p-5",
|
|
6379
|
+
size === "sm" ? "p-3" : "p-5",
|
|
6286
6380
|
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
6287
6381
|
),
|
|
6288
6382
|
trigger: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
@@ -6290,7 +6384,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6290
6384
|
{
|
|
6291
6385
|
type: "button",
|
|
6292
6386
|
className: cn(
|
|
6293
|
-
"group flex w-full items-center justify-between rounded-full border bg-background/80 backdrop-blur-sm
|
|
6387
|
+
"group flex w-full items-center justify-between rounded-full border bg-background/80 backdrop-blur-sm",
|
|
6388
|
+
size === "sm" ? "px-2 py-1.5 text-xs" : "px-3 py-2.5 text-sm",
|
|
6294
6389
|
"border-border/60 hover:border-primary/40",
|
|
6295
6390
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
6296
6391
|
"hover:bg-accent/10 hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
|
|
@@ -6299,15 +6394,16 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6299
6394
|
className
|
|
6300
6395
|
),
|
|
6301
6396
|
children: [
|
|
6302
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
6397
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn("flex items-center", size === "sm" ? "gap-1.5" : "gap-2.5"), children: [
|
|
6303
6398
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6304
6399
|
"div",
|
|
6305
6400
|
{
|
|
6306
6401
|
className: cn(
|
|
6307
|
-
"flex items-center justify-center rounded-lg
|
|
6402
|
+
"flex items-center justify-center rounded-lg transition-all duration-300",
|
|
6403
|
+
size === "sm" ? "p-1" : "p-1.5",
|
|
6308
6404
|
isOpen ? "bg-primary/15 text-primary" : "bg-muted/50 text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary"
|
|
6309
6405
|
),
|
|
6310
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Calendar, { className: cn("h-
|
|
6406
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react14.Calendar, { className: cn("transition-transform duration-300", size === "sm" ? "h-3 w-3" : "h-4 w-4", isOpen && "scale-110") })
|
|
6311
6407
|
}
|
|
6312
6408
|
),
|
|
6313
6409
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -6322,7 +6418,7 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6322
6418
|
}
|
|
6323
6419
|
)
|
|
6324
6420
|
] }),
|
|
6325
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsx)("svg", { className: "h-4 w-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2.5, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
6421
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.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_runtime29.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) }) })
|
|
6326
6422
|
]
|
|
6327
6423
|
}
|
|
6328
6424
|
),
|
|
@@ -6860,8 +6956,8 @@ function TimePicker({
|
|
|
6860
6956
|
required,
|
|
6861
6957
|
format = "24",
|
|
6862
6958
|
includeSeconds = false,
|
|
6863
|
-
minuteStep =
|
|
6864
|
-
secondStep =
|
|
6959
|
+
minuteStep = 1,
|
|
6960
|
+
secondStep = 1,
|
|
6865
6961
|
clearable = true,
|
|
6866
6962
|
variant = "default",
|
|
6867
6963
|
showNow = false,
|
|
@@ -7040,7 +7136,6 @@ function TimePicker({
|
|
|
7040
7136
|
lg: { label: "text-base", height: "h-12", padding: "px-4 py-3", text: "text-base", icon: "w-5 h-5" }
|
|
7041
7137
|
};
|
|
7042
7138
|
const sz = sizeClasses2[size];
|
|
7043
|
-
const radiusClass = size === "sm" ? "rounded-md" : "rounded-lg";
|
|
7044
7139
|
const display = formatTime(parts, format, includeSeconds);
|
|
7045
7140
|
const trigger = variant === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
7046
7141
|
"button",
|
|
@@ -7051,16 +7146,15 @@ function TimePicker({
|
|
|
7051
7146
|
"aria-haspopup": "dialog",
|
|
7052
7147
|
"aria-expanded": open,
|
|
7053
7148
|
className: cn(
|
|
7054
|
-
"group flex w-full items-center justify-between border bg-background/80 backdrop-blur-sm",
|
|
7149
|
+
"group flex w-full items-center justify-between rounded-full border bg-background/80 backdrop-blur-sm",
|
|
7055
7150
|
sz.height,
|
|
7056
7151
|
sz.padding,
|
|
7057
7152
|
sz.text,
|
|
7058
|
-
radiusClass,
|
|
7059
7153
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
7060
7154
|
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
7061
7155
|
"transition-all duration-300 ease-out",
|
|
7062
7156
|
error && "border-destructive/60 focus-visible:ring-destructive/50 bg-destructive/5",
|
|
7063
|
-
success && "border-
|
|
7157
|
+
success && "border-success/60 focus-visible:ring-success/50 bg-success/5",
|
|
7064
7158
|
!error && !success && "border-border/60 hover:border-primary/40 hover:bg-accent/10",
|
|
7065
7159
|
animate && !disabled && "hover:shadow-lg hover:shadow-primary/5 hover:-translate-y-0.5",
|
|
7066
7160
|
open && "ring-2 ring-primary/30 border-primary/50 shadow-lg shadow-primary/10",
|
|
@@ -7073,7 +7167,7 @@ function TimePicker({
|
|
|
7073
7167
|
{
|
|
7074
7168
|
className: cn(
|
|
7075
7169
|
"flex items-center justify-center rounded-md p-1.5 transition-all duration-300",
|
|
7076
|
-
error ? "bg-destructive/10 text-destructive" : success ? "bg-
|
|
7170
|
+
error ? "bg-destructive/10 text-destructive" : success ? "bg-success/10 text-success" : open ? "bg-primary/15 text-primary" : "bg-muted/50 text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary"
|
|
7077
7171
|
),
|
|
7078
7172
|
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Clock, { className: cn(sz.icon, "transition-transform duration-300", open && "rotate-12") })
|
|
7079
7173
|
}
|
|
@@ -7378,7 +7472,7 @@ function TimePicker({
|
|
|
7378
7472
|
contentClassName: cn(
|
|
7379
7473
|
"p-5 rounded-2xl border bg-popover/95 backdrop-blur-xl shadow-2xl",
|
|
7380
7474
|
error && "border-destructive/40",
|
|
7381
|
-
success && "border-
|
|
7475
|
+
success && "border-success/40",
|
|
7382
7476
|
!error && !success && "border-border/60",
|
|
7383
7477
|
animate && "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"
|
|
7384
7478
|
),
|
|
@@ -7390,7 +7484,7 @@ function TimePicker({
|
|
|
7390
7484
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.X, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
7391
7485
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-medium", children: error })
|
|
7392
7486
|
] }),
|
|
7393
|
-
success && !error && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 text-
|
|
7487
|
+
success && !error && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-2 text-success bg-success/10 px-3 py-1.5 rounded-lg", children: [
|
|
7394
7488
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_lucide_react16.Check, { className: "w-3.5 h-3.5 shrink-0" }),
|
|
7395
7489
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "font-medium", children: "Valid time selected" })
|
|
7396
7490
|
] }),
|
|
@@ -9973,10 +10067,10 @@ var SIZE_STYLES2 = {
|
|
|
9973
10067
|
};
|
|
9974
10068
|
var BADGE_VARIANTS = {
|
|
9975
10069
|
default: "bg-muted text-muted-foreground",
|
|
9976
|
-
success: "bg-
|
|
9977
|
-
warning: "bg-
|
|
9978
|
-
error: "bg-
|
|
9979
|
-
info: "bg-
|
|
10070
|
+
success: "bg-success-soft text-success",
|
|
10071
|
+
warning: "bg-warning-soft text-warning-foreground",
|
|
10072
|
+
error: "bg-destructive-soft text-destructive",
|
|
10073
|
+
info: "bg-info-soft text-info"
|
|
9980
10074
|
};
|
|
9981
10075
|
var ListItemSkeleton = ({ size }) => {
|
|
9982
10076
|
const sz = SIZE_STYLES2[size];
|
|
@@ -10501,10 +10595,10 @@ var SIZE_STYLE = {
|
|
|
10501
10595
|
var STATUS_COLOR = {
|
|
10502
10596
|
default: "bg-muted/60",
|
|
10503
10597
|
primary: "bg-primary",
|
|
10504
|
-
success: "bg-
|
|
10505
|
-
warning: "bg-
|
|
10506
|
-
error: "bg-
|
|
10507
|
-
info: "bg-
|
|
10598
|
+
success: "bg-success",
|
|
10599
|
+
warning: "bg-warning",
|
|
10600
|
+
error: "bg-destructive",
|
|
10601
|
+
info: "bg-info"
|
|
10508
10602
|
};
|
|
10509
10603
|
var TimelineContext = React36.createContext(null);
|
|
10510
10604
|
var LINE_STYLE_MAP = {
|
|
@@ -11084,10 +11178,10 @@ function ColorPicker({
|
|
|
11084
11178
|
onClick: copyToClipboard,
|
|
11085
11179
|
className: cn(
|
|
11086
11180
|
"h-9 px-3 rounded-lg border border-border text-xs hover:bg-accent/10 transition-colors flex items-center gap-1.5",
|
|
11087
|
-
copied && "bg-
|
|
11181
|
+
copied && "bg-success/10 border-success/30"
|
|
11088
11182
|
),
|
|
11089
11183
|
children: [
|
|
11090
|
-
copied ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Check, { className: "w-3.5 h-3.5 text-
|
|
11184
|
+
copied ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Check, { className: "w-3.5 h-3.5 text-success" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Copy, { className: "w-3.5 h-3.5" }),
|
|
11091
11185
|
variant === "full" && (copied ? "Copied!" : "Copy")
|
|
11092
11186
|
]
|
|
11093
11187
|
}
|
|
@@ -11124,9 +11218,9 @@ function ColorPicker({
|
|
|
11124
11218
|
onClick: copyToClipboard,
|
|
11125
11219
|
className: cn(
|
|
11126
11220
|
"h-9 w-9 rounded-lg border border-border hover:bg-accent/10 transition-colors flex items-center justify-center",
|
|
11127
|
-
copied && "bg-
|
|
11221
|
+
copied && "bg-success/10 border-success/30"
|
|
11128
11222
|
),
|
|
11129
|
-
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Check, { className: "w-3.5 h-3.5 text-
|
|
11223
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Check, { className: "w-3.5 h-3.5 text-success" }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Copy, { className: "w-3.5 h-3.5" })
|
|
11130
11224
|
}
|
|
11131
11225
|
)
|
|
11132
11226
|
] }),
|