@underverse-ui/underverse 0.2.85 → 0.2.86
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 +102 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +102 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7987,6 +7987,7 @@ function defaultEventTime(args) {
|
|
|
7987
7987
|
function CalendarTimeline({
|
|
7988
7988
|
resources,
|
|
7989
7989
|
events,
|
|
7990
|
+
size = "md",
|
|
7990
7991
|
view,
|
|
7991
7992
|
defaultView = "month",
|
|
7992
7993
|
onViewChange,
|
|
@@ -8002,9 +8003,9 @@ function CalendarTimeline({
|
|
|
8002
8003
|
groupCollapsed,
|
|
8003
8004
|
defaultGroupCollapsed,
|
|
8004
8005
|
onGroupCollapsedChange,
|
|
8005
|
-
resourceColumnWidth
|
|
8006
|
-
rowHeight
|
|
8007
|
-
slotMinWidth
|
|
8006
|
+
resourceColumnWidth,
|
|
8007
|
+
rowHeight,
|
|
8008
|
+
slotMinWidth,
|
|
8008
8009
|
dayTimeStepMinutes = 60,
|
|
8009
8010
|
maxLanesPerRow = 3,
|
|
8010
8011
|
now,
|
|
@@ -8027,6 +8028,62 @@ function CalendarTimeline({
|
|
|
8027
8028
|
const detectedLocale = useLocale();
|
|
8028
8029
|
const resolvedLocale = React28.useMemo(() => localeToBCP47(locale ?? detectedLocale), [locale, detectedLocale]);
|
|
8029
8030
|
const resolvedTimeZone = React28.useMemo(() => timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC", [timeZone]);
|
|
8031
|
+
const sizeConfig = React28.useMemo(() => {
|
|
8032
|
+
const cfgBySize = {
|
|
8033
|
+
sm: {
|
|
8034
|
+
resourceColumnWidth: 200,
|
|
8035
|
+
rowHeight: 44,
|
|
8036
|
+
slotMinWidth: 52,
|
|
8037
|
+
eventHeight: 16,
|
|
8038
|
+
laneGap: 3,
|
|
8039
|
+
lanePaddingY: 5,
|
|
8040
|
+
densityClass: "text-xs",
|
|
8041
|
+
headerPaddingClass: "px-3 py-2",
|
|
8042
|
+
titleClass: "text-base",
|
|
8043
|
+
resourceRowClass: "gap-2 px-3",
|
|
8044
|
+
groupRowClass: "gap-2 px-3",
|
|
8045
|
+
slotHeaderClass: "px-1 py-2",
|
|
8046
|
+
controlButtonIconClass: "h-7 w-7",
|
|
8047
|
+
controlButtonTextClass: "h-7 px-2 text-xs"
|
|
8048
|
+
},
|
|
8049
|
+
md: {
|
|
8050
|
+
resourceColumnWidth: 240,
|
|
8051
|
+
rowHeight: 52,
|
|
8052
|
+
slotMinWidth: 64,
|
|
8053
|
+
eventHeight: 18,
|
|
8054
|
+
laneGap: 4,
|
|
8055
|
+
lanePaddingY: 6,
|
|
8056
|
+
densityClass: "text-sm",
|
|
8057
|
+
headerPaddingClass: "px-4 py-3",
|
|
8058
|
+
titleClass: "text-lg",
|
|
8059
|
+
resourceRowClass: "gap-3 px-4",
|
|
8060
|
+
groupRowClass: "gap-3 px-4",
|
|
8061
|
+
slotHeaderClass: "px-1 py-3",
|
|
8062
|
+
controlButtonIconClass: "h-8 w-8",
|
|
8063
|
+
controlButtonTextClass: "h-8 px-3"
|
|
8064
|
+
},
|
|
8065
|
+
xl: {
|
|
8066
|
+
resourceColumnWidth: 280,
|
|
8067
|
+
rowHeight: 60,
|
|
8068
|
+
slotMinWidth: 76,
|
|
8069
|
+
eventHeight: 20,
|
|
8070
|
+
laneGap: 5,
|
|
8071
|
+
lanePaddingY: 8,
|
|
8072
|
+
densityClass: "text-base",
|
|
8073
|
+
headerPaddingClass: "px-5 py-4",
|
|
8074
|
+
titleClass: "text-xl",
|
|
8075
|
+
resourceRowClass: "gap-4 px-5",
|
|
8076
|
+
groupRowClass: "gap-4 px-5",
|
|
8077
|
+
slotHeaderClass: "px-2 py-4",
|
|
8078
|
+
controlButtonIconClass: "h-9 w-9",
|
|
8079
|
+
controlButtonTextClass: "h-9 px-4 text-sm"
|
|
8080
|
+
}
|
|
8081
|
+
};
|
|
8082
|
+
return cfgBySize[size];
|
|
8083
|
+
}, [size]);
|
|
8084
|
+
const effectiveResourceColumnWidth = resourceColumnWidth ?? sizeConfig.resourceColumnWidth;
|
|
8085
|
+
const effectiveRowHeight = rowHeight ?? sizeConfig.rowHeight;
|
|
8086
|
+
const effectiveSlotMinWidth = slotMinWidth ?? sizeConfig.slotMinWidth;
|
|
8030
8087
|
const isControlledView = view !== void 0;
|
|
8031
8088
|
const [internalView, setInternalView] = React28.useState(defaultView);
|
|
8032
8089
|
const activeView = isControlledView ? view : internalView;
|
|
@@ -8156,7 +8213,7 @@ function CalendarTimeline({
|
|
|
8156
8213
|
onRangeChange?.(range);
|
|
8157
8214
|
}, [range.start, range.end, onRangeChange]);
|
|
8158
8215
|
const slotStarts = React28.useMemo(() => slots.map((s) => s.start), [slots]);
|
|
8159
|
-
const slotWidth =
|
|
8216
|
+
const slotWidth = effectiveSlotMinWidth;
|
|
8160
8217
|
const gridWidth = slots.length * slotWidth;
|
|
8161
8218
|
const normalizedEvents = React28.useMemo(() => {
|
|
8162
8219
|
const rangeStart = range.start.getTime();
|
|
@@ -8188,10 +8245,10 @@ function CalendarTimeline({
|
|
|
8188
8245
|
const title = React28.useMemo(() => {
|
|
8189
8246
|
return formatters?.monthTitle?.(activeDate, { locale: resolvedLocale, timeZone: resolvedTimeZone }) ?? defaultMonthTitle(activeDate, resolvedLocale, resolvedTimeZone);
|
|
8190
8247
|
}, [activeDate, formatters, resolvedLocale, resolvedTimeZone]);
|
|
8191
|
-
const densityClass =
|
|
8192
|
-
const eventHeight =
|
|
8193
|
-
const laneGap =
|
|
8194
|
-
const lanePaddingY =
|
|
8248
|
+
const densityClass = sizeConfig.densityClass;
|
|
8249
|
+
const eventHeight = sizeConfig.eventHeight;
|
|
8250
|
+
const laneGap = sizeConfig.laneGap;
|
|
8251
|
+
const lanePaddingY = sizeConfig.lanePaddingY;
|
|
8195
8252
|
const virt = virtualization?.enabled;
|
|
8196
8253
|
const overscan = virtualization?.overscan ?? 8;
|
|
8197
8254
|
const {
|
|
@@ -8202,7 +8259,7 @@ function CalendarTimeline({
|
|
|
8202
8259
|
} = useVirtualRows({
|
|
8203
8260
|
enabled: virt,
|
|
8204
8261
|
overscan,
|
|
8205
|
-
rowHeight,
|
|
8262
|
+
rowHeight: effectiveRowHeight,
|
|
8206
8263
|
itemCount: rows.length,
|
|
8207
8264
|
scrollRef: bodyRef
|
|
8208
8265
|
});
|
|
@@ -8349,8 +8406,9 @@ function CalendarTimeline({
|
|
|
8349
8406
|
type: "button",
|
|
8350
8407
|
onClick: canToggle ? toggle : void 0,
|
|
8351
8408
|
className: cn(
|
|
8352
|
-
"w-full h-full flex items-center
|
|
8353
|
-
|
|
8409
|
+
"w-full h-full flex items-center text-left",
|
|
8410
|
+
sizeConfig.groupRowClass,
|
|
8411
|
+
"bg-linear-to-r from-muted/40 to-muted/20 border-b border-border/40",
|
|
8354
8412
|
"backdrop-blur-sm",
|
|
8355
8413
|
canToggle ? "cursor-pointer hover:from-muted/60 hover:to-muted/30 transition-all duration-200" : "cursor-default"
|
|
8356
8414
|
),
|
|
@@ -8387,7 +8445,8 @@ function CalendarTimeline({
|
|
|
8387
8445
|
"div",
|
|
8388
8446
|
{
|
|
8389
8447
|
className: cn(
|
|
8390
|
-
"
|
|
8448
|
+
"shrink-0 border-l border-border/30 flex items-center justify-center transition-colors duration-150",
|
|
8449
|
+
sizeConfig.slotHeaderClass,
|
|
8391
8450
|
s.isToday && "bg-primary/8 border-l-primary/40"
|
|
8392
8451
|
),
|
|
8393
8452
|
style: { width: slotWidth, minWidth: slotWidth },
|
|
@@ -8406,8 +8465,8 @@ function CalendarTimeline({
|
|
|
8406
8465
|
week: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.CalendarDays, { className: "h-4 w-4" }),
|
|
8407
8466
|
day: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Calendar, { className: "h-4 w-4" })
|
|
8408
8467
|
};
|
|
8409
|
-
const Header = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sticky top-0 z-30 bg-
|
|
8410
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between gap-4
|
|
8468
|
+
const Header = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "sticky top-0 z-30 bg-linear-to-b from-background via-background to-background/95 border-b border-border/40 backdrop-blur-xl", children: [
|
|
8469
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: cn("flex items-center justify-between gap-4", sizeConfig.headerPaddingClass), children: [
|
|
8411
8470
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
8412
8471
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center bg-muted/40 rounded-xl p-1 gap-0.5", children: [
|
|
8413
8472
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
@@ -8417,7 +8476,7 @@ function CalendarTimeline({
|
|
|
8417
8476
|
size: "icon",
|
|
8418
8477
|
onClick: () => navigate(-1),
|
|
8419
8478
|
"aria-label": l.prev,
|
|
8420
|
-
className: "
|
|
8479
|
+
className: cn(sizeConfig.controlButtonIconClass, "rounded-lg hover:bg-background/80 transition-all duration-200"),
|
|
8421
8480
|
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.ChevronLeft, { className: "h-4 w-4" })
|
|
8422
8481
|
}
|
|
8423
8482
|
),
|
|
@@ -8427,7 +8486,7 @@ function CalendarTimeline({
|
|
|
8427
8486
|
variant: "ghost",
|
|
8428
8487
|
size: "sm",
|
|
8429
8488
|
onClick: goToday,
|
|
8430
|
-
className: "
|
|
8489
|
+
className: cn(sizeConfig.controlButtonTextClass, "rounded-lg hover:bg-background/80 font-medium transition-all duration-200"),
|
|
8431
8490
|
children: l.today
|
|
8432
8491
|
}
|
|
8433
8492
|
),
|
|
@@ -8438,12 +8497,12 @@ function CalendarTimeline({
|
|
|
8438
8497
|
size: "icon",
|
|
8439
8498
|
onClick: () => navigate(1),
|
|
8440
8499
|
"aria-label": l.next,
|
|
8441
|
-
className: "
|
|
8500
|
+
className: cn(sizeConfig.controlButtonIconClass, "rounded-lg hover:bg-background/80 transition-all duration-200"),
|
|
8442
8501
|
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.ChevronRight, { className: "h-4 w-4" })
|
|
8443
8502
|
}
|
|
8444
8503
|
)
|
|
8445
8504
|
] }),
|
|
8446
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "ml-3
|
|
8505
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: cn("ml-3 font-semibold tracking-tight truncate text-foreground", sizeConfig.titleClass), children: title })
|
|
8447
8506
|
] }),
|
|
8448
8507
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex items-center bg-muted/40 rounded-xl p-1 gap-0.5", children: ["month", "week", "day"].map((v) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8449
8508
|
Button_default,
|
|
@@ -8452,7 +8511,8 @@ function CalendarTimeline({
|
|
|
8452
8511
|
size: "sm",
|
|
8453
8512
|
onClick: () => setView(v),
|
|
8454
8513
|
className: cn(
|
|
8455
|
-
|
|
8514
|
+
sizeConfig.controlButtonTextClass,
|
|
8515
|
+
"rounded-lg font-medium transition-all duration-200 gap-1.5",
|
|
8456
8516
|
activeView === v ? "bg-primary text-primary-foreground shadow-sm shadow-primary/25" : "hover:bg-background/80 text-muted-foreground hover:text-foreground"
|
|
8457
8517
|
),
|
|
8458
8518
|
children: [
|
|
@@ -8467,9 +8527,9 @@ function CalendarTimeline({
|
|
|
8467
8527
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8468
8528
|
"div",
|
|
8469
8529
|
{
|
|
8470
|
-
className: "
|
|
8471
|
-
style: { width:
|
|
8472
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-xs font-medium text-muted-foreground/70 uppercase tracking-wider", children: "
|
|
8530
|
+
className: "shrink-0 border-r border-border/30 bg-muted/20 flex items-center justify-center",
|
|
8531
|
+
style: { width: effectiveResourceColumnWidth, minWidth: effectiveResourceColumnWidth },
|
|
8532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-xs font-medium text-muted-foreground/70 uppercase tracking-wider", children: t("resourcesHeader") })
|
|
8473
8533
|
}
|
|
8474
8534
|
),
|
|
8475
8535
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { ref: headerRef, className: "overflow-x-auto overflow-y-hidden scrollbar-none", children: slotHeaderNodes })
|
|
@@ -8479,11 +8539,12 @@ function CalendarTimeline({
|
|
|
8479
8539
|
"div",
|
|
8480
8540
|
{
|
|
8481
8541
|
className: cn(
|
|
8482
|
-
"h-full w-full flex items-center
|
|
8542
|
+
"h-full w-full flex items-center border-b border-border/30 bg-linear-to-r from-background to-background/95",
|
|
8543
|
+
sizeConfig.resourceRowClass,
|
|
8483
8544
|
"hover:from-muted/30 hover:to-muted/10 transition-all duration-200 group"
|
|
8484
8545
|
),
|
|
8485
8546
|
children: [
|
|
8486
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "
|
|
8547
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "shrink-0 opacity-0 group-hover:opacity-60 transition-opacity cursor-grab", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.GripVertical, { className: "h-4 w-4 text-muted-foreground" }) }),
|
|
8487
8548
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: cn("flex-1 min-w-0", r.disabled && "opacity-50"), children: renderResource ? renderResource(r) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "font-medium text-sm truncate block", children: r.label }) })
|
|
8488
8549
|
]
|
|
8489
8550
|
}
|
|
@@ -8538,9 +8599,16 @@ function CalendarTimeline({
|
|
|
8538
8599
|
rows.slice(startRow, endRow).map((row, idx) => {
|
|
8539
8600
|
const rowIndex = startRow + idx;
|
|
8540
8601
|
if (row.kind === "group") {
|
|
8541
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex", style: { height:
|
|
8542
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8543
|
-
|
|
8602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex", style: { height: effectiveRowHeight }, children: [
|
|
8603
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8604
|
+
"div",
|
|
8605
|
+
{
|
|
8606
|
+
className: "shrink-0 sticky left-0 z-20",
|
|
8607
|
+
style: { width: effectiveResourceColumnWidth, minWidth: effectiveResourceColumnWidth },
|
|
8608
|
+
children: renderGroupRow(row.group)
|
|
8609
|
+
}
|
|
8610
|
+
),
|
|
8611
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex-1 border-b border-border/30 bg-linear-to-r from-muted/15 to-muted/5", style: { minWidth: gridWidth } })
|
|
8544
8612
|
] }, `g_${row.group.id}_${rowIndex}`);
|
|
8545
8613
|
}
|
|
8546
8614
|
const r = row.resource;
|
|
@@ -8550,18 +8618,18 @@ function CalendarTimeline({
|
|
|
8550
8618
|
"div",
|
|
8551
8619
|
{
|
|
8552
8620
|
className: "flex group/row hover:bg-muted/5 transition-colors duration-150",
|
|
8553
|
-
style: { height:
|
|
8621
|
+
style: { height: effectiveRowHeight },
|
|
8554
8622
|
"data-uv-ct-row": r.id,
|
|
8555
8623
|
children: [
|
|
8556
8624
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8557
8625
|
"div",
|
|
8558
8626
|
{
|
|
8559
|
-
className: "
|
|
8560
|
-
style: { width:
|
|
8627
|
+
className: "shrink-0 sticky left-0 z-20 border-r border-border/30",
|
|
8628
|
+
style: { width: effectiveResourceColumnWidth, minWidth: effectiveResourceColumnWidth },
|
|
8561
8629
|
children: ResourceCell(r)
|
|
8562
8630
|
}
|
|
8563
8631
|
),
|
|
8564
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative
|
|
8632
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative shrink-0", style: { width: gridWidth, minWidth: gridWidth }, children: [
|
|
8565
8633
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute inset-0", onPointerDown: onPointerDownCell, "data-uv-ct-timeline": true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute inset-0 flex", children: slots.map((s, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8566
8634
|
"div",
|
|
8567
8635
|
{
|
|
@@ -18176,9 +18244,9 @@ var UEditor = ({
|
|
|
18176
18244
|
"[&_ul[data-type='taskList']_li>label>input]:border-2",
|
|
18177
18245
|
"[&_ul[data-type='taskList']_li>label>input]:border-primary/50",
|
|
18178
18246
|
"[&_ul[data-type='taskList']_li>label>input]:accent-primary",
|
|
18179
|
-
"[&_pre]
|
|
18180
|
-
"[&_pre]
|
|
18181
|
-
"[&_pre_code]
|
|
18247
|
+
"[&_pre]:bg-[#1e1e1e]!",
|
|
18248
|
+
"[&_pre]:text-[#d4d4d4]!",
|
|
18249
|
+
"[&_pre_code]:bg-transparent!",
|
|
18182
18250
|
"[&_img.ProseMirror-selectednode]:ring-2",
|
|
18183
18251
|
"[&_img.ProseMirror-selectednode]:ring-primary/60",
|
|
18184
18252
|
"[&_img.ProseMirror-selectednode]:ring-offset-2",
|