@underverse-ui/underverse 1.0.1 → 1.0.4
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 +35 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +35 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -403,6 +403,8 @@ var Badge = ({
|
|
|
403
403
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1",
|
|
404
404
|
clickable && "cursor-pointer hover:shadow-sm active:scale-95",
|
|
405
405
|
pulse && "animate-pulse",
|
|
406
|
+
"relative z-0",
|
|
407
|
+
// Ensure badges stay below sticky headers (z-20, z-50)
|
|
406
408
|
variantStyles[variant]
|
|
407
409
|
);
|
|
408
410
|
if (dot) {
|
|
@@ -8955,6 +8957,8 @@ function CalendarTimelineHeader(props) {
|
|
|
8955
8957
|
newEventDisabled,
|
|
8956
8958
|
onNewEventClick,
|
|
8957
8959
|
activeView,
|
|
8960
|
+
availableViews,
|
|
8961
|
+
showResourceColumn,
|
|
8958
8962
|
sizeConfig,
|
|
8959
8963
|
navigate,
|
|
8960
8964
|
now,
|
|
@@ -8966,6 +8970,12 @@ function CalendarTimelineHeader(props) {
|
|
|
8966
8970
|
headerRef,
|
|
8967
8971
|
slotHeaderNodes
|
|
8968
8972
|
} = props;
|
|
8973
|
+
const resolvedAvailableViews = React28.useMemo(
|
|
8974
|
+
() => availableViews?.length ? availableViews : ["month", "week", "day"],
|
|
8975
|
+
[availableViews]
|
|
8976
|
+
);
|
|
8977
|
+
const showViewSwitcher = resolvedAvailableViews.length > 1;
|
|
8978
|
+
const showLeftColumn = showResourceColumn ?? true;
|
|
8969
8979
|
const dt = useTranslations("DateTimePicker");
|
|
8970
8980
|
const locale = useLocale();
|
|
8971
8981
|
const [todayOpen, setTodayOpen] = React28.useState(false);
|
|
@@ -9150,7 +9160,7 @@ function CalendarTimelineHeader(props) {
|
|
|
9150
9160
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "hidden sm:inline", children: newEventLabel })
|
|
9151
9161
|
}
|
|
9152
9162
|
) : null,
|
|
9153
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-full p-1 gap-0.5", children:
|
|
9163
|
+
showViewSwitcher ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-full p-1 gap-0.5", children: resolvedAvailableViews.map((v) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9154
9164
|
Button_default,
|
|
9155
9165
|
{
|
|
9156
9166
|
variant: activeView === v ? "default" : "ghost",
|
|
@@ -9167,11 +9177,11 @@ function CalendarTimelineHeader(props) {
|
|
|
9167
9177
|
]
|
|
9168
9178
|
},
|
|
9169
9179
|
v
|
|
9170
|
-
)) })
|
|
9180
|
+
)) }) : null
|
|
9171
9181
|
] })
|
|
9172
9182
|
] }),
|
|
9173
9183
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex border-t border-border/20", children: [
|
|
9174
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9184
|
+
showLeftColumn ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9175
9185
|
"div",
|
|
9176
9186
|
{
|
|
9177
9187
|
className: "shrink-0 border-r border-border/30 bg-muted/20 flex items-center justify-center relative group/uv-ct-top-left",
|
|
@@ -9200,7 +9210,7 @@ function CalendarTimelineHeader(props) {
|
|
|
9200
9210
|
) : null
|
|
9201
9211
|
]
|
|
9202
9212
|
}
|
|
9203
|
-
),
|
|
9213
|
+
) : null,
|
|
9204
9214
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: headerRef, className: "flex-1 min-w-0 overflow-x-auto overflow-y-hidden scrollbar-none", children: slotHeaderNodes })
|
|
9205
9215
|
] })
|
|
9206
9216
|
] });
|
|
@@ -9683,6 +9693,7 @@ function CalendarTimeline({
|
|
|
9683
9693
|
eventSheetOpen,
|
|
9684
9694
|
defaultEventSheetOpen,
|
|
9685
9695
|
onEventSheetOpenChange,
|
|
9696
|
+
onlyView,
|
|
9686
9697
|
view,
|
|
9687
9698
|
defaultView = "month",
|
|
9688
9699
|
onViewChange,
|
|
@@ -9698,6 +9709,7 @@ function CalendarTimeline({
|
|
|
9698
9709
|
groupCollapsed,
|
|
9699
9710
|
defaultGroupCollapsed,
|
|
9700
9711
|
onGroupCollapsedChange,
|
|
9712
|
+
hideResourceColumn,
|
|
9701
9713
|
resourceColumnWidth,
|
|
9702
9714
|
defaultResourceColumnWidth,
|
|
9703
9715
|
onResourceColumnWidthChange,
|
|
@@ -9770,6 +9782,7 @@ function CalendarTimeline({
|
|
|
9770
9782
|
},
|
|
9771
9783
|
[isControlledEventSheetOpen, onEventSheetOpenChange, setSelectedEventId]
|
|
9772
9784
|
);
|
|
9785
|
+
const showResourceColumn = !hideResourceColumn;
|
|
9773
9786
|
const sizeConfig = React32.useMemo(() => getSizeConfig(size), [size]);
|
|
9774
9787
|
const densityClass = sizeConfig.densityClass;
|
|
9775
9788
|
const eventHeight = sizeConfig.eventHeight;
|
|
@@ -9779,16 +9792,18 @@ function CalendarTimeline({
|
|
|
9779
9792
|
const cfg = enableLayoutResize;
|
|
9780
9793
|
if (!cfg) return false;
|
|
9781
9794
|
if (isViewOnly) return false;
|
|
9795
|
+
if (!showResourceColumn) return false;
|
|
9782
9796
|
if (cfg === true) return true;
|
|
9783
9797
|
return cfg.column !== false;
|
|
9784
|
-
}, [enableLayoutResize, isViewOnly]);
|
|
9798
|
+
}, [enableLayoutResize, isViewOnly, showResourceColumn]);
|
|
9785
9799
|
const canResizeRow = React32.useMemo(() => {
|
|
9786
9800
|
const cfg = enableLayoutResize;
|
|
9787
9801
|
if (!cfg) return false;
|
|
9788
9802
|
if (isViewOnly) return false;
|
|
9803
|
+
if (!showResourceColumn) return false;
|
|
9789
9804
|
if (cfg === true) return true;
|
|
9790
9805
|
return cfg.row !== false;
|
|
9791
|
-
}, [enableLayoutResize, isViewOnly]);
|
|
9806
|
+
}, [enableLayoutResize, isViewOnly, showResourceColumn]);
|
|
9792
9807
|
const isControlledResourceColumnWidth = resourceColumnWidth !== void 0;
|
|
9793
9808
|
const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React32.useState(() => {
|
|
9794
9809
|
const init = defaultResourceColumnWidth ?? sizeConfig.resourceColumnWidth;
|
|
@@ -9799,7 +9814,7 @@ function CalendarTimeline({
|
|
|
9799
9814
|
if (defaultResourceColumnWidth == null) return;
|
|
9800
9815
|
setInternalResourceColumnWidth(defaultResourceColumnWidth);
|
|
9801
9816
|
}, [defaultResourceColumnWidth, isControlledResourceColumnWidth]);
|
|
9802
|
-
const effectiveResourceColumnWidth = isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth;
|
|
9817
|
+
const effectiveResourceColumnWidth = showResourceColumn ? isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth : 0;
|
|
9803
9818
|
const isControlledRowHeight = rowHeight !== void 0;
|
|
9804
9819
|
const [internalRowHeight, setInternalRowHeight] = React32.useState(() => defaultRowHeight ?? sizeConfig.rowHeight);
|
|
9805
9820
|
React32.useEffect(() => {
|
|
@@ -9813,9 +9828,13 @@ function CalendarTimeline({
|
|
|
9813
9828
|
const colMax = maxResourceColumnWidth ?? 520;
|
|
9814
9829
|
const rowMin = minRowHeight ?? 36;
|
|
9815
9830
|
const rowMax = maxRowHeight ?? 120;
|
|
9831
|
+
const availableViews = React32.useMemo(
|
|
9832
|
+
() => onlyView ? [onlyView] : ["month", "week", "day"],
|
|
9833
|
+
[onlyView]
|
|
9834
|
+
);
|
|
9816
9835
|
const isControlledView = view !== void 0;
|
|
9817
|
-
const [internalView, setInternalView] = React32.useState(defaultView);
|
|
9818
|
-
const activeView = isControlledView ? view : internalView;
|
|
9836
|
+
const [internalView, setInternalView] = React32.useState(() => onlyView ?? defaultView);
|
|
9837
|
+
const activeView = onlyView ? onlyView : isControlledView ? view : internalView;
|
|
9819
9838
|
const isControlledDate = date !== void 0;
|
|
9820
9839
|
const [internalDate, setInternalDate] = React32.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
|
|
9821
9840
|
const activeDate = isControlledDate ? date : internalDate;
|
|
@@ -9844,10 +9863,11 @@ function CalendarTimeline({
|
|
|
9844
9863
|
);
|
|
9845
9864
|
const setView = React32.useCallback(
|
|
9846
9865
|
(next) => {
|
|
9866
|
+
if (onlyView) return;
|
|
9847
9867
|
if (!isControlledView) setInternalView(next);
|
|
9848
9868
|
onViewChange?.(next);
|
|
9849
9869
|
},
|
|
9850
|
-
[isControlledView, onViewChange]
|
|
9870
|
+
[isControlledView, onViewChange, onlyView]
|
|
9851
9871
|
);
|
|
9852
9872
|
const setDate = React32.useCallback(
|
|
9853
9873
|
(next) => {
|
|
@@ -9956,7 +9976,7 @@ function CalendarTimeline({
|
|
|
9956
9976
|
setEventSheetOpen(false);
|
|
9957
9977
|
}
|
|
9958
9978
|
}, [activeEventSheetOpen, activeSelectedEventId, effectiveEnableEventSheet, selectedEvent, setEventSheetOpen]);
|
|
9959
|
-
useHorizontalScrollSync({ bodyRef, headerRef, leftRef });
|
|
9979
|
+
useHorizontalScrollSync({ bodyRef, headerRef, leftRef: showResourceColumn ? leftRef : void 0 });
|
|
9960
9980
|
const virt = virtualization?.enabled;
|
|
9961
9981
|
const overscan = virtualization?.overscan ?? 8;
|
|
9962
9982
|
const isControlledRowHeights = rowHeights !== void 0;
|
|
@@ -10577,6 +10597,8 @@ function CalendarTimeline({
|
|
|
10577
10597
|
newEventDisabled: isViewOnly || !canCreate || resources.length === 0,
|
|
10578
10598
|
onNewEventClick: isViewOnly ? void 0 : openCreate,
|
|
10579
10599
|
activeView,
|
|
10600
|
+
availableViews,
|
|
10601
|
+
showResourceColumn,
|
|
10580
10602
|
sizeConfig,
|
|
10581
10603
|
navigate,
|
|
10582
10604
|
now: resolvedNow,
|
|
@@ -10614,7 +10636,7 @@ function CalendarTimeline({
|
|
|
10614
10636
|
children: [
|
|
10615
10637
|
Header,
|
|
10616
10638
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex min-h-0", children: [
|
|
10617
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10639
|
+
showResourceColumn ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10618
10640
|
"div",
|
|
10619
10641
|
{
|
|
10620
10642
|
ref: leftRef,
|
|
@@ -10643,7 +10665,7 @@ function CalendarTimeline({
|
|
|
10643
10665
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { height: bottomSpacer } })
|
|
10644
10666
|
]
|
|
10645
10667
|
}
|
|
10646
|
-
),
|
|
10668
|
+
) : null,
|
|
10647
10669
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10648
10670
|
"div",
|
|
10649
10671
|
{
|