@underverse-ui/underverse 0.2.90 → 0.2.92
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 +221 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +244 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5789,7 +5789,9 @@ var DatePicker = ({
|
|
|
5789
5789
|
todayLabel,
|
|
5790
5790
|
clearLabel,
|
|
5791
5791
|
weekdayLabels,
|
|
5792
|
-
disablePastDates = false
|
|
5792
|
+
disablePastDates = false,
|
|
5793
|
+
minDate,
|
|
5794
|
+
maxDate
|
|
5793
5795
|
}) => {
|
|
5794
5796
|
const t = useTranslations("DatePicker");
|
|
5795
5797
|
const locale = useLocale();
|
|
@@ -5799,6 +5801,27 @@ var DatePicker = ({
|
|
|
5799
5801
|
const triggerRef = React23.useRef(null);
|
|
5800
5802
|
const wheelContainerRef = React23.useRef(null);
|
|
5801
5803
|
const wheelDeltaRef = React23.useRef(0);
|
|
5804
|
+
const normalizeToLocalDay = React23.useCallback((date) => {
|
|
5805
|
+
if (!date) return null;
|
|
5806
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
5807
|
+
}, []);
|
|
5808
|
+
const minDay = React23.useMemo(() => normalizeToLocalDay(minDate), [minDate, normalizeToLocalDay]);
|
|
5809
|
+
const maxDay = React23.useMemo(() => normalizeToLocalDay(maxDate), [maxDate, normalizeToLocalDay]);
|
|
5810
|
+
const isDateDisabled = React23.useCallback(
|
|
5811
|
+
(date) => {
|
|
5812
|
+
const day = normalizeToLocalDay(date);
|
|
5813
|
+
if (!day) return false;
|
|
5814
|
+
if (disablePastDates) {
|
|
5815
|
+
const today = /* @__PURE__ */ new Date();
|
|
5816
|
+
today.setHours(0, 0, 0, 0);
|
|
5817
|
+
if (day < today) return true;
|
|
5818
|
+
}
|
|
5819
|
+
if (minDay && day < minDay) return true;
|
|
5820
|
+
if (maxDay && day > maxDay) return true;
|
|
5821
|
+
return false;
|
|
5822
|
+
},
|
|
5823
|
+
[disablePastDates, maxDay, minDay, normalizeToLocalDay]
|
|
5824
|
+
);
|
|
5802
5825
|
useShadCNAnimations();
|
|
5803
5826
|
React23.useEffect(() => {
|
|
5804
5827
|
if (value) {
|
|
@@ -5883,21 +5906,19 @@ var DatePicker = ({
|
|
|
5883
5906
|
for (let i = 0; i < firstDayOfMonth; i++) {
|
|
5884
5907
|
days.push(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: size === "sm" ? "w-7 h-7" : "w-8 h-8" }, `empty-${i}`));
|
|
5885
5908
|
}
|
|
5886
|
-
const today = /* @__PURE__ */ new Date();
|
|
5887
|
-
today.setHours(0, 0, 0, 0);
|
|
5888
5909
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
5889
5910
|
const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), day);
|
|
5890
5911
|
const isSelected = value && date.getDate() === value.getDate() && date.getMonth() === value.getMonth() && date.getFullYear() === value.getFullYear();
|
|
5891
5912
|
const isToday2 = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
5892
|
-
const
|
|
5913
|
+
const isDisabled = isDateDisabled(date);
|
|
5893
5914
|
const totalDaysFromStart = firstDayOfMonth + day - 1;
|
|
5894
5915
|
const rowIndex = Math.floor(totalDaysFromStart / 7);
|
|
5895
5916
|
days.push(
|
|
5896
5917
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5897
5918
|
"button",
|
|
5898
5919
|
{
|
|
5899
|
-
onClick: () => !
|
|
5900
|
-
disabled:
|
|
5920
|
+
onClick: () => !isDisabled && handleDateSelect(date),
|
|
5921
|
+
disabled: isDisabled,
|
|
5901
5922
|
style: {
|
|
5902
5923
|
animationDelay: isOpen ? `${rowIndex * 40}ms` : "0ms"
|
|
5903
5924
|
},
|
|
@@ -5905,8 +5926,8 @@ var DatePicker = ({
|
|
|
5905
5926
|
size === "sm" ? "w-7 h-7 text-[12px]" : "w-8 h-8 text-sm",
|
|
5906
5927
|
"datepicker-day rounded-lg focus:outline-none relative cursor-pointer",
|
|
5907
5928
|
"transition-all duration-200 font-medium",
|
|
5908
|
-
|
|
5909
|
-
isSelected ? "bg-linear-to-br from-primary to-primary/80 text-primary-foreground font-bold shadow-lg shadow-primary/30 scale-110 z-10 hover:from-primary hover:to-primary/70" : !
|
|
5929
|
+
isDisabled && "opacity-30 cursor-not-allowed text-muted-foreground",
|
|
5930
|
+
isSelected ? "bg-linear-to-br from-primary to-primary/80 text-primary-foreground font-bold shadow-lg shadow-primary/30 scale-110 z-10 hover:from-primary hover:to-primary/70" : !isDisabled && "hover:bg-accent/80 hover:text-accent-foreground hover:scale-105 focus:bg-accent focus:text-accent-foreground",
|
|
5910
5931
|
isToday2 && !isSelected && "bg-primary/15 text-primary font-bold ring-2 ring-primary/30"
|
|
5911
5932
|
),
|
|
5912
5933
|
children: [
|
|
@@ -6054,15 +6075,18 @@ var DatePicker = ({
|
|
|
6054
6075
|
type: "button",
|
|
6055
6076
|
onClick: () => {
|
|
6056
6077
|
const today = /* @__PURE__ */ new Date();
|
|
6078
|
+
if (isDateDisabled(today)) return;
|
|
6057
6079
|
handleDateSelect(today);
|
|
6058
6080
|
},
|
|
6081
|
+
disabled: isDateDisabled(/* @__PURE__ */ new Date()),
|
|
6059
6082
|
className: cn(
|
|
6060
6083
|
"flex-1 font-semibold rounded-xl",
|
|
6061
6084
|
"bg-linear-to-r from-primary/10 to-primary/5 border border-primary/30",
|
|
6062
6085
|
"text-primary hover:from-primary/20 hover:to-primary/10 hover:border-primary/50",
|
|
6063
6086
|
"transition-all duration-300 flex items-center justify-center",
|
|
6064
6087
|
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-primary/10",
|
|
6065
|
-
size === "sm" ? "px-2 py-1 text-[10px] gap-1" : "px-3 py-2 text-xs gap-2"
|
|
6088
|
+
size === "sm" ? "px-2 py-1 text-[10px] gap-1" : "px-3 py-2 text-xs gap-2",
|
|
6089
|
+
isDateDisabled(/* @__PURE__ */ new Date()) && "opacity-50 cursor-not-allowed hover:scale-100 active:scale-100"
|
|
6066
6090
|
),
|
|
6067
6091
|
children: [
|
|
6068
6092
|
/* @__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" }),
|
|
@@ -6221,7 +6245,7 @@ var DatePicker = ({
|
|
|
6221
6245
|
)
|
|
6222
6246
|
] });
|
|
6223
6247
|
};
|
|
6224
|
-
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false, size = "md" }) => {
|
|
6248
|
+
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false, minDate, maxDate, size = "md" }) => {
|
|
6225
6249
|
const locale = useLocale();
|
|
6226
6250
|
const t = useTranslations("DatePicker");
|
|
6227
6251
|
const [isOpen, setIsOpen] = React23.useState(false);
|
|
@@ -6231,6 +6255,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6231
6255
|
if (!date) return null;
|
|
6232
6256
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
6233
6257
|
};
|
|
6258
|
+
const minDay = React23.useMemo(() => normalizeToLocal(minDate), [minDate]);
|
|
6259
|
+
const maxDay = React23.useMemo(() => normalizeToLocal(maxDate), [maxDate]);
|
|
6234
6260
|
const [viewDate, setViewDate] = React23.useState(startDate || /* @__PURE__ */ new Date());
|
|
6235
6261
|
const [tempStart, setTempStart] = React23.useState(normalizeToLocal(startDate));
|
|
6236
6262
|
const [tempEnd, setTempEnd] = React23.useState(normalizeToLocal(endDate));
|
|
@@ -6310,6 +6336,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6310
6336
|
for (let d = 1; d <= daysInMonth; d++) {
|
|
6311
6337
|
const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), d);
|
|
6312
6338
|
const isPastDate = disablePastDates && date < today;
|
|
6339
|
+
const isOutOfRange = !!minDay && date < minDay || !!maxDay && date > maxDay;
|
|
6340
|
+
const isDisabled = isPastDate || isOutOfRange;
|
|
6313
6341
|
const isSelectedStart = isSameDay2(date, tempStart);
|
|
6314
6342
|
const isSelectedEnd = isSameDay2(date, tempEnd);
|
|
6315
6343
|
const isHovering = hoveredDate && tempStart && !tempEnd;
|
|
@@ -6335,17 +6363,17 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6335
6363
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
6336
6364
|
"button",
|
|
6337
6365
|
{
|
|
6338
|
-
onClick: () => !
|
|
6339
|
-
disabled:
|
|
6340
|
-
onMouseEnter: () => !
|
|
6366
|
+
onClick: () => !isDisabled && handleSelect(date),
|
|
6367
|
+
disabled: isDisabled,
|
|
6368
|
+
onMouseEnter: () => !isDisabled && tempStart && !tempEnd && setHoveredDate(date),
|
|
6341
6369
|
onMouseLeave: () => tempStart && !tempEnd && setHoveredDate(null),
|
|
6342
6370
|
className: cn(
|
|
6343
6371
|
"transition-all duration-200 focus:outline-none relative font-medium cursor-pointer",
|
|
6344
6372
|
size === "sm" ? "w-6 h-6 text-xs" : "w-8 h-8 text-sm",
|
|
6345
6373
|
// Disabled/past date state
|
|
6346
|
-
|
|
6374
|
+
isDisabled && "opacity-30 cursor-not-allowed text-muted-foreground",
|
|
6347
6375
|
// Default state
|
|
6348
|
-
!
|
|
6376
|
+
!isDisabled && !isInRange && !isRangeStart && !isRangeEnd && "hover:bg-accent/80 hover:text-accent-foreground hover:scale-105 rounded-lg",
|
|
6349
6377
|
// Range selection styling - smooth continuous background with gradient
|
|
6350
6378
|
isInRange && "bg-primary/15 text-foreground",
|
|
6351
6379
|
(isRangeStart || isRangeEnd) && "bg-linear-to-br from-primary to-primary/80 text-primary-foreground hover:from-primary hover:to-primary/70 shadow-lg shadow-primary/25",
|
|
@@ -6355,8 +6383,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6355
6383
|
isRangeStart && isRangeEnd && "rounded-lg",
|
|
6356
6384
|
// Single day selection
|
|
6357
6385
|
// Hover effects for range
|
|
6358
|
-
isInRange && !
|
|
6359
|
-
!
|
|
6386
|
+
isInRange && !isDisabled && "hover:bg-primary/25",
|
|
6387
|
+
!isDisabled && "focus:bg-accent focus:text-accent-foreground focus:z-10 focus:shadow-md"
|
|
6360
6388
|
),
|
|
6361
6389
|
children: d
|
|
6362
6390
|
},
|
|
@@ -6568,6 +6596,10 @@ function Calendar2({
|
|
|
6568
6596
|
animate = false,
|
|
6569
6597
|
showEventBadges = false,
|
|
6570
6598
|
highlightWeekends = false,
|
|
6599
|
+
cellMode = "compact",
|
|
6600
|
+
maxEventsPerDay = 3,
|
|
6601
|
+
onEventClick,
|
|
6602
|
+
renderEvent,
|
|
6571
6603
|
...rest
|
|
6572
6604
|
}) {
|
|
6573
6605
|
const isControlledMonth = month != null;
|
|
@@ -6660,6 +6692,13 @@ function Calendar2({
|
|
|
6660
6692
|
xl: { day: "w-14 h-14 text-lg", grid: dense ? "gap-2" : "gap-2.5", head: "text-base", header: "text-lg" }
|
|
6661
6693
|
};
|
|
6662
6694
|
const sz = SIZE_STYLES3[size];
|
|
6695
|
+
const CELL_EVENT_STYLES = {
|
|
6696
|
+
sm: { cell: dense ? "min-h-20 p-1.5" : "min-h-24 p-2", day: "text-[12px]" },
|
|
6697
|
+
md: { cell: dense ? "min-h-28 p-2" : "min-h-32 p-2.5", day: "text-sm" },
|
|
6698
|
+
lg: { cell: dense ? "min-h-36 p-2.5" : "min-h-40 p-3", day: "text-base" },
|
|
6699
|
+
xl: { cell: dense ? "min-h-44 p-3" : "min-h-52 p-3.5", day: "text-lg" }
|
|
6700
|
+
};
|
|
6701
|
+
const cellSz = CELL_EVENT_STYLES[size];
|
|
6663
6702
|
const VARIANT_STYLES2 = {
|
|
6664
6703
|
default: "border border-border rounded-2xl bg-card",
|
|
6665
6704
|
bordered: "border-2 border-border rounded-2xl bg-card shadow-sm",
|
|
@@ -6683,6 +6722,84 @@ function Calendar2({
|
|
|
6683
6722
|
const k = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
6684
6723
|
const dayEvents = byDay.get(k) || [];
|
|
6685
6724
|
const disabled = isDateDisabled(d);
|
|
6725
|
+
const isWeekend = d.getDay() === 0 || d.getDay() === 6;
|
|
6726
|
+
const customDay = renderDay?.({ date: d, isCurrentMonth: inMonth, isToday: isToday2, isSelected: selectedDay, events: dayEvents });
|
|
6727
|
+
if (customDay) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(React24.Fragment, { children: customDay }, `${monthLabel}-${idx}`);
|
|
6728
|
+
if (cellMode === "events") {
|
|
6729
|
+
const limit = Math.max(0, maxEventsPerDay);
|
|
6730
|
+
const visibleEvents = dayEvents.slice(0, limit);
|
|
6731
|
+
const hiddenCount = Math.max(0, dayEvents.length - visibleEvents.length);
|
|
6732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6733
|
+
"div",
|
|
6734
|
+
{
|
|
6735
|
+
className: cn(
|
|
6736
|
+
"rounded-xl border border-border/50 bg-background/40 overflow-hidden",
|
|
6737
|
+
"transition-colors duration-150",
|
|
6738
|
+
animate && "will-change-transform",
|
|
6739
|
+
cellSz.cell,
|
|
6740
|
+
!inMonth && "opacity-60",
|
|
6741
|
+
disabled && "opacity-40",
|
|
6742
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6743
|
+
isToday2 && !selectedDay && "ring-1 ring-primary/40",
|
|
6744
|
+
selectedDay && "border-primary/50 bg-primary/10"
|
|
6745
|
+
),
|
|
6746
|
+
children: [
|
|
6747
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
6748
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6749
|
+
"button",
|
|
6750
|
+
{
|
|
6751
|
+
type: "button",
|
|
6752
|
+
onClick: () => !disabled && handleClickDay(d),
|
|
6753
|
+
disabled,
|
|
6754
|
+
className: cn(
|
|
6755
|
+
"inline-flex items-center justify-center rounded-lg px-2 py-1",
|
|
6756
|
+
"transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6757
|
+
cellSz.day,
|
|
6758
|
+
selectedDay ? "bg-primary text-primary-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
6759
|
+
disabled && "cursor-not-allowed hover:bg-transparent"
|
|
6760
|
+
),
|
|
6761
|
+
title: d.toDateString(),
|
|
6762
|
+
children: d.getDate()
|
|
6763
|
+
}
|
|
6764
|
+
),
|
|
6765
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-[11px] text-muted-foreground tabular-nums", children: dayEvents.length })
|
|
6766
|
+
] }),
|
|
6767
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cn("mt-2 space-y-1", dense ? "mt-1.5" : "mt-2"), children: [
|
|
6768
|
+
visibleEvents.map((e, i) => {
|
|
6769
|
+
const key = e.id ?? `${k}-${i}`;
|
|
6770
|
+
const node = renderEvent?.({ event: e, date: d });
|
|
6771
|
+
if (node) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: node }, String(key));
|
|
6772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6773
|
+
"button",
|
|
6774
|
+
{
|
|
6775
|
+
type: "button",
|
|
6776
|
+
onClick: () => onEventClick?.(e, d),
|
|
6777
|
+
className: cn(
|
|
6778
|
+
"w-full text-left rounded-lg px-2 py-1",
|
|
6779
|
+
"transition-colors duration-150 hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6780
|
+
"text-xs flex items-center gap-2"
|
|
6781
|
+
),
|
|
6782
|
+
title: e.title,
|
|
6783
|
+
children: [
|
|
6784
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "h-2 w-2 rounded-full shrink-0", style: { backgroundColor: e.color || "hsl(var(--primary))" } }),
|
|
6785
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "truncate flex-1", children: e.title ?? "Event" }),
|
|
6786
|
+
showEventBadges && e.badge && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground", children: e.badge })
|
|
6787
|
+
]
|
|
6788
|
+
},
|
|
6789
|
+
String(key)
|
|
6790
|
+
);
|
|
6791
|
+
}),
|
|
6792
|
+
hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "px-2 text-[11px] text-muted-foreground", children: [
|
|
6793
|
+
"+",
|
|
6794
|
+
hiddenCount,
|
|
6795
|
+
" more"
|
|
6796
|
+
] })
|
|
6797
|
+
] })
|
|
6798
|
+
]
|
|
6799
|
+
},
|
|
6800
|
+
`${monthLabel}-${idx}`
|
|
6801
|
+
);
|
|
6802
|
+
}
|
|
6686
6803
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6687
6804
|
"button",
|
|
6688
6805
|
{
|
|
@@ -6693,6 +6810,7 @@ function Calendar2({
|
|
|
6693
6810
|
sz.day,
|
|
6694
6811
|
!inMonth && "text-muted-foreground/60",
|
|
6695
6812
|
disabled && "opacity-40 cursor-not-allowed",
|
|
6813
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6696
6814
|
isToday2 && !selectedDay && "ring-1 ring-primary/50",
|
|
6697
6815
|
selectedDay && "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
6698
6816
|
!selectedDay && "hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
|
|
@@ -6700,7 +6818,14 @@ function Calendar2({
|
|
|
6700
6818
|
title: d.toDateString(),
|
|
6701
6819
|
children: [
|
|
6702
6820
|
d.getDate(),
|
|
6703
|
-
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6821
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6822
|
+
"span",
|
|
6823
|
+
{
|
|
6824
|
+
className: "h-1.5 w-1.5 rounded-full",
|
|
6825
|
+
style: { backgroundColor: e.color || "hsl(var(--primary))" }
|
|
6826
|
+
},
|
|
6827
|
+
String(e.id ?? i)
|
|
6828
|
+
)) })
|
|
6704
6829
|
]
|
|
6705
6830
|
},
|
|
6706
6831
|
`${monthLabel}-${idx}`
|
|
@@ -6763,6 +6888,82 @@ function Calendar2({
|
|
|
6763
6888
|
const k = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
6764
6889
|
const dayEvents = byDay.get(k) || [];
|
|
6765
6890
|
const disabled = isDateDisabled(d);
|
|
6891
|
+
const isWeekend = d.getDay() === 0 || d.getDay() === 6;
|
|
6892
|
+
const customDay = renderDay?.({ date: d, isCurrentMonth: inMonth, isToday: isToday2, isSelected: selectedDay, events: dayEvents });
|
|
6893
|
+
if (customDay) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(React24.Fragment, { children: customDay }, `wd-${idx}`);
|
|
6894
|
+
if (cellMode === "events") {
|
|
6895
|
+
const limit = Math.max(0, maxEventsPerDay);
|
|
6896
|
+
const visibleEvents = dayEvents.slice(0, limit);
|
|
6897
|
+
const hiddenCount = Math.max(0, dayEvents.length - visibleEvents.length);
|
|
6898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6899
|
+
"div",
|
|
6900
|
+
{
|
|
6901
|
+
className: cn(
|
|
6902
|
+
"rounded-xl border border-border/50 bg-background/40 overflow-hidden",
|
|
6903
|
+
"transition-colors duration-150",
|
|
6904
|
+
cellSz.cell,
|
|
6905
|
+
disabled && "opacity-40",
|
|
6906
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6907
|
+
isToday2 && !selectedDay && "ring-1 ring-primary/40",
|
|
6908
|
+
selectedDay && "border-primary/50 bg-primary/10"
|
|
6909
|
+
),
|
|
6910
|
+
children: [
|
|
6911
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
6912
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6913
|
+
"button",
|
|
6914
|
+
{
|
|
6915
|
+
type: "button",
|
|
6916
|
+
onClick: () => !disabled && handleClickDay(d),
|
|
6917
|
+
disabled,
|
|
6918
|
+
className: cn(
|
|
6919
|
+
"inline-flex items-center justify-center rounded-lg px-2 py-1",
|
|
6920
|
+
"transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6921
|
+
cellSz.day,
|
|
6922
|
+
selectedDay ? "bg-primary text-primary-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
6923
|
+
disabled && "cursor-not-allowed hover:bg-transparent"
|
|
6924
|
+
),
|
|
6925
|
+
title: d.toDateString(),
|
|
6926
|
+
children: d.getDate()
|
|
6927
|
+
}
|
|
6928
|
+
),
|
|
6929
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-[11px] text-muted-foreground tabular-nums", children: dayEvents.length })
|
|
6930
|
+
] }),
|
|
6931
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: cn("mt-2 space-y-1", dense ? "mt-1.5" : "mt-2"), children: [
|
|
6932
|
+
visibleEvents.map((e, i) => {
|
|
6933
|
+
const key = e.id ?? `${k}-${i}`;
|
|
6934
|
+
const node = renderEvent?.({ event: e, date: d });
|
|
6935
|
+
if (node) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: node }, String(key));
|
|
6936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6937
|
+
"button",
|
|
6938
|
+
{
|
|
6939
|
+
type: "button",
|
|
6940
|
+
onClick: () => onEventClick?.(e, d),
|
|
6941
|
+
className: cn(
|
|
6942
|
+
"w-full text-left rounded-lg px-2 py-1",
|
|
6943
|
+
"transition-colors duration-150 hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6944
|
+
"text-xs flex items-center gap-2"
|
|
6945
|
+
),
|
|
6946
|
+
title: e.title,
|
|
6947
|
+
children: [
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "h-2 w-2 rounded-full shrink-0", style: { backgroundColor: e.color || "hsl(var(--primary))" } }),
|
|
6949
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "truncate flex-1", children: e.title ?? "Event" }),
|
|
6950
|
+
showEventBadges && e.badge && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground", children: e.badge })
|
|
6951
|
+
]
|
|
6952
|
+
},
|
|
6953
|
+
String(key)
|
|
6954
|
+
);
|
|
6955
|
+
}),
|
|
6956
|
+
hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "px-2 text-[11px] text-muted-foreground", children: [
|
|
6957
|
+
"+",
|
|
6958
|
+
hiddenCount,
|
|
6959
|
+
" more"
|
|
6960
|
+
] })
|
|
6961
|
+
] })
|
|
6962
|
+
]
|
|
6963
|
+
},
|
|
6964
|
+
`wd-${idx}`
|
|
6965
|
+
);
|
|
6966
|
+
}
|
|
6766
6967
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
6767
6968
|
"button",
|
|
6768
6969
|
{
|
|
@@ -6772,6 +6973,7 @@ function Calendar2({
|
|
|
6772
6973
|
"rounded-lg flex items-center justify-center relative cursor-pointer",
|
|
6773
6974
|
sz.day,
|
|
6774
6975
|
disabled && "opacity-40 cursor-not-allowed",
|
|
6976
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6775
6977
|
isToday2 && !selectedDay && "ring-1 ring-primary/50",
|
|
6776
6978
|
selectedDay && "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
6777
6979
|
!selectedDay && "hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
|
|
@@ -6779,7 +6981,7 @@ function Calendar2({
|
|
|
6779
6981
|
title: d.toDateString(),
|
|
6780
6982
|
children: [
|
|
6781
6983
|
d.getDate(),
|
|
6782
|
-
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "h-1.5 w-1.5 rounded-full", style: { backgroundColor: e.color || "hsl(var(--primary))" } }, i)) })
|
|
6984
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "h-1.5 w-1.5 rounded-full", style: { backgroundColor: e.color || "hsl(var(--primary))" } }, String(e.id ?? i))) })
|
|
6783
6985
|
]
|
|
6784
6986
|
},
|
|
6785
6987
|
`wd-${idx}`
|