@kumix/ui 0.3.9 → 0.3.11
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/README.md +15 -14
- package/dist/components/motion/adaptive-stepper.d.ts +32 -0
- package/dist/components/motion/adaptive-stepper.d.ts.map +1 -0
- package/dist/components/motion/adaptive-stepper.js +302 -0
- package/dist/components/motion/adaptive-stepper.js.map +1 -0
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +15 -7
- package/dist/components/motion/availability-scheduler/day-row.js.map +1 -1
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/button/index.d.ts +2 -1
- package/dist/components/motion/button/index.js +2 -1
- package/dist/components/motion/button/metallic.d.ts +10 -0
- package/dist/components/motion/button/metallic.d.ts.map +1 -0
- package/dist/components/motion/button/metallic.js +71 -0
- package/dist/components/motion/button/metallic.js.map +1 -0
- package/dist/components/motion/combobox/content.js +1 -1
- package/dist/components/motion/combobox/context.js +216 -1
- package/dist/components/motion/combobox/context.js.map +1 -0
- package/dist/components/motion/combobox/list.js +1 -1
- package/dist/components/motion/combobox/trigger.js +1 -1
- package/dist/components/motion/combobox.js +1 -1
- package/dist/components/motion/expandable-control.d.ts +28 -0
- package/dist/components/motion/expandable-control.d.ts.map +1 -0
- package/dist/components/motion/expandable-control.js +149 -0
- package/dist/components/motion/expandable-control.js.map +1 -0
- package/dist/components/motion/expanding-arrow-button.d.ts +12 -0
- package/dist/components/motion/expanding-arrow-button.d.ts.map +1 -0
- package/dist/components/motion/expanding-arrow-button.js +142 -0
- package/dist/components/motion/expanding-arrow-button.js.map +1 -0
- package/dist/components/motion/file-tree.d.ts +42 -0
- package/dist/components/motion/file-tree.d.ts.map +1 -0
- package/dist/components/motion/file-tree.js +272 -0
- package/dist/components/motion/file-tree.js.map +1 -0
- package/dist/components/motion/input.d.ts +2 -0
- package/dist/components/motion/input.d.ts.map +1 -1
- package/dist/components/motion/input.js +28 -25
- package/dist/components/motion/input.js.map +1 -1
- package/dist/components/motion/liquid.d.ts +30 -0
- package/dist/components/motion/liquid.d.ts.map +1 -0
- package/dist/components/motion/liquid.js +248 -0
- package/dist/components/motion/liquid.js.map +1 -0
- package/dist/components/motion/multi-select/content.d.ts +16 -0
- package/dist/components/motion/multi-select/content.d.ts.map +1 -0
- package/dist/components/motion/multi-select/content.js +91 -0
- package/dist/components/motion/multi-select/content.js.map +1 -0
- package/dist/components/motion/multi-select/context.d.ts +64 -0
- package/dist/components/motion/multi-select/context.d.ts.map +1 -0
- package/dist/{context-BizvUNZv.js → components/motion/multi-select/context.js} +44 -114
- package/dist/components/motion/multi-select/context.js.map +1 -0
- package/dist/components/motion/multi-select/index.d.ts +5 -0
- package/dist/components/motion/multi-select/index.js +6 -0
- package/dist/components/motion/multi-select/list.d.ts +40 -0
- package/dist/components/motion/multi-select/list.d.ts.map +1 -0
- package/dist/components/motion/multi-select/list.js +144 -0
- package/dist/components/motion/multi-select/list.js.map +1 -0
- package/dist/components/motion/multi-select/trigger.d.ts +22 -0
- package/dist/components/motion/multi-select/trigger.d.ts.map +1 -0
- package/dist/components/motion/multi-select/trigger.js +185 -0
- package/dist/components/motion/multi-select/trigger.js.map +1 -0
- package/dist/components/motion/signup-form.js +6 -2
- package/dist/components/motion/signup-form.js.map +1 -1
- package/dist/components/motion/table/index.js.map +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block-highlight.d.ts +216 -0
- package/dist/components/reui/code-block/code-block-highlight.d.ts.map +1 -0
- package/dist/components/reui/code-block/code-block-highlight.js +792 -0
- package/dist/components/reui/code-block/code-block-highlight.js.map +1 -0
- package/dist/components/reui/code-block/code-block.d.ts +197 -0
- package/dist/components/reui/code-block/code-block.d.ts.map +1 -0
- package/dist/components/reui/code-block/code-block.js +1150 -0
- package/dist/components/reui/code-block/code-block.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts +117 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1554 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +6 -4
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +10 -7
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +3 -2
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-i18n.d.ts +2 -0
- package/dist/components/reui/data-grid/data-grid-i18n.js +53 -0
- package/dist/components/reui/data-grid/data-grid-i18n.js.map +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js +14 -8
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +3 -3
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +6 -4
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +2 -2
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +17 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +146 -50
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +23 -4
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +215 -68
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +276 -6
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +150 -15
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/filters/filters-advanced.js.map +1 -1
- package/dist/components/reui/filters/filters-chip.js.map +1 -1
- package/dist/components/reui/filters/filters.d.ts.map +1 -1
- package/dist/components/reui/filters/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +42 -12
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
- package/dist/components/reui/gantt/gantt-dnd.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-dnd.js +22 -7
- package/dist/components/reui/gantt/gantt-dnd.js.map +1 -1
- package/dist/components/reui/gantt/gantt-i18n.d.ts +8 -0
- package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-i18n.js +6 -1
- package/dist/components/reui/gantt/gantt-i18n.js.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.d.ts +59 -2
- package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.js +67 -2
- package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
- package/dist/components/reui/gantt/gantt-recurrence.js +3 -3
- package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
- package/dist/components/reui/gantt/gantt-types.d.ts +32 -1
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +324 -35
- package/dist/components/reui/gantt/gantt-view.js.map +1 -1
- package/dist/components/reui/gantt/gantt.d.ts +71 -2
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt.js +8 -0
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/message-scroller.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/{copy-menu-1FKoMc9o.js → copy-menu-C5GaT4Z-.js} +67 -2
- package/dist/copy-menu-C5GaT4Z-.js.map +1 -0
- package/dist/data-grid-i18n-52UUYPbr.d.ts +66 -0
- package/dist/data-grid-i18n-52UUYPbr.d.ts.map +1 -0
- package/dist/types-smkWN_7x.d.ts.map +1 -1
- package/dist/use-active-option-CmX6Z-4S.js +86 -0
- package/dist/use-active-option-CmX6Z-4S.js.map +1 -0
- package/package.json +7 -13
- package/dist/context-BizvUNZv.js.map +0 -1
- package/dist/copy-menu-1FKoMc9o.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
4
|
-
import { flattenResources, toZoned } from "./gantt-lib.js";
|
|
4
|
+
import { flattenResources, getBaselineVariance, resolveEventBaseline, toZoned } from "./gantt-lib.js";
|
|
5
5
|
import { useGantt, useGanttSelector, useGanttViewConfig } from "./gantt.js";
|
|
6
6
|
import { useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
|
|
7
7
|
import { createContext, useContext, useMemo, useState } from "react";
|
|
@@ -82,6 +82,9 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
|
|
|
82
82
|
const [tipOpen, setTipOpen] = useState(false);
|
|
83
83
|
const anyInteracting = useGanttSelector((state) => tipOpen && (state.drag !== null || state.slotDraft !== null), { calendar: instance });
|
|
84
84
|
const progress = typeof event.progress === "number" ? Math.min(Math.max(Math.round(event.progress), 0), 100) : null;
|
|
85
|
+
const milestone = occurrence.end.getTime() === occurrence.start.getTime();
|
|
86
|
+
const baseline = viewConfig.baselineBars ? resolveEventBaseline(event) : null;
|
|
87
|
+
const baselineVariance = baseline ? getBaselineVariance(event) : null;
|
|
85
88
|
const defaultContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
86
89
|
occurrence.isRecurring && /* @__PURE__ */ jsx(RepeatIcon, {
|
|
87
90
|
className: "size-2.5 shrink-0 opacity-70",
|
|
@@ -102,9 +105,19 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
|
|
|
102
105
|
isDragging,
|
|
103
106
|
isSelected
|
|
104
107
|
};
|
|
105
|
-
const content = children ?? viewConfig.renderEvent?.(renderProps) ?? (labelOutside ? null : defaultContent);
|
|
108
|
+
const content = children ?? viewConfig.renderEvent?.(renderProps) ?? (labelOutside || milestone ? null : defaultContent);
|
|
106
109
|
const consumerOwnsContent = children !== void 0 || !!viewConfig.renderEvent;
|
|
107
110
|
const timeLabel = settings.i18n.functions.formatEventTime(toZoned(occurrence.start, settings.timeZone), toZoned(occurrence.end, settings.timeZone), occurrence.allDay, settings.locale);
|
|
111
|
+
const baselineStartMs = baseline?.start.getTime();
|
|
112
|
+
const baselineEndMs = baseline?.end.getTime();
|
|
113
|
+
const plannedLabel = useMemo(() => baselineStartMs === void 0 || baselineEndMs === void 0 ? void 0 : settings.i18n.labels.planned(settings.i18n.functions.formatEventTime(toZoned(new Date(baselineStartMs), settings.timeZone), toZoned(new Date(baselineEndMs), settings.timeZone), occurrence.allDay, settings.locale)), [
|
|
114
|
+
baselineStartMs,
|
|
115
|
+
baselineEndMs,
|
|
116
|
+
occurrence.allDay,
|
|
117
|
+
settings.i18n,
|
|
118
|
+
settings.timeZone,
|
|
119
|
+
settings.locale
|
|
120
|
+
]);
|
|
108
121
|
const fallbackRowTitle = useMemo(() => rowTitleProp === void 0 && event.resourceId ? flattenResources(settings.resources).find(({ resource }) => resource.id === event.resourceId)?.resource.title : void 0, [
|
|
109
122
|
rowTitleProp,
|
|
110
123
|
event.resourceId,
|
|
@@ -133,6 +146,7 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
|
|
|
133
146
|
const defaultProps = {
|
|
134
147
|
type: "button",
|
|
135
148
|
"data-slot": "gantt-bar",
|
|
149
|
+
"data-milestone": milestone || void 0,
|
|
136
150
|
"data-all-day": occurrence.allDay || void 0,
|
|
137
151
|
"data-recurring": occurrence.isRecurring || void 0,
|
|
138
152
|
"data-selected": isSelected || void 0,
|
|
@@ -142,11 +156,15 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
|
|
|
142
156
|
"data-label-outside": labelOutside || void 0,
|
|
143
157
|
"data-progress": progress ?? void 0,
|
|
144
158
|
"data-completed": progress === 100 || void 0,
|
|
159
|
+
"data-baseline": !!baseline || void 0,
|
|
160
|
+
"data-baseline-variance": baselineVariance ?? void 0,
|
|
145
161
|
"aria-label": settings.i18n.functions.formatEventAriaLabel({
|
|
146
162
|
title: event.title,
|
|
147
163
|
timeLabel,
|
|
164
|
+
milestoneLabel: milestone ? settings.i18n.labels.milestone : void 0,
|
|
148
165
|
rowTitle,
|
|
149
166
|
progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : void 0,
|
|
167
|
+
plannedLabel,
|
|
150
168
|
continues: segment.continuesBefore || segment.continuesAfter
|
|
151
169
|
}),
|
|
152
170
|
style: { "--gantt-event-color": event.color ?? "var(--color-primary)" },
|
|
@@ -164,16 +182,21 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
|
|
|
164
182
|
e.stopPropagation();
|
|
165
183
|
settings.onEventDoubleClick?.(occurrence, e);
|
|
166
184
|
},
|
|
167
|
-
className: cn("group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal", "outline-none focus-visible:ring-2 focus-visible:ring-ring/50", "bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30", "data-[drag-kind=move]:opacity-0", "data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40", "data-selected:bg-(--gantt-event-color)/30", segment.continuesBefore && "rounded-s-none", segment.continuesAfter && "rounded-e-none", viewConfig.classNames?.event, className),
|
|
185
|
+
className: cn("group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal", "outline-none focus-visible:ring-2 focus-visible:ring-ring/50", "bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30", "data-[drag-kind=move]:opacity-0", "data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40", "data-selected:bg-(--gantt-event-color)/30", milestone && "justify-center bg-transparent px-0 hover:bg-transparent data-selected:bg-transparent", segment.continuesBefore && "rounded-s-none", segment.continuesAfter && "rounded-e-none", viewConfig.classNames?.event, className),
|
|
168
186
|
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
169
|
-
|
|
187
|
+
milestone && !consumerOwnsContent && /* @__PURE__ */ jsx("span", {
|
|
188
|
+
"aria-hidden": true,
|
|
189
|
+
"data-slot": "gantt-bar-milestone",
|
|
190
|
+
className: cn("size-2.5 shrink-0 rotate-45 rounded-[2px] border border-(--gantt-event-color) bg-(--gantt-event-color)/80", isSelected && "ring-2 ring-ring/50")
|
|
191
|
+
}),
|
|
192
|
+
progress !== null && !milestone && /* @__PURE__ */ jsx("span", {
|
|
170
193
|
"aria-hidden": true,
|
|
171
194
|
"data-slot": "gantt-bar-progress",
|
|
172
195
|
className: "pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0",
|
|
173
196
|
"data-full": progress === 100 || void 0,
|
|
174
197
|
style: { width: `${progress}%` }
|
|
175
198
|
}),
|
|
176
|
-
progress === 100 && !consumerOwnsContent && /* @__PURE__ */ jsx(CheckIcon, {
|
|
199
|
+
progress === 100 && !consumerOwnsContent && !milestone && /* @__PURE__ */ jsx(CheckIcon, {
|
|
177
200
|
className: "relative size-2.5 shrink-0 opacity-80",
|
|
178
201
|
"aria-hidden": "true"
|
|
179
202
|
}),
|
|
@@ -200,13 +223,20 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
|
|
|
200
223
|
children: [menu ? /* @__PURE__ */ jsx(ContextMenuTrigger, { render: /* @__PURE__ */ jsx(TooltipTrigger, { render: barButton }) }) : /* @__PURE__ */ jsx(TooltipTrigger, { render: barButton }), tipOpen && !anyInteracting && /* @__PURE__ */ jsxs(TooltipContent, {
|
|
201
224
|
side: "top",
|
|
202
225
|
className: "pointer-events-none",
|
|
203
|
-
children: [
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ jsx("div", {
|
|
228
|
+
className: "font-medium",
|
|
229
|
+
children: event.title
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ jsx("div", {
|
|
232
|
+
className: "opacity-80",
|
|
233
|
+
children: timeLabel
|
|
234
|
+
}),
|
|
235
|
+
plannedLabel && /* @__PURE__ */ jsx("div", {
|
|
236
|
+
className: "opacity-80",
|
|
237
|
+
children: plannedLabel
|
|
238
|
+
})
|
|
239
|
+
]
|
|
210
240
|
})]
|
|
211
241
|
})
|
|
212
242
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-bar.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n createContext,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { CheckIcon, RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../../ui/context-menu\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGantt, useGanttSelector, useGanttViewConfig } from \"./gantt\";\nimport { useGanttGestures, wasRecentDrag } from \"./gantt-dnd\";\nimport { flattenResources, toZoned } from \"./gantt-lib\";\nimport type { GanttOccurrence, GanttSegment } from \"./gantt-types\";\n\n/**\n * Effective Tailwind palette presets for bar colors; every entry works on\n * light and dark surfaces through the bar's alpha background + accent border.\n */\nconst GANTT_COLORS: Array<{ name: string; value: string }> = [\n { name: \"Blue\", value: \"var(--color-blue-500)\" },\n { name: \"Emerald\", value: \"var(--color-emerald-500)\" },\n { name: \"Violet\", value: \"var(--color-violet-500)\" },\n { name: \"Rose\", value: \"var(--color-rose-500)\" },\n { name: \"Amber\", value: \"var(--color-amber-500)\" },\n { name: \"Cyan\", value: \"var(--color-cyan-500)\" },\n { name: \"Orange\", value: \"var(--color-orange-500)\" },\n { name: \"Pink\", value: \"var(--color-pink-500)\" },\n { name: \"Teal\", value: \"var(--color-teal-500)\" },\n { name: \"Indigo\", value: \"var(--color-indigo-500)\" },\n];\n\ninterface GanttBarContextValue<TData = unknown> {\n occurrence: GanttOccurrence<TData>;\n segment: GanttSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst GanttBarContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<GanttBarContextValue<any> | null>(null);\n\n/** The bar's subject; usable inside renderEvent content and bar children. */\nfunction useGanttBarContext<TData = unknown>(): GanttBarContextValue<TData> {\n const ctx = useContext(GanttBarContext);\n if (!ctx) {\n throw new Error(\"useGanttBarContext must be used within <GanttBar>\");\n }\n return ctx as GanttBarContextValue<TData>;\n}\n\ninterface GanttBarProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: GanttSegment<TData>;\n /** Replaces the default bar CONTENT; the wrapper stays gantt-owned. */\n children?: ReactNode;\n /**\n * The title renders beside the bar (view-owned), so the default inner\n * content is suppressed. Explicit children and renderEvent still win.\n */\n labelOutside?: boolean;\n /**\n * The owning row's title for the aria-label. Pass it when the row is in\n * scope (the internal view does); omitting falls back to a tree lookup.\n */\n rowTitle?: string;\n}\n\n/**\n * The one interactive bar element. The wrapper owns positioning hooks, a11y,\n * selection, drag/resize listeners, and data attributes; content comes from\n * children, the root renderEvent override, or the built-in default.\n */\nfunction GanttBar<TData = unknown>({\n segment,\n className,\n render,\n children,\n labelOutside,\n rowTitle: rowTitleProp,\n ...props\n}: GanttBarProps<TData>) {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n const gestures = useGanttGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelected = useGanttSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDragging = useGanttSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // Which gesture owns this bar: a move hides the original (the smooth clone\n // stands in for it); a resize keeps it as a faint placeholder behind the\n // dashed preview so you can see the original extent.\n const dragKind = useGanttSelector<TData, string | null>(\n (state) => (state.drag?.occurrence.key === occurrence.key ? state.drag.kind : null),\n { calendar: instance },\n );\n // Hover-only range tooltip. Focus opens are ignored (the known button+\n // tooltip flash: clicking a bar opens a dialog, focus returns, and a\n // focus-triggered tooltip would pop). Hidden while dragging/resizing.\n const [tipOpen, setTipOpen] = useState(false);\n // Gated on tipOpen: with the tooltip closed the selector returns a stable\n // false, so gesture start/end doesn't re-render every mounted bar.\n const anyInteracting = useGanttSelector<TData, boolean>(\n (state) => tipOpen && (state.drag !== null || state.slotDraft !== null),\n { calendar: instance },\n );\n\n const progress =\n typeof event.progress === \"number\"\n ? Math.min(Math.max(Math.round(event.progress), 0), 100)\n : null;\n\n const defaultContent = (\n <>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate font-medium\">{event.title}</span>\n {!occurrence.allDay && segment.isStart && (\n <span className=\"@[8rem]:inline hidden truncate text-muted-foreground\">\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n )}\n </span>\n )}\n </>\n );\n\n const renderProps = { occurrence, segment, isDragging, isSelected };\n const content =\n children ?? viewConfig.renderEvent?.(renderProps) ?? (labelOutside ? null : defaultContent);\n // Consumer-owned content owns the WHOLE inner visualization: the built-in\n // progress fill and done mark yield so custom bars start from a blank\n // canvas (progress stays readable via data-progress/data-completed).\n const consumerOwnsContent = children !== undefined || !!viewConfig.renderEvent;\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n );\n // name the row too: the split-pane layout carries no grid semantics.\n // The prop path is O(1); the lookup fallback is memoized so external\n // GanttBar usage never flattens the tree per render.\n const fallbackRowTitle = useMemo(\n () =>\n rowTitleProp === undefined && event.resourceId\n ? flattenResources(settings.resources).find(\n ({ resource }) => resource.id === event.resourceId,\n )?.resource.title\n : undefined,\n [rowTitleProp, event.resourceId, settings.resources],\n );\n const rowTitle = rowTitleProp ?? fallbackRowTitle;\n\n const showResize = gestures.canResize(segment);\n const resizeHandles = showResize && (\n <>\n {segment.isStart && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"start\"\n // grip hugs the start edge (justify-start + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 start-0.5 flex w-2 cursor-ew-resize items-center justify-start opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n {segment.isEnd && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"end\"\n // grip hugs the end edge (justify-end + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 end-0.5 flex w-2 cursor-ew-resize items-center justify-end opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"gantt-bar\",\n \"data-all-day\": occurrence.allDay || undefined,\n \"data-recurring\": occurrence.isRecurring || undefined,\n \"data-selected\": isSelected || undefined,\n \"data-dragging\": isDragging || undefined,\n \"data-drag-kind\": dragKind ?? undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n \"data-label-outside\": labelOutside || undefined,\n \"data-progress\": progress ?? undefined,\n \"data-completed\": progress === 100 || undefined,\n \"aria-label\": settings.i18n.functions.formatEventAriaLabel({\n title: event.title,\n timeLabel,\n rowTitle,\n progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : undefined,\n continues: segment.continuesBefore || segment.continuesAfter,\n }),\n style: {\n \"--gantt-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n instance.api.selectEvent(occurrence.key);\n settings.onEventClick?.(occurrence, e);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n // the unfilled remainder has to be legible on its own - at /12 a bar\n // with a progress fill read as a floating segment with no basement\n \"bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30\",\n // move: hide the original (the smooth cursor clone represents it)\n \"data-[drag-kind=move]:opacity-0\",\n // resize: keep the original event exactly, just fade it to a soft\n // placeholder behind the dashed preview - no dramatic restyle\n \"data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40\",\n \"data-selected:bg-(--gantt-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {progress !== null && (\n // Chrome, not content: it is an absolutely-positioned layer BEHIND\n // whatever the bar renders, so a consumer bar (renderEvent) keeps\n // its completion fill instead of silently losing it. The inline\n // done-mark below stays gated, because that one really is content.\n <span\n aria-hidden\n data-slot=\"gantt-bar-progress\"\n className=\"pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0\"\n data-full={progress === 100 || undefined}\n style={{ width: `${progress}%` }}\n />\n )}\n {progress === 100 && !consumerOwnsContent && (\n // done mark: completion chrome like the fill itself, so it shows\n // for outside-label bars too (where the inner content is empty)\n <CheckIcon className=\"relative size-2.5 shrink-0 opacity-80\" aria-hidden=\"true\" />\n )}\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const barButton = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n // Consumer-owned right-click menu (headless): the primitive only wires the\n // ContextMenu; the items and their handlers come entirely from the block.\n const menu = viewConfig.renderEventMenu?.(renderProps);\n\n // The bar is simultaneously the tooltip trigger and (when a menu exists)\n // the context-menu trigger; Base UI composes both via render props.\n const trigger = menu ? (\n <ContextMenuTrigger render={<TooltipTrigger render={barButton} />} />\n ) : (\n <TooltipTrigger render={barButton} />\n );\n\n const barTree = (\n <TooltipProvider delay={500} closeDelay={0} timeout={300}>\n <Tooltip\n open={tipOpen && !anyInteracting}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens only on hover; focus/press opens are dropped\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n {trigger}\n {tipOpen && !anyInteracting && (\n <TooltipContent side=\"top\" className=\"pointer-events-none\">\n <div className=\"font-medium\">{event.title}</div>\n <div className=\"opacity-80\">{timeLabel}</div>\n </TooltipContent>\n )}\n </Tooltip>\n </TooltipProvider>\n );\n\n return (\n <GanttBarContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {menu ? (\n <ContextMenu>\n {barTree}\n <ContextMenuContent data-slot=\"gantt-bar-menu\" className=\"min-w-44\">\n {menu}\n </ContextMenuContent>\n </ContextMenu>\n ) : (\n barTree\n )}\n </GanttBarContext.Provider>\n );\n}\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B,OAAO;GAAE;GAAY;GAAS;GAAY;EAAW;EAC5E,UAAA,OACC,qBAAC,aAAD,EAAA,UAAA,CACG,SACD,oBAAC,oBAAD;GAAoB,aAAU;GAAiB,WAAU;GACtD,UAAA;EACiB,CAAA,CACT,EAAA,CAAA,IAEb;CAEsB,CAAA;AAE9B"}
|
|
1
|
+
{"version":3,"file":"gantt-bar.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n createContext,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { CheckIcon, RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../../ui/context-menu\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGantt, useGanttSelector, useGanttViewConfig } from \"./gantt\";\nimport { useGanttGestures, wasRecentDrag } from \"./gantt-dnd\";\nimport { flattenResources, getBaselineVariance, resolveEventBaseline, toZoned } from \"./gantt-lib\";\nimport type { GanttOccurrence, GanttSegment } from \"./gantt-types\";\n\n/**\n * Effective Tailwind palette presets for bar colors; every entry works on\n * light and dark surfaces through the bar's alpha background + accent border.\n */\nconst GANTT_COLORS: Array<{ name: string; value: string }> = [\n { name: \"Blue\", value: \"var(--color-blue-500)\" },\n { name: \"Emerald\", value: \"var(--color-emerald-500)\" },\n { name: \"Violet\", value: \"var(--color-violet-500)\" },\n { name: \"Rose\", value: \"var(--color-rose-500)\" },\n { name: \"Amber\", value: \"var(--color-amber-500)\" },\n { name: \"Cyan\", value: \"var(--color-cyan-500)\" },\n { name: \"Orange\", value: \"var(--color-orange-500)\" },\n { name: \"Pink\", value: \"var(--color-pink-500)\" },\n { name: \"Teal\", value: \"var(--color-teal-500)\" },\n { name: \"Indigo\", value: \"var(--color-indigo-500)\" },\n];\n\ninterface GanttBarContextValue<TData = unknown> {\n occurrence: GanttOccurrence<TData>;\n segment: GanttSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst GanttBarContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<GanttBarContextValue<any> | null>(null);\n\n/** The bar's subject; usable inside renderEvent content and bar children. */\nfunction useGanttBarContext<TData = unknown>(): GanttBarContextValue<TData> {\n const ctx = useContext(GanttBarContext);\n if (!ctx) {\n throw new Error(\"useGanttBarContext must be used within <GanttBar>\");\n }\n return ctx as GanttBarContextValue<TData>;\n}\n\ninterface GanttBarProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: GanttSegment<TData>;\n /** Replaces the default bar CONTENT; the wrapper stays gantt-owned. */\n children?: ReactNode;\n /**\n * The title renders beside the bar (view-owned), so the default inner\n * content is suppressed. Explicit children and renderEvent still win.\n */\n labelOutside?: boolean;\n /**\n * The owning row's title for the aria-label. Pass it when the row is in\n * scope (the internal view does); omitting falls back to a tree lookup.\n */\n rowTitle?: string;\n}\n\n/**\n * The one interactive bar element. The wrapper owns positioning hooks, a11y,\n * selection, drag/resize listeners, and data attributes; content comes from\n * children, the root renderEvent override, or the built-in default.\n */\nfunction GanttBar<TData = unknown>({\n segment,\n className,\n render,\n children,\n labelOutside,\n rowTitle: rowTitleProp,\n ...props\n}: GanttBarProps<TData>) {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n const gestures = useGanttGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelected = useGanttSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDragging = useGanttSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // Which gesture owns this bar: a move hides the original (the smooth clone\n // stands in for it); a resize keeps it as a faint placeholder behind the\n // dashed preview so you can see the original extent.\n const dragKind = useGanttSelector<TData, string | null>(\n (state) => (state.drag?.occurrence.key === occurrence.key ? state.drag.kind : null),\n { calendar: instance },\n );\n // Hover-only range tooltip. Focus opens are ignored (the known button+\n // tooltip flash: clicking a bar opens a dialog, focus returns, and a\n // focus-triggered tooltip would pop). Hidden while dragging/resizing.\n const [tipOpen, setTipOpen] = useState(false);\n // Gated on tipOpen: with the tooltip closed the selector returns a stable\n // false, so gesture start/end doesn't re-render every mounted bar.\n const anyInteracting = useGanttSelector<TData, boolean>(\n (state) => tipOpen && (state.drag !== null || state.slotDraft !== null),\n { calendar: instance },\n );\n\n const progress =\n typeof event.progress === \"number\"\n ? Math.min(Math.max(Math.round(event.progress), 0), 100)\n : null;\n\n // A zero-duration occurrence is a MILESTONE: the button stays the\n // interactive shell (click, select, menu, move), the diamond replaces the\n // tinted bar body, and the view keeps the title outside.\n const milestone = occurrence.end.getTime() === occurrence.start.getTime();\n\n // The bar only LABELS its baseline (attributes, tooltip, aria); the ghost\n // itself is view-owned chrome, because its range differs from this bar's.\n const baseline = viewConfig.baselineBars ? resolveEventBaseline(event) : null;\n const baselineVariance = baseline ? getBaselineVariance(event) : null;\n\n const defaultContent = (\n <>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate font-medium\">{event.title}</span>\n {!occurrence.allDay && segment.isStart && (\n <span className=\"@[8rem]:inline hidden truncate text-muted-foreground\">\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n )}\n </span>\n )}\n </>\n );\n\n const renderProps = { occurrence, segment, isDragging, isSelected };\n const content =\n children ??\n viewConfig.renderEvent?.(renderProps) ??\n (labelOutside || milestone ? null : defaultContent);\n // Consumer-owned content owns the WHOLE inner visualization: the built-in\n // progress fill and done mark yield so custom bars start from a blank\n // canvas (progress stays readable via data-progress/data-completed).\n const consumerOwnsContent = children !== undefined || !!viewConfig.renderEvent;\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n );\n // Memoized: a second full formatEventTime per render would double the\n // bar's formatting cost, and it cannot wait for the tooltip because the\n // label also feeds aria-label. Keyed on the instants, not the baseline\n // object - resolveEventBaseline allocates a fresh one every render.\n const baselineStartMs = baseline?.start.getTime();\n const baselineEndMs = baseline?.end.getTime();\n const plannedLabel = useMemo(\n () =>\n baselineStartMs === undefined || baselineEndMs === undefined\n ? undefined\n : settings.i18n.labels.planned(\n settings.i18n.functions.formatEventTime(\n toZoned(new Date(baselineStartMs), settings.timeZone),\n toZoned(new Date(baselineEndMs), settings.timeZone),\n occurrence.allDay,\n settings.locale,\n ),\n ),\n [\n baselineStartMs,\n baselineEndMs,\n occurrence.allDay,\n settings.i18n,\n settings.timeZone,\n settings.locale,\n ],\n );\n // name the row too: the split-pane layout carries no grid semantics.\n // The prop path is O(1); the lookup fallback is memoized so external\n // GanttBar usage never flattens the tree per render.\n const fallbackRowTitle = useMemo(\n () =>\n rowTitleProp === undefined && event.resourceId\n ? flattenResources(settings.resources).find(\n ({ resource }) => resource.id === event.resourceId,\n )?.resource.title\n : undefined,\n [rowTitleProp, event.resourceId, settings.resources],\n );\n const rowTitle = rowTitleProp ?? fallbackRowTitle;\n\n const showResize = gestures.canResize(segment);\n const resizeHandles = showResize && (\n <>\n {segment.isStart && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"start\"\n // grip hugs the start edge (justify-start + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 start-0.5 flex w-2 cursor-ew-resize items-center justify-start opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n {segment.isEnd && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"end\"\n // grip hugs the end edge (justify-end + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 end-0.5 flex w-2 cursor-ew-resize items-center justify-end opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"gantt-bar\",\n \"data-milestone\": milestone || undefined,\n \"data-all-day\": occurrence.allDay || undefined,\n \"data-recurring\": occurrence.isRecurring || undefined,\n \"data-selected\": isSelected || undefined,\n \"data-dragging\": isDragging || undefined,\n \"data-drag-kind\": dragKind ?? undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n \"data-label-outside\": labelOutside || undefined,\n \"data-progress\": progress ?? undefined,\n \"data-completed\": progress === 100 || undefined,\n \"data-baseline\": !!baseline || undefined,\n \"data-baseline-variance\": baselineVariance ?? undefined,\n \"aria-label\": settings.i18n.functions.formatEventAriaLabel({\n title: event.title,\n timeLabel,\n milestoneLabel: milestone ? settings.i18n.labels.milestone : undefined,\n rowTitle,\n progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : undefined,\n plannedLabel,\n continues: segment.continuesBefore || segment.continuesAfter,\n }),\n style: {\n \"--gantt-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n instance.api.selectEvent(occurrence.key);\n settings.onEventClick?.(occurrence, e);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n // the unfilled remainder has to be legible on its own - at /12 a bar\n // with a progress fill read as a floating segment with no basement\n \"bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30\",\n // move: hide the original (the smooth cursor clone represents it)\n \"data-[drag-kind=move]:opacity-0\",\n // resize: keep the original event exactly, just fade it to a soft\n // placeholder behind the dashed preview - no dramatic restyle\n \"data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40\",\n \"data-selected:bg-(--gantt-event-color)/30\",\n /* the diamond is the milestone's body, so the shell sheds its own\n tinted fill and centers the glyph on the instant */\n milestone &&\n \"justify-center bg-transparent px-0 hover:bg-transparent data-selected:bg-transparent\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {milestone && !consumerOwnsContent && (\n // the filled diamond IS the milestone's body - chrome, so a custom\n // renderEvent still starts from a blank canvas (data-milestone\n // keeps the fact readable there)\n <span\n aria-hidden\n data-slot=\"gantt-bar-milestone\"\n className={cn(\n \"size-2.5 shrink-0 rotate-45 rounded-[2px] border border-(--gantt-event-color) bg-(--gantt-event-color)/80\",\n isSelected && \"ring-2 ring-ring/50\",\n )}\n />\n )}\n {progress !== null && !milestone && (\n // Chrome, not content: it is an absolutely-positioned layer BEHIND\n // whatever the bar renders, so a consumer bar (renderEvent) keeps\n // its completion fill instead of silently losing it. The inline\n // done-mark below stays gated, because that one really is content.\n <span\n aria-hidden\n data-slot=\"gantt-bar-progress\"\n className=\"pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0\"\n data-full={progress === 100 || undefined}\n style={{ width: `${progress}%` }}\n />\n )}\n {progress === 100 && !consumerOwnsContent && !milestone && (\n // done mark: completion chrome like the fill itself, so it shows\n // for outside-label bars too (where the inner content is empty)\n <CheckIcon className=\"relative size-2.5 shrink-0 opacity-80\" aria-hidden=\"true\" />\n )}\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const barButton = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n // Consumer-owned right-click menu (headless): the primitive only wires the\n // ContextMenu; the items and their handlers come entirely from the block.\n const menu = viewConfig.renderEventMenu?.(renderProps);\n\n // The bar is simultaneously the tooltip trigger and (when a menu exists)\n // the context-menu trigger; Base UI composes both via render props.\n const trigger = menu ? (\n <ContextMenuTrigger render={<TooltipTrigger render={barButton} />} />\n ) : (\n <TooltipTrigger render={barButton} />\n );\n\n const barTree = (\n <TooltipProvider delay={500} closeDelay={0} timeout={300}>\n <Tooltip\n open={tipOpen && !anyInteracting}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens only on hover; focus/press opens are dropped\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n {trigger}\n {tipOpen && !anyInteracting && (\n <TooltipContent side=\"top\" className=\"pointer-events-none\">\n <div className=\"font-medium\">{event.title}</div>\n <div className=\"opacity-80\">{timeLabel}</div>\n {plannedLabel && <div className=\"opacity-80\">{plannedLabel}</div>}\n </TooltipContent>\n )}\n </Tooltip>\n </TooltipProvider>\n );\n\n return (\n <GanttBarContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {menu ? (\n <ContextMenu>\n {barTree}\n <ContextMenuContent data-slot=\"gantt-bar-menu\" className=\"min-w-44\">\n {menu}\n </ContextMenuContent>\n </ContextMenu>\n ) : (\n barTree\n )}\n </GanttBarContext.Provider>\n );\n}\n\nexport type { GanttBarContextValue, GanttBarProps };\nexport { G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;iBAgCG;;iBAKA;;iBAeA;;;;;;iBASA;;
|
|
1
|
+
{"version":3,"file":"gantt-dnd.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-dnd.tsx"],"mappings":";;;;;;;;cAeM;;;;;;iBAgCG;;iBAKA;;iBAeA;;;;;;iBASA;;iBAmwBA,iBAAiB;EAkBlB,YAAA,GAAA,MAAM,cAAY,SAAW,aAAa;EA+B1C,cAAA,GAAA,MAAM,cAAY,SAAW,aAAa,QAAM;EAkBhD,cAAA,GAAA,MAAM;EA1DA,UAAA,SAAA,aAAa;EAyBb,YAAA,SAAA,aAAa"}
|
|
@@ -197,11 +197,24 @@ function beginGesture(config) {
|
|
|
197
197
|
adoptRootTypography(overlay);
|
|
198
198
|
overlay.style.height = `${barHeight}px`;
|
|
199
199
|
const barEl = document.createElement("div");
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
if (occurrence.end.getTime() === occurrence.start.getTime()) {
|
|
201
|
+
barEl.className = "flex shrink-0 items-center justify-center";
|
|
202
|
+
barEl.style.width = `${barWidth}px`;
|
|
203
|
+
barEl.style.height = "100%";
|
|
204
|
+
const diamond = document.createElement("span");
|
|
205
|
+
diamond.className = "rotate-45 rounded-[2px] shadow-lg";
|
|
206
|
+
diamond.style.width = "10px";
|
|
207
|
+
diamond.style.height = "10px";
|
|
208
|
+
diamond.style.background = `color-mix(in oklab, ${color} 80%, var(--color-background))`;
|
|
209
|
+
diamond.style.border = `1px solid ${color}`;
|
|
210
|
+
barEl.appendChild(diamond);
|
|
211
|
+
} else {
|
|
212
|
+
barEl.className = "shrink-0 rounded-sm shadow-lg";
|
|
213
|
+
barEl.style.width = `${barWidth}px`;
|
|
214
|
+
barEl.style.height = "100%";
|
|
215
|
+
barEl.style.background = `color-mix(in oklab, ${color} 22%, var(--color-background))`;
|
|
216
|
+
barEl.style.outline = `1px solid color-mix(in oklab, ${color} 55%, transparent)`;
|
|
217
|
+
}
|
|
205
218
|
overlay.appendChild(barEl);
|
|
206
219
|
const label = document.createElement("span");
|
|
207
220
|
label.className = "text-foreground truncate font-medium whitespace-nowrap";
|
|
@@ -336,7 +349,8 @@ function beginGesture(config) {
|
|
|
336
349
|
if (kind === "move") {
|
|
337
350
|
const start = at(snapMin(minutesAt(e.clientX) - grabOffsetMin));
|
|
338
351
|
let end;
|
|
339
|
-
if (
|
|
352
|
+
if (occurrence.end.getTime() === occurrence.start.getTime()) end = start;
|
|
353
|
+
else if (tl.snapMin >= 1440 && (occurrence.allDay || midnightAligned(occurrence.start) && midnightAligned(occurrence.end))) {
|
|
340
354
|
const daySpan = Math.max(differenceInCalendarDays(toZoned(occurrence.end, settings.timeZone), toZoned(occurrence.start, settings.timeZone)), 1);
|
|
341
355
|
end = zonedStartOfDay(addDays(toZoned(start, settings.timeZone), daySpan), settings.timeZone);
|
|
342
356
|
} else end = new Date(start.getTime() + (occurrence.end.getTime() - occurrence.start.getTime()));
|
|
@@ -512,6 +526,7 @@ function beginGesture(config) {
|
|
|
512
526
|
internals.setDrag(null);
|
|
513
527
|
if (!drag || !occurrence) return;
|
|
514
528
|
if (overlapRejected) return;
|
|
529
|
+
if (settings.enforceCanDrop && !drag.valid) return;
|
|
515
530
|
if (drag.proposedStart.getTime() === occurrence.start.getTime() && drag.proposedEnd.getTime() === occurrence.end.getTime() && (drag.proposedResourceId === void 0 || drag.proposedResourceId === occurrence.event.resourceId)) return;
|
|
516
531
|
if (internals.applyProposedUpdate({
|
|
517
532
|
event: occurrence.event,
|
|
@@ -572,7 +587,7 @@ function useGanttGestures() {
|
|
|
572
587
|
const canResize = useCallback((segment) => {
|
|
573
588
|
const { interactions } = instance.getState();
|
|
574
589
|
const event = segment.occurrence.event;
|
|
575
|
-
return interactions.resize && !event.readOnly && event.resizable !== false;
|
|
590
|
+
return interactions.resize && !event.readOnly && event.resizable !== false && segment.occurrence.end.getTime() > segment.occurrence.start.getTime();
|
|
576
591
|
}, [instance]);
|
|
577
592
|
return {
|
|
578
593
|
beginMove,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-dnd.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-dnd.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect } from \"react\";\nimport { addDays, differenceInCalendarDays } from \"date-fns\";\n\nimport { type GanttInstance, resolveScheduleMode, useGantt, useGanttViewConfig } from \"./gantt\";\nimport { findResource, snapMinutes, toZoned, zonedStartOfDay } from \"./gantt-lib\";\nimport type { GanttProposedUpdate, GanttScheduleMode, GanttSegment } from \"./gantt-types\";\n\n/**\n * Activation policy (dnd-kit parity where proven):\n * mouse move 5px before a drag starts (below = click), create 4px;\n * touch long-press 250ms with 5px tolerance (movement past tolerance\n * before the delay cancels the drag so taps stay taps).\n */\nconst GANTT_ACTIVATION = {\n moveDistancePx: 5,\n createDistancePx: 4,\n touchDelayMs: 250,\n touchTolerancePx: 5,\n} as const;\n\ntype GestureKind = \"move\" | \"resize-start\" | \"resize-end\" | \"create\";\n\ninterface GanttSurface {\n rect: DOMRect;\n rangeStart: number;\n rangeEnd: number;\n snapMin: number;\n /** Mirrored axis: in RTL the range START sits at the rect's RIGHT edge. */\n isRtl: boolean;\n rows: Array<{ resourceId: string; rect: DOMRect }>;\n}\n\n/**\n * Pointer x (viewport px) to minutes from the range start, clamped to the\n * track. The single place the horizontal axis direction is resolved: every\n * gesture mapping (move, both resizes, create, grab offset) goes through it.\n */\nfunction surfaceMinutesAt(tl: GanttSurface, x: number): number {\n const clamped = Math.min(Math.max(x, tl.rect.left), tl.rect.right);\n const traveled = tl.isRtl ? tl.rect.right - clamped : clamped - tl.rect.left;\n return (traveled / tl.rect.width) * ((tl.rangeEnd - tl.rangeStart) / 60000);\n}\n\n/** Module flag so bar onClick can ignore the click that ends a drag. */\nlet lastGestureEndedAt = 0;\nfunction wasRecentDrag(): boolean {\n return performance.now() - lastGestureEndedAt < 250;\n}\n\n/** Mark a non-dnd gesture (e.g. a timeline pan) so the click it ends is ignored. */\nfunction markGestureEnd(): void {\n lastGestureEndedAt = performance.now();\n}\n\n/**\n * Registry of in-flight gesture cancels. A gesture measures its surface\n * (axis + row rects) once at activation, so the VIEW - not the bar, bars\n * legitimately unmount mid-gesture - must be able to abort gestures when it\n * unmounts or when the measured geometry changes under them (zoom, scale,\n * range growth, splitter). Cancel fully reverts: listeners, overlays and the\n * body drag state all clear, and no update is committed.\n */\nconst activeGestureCancels = new Set<() => void>();\n\n/** Cancel (and fully revert) every in-flight gantt pointer gesture. */\nfunction cancelActiveGanttGestures(): void {\n for (const cancel of [...activeGestureCancels]) cancel();\n}\n\n/**\n * View-level teardown, mounted once by GanttView: aborts any in-flight\n * gesture on unmount so window listeners, body-appended overlays and the\n * gantt-dragging body class never outlive the gantt.\n */\nfunction useGanttGestureTeardown(): void {\n useEffect(() => cancelActiveGanttGestures, []);\n}\n\n/**\n * Snap a translate offset to the device pixel grid. The cursor-following\n * overlays (the move clone and the resize indicator) are their own\n * `will-change: transform` compositing layers: the GPU rasterizes their text\n * once and repositions that texture each frame, so a subpixel translate\n * (getBoundingClientRect and raw clientX/Y are routinely fractional) resamples\n * the texture and blurs the text. Rounding each offset to a whole device pixel\n * lands the layer on the grid so glyphs stay crisp, without giving up the\n * per-frame GPU transform.\n */\nfunction snapToPixel(value: number): number {\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n return Math.round(value * dpr) / dpr;\n}\n\nfunction collectSurface(root: HTMLElement | null): GanttSurface | null {\n if (!root) return null;\n const axis = root.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (!axis) return null;\n return {\n rect: axis.getBoundingClientRect(),\n rangeStart: Number(axis.dataset.ganttRangeStart),\n rangeEnd: Number(axis.dataset.ganttRangeEnd),\n snapMin: Number(axis.dataset.ganttSnap) || 15,\n isRtl: getComputedStyle(axis).direction === \"rtl\",\n rows: [...root.querySelectorAll<HTMLElement>(\"[data-gantt-row]\")]\n // static rows (parents that aggregate their subtree) take no drops\n .filter((row) => row.dataset.ganttRowStatic === undefined)\n .map((row) => ({\n resourceId: row.dataset.ganttResource ?? \"\",\n rect: row.getBoundingClientRect(),\n })),\n };\n}\n\ninterface BeginGestureConfig<TData> {\n instance: GanttInstance<TData>;\n kind: GestureKind;\n origin: HTMLElement;\n startEvent: PointerEvent;\n segment?: GanttSegment<TData>;\n /** Consumer renders the move preview (renderDragPreview); the engine only positions it. */\n customMoveOverlay?: boolean;\n /** Consumer renders the resize indicator; the engine only positions it. */\n customResizeOverlay?: boolean;\n /** View-level cardinality default; a node's own scheduleMode wins. */\n scheduleMode?: GanttScheduleMode;\n}\n\nfunction beginGesture<TData>(config: BeginGestureConfig<TData>) {\n const { instance, kind, origin, startEvent, segment, customMoveOverlay, customResizeOverlay } =\n config;\n const { settings, internals, api } = instance;\n const activation = { ...GANTT_ACTIVATION, ...settings.activation };\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const pointerId = startEvent.pointerId;\n // stable ancestors: bar nodes may be replaced by re-renders mid-gesture\n const viewRoot = origin.closest<HTMLElement>(\"[data-slot=gantt-view]\");\n const ganttRoot = origin.closest<HTMLElement>(\"[data-slot=gantt]\");\n const announcer = ganttRoot?.querySelector<HTMLElement>(\"[data-slot=gantt-announcer]\");\n\n /**\n * The cursor-following overlays are appended to document.body so no ancestor\n * transform or overflow can clip them - which also cuts them off from the\n * gantt root, and the root is what OWNS the type scale (its `text-xs` is\n * what every resting label inherits). Without this the clone's label jumps\n * to the document default and reads visibly bigger than the bar it left.\n * Copying the ROOT's resolved metrics - rather than hardcoding a size -\n * keeps the documented contract that one class on the root (e.g.\n * className=\"text-sm\") rescales the whole gantt, drag clone included.\n */\n const adoptRootTypography = (el: HTMLElement) => {\n if (!ganttRoot) return;\n const rootStyle = getComputedStyle(ganttRoot);\n el.style.fontSize = rootStyle.fontSize;\n el.style.lineHeight = rootStyle.lineHeight;\n el.style.fontFamily = rootStyle.fontFamily;\n el.style.letterSpacing = rootStyle.letterSpacing;\n // physical positioning, logical content: the flex row mirrors so the\n // label lands on the same side of the bar as the resting one in RTL\n el.style.direction = rootStyle.direction;\n };\n\n const isTouch = startEvent.pointerType === \"touch\";\n // resize activates immediately on precise pointers; on touch it waits for\n // the same long-press as a move, so a stray brush over a bar edge can\n // never start an accidental resize\n let active = kind.startsWith(\"resize\") && !isTouch;\n let surface: GanttSurface | null = active ? collectSurface(viewRoot) : null;\n let lastProposalKey = \"\";\n let touchTimer: ReturnType<typeof setTimeout> | null = null;\n let lastPointer: PointerEvent = startEvent;\n\n const occurrence = segment?.occurrence;\n\n // ----- neighbour awareness: the other schedules in the SAME node -----\n // A node in \"single\" mode rejects any concurrency regardless of the\n // overlap option; otherwise the option decides. \"allow\" short-circuits\n // everything below, so the default gesture path is untouched.\n const nodeId = occurrence?.event.resourceId;\n const nodeMode = resolveScheduleMode(\n nodeId === undefined ? null : findResource(settings.resources, nodeId),\n config.scheduleMode,\n );\n const overlapPolicy = nodeMode === \"single\" ? (\"reject\" as const) : settings.overlap;\n // Read once per gesture: the gantt never mutates events mid-drag, so the\n // neighbours cannot move under us.\n let neighbourCache: Array<{ start: number; end: number }> | null = null;\n const getNeighbours = () => {\n if (neighbourCache) return neighbourCache;\n neighbourCache =\n !occurrence || nodeId === undefined || overlapPolicy === \"allow\"\n ? []\n : api\n .getOccurrences()\n .filter((other) => other.event.resourceId === nodeId && other.key !== occurrence.key)\n .map((other) => ({\n start: other.start.getTime(),\n end: other.end.getTime(),\n }));\n return neighbourCache;\n };\n const overlapsNeighbour = (start: Date, end: Date) =>\n getNeighbours().some((other) => other.start < end.getTime() && other.end > start.getTime());\n /**\n * Stop the gesture at the neighbour's edge. Runs AFTER snapping so the\n * clamp always wins, and only against neighbours that sit clear of the\n * bar's CURRENT span - a pre-existing overlap has no edge to stop at.\n */\n const clampToNeighbours = (start: Date, end: Date): { start: Date; end: Date } => {\n if (overlapPolicy !== \"clamp\" || !occurrence) return { start, end };\n const anchorStart = occurrence.start.getTime();\n const anchorEnd = occurrence.end.getTime();\n let floor = -Infinity;\n let ceiling = Infinity;\n for (const other of getNeighbours()) {\n if (other.end <= anchorStart) floor = Math.max(floor, other.end);\n else if (other.start >= anchorEnd) ceiling = Math.min(ceiling, other.start);\n }\n if (floor === -Infinity && ceiling === Infinity) return { start, end };\n let from = start.getTime();\n let to = end.getTime();\n if (kind === \"resize-start\") {\n from = Math.min(Math.max(from, floor), to);\n } else if (kind === \"resize-end\") {\n to = Math.max(Math.min(to, ceiling), from);\n } else {\n // a move keeps its duration and parks against whichever edge it meets\n const duration = to - from;\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n if (to > ceiling) {\n to = ceiling;\n from = to - duration;\n }\n // window narrower than the bar itself: park at the earlier edge\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n }\n return { start: new Date(from), end: new Date(to) };\n };\n // Set by applyProposal when a \"reject\" policy refuses the current proposal;\n // read on pointerup so the commit is actually blocked, not merely styled.\n let overlapRejected = false;\n\n // Preserve the grab offset so the bar does not jump to the pointer\n let grabOffsetMin = 0;\n // Smooth cursor-following clone for a move: a real-looking bar that tracks\n // the pointer's x via transform (no per-frame React), lifted with a shadow.\n let overlay: HTMLDivElement | null = null;\n let grabOffsetPx = 0;\n let barTop = 0;\n let barWidth = 0;\n let barHeight = 0;\n\n const createMoveOverlay = () => {\n if (kind !== \"move\" || !occurrence || overlay || barWidth === 0) return;\n // consumer-rendered preview (renderDragPreview): the view mounts it from\n // drag state; positionOverlay adopts it lazily and only writes transforms\n if (customMoveOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n overlay = document.createElement(\"div\");\n overlay.setAttribute(\"data-slot\", \"gantt-drag-overlay\");\n // container: the bar + its label ride together; the label stays OUTSIDE\n // the bar (to the right), matching the resting look - no in-bar text\n overlay.className =\n // physical left-0 anchor: the clone is positioned by translate3d from\n // raw clientX, which is physical - a logical start-0 anchor would pin\n // it to the RIGHT edge in RTL and fling the clone off screen\n \"pointer-events-none fixed top-0 left-0 z-100 flex items-center gap-2 will-change-transform\";\n adoptRootTypography(overlay);\n overlay.style.height = `${barHeight}px`;\n const barEl = document.createElement(\"div\");\n barEl.className = \"shrink-0 rounded-sm shadow-lg\";\n barEl.style.width = `${barWidth}px`;\n barEl.style.height = \"100%\";\n barEl.style.background = `color-mix(in oklab, ${color} 22%, var(--color-background))`;\n barEl.style.outline = `1px solid color-mix(in oklab, ${color} 55%, transparent)`;\n overlay.appendChild(barEl);\n const label = document.createElement(\"span\");\n label.className = \"text-foreground truncate font-medium whitespace-nowrap\";\n label.textContent = occurrence.event.title;\n overlay.appendChild(label);\n document.body.appendChild(overlay);\n positionOverlay(lastPointer);\n };\n\n const positionOverlay = (e: PointerEvent) => {\n if (!overlay && customMoveOverlay && active && kind === \"move\") {\n overlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-drag-overlay][data-custom]\",\n );\n if (overlay) overlay.style.visibility = \"visible\";\n }\n if (!overlay) return;\n // x follows the pointer freely (smooth); y stays on the bar's own row\n overlay.style.transform = `translate3d(${snapToPixel(e.clientX - grabOffsetPx)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n // Resize status indicator: a smooth cursor-following edge line plus a live\n // range + duration chip. The dashed ghost still shows the SNAPPED landing;\n // this overlay is the continuous feedback between snap steps.\n let resizeOverlay: HTMLDivElement | null = null;\n let resizeLine: HTMLDivElement | null = null;\n let resizeRange: HTMLSpanElement | null = null;\n let resizeDot: HTMLSpanElement | null = null;\n let resizeDuration: HTMLSpanElement | null = null;\n\n const positionResizeOverlay = (e: PointerEvent) => {\n if (!resizeOverlay && customResizeOverlay && kind.startsWith(\"resize\")) {\n resizeOverlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-resize-indicator][data-custom]\",\n );\n if (resizeOverlay) resizeOverlay.style.visibility = \"visible\";\n }\n if (!resizeOverlay || !surface) return;\n // x follows the pointer freely (clamped to the track); y stays on the bar\n const x = Math.min(Math.max(e.clientX, surface.rect.left), surface.rect.right);\n resizeOverlay.style.transform = `translate3d(${snapToPixel(x)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n const createResizeOverlay = () => {\n if (!kind.startsWith(\"resize\") || !occurrence || resizeOverlay) return;\n const barEl = origin.closest<HTMLElement>(\"[data-slot=gantt-bar]\");\n const rect = (barEl ?? origin).getBoundingClientRect();\n barTop = rect.top;\n barHeight = rect.height;\n // consumer-rendered indicator: rect capture above still runs (the engine\n // positions the consumer's wrapper), only the default DOM is skipped\n if (customResizeOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n resizeOverlay = document.createElement(\"div\");\n resizeOverlay.setAttribute(\"data-slot\", \"gantt-resize-indicator\");\n resizeOverlay.className =\n // physical left-0 anchor, same reason as the move clone above\n \"pointer-events-none fixed top-0 left-0 z-100 will-change-transform\";\n adoptRootTypography(resizeOverlay);\n resizeOverlay.style.height = `${barHeight}px`;\n resizeLine = document.createElement(\"div\");\n resizeLine.className = \"h-full w-0.5 -translate-x-1/2 rounded-full\";\n resizeLine.style.background = color;\n resizeOverlay.appendChild(resizeLine);\n const chip = document.createElement(\"div\");\n chip.className =\n // physical left-0: centered with a physical translate on a physical anchor\n // no text size of its own: it inherits the root scale adopted above, so\n // the chip tracks a consumer rescale instead of pinning itself to 12px\n \"bg-foreground text-background absolute bottom-full left-0 mb-1.5 flex -translate-x-1/2 items-center gap-1.5 rounded-md px-2 py-1 font-medium whitespace-nowrap\";\n resizeRange = document.createElement(\"span\");\n chip.appendChild(resizeRange);\n resizeDot = document.createElement(\"span\");\n resizeDot.className = \"bg-background/40 size-1 shrink-0 rounded-full\";\n resizeDot.setAttribute(\"aria-hidden\", \"true\");\n chip.appendChild(resizeDot);\n resizeDuration = document.createElement(\"span\");\n chip.appendChild(resizeDuration);\n // The arrow. Every other bubble in the gantt has one pointing at what it\n // describes; this chip had none, so a resize looked like a different\n // component from the hover hint. Physical left-1/2 to match the chip's own\n // physical anchor, and out of flow so the chip's flex gap ignores it.\n const chipArrow = document.createElement(\"span\");\n chipArrow.setAttribute(\"aria-hidden\", \"true\");\n chipArrow.className =\n \"bg-foreground absolute -bottom-1 left-1/2 size-2.5 -translate-x-1/2 rotate-45 rounded-[2px]\";\n chip.appendChild(chipArrow);\n resizeOverlay.appendChild(chip);\n document.body.appendChild(resizeOverlay);\n // seed the chip with the CURRENT range so it never flashes empty;\n // zoned so the label names the same day the grid shows\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay ?? false,\n settings.locale,\n );\n const days = Math.round((occurrence.end.getTime() - occurrence.start.getTime()) / 86_400_000);\n if (days >= 1) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n } else {\n resizeDot.style.display = \"none\";\n resizeDuration.style.display = \"none\";\n }\n positionResizeOverlay(startEvent);\n };\n\n // resize activates immediately, so its indicator mounts with the gesture\n if (active) createResizeOverlay();\n\n const activationDistance =\n kind === \"create\" ? activation.createDistancePx : activation.moveDistancePx;\n\n // Each gesture keeps its own cursor: a resize must stay ew-resize for the\n // whole drag (flipping to grabbing reads as a move), a move grabs.\n const gestureCursor = kind.startsWith(\"resize\") ? \"ew-resize\" : \"grabbing\";\n const setBodyDragging = (on: boolean, invalid = false) => {\n document.body.classList.toggle(\"gantt-dragging\", on);\n document.body.style.cursor = on ? (invalid ? \"not-allowed\" : gestureCursor) : \"\";\n document.body.style.userSelect = on ? \"none\" : \"\";\n if (!on) document.body.style.removeProperty(\"-webkit-user-select\");\n };\n\n const activate = () => {\n if (active) return;\n active = true;\n surface = collectSurface(viewRoot);\n // touch resize activates here (long-press) instead of at gesture start,\n // so its indicator mounts now; the guard inside makes this a no-op for\n // every other path\n createResizeOverlay();\n if (kind === \"move\" && occurrence && surface) {\n const pointerMin = surfaceMinutesAt(surface, startX);\n // TRUE start, never clamped to the range: a bar that begins before the\n // visible window (negative minutes) must keep its real grab offset, or\n // the first snapped proposal teleports its start to the range edge\n const occStartMin = (occurrence.start.getTime() - surface.rangeStart) / 60000;\n grabOffsetMin = pointerMin - occStartMin;\n const rect = origin.getBoundingClientRect();\n barTop = rect.top;\n barWidth = rect.width;\n barHeight = rect.height;\n grabOffsetPx = startX - rect.left;\n createMoveOverlay();\n }\n setBodyDragging(true);\n };\n\n const computeProposal = (\n e: PointerEvent,\n ): {\n start: Date;\n end: Date;\n allDay: boolean;\n resourceId?: string;\n } | null => {\n if (!surface) return null;\n const tl = surface;\n const rangeMinutes = (tl.rangeEnd - tl.rangeStart) / 60000;\n const minutesAt = (x: number) => surfaceMinutesAt(tl, x);\n // Day-grid scales snap to real zoned midnights, not 1440-minute\n // multiples from the range start - those drift by an hour across DST\n const snapMin = (minutes: number) => {\n if (tl.snapMin < 24 * 60) return snapMinutes(minutes, tl.snapMin);\n const ms = tl.rangeStart + minutes * 60000;\n const dayStart = zonedStartOfDay(new Date(ms), settings.timeZone);\n const dayEnd = zonedStartOfDay(\n addDays(toZoned(new Date(ms), settings.timeZone), 1),\n settings.timeZone,\n );\n const snapped = ms - dayStart.getTime() < dayEnd.getTime() - ms ? dayStart : dayEnd;\n return (snapped.getTime() - tl.rangeStart) / 60000;\n };\n const rowAt = (y: number) => {\n let best = tl.rows[0];\n for (const row of tl.rows) {\n if (y >= row.rect.top && y < row.rect.bottom) return row;\n if (\n best &&\n Math.abs(y - (row.rect.top + row.rect.height / 2)) <\n Math.abs(y - (best.rect.top + best.rect.height / 2))\n ) {\n best = row;\n }\n }\n return best;\n };\n const at = (minutes: number) => new Date(tl.rangeStart + minutes * 60000);\n\n if (kind === \"create\") {\n const anchorMin = snapMin(minutesAt(startX));\n const curMin = snapMin(minutesAt(e.clientX));\n const lo = Math.min(anchorMin, curMin);\n // a bare click still yields a usable slot: at least slotDuration long\n const hi = Math.max(anchorMin, curMin, lo + Math.max(tl.snapMin, settings.slotDuration));\n return {\n start: at(lo),\n end: at(hi),\n allDay: false,\n resourceId: rowAt(startY)?.resourceId,\n };\n }\n if (!occurrence) return null;\n const midnightAligned = (d: Date) =>\n zonedStartOfDay(d, settings.timeZone).getTime() === d.getTime();\n if (kind === \"move\") {\n // x-axis only: the bar slides along its OWN row, never across rows.\n // The proposal preserves the pointer DELTA - no clamping to the visible\n // range, or bars crossing the window edge would teleport to it.\n const start = at(snapMin(minutesAt(e.clientX) - grabOffsetMin));\n // Day-snapped scales preserve the CALENDAR span for day-aligned bars:\n // a 3-day bar dragged across a DST change stays midnight-to-midnight\n // (72h +/- 1h), never drifting to a 23:00 end. Sub-day events keep\n // their exact ms duration.\n let end: Date;\n if (\n tl.snapMin >= 24 * 60 &&\n (occurrence.allDay ||\n (midnightAligned(occurrence.start) && midnightAligned(occurrence.end)))\n ) {\n const daySpan = Math.max(\n differenceInCalendarDays(\n toZoned(occurrence.end, settings.timeZone),\n toZoned(occurrence.start, settings.timeZone),\n ),\n 1,\n );\n end = zonedStartOfDay(\n addDays(toZoned(start, settings.timeZone), daySpan),\n settings.timeZone,\n );\n } else {\n end = new Date(start.getTime() + (occurrence.end.getTime() - occurrence.start.getTime()));\n }\n const bounded = clampToNeighbours(start, end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const min = snapMin(minutesAt(e.clientX));\n if (kind === \"resize-start\") {\n const endMin = (occurrence.end.getTime() - tl.rangeStart) / 60000;\n // Minimum length = one snap unit; on day grids that unit is the LAST\n // zoned midnight before the end (raw 1440-minute arithmetic lands off\n // the midnight grid across DST changes).\n const maxStartMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n midnightAligned(occurrence.end)\n ? addDays(toZoned(occurrence.end, settings.timeZone), -1)\n : occurrence.end,\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : endMin - tl.snapMin;\n const clamped = Math.min(Math.max(min, 0), maxStartMin);\n const bounded = clampToNeighbours(at(clamped), occurrence.end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const startMin = (occurrence.start.getTime() - tl.rangeStart) / 60000;\n // Mirror of the resize-start bound: the FIRST zoned midnight after the\n // start on day grids, plain snap arithmetic otherwise.\n const minEndMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n addDays(toZoned(occurrence.start, settings.timeZone), 1),\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : startMin + tl.snapMin;\n const clamped = Math.max(Math.min(min, rangeMinutes), minEndMin);\n const bounded = clampToNeighbours(occurrence.start, at(clamped));\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n };\n\n const applyProposal = (e: PointerEvent) => {\n const proposal = computeProposal(e);\n if (!proposal) return;\n const key = `${proposal.start.getTime()}-${proposal.end.getTime()}-${proposal.allDay}-${proposal.resourceId ?? \"\"}`;\n if (key === lastProposalKey) return;\n lastProposalKey = key;\n\n if (kind === \"create\") {\n const draft = { ...proposal };\n if (settings.canSelectSlot && !settings.canSelectSlot(draft)) return;\n internals.setSlotDraft(draft);\n return;\n }\n const update: GanttProposedUpdate<TData> = {\n event: occurrence!.event,\n occurrence: occurrence!,\n ...proposal,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n };\n // \"reject\" is the one veto the engine owns: it both styles the ghost AND\n // blocks the commit below. canDropEvent stays advisory, as documented.\n overlapRejected = overlapPolicy === \"reject\" && overlapsNeighbour(proposal.start, proposal.end);\n const valid =\n !overlapRejected && (settings.canDropEvent ? settings.canDropEvent(update) : true);\n // live status: the indicator chip always names the CURRENT proposed\n // range; the edge line flips to destructive on an invalid drop\n if (resizeRange && resizeDot && resizeDuration) {\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(proposal.start, settings.timeZone),\n toZoned(proposal.end, settings.timeZone),\n proposal.allDay,\n settings.locale,\n );\n const days = Math.round((proposal.end.getTime() - proposal.start.getTime()) / 86_400_000);\n const showDays = days >= 1;\n resizeDot.style.display = showDays ? \"\" : \"none\";\n resizeDuration.style.display = showDays ? \"\" : \"none\";\n if (showDays) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n }\n }\n if (resizeLine) {\n resizeLine.style.background = valid\n ? (occurrence!.event.color ?? \"var(--color-primary)\")\n : \"var(--color-destructive)\";\n }\n setBodyDragging(true, !valid);\n internals.setDrag({\n kind: kind === \"move\" ? \"move\" : (kind as \"resize-start\" | \"resize-end\"),\n occurrence: occurrence!,\n proposedStart: proposal.start,\n proposedEnd: proposal.end,\n proposedAllDay: proposal.allDay,\n proposedResourceId: proposal.resourceId,\n valid,\n });\n };\n\n // ----- edge auto-scroll: pan the timeline while dragging near its edge -----\n // The pointer is clamped to the visible track, so without this a bar can\n // never travel past the window. Holding the pointer inside the edge zone\n // scrolls the viewport (speed eased by proximity), refreshes the track rect\n // (the axis moved under the pointer) and re-derives the proposal from the\n // same pointer position. Programmatic scrolls never mark user intent, so\n // this can never trigger infinite-range growth mid-gesture.\n const AUTO_SCROLL_EDGE_PX = 24;\n const AUTO_SCROLL_MAX_SPEED = 14;\n let autoScrollRaf = 0;\n const timelineViewport = viewRoot?.querySelector<HTMLElement>(\n \"[data-slot=gantt-timeline-pane] [data-slot=scroll-area-viewport]\",\n );\n const autoScrollTick = () => {\n autoScrollRaf = 0;\n if (finished || !active || !surface || !timelineViewport) return;\n const paneRect = timelineViewport.getBoundingClientRect();\n const x = lastPointer.clientX;\n let speed = 0;\n if (x < paneRect.left + AUTO_SCROLL_EDGE_PX) {\n speed =\n -((paneRect.left + AUTO_SCROLL_EDGE_PX - x) / AUTO_SCROLL_EDGE_PX) * AUTO_SCROLL_MAX_SPEED;\n } else if (x > paneRect.right - AUTO_SCROLL_EDGE_PX) {\n speed =\n ((x - (paneRect.right - AUTO_SCROLL_EDGE_PX)) / AUTO_SCROLL_EDGE_PX) *\n AUTO_SCROLL_MAX_SPEED;\n }\n if (speed === 0) return;\n const before = timelineViewport.scrollLeft;\n timelineViewport.scrollLeft = before + speed;\n if (timelineViewport.scrollLeft === before) return; // parked on the end\n const axis = viewRoot?.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (axis) surface.rect = axis.getBoundingClientRect();\n applyProposal(lastPointer);\n positionResizeOverlay(lastPointer);\n scheduleAutoScroll();\n };\n const scheduleAutoScroll = () => {\n if (!autoScrollRaf) autoScrollRaf = requestAnimationFrame(autoScrollTick);\n };\n\n // idempotent: pointerup, pointercancel, Escape, blur and the view-level\n // teardown can race; whichever lands first wins and the rest no-op\n let finished = false;\n const cleanup = () => {\n if (finished) return;\n finished = true;\n activeGestureCancels.delete(cancel);\n if (autoScrollRaf) cancelAnimationFrame(autoScrollRaf);\n try {\n origin.releasePointerCapture(pointerId);\n } catch {\n // capture already released (pointer gone or origin detached)\n }\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onCancel);\n window.removeEventListener(\"blur\", onWindowBlur);\n window.removeEventListener(\"keydown\", onKeyDown, true);\n if (touchTimer) clearTimeout(touchTimer);\n // consumer-rendered overlays are React-owned: they unmount when the drag\n // state clears, so the engine must never removeChild them itself\n if (!customMoveOverlay) overlay?.remove();\n overlay = null;\n if (!customResizeOverlay) resizeOverlay?.remove();\n resizeOverlay = null;\n setBodyDragging(false);\n };\n\n const cancel = () => {\n cleanup();\n if (active) {\n lastGestureEndedAt = performance.now();\n internals.setDrag(null);\n internals.setSlotDraft(null);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n cancel();\n }\n };\n\n // focus loss mid-gesture (alt-tab, OS dialogs) means the release may never\n // be delivered; treat it as a cancel so the gesture cannot get stuck\n const onWindowBlur = () => cancel();\n\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n lastPointer = e;\n if (!active) {\n const distance = Math.hypot(e.clientX - startX, e.clientY - startY);\n if (isTouch) {\n // Long-press pending: moving past tolerance means scroll, not drag\n if (distance > activation.touchTolerancePx) cancel();\n return;\n }\n if (distance < activationDistance) return;\n activate();\n }\n applyProposal(e);\n positionOverlay(e);\n positionResizeOverlay(e);\n scheduleAutoScroll();\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n if (!active) return;\n lastGestureEndedAt = performance.now();\n\n const state = instance.getState();\n if (kind === \"create\") {\n const draft = state.slotDraft;\n internals.setSlotDraft(null);\n if (draft) {\n api.select({\n slot: { start: draft.start, end: draft.end, allDay: draft.allDay },\n });\n settings.onSelectSlot?.(draft);\n }\n return;\n }\n const drag = state.drag;\n internals.setDrag(null);\n if (!drag || !occurrence) return;\n // the node refuses concurrency: revert instead of committing an overlap\n if (overlapRejected) return;\n const unchanged =\n drag.proposedStart.getTime() === occurrence.start.getTime() &&\n drag.proposedEnd.getTime() === occurrence.end.getTime() &&\n (drag.proposedResourceId === undefined ||\n drag.proposedResourceId === occurrence.event.resourceId);\n if (unchanged) return;\n // Commit through the one validation funnel; consumer reject = automatic\n // revert because the gantt never mutated during the gesture.\n const accepted = internals.applyProposedUpdate({\n event: occurrence.event,\n occurrence,\n start: drag.proposedStart,\n end: drag.proposedEnd,\n allDay: drag.proposedAllDay,\n resourceId: drag.proposedResourceId,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n });\n if (accepted && announcer) {\n announcer.textContent = `${occurrence.event.title}, ${settings.i18n.functions.formatEventTime(\n toZoned(drag.proposedStart, settings.timeZone),\n toZoned(drag.proposedEnd, settings.timeZone),\n drag.proposedAllDay,\n settings.locale,\n )}`;\n }\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cancel();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onCancel);\n window.addEventListener(\"blur\", onWindowBlur);\n window.addEventListener(\"keydown\", onKeyDown, true);\n activeGestureCancels.add(cancel);\n\n // Capture the pointer so a release OUTSIDE the OS window still delivers\n // pointerup here instead of leaving the gesture stuck. Captured events keep\n // bubbling to the window listeners above, and if the origin node is removed\n // mid-gesture the capture auto-releases - behavior then degrades to plain\n // window listeners, never worse than before. Guarded: the pointer can\n // already be gone by now (fast flicks, synthetic events).\n try {\n origin.setPointerCapture(pointerId);\n } catch {\n // capture is an enhancement, never a requirement\n }\n\n // Touch: long-press activation (movement past tolerance cancels above)\n if (isTouch && !active) {\n touchTimer = setTimeout(() => {\n activate();\n applyProposal(lastPointer);\n }, activation.touchDelayMs);\n }\n}\n\n/** Per-bar / per-row pointer gesture wiring. */\nfunction useGanttGestures<TData = unknown>() {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n // presence flags only: the engine skips its default overlay DOM and\n // positions the consumer-rendered node instead\n const customMoveOverlay = !!viewConfig.renderDragPreview;\n const customResizeOverlay = !!viewConfig.renderResizeIndicator;\n\n const canDrag = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.drag && !event.readOnly && event.draggable !== false;\n },\n [instance],\n );\n\n const beginMove = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>) => {\n if (e.button !== 0 || !canDrag(segment)) return;\n beginGesture({\n instance,\n kind: \"move\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customMoveOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canDrag, customMoveOverlay, viewConfig.scheduleMode],\n );\n\n const canResize = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.resize && !event.readOnly && event.resizable !== false;\n },\n [instance],\n );\n\n const beginResize = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>, edge: \"start\" | \"end\") => {\n if (e.button !== 0 || !canResize(segment)) return;\n e.stopPropagation();\n e.preventDefault();\n beginGesture({\n instance,\n kind: edge === \"start\" ? \"resize-start\" : \"resize-end\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customResizeOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canResize, customResizeOverlay, viewConfig.scheduleMode],\n );\n\n const beginCreate = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n if (!instance.getState().interactions.selectSlot) return;\n beginGesture({\n instance,\n kind: \"create\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n });\n },\n [instance],\n );\n\n return { beginMove, beginResize, beginCreate, canDrag, canResize };\n}\n\nexport {\n cancelActiveGanttGestures,\n GANTT_ACTIVATION,\n markGestureEnd,\n useGanttGestures,\n useGanttGestureTeardown,\n wasRecentDrag,\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,mBAAmB;CACvB,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;AACpB;;;;;;AAmBA,SAAS,iBAAiB,IAAkB,GAAmB;CAC7D,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,KAAK,IAAI,GAAG,GAAG,KAAK,KAAK;CAEjE,QADiB,GAAG,QAAQ,GAAG,KAAK,QAAQ,UAAU,UAAU,GAAG,KAAK,QACrD,GAAG,KAAK,UAAW,GAAG,WAAW,GAAG,cAAc;AACvE;;AAGA,IAAI,qBAAqB;AACzB,SAAS,gBAAyB;CAChC,OAAO,YAAY,IAAI,IAAI,qBAAqB;AAClD;;AAGA,SAAS,iBAAuB;CAC9B,qBAAqB,YAAY,IAAI;AACvC;;;;;;;;;AAUA,MAAM,uCAAuB,IAAI,IAAgB;;AAGjD,SAAS,4BAAkC;CACzC,KAAK,MAAM,UAAU,CAAC,GAAG,oBAAoB,GAAG,OAAO;AACzD;;;;;;AAOA,SAAS,0BAAgC;CACvC,gBAAgB,2BAA2B,CAAC,CAAC;AAC/C;;;;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CACX;CAEA,MAAM,YAAY,aACf,GAAuB,YAAiC;EACvD,IAAI,EAAE,WAAW,KAAK,CAAC,QAAQ,OAAO,GAAG;EACzC,aAAa;GACX;GACA,MAAM;GACN,QAAQ,EAAE;GACV,YAAY,EAAE;GACd;GACA;GACA,cAAc,WAAW;EAC3B,CAAC;CACH,GACA;EAAC;EAAU;EAAS;EAAmB,WAAW;CAAY,CAChE;CAEA,MAAM,YAAY,aACf,YAAiC;EAChC,MAAM,EAAE,iBAAiB,SAAS,SAAS;EAC3C,MAAM,QAAQ,QAAQ,WAAW;EACjC,OAAO,aAAa,UAAU,CAAC,MAAM,YAAY,MAAM,cAAc;CACvE,GACA,CAAC,QAAQ,CACX;CAkCA,OAAO;EAAE;EAAW,aAhCA,aACjB,GAAuB,SAA8B,SAA0B;GAC9E,IAAI,EAAE,WAAW,KAAK,CAAC,UAAU,OAAO,GAAG;GAC3C,EAAE,gBAAgB;GAClB,EAAE,eAAe;GACjB,aAAa;IACX;IACA,MAAM,SAAS,UAAU,iBAAiB;IAC1C,QAAQ,EAAE;IACV,YAAY,EAAE;IACd;IACA;IACA,cAAc,WAAW;GAC3B,CAAC;EACH,GACA;GAAC;GAAU;GAAW;GAAqB,WAAW;EAAY,CAiBtC;EAAG,aAdb,aACjB,MAA0B;GACzB,IAAI,EAAE,WAAW,GAAG;GACpB,IAAI,CAAC,SAAS,SAAS,CAAC,CAAC,aAAa,YAAY;GAClD,aAAa;IACX;IACA,MAAM;IACN,QAAQ,EAAE;IACV,YAAY,EAAE;GAChB,CAAC;EACH,GACA,CAAC,QAAQ,CAGgC;EAAG;EAAS;CAAU;AACnE"}
|
|
1
|
+
{"version":3,"file":"gantt-dnd.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-dnd.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect } from \"react\";\nimport { addDays, differenceInCalendarDays } from \"date-fns\";\n\nimport { type GanttInstance, resolveScheduleMode, useGantt, useGanttViewConfig } from \"./gantt\";\nimport { findResource, snapMinutes, toZoned, zonedStartOfDay } from \"./gantt-lib\";\nimport type { GanttProposedUpdate, GanttScheduleMode, GanttSegment } from \"./gantt-types\";\n\n/**\n * Activation policy (dnd-kit parity where proven):\n * mouse move 5px before a drag starts (below = click), create 4px;\n * touch long-press 250ms with 5px tolerance (movement past tolerance\n * before the delay cancels the drag so taps stay taps).\n */\nconst GANTT_ACTIVATION = {\n moveDistancePx: 5,\n createDistancePx: 4,\n touchDelayMs: 250,\n touchTolerancePx: 5,\n} as const;\n\ntype GestureKind = \"move\" | \"resize-start\" | \"resize-end\" | \"create\";\n\ninterface GanttSurface {\n rect: DOMRect;\n rangeStart: number;\n rangeEnd: number;\n snapMin: number;\n /** Mirrored axis: in RTL the range START sits at the rect's RIGHT edge. */\n isRtl: boolean;\n rows: Array<{ resourceId: string; rect: DOMRect }>;\n}\n\n/**\n * Pointer x (viewport px) to minutes from the range start, clamped to the\n * track. The single place the horizontal axis direction is resolved: every\n * gesture mapping (move, both resizes, create, grab offset) goes through it.\n */\nfunction surfaceMinutesAt(tl: GanttSurface, x: number): number {\n const clamped = Math.min(Math.max(x, tl.rect.left), tl.rect.right);\n const traveled = tl.isRtl ? tl.rect.right - clamped : clamped - tl.rect.left;\n return (traveled / tl.rect.width) * ((tl.rangeEnd - tl.rangeStart) / 60000);\n}\n\n/** Module flag so bar onClick can ignore the click that ends a drag. */\nlet lastGestureEndedAt = 0;\nfunction wasRecentDrag(): boolean {\n return performance.now() - lastGestureEndedAt < 250;\n}\n\n/** Mark a non-dnd gesture (e.g. a timeline pan) so the click it ends is ignored. */\nfunction markGestureEnd(): void {\n lastGestureEndedAt = performance.now();\n}\n\n/**\n * Registry of in-flight gesture cancels. A gesture measures its surface\n * (axis + row rects) once at activation, so the VIEW - not the bar, bars\n * legitimately unmount mid-gesture - must be able to abort gestures when it\n * unmounts or when the measured geometry changes under them (zoom, scale,\n * range growth, splitter). Cancel fully reverts: listeners, overlays and the\n * body drag state all clear, and no update is committed.\n */\nconst activeGestureCancels = new Set<() => void>();\n\n/** Cancel (and fully revert) every in-flight gantt pointer gesture. */\nfunction cancelActiveGanttGestures(): void {\n for (const cancel of [...activeGestureCancels]) cancel();\n}\n\n/**\n * View-level teardown, mounted once by GanttView: aborts any in-flight\n * gesture on unmount so window listeners, body-appended overlays and the\n * gantt-dragging body class never outlive the gantt.\n */\nfunction useGanttGestureTeardown(): void {\n useEffect(() => cancelActiveGanttGestures, []);\n}\n\n/**\n * Snap a translate offset to the device pixel grid. The cursor-following\n * overlays (the move clone and the resize indicator) are their own\n * `will-change: transform` compositing layers: the GPU rasterizes their text\n * once and repositions that texture each frame, so a subpixel translate\n * (getBoundingClientRect and raw clientX/Y are routinely fractional) resamples\n * the texture and blurs the text. Rounding each offset to a whole device pixel\n * lands the layer on the grid so glyphs stay crisp, without giving up the\n * per-frame GPU transform.\n */\nfunction snapToPixel(value: number): number {\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n return Math.round(value * dpr) / dpr;\n}\n\nfunction collectSurface(root: HTMLElement | null): GanttSurface | null {\n if (!root) return null;\n const axis = root.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (!axis) return null;\n return {\n rect: axis.getBoundingClientRect(),\n rangeStart: Number(axis.dataset.ganttRangeStart),\n rangeEnd: Number(axis.dataset.ganttRangeEnd),\n snapMin: Number(axis.dataset.ganttSnap) || 15,\n isRtl: getComputedStyle(axis).direction === \"rtl\",\n rows: [...root.querySelectorAll<HTMLElement>(\"[data-gantt-row]\")]\n // static rows (parents that aggregate their subtree) take no drops\n .filter((row) => row.dataset.ganttRowStatic === undefined)\n .map((row) => ({\n resourceId: row.dataset.ganttResource ?? \"\",\n rect: row.getBoundingClientRect(),\n })),\n };\n}\n\ninterface BeginGestureConfig<TData> {\n instance: GanttInstance<TData>;\n kind: GestureKind;\n origin: HTMLElement;\n startEvent: PointerEvent;\n segment?: GanttSegment<TData>;\n /** Consumer renders the move preview (renderDragPreview); the engine only positions it. */\n customMoveOverlay?: boolean;\n /** Consumer renders the resize indicator; the engine only positions it. */\n customResizeOverlay?: boolean;\n /** View-level cardinality default; a node's own scheduleMode wins. */\n scheduleMode?: GanttScheduleMode;\n}\n\nfunction beginGesture<TData>(config: BeginGestureConfig<TData>) {\n const { instance, kind, origin, startEvent, segment, customMoveOverlay, customResizeOverlay } =\n config;\n const { settings, internals, api } = instance;\n const activation = { ...GANTT_ACTIVATION, ...settings.activation };\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const pointerId = startEvent.pointerId;\n // stable ancestors: bar nodes may be replaced by re-renders mid-gesture\n const viewRoot = origin.closest<HTMLElement>(\"[data-slot=gantt-view]\");\n const ganttRoot = origin.closest<HTMLElement>(\"[data-slot=gantt]\");\n const announcer = ganttRoot?.querySelector<HTMLElement>(\"[data-slot=gantt-announcer]\");\n\n /**\n * The cursor-following overlays are appended to document.body so no ancestor\n * transform or overflow can clip them - which also cuts them off from the\n * gantt root, and the root is what OWNS the type scale (its `text-xs` is\n * what every resting label inherits). Without this the clone's label jumps\n * to the document default and reads visibly bigger than the bar it left.\n * Copying the ROOT's resolved metrics - rather than hardcoding a size -\n * keeps the documented contract that one class on the root (e.g.\n * className=\"text-sm\") rescales the whole gantt, drag clone included.\n */\n const adoptRootTypography = (el: HTMLElement) => {\n if (!ganttRoot) return;\n const rootStyle = getComputedStyle(ganttRoot);\n el.style.fontSize = rootStyle.fontSize;\n el.style.lineHeight = rootStyle.lineHeight;\n el.style.fontFamily = rootStyle.fontFamily;\n el.style.letterSpacing = rootStyle.letterSpacing;\n // physical positioning, logical content: the flex row mirrors so the\n // label lands on the same side of the bar as the resting one in RTL\n el.style.direction = rootStyle.direction;\n };\n\n const isTouch = startEvent.pointerType === \"touch\";\n // resize activates immediately on precise pointers; on touch it waits for\n // the same long-press as a move, so a stray brush over a bar edge can\n // never start an accidental resize\n let active = kind.startsWith(\"resize\") && !isTouch;\n let surface: GanttSurface | null = active ? collectSurface(viewRoot) : null;\n let lastProposalKey = \"\";\n let touchTimer: ReturnType<typeof setTimeout> | null = null;\n let lastPointer: PointerEvent = startEvent;\n\n const occurrence = segment?.occurrence;\n\n // ----- neighbour awareness: the other schedules in the SAME node -----\n // A node in \"single\" mode rejects any concurrency regardless of the\n // overlap option; otherwise the option decides. \"allow\" short-circuits\n // everything below, so the default gesture path is untouched.\n const nodeId = occurrence?.event.resourceId;\n const nodeMode = resolveScheduleMode(\n nodeId === undefined ? null : findResource(settings.resources, nodeId),\n config.scheduleMode,\n );\n const overlapPolicy = nodeMode === \"single\" ? (\"reject\" as const) : settings.overlap;\n // Read once per gesture: the gantt never mutates events mid-drag, so the\n // neighbours cannot move under us.\n let neighbourCache: Array<{ start: number; end: number }> | null = null;\n const getNeighbours = () => {\n if (neighbourCache) return neighbourCache;\n neighbourCache =\n !occurrence || nodeId === undefined || overlapPolicy === \"allow\"\n ? []\n : api\n .getOccurrences()\n .filter((other) => other.event.resourceId === nodeId && other.key !== occurrence.key)\n .map((other) => ({\n start: other.start.getTime(),\n end: other.end.getTime(),\n }));\n return neighbourCache;\n };\n const overlapsNeighbour = (start: Date, end: Date) =>\n getNeighbours().some((other) => other.start < end.getTime() && other.end > start.getTime());\n /**\n * Stop the gesture at the neighbour's edge. Runs AFTER snapping so the\n * clamp always wins, and only against neighbours that sit clear of the\n * bar's CURRENT span - a pre-existing overlap has no edge to stop at.\n */\n const clampToNeighbours = (start: Date, end: Date): { start: Date; end: Date } => {\n if (overlapPolicy !== \"clamp\" || !occurrence) return { start, end };\n const anchorStart = occurrence.start.getTime();\n const anchorEnd = occurrence.end.getTime();\n let floor = -Infinity;\n let ceiling = Infinity;\n for (const other of getNeighbours()) {\n if (other.end <= anchorStart) floor = Math.max(floor, other.end);\n else if (other.start >= anchorEnd) ceiling = Math.min(ceiling, other.start);\n }\n if (floor === -Infinity && ceiling === Infinity) return { start, end };\n let from = start.getTime();\n let to = end.getTime();\n if (kind === \"resize-start\") {\n from = Math.min(Math.max(from, floor), to);\n } else if (kind === \"resize-end\") {\n to = Math.max(Math.min(to, ceiling), from);\n } else {\n // a move keeps its duration and parks against whichever edge it meets\n const duration = to - from;\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n if (to > ceiling) {\n to = ceiling;\n from = to - duration;\n }\n // window narrower than the bar itself: park at the earlier edge\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n }\n return { start: new Date(from), end: new Date(to) };\n };\n // Set by applyProposal when a \"reject\" policy refuses the current proposal;\n // read on pointerup so the commit is actually blocked, not merely styled.\n let overlapRejected = false;\n\n // Preserve the grab offset so the bar does not jump to the pointer\n let grabOffsetMin = 0;\n // Smooth cursor-following clone for a move: a real-looking bar that tracks\n // the pointer's x via transform (no per-frame React), lifted with a shadow.\n let overlay: HTMLDivElement | null = null;\n let grabOffsetPx = 0;\n let barTop = 0;\n let barWidth = 0;\n let barHeight = 0;\n\n const createMoveOverlay = () => {\n if (kind !== \"move\" || !occurrence || overlay || barWidth === 0) return;\n // consumer-rendered preview (renderDragPreview): the view mounts it from\n // drag state; positionOverlay adopts it lazily and only writes transforms\n if (customMoveOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n overlay = document.createElement(\"div\");\n overlay.setAttribute(\"data-slot\", \"gantt-drag-overlay\");\n // container: the bar + its label ride together; the label stays OUTSIDE\n // the bar (to the right), matching the resting look - no in-bar text\n overlay.className =\n // physical left-0 anchor: the clone is positioned by translate3d from\n // raw clientX, which is physical - a logical start-0 anchor would pin\n // it to the RIGHT edge in RTL and fling the clone off screen\n \"pointer-events-none fixed top-0 left-0 z-100 flex items-center gap-2 will-change-transform\";\n adoptRootTypography(overlay);\n overlay.style.height = `${barHeight}px`;\n const barEl = document.createElement(\"div\");\n if (occurrence.end.getTime() === occurrence.start.getTime()) {\n // a MILESTONE stays a diamond while it travels: the resting glyph,\n // lifted with a shadow - a rectangle here reads as a different object\n barEl.className = \"flex shrink-0 items-center justify-center\";\n barEl.style.width = `${barWidth}px`;\n barEl.style.height = \"100%\";\n const diamond = document.createElement(\"span\");\n diamond.className = \"rotate-45 rounded-[2px] shadow-lg\";\n diamond.style.width = \"10px\";\n diamond.style.height = \"10px\";\n diamond.style.background = `color-mix(in oklab, ${color} 80%, var(--color-background))`;\n diamond.style.border = `1px solid ${color}`;\n barEl.appendChild(diamond);\n } else {\n barEl.className = \"shrink-0 rounded-sm shadow-lg\";\n barEl.style.width = `${barWidth}px`;\n barEl.style.height = \"100%\";\n barEl.style.background = `color-mix(in oklab, ${color} 22%, var(--color-background))`;\n barEl.style.outline = `1px solid color-mix(in oklab, ${color} 55%, transparent)`;\n }\n overlay.appendChild(barEl);\n const label = document.createElement(\"span\");\n label.className = \"text-foreground truncate font-medium whitespace-nowrap\";\n label.textContent = occurrence.event.title;\n overlay.appendChild(label);\n document.body.appendChild(overlay);\n positionOverlay(lastPointer);\n };\n\n const positionOverlay = (e: PointerEvent) => {\n if (!overlay && customMoveOverlay && active && kind === \"move\") {\n overlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-drag-overlay][data-custom]\",\n );\n if (overlay) overlay.style.visibility = \"visible\";\n }\n if (!overlay) return;\n // x follows the pointer freely (smooth); y stays on the bar's own row\n overlay.style.transform = `translate3d(${snapToPixel(e.clientX - grabOffsetPx)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n // Resize status indicator: a smooth cursor-following edge line plus a live\n // range + duration chip. The dashed ghost still shows the SNAPPED landing;\n // this overlay is the continuous feedback between snap steps.\n let resizeOverlay: HTMLDivElement | null = null;\n let resizeLine: HTMLDivElement | null = null;\n let resizeRange: HTMLSpanElement | null = null;\n let resizeDot: HTMLSpanElement | null = null;\n let resizeDuration: HTMLSpanElement | null = null;\n\n const positionResizeOverlay = (e: PointerEvent) => {\n if (!resizeOverlay && customResizeOverlay && kind.startsWith(\"resize\")) {\n resizeOverlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-resize-indicator][data-custom]\",\n );\n if (resizeOverlay) resizeOverlay.style.visibility = \"visible\";\n }\n if (!resizeOverlay || !surface) return;\n // x follows the pointer freely (clamped to the track); y stays on the bar\n const x = Math.min(Math.max(e.clientX, surface.rect.left), surface.rect.right);\n resizeOverlay.style.transform = `translate3d(${snapToPixel(x)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n const createResizeOverlay = () => {\n if (!kind.startsWith(\"resize\") || !occurrence || resizeOverlay) return;\n const barEl = origin.closest<HTMLElement>(\"[data-slot=gantt-bar]\");\n const rect = (barEl ?? origin).getBoundingClientRect();\n barTop = rect.top;\n barHeight = rect.height;\n // consumer-rendered indicator: rect capture above still runs (the engine\n // positions the consumer's wrapper), only the default DOM is skipped\n if (customResizeOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n resizeOverlay = document.createElement(\"div\");\n resizeOverlay.setAttribute(\"data-slot\", \"gantt-resize-indicator\");\n resizeOverlay.className =\n // physical left-0 anchor, same reason as the move clone above\n \"pointer-events-none fixed top-0 left-0 z-100 will-change-transform\";\n adoptRootTypography(resizeOverlay);\n resizeOverlay.style.height = `${barHeight}px`;\n resizeLine = document.createElement(\"div\");\n resizeLine.className = \"h-full w-0.5 -translate-x-1/2 rounded-full\";\n resizeLine.style.background = color;\n resizeOverlay.appendChild(resizeLine);\n const chip = document.createElement(\"div\");\n chip.className =\n // physical left-0: centered with a physical translate on a physical anchor\n // no text size of its own: it inherits the root scale adopted above, so\n // the chip tracks a consumer rescale instead of pinning itself to 12px\n \"bg-foreground text-background absolute bottom-full left-0 mb-1.5 flex -translate-x-1/2 items-center gap-1.5 rounded-md px-2 py-1 font-medium whitespace-nowrap\";\n resizeRange = document.createElement(\"span\");\n chip.appendChild(resizeRange);\n resizeDot = document.createElement(\"span\");\n resizeDot.className = \"bg-background/40 size-1 shrink-0 rounded-full\";\n resizeDot.setAttribute(\"aria-hidden\", \"true\");\n chip.appendChild(resizeDot);\n resizeDuration = document.createElement(\"span\");\n chip.appendChild(resizeDuration);\n // The arrow. Every other bubble in the gantt has one pointing at what it\n // describes; this chip had none, so a resize looked like a different\n // component from the hover hint. Physical left-1/2 to match the chip's own\n // physical anchor, and out of flow so the chip's flex gap ignores it.\n const chipArrow = document.createElement(\"span\");\n chipArrow.setAttribute(\"aria-hidden\", \"true\");\n chipArrow.className =\n \"bg-foreground absolute -bottom-1 left-1/2 size-2.5 -translate-x-1/2 rotate-45 rounded-[2px]\";\n chip.appendChild(chipArrow);\n resizeOverlay.appendChild(chip);\n document.body.appendChild(resizeOverlay);\n // seed the chip with the CURRENT range so it never flashes empty;\n // zoned so the label names the same day the grid shows\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay ?? false,\n settings.locale,\n );\n const days = Math.round((occurrence.end.getTime() - occurrence.start.getTime()) / 86_400_000);\n if (days >= 1) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n } else {\n resizeDot.style.display = \"none\";\n resizeDuration.style.display = \"none\";\n }\n positionResizeOverlay(startEvent);\n };\n\n // resize activates immediately, so its indicator mounts with the gesture\n if (active) createResizeOverlay();\n\n const activationDistance =\n kind === \"create\" ? activation.createDistancePx : activation.moveDistancePx;\n\n // Each gesture keeps its own cursor: a resize must stay ew-resize for the\n // whole drag (flipping to grabbing reads as a move), a move grabs.\n const gestureCursor = kind.startsWith(\"resize\") ? \"ew-resize\" : \"grabbing\";\n const setBodyDragging = (on: boolean, invalid = false) => {\n document.body.classList.toggle(\"gantt-dragging\", on);\n document.body.style.cursor = on ? (invalid ? \"not-allowed\" : gestureCursor) : \"\";\n document.body.style.userSelect = on ? \"none\" : \"\";\n if (!on) document.body.style.removeProperty(\"-webkit-user-select\");\n };\n\n const activate = () => {\n if (active) return;\n active = true;\n surface = collectSurface(viewRoot);\n // touch resize activates here (long-press) instead of at gesture start,\n // so its indicator mounts now; the guard inside makes this a no-op for\n // every other path\n createResizeOverlay();\n if (kind === \"move\" && occurrence && surface) {\n const pointerMin = surfaceMinutesAt(surface, startX);\n // TRUE start, never clamped to the range: a bar that begins before the\n // visible window (negative minutes) must keep its real grab offset, or\n // the first snapped proposal teleports its start to the range edge\n const occStartMin = (occurrence.start.getTime() - surface.rangeStart) / 60000;\n grabOffsetMin = pointerMin - occStartMin;\n const rect = origin.getBoundingClientRect();\n barTop = rect.top;\n barWidth = rect.width;\n barHeight = rect.height;\n grabOffsetPx = startX - rect.left;\n createMoveOverlay();\n }\n setBodyDragging(true);\n };\n\n const computeProposal = (\n e: PointerEvent,\n ): {\n start: Date;\n end: Date;\n allDay: boolean;\n resourceId?: string;\n } | null => {\n if (!surface) return null;\n const tl = surface;\n const rangeMinutes = (tl.rangeEnd - tl.rangeStart) / 60000;\n const minutesAt = (x: number) => surfaceMinutesAt(tl, x);\n // Day-grid scales snap to real zoned midnights, not 1440-minute\n // multiples from the range start - those drift by an hour across DST\n const snapMin = (minutes: number) => {\n if (tl.snapMin < 24 * 60) return snapMinutes(minutes, tl.snapMin);\n const ms = tl.rangeStart + minutes * 60000;\n const dayStart = zonedStartOfDay(new Date(ms), settings.timeZone);\n const dayEnd = zonedStartOfDay(\n addDays(toZoned(new Date(ms), settings.timeZone), 1),\n settings.timeZone,\n );\n const snapped = ms - dayStart.getTime() < dayEnd.getTime() - ms ? dayStart : dayEnd;\n return (snapped.getTime() - tl.rangeStart) / 60000;\n };\n const rowAt = (y: number) => {\n let best = tl.rows[0];\n for (const row of tl.rows) {\n if (y >= row.rect.top && y < row.rect.bottom) return row;\n if (\n best &&\n Math.abs(y - (row.rect.top + row.rect.height / 2)) <\n Math.abs(y - (best.rect.top + best.rect.height / 2))\n ) {\n best = row;\n }\n }\n return best;\n };\n const at = (minutes: number) => new Date(tl.rangeStart + minutes * 60000);\n\n if (kind === \"create\") {\n const anchorMin = snapMin(minutesAt(startX));\n const curMin = snapMin(minutesAt(e.clientX));\n const lo = Math.min(anchorMin, curMin);\n // a bare click still yields a usable slot: at least slotDuration long\n const hi = Math.max(anchorMin, curMin, lo + Math.max(tl.snapMin, settings.slotDuration));\n return {\n start: at(lo),\n end: at(hi),\n allDay: false,\n resourceId: rowAt(startY)?.resourceId,\n };\n }\n if (!occurrence) return null;\n const midnightAligned = (d: Date) =>\n zonedStartOfDay(d, settings.timeZone).getTime() === d.getTime();\n if (kind === \"move\") {\n // x-axis only: the bar slides along its OWN row, never across rows.\n // The proposal preserves the pointer DELTA - no clamping to the visible\n // range, or bars crossing the window edge would teleport to it.\n const start = at(snapMin(minutesAt(e.clientX) - grabOffsetMin));\n // Day-snapped scales preserve the CALENDAR span for day-aligned bars:\n // a 3-day bar dragged across a DST change stays midnight-to-midnight\n // (72h +/- 1h), never drifting to a 23:00 end. Sub-day events keep\n // their exact ms duration.\n let end: Date;\n if (occurrence.end.getTime() === occurrence.start.getTime()) {\n // a milestone is an instant: moving it moves the point - the\n // day-span branch below would silently stretch it to a full day\n end = start;\n } else if (\n tl.snapMin >= 24 * 60 &&\n (occurrence.allDay ||\n (midnightAligned(occurrence.start) && midnightAligned(occurrence.end)))\n ) {\n const daySpan = Math.max(\n differenceInCalendarDays(\n toZoned(occurrence.end, settings.timeZone),\n toZoned(occurrence.start, settings.timeZone),\n ),\n 1,\n );\n end = zonedStartOfDay(\n addDays(toZoned(start, settings.timeZone), daySpan),\n settings.timeZone,\n );\n } else {\n end = new Date(start.getTime() + (occurrence.end.getTime() - occurrence.start.getTime()));\n }\n const bounded = clampToNeighbours(start, end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const min = snapMin(minutesAt(e.clientX));\n if (kind === \"resize-start\") {\n const endMin = (occurrence.end.getTime() - tl.rangeStart) / 60000;\n // Minimum length = one snap unit; on day grids that unit is the LAST\n // zoned midnight before the end (raw 1440-minute arithmetic lands off\n // the midnight grid across DST changes).\n const maxStartMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n midnightAligned(occurrence.end)\n ? addDays(toZoned(occurrence.end, settings.timeZone), -1)\n : occurrence.end,\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : endMin - tl.snapMin;\n const clamped = Math.min(Math.max(min, 0), maxStartMin);\n const bounded = clampToNeighbours(at(clamped), occurrence.end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const startMin = (occurrence.start.getTime() - tl.rangeStart) / 60000;\n // Mirror of the resize-start bound: the FIRST zoned midnight after the\n // start on day grids, plain snap arithmetic otherwise.\n const minEndMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n addDays(toZoned(occurrence.start, settings.timeZone), 1),\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : startMin + tl.snapMin;\n const clamped = Math.max(Math.min(min, rangeMinutes), minEndMin);\n const bounded = clampToNeighbours(occurrence.start, at(clamped));\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n };\n\n const applyProposal = (e: PointerEvent) => {\n const proposal = computeProposal(e);\n if (!proposal) return;\n const key = `${proposal.start.getTime()}-${proposal.end.getTime()}-${proposal.allDay}-${proposal.resourceId ?? \"\"}`;\n if (key === lastProposalKey) return;\n lastProposalKey = key;\n\n if (kind === \"create\") {\n const draft = { ...proposal };\n if (settings.canSelectSlot && !settings.canSelectSlot(draft)) return;\n internals.setSlotDraft(draft);\n return;\n }\n const update: GanttProposedUpdate<TData> = {\n event: occurrence!.event,\n occurrence: occurrence!,\n ...proposal,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n };\n // \"reject\" is the one veto the engine owns: it both styles the ghost AND\n // blocks the commit below. canDropEvent stays advisory unless the\n // consumer opts into enforceCanDrop, which is checked at release.\n overlapRejected = overlapPolicy === \"reject\" && overlapsNeighbour(proposal.start, proposal.end);\n const valid =\n !overlapRejected && (settings.canDropEvent ? settings.canDropEvent(update) : true);\n // live status: the indicator chip always names the CURRENT proposed\n // range; the edge line flips to destructive on an invalid drop\n if (resizeRange && resizeDot && resizeDuration) {\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(proposal.start, settings.timeZone),\n toZoned(proposal.end, settings.timeZone),\n proposal.allDay,\n settings.locale,\n );\n const days = Math.round((proposal.end.getTime() - proposal.start.getTime()) / 86_400_000);\n const showDays = days >= 1;\n resizeDot.style.display = showDays ? \"\" : \"none\";\n resizeDuration.style.display = showDays ? \"\" : \"none\";\n if (showDays) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n }\n }\n if (resizeLine) {\n resizeLine.style.background = valid\n ? (occurrence!.event.color ?? \"var(--color-primary)\")\n : \"var(--color-destructive)\";\n }\n setBodyDragging(true, !valid);\n internals.setDrag({\n kind: kind === \"move\" ? \"move\" : (kind as \"resize-start\" | \"resize-end\"),\n occurrence: occurrence!,\n proposedStart: proposal.start,\n proposedEnd: proposal.end,\n proposedAllDay: proposal.allDay,\n proposedResourceId: proposal.resourceId,\n valid,\n });\n };\n\n // ----- edge auto-scroll: pan the timeline while dragging near its edge -----\n // The pointer is clamped to the visible track, so without this a bar can\n // never travel past the window. Holding the pointer inside the edge zone\n // scrolls the viewport (speed eased by proximity), refreshes the track rect\n // (the axis moved under the pointer) and re-derives the proposal from the\n // same pointer position. Programmatic scrolls never mark user intent, so\n // this can never trigger infinite-range growth mid-gesture.\n const AUTO_SCROLL_EDGE_PX = 24;\n const AUTO_SCROLL_MAX_SPEED = 14;\n let autoScrollRaf = 0;\n const timelineViewport = viewRoot?.querySelector<HTMLElement>(\n \"[data-slot=gantt-timeline-pane] [data-slot=scroll-area-viewport]\",\n );\n const autoScrollTick = () => {\n autoScrollRaf = 0;\n if (finished || !active || !surface || !timelineViewport) return;\n const paneRect = timelineViewport.getBoundingClientRect();\n const x = lastPointer.clientX;\n let speed = 0;\n if (x < paneRect.left + AUTO_SCROLL_EDGE_PX) {\n speed =\n -((paneRect.left + AUTO_SCROLL_EDGE_PX - x) / AUTO_SCROLL_EDGE_PX) * AUTO_SCROLL_MAX_SPEED;\n } else if (x > paneRect.right - AUTO_SCROLL_EDGE_PX) {\n speed =\n ((x - (paneRect.right - AUTO_SCROLL_EDGE_PX)) / AUTO_SCROLL_EDGE_PX) *\n AUTO_SCROLL_MAX_SPEED;\n }\n if (speed === 0) return;\n const before = timelineViewport.scrollLeft;\n timelineViewport.scrollLeft = before + speed;\n if (timelineViewport.scrollLeft === before) return; // parked on the end\n const axis = viewRoot?.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (axis) surface.rect = axis.getBoundingClientRect();\n applyProposal(lastPointer);\n positionResizeOverlay(lastPointer);\n scheduleAutoScroll();\n };\n const scheduleAutoScroll = () => {\n if (!autoScrollRaf) autoScrollRaf = requestAnimationFrame(autoScrollTick);\n };\n\n // idempotent: pointerup, pointercancel, Escape, blur and the view-level\n // teardown can race; whichever lands first wins and the rest no-op\n let finished = false;\n const cleanup = () => {\n if (finished) return;\n finished = true;\n activeGestureCancels.delete(cancel);\n if (autoScrollRaf) cancelAnimationFrame(autoScrollRaf);\n try {\n origin.releasePointerCapture(pointerId);\n } catch {\n // capture already released (pointer gone or origin detached)\n }\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onCancel);\n window.removeEventListener(\"blur\", onWindowBlur);\n window.removeEventListener(\"keydown\", onKeyDown, true);\n if (touchTimer) clearTimeout(touchTimer);\n // consumer-rendered overlays are React-owned: they unmount when the drag\n // state clears, so the engine must never removeChild them itself\n if (!customMoveOverlay) overlay?.remove();\n overlay = null;\n if (!customResizeOverlay) resizeOverlay?.remove();\n resizeOverlay = null;\n setBodyDragging(false);\n };\n\n const cancel = () => {\n cleanup();\n if (active) {\n lastGestureEndedAt = performance.now();\n internals.setDrag(null);\n internals.setSlotDraft(null);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n cancel();\n }\n };\n\n // focus loss mid-gesture (alt-tab, OS dialogs) means the release may never\n // be delivered; treat it as a cancel so the gesture cannot get stuck\n const onWindowBlur = () => cancel();\n\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n lastPointer = e;\n if (!active) {\n const distance = Math.hypot(e.clientX - startX, e.clientY - startY);\n if (isTouch) {\n // Long-press pending: moving past tolerance means scroll, not drag\n if (distance > activation.touchTolerancePx) cancel();\n return;\n }\n if (distance < activationDistance) return;\n activate();\n }\n applyProposal(e);\n positionOverlay(e);\n positionResizeOverlay(e);\n scheduleAutoScroll();\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n if (!active) return;\n lastGestureEndedAt = performance.now();\n\n const state = instance.getState();\n if (kind === \"create\") {\n const draft = state.slotDraft;\n internals.setSlotDraft(null);\n if (draft) {\n api.select({\n slot: { start: draft.start, end: draft.end, allDay: draft.allDay },\n });\n settings.onSelectSlot?.(draft);\n }\n return;\n }\n const drag = state.drag;\n internals.setDrag(null);\n if (!drag || !occurrence) return;\n // the node refuses concurrency: revert instead of committing an overlap\n if (overlapRejected) return;\n // enforceCanDrop makes the advisory verdict binding: a release whose\n // last canDropEvent answer was false reverts exactly like \"reject\" -\n // the red ghost becomes a promise instead of a suggestion\n if (settings.enforceCanDrop && !drag.valid) return;\n const unchanged =\n drag.proposedStart.getTime() === occurrence.start.getTime() &&\n drag.proposedEnd.getTime() === occurrence.end.getTime() &&\n (drag.proposedResourceId === undefined ||\n drag.proposedResourceId === occurrence.event.resourceId);\n if (unchanged) return;\n // Commit through the one validation funnel; consumer reject = automatic\n // revert because the gantt never mutated during the gesture.\n const accepted = internals.applyProposedUpdate({\n event: occurrence.event,\n occurrence,\n start: drag.proposedStart,\n end: drag.proposedEnd,\n allDay: drag.proposedAllDay,\n resourceId: drag.proposedResourceId,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n });\n if (accepted && announcer) {\n announcer.textContent = `${occurrence.event.title}, ${settings.i18n.functions.formatEventTime(\n toZoned(drag.proposedStart, settings.timeZone),\n toZoned(drag.proposedEnd, settings.timeZone),\n drag.proposedAllDay,\n settings.locale,\n )}`;\n }\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cancel();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onCancel);\n window.addEventListener(\"blur\", onWindowBlur);\n window.addEventListener(\"keydown\", onKeyDown, true);\n activeGestureCancels.add(cancel);\n\n // Capture the pointer so a release OUTSIDE the OS window still delivers\n // pointerup here instead of leaving the gesture stuck. Captured events keep\n // bubbling to the window listeners above, and if the origin node is removed\n // mid-gesture the capture auto-releases - behavior then degrades to plain\n // window listeners, never worse than before. Guarded: the pointer can\n // already be gone by now (fast flicks, synthetic events).\n try {\n origin.setPointerCapture(pointerId);\n } catch {\n // capture is an enhancement, never a requirement\n }\n\n // Touch: long-press activation (movement past tolerance cancels above)\n if (isTouch && !active) {\n touchTimer = setTimeout(() => {\n activate();\n applyProposal(lastPointer);\n }, activation.touchDelayMs);\n }\n}\n\n/** Per-bar / per-row pointer gesture wiring. */\nfunction useGanttGestures<TData = unknown>() {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n // presence flags only: the engine skips its default overlay DOM and\n // positions the consumer-rendered node instead\n const customMoveOverlay = !!viewConfig.renderDragPreview;\n const customResizeOverlay = !!viewConfig.renderResizeIndicator;\n\n const canDrag = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.drag && !event.readOnly && event.draggable !== false;\n },\n [instance],\n );\n\n const beginMove = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>) => {\n if (e.button !== 0 || !canDrag(segment)) return;\n beginGesture({\n instance,\n kind: \"move\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customMoveOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canDrag, customMoveOverlay, viewConfig.scheduleMode],\n );\n\n const canResize = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return (\n interactions.resize &&\n !event.readOnly &&\n event.resizable !== false &&\n // a milestone is an instant: it has no edges to resize\n segment.occurrence.end.getTime() > segment.occurrence.start.getTime()\n );\n },\n [instance],\n );\n\n const beginResize = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>, edge: \"start\" | \"end\") => {\n if (e.button !== 0 || !canResize(segment)) return;\n e.stopPropagation();\n e.preventDefault();\n beginGesture({\n instance,\n kind: edge === \"start\" ? \"resize-start\" : \"resize-end\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customResizeOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canResize, customResizeOverlay, viewConfig.scheduleMode],\n );\n\n const beginCreate = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n if (!instance.getState().interactions.selectSlot) return;\n beginGesture({\n instance,\n kind: \"create\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n });\n },\n [instance],\n );\n\n return { beginMove, beginResize, beginCreate, canDrag, canResize };\n}\n\nexport {\n cancelActiveGanttGestures,\n GANTT_ACTIVATION,\n markGestureEnd,\n useGanttGestures,\n useGanttGestureTeardown,\n wasRecentDrag,\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,mBAAmB;CACvB,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;AACpB;;;;;;AAmBA,SAAS,iBAAiB,IAAkB,GAAmB;CAC7D,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,KAAK,IAAI,GAAG,GAAG,KAAK,KAAK;CAEjE,QADiB,GAAG,QAAQ,GAAG,KAAK,Q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,MAAM,QAAQ,QAAQ,WAAW;EACjC,OACE,aAAa,UACb,CAAC,MAAM,YACP,MAAM,cAAc,SAEpB,QAAQ,WAAW,IAAI,QAAQ,IAAI,QAAQ,WAAW,MAAM,QAAQ;CAExE,GACA,CAAC,QAAQ,CACX;CAkCA,OAAO;EAAE;EAAW,aAhCA,aACjB,GAAuB,SAA8B,SAA0B;GAC9E,IAAI,EAAE,WAAW,KAAK,CAAC,UAAU,OAAO,GAAG;GAC3C,EAAE,gBAAgB;GAClB,EAAE,eAAe;GACjB,aAAa;IACX;IACA,MAAM,SAAS,UAAU,iBAAiB;IAC1C,QAAQ,EAAE;IACV,YAAY,EAAE;IACd;IACA;IACA,cAAc,WAAW;GAC3B,CAAC;EACH,GACA;GAAC;GAAU;GAAW;GAAqB,WAAW;EAAY,CAiBtC;EAAG,aAdb,aACjB,MAA0B;GACzB,IAAI,EAAE,WAAW,GAAG;GACpB,IAAI,CAAC,SAAS,SAAS,CAAC,CAAC,aAAa,YAAY;GAClD,aAAa;IACX;IACA,MAAM;IACN,QAAQ,EAAE;IACV,YAAY,EAAE;GAChB,CAAC;EACH,GACA,CAAC,QAAQ,CAGgC;EAAG;EAAS;CAAU;AACnE"}
|
|
@@ -35,6 +35,10 @@ interface GanttI18nConfig {
|
|
|
35
35
|
durationDays: (days: number) => string;
|
|
36
36
|
/** Appended to the bar aria-label when its segment is clipped by the range. */
|
|
37
37
|
continues: string;
|
|
38
|
+
/** Names the planned (baseline) range in the bar tooltip and aria-label. */
|
|
39
|
+
planned: (rangeLabel: string) => string;
|
|
40
|
+
/** Read to screen readers on a zero-duration (milestone) bar. */
|
|
41
|
+
milestone: string;
|
|
38
42
|
scales: {
|
|
39
43
|
day: string;
|
|
40
44
|
week: string;
|
|
@@ -63,8 +67,12 @@ interface GanttI18nConfig {
|
|
|
63
67
|
formatEventAriaLabel: (parts: {
|
|
64
68
|
title: string;
|
|
65
69
|
timeLabel: string;
|
|
70
|
+
/** Localized milestone clause, from `labels.milestone`. */
|
|
71
|
+
milestoneLabel?: string;
|
|
66
72
|
rowTitle?: string;
|
|
67
73
|
progressLabel?: string;
|
|
74
|
+
/** Localized planned-range clause, from `labels.planned`. */
|
|
75
|
+
plannedLabel?: string;
|
|
68
76
|
continues: boolean;
|
|
69
77
|
}) => string;
|
|
70
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-i18n.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-i18n.tsx"],"mappings":";;;UAMU;EACR;IACE;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;IACA,SAAS;IACT,OAAO;IACP;IACA;;IAEA;;IAEA;IACA;;IAEA;IACA;IACA;;IAEA;;IAEA,YAAY;;IAEZ,WAAW;;IAEX,eAAe;;IAEf;IACA;MACE;MACA;MACA;MACA;MACA;;;;EAIJ;IACE;IACA;IACA;IACA;;EAEF;IACE,cACE,OAAO,YACP;MACE,MAAM;MACN,aAAa;MACb,cAAc;MACd,SAAS;;IAGb,kBAAkB,OAAO,MAAM,KAAK,MAAM,iBAAiB,SAAS;IACpE,iBAAiB,OAAO,gBAAgB,SAAS;;IAEjD,uBAAuB;MACrB;MACA;MACA;MACA;MACA;;;;
|
|
1
|
+
{"version":3,"file":"gantt-i18n.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-i18n.tsx"],"mappings":";;;UAMU;EACR;IACE;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;IACA,SAAS;IACT,OAAO;IACP;IACA;;IAEA;;IAEA;IACA;;IAEA;IACA;IACA;;IAEA;;IAEA,YAAY;;IAEZ,WAAW;;IAEX,eAAe;;IAEf;;IAEA,UAAU;;IAEV;IACA;MACE;MACA;MACA;MACA;MACA;;;;EAIJ;IACE;IACA;IACA;IACA;;EAEF;IACE,cACE,OAAO,YACP;MACE,MAAM;MACN,aAAa;MACb,cAAc;MACd,SAAS;;IAGb,kBAAkB,OAAO,MAAM,KAAK,MAAM,iBAAiB,SAAS;IACpE,iBAAiB,OAAO,gBAAgB,SAAS;;IAEjD,uBAAuB;MACrB;MACA;;MAEA;MACA;MACA;;MAEA;MACA;;;;cA+IA,oBAAoB;;UAUhB;EACR,SAAS,QAAQ,KAAK;IACpB,SAAS,QAAQ;;EAEnB,UAAU,QAAQ;EAClB,YAAY,QAAQ;;;;;;;;;iBAUb,eAAe,YAAY,qBAAqB"}
|