@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.js
CHANGED
|
@@ -5614,7 +5614,9 @@ var DatePicker = ({
|
|
|
5614
5614
|
todayLabel,
|
|
5615
5615
|
clearLabel,
|
|
5616
5616
|
weekdayLabels,
|
|
5617
|
-
disablePastDates = false
|
|
5617
|
+
disablePastDates = false,
|
|
5618
|
+
minDate,
|
|
5619
|
+
maxDate
|
|
5618
5620
|
}) => {
|
|
5619
5621
|
const t = useTranslations("DatePicker");
|
|
5620
5622
|
const locale = useLocale();
|
|
@@ -5624,6 +5626,27 @@ var DatePicker = ({
|
|
|
5624
5626
|
const triggerRef = React23.useRef(null);
|
|
5625
5627
|
const wheelContainerRef = React23.useRef(null);
|
|
5626
5628
|
const wheelDeltaRef = React23.useRef(0);
|
|
5629
|
+
const normalizeToLocalDay = React23.useCallback((date) => {
|
|
5630
|
+
if (!date) return null;
|
|
5631
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
5632
|
+
}, []);
|
|
5633
|
+
const minDay = React23.useMemo(() => normalizeToLocalDay(minDate), [minDate, normalizeToLocalDay]);
|
|
5634
|
+
const maxDay = React23.useMemo(() => normalizeToLocalDay(maxDate), [maxDate, normalizeToLocalDay]);
|
|
5635
|
+
const isDateDisabled = React23.useCallback(
|
|
5636
|
+
(date) => {
|
|
5637
|
+
const day = normalizeToLocalDay(date);
|
|
5638
|
+
if (!day) return false;
|
|
5639
|
+
if (disablePastDates) {
|
|
5640
|
+
const today = /* @__PURE__ */ new Date();
|
|
5641
|
+
today.setHours(0, 0, 0, 0);
|
|
5642
|
+
if (day < today) return true;
|
|
5643
|
+
}
|
|
5644
|
+
if (minDay && day < minDay) return true;
|
|
5645
|
+
if (maxDay && day > maxDay) return true;
|
|
5646
|
+
return false;
|
|
5647
|
+
},
|
|
5648
|
+
[disablePastDates, maxDay, minDay, normalizeToLocalDay]
|
|
5649
|
+
);
|
|
5627
5650
|
useShadCNAnimations();
|
|
5628
5651
|
React23.useEffect(() => {
|
|
5629
5652
|
if (value) {
|
|
@@ -5708,21 +5731,19 @@ var DatePicker = ({
|
|
|
5708
5731
|
for (let i = 0; i < firstDayOfMonth; i++) {
|
|
5709
5732
|
days.push(/* @__PURE__ */ jsx29("div", { className: size === "sm" ? "w-7 h-7" : "w-8 h-8" }, `empty-${i}`));
|
|
5710
5733
|
}
|
|
5711
|
-
const today = /* @__PURE__ */ new Date();
|
|
5712
|
-
today.setHours(0, 0, 0, 0);
|
|
5713
5734
|
for (let day = 1; day <= daysInMonth; day++) {
|
|
5714
5735
|
const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), day);
|
|
5715
5736
|
const isSelected = value && date.getDate() === value.getDate() && date.getMonth() === value.getMonth() && date.getFullYear() === value.getFullYear();
|
|
5716
5737
|
const isToday2 = date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
5717
|
-
const
|
|
5738
|
+
const isDisabled = isDateDisabled(date);
|
|
5718
5739
|
const totalDaysFromStart = firstDayOfMonth + day - 1;
|
|
5719
5740
|
const rowIndex = Math.floor(totalDaysFromStart / 7);
|
|
5720
5741
|
days.push(
|
|
5721
5742
|
/* @__PURE__ */ jsxs24(
|
|
5722
5743
|
"button",
|
|
5723
5744
|
{
|
|
5724
|
-
onClick: () => !
|
|
5725
|
-
disabled:
|
|
5745
|
+
onClick: () => !isDisabled && handleDateSelect(date),
|
|
5746
|
+
disabled: isDisabled,
|
|
5726
5747
|
style: {
|
|
5727
5748
|
animationDelay: isOpen ? `${rowIndex * 40}ms` : "0ms"
|
|
5728
5749
|
},
|
|
@@ -5730,8 +5751,8 @@ var DatePicker = ({
|
|
|
5730
5751
|
size === "sm" ? "w-7 h-7 text-[12px]" : "w-8 h-8 text-sm",
|
|
5731
5752
|
"datepicker-day rounded-lg focus:outline-none relative cursor-pointer",
|
|
5732
5753
|
"transition-all duration-200 font-medium",
|
|
5733
|
-
|
|
5734
|
-
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" : !
|
|
5754
|
+
isDisabled && "opacity-30 cursor-not-allowed text-muted-foreground",
|
|
5755
|
+
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",
|
|
5735
5756
|
isToday2 && !isSelected && "bg-primary/15 text-primary font-bold ring-2 ring-primary/30"
|
|
5736
5757
|
),
|
|
5737
5758
|
children: [
|
|
@@ -5879,15 +5900,18 @@ var DatePicker = ({
|
|
|
5879
5900
|
type: "button",
|
|
5880
5901
|
onClick: () => {
|
|
5881
5902
|
const today = /* @__PURE__ */ new Date();
|
|
5903
|
+
if (isDateDisabled(today)) return;
|
|
5882
5904
|
handleDateSelect(today);
|
|
5883
5905
|
},
|
|
5906
|
+
disabled: isDateDisabled(/* @__PURE__ */ new Date()),
|
|
5884
5907
|
className: cn(
|
|
5885
5908
|
"flex-1 font-semibold rounded-xl",
|
|
5886
5909
|
"bg-linear-to-r from-primary/10 to-primary/5 border border-primary/30",
|
|
5887
5910
|
"text-primary hover:from-primary/20 hover:to-primary/10 hover:border-primary/50",
|
|
5888
5911
|
"transition-all duration-300 flex items-center justify-center",
|
|
5889
5912
|
"hover:scale-[1.02] active:scale-[0.98] hover:shadow-md hover:shadow-primary/10",
|
|
5890
|
-
size === "sm" ? "px-2 py-1 text-[10px] gap-1" : "px-3 py-2 text-xs gap-2"
|
|
5913
|
+
size === "sm" ? "px-2 py-1 text-[10px] gap-1" : "px-3 py-2 text-xs gap-2",
|
|
5914
|
+
isDateDisabled(/* @__PURE__ */ new Date()) && "opacity-50 cursor-not-allowed hover:scale-100 active:scale-100"
|
|
5891
5915
|
),
|
|
5892
5916
|
children: [
|
|
5893
5917
|
/* @__PURE__ */ jsx29(Sparkles2, { className: size === "sm" ? "w-2.5 h-2.5" : "w-3.5 h-3.5" }),
|
|
@@ -6046,7 +6070,7 @@ var DatePicker = ({
|
|
|
6046
6070
|
)
|
|
6047
6071
|
] });
|
|
6048
6072
|
};
|
|
6049
|
-
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false, size = "md" }) => {
|
|
6073
|
+
var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select date range...", className, disablePastDates = false, minDate, maxDate, size = "md" }) => {
|
|
6050
6074
|
const locale = useLocale();
|
|
6051
6075
|
const t = useTranslations("DatePicker");
|
|
6052
6076
|
const [isOpen, setIsOpen] = React23.useState(false);
|
|
@@ -6056,6 +6080,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6056
6080
|
if (!date) return null;
|
|
6057
6081
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
6058
6082
|
};
|
|
6083
|
+
const minDay = React23.useMemo(() => normalizeToLocal(minDate), [minDate]);
|
|
6084
|
+
const maxDay = React23.useMemo(() => normalizeToLocal(maxDate), [maxDate]);
|
|
6059
6085
|
const [viewDate, setViewDate] = React23.useState(startDate || /* @__PURE__ */ new Date());
|
|
6060
6086
|
const [tempStart, setTempStart] = React23.useState(normalizeToLocal(startDate));
|
|
6061
6087
|
const [tempEnd, setTempEnd] = React23.useState(normalizeToLocal(endDate));
|
|
@@ -6135,6 +6161,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6135
6161
|
for (let d = 1; d <= daysInMonth; d++) {
|
|
6136
6162
|
const date = new Date(viewDate.getFullYear(), viewDate.getMonth(), d);
|
|
6137
6163
|
const isPastDate = disablePastDates && date < today;
|
|
6164
|
+
const isOutOfRange = !!minDay && date < minDay || !!maxDay && date > maxDay;
|
|
6165
|
+
const isDisabled = isPastDate || isOutOfRange;
|
|
6138
6166
|
const isSelectedStart = isSameDay2(date, tempStart);
|
|
6139
6167
|
const isSelectedEnd = isSameDay2(date, tempEnd);
|
|
6140
6168
|
const isHovering = hoveredDate && tempStart && !tempEnd;
|
|
@@ -6160,17 +6188,17 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6160
6188
|
/* @__PURE__ */ jsx29(
|
|
6161
6189
|
"button",
|
|
6162
6190
|
{
|
|
6163
|
-
onClick: () => !
|
|
6164
|
-
disabled:
|
|
6165
|
-
onMouseEnter: () => !
|
|
6191
|
+
onClick: () => !isDisabled && handleSelect(date),
|
|
6192
|
+
disabled: isDisabled,
|
|
6193
|
+
onMouseEnter: () => !isDisabled && tempStart && !tempEnd && setHoveredDate(date),
|
|
6166
6194
|
onMouseLeave: () => tempStart && !tempEnd && setHoveredDate(null),
|
|
6167
6195
|
className: cn(
|
|
6168
6196
|
"transition-all duration-200 focus:outline-none relative font-medium cursor-pointer",
|
|
6169
6197
|
size === "sm" ? "w-6 h-6 text-xs" : "w-8 h-8 text-sm",
|
|
6170
6198
|
// Disabled/past date state
|
|
6171
|
-
|
|
6199
|
+
isDisabled && "opacity-30 cursor-not-allowed text-muted-foreground",
|
|
6172
6200
|
// Default state
|
|
6173
|
-
!
|
|
6201
|
+
!isDisabled && !isInRange && !isRangeStart && !isRangeEnd && "hover:bg-accent/80 hover:text-accent-foreground hover:scale-105 rounded-lg",
|
|
6174
6202
|
// Range selection styling - smooth continuous background with gradient
|
|
6175
6203
|
isInRange && "bg-primary/15 text-foreground",
|
|
6176
6204
|
(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",
|
|
@@ -6180,8 +6208,8 @@ var DateRangePicker = ({ startDate, endDate, onChange, placeholder = "Select dat
|
|
|
6180
6208
|
isRangeStart && isRangeEnd && "rounded-lg",
|
|
6181
6209
|
// Single day selection
|
|
6182
6210
|
// Hover effects for range
|
|
6183
|
-
isInRange && !
|
|
6184
|
-
!
|
|
6211
|
+
isInRange && !isDisabled && "hover:bg-primary/25",
|
|
6212
|
+
!isDisabled && "focus:bg-accent focus:text-accent-foreground focus:z-10 focus:shadow-md"
|
|
6185
6213
|
),
|
|
6186
6214
|
children: d
|
|
6187
6215
|
},
|
|
@@ -6393,6 +6421,10 @@ function Calendar2({
|
|
|
6393
6421
|
animate = false,
|
|
6394
6422
|
showEventBadges = false,
|
|
6395
6423
|
highlightWeekends = false,
|
|
6424
|
+
cellMode = "compact",
|
|
6425
|
+
maxEventsPerDay = 3,
|
|
6426
|
+
onEventClick,
|
|
6427
|
+
renderEvent,
|
|
6396
6428
|
...rest
|
|
6397
6429
|
}) {
|
|
6398
6430
|
const isControlledMonth = month != null;
|
|
@@ -6485,6 +6517,13 @@ function Calendar2({
|
|
|
6485
6517
|
xl: { day: "w-14 h-14 text-lg", grid: dense ? "gap-2" : "gap-2.5", head: "text-base", header: "text-lg" }
|
|
6486
6518
|
};
|
|
6487
6519
|
const sz = SIZE_STYLES3[size];
|
|
6520
|
+
const CELL_EVENT_STYLES = {
|
|
6521
|
+
sm: { cell: dense ? "min-h-20 p-1.5" : "min-h-24 p-2", day: "text-[12px]" },
|
|
6522
|
+
md: { cell: dense ? "min-h-28 p-2" : "min-h-32 p-2.5", day: "text-sm" },
|
|
6523
|
+
lg: { cell: dense ? "min-h-36 p-2.5" : "min-h-40 p-3", day: "text-base" },
|
|
6524
|
+
xl: { cell: dense ? "min-h-44 p-3" : "min-h-52 p-3.5", day: "text-lg" }
|
|
6525
|
+
};
|
|
6526
|
+
const cellSz = CELL_EVENT_STYLES[size];
|
|
6488
6527
|
const VARIANT_STYLES2 = {
|
|
6489
6528
|
default: "border border-border rounded-2xl bg-card",
|
|
6490
6529
|
bordered: "border-2 border-border rounded-2xl bg-card shadow-sm",
|
|
@@ -6508,6 +6547,84 @@ function Calendar2({
|
|
|
6508
6547
|
const k = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
6509
6548
|
const dayEvents = byDay.get(k) || [];
|
|
6510
6549
|
const disabled = isDateDisabled(d);
|
|
6550
|
+
const isWeekend = d.getDay() === 0 || d.getDay() === 6;
|
|
6551
|
+
const customDay = renderDay?.({ date: d, isCurrentMonth: inMonth, isToday: isToday2, isSelected: selectedDay, events: dayEvents });
|
|
6552
|
+
if (customDay) return /* @__PURE__ */ jsx30(React24.Fragment, { children: customDay }, `${monthLabel}-${idx}`);
|
|
6553
|
+
if (cellMode === "events") {
|
|
6554
|
+
const limit = Math.max(0, maxEventsPerDay);
|
|
6555
|
+
const visibleEvents = dayEvents.slice(0, limit);
|
|
6556
|
+
const hiddenCount = Math.max(0, dayEvents.length - visibleEvents.length);
|
|
6557
|
+
return /* @__PURE__ */ jsxs25(
|
|
6558
|
+
"div",
|
|
6559
|
+
{
|
|
6560
|
+
className: cn(
|
|
6561
|
+
"rounded-xl border border-border/50 bg-background/40 overflow-hidden",
|
|
6562
|
+
"transition-colors duration-150",
|
|
6563
|
+
animate && "will-change-transform",
|
|
6564
|
+
cellSz.cell,
|
|
6565
|
+
!inMonth && "opacity-60",
|
|
6566
|
+
disabled && "opacity-40",
|
|
6567
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6568
|
+
isToday2 && !selectedDay && "ring-1 ring-primary/40",
|
|
6569
|
+
selectedDay && "border-primary/50 bg-primary/10"
|
|
6570
|
+
),
|
|
6571
|
+
children: [
|
|
6572
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between gap-2", children: [
|
|
6573
|
+
/* @__PURE__ */ jsx30(
|
|
6574
|
+
"button",
|
|
6575
|
+
{
|
|
6576
|
+
type: "button",
|
|
6577
|
+
onClick: () => !disabled && handleClickDay(d),
|
|
6578
|
+
disabled,
|
|
6579
|
+
className: cn(
|
|
6580
|
+
"inline-flex items-center justify-center rounded-lg px-2 py-1",
|
|
6581
|
+
"transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6582
|
+
cellSz.day,
|
|
6583
|
+
selectedDay ? "bg-primary text-primary-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
6584
|
+
disabled && "cursor-not-allowed hover:bg-transparent"
|
|
6585
|
+
),
|
|
6586
|
+
title: d.toDateString(),
|
|
6587
|
+
children: d.getDate()
|
|
6588
|
+
}
|
|
6589
|
+
),
|
|
6590
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsx30("span", { className: "text-[11px] text-muted-foreground tabular-nums", children: dayEvents.length })
|
|
6591
|
+
] }),
|
|
6592
|
+
/* @__PURE__ */ jsxs25("div", { className: cn("mt-2 space-y-1", dense ? "mt-1.5" : "mt-2"), children: [
|
|
6593
|
+
visibleEvents.map((e, i) => {
|
|
6594
|
+
const key = e.id ?? `${k}-${i}`;
|
|
6595
|
+
const node = renderEvent?.({ event: e, date: d });
|
|
6596
|
+
if (node) return /* @__PURE__ */ jsx30("div", { children: node }, String(key));
|
|
6597
|
+
return /* @__PURE__ */ jsxs25(
|
|
6598
|
+
"button",
|
|
6599
|
+
{
|
|
6600
|
+
type: "button",
|
|
6601
|
+
onClick: () => onEventClick?.(e, d),
|
|
6602
|
+
className: cn(
|
|
6603
|
+
"w-full text-left rounded-lg px-2 py-1",
|
|
6604
|
+
"transition-colors duration-150 hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6605
|
+
"text-xs flex items-center gap-2"
|
|
6606
|
+
),
|
|
6607
|
+
title: e.title,
|
|
6608
|
+
children: [
|
|
6609
|
+
/* @__PURE__ */ jsx30("span", { className: "h-2 w-2 rounded-full shrink-0", style: { backgroundColor: e.color || "hsl(var(--primary))" } }),
|
|
6610
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate flex-1", children: e.title ?? "Event" }),
|
|
6611
|
+
showEventBadges && e.badge && /* @__PURE__ */ jsx30("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground", children: e.badge })
|
|
6612
|
+
]
|
|
6613
|
+
},
|
|
6614
|
+
String(key)
|
|
6615
|
+
);
|
|
6616
|
+
}),
|
|
6617
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs25("div", { className: "px-2 text-[11px] text-muted-foreground", children: [
|
|
6618
|
+
"+",
|
|
6619
|
+
hiddenCount,
|
|
6620
|
+
" more"
|
|
6621
|
+
] })
|
|
6622
|
+
] })
|
|
6623
|
+
]
|
|
6624
|
+
},
|
|
6625
|
+
`${monthLabel}-${idx}`
|
|
6626
|
+
);
|
|
6627
|
+
}
|
|
6511
6628
|
return /* @__PURE__ */ jsxs25(
|
|
6512
6629
|
"button",
|
|
6513
6630
|
{
|
|
@@ -6518,6 +6635,7 @@ function Calendar2({
|
|
|
6518
6635
|
sz.day,
|
|
6519
6636
|
!inMonth && "text-muted-foreground/60",
|
|
6520
6637
|
disabled && "opacity-40 cursor-not-allowed",
|
|
6638
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6521
6639
|
isToday2 && !selectedDay && "ring-1 ring-primary/50",
|
|
6522
6640
|
selectedDay && "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
6523
6641
|
!selectedDay && "hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
|
|
@@ -6525,7 +6643,14 @@ function Calendar2({
|
|
|
6525
6643
|
title: d.toDateString(),
|
|
6526
6644
|
children: [
|
|
6527
6645
|
d.getDate(),
|
|
6528
|
-
dayEvents.length > 0 && /* @__PURE__ */ jsx30("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ jsx30(
|
|
6646
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsx30("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ jsx30(
|
|
6647
|
+
"span",
|
|
6648
|
+
{
|
|
6649
|
+
className: "h-1.5 w-1.5 rounded-full",
|
|
6650
|
+
style: { backgroundColor: e.color || "hsl(var(--primary))" }
|
|
6651
|
+
},
|
|
6652
|
+
String(e.id ?? i)
|
|
6653
|
+
)) })
|
|
6529
6654
|
]
|
|
6530
6655
|
},
|
|
6531
6656
|
`${monthLabel}-${idx}`
|
|
@@ -6588,6 +6713,82 @@ function Calendar2({
|
|
|
6588
6713
|
const k = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
6589
6714
|
const dayEvents = byDay.get(k) || [];
|
|
6590
6715
|
const disabled = isDateDisabled(d);
|
|
6716
|
+
const isWeekend = d.getDay() === 0 || d.getDay() === 6;
|
|
6717
|
+
const customDay = renderDay?.({ date: d, isCurrentMonth: inMonth, isToday: isToday2, isSelected: selectedDay, events: dayEvents });
|
|
6718
|
+
if (customDay) return /* @__PURE__ */ jsx30(React24.Fragment, { children: customDay }, `wd-${idx}`);
|
|
6719
|
+
if (cellMode === "events") {
|
|
6720
|
+
const limit = Math.max(0, maxEventsPerDay);
|
|
6721
|
+
const visibleEvents = dayEvents.slice(0, limit);
|
|
6722
|
+
const hiddenCount = Math.max(0, dayEvents.length - visibleEvents.length);
|
|
6723
|
+
return /* @__PURE__ */ jsxs25(
|
|
6724
|
+
"div",
|
|
6725
|
+
{
|
|
6726
|
+
className: cn(
|
|
6727
|
+
"rounded-xl border border-border/50 bg-background/40 overflow-hidden",
|
|
6728
|
+
"transition-colors duration-150",
|
|
6729
|
+
cellSz.cell,
|
|
6730
|
+
disabled && "opacity-40",
|
|
6731
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6732
|
+
isToday2 && !selectedDay && "ring-1 ring-primary/40",
|
|
6733
|
+
selectedDay && "border-primary/50 bg-primary/10"
|
|
6734
|
+
),
|
|
6735
|
+
children: [
|
|
6736
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center justify-between gap-2", children: [
|
|
6737
|
+
/* @__PURE__ */ jsx30(
|
|
6738
|
+
"button",
|
|
6739
|
+
{
|
|
6740
|
+
type: "button",
|
|
6741
|
+
onClick: () => !disabled && handleClickDay(d),
|
|
6742
|
+
disabled,
|
|
6743
|
+
className: cn(
|
|
6744
|
+
"inline-flex items-center justify-center rounded-lg px-2 py-1",
|
|
6745
|
+
"transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6746
|
+
cellSz.day,
|
|
6747
|
+
selectedDay ? "bg-primary text-primary-foreground" : "hover:bg-accent hover:text-accent-foreground",
|
|
6748
|
+
disabled && "cursor-not-allowed hover:bg-transparent"
|
|
6749
|
+
),
|
|
6750
|
+
title: d.toDateString(),
|
|
6751
|
+
children: d.getDate()
|
|
6752
|
+
}
|
|
6753
|
+
),
|
|
6754
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsx30("span", { className: "text-[11px] text-muted-foreground tabular-nums", children: dayEvents.length })
|
|
6755
|
+
] }),
|
|
6756
|
+
/* @__PURE__ */ jsxs25("div", { className: cn("mt-2 space-y-1", dense ? "mt-1.5" : "mt-2"), children: [
|
|
6757
|
+
visibleEvents.map((e, i) => {
|
|
6758
|
+
const key = e.id ?? `${k}-${i}`;
|
|
6759
|
+
const node = renderEvent?.({ event: e, date: d });
|
|
6760
|
+
if (node) return /* @__PURE__ */ jsx30("div", { children: node }, String(key));
|
|
6761
|
+
return /* @__PURE__ */ jsxs25(
|
|
6762
|
+
"button",
|
|
6763
|
+
{
|
|
6764
|
+
type: "button",
|
|
6765
|
+
onClick: () => onEventClick?.(e, d),
|
|
6766
|
+
className: cn(
|
|
6767
|
+
"w-full text-left rounded-lg px-2 py-1",
|
|
6768
|
+
"transition-colors duration-150 hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
6769
|
+
"text-xs flex items-center gap-2"
|
|
6770
|
+
),
|
|
6771
|
+
title: e.title,
|
|
6772
|
+
children: [
|
|
6773
|
+
/* @__PURE__ */ jsx30("span", { className: "h-2 w-2 rounded-full shrink-0", style: { backgroundColor: e.color || "hsl(var(--primary))" } }),
|
|
6774
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate flex-1", children: e.title ?? "Event" }),
|
|
6775
|
+
showEventBadges && e.badge && /* @__PURE__ */ jsx30("span", { className: "shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10px] text-muted-foreground", children: e.badge })
|
|
6776
|
+
]
|
|
6777
|
+
},
|
|
6778
|
+
String(key)
|
|
6779
|
+
);
|
|
6780
|
+
}),
|
|
6781
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs25("div", { className: "px-2 text-[11px] text-muted-foreground", children: [
|
|
6782
|
+
"+",
|
|
6783
|
+
hiddenCount,
|
|
6784
|
+
" more"
|
|
6785
|
+
] })
|
|
6786
|
+
] })
|
|
6787
|
+
]
|
|
6788
|
+
},
|
|
6789
|
+
`wd-${idx}`
|
|
6790
|
+
);
|
|
6791
|
+
}
|
|
6591
6792
|
return /* @__PURE__ */ jsxs25(
|
|
6592
6793
|
"button",
|
|
6593
6794
|
{
|
|
@@ -6597,6 +6798,7 @@ function Calendar2({
|
|
|
6597
6798
|
"rounded-lg flex items-center justify-center relative cursor-pointer",
|
|
6598
6799
|
sz.day,
|
|
6599
6800
|
disabled && "opacity-40 cursor-not-allowed",
|
|
6801
|
+
highlightWeekends && isWeekend && "bg-accent/10",
|
|
6600
6802
|
isToday2 && !selectedDay && "ring-1 ring-primary/50",
|
|
6601
6803
|
selectedDay && "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
6602
6804
|
!selectedDay && "hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"
|
|
@@ -6604,7 +6806,7 @@ function Calendar2({
|
|
|
6604
6806
|
title: d.toDateString(),
|
|
6605
6807
|
children: [
|
|
6606
6808
|
d.getDate(),
|
|
6607
|
-
dayEvents.length > 0 && /* @__PURE__ */ jsx30("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ jsx30("span", { className: "h-1.5 w-1.5 rounded-full", style: { backgroundColor: e.color || "hsl(var(--primary))" } }, i)) })
|
|
6809
|
+
dayEvents.length > 0 && /* @__PURE__ */ jsx30("span", { className: "absolute -bottom-1 inline-flex gap-0.5", children: dayEvents.slice(0, 3).map((e, i) => /* @__PURE__ */ jsx30("span", { className: "h-1.5 w-1.5 rounded-full", style: { backgroundColor: e.color || "hsl(var(--primary))" } }, String(e.id ?? i))) })
|
|
6608
6810
|
]
|
|
6609
6811
|
},
|
|
6610
6812
|
`wd-${idx}`
|
|
@@ -12547,7 +12749,7 @@ var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
|
12547
12749
|
var Grid_default = Grid;
|
|
12548
12750
|
|
|
12549
12751
|
// ../../components/ui/LineChart.tsx
|
|
12550
|
-
import { useMemo as
|
|
12752
|
+
import { useMemo as useMemo10, useState as useState36, useRef as useRef15 } from "react";
|
|
12551
12753
|
|
|
12552
12754
|
// ../../components/ui/ChartTooltip.tsx
|
|
12553
12755
|
import { useEffect as useEffect22, useState as useState35 } from "react";
|
|
@@ -12646,7 +12848,7 @@ function LineChart({
|
|
|
12646
12848
|
const chartWidth = width - padding.left - padding.right;
|
|
12647
12849
|
const chartHeight = height - padding.top - padding.bottom;
|
|
12648
12850
|
const [hoveredPoint, setHoveredPoint] = useState36(null);
|
|
12649
|
-
const { minValue, maxValue, points, linePath, areaPath } =
|
|
12851
|
+
const { minValue, maxValue, points, linePath, areaPath } = useMemo10(() => {
|
|
12650
12852
|
if (!data.length) return { minValue: 0, maxValue: 0, points: [], linePath: "", areaPath: "" };
|
|
12651
12853
|
const values = data.map((d) => d.value);
|
|
12652
12854
|
const min = Math.min(...values);
|
|
@@ -12681,7 +12883,7 @@ function LineChart({
|
|
|
12681
12883
|
}
|
|
12682
12884
|
return { minValue: min, maxValue: max, points: pts, linePath: path, areaPath: area };
|
|
12683
12885
|
}, [data, chartWidth, chartHeight, curved, padding.left, padding.top]);
|
|
12684
|
-
const gridLines =
|
|
12886
|
+
const gridLines = useMemo10(() => {
|
|
12685
12887
|
const lines = [];
|
|
12686
12888
|
const steps = 5;
|
|
12687
12889
|
for (let i = 0; i <= steps; i++) {
|
|
@@ -12799,7 +13001,7 @@ function LineChart({
|
|
|
12799
13001
|
}
|
|
12800
13002
|
|
|
12801
13003
|
// ../../components/ui/BarChart.tsx
|
|
12802
|
-
import { useMemo as
|
|
13004
|
+
import { useMemo as useMemo11, useState as useState37, useRef as useRef16 } from "react";
|
|
12803
13005
|
import { Fragment as Fragment21, jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
12804
13006
|
function BarChart({
|
|
12805
13007
|
data,
|
|
@@ -12820,7 +13022,7 @@ function BarChart({
|
|
|
12820
13022
|
const chartWidth = width - padding.left - padding.right;
|
|
12821
13023
|
const chartHeight = height - padding.top - padding.bottom;
|
|
12822
13024
|
const [hoveredBar, setHoveredBar] = useState37(null);
|
|
12823
|
-
const { maxValue, bars, gridLines } =
|
|
13025
|
+
const { maxValue, bars, gridLines } = useMemo11(() => {
|
|
12824
13026
|
if (!data.length) return { maxValue: 0, bars: [], gridLines: [] };
|
|
12825
13027
|
const max = Math.max(...data.map((d) => d.value));
|
|
12826
13028
|
const barCount = data.length;
|
|
@@ -12981,7 +13183,7 @@ function BarChart({
|
|
|
12981
13183
|
}
|
|
12982
13184
|
|
|
12983
13185
|
// ../../components/ui/PieChart.tsx
|
|
12984
|
-
import { useMemo as
|
|
13186
|
+
import { useMemo as useMemo12, useState as useState38, useRef as useRef17 } from "react";
|
|
12985
13187
|
import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
12986
13188
|
function PieChart({
|
|
12987
13189
|
data,
|
|
@@ -12999,7 +13201,7 @@ function PieChart({
|
|
|
12999
13201
|
const center = size / 2;
|
|
13000
13202
|
const radius = size / 2 - 10;
|
|
13001
13203
|
const innerRadius = donut ? radius - donutWidth : 0;
|
|
13002
|
-
const { segments, total } =
|
|
13204
|
+
const { segments, total } = useMemo12(() => {
|
|
13003
13205
|
if (!data.length) return { segments: [], total: 0 };
|
|
13004
13206
|
const sum = data.reduce((acc, d) => acc + d.value, 0);
|
|
13005
13207
|
let currentAngle = startAngle;
|
|
@@ -13146,7 +13348,7 @@ function PieChart({
|
|
|
13146
13348
|
}
|
|
13147
13349
|
|
|
13148
13350
|
// ../../components/ui/AreaChart.tsx
|
|
13149
|
-
import { useMemo as
|
|
13351
|
+
import { useMemo as useMemo13, useState as useState39, useRef as useRef18 } from "react";
|
|
13150
13352
|
import { jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13151
13353
|
function getCatmullRomSpline(points) {
|
|
13152
13354
|
if (points.length < 2) return "";
|
|
@@ -13186,7 +13388,7 @@ function AreaChart({
|
|
|
13186
13388
|
const chartWidth = width - padding.left - padding.right;
|
|
13187
13389
|
const chartHeight = height - padding.top - padding.bottom;
|
|
13188
13390
|
const [hoveredPoint, setHoveredPoint] = useState39(null);
|
|
13189
|
-
const { processedSeries, gridLines, maxValue, labels } =
|
|
13391
|
+
const { processedSeries, gridLines, maxValue, labels } = useMemo13(() => {
|
|
13190
13392
|
if (!series.length || !series[0]?.data?.length) {
|
|
13191
13393
|
return { processedSeries: [], gridLines: [], maxValue: 0, labels: [] };
|
|
13192
13394
|
}
|
|
@@ -13400,7 +13602,7 @@ function AreaChart({
|
|
|
13400
13602
|
}
|
|
13401
13603
|
|
|
13402
13604
|
// ../../components/ui/Sparkline.tsx
|
|
13403
|
-
import { useMemo as
|
|
13605
|
+
import { useMemo as useMemo14 } from "react";
|
|
13404
13606
|
import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
13405
13607
|
function getCatmullRomSpline2(points) {
|
|
13406
13608
|
if (points.length < 2) return "";
|
|
@@ -13439,7 +13641,7 @@ function Sparkline({
|
|
|
13439
13641
|
const padding = 4;
|
|
13440
13642
|
const chartWidth = width - padding * 2;
|
|
13441
13643
|
const chartHeight = height - padding * 2;
|
|
13442
|
-
const { points, linePath, areaPath, lineLength, trend } =
|
|
13644
|
+
const { points, linePath, areaPath, lineLength, trend } = useMemo14(() => {
|
|
13443
13645
|
const normalizedData = data.map((d) => typeof d === "number" ? d : d.value);
|
|
13444
13646
|
if (!normalizedData.length) {
|
|
13445
13647
|
return { points: [], linePath: "", areaPath: "", lineLength: 0, trend: 0 };
|
|
@@ -13543,7 +13745,7 @@ function Sparkline({
|
|
|
13543
13745
|
}
|
|
13544
13746
|
|
|
13545
13747
|
// ../../components/ui/RadarChart.tsx
|
|
13546
|
-
import { useMemo as
|
|
13748
|
+
import { useMemo as useMemo15, useState as useState40, useRef as useRef19 } from "react";
|
|
13547
13749
|
import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
13548
13750
|
function RadarChart({
|
|
13549
13751
|
series,
|
|
@@ -13559,7 +13761,7 @@ function RadarChart({
|
|
|
13559
13761
|
const center = size / 2;
|
|
13560
13762
|
const radius = size / 2 - 40;
|
|
13561
13763
|
const [hoveredPoint, setHoveredPoint] = useState40(null);
|
|
13562
|
-
const { axes, processedSeries, levelPaths } =
|
|
13764
|
+
const { axes, processedSeries, levelPaths } = useMemo15(() => {
|
|
13563
13765
|
if (!series.length || !series[0]?.data?.length) {
|
|
13564
13766
|
return { axes: [], processedSeries: [], levelPaths: [] };
|
|
13565
13767
|
}
|
|
@@ -13743,7 +13945,7 @@ function RadarChart({
|
|
|
13743
13945
|
}
|
|
13744
13946
|
|
|
13745
13947
|
// ../../components/ui/GaugeChart.tsx
|
|
13746
|
-
import { useMemo as
|
|
13948
|
+
import { useMemo as useMemo16 } from "react";
|
|
13747
13949
|
import { jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
13748
13950
|
function GaugeChart({
|
|
13749
13951
|
value,
|
|
@@ -13763,7 +13965,7 @@ function GaugeChart({
|
|
|
13763
13965
|
}) {
|
|
13764
13966
|
const center = size / 2;
|
|
13765
13967
|
const radius = center - thickness / 2 - 10;
|
|
13766
|
-
const { backgroundPath, valuePath, percentage, needleAngle } =
|
|
13968
|
+
const { backgroundPath, valuePath, percentage, needleAngle } = useMemo16(() => {
|
|
13767
13969
|
const normalizedValue = Math.min(Math.max(value, min), max);
|
|
13768
13970
|
const pct = (normalizedValue - min) / (max - min);
|
|
13769
13971
|
const totalAngle = endAngle - startAngle;
|
|
@@ -16366,7 +16568,7 @@ function useSmartLocale() {
|
|
|
16366
16568
|
}
|
|
16367
16569
|
|
|
16368
16570
|
// ../../components/ui/UEditor/UEditor.tsx
|
|
16369
|
-
import { useEffect as useEffect30, useMemo as
|
|
16571
|
+
import { useEffect as useEffect30, useMemo as useMemo19 } from "react";
|
|
16370
16572
|
import { useTranslations as useTranslations7 } from "next-intl";
|
|
16371
16573
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
16372
16574
|
|
|
@@ -17098,13 +17300,13 @@ import {
|
|
|
17098
17300
|
} from "lucide-react";
|
|
17099
17301
|
|
|
17100
17302
|
// ../../components/ui/UEditor/colors.tsx
|
|
17101
|
-
import { useMemo as
|
|
17303
|
+
import { useMemo as useMemo17 } from "react";
|
|
17102
17304
|
import { useTranslations as useTranslations2 } from "next-intl";
|
|
17103
17305
|
import { X as X14 } from "lucide-react";
|
|
17104
17306
|
import { jsx as jsx71, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
17105
17307
|
var useEditorColors = () => {
|
|
17106
17308
|
const t = useTranslations2("UEditor");
|
|
17107
|
-
const textColors =
|
|
17309
|
+
const textColors = useMemo17(
|
|
17108
17310
|
() => [
|
|
17109
17311
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
17110
17312
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -17117,7 +17319,7 @@ var useEditorColors = () => {
|
|
|
17117
17319
|
],
|
|
17118
17320
|
[t]
|
|
17119
17321
|
);
|
|
17120
|
-
const highlightColors =
|
|
17322
|
+
const highlightColors = useMemo17(
|
|
17121
17323
|
() => [
|
|
17122
17324
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
17123
17325
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -17731,7 +17933,7 @@ var EditorToolbar = ({
|
|
|
17731
17933
|
};
|
|
17732
17934
|
|
|
17733
17935
|
// ../../components/ui/UEditor/menus.tsx
|
|
17734
|
-
import { useCallback as useCallback13, useEffect as useEffect29, useMemo as
|
|
17936
|
+
import { useCallback as useCallback13, useEffect as useEffect29, useMemo as useMemo18, useRef as useRef26, useState as useState48 } from "react";
|
|
17735
17937
|
import { createPortal as createPortal9 } from "react-dom";
|
|
17736
17938
|
import { useTranslations as useTranslations5 } from "next-intl";
|
|
17737
17939
|
import {
|
|
@@ -17762,7 +17964,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
17762
17964
|
const t = useTranslations5("UEditor");
|
|
17763
17965
|
const [selectedIndex, setSelectedIndex] = useState48(0);
|
|
17764
17966
|
const menuRef = useRef26(null);
|
|
17765
|
-
const allCommands =
|
|
17967
|
+
const allCommands = useMemo18(
|
|
17766
17968
|
() => [
|
|
17767
17969
|
{
|
|
17768
17970
|
icon: Type3,
|
|
@@ -17833,7 +18035,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
17833
18035
|
],
|
|
17834
18036
|
[editor, t]
|
|
17835
18037
|
);
|
|
17836
|
-
const commands =
|
|
18038
|
+
const commands = useMemo18(() => {
|
|
17837
18039
|
if (!filterText) return allCommands;
|
|
17838
18040
|
const lowerFilter = filterText.toLowerCase();
|
|
17839
18041
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
@@ -18225,7 +18427,7 @@ var UEditor = ({
|
|
|
18225
18427
|
}) => {
|
|
18226
18428
|
const t = useTranslations7("UEditor");
|
|
18227
18429
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
18228
|
-
const extensions =
|
|
18430
|
+
const extensions = useMemo19(
|
|
18229
18431
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
18230
18432
|
[effectivePlaceholder, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
18231
18433
|
);
|