@underverse-ui/underverse 0.2.111 → 0.2.112
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 +350 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +522 -386
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8215,8 +8215,10 @@ var DateTimePicker = ({
|
|
|
8215
8215
|
const locale = useLocale();
|
|
8216
8216
|
const [open, setOpen] = React26.useState(false);
|
|
8217
8217
|
const [tempDate, setTempDate] = React26.useState(value);
|
|
8218
|
+
const [calendarMonth, setCalendarMonth] = React26.useState(() => value ?? /* @__PURE__ */ new Date());
|
|
8218
8219
|
React26.useEffect(() => {
|
|
8219
8220
|
setTempDate(value);
|
|
8221
|
+
setCalendarMonth(value ?? /* @__PURE__ */ new Date());
|
|
8220
8222
|
}, [value, open]);
|
|
8221
8223
|
const getTimeString = (date) => {
|
|
8222
8224
|
if (!date) return "";
|
|
@@ -8242,6 +8244,7 @@ var DateTimePicker = ({
|
|
|
8242
8244
|
}
|
|
8243
8245
|
return newDate;
|
|
8244
8246
|
});
|
|
8247
|
+
setCalendarMonth(date);
|
|
8245
8248
|
}
|
|
8246
8249
|
};
|
|
8247
8250
|
const handleTimeChange = (timeStr) => {
|
|
@@ -8365,9 +8368,8 @@ var DateTimePicker = ({
|
|
|
8365
8368
|
value: tempDate,
|
|
8366
8369
|
onSelect: handleDateSelect,
|
|
8367
8370
|
selectMode: "single",
|
|
8368
|
-
month:
|
|
8369
|
-
onMonthChange:
|
|
8370
|
-
},
|
|
8371
|
+
month: calendarMonth,
|
|
8372
|
+
onMonthChange: setCalendarMonth,
|
|
8371
8373
|
minDate,
|
|
8372
8374
|
maxDate,
|
|
8373
8375
|
className: "border-0 shadow-none w-auto",
|
|
@@ -8406,7 +8408,7 @@ var DateTimePicker = ({
|
|
|
8406
8408
|
};
|
|
8407
8409
|
|
|
8408
8410
|
// ../../components/ui/CalendarTimeline/CalendarTimeline.tsx
|
|
8409
|
-
var
|
|
8411
|
+
var React32 = __toESM(require("react"), 1);
|
|
8410
8412
|
var import_lucide_react21 = require("lucide-react");
|
|
8411
8413
|
|
|
8412
8414
|
// ../../components/ui/CalendarTimeline/date.ts
|
|
@@ -8868,6 +8870,7 @@ function resourcesById(resources) {
|
|
|
8868
8870
|
}
|
|
8869
8871
|
|
|
8870
8872
|
// ../../components/ui/CalendarTimeline/CalendarTimelineHeader.tsx
|
|
8873
|
+
var React28 = __toESM(require("react"), 1);
|
|
8871
8874
|
var import_lucide_react18 = require("lucide-react");
|
|
8872
8875
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
8873
8876
|
var VIEW_ICONS = {
|
|
@@ -8886,7 +8889,8 @@ function CalendarTimelineHeader(props) {
|
|
|
8886
8889
|
activeView,
|
|
8887
8890
|
sizeConfig,
|
|
8888
8891
|
navigate,
|
|
8889
|
-
|
|
8892
|
+
now,
|
|
8893
|
+
onApplyDateTime,
|
|
8890
8894
|
setView,
|
|
8891
8895
|
effectiveResourceColumnWidth,
|
|
8892
8896
|
canResizeColumn,
|
|
@@ -8894,6 +8898,64 @@ function CalendarTimelineHeader(props) {
|
|
|
8894
8898
|
headerRef,
|
|
8895
8899
|
slotHeaderNodes
|
|
8896
8900
|
} = props;
|
|
8901
|
+
const dt = useTranslations("DateTimePicker");
|
|
8902
|
+
const locale = useLocale();
|
|
8903
|
+
const [todayOpen, setTodayOpen] = React28.useState(false);
|
|
8904
|
+
const [tempDate, setTempDate] = React28.useState(() => now);
|
|
8905
|
+
const [calendarMonth, setCalendarMonth] = React28.useState(() => now);
|
|
8906
|
+
React28.useEffect(() => {
|
|
8907
|
+
if (!todayOpen) return;
|
|
8908
|
+
setTempDate(now);
|
|
8909
|
+
setCalendarMonth(now);
|
|
8910
|
+
}, [now, todayOpen]);
|
|
8911
|
+
const monthLabel = React28.useCallback(
|
|
8912
|
+
(date) => date.toLocaleDateString(locale === "vi" ? "vi-VN" : "en-US", {
|
|
8913
|
+
month: "long",
|
|
8914
|
+
year: "numeric"
|
|
8915
|
+
}),
|
|
8916
|
+
[locale]
|
|
8917
|
+
);
|
|
8918
|
+
const weekdays = React28.useMemo(() => {
|
|
8919
|
+
switch (locale) {
|
|
8920
|
+
case "vi":
|
|
8921
|
+
return ["CN", "T2", "T3", "T4", "T5", "T6", "T7"];
|
|
8922
|
+
case "ko":
|
|
8923
|
+
return ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"];
|
|
8924
|
+
case "ja":
|
|
8925
|
+
return ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"];
|
|
8926
|
+
default:
|
|
8927
|
+
return ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
8928
|
+
}
|
|
8929
|
+
}, [locale]);
|
|
8930
|
+
const getTimeString = React28.useCallback((date) => {
|
|
8931
|
+
const h = date.getHours();
|
|
8932
|
+
const m = date.getMinutes();
|
|
8933
|
+
return `${h.toString().padStart(2, "0")}:${m.toString().padStart(2, "0")}`;
|
|
8934
|
+
}, []);
|
|
8935
|
+
const handleDateSelect = React28.useCallback((date) => {
|
|
8936
|
+
if (!(date instanceof Date)) return;
|
|
8937
|
+
setTempDate((prev) => {
|
|
8938
|
+
const next = new Date(date);
|
|
8939
|
+
next.setHours(prev.getHours(), prev.getMinutes(), prev.getSeconds());
|
|
8940
|
+
return next;
|
|
8941
|
+
});
|
|
8942
|
+
}, []);
|
|
8943
|
+
const handleTimeChange = React28.useCallback((timeStr) => {
|
|
8944
|
+
if (!timeStr) return;
|
|
8945
|
+
const [hStr, mStr] = timeStr.split(":");
|
|
8946
|
+
const h = parseInt(hStr, 10);
|
|
8947
|
+
const m = parseInt(mStr, 10);
|
|
8948
|
+
if (!Number.isFinite(h) || !Number.isFinite(m)) return;
|
|
8949
|
+
setTempDate((prev) => {
|
|
8950
|
+
const next = new Date(prev);
|
|
8951
|
+
next.setHours(h, m, prev.getSeconds());
|
|
8952
|
+
return next;
|
|
8953
|
+
});
|
|
8954
|
+
}, []);
|
|
8955
|
+
const applyDateTime = React28.useCallback(() => {
|
|
8956
|
+
onApplyDateTime(tempDate);
|
|
8957
|
+
setTodayOpen(false);
|
|
8958
|
+
}, [onApplyDateTime, tempDate]);
|
|
8897
8959
|
return /* @__PURE__ */ (0, import_jsx_runtime34.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: [
|
|
8898
8960
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: cn("flex items-center justify-between gap-4", sizeConfig.headerPaddingClass), children: [
|
|
8899
8961
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
@@ -8910,13 +8972,87 @@ function CalendarTimelineHeader(props) {
|
|
|
8910
8972
|
}
|
|
8911
8973
|
),
|
|
8912
8974
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8913
|
-
|
|
8975
|
+
Popover,
|
|
8914
8976
|
{
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8977
|
+
open: todayOpen,
|
|
8978
|
+
onOpenChange: setTodayOpen,
|
|
8979
|
+
placement: "bottom-start",
|
|
8980
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8981
|
+
Button_default,
|
|
8982
|
+
{
|
|
8983
|
+
variant: "ghost",
|
|
8984
|
+
size: "sm",
|
|
8985
|
+
className: cn(sizeConfig.controlButtonTextClass, "rounded-full hover:bg-background/80 font-medium transition-all duration-200"),
|
|
8986
|
+
children: labels.today
|
|
8987
|
+
}
|
|
8988
|
+
),
|
|
8989
|
+
contentClassName: cn(
|
|
8990
|
+
"w-auto p-0 rounded-2xl md:rounded-3xl overflow-hidden"
|
|
8991
|
+
),
|
|
8992
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "max-w-[calc(100vw-1rem)] max-h-[calc(100vh-6rem)] overflow-auto", children: [
|
|
8993
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col lg:flex-row divide-y lg:divide-y-0 lg:divide-x divide-border", children: [
|
|
8994
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8995
|
+
Calendar2,
|
|
8996
|
+
{
|
|
8997
|
+
value: tempDate,
|
|
8998
|
+
onSelect: handleDateSelect,
|
|
8999
|
+
selectMode: "single",
|
|
9000
|
+
month: calendarMonth,
|
|
9001
|
+
onMonthChange: setCalendarMonth,
|
|
9002
|
+
className: "border-0 shadow-none w-auto",
|
|
9003
|
+
size: "sm",
|
|
9004
|
+
labels: {
|
|
9005
|
+
month: monthLabel,
|
|
9006
|
+
weekdays
|
|
9007
|
+
}
|
|
9008
|
+
}
|
|
9009
|
+
) }),
|
|
9010
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-2 flex flex-col gap-3", children: [
|
|
9011
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
9012
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-sm font-semibold text-muted-foreground", children: dt?.("time") || "Time" }),
|
|
9013
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9014
|
+
Button_default,
|
|
9015
|
+
{
|
|
9016
|
+
variant: "ghost",
|
|
9017
|
+
size: "sm",
|
|
9018
|
+
className: "rounded-full text-muted-foreground hover:text-foreground",
|
|
9019
|
+
onClick: () => setTempDate(now),
|
|
9020
|
+
children: labels.today
|
|
9021
|
+
}
|
|
9022
|
+
)
|
|
9023
|
+
] }),
|
|
9024
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9025
|
+
TimePicker,
|
|
9026
|
+
{
|
|
9027
|
+
variant: "inline",
|
|
9028
|
+
value: getTimeString(tempDate),
|
|
9029
|
+
onChange: handleTimeChange,
|
|
9030
|
+
format: "24",
|
|
9031
|
+
includeSeconds: false,
|
|
9032
|
+
clearable: false,
|
|
9033
|
+
className: "border-0 shadow-none p-0 bg-transparent rounded-none",
|
|
9034
|
+
size: "sm"
|
|
9035
|
+
}
|
|
9036
|
+
)
|
|
9037
|
+
] })
|
|
9038
|
+
] }),
|
|
9039
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "p-3 border-t border-border flex justify-between items-center bg-muted/20", children: [
|
|
9040
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
9041
|
+
Button_default,
|
|
9042
|
+
{
|
|
9043
|
+
variant: "ghost",
|
|
9044
|
+
size: "sm",
|
|
9045
|
+
className: "rounded-full text-muted-foreground hover:text-foreground",
|
|
9046
|
+
onClick: () => {
|
|
9047
|
+
setTempDate(now);
|
|
9048
|
+
setCalendarMonth(now);
|
|
9049
|
+
},
|
|
9050
|
+
children: labels.today
|
|
9051
|
+
}
|
|
9052
|
+
),
|
|
9053
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button_default, { size: "sm", onClick: applyDateTime, className: "rounded-full", children: dt?.("done") || "Done" })
|
|
9054
|
+
] })
|
|
9055
|
+
] })
|
|
8920
9056
|
}
|
|
8921
9057
|
),
|
|
8922
9058
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
@@ -9079,9 +9215,9 @@ function ResourceRowCell(props) {
|
|
|
9079
9215
|
}
|
|
9080
9216
|
|
|
9081
9217
|
// ../../components/ui/CalendarTimeline/CalendarTimelineGridOverlay.tsx
|
|
9082
|
-
var
|
|
9218
|
+
var React29 = __toESM(require("react"), 1);
|
|
9083
9219
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
9084
|
-
var CalendarTimelineGridOverlay =
|
|
9220
|
+
var CalendarTimelineGridOverlay = React29.memo(function CalendarTimelineGridOverlay2(props) {
|
|
9085
9221
|
const { gridWidth, height, slotLefts, slotWidths, activeView, todaySlotIdx, dayAnchor, weekendSlotIdxs, visibleStartIdx, visibleEndIdx, className } = props;
|
|
9086
9222
|
const startIdx = Math.max(0, visibleStartIdx ?? 0);
|
|
9087
9223
|
const endIdx = Math.min(slotWidths.length, visibleEndIdx ?? slotWidths.length);
|
|
@@ -9110,19 +9246,19 @@ var CalendarTimelineGridOverlay = React28.memo(function CalendarTimelineGridOver
|
|
|
9110
9246
|
slotLefts.slice(startIdx, endIdx).map((left, j) => {
|
|
9111
9247
|
const i = startIdx + j;
|
|
9112
9248
|
const isAnchor = dayAnchor ? Boolean(dayAnchor[i]) : true;
|
|
9113
|
-
const opacityClass = activeView === "day" && dayAnchor ? isAnchor ? "bg-border/
|
|
9249
|
+
const opacityClass = activeView === "day" && dayAnchor ? isAnchor ? "bg-border/35" : "bg-border/15" : "bg-border/30";
|
|
9114
9250
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: cn("absolute top-0 h-full w-px", opacityClass), style: { left }, "aria-hidden": true }, i);
|
|
9115
9251
|
})
|
|
9116
9252
|
] });
|
|
9117
9253
|
});
|
|
9118
9254
|
|
|
9119
9255
|
// ../../components/ui/CalendarTimeline/CalendarTimelineSlotHeaderCell.tsx
|
|
9120
|
-
var
|
|
9256
|
+
var React30 = __toESM(require("react"), 1);
|
|
9121
9257
|
var import_lucide_react20 = require("lucide-react");
|
|
9122
9258
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
9123
|
-
var CalendarTimelineSlotHeaderCell =
|
|
9259
|
+
var CalendarTimelineSlotHeaderCell = React30.memo(function CalendarTimelineSlotHeaderCell2(props) {
|
|
9124
9260
|
const { width, activeView, isToday: isToday2, label, ariaLabel, borderClassName, dayHeaderMarks, idx, className } = props;
|
|
9125
|
-
const content =
|
|
9261
|
+
const content = React30.useMemo(() => {
|
|
9126
9262
|
if (activeView === "day" && dayHeaderMarks) {
|
|
9127
9263
|
if (dayHeaderMarks.showEllipsis[idx]) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "text-xs text-muted-foreground/70 select-none", children: "\u2026" });
|
|
9128
9264
|
if (!dayHeaderMarks.showTime[idx]) return null;
|
|
@@ -9145,7 +9281,7 @@ var CalendarTimelineSlotHeaderCell = React29.memo(function CalendarTimelineSlotH
|
|
|
9145
9281
|
});
|
|
9146
9282
|
|
|
9147
9283
|
// ../../components/ui/CalendarTimeline/internal-hooks.ts
|
|
9148
|
-
var
|
|
9284
|
+
var React31 = __toESM(require("react"), 1);
|
|
9149
9285
|
function useTimelineSlots(args) {
|
|
9150
9286
|
const {
|
|
9151
9287
|
activeView,
|
|
@@ -9159,7 +9295,7 @@ function useTimelineSlots(args) {
|
|
|
9159
9295
|
resolvedNow,
|
|
9160
9296
|
formatters
|
|
9161
9297
|
} = args;
|
|
9162
|
-
const { slots, range } =
|
|
9298
|
+
const { slots, range } = React31.useMemo(() => {
|
|
9163
9299
|
const { start, end, slotStarts: slotStarts2 } = computeSlotStarts({
|
|
9164
9300
|
view: activeView,
|
|
9165
9301
|
date: activeDate,
|
|
@@ -9181,9 +9317,9 @@ function useTimelineSlots(args) {
|
|
|
9181
9317
|
}));
|
|
9182
9318
|
return { slots: slotItems, range: { start, end } };
|
|
9183
9319
|
}, [activeView, activeDate, dayRangeMode, dayTimeStepMinutes, formatters, resolvedLocale, resolvedNow, resolvedTimeZone, weekStartsOn, workHours]);
|
|
9184
|
-
const slotStarts =
|
|
9185
|
-
const todaySlotIdx =
|
|
9186
|
-
const weekendSlotIdxs =
|
|
9320
|
+
const slotStarts = React31.useMemo(() => slots.map((s) => s.start), [slots]);
|
|
9321
|
+
const todaySlotIdx = React31.useMemo(() => slots.findIndex((s) => s.isToday), [slots]);
|
|
9322
|
+
const weekendSlotIdxs = React31.useMemo(() => {
|
|
9187
9323
|
const out = [];
|
|
9188
9324
|
for (let i = 0; i < slots.length; i++) if (slots[i]?.isWeekend) out.push(i);
|
|
9189
9325
|
return out;
|
|
@@ -9192,16 +9328,16 @@ function useTimelineSlots(args) {
|
|
|
9192
9328
|
}
|
|
9193
9329
|
function useNormalizedEvents(args) {
|
|
9194
9330
|
const { events, range, activeView, resolvedTimeZone, resources } = args;
|
|
9195
|
-
const normalizedEvents =
|
|
9331
|
+
const normalizedEvents = React31.useMemo(() => {
|
|
9196
9332
|
return normalizeEvents({ events, range, view: activeView, timeZone: resolvedTimeZone });
|
|
9197
9333
|
}, [activeView, events, range, resolvedTimeZone]);
|
|
9198
|
-
const eventsByResource =
|
|
9199
|
-
const resourceById =
|
|
9334
|
+
const eventsByResource = React31.useMemo(() => eventsByResourceId(normalizedEvents), [normalizedEvents]);
|
|
9335
|
+
const resourceById = React31.useMemo(() => resourcesById(resources), [resources]);
|
|
9200
9336
|
return { normalizedEvents, eventsByResource, resourceById };
|
|
9201
9337
|
}
|
|
9202
9338
|
function useDayHeaderMarks(args) {
|
|
9203
9339
|
const { enabled, activeView, normalizedEvents, slotStarts, slotCount } = args;
|
|
9204
|
-
return
|
|
9340
|
+
return React31.useMemo(() => {
|
|
9205
9341
|
if (!enabled) return null;
|
|
9206
9342
|
if (activeView !== "day") return null;
|
|
9207
9343
|
const n = slotCount;
|
|
@@ -9236,14 +9372,14 @@ function useSlotMetrics(args) {
|
|
|
9236
9372
|
dayHeaderSmart,
|
|
9237
9373
|
daySlotCompression
|
|
9238
9374
|
} = args;
|
|
9239
|
-
const fixedSlotWidth =
|
|
9375
|
+
const fixedSlotWidth = React31.useMemo(() => {
|
|
9240
9376
|
const baseSlotWidth = activeView === "month" || activeView === "day" ? effectiveSlotMinWidth * 3 : effectiveSlotMinWidth;
|
|
9241
9377
|
if (activeView !== "week") return baseSlotWidth;
|
|
9242
9378
|
if (bodyClientWidth <= 0) return baseSlotWidth;
|
|
9243
9379
|
if (slotsLength <= 0) return baseSlotWidth;
|
|
9244
9380
|
return Math.max(baseSlotWidth, bodyClientWidth / slotsLength);
|
|
9245
9381
|
}, [activeView, bodyClientWidth, effectiveSlotMinWidth, slotsLength]);
|
|
9246
|
-
const slotMetrics =
|
|
9382
|
+
const slotMetrics = React31.useMemo(() => {
|
|
9247
9383
|
const n = slotsLength;
|
|
9248
9384
|
const widths = new Array(n).fill(fixedSlotWidth);
|
|
9249
9385
|
const isAdaptiveView = activeView === "month" || activeView === "day";
|
|
@@ -9373,7 +9509,7 @@ function useSlotMetrics(args) {
|
|
|
9373
9509
|
}
|
|
9374
9510
|
function useLayoutsByResource(args) {
|
|
9375
9511
|
const { eventsByResource, preview, slotStarts, slotsLength, slotLefts, getResourceRowHeight, laneGap, lanePaddingY, effectiveMaxLanesPerRow, eventHeight } = args;
|
|
9376
|
-
return
|
|
9512
|
+
return React31.useMemo(() => {
|
|
9377
9513
|
const map = /* @__PURE__ */ new Map();
|
|
9378
9514
|
for (const [resourceId, list] of eventsByResource.entries()) {
|
|
9379
9515
|
const mapped = list.map((ev) => {
|
|
@@ -9420,9 +9556,9 @@ function lowerBound2(arr, target) {
|
|
|
9420
9556
|
}
|
|
9421
9557
|
function useVisibleSlotRange(args) {
|
|
9422
9558
|
const { enabled, overscan, scrollRef, slotLefts, slotCount } = args;
|
|
9423
|
-
const [scrollLeft, setScrollLeft] =
|
|
9424
|
-
const [viewportWidth, setViewportWidth] =
|
|
9425
|
-
|
|
9559
|
+
const [scrollLeft, setScrollLeft] = React31.useState(0);
|
|
9560
|
+
const [viewportWidth, setViewportWidth] = React31.useState(0);
|
|
9561
|
+
React31.useEffect(() => {
|
|
9426
9562
|
if (!enabled) return;
|
|
9427
9563
|
const el = scrollRef.current;
|
|
9428
9564
|
if (!el) return;
|
|
@@ -9437,7 +9573,7 @@ function useVisibleSlotRange(args) {
|
|
|
9437
9573
|
el.removeEventListener("scroll", onScroll);
|
|
9438
9574
|
};
|
|
9439
9575
|
}, [enabled, scrollRef]);
|
|
9440
|
-
return
|
|
9576
|
+
return React31.useMemo(() => {
|
|
9441
9577
|
if (!enabled) return { startIdx: 0, endIdx: slotCount };
|
|
9442
9578
|
if (slotCount <= 0) return { startIdx: 0, endIdx: 0 };
|
|
9443
9579
|
if (viewportWidth <= 0) return { startIdx: 0, endIdx: slotCount };
|
|
@@ -9529,14 +9665,14 @@ function CalendarTimeline({
|
|
|
9529
9665
|
}) {
|
|
9530
9666
|
const t = useTranslations("CalendarTimeline");
|
|
9531
9667
|
const detectedLocale = useLocale();
|
|
9532
|
-
const resolvedLocale =
|
|
9533
|
-
const resolvedTimeZone =
|
|
9668
|
+
const resolvedLocale = React32.useMemo(() => localeToBCP47(locale ?? detectedLocale), [locale, detectedLocale]);
|
|
9669
|
+
const resolvedTimeZone = React32.useMemo(() => timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC", [timeZone]);
|
|
9534
9670
|
const effectiveEnableEventSheet = enableEventSheet ?? Boolean(renderEventSheet);
|
|
9535
9671
|
const isViewOnly = interactions?.mode === "view";
|
|
9536
9672
|
const isControlledSelectedEventId = selectedEventId !== void 0;
|
|
9537
|
-
const [internalSelectedEventId, setInternalSelectedEventId] =
|
|
9673
|
+
const [internalSelectedEventId, setInternalSelectedEventId] = React32.useState(defaultSelectedEventId ?? null);
|
|
9538
9674
|
const activeSelectedEventId = isControlledSelectedEventId ? selectedEventId : internalSelectedEventId;
|
|
9539
|
-
const setSelectedEventId =
|
|
9675
|
+
const setSelectedEventId = React32.useCallback(
|
|
9540
9676
|
(next) => {
|
|
9541
9677
|
if (!isControlledSelectedEventId) setInternalSelectedEventId(next);
|
|
9542
9678
|
onSelectedEventIdChange?.(next);
|
|
@@ -9544,9 +9680,9 @@ function CalendarTimeline({
|
|
|
9544
9680
|
[isControlledSelectedEventId, onSelectedEventIdChange]
|
|
9545
9681
|
);
|
|
9546
9682
|
const isControlledEventSheetOpen = eventSheetOpen !== void 0;
|
|
9547
|
-
const [internalEventSheetOpen, setInternalEventSheetOpen] =
|
|
9683
|
+
const [internalEventSheetOpen, setInternalEventSheetOpen] = React32.useState(defaultEventSheetOpen ?? false);
|
|
9548
9684
|
const activeEventSheetOpen = isControlledEventSheetOpen ? Boolean(eventSheetOpen) : internalEventSheetOpen;
|
|
9549
|
-
const setEventSheetOpen =
|
|
9685
|
+
const setEventSheetOpen = React32.useCallback(
|
|
9550
9686
|
(next) => {
|
|
9551
9687
|
if (!isControlledEventSheetOpen) setInternalEventSheetOpen(next);
|
|
9552
9688
|
onEventSheetOpenChange?.(next);
|
|
@@ -9554,19 +9690,19 @@ function CalendarTimeline({
|
|
|
9554
9690
|
},
|
|
9555
9691
|
[isControlledEventSheetOpen, onEventSheetOpenChange, setSelectedEventId]
|
|
9556
9692
|
);
|
|
9557
|
-
const sizeConfig =
|
|
9693
|
+
const sizeConfig = React32.useMemo(() => getSizeConfig(size), [size]);
|
|
9558
9694
|
const densityClass = sizeConfig.densityClass;
|
|
9559
9695
|
const eventHeight = sizeConfig.eventHeight;
|
|
9560
9696
|
const laneGap = sizeConfig.laneGap;
|
|
9561
9697
|
const lanePaddingY = sizeConfig.lanePaddingY;
|
|
9562
|
-
const canResizeColumn =
|
|
9698
|
+
const canResizeColumn = React32.useMemo(() => {
|
|
9563
9699
|
const cfg = enableLayoutResize;
|
|
9564
9700
|
if (!cfg) return false;
|
|
9565
9701
|
if (isViewOnly) return false;
|
|
9566
9702
|
if (cfg === true) return true;
|
|
9567
9703
|
return cfg.column !== false;
|
|
9568
9704
|
}, [enableLayoutResize, isViewOnly]);
|
|
9569
|
-
const canResizeRow =
|
|
9705
|
+
const canResizeRow = React32.useMemo(() => {
|
|
9570
9706
|
const cfg = enableLayoutResize;
|
|
9571
9707
|
if (!cfg) return false;
|
|
9572
9708
|
if (isViewOnly) return false;
|
|
@@ -9574,19 +9710,19 @@ function CalendarTimeline({
|
|
|
9574
9710
|
return cfg.row !== false;
|
|
9575
9711
|
}, [enableLayoutResize, isViewOnly]);
|
|
9576
9712
|
const isControlledResourceColumnWidth = resourceColumnWidth !== void 0;
|
|
9577
|
-
const [internalResourceColumnWidth, setInternalResourceColumnWidth] =
|
|
9713
|
+
const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React32.useState(() => {
|
|
9578
9714
|
const init = defaultResourceColumnWidth ?? sizeConfig.resourceColumnWidth;
|
|
9579
9715
|
return typeof init === "number" ? init : sizeConfig.resourceColumnWidth;
|
|
9580
9716
|
});
|
|
9581
|
-
|
|
9717
|
+
React32.useEffect(() => {
|
|
9582
9718
|
if (isControlledResourceColumnWidth) return;
|
|
9583
9719
|
if (defaultResourceColumnWidth == null) return;
|
|
9584
9720
|
setInternalResourceColumnWidth(defaultResourceColumnWidth);
|
|
9585
9721
|
}, [defaultResourceColumnWidth, isControlledResourceColumnWidth]);
|
|
9586
9722
|
const effectiveResourceColumnWidth = isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth;
|
|
9587
9723
|
const isControlledRowHeight = rowHeight !== void 0;
|
|
9588
|
-
const [internalRowHeight, setInternalRowHeight] =
|
|
9589
|
-
|
|
9724
|
+
const [internalRowHeight, setInternalRowHeight] = React32.useState(() => defaultRowHeight ?? sizeConfig.rowHeight);
|
|
9725
|
+
React32.useEffect(() => {
|
|
9590
9726
|
if (isControlledRowHeight) return;
|
|
9591
9727
|
if (defaultRowHeight == null) return;
|
|
9592
9728
|
setInternalRowHeight(defaultRowHeight);
|
|
@@ -9598,13 +9734,13 @@ function CalendarTimeline({
|
|
|
9598
9734
|
const rowMin = minRowHeight ?? 36;
|
|
9599
9735
|
const rowMax = maxRowHeight ?? 120;
|
|
9600
9736
|
const isControlledView = view !== void 0;
|
|
9601
|
-
const [internalView, setInternalView] =
|
|
9737
|
+
const [internalView, setInternalView] = React32.useState(defaultView);
|
|
9602
9738
|
const activeView = isControlledView ? view : internalView;
|
|
9603
9739
|
const isControlledDate = date !== void 0;
|
|
9604
|
-
const [internalDate, setInternalDate] =
|
|
9740
|
+
const [internalDate, setInternalDate] = React32.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
|
|
9605
9741
|
const activeDate = isControlledDate ? date : internalDate;
|
|
9606
|
-
const resolvedNow = now ?? /* @__PURE__ */ new Date();
|
|
9607
|
-
const l =
|
|
9742
|
+
const resolvedNow = React32.useMemo(() => now ?? /* @__PURE__ */ new Date(), [now]);
|
|
9743
|
+
const l = React32.useMemo(
|
|
9608
9744
|
() => ({
|
|
9609
9745
|
today: labels?.today ?? t("today"),
|
|
9610
9746
|
prev: labels?.prev ?? t("prev"),
|
|
@@ -9626,21 +9762,21 @@ function CalendarTimeline({
|
|
|
9626
9762
|
}),
|
|
9627
9763
|
[labels, t]
|
|
9628
9764
|
);
|
|
9629
|
-
const setView =
|
|
9765
|
+
const setView = React32.useCallback(
|
|
9630
9766
|
(next) => {
|
|
9631
9767
|
if (!isControlledView) setInternalView(next);
|
|
9632
9768
|
onViewChange?.(next);
|
|
9633
9769
|
},
|
|
9634
9770
|
[isControlledView, onViewChange]
|
|
9635
9771
|
);
|
|
9636
|
-
const setDate =
|
|
9772
|
+
const setDate = React32.useCallback(
|
|
9637
9773
|
(next) => {
|
|
9638
9774
|
if (!isControlledDate) setInternalDate(next);
|
|
9639
9775
|
onDateChange?.(next);
|
|
9640
9776
|
},
|
|
9641
9777
|
[isControlledDate, onDateChange]
|
|
9642
9778
|
);
|
|
9643
|
-
const navigate =
|
|
9779
|
+
const navigate = React32.useCallback(
|
|
9644
9780
|
(dir) => {
|
|
9645
9781
|
const base = activeDate;
|
|
9646
9782
|
if (activeView === "month") {
|
|
@@ -9655,18 +9791,17 @@ function CalendarTimeline({
|
|
|
9655
9791
|
},
|
|
9656
9792
|
[activeDate, activeView, resolvedTimeZone, setDate]
|
|
9657
9793
|
);
|
|
9658
|
-
const
|
|
9659
|
-
const [internalCollapsed, setInternalCollapsed] = React31.useState(() => defaultGroupCollapsed ?? {});
|
|
9794
|
+
const [internalCollapsed, setInternalCollapsed] = React32.useState(() => defaultGroupCollapsed ?? {});
|
|
9660
9795
|
const collapsed = groupCollapsed ?? internalCollapsed;
|
|
9661
|
-
const setCollapsed =
|
|
9796
|
+
const setCollapsed = React32.useCallback(
|
|
9662
9797
|
(next) => {
|
|
9663
9798
|
if (!groupCollapsed) setInternalCollapsed(next);
|
|
9664
9799
|
onGroupCollapsedChange?.(next);
|
|
9665
9800
|
},
|
|
9666
9801
|
[groupCollapsed, onGroupCollapsedChange]
|
|
9667
9802
|
);
|
|
9668
|
-
const rows =
|
|
9669
|
-
const groupResourceCounts =
|
|
9803
|
+
const rows = React32.useMemo(() => buildRows({ resources, groups, collapsed }), [resources, groups, collapsed]);
|
|
9804
|
+
const groupResourceCounts = React32.useMemo(() => getGroupResourceCounts(resources), [resources]);
|
|
9670
9805
|
const { slots, range, slotStarts, todaySlotIdx, weekendSlotIdxs } = useTimelineSlots({
|
|
9671
9806
|
activeView,
|
|
9672
9807
|
activeDate,
|
|
@@ -9679,12 +9814,12 @@ function CalendarTimeline({
|
|
|
9679
9814
|
resolvedNow,
|
|
9680
9815
|
formatters
|
|
9681
9816
|
});
|
|
9682
|
-
|
|
9817
|
+
React32.useEffect(() => {
|
|
9683
9818
|
onRangeChange?.(range);
|
|
9684
9819
|
}, [range.start, range.end, onRangeChange]);
|
|
9685
|
-
const leftRef =
|
|
9686
|
-
const bodyRef =
|
|
9687
|
-
const headerRef =
|
|
9820
|
+
const leftRef = React32.useRef(null);
|
|
9821
|
+
const bodyRef = React32.useRef(null);
|
|
9822
|
+
const headerRef = React32.useRef(null);
|
|
9688
9823
|
const bodyClientWidth = useClientWidth(bodyRef);
|
|
9689
9824
|
const { normalizedEvents, eventsByResource, resourceById } = useNormalizedEvents({
|
|
9690
9825
|
events,
|
|
@@ -9716,16 +9851,16 @@ function CalendarTimeline({
|
|
|
9716
9851
|
slotLefts,
|
|
9717
9852
|
slotCount: slots.length
|
|
9718
9853
|
});
|
|
9719
|
-
const selectedEvent =
|
|
9854
|
+
const selectedEvent = React32.useMemo(() => {
|
|
9720
9855
|
if (!activeSelectedEventId) return null;
|
|
9721
9856
|
const found = normalizedEvents.find((e) => e.id === activeSelectedEventId);
|
|
9722
9857
|
return found ?? null;
|
|
9723
9858
|
}, [activeSelectedEventId, normalizedEvents]);
|
|
9724
|
-
const selectedResource =
|
|
9859
|
+
const selectedResource = React32.useMemo(() => {
|
|
9725
9860
|
if (!selectedEvent) return void 0;
|
|
9726
9861
|
return resourceById.get(selectedEvent.resourceId);
|
|
9727
9862
|
}, [resourceById, selectedEvent]);
|
|
9728
|
-
const selectedTimeText =
|
|
9863
|
+
const selectedTimeText = React32.useMemo(() => {
|
|
9729
9864
|
if (!selectedEvent) return "";
|
|
9730
9865
|
return formatters?.eventTime?.({
|
|
9731
9866
|
start: selectedEvent._start,
|
|
@@ -9735,7 +9870,7 @@ function CalendarTimeline({
|
|
|
9735
9870
|
view: activeView
|
|
9736
9871
|
}) ?? defaultEventTime({ start: selectedEvent._start, end: selectedEvent._end, locale: resolvedLocale, timeZone: resolvedTimeZone, view: activeView });
|
|
9737
9872
|
}, [activeView, formatters, resolvedLocale, resolvedTimeZone, selectedEvent]);
|
|
9738
|
-
|
|
9873
|
+
React32.useEffect(() => {
|
|
9739
9874
|
if (!effectiveEnableEventSheet) return;
|
|
9740
9875
|
if (activeEventSheetOpen && activeSelectedEventId && !selectedEvent) {
|
|
9741
9876
|
setEventSheetOpen(false);
|
|
@@ -9745,24 +9880,24 @@ function CalendarTimeline({
|
|
|
9745
9880
|
const virt = virtualization?.enabled;
|
|
9746
9881
|
const overscan = virtualization?.overscan ?? 8;
|
|
9747
9882
|
const isControlledRowHeights = rowHeights !== void 0;
|
|
9748
|
-
const [internalRowHeights, setInternalRowHeights] =
|
|
9749
|
-
|
|
9883
|
+
const [internalRowHeights, setInternalRowHeights] = React32.useState(() => defaultRowHeights ?? {});
|
|
9884
|
+
React32.useEffect(() => {
|
|
9750
9885
|
if (isControlledRowHeights) return;
|
|
9751
9886
|
if (!defaultRowHeights) return;
|
|
9752
9887
|
setInternalRowHeights(defaultRowHeights);
|
|
9753
9888
|
}, [defaultRowHeights, isControlledRowHeights]);
|
|
9754
9889
|
const activeRowHeights = isControlledRowHeights ? rowHeights : internalRowHeights;
|
|
9755
|
-
const autoRowHeightCfg =
|
|
9890
|
+
const autoRowHeightCfg = React32.useMemo(() => {
|
|
9756
9891
|
if (!autoRowHeight) return null;
|
|
9757
9892
|
return autoRowHeight === true ? {} : autoRowHeight;
|
|
9758
9893
|
}, [autoRowHeight]);
|
|
9759
|
-
const effectiveMaxLanesPerRow =
|
|
9894
|
+
const effectiveMaxLanesPerRow = React32.useMemo(() => {
|
|
9760
9895
|
if (!autoRowHeightCfg) return maxLanesPerRow;
|
|
9761
9896
|
const maxLanes = autoRowHeightCfg.maxLanesPerRow;
|
|
9762
9897
|
if (typeof maxLanes === "number" && Number.isFinite(maxLanes) && maxLanes > 0) return Math.floor(maxLanes);
|
|
9763
9898
|
return Number.POSITIVE_INFINITY;
|
|
9764
9899
|
}, [autoRowHeightCfg, maxLanesPerRow]);
|
|
9765
|
-
const autoRowHeightsByResource =
|
|
9900
|
+
const autoRowHeightsByResource = React32.useMemo(() => {
|
|
9766
9901
|
if (!autoRowHeightCfg) return null;
|
|
9767
9902
|
const maxRowHeight2 = autoRowHeightCfg.maxRowHeight;
|
|
9768
9903
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -9780,7 +9915,7 @@ function CalendarTimeline({
|
|
|
9780
9915
|
}
|
|
9781
9916
|
return out;
|
|
9782
9917
|
}, [autoRowHeightCfg, eventHeight, eventsByResource, laneGap, lanePaddingY, slotStarts, slots.length, effectiveMaxLanesPerRow]);
|
|
9783
|
-
const getResourceRowHeight =
|
|
9918
|
+
const getResourceRowHeight = React32.useCallback(
|
|
9784
9919
|
(resourceId) => {
|
|
9785
9920
|
const h = activeRowHeights[resourceId];
|
|
9786
9921
|
const base = typeof h === "number" && Number.isFinite(h) && h > 0 ? h : effectiveRowHeight;
|
|
@@ -9790,7 +9925,7 @@ function CalendarTimeline({
|
|
|
9790
9925
|
},
|
|
9791
9926
|
[activeRowHeights, autoRowHeightsByResource, effectiveRowHeight]
|
|
9792
9927
|
);
|
|
9793
|
-
const setRowHeightForResource =
|
|
9928
|
+
const setRowHeightForResource = React32.useCallback(
|
|
9794
9929
|
(resourceId, height) => {
|
|
9795
9930
|
const clamped = clamp4(Math.round(height), rowMin, rowMax);
|
|
9796
9931
|
onRowHeightChange?.(clamped);
|
|
@@ -9807,7 +9942,7 @@ function CalendarTimeline({
|
|
|
9807
9942
|
},
|
|
9808
9943
|
[activeRowHeights, isControlledRowHeights, onRowHeightChange, onRowHeightsChange, rowMax, rowMin]
|
|
9809
9944
|
);
|
|
9810
|
-
const rowHeightsArray =
|
|
9945
|
+
const rowHeightsArray = React32.useMemo(() => {
|
|
9811
9946
|
return rows.map((r) => {
|
|
9812
9947
|
if (r.kind === "resource") return getResourceRowHeight(r.resource.id);
|
|
9813
9948
|
return sizeConfig.groupRowHeight;
|
|
@@ -9823,13 +9958,13 @@ function CalendarTimeline({
|
|
|
9823
9958
|
const endRow = virt ? virtualResult.endIndex : rows.length;
|
|
9824
9959
|
const topSpacer = virt ? virtualResult.topSpacer : 0;
|
|
9825
9960
|
const bottomSpacer = virt ? virtualResult.bottomSpacer : 0;
|
|
9826
|
-
const renderedRowsHeight =
|
|
9961
|
+
const renderedRowsHeight = React32.useMemo(() => {
|
|
9827
9962
|
let h = 0;
|
|
9828
9963
|
for (let i = startRow; i < endRow; i++) h += rowHeightsArray[i] ?? effectiveRowHeight;
|
|
9829
9964
|
return h;
|
|
9830
9965
|
}, [effectiveRowHeight, endRow, rowHeightsArray, startRow]);
|
|
9831
|
-
const resizeRef =
|
|
9832
|
-
const setResourceColumnWidth =
|
|
9966
|
+
const resizeRef = React32.useRef(null);
|
|
9967
|
+
const setResourceColumnWidth = React32.useCallback(
|
|
9833
9968
|
(next) => {
|
|
9834
9969
|
const clamped = clamp4(Math.round(next), colMin, colMax);
|
|
9835
9970
|
if (!isControlledResourceColumnWidth) setInternalResourceColumnWidth(clamped);
|
|
@@ -9837,7 +9972,7 @@ function CalendarTimeline({
|
|
|
9837
9972
|
},
|
|
9838
9973
|
[colMax, colMin, isControlledResourceColumnWidth, onResourceColumnWidthChange]
|
|
9839
9974
|
);
|
|
9840
|
-
const startResize =
|
|
9975
|
+
const startResize = React32.useCallback(
|
|
9841
9976
|
(mode, e, args) => {
|
|
9842
9977
|
if (e.button !== 0 || e.ctrlKey) return;
|
|
9843
9978
|
resizeRef.current = {
|
|
@@ -9880,7 +10015,7 @@ function CalendarTimeline({
|
|
|
9880
10015
|
},
|
|
9881
10016
|
[setResourceColumnWidth, setRowHeightForResource]
|
|
9882
10017
|
);
|
|
9883
|
-
|
|
10018
|
+
React32.useEffect(() => {
|
|
9884
10019
|
return () => {
|
|
9885
10020
|
if (!resizeRef.current) return;
|
|
9886
10021
|
resizeRef.current = null;
|
|
@@ -9888,7 +10023,7 @@ function CalendarTimeline({
|
|
|
9888
10023
|
document.body.style.userSelect = "";
|
|
9889
10024
|
};
|
|
9890
10025
|
}, []);
|
|
9891
|
-
const beginResizeColumn =
|
|
10026
|
+
const beginResizeColumn = React32.useCallback(
|
|
9892
10027
|
(e) => {
|
|
9893
10028
|
if (!canResizeColumn) return;
|
|
9894
10029
|
if (typeof effectiveResourceColumnWidth !== "number") return;
|
|
@@ -9896,7 +10031,7 @@ function CalendarTimeline({
|
|
|
9896
10031
|
},
|
|
9897
10032
|
[canResizeColumn, effectiveResourceColumnWidth, effectiveRowHeight, startResize]
|
|
9898
10033
|
);
|
|
9899
|
-
const beginResizeResourceRow =
|
|
10034
|
+
const beginResizeResourceRow = React32.useCallback(
|
|
9900
10035
|
(resourceId) => (e) => {
|
|
9901
10036
|
if (!canResizeRow) return;
|
|
9902
10037
|
startResize("row", e, {
|
|
@@ -9907,7 +10042,7 @@ function CalendarTimeline({
|
|
|
9907
10042
|
},
|
|
9908
10043
|
[canResizeRow, effectiveResourceColumnWidth, getResourceRowHeight, startResize]
|
|
9909
10044
|
);
|
|
9910
|
-
const title =
|
|
10045
|
+
const title = React32.useMemo(() => {
|
|
9911
10046
|
if (activeView === "month") {
|
|
9912
10047
|
return formatters?.monthTitle?.(activeDate, { locale: resolvedLocale, timeZone: resolvedTimeZone }) ?? defaultMonthTitle(activeDate, resolvedLocale, resolvedTimeZone);
|
|
9913
10048
|
}
|
|
@@ -9928,11 +10063,11 @@ function CalendarTimeline({
|
|
|
9928
10063
|
}, [activeDate, activeView, formatters, l.week, range.end, range.start, resolvedLocale, resolvedTimeZone]);
|
|
9929
10064
|
const createMode = interactions?.createMode ?? "drag";
|
|
9930
10065
|
const canCreate = !isViewOnly && (interactions?.creatable ?? false) && !!onCreateEvent;
|
|
9931
|
-
const [createOpen, setCreateOpen] =
|
|
9932
|
-
const [createResourceId, setCreateResourceId] =
|
|
9933
|
-
const [createStartIdx, setCreateStartIdx] =
|
|
9934
|
-
const [createEndIdx, setCreateEndIdx] =
|
|
9935
|
-
const resourceOptions =
|
|
10066
|
+
const [createOpen, setCreateOpen] = React32.useState(false);
|
|
10067
|
+
const [createResourceId, setCreateResourceId] = React32.useState(null);
|
|
10068
|
+
const [createStartIdx, setCreateStartIdx] = React32.useState(0);
|
|
10069
|
+
const [createEndIdx, setCreateEndIdx] = React32.useState(1);
|
|
10070
|
+
const resourceOptions = React32.useMemo(() => {
|
|
9936
10071
|
return resources.map((r) => ({
|
|
9937
10072
|
label: typeof r.label === "string" ? r.label : r.id,
|
|
9938
10073
|
value: r.id,
|
|
@@ -9940,12 +10075,12 @@ function CalendarTimeline({
|
|
|
9940
10075
|
disabled: r.disabled ?? false
|
|
9941
10076
|
}));
|
|
9942
10077
|
}, [resources]);
|
|
9943
|
-
const slotPickerLabel =
|
|
10078
|
+
const slotPickerLabel = React32.useMemo(() => {
|
|
9944
10079
|
const timeFmt = getDtf(resolvedLocale, resolvedTimeZone, { hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
|
|
9945
10080
|
const dayFmt = getDtf(resolvedLocale, resolvedTimeZone, { weekday: "short", month: "short", day: "numeric" });
|
|
9946
10081
|
return (d) => activeView === "day" ? timeFmt.format(d) : dayFmt.format(d);
|
|
9947
10082
|
}, [activeView, resolvedLocale, resolvedTimeZone]);
|
|
9948
|
-
const openCreate =
|
|
10083
|
+
const openCreate = React32.useCallback(() => {
|
|
9949
10084
|
if (!canCreate) return;
|
|
9950
10085
|
if (activeEventSheetOpen) setEventSheetOpen(false);
|
|
9951
10086
|
const firstResource = resources.find((r) => !r.disabled)?.id ?? resources[0]?.id ?? null;
|
|
@@ -9977,13 +10112,13 @@ function CalendarTimeline({
|
|
|
9977
10112
|
slotStarts,
|
|
9978
10113
|
slots.length
|
|
9979
10114
|
]);
|
|
9980
|
-
|
|
10115
|
+
React32.useEffect(() => {
|
|
9981
10116
|
setCreateEndIdx((prev) => Math.min(slots.length, Math.max(prev, createStartIdx + 1)));
|
|
9982
10117
|
}, [createStartIdx, slots.length]);
|
|
9983
|
-
const createStartOptions =
|
|
10118
|
+
const createStartOptions = React32.useMemo(() => {
|
|
9984
10119
|
return slotStarts.map((d, idx) => ({ label: slotPickerLabel(d), value: idx }));
|
|
9985
10120
|
}, [slotStarts, slotPickerLabel]);
|
|
9986
|
-
const createEndOptions =
|
|
10121
|
+
const createEndOptions = React32.useMemo(() => {
|
|
9987
10122
|
const out = [];
|
|
9988
10123
|
for (let idx = createStartIdx + 1; idx <= slotStarts.length; idx++) {
|
|
9989
10124
|
const boundary = idx >= slotStarts.length ? range.end : slotStarts[idx];
|
|
@@ -9991,7 +10126,7 @@ function CalendarTimeline({
|
|
|
9991
10126
|
}
|
|
9992
10127
|
return out;
|
|
9993
10128
|
}, [createStartIdx, range.end, slotPickerLabel, slotStarts]);
|
|
9994
|
-
const commitCreate =
|
|
10129
|
+
const commitCreate = React32.useCallback(() => {
|
|
9995
10130
|
if (!onCreateEvent) return;
|
|
9996
10131
|
if (!createResourceId) return;
|
|
9997
10132
|
const start = slotStarts[clamp4(createStartIdx, 0, Math.max(0, slotStarts.length - 1))];
|
|
@@ -10002,24 +10137,24 @@ function CalendarTimeline({
|
|
|
10002
10137
|
onCreateEvent({ resourceId: createResourceId, start, end: endBoundary });
|
|
10003
10138
|
setCreateOpen(false);
|
|
10004
10139
|
}, [createEndIdx, createResourceId, createStartIdx, onCreateEvent, range.end, slotStarts]);
|
|
10005
|
-
const dragRef =
|
|
10006
|
-
const [preview, setPreview] =
|
|
10007
|
-
const suppressNextEventClickRef =
|
|
10008
|
-
const [hoverCell, setHoverCell] =
|
|
10009
|
-
const autoScrollStateRef =
|
|
10140
|
+
const dragRef = React32.useRef(null);
|
|
10141
|
+
const [preview, setPreview] = React32.useState(null);
|
|
10142
|
+
const suppressNextEventClickRef = React32.useRef(false);
|
|
10143
|
+
const [hoverCell, setHoverCell] = React32.useState(null);
|
|
10144
|
+
const autoScrollStateRef = React32.useRef({
|
|
10010
10145
|
dir: 0,
|
|
10011
10146
|
speed: 0,
|
|
10012
10147
|
lastClientX: 0,
|
|
10013
10148
|
lastClientY: 0
|
|
10014
10149
|
});
|
|
10015
|
-
const autoScrollRafRef =
|
|
10016
|
-
const stopAutoScroll =
|
|
10150
|
+
const autoScrollRafRef = React32.useRef(null);
|
|
10151
|
+
const stopAutoScroll = React32.useCallback(() => {
|
|
10017
10152
|
if (autoScrollRafRef.current != null) cancelAnimationFrame(autoScrollRafRef.current);
|
|
10018
10153
|
autoScrollRafRef.current = null;
|
|
10019
10154
|
autoScrollStateRef.current.dir = 0;
|
|
10020
10155
|
autoScrollStateRef.current.speed = 0;
|
|
10021
10156
|
}, []);
|
|
10022
|
-
const getPointerContext =
|
|
10157
|
+
const getPointerContext = React32.useCallback(
|
|
10023
10158
|
(clientX, clientY, opts) => {
|
|
10024
10159
|
const body = bodyRef.current;
|
|
10025
10160
|
if (!body) return null;
|
|
@@ -10037,7 +10172,7 @@ function CalendarTimeline({
|
|
|
10037
10172
|
},
|
|
10038
10173
|
[xToSlotIdx]
|
|
10039
10174
|
);
|
|
10040
|
-
const slotToDate =
|
|
10175
|
+
const slotToDate = React32.useCallback(
|
|
10041
10176
|
(slotIdx) => {
|
|
10042
10177
|
const start = slotStarts[clamp4(slotIdx, 0, slotStarts.length - 1)];
|
|
10043
10178
|
if (activeView === "day") {
|
|
@@ -10048,7 +10183,7 @@ function CalendarTimeline({
|
|
|
10048
10183
|
},
|
|
10049
10184
|
[activeView, dayTimeStepMinutes, resolvedTimeZone, slotStarts]
|
|
10050
10185
|
);
|
|
10051
|
-
const updateDragPreview =
|
|
10186
|
+
const updateDragPreview = React32.useCallback(
|
|
10052
10187
|
(clientX, clientY) => {
|
|
10053
10188
|
const drag = dragRef.current;
|
|
10054
10189
|
if (!drag) return;
|
|
@@ -10092,7 +10227,7 @@ function CalendarTimeline({
|
|
|
10092
10227
|
},
|
|
10093
10228
|
[getPointerContext, range.end, range.start, slotToDate, slots.length]
|
|
10094
10229
|
);
|
|
10095
|
-
const autoScrollTick =
|
|
10230
|
+
const autoScrollTick = React32.useCallback(() => {
|
|
10096
10231
|
const drag = dragRef.current;
|
|
10097
10232
|
const body = bodyRef.current;
|
|
10098
10233
|
const st = autoScrollStateRef.current;
|
|
@@ -10111,7 +10246,7 @@ function CalendarTimeline({
|
|
|
10111
10246
|
updateDragPreview(st.lastClientX, st.lastClientY);
|
|
10112
10247
|
autoScrollRafRef.current = requestAnimationFrame(autoScrollTick);
|
|
10113
10248
|
}, [stopAutoScroll, updateDragPreview]);
|
|
10114
|
-
const updateAutoScrollFromPointer =
|
|
10249
|
+
const updateAutoScrollFromPointer = React32.useCallback(
|
|
10115
10250
|
(clientX, clientY) => {
|
|
10116
10251
|
const body = bodyRef.current;
|
|
10117
10252
|
if (!body) return;
|
|
@@ -10142,7 +10277,7 @@ function CalendarTimeline({
|
|
|
10142
10277
|
},
|
|
10143
10278
|
[autoScrollTick, stopAutoScroll]
|
|
10144
10279
|
);
|
|
10145
|
-
|
|
10280
|
+
React32.useEffect(() => stopAutoScroll, [stopAutoScroll]);
|
|
10146
10281
|
const onPointerDownEvent = (e, ev, mode) => {
|
|
10147
10282
|
if (e.button !== 0 || e.ctrlKey) return;
|
|
10148
10283
|
if (isViewOnly) return;
|
|
@@ -10294,7 +10429,7 @@ function CalendarTimeline({
|
|
|
10294
10429
|
}
|
|
10295
10430
|
);
|
|
10296
10431
|
};
|
|
10297
|
-
const slotHeaderNodes =
|
|
10432
|
+
const slotHeaderNodes = React32.useMemo(() => {
|
|
10298
10433
|
const startIdx = colVirtEnabled ? visibleSlots.startIdx : 0;
|
|
10299
10434
|
const endIdx = colVirtEnabled ? visibleSlots.endIdx : slots.length;
|
|
10300
10435
|
const leftSpacer = startIdx > 0 ? slotLefts[startIdx] ?? 0 : 0;
|
|
@@ -10364,7 +10499,8 @@ function CalendarTimeline({
|
|
|
10364
10499
|
activeView,
|
|
10365
10500
|
sizeConfig,
|
|
10366
10501
|
navigate,
|
|
10367
|
-
|
|
10502
|
+
now: resolvedNow,
|
|
10503
|
+
onApplyDateTime: setDate,
|
|
10368
10504
|
setView,
|
|
10369
10505
|
effectiveResourceColumnWidth,
|
|
10370
10506
|
canResizeColumn,
|
|
@@ -10615,7 +10751,7 @@ function CalendarTimeline({
|
|
|
10615
10751
|
]
|
|
10616
10752
|
}
|
|
10617
10753
|
);
|
|
10618
|
-
if (!enableEventTooltips) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
10754
|
+
if (!enableEventTooltips) return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(React32.Fragment, { children: block }, ev.id);
|
|
10619
10755
|
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
10620
10756
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "font-semibold", children: tooltipTitle }),
|
|
10621
10757
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "text-xs opacity-80", children: timeText }),
|
|
@@ -10771,7 +10907,7 @@ function CalendarTimeline({
|
|
|
10771
10907
|
}
|
|
10772
10908
|
|
|
10773
10909
|
// ../../components/ui/MultiCombobox.tsx
|
|
10774
|
-
var
|
|
10910
|
+
var React33 = __toESM(require("react"), 1);
|
|
10775
10911
|
var import_react16 = require("react");
|
|
10776
10912
|
var import_lucide_react22 = require("lucide-react");
|
|
10777
10913
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
@@ -10806,27 +10942,27 @@ var MultiCombobox = ({
|
|
|
10806
10942
|
helperText,
|
|
10807
10943
|
maxTagsVisible = 3
|
|
10808
10944
|
}) => {
|
|
10809
|
-
const [query, setQuery] =
|
|
10810
|
-
const [open, setOpen] =
|
|
10811
|
-
const [activeIndex, setActiveIndex] =
|
|
10812
|
-
const inputRef =
|
|
10813
|
-
const listRef =
|
|
10814
|
-
const triggerRef =
|
|
10945
|
+
const [query, setQuery] = React33.useState("");
|
|
10946
|
+
const [open, setOpen] = React33.useState(false);
|
|
10947
|
+
const [activeIndex, setActiveIndex] = React33.useState(null);
|
|
10948
|
+
const inputRef = React33.useRef(null);
|
|
10949
|
+
const listRef = React33.useRef([]);
|
|
10950
|
+
const triggerRef = React33.useRef(null);
|
|
10815
10951
|
useShadCNAnimations();
|
|
10816
|
-
const normalizedOptions =
|
|
10952
|
+
const normalizedOptions = React33.useMemo(
|
|
10817
10953
|
() => options.map(
|
|
10818
10954
|
(o) => typeof o === "string" ? { value: o, label: o } : { value: o.value, label: o.label, icon: o.icon, description: o.description, disabled: o.disabled, group: o.group }
|
|
10819
10955
|
),
|
|
10820
10956
|
[options]
|
|
10821
10957
|
);
|
|
10822
10958
|
const enableSearch = normalizedOptions.length > 10;
|
|
10823
|
-
const filtered =
|
|
10959
|
+
const filtered = React33.useMemo(
|
|
10824
10960
|
() => enableSearch ? normalizedOptions.filter(
|
|
10825
10961
|
(opt) => opt.label.toLowerCase().includes(query.toLowerCase()) || opt.description?.toLowerCase().includes(query.toLowerCase())
|
|
10826
10962
|
) : normalizedOptions,
|
|
10827
10963
|
[normalizedOptions, query, enableSearch]
|
|
10828
10964
|
);
|
|
10829
|
-
const groupedOptions =
|
|
10965
|
+
const groupedOptions = React33.useMemo(() => {
|
|
10830
10966
|
if (!groupBy) return null;
|
|
10831
10967
|
const groups = /* @__PURE__ */ new Map();
|
|
10832
10968
|
filtered.forEach((opt) => {
|
|
@@ -10862,7 +10998,7 @@ var MultiCombobox = ({
|
|
|
10862
10998
|
const handleClearAll = () => {
|
|
10863
10999
|
onChange([]);
|
|
10864
11000
|
};
|
|
10865
|
-
|
|
11001
|
+
React33.useEffect(() => {
|
|
10866
11002
|
if (open && enableSearch) {
|
|
10867
11003
|
setTimeout(() => {
|
|
10868
11004
|
inputRef.current?.focus();
|
|
@@ -11087,7 +11223,7 @@ var MultiCombobox = ({
|
|
|
11087
11223
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex items-center gap-1.5 flex-wrap min-h-6 flex-1", children: value.length > 0 ? showTags ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
11088
11224
|
visibleTags.map((option) => {
|
|
11089
11225
|
if (renderTag) {
|
|
11090
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
11226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(React33.Fragment, { children: renderTag(option, () => handleRemove(option.value)) }, option.value);
|
|
11091
11227
|
}
|
|
11092
11228
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
11093
11229
|
"span",
|
|
@@ -11228,17 +11364,17 @@ var MultiCombobox = ({
|
|
|
11228
11364
|
};
|
|
11229
11365
|
|
|
11230
11366
|
// ../../components/ui/RadioGroup.tsx
|
|
11231
|
-
var
|
|
11367
|
+
var React34 = __toESM(require("react"), 1);
|
|
11232
11368
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
11233
|
-
var RadioGroupContext =
|
|
11369
|
+
var RadioGroupContext = React34.createContext(void 0);
|
|
11234
11370
|
var useRadioGroup = () => {
|
|
11235
|
-
const context =
|
|
11371
|
+
const context = React34.useContext(RadioGroupContext);
|
|
11236
11372
|
if (!context) {
|
|
11237
11373
|
throw new Error("RadioGroupItem must be used within a RadioGroup");
|
|
11238
11374
|
}
|
|
11239
11375
|
return context;
|
|
11240
11376
|
};
|
|
11241
|
-
var RadioGroup =
|
|
11377
|
+
var RadioGroup = React34.forwardRef(
|
|
11242
11378
|
({
|
|
11243
11379
|
value,
|
|
11244
11380
|
defaultValue,
|
|
@@ -11254,7 +11390,7 @@ var RadioGroup = React33.forwardRef(
|
|
|
11254
11390
|
error = false,
|
|
11255
11391
|
errorMessage
|
|
11256
11392
|
}, ref) => {
|
|
11257
|
-
const [internalValue, setInternalValue] =
|
|
11393
|
+
const [internalValue, setInternalValue] = React34.useState(defaultValue || "");
|
|
11258
11394
|
const isControlled = value !== void 0;
|
|
11259
11395
|
const currentValue = isControlled ? value : internalValue;
|
|
11260
11396
|
const handleValueChange = (newValue) => {
|
|
@@ -11265,7 +11401,7 @@ var RadioGroup = React33.forwardRef(
|
|
|
11265
11401
|
onValueChange?.(newValue);
|
|
11266
11402
|
}
|
|
11267
11403
|
};
|
|
11268
|
-
const uniqueId =
|
|
11404
|
+
const uniqueId = React34.useId();
|
|
11269
11405
|
const radioName = name || `radio-group-${uniqueId}`;
|
|
11270
11406
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11271
11407
|
RadioGroupContext.Provider,
|
|
@@ -11323,7 +11459,7 @@ var sizeStyles7 = {
|
|
|
11323
11459
|
padding: "p-4"
|
|
11324
11460
|
}
|
|
11325
11461
|
};
|
|
11326
|
-
var RadioGroupItem =
|
|
11462
|
+
var RadioGroupItem = React34.forwardRef(
|
|
11327
11463
|
({ value, id, disabled, className, children, label, description, icon }, ref) => {
|
|
11328
11464
|
const { value: selectedValue, onValueChange, name, disabled: groupDisabled, size = "md", variant = "default" } = useRadioGroup();
|
|
11329
11465
|
const isDisabled = disabled || groupDisabled;
|
|
@@ -11500,7 +11636,7 @@ var RadioGroupItem = React33.forwardRef(
|
|
|
11500
11636
|
RadioGroupItem.displayName = "RadioGroupItem";
|
|
11501
11637
|
|
|
11502
11638
|
// ../../components/ui/Slider.tsx
|
|
11503
|
-
var
|
|
11639
|
+
var React35 = __toESM(require("react"), 1);
|
|
11504
11640
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
11505
11641
|
var SIZE_STYLES = {
|
|
11506
11642
|
sm: {
|
|
@@ -11520,7 +11656,7 @@ var SIZE_STYLES = {
|
|
|
11520
11656
|
}
|
|
11521
11657
|
};
|
|
11522
11658
|
var clamp5 = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
11523
|
-
var Slider =
|
|
11659
|
+
var Slider = React35.forwardRef(
|
|
11524
11660
|
({
|
|
11525
11661
|
className,
|
|
11526
11662
|
mode = "single",
|
|
@@ -11552,15 +11688,15 @@ var Slider = React34.forwardRef(
|
|
|
11552
11688
|
...props
|
|
11553
11689
|
}, ref) => {
|
|
11554
11690
|
const isRange = mode === "range";
|
|
11555
|
-
const trackRef =
|
|
11556
|
-
const [internalValue, setInternalValue] =
|
|
11557
|
-
const [internalRange, setInternalRange] =
|
|
11691
|
+
const trackRef = React35.useRef(null);
|
|
11692
|
+
const [internalValue, setInternalValue] = React35.useState(defaultValue);
|
|
11693
|
+
const [internalRange, setInternalRange] = React35.useState(() => {
|
|
11558
11694
|
if (defaultRangeValue) return defaultRangeValue;
|
|
11559
11695
|
const v = clamp5(defaultValue, min, max);
|
|
11560
11696
|
return [min, v];
|
|
11561
11697
|
});
|
|
11562
|
-
const [activeThumb, setActiveThumb] =
|
|
11563
|
-
const dragRef =
|
|
11698
|
+
const [activeThumb, setActiveThumb] = React35.useState(null);
|
|
11699
|
+
const dragRef = React35.useRef(null);
|
|
11564
11700
|
const isControlled = value !== void 0;
|
|
11565
11701
|
const currentValue = isControlled ? value : internalValue;
|
|
11566
11702
|
const isRangeControlled = rangeValue !== void 0;
|
|
@@ -11568,7 +11704,7 @@ var Slider = React34.forwardRef(
|
|
|
11568
11704
|
const rangeMin = clamp5(currentRange[0] ?? min, min, max);
|
|
11569
11705
|
const rangeMax = clamp5(currentRange[1] ?? max, min, max);
|
|
11570
11706
|
const normalizedRange = rangeMin <= rangeMax ? [rangeMin, rangeMax] : [rangeMax, rangeMin];
|
|
11571
|
-
const handleSingleChange =
|
|
11707
|
+
const handleSingleChange = React35.useCallback(
|
|
11572
11708
|
(e) => {
|
|
11573
11709
|
const newValue = Number(e.target.value);
|
|
11574
11710
|
if (!isControlled) {
|
|
@@ -11579,14 +11715,14 @@ var Slider = React34.forwardRef(
|
|
|
11579
11715
|
},
|
|
11580
11716
|
[isControlled, onChange, onValueChange]
|
|
11581
11717
|
);
|
|
11582
|
-
const emitRange =
|
|
11718
|
+
const emitRange = React35.useCallback(
|
|
11583
11719
|
(next) => {
|
|
11584
11720
|
onRangeChange?.(next);
|
|
11585
11721
|
onRangeValueChange?.(next);
|
|
11586
11722
|
},
|
|
11587
11723
|
[onRangeChange, onRangeValueChange]
|
|
11588
11724
|
);
|
|
11589
|
-
const handleRangeChange =
|
|
11725
|
+
const handleRangeChange = React35.useCallback(
|
|
11590
11726
|
(thumb) => (e) => {
|
|
11591
11727
|
const nextVal = Number(e.target.value);
|
|
11592
11728
|
const [curMin, curMax] = normalizedRange;
|
|
@@ -11601,7 +11737,7 @@ var Slider = React34.forwardRef(
|
|
|
11601
11737
|
const rangeStartPct = (normalizedRange[0] - min) / denom * 100;
|
|
11602
11738
|
const rangeEndPct = (normalizedRange[1] - min) / denom * 100;
|
|
11603
11739
|
const sizeStyles8 = SIZE_STYLES[size];
|
|
11604
|
-
const displayValue =
|
|
11740
|
+
const displayValue = React35.useMemo(() => {
|
|
11605
11741
|
if (isRange) {
|
|
11606
11742
|
const a = formatValue ? formatValue(normalizedRange[0]) : normalizedRange[0].toString();
|
|
11607
11743
|
const b = formatValue ? formatValue(normalizedRange[1]) : normalizedRange[1].toString();
|
|
@@ -11609,7 +11745,7 @@ var Slider = React34.forwardRef(
|
|
|
11609
11745
|
}
|
|
11610
11746
|
return formatValue ? formatValue(currentValue) : currentValue.toString();
|
|
11611
11747
|
}, [currentValue, formatValue, isRange, normalizedRange]);
|
|
11612
|
-
const quantize =
|
|
11748
|
+
const quantize = React35.useCallback(
|
|
11613
11749
|
(v) => {
|
|
11614
11750
|
const stepped = Math.round((v - min) / step) * step + min;
|
|
11615
11751
|
const fixed = Number(stepped.toFixed(10));
|
|
@@ -11617,7 +11753,7 @@ var Slider = React34.forwardRef(
|
|
|
11617
11753
|
},
|
|
11618
11754
|
[max, min, step]
|
|
11619
11755
|
);
|
|
11620
|
-
const valueFromClientX =
|
|
11756
|
+
const valueFromClientX = React35.useCallback(
|
|
11621
11757
|
(clientX) => {
|
|
11622
11758
|
const el = trackRef.current;
|
|
11623
11759
|
if (!el) return min;
|
|
@@ -12721,7 +12857,7 @@ function ImageUpload({
|
|
|
12721
12857
|
}
|
|
12722
12858
|
|
|
12723
12859
|
// ../../components/ui/Carousel.tsx
|
|
12724
|
-
var
|
|
12860
|
+
var React38 = __toESM(require("react"), 1);
|
|
12725
12861
|
var import_lucide_react26 = require("lucide-react");
|
|
12726
12862
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
12727
12863
|
function Carousel({
|
|
@@ -12744,19 +12880,19 @@ function Carousel({
|
|
|
12744
12880
|
thumbnailRenderer,
|
|
12745
12881
|
ariaLabel = "Carousel"
|
|
12746
12882
|
}) {
|
|
12747
|
-
const [currentIndex, setCurrentIndex] =
|
|
12748
|
-
const [isPaused, setIsPaused] =
|
|
12749
|
-
const [isDragging, setIsDragging] =
|
|
12750
|
-
const [startPos, setStartPos] =
|
|
12751
|
-
const [currentTranslate, setCurrentTranslate] =
|
|
12752
|
-
const [prevTranslate, setPrevTranslate] =
|
|
12753
|
-
const progressElRef =
|
|
12754
|
-
const carouselRef =
|
|
12755
|
-
const rafRef =
|
|
12756
|
-
const totalSlides =
|
|
12883
|
+
const [currentIndex, setCurrentIndex] = React38.useState(0);
|
|
12884
|
+
const [isPaused, setIsPaused] = React38.useState(false);
|
|
12885
|
+
const [isDragging, setIsDragging] = React38.useState(false);
|
|
12886
|
+
const [startPos, setStartPos] = React38.useState(0);
|
|
12887
|
+
const [currentTranslate, setCurrentTranslate] = React38.useState(0);
|
|
12888
|
+
const [prevTranslate, setPrevTranslate] = React38.useState(0);
|
|
12889
|
+
const progressElRef = React38.useRef(null);
|
|
12890
|
+
const carouselRef = React38.useRef(null);
|
|
12891
|
+
const rafRef = React38.useRef(null);
|
|
12892
|
+
const totalSlides = React38.Children.count(children);
|
|
12757
12893
|
const maxIndex = Math.max(0, totalSlides - slidesToShow);
|
|
12758
12894
|
const isHorizontal = orientation === "horizontal";
|
|
12759
|
-
const scrollPrev =
|
|
12895
|
+
const scrollPrev = React38.useCallback(() => {
|
|
12760
12896
|
setCurrentIndex((prev) => {
|
|
12761
12897
|
if (prev === 0) {
|
|
12762
12898
|
return loop ? maxIndex : 0;
|
|
@@ -12764,7 +12900,7 @@ function Carousel({
|
|
|
12764
12900
|
return Math.max(0, prev - slidesToScroll);
|
|
12765
12901
|
});
|
|
12766
12902
|
}, [loop, maxIndex, slidesToScroll]);
|
|
12767
|
-
const scrollNext =
|
|
12903
|
+
const scrollNext = React38.useCallback(() => {
|
|
12768
12904
|
setCurrentIndex((prev) => {
|
|
12769
12905
|
if (prev >= maxIndex) {
|
|
12770
12906
|
return loop ? 0 : maxIndex;
|
|
@@ -12772,13 +12908,13 @@ function Carousel({
|
|
|
12772
12908
|
return Math.min(maxIndex, prev + slidesToScroll);
|
|
12773
12909
|
});
|
|
12774
12910
|
}, [loop, maxIndex, slidesToScroll]);
|
|
12775
|
-
const scrollTo =
|
|
12911
|
+
const scrollTo = React38.useCallback(
|
|
12776
12912
|
(index) => {
|
|
12777
12913
|
setCurrentIndex(Math.min(maxIndex, Math.max(0, index)));
|
|
12778
12914
|
},
|
|
12779
12915
|
[maxIndex]
|
|
12780
12916
|
);
|
|
12781
|
-
|
|
12917
|
+
React38.useEffect(() => {
|
|
12782
12918
|
const handleKeyDown = (e) => {
|
|
12783
12919
|
if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
12784
12920
|
e.preventDefault();
|
|
@@ -12800,7 +12936,7 @@ function Carousel({
|
|
|
12800
12936
|
return () => carousel.removeEventListener("keydown", handleKeyDown);
|
|
12801
12937
|
}
|
|
12802
12938
|
}, [scrollPrev, scrollNext, scrollTo, maxIndex]);
|
|
12803
|
-
|
|
12939
|
+
React38.useEffect(() => {
|
|
12804
12940
|
const stop = () => {
|
|
12805
12941
|
if (rafRef.current != null) {
|
|
12806
12942
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -12859,7 +12995,7 @@ function Carousel({
|
|
|
12859
12995
|
setCurrentTranslate(0);
|
|
12860
12996
|
setPrevTranslate(0);
|
|
12861
12997
|
};
|
|
12862
|
-
|
|
12998
|
+
React38.useEffect(() => {
|
|
12863
12999
|
onSlideChange?.(currentIndex);
|
|
12864
13000
|
}, [currentIndex, onSlideChange]);
|
|
12865
13001
|
const getAnimationStyles2 = () => {
|
|
@@ -12912,7 +13048,7 @@ function Carousel({
|
|
|
12912
13048
|
role: "group",
|
|
12913
13049
|
"aria-atomic": "false",
|
|
12914
13050
|
"aria-live": autoScroll ? "off" : "polite",
|
|
12915
|
-
children:
|
|
13051
|
+
children: React38.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12916
13052
|
"div",
|
|
12917
13053
|
{
|
|
12918
13054
|
className: cn(
|
|
@@ -13002,7 +13138,7 @@ function Carousel({
|
|
|
13002
13138
|
"absolute bottom-0 left-0 right-0 flex gap-2 p-4 bg-linear-to-t from-black/50 to-transparent overflow-x-auto",
|
|
13003
13139
|
isHorizontal ? "flex-row" : "flex-col"
|
|
13004
13140
|
),
|
|
13005
|
-
children:
|
|
13141
|
+
children: React38.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
13006
13142
|
"button",
|
|
13007
13143
|
{
|
|
13008
13144
|
onClick: () => scrollTo(idx),
|
|
@@ -13295,7 +13431,7 @@ function FallingIcons({
|
|
|
13295
13431
|
}
|
|
13296
13432
|
|
|
13297
13433
|
// ../../components/ui/List.tsx
|
|
13298
|
-
var
|
|
13434
|
+
var React40 = __toESM(require("react"), 1);
|
|
13299
13435
|
var import_lucide_react27 = require("lucide-react");
|
|
13300
13436
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
13301
13437
|
var SIZE_STYLES2 = {
|
|
@@ -13321,7 +13457,7 @@ var ListItemSkeleton = ({ size }) => {
|
|
|
13321
13457
|
] })
|
|
13322
13458
|
] });
|
|
13323
13459
|
};
|
|
13324
|
-
var ListRoot =
|
|
13460
|
+
var ListRoot = React40.forwardRef(
|
|
13325
13461
|
({
|
|
13326
13462
|
as = "ul",
|
|
13327
13463
|
ordered,
|
|
@@ -13341,7 +13477,7 @@ var ListRoot = React39.forwardRef(
|
|
|
13341
13477
|
...rest
|
|
13342
13478
|
}, ref) => {
|
|
13343
13479
|
const Comp = ordered ? "ol" : as;
|
|
13344
|
-
const childCount =
|
|
13480
|
+
const childCount = React40.Children.count(children);
|
|
13345
13481
|
const hasChildren = childCount > 0;
|
|
13346
13482
|
const variantClasses2 = {
|
|
13347
13483
|
plain: "",
|
|
@@ -13379,14 +13515,14 @@ var ListRoot = React39.forwardRef(
|
|
|
13379
13515
|
className
|
|
13380
13516
|
),
|
|
13381
13517
|
...rest,
|
|
13382
|
-
children:
|
|
13383
|
-
if (!
|
|
13518
|
+
children: React40.Children.map(children, (child, idx) => {
|
|
13519
|
+
if (!React40.isValidElement(child)) return child;
|
|
13384
13520
|
const childClass = cn(
|
|
13385
13521
|
child.props?.className,
|
|
13386
13522
|
hoverable && variant !== "flush" && "hover:bg-accent/50 focus:bg-accent/60 focus:outline-none transition-colors",
|
|
13387
13523
|
variant === "flush" && "hover:bg-accent/30"
|
|
13388
13524
|
);
|
|
13389
|
-
return
|
|
13525
|
+
return React40.cloneElement(child, {
|
|
13390
13526
|
className: childClass,
|
|
13391
13527
|
// Pass global item class to contentClassName of ListItem
|
|
13392
13528
|
contentClassName: cn(itemClassName, child.props?.contentClassName),
|
|
@@ -13401,7 +13537,7 @@ var ListRoot = React39.forwardRef(
|
|
|
13401
13537
|
}
|
|
13402
13538
|
);
|
|
13403
13539
|
ListRoot.displayName = "List";
|
|
13404
|
-
var ListItem =
|
|
13540
|
+
var ListItem = React40.forwardRef(
|
|
13405
13541
|
({
|
|
13406
13542
|
as = "li",
|
|
13407
13543
|
selected = false,
|
|
@@ -13424,7 +13560,7 @@ var ListItem = React39.forwardRef(
|
|
|
13424
13560
|
children,
|
|
13425
13561
|
...rest
|
|
13426
13562
|
}, ref) => {
|
|
13427
|
-
const [internalExpanded, setInternalExpanded] =
|
|
13563
|
+
const [internalExpanded, setInternalExpanded] = React40.useState(false);
|
|
13428
13564
|
const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
13429
13565
|
const sizeAttr = rest["data-size"];
|
|
13430
13566
|
const resolvedSize = sizeAttr && ["xs", "sm", "md", "lg"].includes(sizeAttr) ? sizeAttr : "md";
|
|
@@ -13492,7 +13628,7 @@ var List = Object.assign(ListRoot, { Item: ListItem });
|
|
|
13492
13628
|
var List_default = List;
|
|
13493
13629
|
|
|
13494
13630
|
// ../../components/ui/Watermark.tsx
|
|
13495
|
-
var
|
|
13631
|
+
var React41 = __toESM(require("react"), 1);
|
|
13496
13632
|
var import_react_dom5 = require("react-dom");
|
|
13497
13633
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
13498
13634
|
var PRESETS2 = {
|
|
@@ -13504,8 +13640,8 @@ var PRESETS2 = {
|
|
|
13504
13640
|
internal: { text: "INTERNAL USE ONLY", color: "rgba(156, 163, 175, 0.15)", rotate: -22, fontSize: 13, fontWeight: "600" }
|
|
13505
13641
|
};
|
|
13506
13642
|
function useWatermarkDataURL(opts) {
|
|
13507
|
-
const [url, setUrl] =
|
|
13508
|
-
|
|
13643
|
+
const [url, setUrl] = React41.useState(null);
|
|
13644
|
+
React41.useEffect(() => {
|
|
13509
13645
|
let cancelled = false;
|
|
13510
13646
|
const text = opts.text;
|
|
13511
13647
|
const image = opts.image;
|
|
@@ -13682,9 +13818,9 @@ var Watermark = ({
|
|
|
13682
13818
|
children,
|
|
13683
13819
|
...rest
|
|
13684
13820
|
}) => {
|
|
13685
|
-
const [visible, setVisible] =
|
|
13686
|
-
const [isDark, setIsDark] =
|
|
13687
|
-
|
|
13821
|
+
const [visible, setVisible] = React41.useState(true);
|
|
13822
|
+
const [isDark, setIsDark] = React41.useState(false);
|
|
13823
|
+
React41.useEffect(() => {
|
|
13688
13824
|
if (!darkMode) return;
|
|
13689
13825
|
const checkDarkMode = () => {
|
|
13690
13826
|
const isDarkMode = document.documentElement.classList.contains("dark") || window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -13786,7 +13922,7 @@ var Watermark = ({
|
|
|
13786
13922
|
var Watermark_default = Watermark;
|
|
13787
13923
|
|
|
13788
13924
|
// ../../components/ui/Timeline.tsx
|
|
13789
|
-
var
|
|
13925
|
+
var React42 = __toESM(require("react"), 1);
|
|
13790
13926
|
var import_lucide_react28 = require("lucide-react");
|
|
13791
13927
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
13792
13928
|
var SIZE_STYLE = {
|
|
@@ -13839,7 +13975,7 @@ var STATUS_COLOR = {
|
|
|
13839
13975
|
error: "bg-destructive",
|
|
13840
13976
|
info: "bg-info"
|
|
13841
13977
|
};
|
|
13842
|
-
var TimelineContext =
|
|
13978
|
+
var TimelineContext = React42.createContext(null);
|
|
13843
13979
|
var LINE_STYLE_MAP = {
|
|
13844
13980
|
solid: "border-solid",
|
|
13845
13981
|
dashed: "border-dashed",
|
|
@@ -13867,7 +14003,7 @@ var Marker = ({ index, last, size, color, status = "default", lineColor, lineSty
|
|
|
13867
14003
|
!last && showLine && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("flex-1 border-l-2", LINE_STYLE_MAP[lineStyle]), style: { borderColor: lineColor || "hsl(var(--border))" } })
|
|
13868
14004
|
] });
|
|
13869
14005
|
};
|
|
13870
|
-
var TimelineRoot =
|
|
14006
|
+
var TimelineRoot = React42.forwardRef(
|
|
13871
14007
|
({
|
|
13872
14008
|
align = "left",
|
|
13873
14009
|
variant = "default",
|
|
@@ -13897,7 +14033,7 @@ var TimelineRoot = React41.forwardRef(
|
|
|
13897
14033
|
}
|
|
13898
14034
|
);
|
|
13899
14035
|
TimelineRoot.displayName = "Timeline";
|
|
13900
|
-
var TimelineItem =
|
|
14036
|
+
var TimelineItem = React42.forwardRef(
|
|
13901
14037
|
({
|
|
13902
14038
|
title,
|
|
13903
14039
|
description,
|
|
@@ -13916,11 +14052,11 @@ var TimelineItem = React41.forwardRef(
|
|
|
13916
14052
|
children,
|
|
13917
14053
|
...rest
|
|
13918
14054
|
}, ref) => {
|
|
13919
|
-
const ctx =
|
|
14055
|
+
const ctx = React42.useContext(TimelineContext);
|
|
13920
14056
|
const idx = rest["data-index"];
|
|
13921
14057
|
const isLast = Boolean(rest["data-last"]);
|
|
13922
14058
|
const sz = SIZE_STYLE[ctx.size];
|
|
13923
|
-
const [internalExpanded, setInternalExpanded] =
|
|
14059
|
+
const [internalExpanded, setInternalExpanded] = React42.useState(false);
|
|
13924
14060
|
const isExpanded = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
13925
14061
|
const toggleExpanded = () => {
|
|
13926
14062
|
const newExpanded = !isExpanded;
|
|
@@ -14062,7 +14198,7 @@ var Timeline = Object.assign(TimelineRoot, { Item: TimelineItem });
|
|
|
14062
14198
|
var Timeline_default = Timeline;
|
|
14063
14199
|
|
|
14064
14200
|
// ../../components/ui/ColorPicker.tsx
|
|
14065
|
-
var
|
|
14201
|
+
var React43 = __toESM(require("react"), 1);
|
|
14066
14202
|
var import_lucide_react29 = require("lucide-react");
|
|
14067
14203
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
14068
14204
|
var clamp6 = (n, min, max) => Math.max(min, Math.min(max, n));
|
|
@@ -14256,12 +14392,12 @@ function ColorPicker({
|
|
|
14256
14392
|
}) {
|
|
14257
14393
|
const isControlled = value !== void 0;
|
|
14258
14394
|
const initial = parseAnyColor(isControlled ? value : defaultValue) || { r: 79, g: 70, b: 229, a: 1 };
|
|
14259
|
-
const [rgba, setRgba] =
|
|
14260
|
-
const [open, setOpen] =
|
|
14261
|
-
const [text, setText] =
|
|
14262
|
-
const [copied, setCopied] =
|
|
14263
|
-
const [recentColors, setRecentColors] =
|
|
14264
|
-
|
|
14395
|
+
const [rgba, setRgba] = React43.useState(initial);
|
|
14396
|
+
const [open, setOpen] = React43.useState(false);
|
|
14397
|
+
const [text, setText] = React43.useState(() => formatOutput(initial, withAlpha, format));
|
|
14398
|
+
const [copied, setCopied] = React43.useState(false);
|
|
14399
|
+
const [recentColors, setRecentColors] = React43.useState([]);
|
|
14400
|
+
React43.useEffect(() => {
|
|
14265
14401
|
if (isControlled) {
|
|
14266
14402
|
const parsed = parseAnyColor(value);
|
|
14267
14403
|
if (parsed) {
|
|
@@ -17213,10 +17349,10 @@ function DataTable({
|
|
|
17213
17349
|
var DataTable_default = DataTable;
|
|
17214
17350
|
|
|
17215
17351
|
// ../../components/ui/Form.tsx
|
|
17216
|
-
var
|
|
17352
|
+
var React58 = __toESM(require("react"), 1);
|
|
17217
17353
|
var import_react_hook_form = require("react-hook-form");
|
|
17218
17354
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
17219
|
-
var FormConfigContext =
|
|
17355
|
+
var FormConfigContext = React58.createContext({ size: "md" });
|
|
17220
17356
|
var FormWrapper = ({
|
|
17221
17357
|
children,
|
|
17222
17358
|
onSubmit,
|
|
@@ -17229,7 +17365,7 @@ var FormWrapper = ({
|
|
|
17229
17365
|
const methods = (0, import_react_hook_form.useForm)({
|
|
17230
17366
|
defaultValues: initialValues
|
|
17231
17367
|
});
|
|
17232
|
-
|
|
17368
|
+
React58.useEffect(() => {
|
|
17233
17369
|
if (initialValues) {
|
|
17234
17370
|
methods.reset(initialValues);
|
|
17235
17371
|
}
|
|
@@ -17238,15 +17374,15 @@ var FormWrapper = ({
|
|
|
17238
17374
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
17239
17375
|
};
|
|
17240
17376
|
var Form = FormWrapper;
|
|
17241
|
-
var FormFieldContext =
|
|
17377
|
+
var FormFieldContext = React58.createContext({});
|
|
17242
17378
|
var FormField = ({
|
|
17243
17379
|
...props
|
|
17244
17380
|
}) => {
|
|
17245
17381
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react_hook_form.Controller, { ...props }) });
|
|
17246
17382
|
};
|
|
17247
17383
|
var useFormField = () => {
|
|
17248
|
-
const fieldContext =
|
|
17249
|
-
const itemContext =
|
|
17384
|
+
const fieldContext = React58.useContext(FormFieldContext);
|
|
17385
|
+
const itemContext = React58.useContext(FormItemContext);
|
|
17250
17386
|
const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
|
|
17251
17387
|
if (!fieldContext) {
|
|
17252
17388
|
try {
|
|
@@ -17267,16 +17403,16 @@ var useFormField = () => {
|
|
|
17267
17403
|
...fieldState
|
|
17268
17404
|
};
|
|
17269
17405
|
};
|
|
17270
|
-
var FormItemContext =
|
|
17271
|
-
var FormItem =
|
|
17272
|
-
const id =
|
|
17406
|
+
var FormItemContext = React58.createContext({});
|
|
17407
|
+
var FormItem = React58.forwardRef(({ className, ...props }, ref) => {
|
|
17408
|
+
const id = React58.useId();
|
|
17273
17409
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
17274
17410
|
});
|
|
17275
17411
|
FormItem.displayName = "FormItem";
|
|
17276
|
-
var FormLabel =
|
|
17412
|
+
var FormLabel = React58.forwardRef(
|
|
17277
17413
|
({ className, children, required, ...props }, ref) => {
|
|
17278
17414
|
const { error, formItemId } = useFormField();
|
|
17279
|
-
const config =
|
|
17415
|
+
const config = React58.useContext(FormConfigContext);
|
|
17280
17416
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
17281
17417
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
17282
17418
|
children,
|
|
@@ -17285,7 +17421,7 @@ var FormLabel = React57.forwardRef(
|
|
|
17285
17421
|
}
|
|
17286
17422
|
);
|
|
17287
17423
|
FormLabel.displayName = "FormLabel";
|
|
17288
|
-
var FormControl =
|
|
17424
|
+
var FormControl = React58.forwardRef(({ ...props }, ref) => {
|
|
17289
17425
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
17290
17426
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
17291
17427
|
"div",
|
|
@@ -17299,12 +17435,12 @@ var FormControl = React57.forwardRef(({ ...props }, ref) => {
|
|
|
17299
17435
|
);
|
|
17300
17436
|
});
|
|
17301
17437
|
FormControl.displayName = "FormControl";
|
|
17302
|
-
var FormDescription =
|
|
17438
|
+
var FormDescription = React58.forwardRef(({ className, ...props }, ref) => {
|
|
17303
17439
|
const { formDescriptionId } = useFormField();
|
|
17304
17440
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
17305
17441
|
});
|
|
17306
17442
|
FormDescription.displayName = "FormDescription";
|
|
17307
|
-
var FormMessage =
|
|
17443
|
+
var FormMessage = React58.forwardRef(({ className, children, ...props }, ref) => {
|
|
17308
17444
|
const { error, formMessageId } = useFormField();
|
|
17309
17445
|
const body = error ? String(error?.message) : children;
|
|
17310
17446
|
if (!body) {
|
|
@@ -17313,7 +17449,7 @@ var FormMessage = React57.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
17313
17449
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
17314
17450
|
});
|
|
17315
17451
|
FormMessage.displayName = "FormMessage";
|
|
17316
|
-
var FormInput =
|
|
17452
|
+
var FormInput = React58.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
17317
17453
|
FormField,
|
|
17318
17454
|
{
|
|
17319
17455
|
name,
|
|
@@ -17324,7 +17460,7 @@ var FormInput = React57.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */
|
|
|
17324
17460
|
}
|
|
17325
17461
|
) }));
|
|
17326
17462
|
FormInput.displayName = "FormInput";
|
|
17327
|
-
var FormCheckbox =
|
|
17463
|
+
var FormCheckbox = React58.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
17328
17464
|
FormField,
|
|
17329
17465
|
{
|
|
17330
17466
|
name,
|
|
@@ -17348,9 +17484,9 @@ var FormCheckbox = React57.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
17348
17484
|
}
|
|
17349
17485
|
) }));
|
|
17350
17486
|
FormCheckbox.displayName = "FormCheckbox";
|
|
17351
|
-
var FormActions =
|
|
17487
|
+
var FormActions = React58.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
17352
17488
|
FormActions.displayName = "FormActions";
|
|
17353
|
-
var FormSubmitButton =
|
|
17489
|
+
var FormSubmitButton = React58.forwardRef(
|
|
17354
17490
|
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
|
|
17355
17491
|
);
|
|
17356
17492
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
@@ -18132,7 +18268,7 @@ var VARIANT_STYLES_ALERT = {
|
|
|
18132
18268
|
};
|
|
18133
18269
|
|
|
18134
18270
|
// src/contexts/TranslationContext.tsx
|
|
18135
|
-
var
|
|
18271
|
+
var React60 = __toESM(require("react"), 1);
|
|
18136
18272
|
|
|
18137
18273
|
// locales/en.json
|
|
18138
18274
|
var en_default = {
|
|
@@ -18490,9 +18626,9 @@ var defaultTranslations2 = {
|
|
|
18490
18626
|
ko: ko_default,
|
|
18491
18627
|
ja: ja_default
|
|
18492
18628
|
};
|
|
18493
|
-
var TranslationContext2 =
|
|
18629
|
+
var TranslationContext2 = React60.createContext(null);
|
|
18494
18630
|
var TranslationProvider = ({ children, locale = "en", translations }) => {
|
|
18495
|
-
const t =
|
|
18631
|
+
const t = React60.useCallback(
|
|
18496
18632
|
(namespace) => {
|
|
18497
18633
|
return (key) => {
|
|
18498
18634
|
const mergedTranslations = {
|
|
@@ -18520,7 +18656,7 @@ var TranslationProvider = ({ children, locale = "en", translations }) => {
|
|
|
18520
18656
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(TranslationContext2.Provider, { value: { locale, t }, children });
|
|
18521
18657
|
};
|
|
18522
18658
|
var useUnderverseTranslations = (namespace) => {
|
|
18523
|
-
const context =
|
|
18659
|
+
const context = React60.useContext(TranslationContext2);
|
|
18524
18660
|
if (!context) {
|
|
18525
18661
|
return (key) => {
|
|
18526
18662
|
const parts = namespace.split(".");
|
|
@@ -18542,12 +18678,12 @@ var useUnderverseTranslations = (namespace) => {
|
|
|
18542
18678
|
return context.t(namespace);
|
|
18543
18679
|
};
|
|
18544
18680
|
var useUnderverseLocale = () => {
|
|
18545
|
-
const context =
|
|
18681
|
+
const context = React60.useContext(TranslationContext2);
|
|
18546
18682
|
return context?.locale || "en";
|
|
18547
18683
|
};
|
|
18548
18684
|
|
|
18549
18685
|
// src/hooks/useSmartTranslations.tsx
|
|
18550
|
-
var
|
|
18686
|
+
var React61 = __toESM(require("react"), 1);
|
|
18551
18687
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
18552
18688
|
var nextIntlHooks = null;
|
|
18553
18689
|
try {
|
|
@@ -18559,12 +18695,12 @@ try {
|
|
|
18559
18695
|
} catch {
|
|
18560
18696
|
nextIntlHooks = null;
|
|
18561
18697
|
}
|
|
18562
|
-
var ForceInternalContext =
|
|
18698
|
+
var ForceInternalContext = React61.createContext(false);
|
|
18563
18699
|
var ForceInternalTranslationsProvider = ({ children }) => {
|
|
18564
18700
|
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ForceInternalContext.Provider, { value: true, children });
|
|
18565
18701
|
};
|
|
18566
18702
|
function useSmartTranslations(namespace) {
|
|
18567
|
-
const forceInternal =
|
|
18703
|
+
const forceInternal = React61.useContext(ForceInternalContext);
|
|
18568
18704
|
const internalT = useUnderverseTranslations(namespace);
|
|
18569
18705
|
if (forceInternal || !nextIntlHooks?.useTranslations) {
|
|
18570
18706
|
return internalT;
|
|
@@ -18577,7 +18713,7 @@ function useSmartTranslations(namespace) {
|
|
|
18577
18713
|
}
|
|
18578
18714
|
}
|
|
18579
18715
|
function useSmartLocale() {
|
|
18580
|
-
const forceInternal =
|
|
18716
|
+
const forceInternal = React61.useContext(ForceInternalContext);
|
|
18581
18717
|
const internalLocale = useUnderverseLocale();
|
|
18582
18718
|
if (forceInternal || !nextIntlHooks?.useLocale) {
|
|
18583
18719
|
return internalLocale;
|