@weekwise/react 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +227 -2
- package/dist/Calendar.d.ts +6 -0
- package/dist/Calendar.types.d.ts +120 -0
- package/dist/components/calendar-toolbar/CalendarToolbar.d.ts +3 -0
- package/dist/components/calendar-toolbar/index.d.ts +2 -0
- package/dist/components/date-navigator/DateNavigator.d.ts +7 -0
- package/dist/components/date-navigator/index.d.ts +2 -0
- package/dist/components/day-week-drawer/DayWeekDrawer.d.ts +9 -0
- package/dist/components/day-week-drawer/index.d.ts +2 -0
- package/dist/components/day-week-event/DayWeekEvent.d.ts +7 -0
- package/dist/components/day-week-event/DayWeekEventPreview.d.ts +11 -0
- package/dist/components/day-week-event/index.d.ts +3 -0
- package/dist/components/day-week-view/DayWeekView.d.ts +39 -0
- package/dist/components/day-week-view/HiddenEvents.d.ts +14 -0
- package/dist/components/day-week-view/index.d.ts +2 -0
- package/dist/components/day-week-view/useTimeColumnWidth.d.ts +9 -0
- package/dist/components/drag-overlay/DragOverlay.d.ts +11 -0
- package/dist/components/drag-overlay/index.d.ts +2 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/month-view/MonthView.d.ts +7 -0
- package/dist/components/month-view/MonthView.utils.d.ts +12 -0
- package/dist/components/month-view/MonthViewDay.d.ts +12 -0
- package/dist/components/month-view/MonthViewEvent.d.ts +30 -0
- package/dist/components/month-view/MonthViewEventPreview.d.ts +9 -0
- package/dist/components/month-view/MonthViewWeek.d.ts +20 -0
- package/dist/components/month-view/index.d.ts +2 -0
- package/dist/components/month-view/useMonthLanes.d.ts +7 -0
- package/dist/components/month-view/useMonthResize.d.ts +32 -0
- package/dist/components/nav-btn/NavBtn.d.ts +5 -0
- package/dist/components/nav-btn/index.d.ts +2 -0
- package/dist/components/pointer-popover/PointerPopover.d.ts +6 -0
- package/dist/components/pointer-popover/index.d.ts +2 -0
- package/dist/components/view-select/ViewSelect.d.ts +8 -0
- package/dist/components/view-select/index.d.ts +2 -0
- package/dist/contexts/CalendarContext.d.ts +7 -0
- package/dist/contexts/CalendarViewportContext.d.ts +11 -0
- package/dist/contexts/DayWeekViewContext.d.ts +7 -0
- package/dist/contexts/ThemeSourceContext.d.ts +4 -0
- package/dist/date-localization/DateLocalizationContext.d.ts +6 -0
- package/dist/date-localization/DateLocalizationProvider.d.ts +17 -0
- package/dist/date-localization/MessagesContext.d.ts +4 -0
- package/dist/date-localization/index.d.ts +6 -0
- package/dist/date-localization/useDateUtils.d.ts +8 -0
- package/dist/date-localization/useMessages.d.ts +2 -0
- package/dist/hooks/index.d.ts +15 -0
- package/dist/hooks/useAbsEventRect.d.ts +3 -0
- package/dist/hooks/useAutoScroller.d.ts +33 -0
- package/dist/hooks/useCalendarSize.d.ts +7 -0
- package/dist/hooks/useCalendarValue.d.ts +7 -0
- package/dist/hooks/useCanResizeEvent.d.ts +3 -0
- package/dist/hooks/useComputed.d.ts +2 -0
- package/dist/hooks/useControlled.d.ts +36 -0
- package/dist/hooks/useControlled.types.d.ts +16 -0
- package/dist/hooks/useControlled.utils.d.ts +7 -0
- package/dist/hooks/useCurrentRef.d.ts +3 -0
- package/dist/hooks/useEventCallback.d.ts +1 -0
- package/dist/hooks/useEventCallback.types.d.ts +8 -0
- package/dist/hooks/useEventCallback.utils.d.ts +2 -0
- package/dist/hooks/useEventResize.d.ts +46 -0
- package/dist/hooks/useGlobalListeners.d.ts +9 -0
- package/dist/hooks/useInterval.d.ts +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +7 -0
- package/dist/hooks/useMergedRefs.d.ts +3 -0
- package/dist/hooks/useMove.d.ts +5 -0
- package/dist/hooks/useMove.types.d.ts +56 -0
- package/dist/hooks/useMoveTransform.d.ts +72 -0
- package/dist/hooks/useMutationObserver.d.ts +5 -0
- package/dist/hooks/useNavigation.d.ts +6 -0
- package/dist/hooks/usePrevious.d.ts +2 -0
- package/dist/hooks/useRect.d.ts +2 -0
- package/dist/hooks/useRefWithInit.d.ts +13 -0
- package/dist/hooks/useResizeObserver.d.ts +5 -0
- package/dist/hooks/useScrollBarSize.d.ts +2 -0
- package/dist/hooks/useScrollBarSize.types.d.ts +6 -0
- package/dist/hooks/useScrollIntent.d.ts +14 -0
- package/dist/hooks/useScrollOffsets.d.ts +2 -0
- package/dist/hooks/useScrollOffsetsDelta.d.ts +3 -0
- package/dist/hooks/useScrollableAncestors.d.ts +1 -0
- package/dist/hooks/useScrollableAncestorsRects.d.ts +3 -0
- package/dist/hooks/useStateRef.d.ts +8 -0
- package/dist/hooks/useTimeInterval.d.ts +1 -0
- package/dist/hooks/useTimeOffset.d.ts +1 -0
- package/dist/hooks/useToday.d.ts +6 -0
- package/dist/icons/chevron.d.ts +2 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2640 -0
- package/dist/index.js.map +1 -0
- package/dist/portal/Portal.d.ts +16 -0
- package/dist/portal/index.d.ts +2 -0
- package/dist/style.css +2 -0
- package/dist/utils/css.d.ts +3 -0
- package/dist/utils/mergeRefs.d.ts +2 -0
- package/package.json +89 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,2640 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext as e, startTransition as t, useCallback as n, useContext as r, useEffect as i, useId as a, useInsertionEffect as o, useLayoutEffect as s, useMemo as c, useReducer as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
|
|
3
|
+
import { MONTH_WEEK_GEOMETRY as p, ROW_HEIGHTS as m, Rect as h, THEME_PROPERTIES as g, add as _, adjustScrollRect as v, applyMoveTransformModifiers as y, arrangeEventsByDay as b, arrangeMonthWeek as x, boundingDraggableContainerModifier as S, boundingResizableContainerModifier as C, buildEventMap as w, buildTimeRows as T, builtInMessages as E, cx as D, defaultCoordinates as O, emptyArray as k, formatMonthYear as ee, formatNowOffset as A, formatTimelineRange as j, fromDayMinutes as M, getCalendarSize as N, getClientRect as P, getEventTimeFrameFromInfo as F, getHiddenEvents as I, getMonthGrid as L, getMonthLaneCount as R, getNavigationTarget as z, getNowOffset as B, getRevealScrollTop as te, getScrollCoordinates as V, getScrollDirectionAndSpeed as ne, getScrollOffsets as H, getScrollableAncestors as re, getScrollableElement as ie, getTimeFrame as ae, getTimeStepEqualizerModifier as oe, getTimelineRange as se, getViewChangeTarget as ce, getViewHeading as le, getVisibleDays as ue, getWeekdayNames as de, getWindow as fe, isDevEnvironment as U, isHTMLElement as pe, isInViewPeriod as me, isNotNull as he, isPastDay as ge, match as _e, mergeCallbacks as ve, normalizeViewValue as ye, omit as be, resizeEventDays as xe, resizeEventRange as Se, resolveMessages as Ce, resolveMessages as we, round as Te, shallowEqual as Ee, splitIntoDays as De, subtract as Oe, toDayMinutes as ke, transferDay as Ae } from "@weekwise/core";
|
|
4
|
+
import { createDragAndDropApi as je } from "@weekwise/dnd";
|
|
5
|
+
import { DragAndDropContext as Me, useDragAndDrop as Ne } from "@weekwise/dnd/react";
|
|
6
|
+
import { autoUpdate as Pe, flip as Fe, offset as Ie, shift as Le, useFloating as Re } from "@floating-ui/react-dom";
|
|
7
|
+
import { Fragment as ze, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal as Be } from "react-dom";
|
|
9
|
+
// src/date-localization/DateLocalizationContext.ts
|
|
10
|
+
var Ve = e(void 0);
|
|
11
|
+
U && (Ve.displayName = "DateLocalizationContext");
|
|
12
|
+
// src/date-localization/useDateUtils.ts
|
|
13
|
+
function He() {
|
|
14
|
+
let e = r(Ve);
|
|
15
|
+
if (!e) throw Error("DateLocalizationContext is required");
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
function K() {
|
|
19
|
+
return He();
|
|
20
|
+
}
|
|
21
|
+
// src/date-localization/MessagesContext.ts
|
|
22
|
+
var Ue = e(void 0);
|
|
23
|
+
U && (Ue.displayName = "MessagesContext");
|
|
24
|
+
// src/date-localization/DateLocalizationProvider.tsx
|
|
25
|
+
function We(e) {
|
|
26
|
+
let { adapter: t, messages: n, children: r } = e, i = c(() => typeof t == "function" ? new t() : t, [t]), a = c(() => we(i.locale, n), [i.locale, n]);
|
|
27
|
+
return /* @__PURE__ */ W(Ve.Provider, {
|
|
28
|
+
value: i,
|
|
29
|
+
children: /* @__PURE__ */ W(Ue.Provider, {
|
|
30
|
+
value: a,
|
|
31
|
+
children: r
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// src/date-localization/useMessages.ts
|
|
36
|
+
function Ge() {
|
|
37
|
+
let e = r(Ue), t = He();
|
|
38
|
+
return e ?? we(t.locale);
|
|
39
|
+
}
|
|
40
|
+
var Ke = typeof window < "u" ? s : i;
|
|
41
|
+
// src/hooks/useResizeObserver.ts
|
|
42
|
+
function qe(e, t = !1) {
|
|
43
|
+
let n = u(e);
|
|
44
|
+
n.current = e;
|
|
45
|
+
let r = c(() => {
|
|
46
|
+
if (t || typeof window > "u" || window.ResizeObserver === void 0) return;
|
|
47
|
+
let { current: e } = n, { ResizeObserver: r } = window;
|
|
48
|
+
return new r(e);
|
|
49
|
+
}, [t]);
|
|
50
|
+
return i(() => () => r?.disconnect(), [r]), r;
|
|
51
|
+
}
|
|
52
|
+
// src/hooks/useCalendarSize.ts
|
|
53
|
+
function Je(e) {
|
|
54
|
+
let [t, n] = d("regular"), r = qe(([e]) => {
|
|
55
|
+
if (!e) return;
|
|
56
|
+
let t = e.borderBoxSize?.[0]?.inlineSize ?? e.contentRect.width;
|
|
57
|
+
n(N(t));
|
|
58
|
+
});
|
|
59
|
+
return Ke(() => {
|
|
60
|
+
let t = e.current;
|
|
61
|
+
if (t) return n(N(t.getBoundingClientRect().width)), r?.observe(t), () => r?.unobserve(t);
|
|
62
|
+
}, [r, e]), t;
|
|
63
|
+
}
|
|
64
|
+
// src/hooks/useCurrentRef.ts
|
|
65
|
+
function Ye(e) {
|
|
66
|
+
let t = u(e);
|
|
67
|
+
return t.current = e, t;
|
|
68
|
+
}
|
|
69
|
+
// src/hooks/useComputed.ts
|
|
70
|
+
function Xe(e, t) {
|
|
71
|
+
let n = u(void 0), r = Ye(e);
|
|
72
|
+
return c(() => {
|
|
73
|
+
let e = r.current(n.current);
|
|
74
|
+
return n.current = e, e;
|
|
75
|
+
}, t);
|
|
76
|
+
}
|
|
77
|
+
// src/hooks/useControlled.utils.ts
|
|
78
|
+
function Ze(e) {
|
|
79
|
+
let [t] = d(() => e !== void 0);
|
|
80
|
+
return t;
|
|
81
|
+
}
|
|
82
|
+
function Qe(e, t, n, r) {
|
|
83
|
+
let a = u(/* @__PURE__ */ Error());
|
|
84
|
+
i(() => {
|
|
85
|
+
if (e !== (t !== void 0)) throw Error(`
|
|
86
|
+
[useControlled]:
|
|
87
|
+
A component is changing ${e ? "a controlled value to be uncontrolled" : "an uncontrolled value to be controlled"}. This is likely caused by the value changing from ${e ? "defined to an undefined" : "undefined to a defined"} value, which should not happen.
|
|
88
|
+
Decide between using a controlled or uncontrolled input element for the lifetime of the component.
|
|
89
|
+
More info: https://reactjs.org/link/controlled-components
|
|
90
|
+
${a.current.stack}
|
|
91
|
+
`);
|
|
92
|
+
}, [e, t]), i(() => {
|
|
93
|
+
if (!e && n !== r) throw Error(`
|
|
94
|
+
[useControlled]:
|
|
95
|
+
A component is changing the default state of an uncontrolled value after being initialized.
|
|
96
|
+
To suppress this warning opt to use a controlled value.
|
|
97
|
+
More info: https://reactjs.org/link/controlled-components
|
|
98
|
+
${a.current.stack}`);
|
|
99
|
+
}, [
|
|
100
|
+
r,
|
|
101
|
+
n,
|
|
102
|
+
e
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
// src/hooks/useControlled.ts
|
|
106
|
+
function $e(e) {
|
|
107
|
+
let { controlled: t, default: r } = e, [i, a] = d(() => r === void 0 && "initialState" in e && e.initialState !== void 0 ? e.initialState : r), [o] = d(r), s = Ze(t);
|
|
108
|
+
U && Qe(s, t, o, r);
|
|
109
|
+
let c = n((e) => {
|
|
110
|
+
s || a(e);
|
|
111
|
+
}, [s]);
|
|
112
|
+
return [
|
|
113
|
+
s ? t : i,
|
|
114
|
+
c,
|
|
115
|
+
s
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
// src/hooks/useRefWithInit.ts
|
|
119
|
+
var et = {};
|
|
120
|
+
function tt(e, t) {
|
|
121
|
+
let n = u(et);
|
|
122
|
+
return n.current === et && (n.current = e(t)), n;
|
|
123
|
+
}
|
|
124
|
+
// src/hooks/useEventCallback.utils.ts
|
|
125
|
+
function nt() {
|
|
126
|
+
if (U) throw Error("useEventCallback: Cannot call an event handler while rendering.");
|
|
127
|
+
}
|
|
128
|
+
function rt() {
|
|
129
|
+
let e = {
|
|
130
|
+
next: void 0,
|
|
131
|
+
callback: nt,
|
|
132
|
+
trampoline: (...t) => e.callback?.(...t),
|
|
133
|
+
effect: () => {
|
|
134
|
+
e.callback = e.next;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return e;
|
|
138
|
+
}
|
|
139
|
+
// src/hooks/useEventCallback.ts
|
|
140
|
+
function q(e) {
|
|
141
|
+
let t = tt(rt).current;
|
|
142
|
+
return t.next = e, o(t.effect), t.trampoline;
|
|
143
|
+
}
|
|
144
|
+
// src/hooks/useGlobalListeners.ts
|
|
145
|
+
function it() {
|
|
146
|
+
let [e] = d(() => ({ current: /* @__PURE__ */ new Map() })), { addGlobalListener: t, removeGlobalListener: n, removeAllGlobalListeners: r } = c(() => {
|
|
147
|
+
function t(t, n, r, i) {
|
|
148
|
+
let a = typeof i != "boolean" && i?.once ? (n) => {
|
|
149
|
+
e.current.delete(r), t instanceof Document ? r.call(t, n) : r(n);
|
|
150
|
+
} : r;
|
|
151
|
+
t.addEventListener(n, r, i), e.current.set(r, {
|
|
152
|
+
type: n,
|
|
153
|
+
target: t,
|
|
154
|
+
fn: a,
|
|
155
|
+
options: i
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function n(t, n, r, i) {
|
|
159
|
+
let a = e.current.get(r)?.fn || r;
|
|
160
|
+
t.removeEventListener(n, a, i), e.current.delete(r);
|
|
161
|
+
}
|
|
162
|
+
function r() {
|
|
163
|
+
e.current.forEach(({ target: e, type: t, options: r }, i) => {
|
|
164
|
+
n(e, t, i, r);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
addGlobalListener: t,
|
|
169
|
+
removeGlobalListener: n,
|
|
170
|
+
removeAllGlobalListeners: r
|
|
171
|
+
};
|
|
172
|
+
}, [e]);
|
|
173
|
+
return i(() => r, [r]), {
|
|
174
|
+
addGlobalListener: t,
|
|
175
|
+
removeGlobalListener: n,
|
|
176
|
+
removeAllGlobalListeners: r
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// src/utils/mergeRefs.ts
|
|
180
|
+
var at = (e) => !e || typeof e == "function" ? e : (t) => {
|
|
181
|
+
e.current = t;
|
|
182
|
+
};
|
|
183
|
+
function ot(...e) {
|
|
184
|
+
return (t) => {
|
|
185
|
+
e.forEach((e) => {
|
|
186
|
+
at(e)?.(t);
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// src/hooks/useMergedRefs.ts
|
|
191
|
+
function st(...e) {
|
|
192
|
+
return c(() => ot(...e), e);
|
|
193
|
+
}
|
|
194
|
+
// src/hooks/useMove.ts
|
|
195
|
+
function ct(e) {
|
|
196
|
+
let [{ state: t }] = d(() => ({ state: {
|
|
197
|
+
activePointId: null,
|
|
198
|
+
clientX: 0,
|
|
199
|
+
clientY: 0,
|
|
200
|
+
initialClientX: 0,
|
|
201
|
+
initialClientY: 0,
|
|
202
|
+
isDistanceReached: !1
|
|
203
|
+
} })), n = u(e);
|
|
204
|
+
n.current = e;
|
|
205
|
+
let { addGlobalListener: r, removeGlobalListener: i } = it();
|
|
206
|
+
return { listeners: c(() => {
|
|
207
|
+
let e = {}, a = (e) => {
|
|
208
|
+
"stopPropagation" in e && "preventDefault" in e && (e.stopPropagation(), e.preventDefault());
|
|
209
|
+
}, o = (e, r) => {
|
|
210
|
+
let { current: { distance: i = 0, ...a } } = n, { clientX: o, clientY: s } = e, { clientX: c, clientY: l } = t;
|
|
211
|
+
t.clientX = o, t.clientY = s, r !== void 0 && (t.activePointId = r);
|
|
212
|
+
let u = (e) => ({
|
|
213
|
+
shiftKey: e.shiftKey,
|
|
214
|
+
metaKey: e.metaKey,
|
|
215
|
+
ctrlKey: e.ctrlKey,
|
|
216
|
+
altKey: e.altKey,
|
|
217
|
+
clientX: o,
|
|
218
|
+
clientY: s
|
|
219
|
+
});
|
|
220
|
+
return {
|
|
221
|
+
start(e, n) {
|
|
222
|
+
return t.initialClientX = o, t.initialClientY = s, t.isDistanceReached = i === 0, a.onMoveStart({
|
|
223
|
+
type: "movestart",
|
|
224
|
+
pointerType: e,
|
|
225
|
+
...u(n)
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
move(e, n, r, d) {
|
|
229
|
+
let f = o - t.initialClientX, p = s - t.initialClientY;
|
|
230
|
+
!t.isDistanceReached && f ** 2 + p ** 2 >= i ** 2 && (t.isDistanceReached = !0), t.isDistanceReached && a.onMove({
|
|
231
|
+
type: "move",
|
|
232
|
+
pointerType: e,
|
|
233
|
+
deltaX: r ?? o - c,
|
|
234
|
+
deltaY: d ?? s - l,
|
|
235
|
+
initialDeltaX: f,
|
|
236
|
+
initialDeltaY: p,
|
|
237
|
+
...u(n)
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
end(e, t) {
|
|
241
|
+
a.onMoveEnd({
|
|
242
|
+
type: "moveend",
|
|
243
|
+
pointerType: e,
|
|
244
|
+
...u(t)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
if (typeof PointerEvent > "u") {
|
|
250
|
+
let n = (e) => {
|
|
251
|
+
e.button === 0 && o(e).move("mouse", e);
|
|
252
|
+
}, s = (e) => {
|
|
253
|
+
e.button === 0 && o(e).end("mouse", e);
|
|
254
|
+
};
|
|
255
|
+
e.onMouseDown = (e) => {
|
|
256
|
+
e.button === 0 && (o(e).start("mouse", e) === !1 ? o(e, null) : (r(window, "mousemove", n, !1), r(window, "mouseup", s, !1), a(e)));
|
|
257
|
+
};
|
|
258
|
+
let c = (e) => {
|
|
259
|
+
let n = [...e.changedTouches].findIndex(({ identifier: e }) => e === t.activePointId);
|
|
260
|
+
if (n >= 0) {
|
|
261
|
+
let t = e.changedTouches[n];
|
|
262
|
+
o(t).move("touch", e);
|
|
263
|
+
}
|
|
264
|
+
}, l = (e) => {
|
|
265
|
+
let n = [...e.changedTouches].findIndex(({ identifier: e }) => e === t.activePointId);
|
|
266
|
+
n >= 0 && (o(e.changedTouches[n], null).end("touch", e), r(window, "touchmove", c), i(window, "touchend", l), i(window, "touchcancel", l));
|
|
267
|
+
};
|
|
268
|
+
e.onTouchStart = (e) => {
|
|
269
|
+
if (e.changedTouches.length === 0 || t.activePointId !== null) return;
|
|
270
|
+
let n = e.changedTouches[0];
|
|
271
|
+
o(n, n.identifier).start("touch", e) === !1 ? o(n, null) : (r(window, "touchmove", c, !1), r(window, "touchend", l, !1), r(window, "touchcancel", l, !1), a(e));
|
|
272
|
+
};
|
|
273
|
+
} else {
|
|
274
|
+
let n = (e) => {
|
|
275
|
+
if (e.pointerId === t.activePointId) {
|
|
276
|
+
let t = e.pointerType || "mouse";
|
|
277
|
+
o(e).move(t, e);
|
|
278
|
+
}
|
|
279
|
+
}, s = (e) => {
|
|
280
|
+
if (e.pointerId === t.activePointId) {
|
|
281
|
+
let t = e.pointerType || "mouse";
|
|
282
|
+
o(e, null).end(t, e), i(window, "pointermove", n, !1), i(window, "pointerup", s, !1), i(window, "pointercancel", s, !1);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
e.onPointerDown = (e) => {
|
|
286
|
+
if (e.button === 0 && t.activePointId === null) {
|
|
287
|
+
let t = e.pointerType || "mouse";
|
|
288
|
+
o(e, e.pointerId).start(t, e) === !1 ? o(e, null) : (r(window, "pointermove", n, !1), r(window, "pointerup", s, !1), r(window, "pointercancel", s, !1), a(e));
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
let s = (e, t, n) => {
|
|
293
|
+
let { start: r, move: i, end: a } = o({
|
|
294
|
+
clientX: 0,
|
|
295
|
+
clientY: 0
|
|
296
|
+
});
|
|
297
|
+
r("keyboard", e) ? (i("keyboard", e, t, n), a("keyboard", e)) : o({
|
|
298
|
+
clientX: 0,
|
|
299
|
+
clientY: 0
|
|
300
|
+
}, null);
|
|
301
|
+
};
|
|
302
|
+
return e.onKeyDown = (e) => {
|
|
303
|
+
switch (e.key) {
|
|
304
|
+
case "Left":
|
|
305
|
+
case "ArrowLeft":
|
|
306
|
+
a(e), s(e, -1, 0);
|
|
307
|
+
break;
|
|
308
|
+
case "Right":
|
|
309
|
+
case "ArrowRight":
|
|
310
|
+
a(e), s(e, 1, 0);
|
|
311
|
+
break;
|
|
312
|
+
case "Up":
|
|
313
|
+
case "ArrowUp":
|
|
314
|
+
a(e), s(e, 0, -1);
|
|
315
|
+
break;
|
|
316
|
+
case "Down":
|
|
317
|
+
case "ArrowDown": a(e), s(e, 0, 1);
|
|
318
|
+
}
|
|
319
|
+
}, e;
|
|
320
|
+
}, [
|
|
321
|
+
r,
|
|
322
|
+
i,
|
|
323
|
+
t
|
|
324
|
+
]) };
|
|
325
|
+
}
|
|
326
|
+
// src/hooks/usePrevious.ts
|
|
327
|
+
function lt(e) {
|
|
328
|
+
let t = u(void 0);
|
|
329
|
+
return i(() => {
|
|
330
|
+
t.current = e;
|
|
331
|
+
}, [e]), t.current;
|
|
332
|
+
}
|
|
333
|
+
// src/hooks/useScrollBarSize.ts
|
|
334
|
+
function ut() {
|
|
335
|
+
let e = null, n = 0, r = (t) => (n += 1, e === null && (e = document.createElement("div"), e.style.width = "99px", e.style.height = "99px", e.style.overflow = "scroll", e.style.position = "absolute", e.style.top = "-9999px", e.setAttribute("aria-hidden", "true"), e.setAttribute("role", "presentation"), document.body.appendChild(e), window.addEventListener("resize", t)), {
|
|
336
|
+
element: e,
|
|
337
|
+
cleanup: () => {
|
|
338
|
+
e && --n <= 0 && (document.body.removeChild(e), window.removeEventListener("resize", t), e = null, n = 0);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
return function() {
|
|
342
|
+
let [e, n] = d({
|
|
343
|
+
height: 0,
|
|
344
|
+
width: 0
|
|
345
|
+
});
|
|
346
|
+
return Ke(() => {
|
|
347
|
+
let e = () => {
|
|
348
|
+
let e = i.offsetHeight - i.clientHeight, r = i.offsetWidth - i.clientWidth;
|
|
349
|
+
t(() => {
|
|
350
|
+
n((t) => {
|
|
351
|
+
let { height: n, width: i } = t;
|
|
352
|
+
return n !== e || i !== r ? {
|
|
353
|
+
height: e,
|
|
354
|
+
width: r
|
|
355
|
+
} : t;
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
}, { element: i, cleanup: a } = r(e);
|
|
359
|
+
return e(), a;
|
|
360
|
+
}, []), e;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
var dt = ut();
|
|
364
|
+
// src/hooks/useStateRef.ts
|
|
365
|
+
function ft(e) {
|
|
366
|
+
let [t, r] = d(e), i = u(e);
|
|
367
|
+
return [
|
|
368
|
+
t,
|
|
369
|
+
n((e) => {
|
|
370
|
+
i.current = e, r(e);
|
|
371
|
+
}, []),
|
|
372
|
+
i
|
|
373
|
+
];
|
|
374
|
+
}
|
|
375
|
+
// src/hooks/useTimeInterval.ts
|
|
376
|
+
function pt(e, t, n = !0) {
|
|
377
|
+
let r = u(null), a = Ye(e);
|
|
378
|
+
i(() => {
|
|
379
|
+
if (n) {
|
|
380
|
+
let e = /* @__PURE__ */ new Date(), n = t - (e.getMinutes() * 60 + e.getSeconds()) * 1e3 % t;
|
|
381
|
+
r.current = setTimeout(() => {
|
|
382
|
+
a.current(), r.current = setInterval(a.current, t);
|
|
383
|
+
}, n), a.current();
|
|
384
|
+
}
|
|
385
|
+
return () => {
|
|
386
|
+
r.current && clearTimeout(r.current);
|
|
387
|
+
};
|
|
388
|
+
}, [
|
|
389
|
+
a,
|
|
390
|
+
t,
|
|
391
|
+
n
|
|
392
|
+
]);
|
|
393
|
+
}
|
|
394
|
+
// src/hooks/useToday.ts
|
|
395
|
+
function mt() {
|
|
396
|
+
let { getToday: e, addDays: t, toMillis: n, fromMillis: r } = K(), [a, o] = d(() => n(e()));
|
|
397
|
+
return i(() => {
|
|
398
|
+
let i = n(t(r(a), 1)), s = Math.max(i - Date.now(), 0) + 1e3, c = setTimeout(() => o(n(e())), s);
|
|
399
|
+
return () => clearTimeout(c);
|
|
400
|
+
}, [
|
|
401
|
+
t,
|
|
402
|
+
r,
|
|
403
|
+
e,
|
|
404
|
+
n,
|
|
405
|
+
a
|
|
406
|
+
]), a;
|
|
407
|
+
}
|
|
408
|
+
// src/contexts/CalendarContext.ts
|
|
409
|
+
var ht = e(void 0);
|
|
410
|
+
U && (ht.displayName = "CalendarContext");
|
|
411
|
+
function J() {
|
|
412
|
+
let e = r(ht);
|
|
413
|
+
if (!e) throw Error("CalendarContext is required");
|
|
414
|
+
return e;
|
|
415
|
+
}
|
|
416
|
+
// src/contexts/ThemeSourceContext.ts
|
|
417
|
+
var gt = e(null);
|
|
418
|
+
U && (gt.displayName = "ThemeSourceContext");
|
|
419
|
+
// src/hooks/useCalendarValue.ts
|
|
420
|
+
function _t(e) {
|
|
421
|
+
let { view: t, defaultView: r, startWeek: a, viewValue: o, defaultViewValue: s, dateUtils: c, onChangeView: l, onChangeViewValue: d } = e, [f, p] = $e({
|
|
422
|
+
controlled: t,
|
|
423
|
+
default: r,
|
|
424
|
+
initialState: "week"
|
|
425
|
+
}), m = n((e, t) => ye(c, e, t, a), [c, a]), [h, g] = $e({
|
|
426
|
+
controlled: o,
|
|
427
|
+
default: s,
|
|
428
|
+
initialState: m(f)
|
|
429
|
+
}), _ = q((e, t) => {
|
|
430
|
+
g(e), d?.(e, t);
|
|
431
|
+
}), v = q(ve((e) => {
|
|
432
|
+
p(e);
|
|
433
|
+
}, l)), y = Ye(h), b = u(f), x = u(a), S = u(c);
|
|
434
|
+
return i(() => {
|
|
435
|
+
let e = b.current, t = x.current !== a, n = S.current, r = n === c ? y.current : Ae(n, c, y.current);
|
|
436
|
+
b.current = f, x.current = a, S.current = c;
|
|
437
|
+
let i = e === f && !t ? m(f, r) : ce(c, e, f, r, a);
|
|
438
|
+
_(i, f);
|
|
439
|
+
}, [
|
|
440
|
+
m,
|
|
441
|
+
_,
|
|
442
|
+
f,
|
|
443
|
+
y,
|
|
444
|
+
c,
|
|
445
|
+
a
|
|
446
|
+
]), {
|
|
447
|
+
view: f,
|
|
448
|
+
viewValue: h,
|
|
449
|
+
changeViewValue: _,
|
|
450
|
+
changeView: v
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
// src/hooks/useNavigation.ts
|
|
454
|
+
function vt(e) {
|
|
455
|
+
let { dateUtils: t, view: n, viewValue: r, changeViewValue: i, startWeek: a } = e, o = (e, r) => () => i(z(t, n, e, r, a), n);
|
|
456
|
+
return {
|
|
457
|
+
goForward: q(o(r, 1)),
|
|
458
|
+
goBackward: q(o(r, -1)),
|
|
459
|
+
goToday: q(o(t.getToday(), 0))
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
// src/icons/chevron.tsx
|
|
463
|
+
function yt(e) {
|
|
464
|
+
return /* @__PURE__ */ W("svg", {
|
|
465
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
466
|
+
fill: "none",
|
|
467
|
+
height: "12",
|
|
468
|
+
viewBox: "0 0 13 12",
|
|
469
|
+
width: "13",
|
|
470
|
+
...e,
|
|
471
|
+
children: /* @__PURE__ */ W("path", {
|
|
472
|
+
d: "M1.77498 2.29504L6.35498 6.87504L10.945 2.29504L12.355 3.70504L6.35498 9.70504L0.35498 3.70504L1.77498 2.29504Z",
|
|
473
|
+
fill: "currentColor"
|
|
474
|
+
})
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
// src/portal/Portal.tsx
|
|
478
|
+
var bt = () => () => {}, xt = () => !0, St = () => !1;
|
|
479
|
+
function Ct() {
|
|
480
|
+
return f(bt, xt, St);
|
|
481
|
+
}
|
|
482
|
+
function wt(e) {
|
|
483
|
+
let t = { display: "contents" };
|
|
484
|
+
if (!e) return t;
|
|
485
|
+
let n = getComputedStyle(e);
|
|
486
|
+
for (let e of g) {
|
|
487
|
+
let r = n.getPropertyValue(e).trim();
|
|
488
|
+
r && (t[e === "font-family" ? "fontFamily" : e] = r);
|
|
489
|
+
}
|
|
490
|
+
return t;
|
|
491
|
+
}
|
|
492
|
+
function Tt({ children: e, container: t }) {
|
|
493
|
+
let n = Ct(), i = r(gt);
|
|
494
|
+
return n ? t ? Be(e, t) : Be(/* @__PURE__ */ W("div", {
|
|
495
|
+
style: wt(i?.current),
|
|
496
|
+
children: e
|
|
497
|
+
}), document.body) : null;
|
|
498
|
+
}
|
|
499
|
+
var Y = {
|
|
500
|
+
root: "_root_1aojr_1",
|
|
501
|
+
root__toggle: "_root__toggle_1aojr_6",
|
|
502
|
+
root__toggleLabel: "_root__toggleLabel_1aojr_30",
|
|
503
|
+
root__toggleIcon: "_root__toggleIcon_1aojr_37",
|
|
504
|
+
root__toggleIcon_open: "_root__toggleIcon_open_1aojr_43",
|
|
505
|
+
popover: "_popover_1aojr_47",
|
|
506
|
+
popover__header: "_popover__header_1aojr_71",
|
|
507
|
+
popover__title: "_popover__title_1aojr_93",
|
|
508
|
+
popover__navBackward: "_popover__navBackward_1aojr_98",
|
|
509
|
+
popover__navForward: "_popover__navForward_1aojr_102",
|
|
510
|
+
popover__grid: "_popover__grid_1aojr_106",
|
|
511
|
+
popover__weekday: "_popover__weekday_1aojr_112",
|
|
512
|
+
popover__day: "_popover__day_1aojr_122",
|
|
513
|
+
popover__day_outside: "_popover__day_outside_1aojr_140",
|
|
514
|
+
popover__day_selected: "_popover__day_selected_1aojr_145",
|
|
515
|
+
popover__day_rangeStart: "_popover__day_rangeStart_1aojr_152",
|
|
516
|
+
popover__day_rangeEnd: "_popover__day_rangeEnd_1aojr_157",
|
|
517
|
+
popover__day_today: "_popover__day_today_1aojr_162"
|
|
518
|
+
};
|
|
519
|
+
// src/components/date-navigator/DateNavigator.tsx
|
|
520
|
+
function Et({ renderHeading: e, type: t = "button", onClick: n, onKeyDown: r, className: a, ...o }) {
|
|
521
|
+
let { view: s, viewValue: l, changeViewValue: f, startWeek: p } = J(), m = K(), h = Ge(), { getStartOfWeek: g, getStartOfMonth: _, addMonths: v } = m, [y, b] = d(!1), [x, S] = d(() => _(l)), C = u(null), { refs: w, floatingStyles: T } = Re({
|
|
522
|
+
placement: "bottom",
|
|
523
|
+
middleware: [
|
|
524
|
+
Ie(6),
|
|
525
|
+
Fe({ padding: 8 }),
|
|
526
|
+
Le({ padding: 8 })
|
|
527
|
+
],
|
|
528
|
+
whileElementsMounted: Pe
|
|
529
|
+
});
|
|
530
|
+
i(() => {
|
|
531
|
+
y && S(_(l));
|
|
532
|
+
}, [
|
|
533
|
+
y,
|
|
534
|
+
_,
|
|
535
|
+
l
|
|
536
|
+
]), i(() => {
|
|
537
|
+
if (!y) return;
|
|
538
|
+
let e = (e) => {
|
|
539
|
+
let t = e.target;
|
|
540
|
+
C.current?.contains(t) || w.floating.current?.contains(t) || b(!1);
|
|
541
|
+
};
|
|
542
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
543
|
+
}, [y, w.floating]);
|
|
544
|
+
let E = c(() => e ? e(l, s) : le(m, s, l, p), [
|
|
545
|
+
m,
|
|
546
|
+
e,
|
|
547
|
+
p,
|
|
548
|
+
s,
|
|
549
|
+
l
|
|
550
|
+
]), O = c(() => L(m, x, p), [
|
|
551
|
+
m,
|
|
552
|
+
x,
|
|
553
|
+
p
|
|
554
|
+
]), k = (e) => {
|
|
555
|
+
n?.(e), b((e) => !e);
|
|
556
|
+
}, A = (e) => {
|
|
557
|
+
r?.(e), e.key === "Escape" && b(!1);
|
|
558
|
+
}, j = (e) => {
|
|
559
|
+
f(s === "week" ? g(e, p) : e, s), b(!1);
|
|
560
|
+
};
|
|
561
|
+
return /* @__PURE__ */ G("div", {
|
|
562
|
+
ref: C,
|
|
563
|
+
className: Y.root,
|
|
564
|
+
children: [/* @__PURE__ */ G("button", {
|
|
565
|
+
type: t,
|
|
566
|
+
"aria-label": h.chooseDate,
|
|
567
|
+
"aria-expanded": y,
|
|
568
|
+
"aria-haspopup": "dialog",
|
|
569
|
+
...o,
|
|
570
|
+
onClick: k,
|
|
571
|
+
onKeyDown: A,
|
|
572
|
+
ref: w.setReference,
|
|
573
|
+
className: D(a, Y.root__toggle),
|
|
574
|
+
children: [/* @__PURE__ */ W("span", {
|
|
575
|
+
className: Y.root__toggleLabel,
|
|
576
|
+
children: E
|
|
577
|
+
}), /* @__PURE__ */ W(yt, { className: D(Y.root__toggleIcon, { [Y.root__toggleIcon_open]: y }) })]
|
|
578
|
+
}), y && /* @__PURE__ */ W(Tt, { children: /* @__PURE__ */ G("div", {
|
|
579
|
+
ref: w.setFloating,
|
|
580
|
+
style: T,
|
|
581
|
+
role: "dialog",
|
|
582
|
+
"aria-label": h.chooseDate,
|
|
583
|
+
className: Y.popover,
|
|
584
|
+
children: [/* @__PURE__ */ G("div", {
|
|
585
|
+
className: Y.popover__header,
|
|
586
|
+
children: [
|
|
587
|
+
/* @__PURE__ */ W("button", {
|
|
588
|
+
type: "button",
|
|
589
|
+
"aria-label": h.previousMonth,
|
|
590
|
+
onClick: () => S((e) => v(e, -1)),
|
|
591
|
+
children: /* @__PURE__ */ W(yt, { className: Y.popover__navBackward })
|
|
592
|
+
}),
|
|
593
|
+
/* @__PURE__ */ W("div", {
|
|
594
|
+
className: Y.popover__title,
|
|
595
|
+
children: ee(m, x)
|
|
596
|
+
}),
|
|
597
|
+
/* @__PURE__ */ W("button", {
|
|
598
|
+
type: "button",
|
|
599
|
+
"aria-label": h.nextMonth,
|
|
600
|
+
onClick: () => S((e) => v(e, 1)),
|
|
601
|
+
children: /* @__PURE__ */ W(yt, { className: Y.popover__navForward })
|
|
602
|
+
})
|
|
603
|
+
]
|
|
604
|
+
}), /* @__PURE__ */ G("div", {
|
|
605
|
+
className: Y.popover__grid,
|
|
606
|
+
children: [O.slice(0, 7).map((e) => /* @__PURE__ */ W("div", {
|
|
607
|
+
className: Y.popover__weekday,
|
|
608
|
+
children: m.weekDayShortName(m.getWeekDay(e))
|
|
609
|
+
}, m.getWeekDay(e))), O.map((e, t) => {
|
|
610
|
+
let n = m.getMonths(e) !== m.getMonths(x), r = m.isToday(e), i = s !== "month" && me(m, s, l, e), a = i && (s === "day" || t % 7 == 0), o = i && (s === "day" || t % 7 == 6);
|
|
611
|
+
return /* @__PURE__ */ W("button", {
|
|
612
|
+
type: "button",
|
|
613
|
+
onClick: () => j(e),
|
|
614
|
+
className: D(Y.popover__day, {
|
|
615
|
+
[Y.popover__day_outside]: n,
|
|
616
|
+
[Y.popover__day_today]: r,
|
|
617
|
+
[Y.popover__day_selected]: i,
|
|
618
|
+
[Y.popover__day_rangeStart]: a,
|
|
619
|
+
[Y.popover__day_rangeEnd]: o
|
|
620
|
+
}),
|
|
621
|
+
children: m.getMonthDay(e)
|
|
622
|
+
}, m.toMillis(e));
|
|
623
|
+
})]
|
|
624
|
+
})]
|
|
625
|
+
}) })]
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
var Dt = {
|
|
629
|
+
root: "_root_l1csz_1",
|
|
630
|
+
root__icon: "_root__icon_l1csz_21",
|
|
631
|
+
root__icon_forward: "_root__icon_forward_l1csz_25",
|
|
632
|
+
root__icon_backward: "_root__icon_backward_l1csz_29"
|
|
633
|
+
};
|
|
634
|
+
// src/components/nav-btn/NavBtn.tsx
|
|
635
|
+
function Ot({ direction: e = "forward", type: t = "button", onClick: n, className: r, children: i, ...a }) {
|
|
636
|
+
let { goForward: o, goBackward: s } = J(), c = Ge(), l = q(ve(n, () => {
|
|
637
|
+
e === "forward" ? o() : e === "backward" && s();
|
|
638
|
+
}));
|
|
639
|
+
return /* @__PURE__ */ W("button", {
|
|
640
|
+
type: t,
|
|
641
|
+
"aria-label": e === "forward" ? c.next : c.previous,
|
|
642
|
+
...a,
|
|
643
|
+
onClick: l,
|
|
644
|
+
className: D(r, Dt.root),
|
|
645
|
+
children: i ?? /* @__PURE__ */ W(yt, { className: D(Dt.root__icon, {
|
|
646
|
+
[Dt.root__icon_backward]: e === "backward",
|
|
647
|
+
[Dt.root__icon_forward]: e === "forward"
|
|
648
|
+
}) })
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
var kt = {
|
|
652
|
+
root: "_root_1n590_1",
|
|
653
|
+
root__icon: "_root__icon_1n590_25",
|
|
654
|
+
root__icon_open: "_root__icon_open_1n590_32",
|
|
655
|
+
list: "_list_1n590_36",
|
|
656
|
+
list__option: "_list__option_1n590_48",
|
|
657
|
+
list__option_active: "_list__option_active_1n590_67",
|
|
658
|
+
list__check: "_list__check_1n590_75"
|
|
659
|
+
}, At = [
|
|
660
|
+
"day",
|
|
661
|
+
"week",
|
|
662
|
+
"month"
|
|
663
|
+
];
|
|
664
|
+
function jt({ className: e }) {
|
|
665
|
+
let { view: t, changeView: n } = J(), r = Ge(), { addGlobalListener: o, removeGlobalListener: s } = it(), c = a(), [l, f] = d(!1), [p, m] = d(t), h = u(/* @__PURE__ */ new Map()), { refs: g, floatingStyles: _ } = Re({
|
|
666
|
+
placement: "bottom-end",
|
|
667
|
+
middleware: [
|
|
668
|
+
Ie(6),
|
|
669
|
+
Fe({ padding: 8 }),
|
|
670
|
+
Le({ padding: 8 })
|
|
671
|
+
],
|
|
672
|
+
whileElementsMounted: Pe
|
|
673
|
+
}), v = (e) => {
|
|
674
|
+
f(!1);
|
|
675
|
+
let t = g.reference.current;
|
|
676
|
+
e && t instanceof HTMLElement && t.focus();
|
|
677
|
+
}, y = (e = t) => {
|
|
678
|
+
m(e), f(!0);
|
|
679
|
+
}, b = (e) => {
|
|
680
|
+
v(!0), n(e);
|
|
681
|
+
};
|
|
682
|
+
i(() => {
|
|
683
|
+
l && h.current.get(p)?.focus();
|
|
684
|
+
}, [l, p]), i(() => {
|
|
685
|
+
if (!l) return;
|
|
686
|
+
let e = (e) => {
|
|
687
|
+
let t = e.target, n = g.reference.current;
|
|
688
|
+
n instanceof Node && n.contains(t) || g.floating.current?.contains(t) || f(!1);
|
|
689
|
+
};
|
|
690
|
+
return o(document, "pointerdown", e), () => s(document, "pointerdown", e);
|
|
691
|
+
}, [
|
|
692
|
+
o,
|
|
693
|
+
l,
|
|
694
|
+
g.floating,
|
|
695
|
+
g.reference,
|
|
696
|
+
s
|
|
697
|
+
]);
|
|
698
|
+
let x = (e) => {
|
|
699
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), y());
|
|
700
|
+
}, S = (e) => {
|
|
701
|
+
let t = At.indexOf(p), n = (t) => {
|
|
702
|
+
e.preventDefault(), m(At[(t + At.length) % At.length] ?? p);
|
|
703
|
+
};
|
|
704
|
+
switch (e.key) {
|
|
705
|
+
case "ArrowDown": return n(t + 1);
|
|
706
|
+
case "ArrowUp": return n(t - 1);
|
|
707
|
+
case "Home": return n(0);
|
|
708
|
+
case "End": return n(At.length - 1);
|
|
709
|
+
case "Enter":
|
|
710
|
+
case " ": return e.preventDefault(), b(p);
|
|
711
|
+
case "Escape": return e.preventDefault(), v(!0);
|
|
712
|
+
case "Tab": return v(!1);
|
|
713
|
+
}
|
|
714
|
+
}, C = `${c}-list`;
|
|
715
|
+
return /* @__PURE__ */ G(ze, { children: [/* @__PURE__ */ G("button", {
|
|
716
|
+
ref: g.setReference,
|
|
717
|
+
type: "button",
|
|
718
|
+
"aria-haspopup": "listbox",
|
|
719
|
+
"aria-expanded": l,
|
|
720
|
+
"aria-controls": l ? C : void 0,
|
|
721
|
+
"aria-label": `${r.chooseView}: ${r[t]}`,
|
|
722
|
+
className: D(e, kt.root),
|
|
723
|
+
onClick: () => l ? v(!1) : y(),
|
|
724
|
+
onKeyDown: x,
|
|
725
|
+
children: [r[t], /* @__PURE__ */ W(yt, {
|
|
726
|
+
"aria-hidden": "true",
|
|
727
|
+
className: D(kt.root__icon, { [kt.root__icon_open]: l })
|
|
728
|
+
})]
|
|
729
|
+
}), l && /* @__PURE__ */ W(Tt, { children: /* @__PURE__ */ W("div", {
|
|
730
|
+
ref: g.setFloating,
|
|
731
|
+
id: C,
|
|
732
|
+
role: "listbox",
|
|
733
|
+
"aria-label": r.chooseView,
|
|
734
|
+
style: _,
|
|
735
|
+
className: kt.list,
|
|
736
|
+
onKeyDown: S,
|
|
737
|
+
children: At.map((e) => /* @__PURE__ */ G("div", {
|
|
738
|
+
ref: (t) => {
|
|
739
|
+
t ? h.current.set(e, t) : h.current.delete(e);
|
|
740
|
+
},
|
|
741
|
+
id: `${c}-${e}`,
|
|
742
|
+
role: "option",
|
|
743
|
+
tabIndex: -1,
|
|
744
|
+
"aria-selected": e === t,
|
|
745
|
+
className: D(kt.list__option, { [kt.list__option_active]: e === p }),
|
|
746
|
+
onClick: () => b(e),
|
|
747
|
+
onPointerMove: () => m(e),
|
|
748
|
+
children: [r[e], e === t && /* @__PURE__ */ W("svg", {
|
|
749
|
+
"aria-hidden": "true",
|
|
750
|
+
className: kt.list__check,
|
|
751
|
+
viewBox: "0 0 16 16",
|
|
752
|
+
width: "14",
|
|
753
|
+
height: "14",
|
|
754
|
+
children: /* @__PURE__ */ W("path", {
|
|
755
|
+
d: "M3 8.5 6.5 12 13 4.5",
|
|
756
|
+
fill: "none",
|
|
757
|
+
stroke: "currentColor",
|
|
758
|
+
strokeWidth: "2",
|
|
759
|
+
strokeLinecap: "round",
|
|
760
|
+
strokeLinejoin: "round"
|
|
761
|
+
})
|
|
762
|
+
})]
|
|
763
|
+
}, e))
|
|
764
|
+
}) })] });
|
|
765
|
+
}
|
|
766
|
+
var X = {
|
|
767
|
+
root: "_root_1lvdm_1",
|
|
768
|
+
root__navigationPane: "_root__navigationPane_1lvdm_12",
|
|
769
|
+
root__viewList: "_root__viewList_1lvdm_13",
|
|
770
|
+
root__today: "_root__today_1lvdm_26",
|
|
771
|
+
root__viewTab: "_root__viewTab_1lvdm_55",
|
|
772
|
+
root__viewTab_isActive: "_root__viewTab_isActive_1lvdm_75",
|
|
773
|
+
root__viewTab_disabled: "_root__viewTab_disabled_1lvdm_83",
|
|
774
|
+
root__viewSelect: "_root__viewSelect_1lvdm_89"
|
|
775
|
+
};
|
|
776
|
+
// src/components/calendar-toolbar/CalendarToolbar.tsx
|
|
777
|
+
function Mt(e) {
|
|
778
|
+
let { goToday: t, changeView: n, view: r } = J(), i = Ge(), a = e, o = {
|
|
779
|
+
day: {
|
|
780
|
+
type: "button",
|
|
781
|
+
"aria-selected": r === "day",
|
|
782
|
+
onClick: ve(void 0, () => n("day")),
|
|
783
|
+
className: D(X.root__viewTab, { [X.root__viewTab_isActive]: r === "day" }),
|
|
784
|
+
children: i.day
|
|
785
|
+
},
|
|
786
|
+
week: {
|
|
787
|
+
type: "button",
|
|
788
|
+
"aria-selected": r === "week",
|
|
789
|
+
onClick: ve(void 0, () => n("week")),
|
|
790
|
+
className: D(X.root__viewTab, { [X.root__viewTab_isActive]: r === "week" }),
|
|
791
|
+
children: i.week
|
|
792
|
+
},
|
|
793
|
+
month: {
|
|
794
|
+
type: "button",
|
|
795
|
+
"aria-selected": r === "month",
|
|
796
|
+
onClick: ve(void 0, () => n("month")),
|
|
797
|
+
className: D(X.root__viewTab, { [X.root__viewTab_isActive]: r === "month" }),
|
|
798
|
+
children: i.month
|
|
799
|
+
}
|
|
800
|
+
}, s = {
|
|
801
|
+
type: "button",
|
|
802
|
+
onClick: q(t),
|
|
803
|
+
className: X.root__today,
|
|
804
|
+
children: i.today
|
|
805
|
+
};
|
|
806
|
+
return /* @__PURE__ */ G("div", {
|
|
807
|
+
...a,
|
|
808
|
+
className: D(a.className, X.root),
|
|
809
|
+
children: [
|
|
810
|
+
/* @__PURE__ */ W(Et, {}),
|
|
811
|
+
/* @__PURE__ */ G("div", {
|
|
812
|
+
className: X.root__navigationPane,
|
|
813
|
+
role: "group",
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ W(Ot, { direction: "backward" }),
|
|
816
|
+
/* @__PURE__ */ W("button", { ...s }),
|
|
817
|
+
/* @__PURE__ */ W(Ot, { direction: "forward" })
|
|
818
|
+
]
|
|
819
|
+
}),
|
|
820
|
+
/* @__PURE__ */ G("div", {
|
|
821
|
+
className: X.root__viewList,
|
|
822
|
+
children: [
|
|
823
|
+
/* @__PURE__ */ W("button", { ...o.day }),
|
|
824
|
+
/* @__PURE__ */ W("button", { ...o.week }),
|
|
825
|
+
/* @__PURE__ */ W("button", { ...o.month })
|
|
826
|
+
]
|
|
827
|
+
}),
|
|
828
|
+
/* @__PURE__ */ W("div", {
|
|
829
|
+
className: X.root__viewSelect,
|
|
830
|
+
children: /* @__PURE__ */ W(jt, {})
|
|
831
|
+
})
|
|
832
|
+
]
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
// src/contexts/CalendarViewportContext.ts
|
|
836
|
+
var Nt = e(void 0);
|
|
837
|
+
U && (Nt.displayName = "CalendarViewportContext");
|
|
838
|
+
function Pt() {
|
|
839
|
+
let e = r(Nt);
|
|
840
|
+
if (!e) throw Error("CalendarViewportContext is required");
|
|
841
|
+
return e;
|
|
842
|
+
}
|
|
843
|
+
var Ft = { root: "_root_i43d6_1" };
|
|
844
|
+
// src/components/pointer-popover/PointerPopover.tsx
|
|
845
|
+
function It({ coordinates: e, className: t, style: n, ...r }) {
|
|
846
|
+
return /* @__PURE__ */ W("span", {
|
|
847
|
+
tabIndex: -1,
|
|
848
|
+
...r,
|
|
849
|
+
className: D(t, Ft.root),
|
|
850
|
+
style: {
|
|
851
|
+
...n,
|
|
852
|
+
...e ? {
|
|
853
|
+
top: `calc(${e.y}px + 20px)`,
|
|
854
|
+
left: `calc(${e.x}px + 20px)`
|
|
855
|
+
} : null
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
var Lt = {
|
|
860
|
+
root: "_root_mqfwg_1",
|
|
861
|
+
root_isDragging: "_root_isDragging_mqfwg_11",
|
|
862
|
+
root_isReturning: "_root_isReturning_mqfwg_20",
|
|
863
|
+
"ww-drag-return": "_ww-drag-return_mqfwg_36",
|
|
864
|
+
root_isBlocked: "_root_isBlocked_mqfwg_33"
|
|
865
|
+
}, Rt = {
|
|
866
|
+
isStart: !0,
|
|
867
|
+
isEnd: !0
|
|
868
|
+
};
|
|
869
|
+
function zt({ showPreview: e = !0, pxPerMinute: t = 1, ...n }) {
|
|
870
|
+
let { eventMap: r, eventRenderer: i, pointerPreviewRenderer: a, view: o } = J(), { viewportRef: s } = Pt(), { isDragging: l, canDrop: f, dropData: p, eventItem: m, source: h, x: g, y: _, ...v } = Ne(({ draggable: e, overlay: t, droppable: n, canDrop: r }) => {
|
|
871
|
+
let i = [...n.dropTargets.values()].shift(), a = [...e.dragTargets.values()].shift();
|
|
872
|
+
return {
|
|
873
|
+
...t.transform,
|
|
874
|
+
source: [...e.dragTargets.keys()].shift() ?? null,
|
|
875
|
+
canDrop: r(),
|
|
876
|
+
dropData: i,
|
|
877
|
+
eventItem: a ? a.filter((e) => e.event)[0] : null,
|
|
878
|
+
isDragging: e.isDragging,
|
|
879
|
+
x: e.x,
|
|
880
|
+
y: e.y
|
|
881
|
+
};
|
|
882
|
+
}), y = c(() => {
|
|
883
|
+
if (!m) return null;
|
|
884
|
+
let { key: e } = JSON.parse(m.event);
|
|
885
|
+
return r.get(e)?.value ?? null;
|
|
886
|
+
}, [m, r]), b = u(null), [x, S] = d(null);
|
|
887
|
+
if (Ke(() => {
|
|
888
|
+
if (!l || p) {
|
|
889
|
+
b.current = l ? v : null, S(null);
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
let e = b.current, t = s.current;
|
|
893
|
+
if (x || !e || !h || !t) return;
|
|
894
|
+
let n = h.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
895
|
+
S({
|
|
896
|
+
container: t,
|
|
897
|
+
style: {
|
|
898
|
+
left: n.left - r.left,
|
|
899
|
+
top: n.top - r.top,
|
|
900
|
+
width: n.width,
|
|
901
|
+
height: n.height,
|
|
902
|
+
"--ww-return-left": `${e.left}px`,
|
|
903
|
+
"--ww-return-top": `${e.top}px`,
|
|
904
|
+
"--ww-return-width": `${e.width}px`,
|
|
905
|
+
"--ww-return-height": `${e.height}px`
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
}), !l) return null;
|
|
909
|
+
if (!p) return x ? /* @__PURE__ */ W(Tt, {
|
|
910
|
+
container: x.container,
|
|
911
|
+
children: /* @__PURE__ */ W("div", {
|
|
912
|
+
...n,
|
|
913
|
+
className: D(n.className, Lt.root, Lt.root_isReturning),
|
|
914
|
+
style: x.style,
|
|
915
|
+
children: y == null ? null : i.current?.(y, o, Rt)
|
|
916
|
+
})
|
|
917
|
+
}) : null;
|
|
918
|
+
let C = !f;
|
|
919
|
+
return /* @__PURE__ */ G(Tt, {
|
|
920
|
+
container: s.current,
|
|
921
|
+
children: [/* @__PURE__ */ W("div", {
|
|
922
|
+
...n,
|
|
923
|
+
className: D(n.className, Lt.root, {
|
|
924
|
+
[Lt.root_isDragging]: l,
|
|
925
|
+
[Lt.root_isBlocked]: C
|
|
926
|
+
}),
|
|
927
|
+
style: { ...v },
|
|
928
|
+
children: y == null ? null : i.current?.(y, o, Rt)
|
|
929
|
+
}), e && !C && /* @__PURE__ */ W(It, {
|
|
930
|
+
coordinates: {
|
|
931
|
+
x: g,
|
|
932
|
+
y: _
|
|
933
|
+
},
|
|
934
|
+
children: p ? a.current?.(p.date, Math.round(v.top / t), Math.round(v.height / t)) : null
|
|
935
|
+
})]
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
// src/components/month-view/MonthView.utils.ts
|
|
939
|
+
function Bt(e, t) {
|
|
940
|
+
return {
|
|
941
|
+
...t,
|
|
942
|
+
...e
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
function Vt(e) {
|
|
946
|
+
return Array.from({ length: Math.ceil(e.length / 7) }, (t, n) => e.slice(n * 7, n * 7 + 7));
|
|
947
|
+
}
|
|
948
|
+
function Ht(e, t, n) {
|
|
949
|
+
let r = e?.querySelectorAll("[data-day-index]") ?? [], i = -1, a = 1e400;
|
|
950
|
+
for (let e of r) {
|
|
951
|
+
let r = e.getBoundingClientRect(), o = t < r.left ? r.left - t : t >= r.right ? t - r.right : 0, s = n < r.top ? r.top - n : n >= r.bottom ? n - r.bottom : 0, c = Math.hypot(o, s);
|
|
952
|
+
c < a && (a = c, i = Number(e.dataset.dayIndex));
|
|
953
|
+
}
|
|
954
|
+
return i;
|
|
955
|
+
}
|
|
956
|
+
var Z = {
|
|
957
|
+
root: "_root_diwsf_1",
|
|
958
|
+
root__head: "_root__head_diwsf_10",
|
|
959
|
+
root__weekday: "_root__weekday_diwsf_20",
|
|
960
|
+
root__body: "_root__body_diwsf_30",
|
|
961
|
+
root__viewport: "_root__viewport_diwsf_36",
|
|
962
|
+
root__week: "_root__week_diwsf_20",
|
|
963
|
+
root__day: "_root__day_diwsf_61",
|
|
964
|
+
root__day_isOver: "_root__day_isOver_diwsf_85",
|
|
965
|
+
root__dayNumber: "_root__dayNumber_diwsf_99",
|
|
966
|
+
root__event: "_root__event_diwsf_121",
|
|
967
|
+
root__event_span: "_root__event_span_diwsf_150",
|
|
968
|
+
root__event_continuesBefore: "_root__event_continuesBefore_diwsf_156",
|
|
969
|
+
root__event_continuesAfter: "_root__event_continuesAfter_diwsf_162",
|
|
970
|
+
root__event_isResizing: "_root__event_isResizing_diwsf_168",
|
|
971
|
+
root__event_isResizeSource: "_root__event_isResizeSource_diwsf_172",
|
|
972
|
+
root__resize: "_root__resize_diwsf_177",
|
|
973
|
+
root__resizeStart: "_root__resizeStart_diwsf_185",
|
|
974
|
+
root__resizeEnd: "_root__resizeEnd_diwsf_189",
|
|
975
|
+
root_isResizing: "_root_isResizing_diwsf_193",
|
|
976
|
+
root__event_isDragging: "_root__event_isDragging_diwsf_198",
|
|
977
|
+
root__dragOverlay: "_root__dragOverlay_diwsf_203",
|
|
978
|
+
root__more: "_root__more_diwsf_228"
|
|
979
|
+
};
|
|
980
|
+
// src/components/month-view/MonthViewDay.tsx
|
|
981
|
+
function Ut(e) {
|
|
982
|
+
let { ref: t, targetDate: n, children: r, onDoubleClick: a, ...o } = e, { onEventChange: s, onEventCreate: c, getIsDayDisabled: l, disabled: d, eventMap: f } = J(), p = K(), { getHours: m, getMinutes: h, getNow: g } = p, _ = u(null), { register: v, isOver: y } = Ne(({ registerDropTarget: e, isOver: t }) => ({
|
|
983
|
+
register: e,
|
|
984
|
+
isOver: t(_.current)
|
|
985
|
+
}));
|
|
986
|
+
i(() => {
|
|
987
|
+
let e = _.current;
|
|
988
|
+
if (e) return v(e, {
|
|
989
|
+
data: { date: n },
|
|
990
|
+
onDrop: async (e) => {
|
|
991
|
+
let [t] = await Promise.all(e.items.filter((e) => e.kind === "text" && e.types.has("event") && "getText" in e).map(async (e) => {
|
|
992
|
+
let t = await e.getText("event");
|
|
993
|
+
return JSON.parse(t);
|
|
994
|
+
})), r = t && f.get(t.key);
|
|
995
|
+
if (!r) return;
|
|
996
|
+
let i = p.fromMillis(t.day ?? t.date), a = ke(p, i, n) / 1440;
|
|
997
|
+
a !== 0 && s(r.key, p.addDays(p.getStartOfDay(r.date), a), {
|
|
998
|
+
from: m(r.date) * 60 + h(r.date),
|
|
999
|
+
duration: r.duration
|
|
1000
|
+
});
|
|
1001
|
+
},
|
|
1002
|
+
getDropOperationForPoint: (e, t) => d || !e.has("event") || l && l(n) ? "cancel" : t[0]
|
|
1003
|
+
});
|
|
1004
|
+
}, [
|
|
1005
|
+
p,
|
|
1006
|
+
d,
|
|
1007
|
+
f,
|
|
1008
|
+
m,
|
|
1009
|
+
l,
|
|
1010
|
+
h,
|
|
1011
|
+
s,
|
|
1012
|
+
v,
|
|
1013
|
+
n
|
|
1014
|
+
]);
|
|
1015
|
+
let b = q((e) => {
|
|
1016
|
+
if (a?.(e), e.defaultPrevented || d || l && l(n)) return;
|
|
1017
|
+
let t = g();
|
|
1018
|
+
c(n, {
|
|
1019
|
+
from: m(t) * 60 + h(t),
|
|
1020
|
+
duration: 60
|
|
1021
|
+
});
|
|
1022
|
+
}), x = st(_, t);
|
|
1023
|
+
return /* @__PURE__ */ W("div", {
|
|
1024
|
+
...o,
|
|
1025
|
+
ref: x,
|
|
1026
|
+
onDoubleClick: b,
|
|
1027
|
+
className: D(o.className, Z.root__day, { [Z.root__day_isOver]: y }),
|
|
1028
|
+
children: r
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
// src/hooks/useInterval.ts
|
|
1032
|
+
function Wt() {
|
|
1033
|
+
let e = u(null);
|
|
1034
|
+
return [n((t, n) => {
|
|
1035
|
+
e.current = setInterval(t, n);
|
|
1036
|
+
}, []), n(() => {
|
|
1037
|
+
e.current !== null && (clearInterval(e.current), e.current = null);
|
|
1038
|
+
}, [])];
|
|
1039
|
+
}
|
|
1040
|
+
// src/hooks/useScrollIntent.ts
|
|
1041
|
+
var Gt = {
|
|
1042
|
+
x: {
|
|
1043
|
+
[-1]: !1,
|
|
1044
|
+
1: !1
|
|
1045
|
+
},
|
|
1046
|
+
y: {
|
|
1047
|
+
[-1]: !1,
|
|
1048
|
+
1: !1
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
function Kt({ delta: e, disabled: t }) {
|
|
1052
|
+
let n = lt(e);
|
|
1053
|
+
return Xe((r) => {
|
|
1054
|
+
if (t || !n || !r) return Gt;
|
|
1055
|
+
let i = {
|
|
1056
|
+
x: Math.sign(e.x - n.x),
|
|
1057
|
+
y: Math.sign(e.y - n.y)
|
|
1058
|
+
};
|
|
1059
|
+
return {
|
|
1060
|
+
x: {
|
|
1061
|
+
[-1]: r.x[-1] || i.x === -1,
|
|
1062
|
+
1: r.x[1] || i.x === 1
|
|
1063
|
+
},
|
|
1064
|
+
y: {
|
|
1065
|
+
[-1]: r.y[-1] || i.y === -1,
|
|
1066
|
+
1: r.y[1] || i.y === 1
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
}, [
|
|
1070
|
+
t,
|
|
1071
|
+
e,
|
|
1072
|
+
n
|
|
1073
|
+
]);
|
|
1074
|
+
}
|
|
1075
|
+
// src/hooks/useAutoScroller.ts
|
|
1076
|
+
function qt(e) {
|
|
1077
|
+
let { acceleration: t, activator: r = 0, canScroll: a, enabled: o, interval: s = 5, pointerCoordinates: l, order: d = 0, delta: f, threshold: p, activeNodeRect: m, scrollableAncestors: h, scrollableAncestorsRects: g } = e, [_, v] = Wt(), y = Kt({
|
|
1078
|
+
delta: f,
|
|
1079
|
+
disabled: !o
|
|
1080
|
+
}), b = u({
|
|
1081
|
+
x: 0,
|
|
1082
|
+
y: 0
|
|
1083
|
+
}), x = u({
|
|
1084
|
+
x: 0,
|
|
1085
|
+
y: 0
|
|
1086
|
+
}), S = u(null), C = c(() => d === 0 ? [[...h].reverse(), [...g].reverse()] : [[...h], [...g]], [
|
|
1087
|
+
d,
|
|
1088
|
+
h,
|
|
1089
|
+
g
|
|
1090
|
+
]), w = c(() => {
|
|
1091
|
+
switch (r) {
|
|
1092
|
+
case 0: return l ? {
|
|
1093
|
+
top: l.y,
|
|
1094
|
+
bottom: l.y,
|
|
1095
|
+
left: l.x,
|
|
1096
|
+
right: l.x
|
|
1097
|
+
} : null;
|
|
1098
|
+
case 1: return m;
|
|
1099
|
+
}
|
|
1100
|
+
}, [
|
|
1101
|
+
r,
|
|
1102
|
+
m,
|
|
1103
|
+
l
|
|
1104
|
+
]), T = n(() => {
|
|
1105
|
+
let e = S.current;
|
|
1106
|
+
if (!e) return;
|
|
1107
|
+
let t = b.current.x * x.current.x, n = b.current.y * x.current.y;
|
|
1108
|
+
e.scrollBy(t, n);
|
|
1109
|
+
}, []);
|
|
1110
|
+
i(() => {
|
|
1111
|
+
let [e, n] = C;
|
|
1112
|
+
if (!o || !e.length || !w) v();
|
|
1113
|
+
else {
|
|
1114
|
+
for (let [r, i] of e.entries()) {
|
|
1115
|
+
if (!i || a?.(i) === !1) continue;
|
|
1116
|
+
let e = n[r];
|
|
1117
|
+
if (!e) continue;
|
|
1118
|
+
let { direction: o, speed: c } = ne(i, e, w, t, p);
|
|
1119
|
+
for (let e of ["x", "y"]) y[e][o[e]] || (c[e] = 0, o[e] = 0);
|
|
1120
|
+
if (c.x > 0 || c.y > 0) {
|
|
1121
|
+
v(), _(T, s), S.current = i, b.current = c, x.current = o;
|
|
1122
|
+
return;
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
b.current = {
|
|
1126
|
+
x: 0,
|
|
1127
|
+
y: 0
|
|
1128
|
+
}, x.current = {
|
|
1129
|
+
x: 0,
|
|
1130
|
+
y: 0
|
|
1131
|
+
}, v();
|
|
1132
|
+
}
|
|
1133
|
+
}, [
|
|
1134
|
+
t,
|
|
1135
|
+
T,
|
|
1136
|
+
a,
|
|
1137
|
+
o,
|
|
1138
|
+
s,
|
|
1139
|
+
w,
|
|
1140
|
+
h,
|
|
1141
|
+
C,
|
|
1142
|
+
p,
|
|
1143
|
+
v,
|
|
1144
|
+
_,
|
|
1145
|
+
...Object.entries(w || {}),
|
|
1146
|
+
...Object.entries(y),
|
|
1147
|
+
...Object.entries(p || {})
|
|
1148
|
+
]);
|
|
1149
|
+
}
|
|
1150
|
+
// src/hooks/useMutationObserver.ts
|
|
1151
|
+
function Jt(e, t = !1) {
|
|
1152
|
+
let n = u(e);
|
|
1153
|
+
n.current = e;
|
|
1154
|
+
let r = c(() => {
|
|
1155
|
+
if (t || typeof window > "u" || window.MutationObserver === void 0) return;
|
|
1156
|
+
let { MutationObserver: e } = window, { current: r } = n;
|
|
1157
|
+
return new e(r);
|
|
1158
|
+
}, [t]);
|
|
1159
|
+
return i(() => () => r?.disconnect(), [r]), r;
|
|
1160
|
+
}
|
|
1161
|
+
// src/hooks/useRect.ts
|
|
1162
|
+
function Yt(e, t = P, n) {
|
|
1163
|
+
let [r, i] = l(s, null), a = Jt((t) => {
|
|
1164
|
+
if (e) for (let n of t) {
|
|
1165
|
+
let { type: t, target: r } = n;
|
|
1166
|
+
if (t === "childList" && pe(r) && r.contains(e)) {
|
|
1167
|
+
i();
|
|
1168
|
+
break;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}), o = qe(i);
|
|
1172
|
+
return Ke(() => {
|
|
1173
|
+
i(), e ? (o?.observe(e), a?.observe(document.body, {
|
|
1174
|
+
childList: !0,
|
|
1175
|
+
subtree: !0
|
|
1176
|
+
})) : (o?.disconnect(), a?.disconnect());
|
|
1177
|
+
}, [
|
|
1178
|
+
e,
|
|
1179
|
+
a,
|
|
1180
|
+
o
|
|
1181
|
+
]), r;
|
|
1182
|
+
function s(r) {
|
|
1183
|
+
if (!e) return null;
|
|
1184
|
+
if (e.isConnected === !1) return r ?? n ?? null;
|
|
1185
|
+
let i = t(e);
|
|
1186
|
+
return Ee(i, r) ? r : i;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
// src/hooks/useScrollableAncestors.ts
|
|
1190
|
+
var Xt = [];
|
|
1191
|
+
function Zt(e, t) {
|
|
1192
|
+
let n = u(e), r = c(() => e ? re(e, t) : Xt, [e, t]);
|
|
1193
|
+
return i(() => {
|
|
1194
|
+
n.current = e;
|
|
1195
|
+
}, [e]), r;
|
|
1196
|
+
}
|
|
1197
|
+
// src/hooks/useScrollableAncestorsRects.ts
|
|
1198
|
+
var Qt = [];
|
|
1199
|
+
function $t(e, t = P) {
|
|
1200
|
+
let [n, r] = l(a, Qt), i = qe(r);
|
|
1201
|
+
return e.length > 0 && n === Qt && r(), Ke(() => {
|
|
1202
|
+
e.length ? e.forEach((e) => i?.observe(e)) : (i?.disconnect(), r());
|
|
1203
|
+
}, [e, i]), n;
|
|
1204
|
+
function a() {
|
|
1205
|
+
return e.length ? e.map((e) => {
|
|
1206
|
+
if (e === document.scrollingElement) {
|
|
1207
|
+
let t = fe(e), n = t.innerWidth, r = t.innerHeight;
|
|
1208
|
+
return {
|
|
1209
|
+
top: 0,
|
|
1210
|
+
left: 0,
|
|
1211
|
+
right: n,
|
|
1212
|
+
bottom: r,
|
|
1213
|
+
width: n,
|
|
1214
|
+
height: r
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
return new h(t(e), e);
|
|
1218
|
+
}) : Qt;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
// src/hooks/useScrollOffsets.ts
|
|
1222
|
+
function en(e) {
|
|
1223
|
+
let [t, r] = d(null), a = u(e), o = n((e) => {
|
|
1224
|
+
let t = ie(e.target);
|
|
1225
|
+
t && r((e) => e ? (e.set(t, V(t)), new Map(e)) : null);
|
|
1226
|
+
}, []);
|
|
1227
|
+
return i(() => {
|
|
1228
|
+
let t = a.current;
|
|
1229
|
+
if (e !== t) {
|
|
1230
|
+
n(t);
|
|
1231
|
+
let i = e.map((e) => {
|
|
1232
|
+
let t = ie(e);
|
|
1233
|
+
return t ? (t.addEventListener("scroll", o, { passive: !0 }), [t, V(t)]) : null;
|
|
1234
|
+
}).filter((e) => he(e));
|
|
1235
|
+
r(i.length ? new Map(i) : null), a.current = e;
|
|
1236
|
+
}
|
|
1237
|
+
return () => {
|
|
1238
|
+
n(e), n(t);
|
|
1239
|
+
};
|
|
1240
|
+
function n(e) {
|
|
1241
|
+
e.forEach((e) => {
|
|
1242
|
+
let t = ie(e);
|
|
1243
|
+
t && t.removeEventListener("scroll", o);
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
}, [o, e]), c(() => e.length ? t ? Array.from(t.values()).reduce((e, t) => _(e, t), O) : H(e) : O, [e, t]);
|
|
1247
|
+
}
|
|
1248
|
+
// src/hooks/useScrollOffsetsDelta.ts
|
|
1249
|
+
function tn(e, t = k) {
|
|
1250
|
+
let n = u(null);
|
|
1251
|
+
return i(() => {
|
|
1252
|
+
n.current = null;
|
|
1253
|
+
}, t), i(() => {
|
|
1254
|
+
let t = e !== O;
|
|
1255
|
+
t && !n.current && (n.current = e), !t && n.current && (n.current = null);
|
|
1256
|
+
}, [e]), n.current ? Oe(e, n.current) : O;
|
|
1257
|
+
}
|
|
1258
|
+
// src/hooks/useMoveTransform.ts
|
|
1259
|
+
var nn = {
|
|
1260
|
+
Start: "start",
|
|
1261
|
+
Move: "move",
|
|
1262
|
+
Stop: "stop"
|
|
1263
|
+
}, rn = {
|
|
1264
|
+
isActive: !1,
|
|
1265
|
+
initialTranslate: {
|
|
1266
|
+
x: 0,
|
|
1267
|
+
y: 0
|
|
1268
|
+
},
|
|
1269
|
+
translate: {
|
|
1270
|
+
x: 0,
|
|
1271
|
+
y: 0
|
|
1272
|
+
},
|
|
1273
|
+
delta: {
|
|
1274
|
+
x: 0,
|
|
1275
|
+
y: 0
|
|
1276
|
+
},
|
|
1277
|
+
context: null
|
|
1278
|
+
};
|
|
1279
|
+
function an({ autoScrollEnabled: e = !0, modifiers: t = [], activeNode: n = null, containerNode: r = null }) {
|
|
1280
|
+
let [i, a] = l(on, rn), o = typeof n == "function" ? n(i.context) : n, s = typeof r == "function" ? r(i.context) : r, u = Yt(i.isActive ? o : null), d = Yt(i.isActive ? s : null), f = Zt(i.isActive ? o : null), p = $t(f), m = tn(en(f)), h = c(() => {
|
|
1281
|
+
let e = (e) => (t, n) => {
|
|
1282
|
+
a({
|
|
1283
|
+
type: e,
|
|
1284
|
+
coordinates: t,
|
|
1285
|
+
context: n
|
|
1286
|
+
});
|
|
1287
|
+
};
|
|
1288
|
+
return {
|
|
1289
|
+
start: e(nn.Start),
|
|
1290
|
+
move: e(nn.Move),
|
|
1291
|
+
stop: e(nn.Stop)
|
|
1292
|
+
};
|
|
1293
|
+
}, []), g = _(i.initialTranslate, i.translate);
|
|
1294
|
+
qt({
|
|
1295
|
+
delta: i.translate,
|
|
1296
|
+
enabled: e && i.isActive,
|
|
1297
|
+
activeNodeRect: u,
|
|
1298
|
+
pointerCoordinates: g,
|
|
1299
|
+
scrollableAncestors: f,
|
|
1300
|
+
scrollableAncestorsRects: p
|
|
1301
|
+
});
|
|
1302
|
+
let b = _(i.translate, m), x = v(u, m), S = v(d, m), C = y(t, {
|
|
1303
|
+
delta: i.delta,
|
|
1304
|
+
transform: {
|
|
1305
|
+
...i.translate,
|
|
1306
|
+
left: i.translate.x,
|
|
1307
|
+
top: i.translate.y,
|
|
1308
|
+
height: u?.height || 0,
|
|
1309
|
+
width: u?.width || 0
|
|
1310
|
+
},
|
|
1311
|
+
context: i.context,
|
|
1312
|
+
activeNodeRect: u,
|
|
1313
|
+
containerNodeRect: d,
|
|
1314
|
+
translate: b,
|
|
1315
|
+
initialTranslate: i.initialTranslate
|
|
1316
|
+
});
|
|
1317
|
+
return [
|
|
1318
|
+
{
|
|
1319
|
+
context: i.context,
|
|
1320
|
+
isActive: i.currentAction === "move",
|
|
1321
|
+
transform: C,
|
|
1322
|
+
translate: i.translate,
|
|
1323
|
+
initialTranslate: i.initialTranslate,
|
|
1324
|
+
containerNodeRect: d,
|
|
1325
|
+
activeNodeRect: u,
|
|
1326
|
+
delta: i.delta
|
|
1327
|
+
},
|
|
1328
|
+
h,
|
|
1329
|
+
{
|
|
1330
|
+
pointerCoordinates: g,
|
|
1331
|
+
scrollAdjustmentActiveNodeRect: x,
|
|
1332
|
+
scrollAdjustmentContainerNodeRect: S
|
|
1333
|
+
}
|
|
1334
|
+
];
|
|
1335
|
+
}
|
|
1336
|
+
function on(e, t) {
|
|
1337
|
+
let n = {
|
|
1338
|
+
[nn.Start]: (e, { coordinates: t, context: n }) => ({
|
|
1339
|
+
...e,
|
|
1340
|
+
isActive: !0,
|
|
1341
|
+
currentAction: nn.Start,
|
|
1342
|
+
initialTranslate: { ...t },
|
|
1343
|
+
context: n
|
|
1344
|
+
}),
|
|
1345
|
+
[nn.Move]: (e, { coordinates: t }) => ({
|
|
1346
|
+
...e,
|
|
1347
|
+
currentAction: nn.Move,
|
|
1348
|
+
translate: {
|
|
1349
|
+
x: t.x - e.initialTranslate.x,
|
|
1350
|
+
y: t.y - e.initialTranslate.y
|
|
1351
|
+
},
|
|
1352
|
+
delta: {
|
|
1353
|
+
x: t.x - (e.translate.x + e.initialTranslate.x),
|
|
1354
|
+
y: t.y - (e.translate.y + e.initialTranslate.y)
|
|
1355
|
+
}
|
|
1356
|
+
}),
|
|
1357
|
+
[nn.Stop]: () => ({
|
|
1358
|
+
...rn,
|
|
1359
|
+
currentAction: nn.Stop
|
|
1360
|
+
})
|
|
1361
|
+
};
|
|
1362
|
+
return _e(t.type, n, e, t);
|
|
1363
|
+
}
|
|
1364
|
+
// src/components/month-view/MonthViewEvent.tsx
|
|
1365
|
+
var sn = 6;
|
|
1366
|
+
function cn(e) {
|
|
1367
|
+
let { ref: t, eventData: n, weekDays: r, resizable: a = !1, resize: o, isResizeSource: s = !1, isAnyResizing: c = !1, children: l, ...d } = e, { disabled: f } = J(), m = K(), { viewportRef: h } = Pt(), g = u(null), _ = u(null), { attributes: v, isDragging: y, overElement: b, register: x, setOverlayTransform: S } = Ne(({ registerDragSource: e, draggable: t, droppable: n, setTransform: r, isActive: i }) => {
|
|
1368
|
+
let a = i(g.current), [o] = a ? [...n.dropTargets].pop() ?? [null] : [null];
|
|
1369
|
+
return {
|
|
1370
|
+
attributes: t.attributes,
|
|
1371
|
+
isDragging: a,
|
|
1372
|
+
overElement: o,
|
|
1373
|
+
register: e,
|
|
1374
|
+
setOverlayTransform: r
|
|
1375
|
+
};
|
|
1376
|
+
}), C = Yt(y ? b : null), [{ transform: w, context: T }, E] = an({
|
|
1377
|
+
autoScrollEnabled: !1,
|
|
1378
|
+
activeNode: () => g.current,
|
|
1379
|
+
containerNode: () => h.current,
|
|
1380
|
+
modifiers: [function({ activeNodeRect: e, containerNodeRect: t, transform: n, translate: r, initialTranslate: i }) {
|
|
1381
|
+
if (!t || !e || !C) return n;
|
|
1382
|
+
n.x = r.x + i.x - t.left, n.y = r.y + i.y - t.top, n.left = C.left - t.left + sn, n.width = C.width - 12, n.height = e.height;
|
|
1383
|
+
let a = e.top + r.y, o = C.top + p.header, s = C.top + C.height - e.height;
|
|
1384
|
+
return n.top = Math.max(o, Math.min(a, s)) - t.top, n;
|
|
1385
|
+
}]
|
|
1386
|
+
}), O = q((e) => {
|
|
1387
|
+
T === "overlay" && S(e);
|
|
1388
|
+
});
|
|
1389
|
+
i(() => {
|
|
1390
|
+
O(w);
|
|
1391
|
+
}, [O, ...Object.values(w)]);
|
|
1392
|
+
let k = q(() => {
|
|
1393
|
+
let e = _.current ?? r[n.column], t = {
|
|
1394
|
+
...n,
|
|
1395
|
+
date: m.toMillis(n.date),
|
|
1396
|
+
day: e && m.toMillis(e)
|
|
1397
|
+
};
|
|
1398
|
+
return [{ event: JSON.stringify(t) }];
|
|
1399
|
+
});
|
|
1400
|
+
i(() => {
|
|
1401
|
+
if (g.current && !f) return x(g.current, {
|
|
1402
|
+
getItems: k,
|
|
1403
|
+
onDragStart(e) {
|
|
1404
|
+
E.start({
|
|
1405
|
+
x: e.x,
|
|
1406
|
+
y: e.y
|
|
1407
|
+
}, "overlay");
|
|
1408
|
+
},
|
|
1409
|
+
onDragMove(e) {
|
|
1410
|
+
E.move({
|
|
1411
|
+
x: e.x,
|
|
1412
|
+
y: e.y
|
|
1413
|
+
});
|
|
1414
|
+
},
|
|
1415
|
+
onDragEnd(e) {
|
|
1416
|
+
E.stop({
|
|
1417
|
+
x: e.x,
|
|
1418
|
+
y: e.y
|
|
1419
|
+
});
|
|
1420
|
+
},
|
|
1421
|
+
getAllowedDropOperations() {
|
|
1422
|
+
return ["move"];
|
|
1423
|
+
}
|
|
1424
|
+
});
|
|
1425
|
+
}, [
|
|
1426
|
+
E,
|
|
1427
|
+
f,
|
|
1428
|
+
k,
|
|
1429
|
+
x
|
|
1430
|
+
]);
|
|
1431
|
+
let ee = (e) => {
|
|
1432
|
+
e.stopPropagation();
|
|
1433
|
+
let t = e.currentTarget.parentElement;
|
|
1434
|
+
if (!t) return;
|
|
1435
|
+
let i = t.getBoundingClientRect(), a = Math.floor((e.clientX - i.left) / i.width * r.length), o = Math.min(Math.max(a, n.column), n.column + n.span - 1);
|
|
1436
|
+
_.current = r[o] ?? null;
|
|
1437
|
+
}, A = (e) => ({
|
|
1438
|
+
onMoveStart: () => (o?.start(n.key, e), !0),
|
|
1439
|
+
onMove: (e) => o?.move(e.clientX, e.clientY),
|
|
1440
|
+
onMoveEnd: () => o?.end()
|
|
1441
|
+
}), { listeners: j } = ct(A("start")), { listeners: M } = ct(A("end")), N = st(g, t), P = n.span > 1 || !n.isStart || !n.isEnd, F = Bt({
|
|
1442
|
+
"--ww-column": n.column + 1,
|
|
1443
|
+
"--ww-span": n.span,
|
|
1444
|
+
"--ww-row": n.lane + 2
|
|
1445
|
+
}, d.style);
|
|
1446
|
+
return /* @__PURE__ */ G("div", {
|
|
1447
|
+
...d,
|
|
1448
|
+
...c ? null : v,
|
|
1449
|
+
ref: N,
|
|
1450
|
+
style: F,
|
|
1451
|
+
"data-key": String(n.key),
|
|
1452
|
+
"data-continues-before": n.isStart ? void 0 : "",
|
|
1453
|
+
"data-continues-after": n.isEnd ? void 0 : "",
|
|
1454
|
+
onPointerDown: ee,
|
|
1455
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
1456
|
+
className: D(d.className, Z.root__event, {
|
|
1457
|
+
[Z.root__event_span]: P,
|
|
1458
|
+
[Z.root__event_continuesBefore]: !n.isStart,
|
|
1459
|
+
[Z.root__event_continuesAfter]: !n.isEnd,
|
|
1460
|
+
[Z.root__event_isDragging]: y,
|
|
1461
|
+
[Z.root__event_isResizeSource]: s
|
|
1462
|
+
}),
|
|
1463
|
+
children: [
|
|
1464
|
+
l,
|
|
1465
|
+
a && n.isStart && /* @__PURE__ */ W("div", {
|
|
1466
|
+
...j,
|
|
1467
|
+
"data-edge": "start",
|
|
1468
|
+
className: D(Z.root__resize, Z.root__resizeStart)
|
|
1469
|
+
}),
|
|
1470
|
+
a && n.isEnd && /* @__PURE__ */ W("div", {
|
|
1471
|
+
...M,
|
|
1472
|
+
"data-edge": "end",
|
|
1473
|
+
className: D(Z.root__resize, Z.root__resizeEnd)
|
|
1474
|
+
})
|
|
1475
|
+
]
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
// src/components/month-view/MonthViewEventPreview.tsx
|
|
1479
|
+
function ln({ bar: e, children: t }) {
|
|
1480
|
+
return /* @__PURE__ */ W("div", {
|
|
1481
|
+
"aria-hidden": "true",
|
|
1482
|
+
"data-key": String(e.key),
|
|
1483
|
+
"data-continues-before": e.isStart ? void 0 : "",
|
|
1484
|
+
"data-continues-after": e.isEnd ? void 0 : "",
|
|
1485
|
+
className: D(Z.root__event, Z.root__event_isResizing, {
|
|
1486
|
+
[Z.root__event_span]: e.span > 1 || !e.isStart || !e.isEnd,
|
|
1487
|
+
[Z.root__event_continuesBefore]: !e.isStart,
|
|
1488
|
+
[Z.root__event_continuesAfter]: !e.isEnd
|
|
1489
|
+
}),
|
|
1490
|
+
style: Bt({
|
|
1491
|
+
"--ww-column": e.column + 1,
|
|
1492
|
+
"--ww-span": e.span,
|
|
1493
|
+
"--ww-row": e.lane + 2
|
|
1494
|
+
}),
|
|
1495
|
+
children: t
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
// src/components/month-view/MonthViewWeek.tsx
|
|
1499
|
+
function un(e) {
|
|
1500
|
+
let { days: t, firstDayIndex: n, layout: r, sourceBars: i, lanes: a, resizingKey: o, resize: s } = e, { viewValue: c, eventRenderer: l, view: u, disabled: d } = J(), { getMonthDay: f, isSameMonth: p, isToday: m, toMillis: h } = K(), g = Ge(), _ = o !== void 0, v = (e) => l.current?.(e.value, u, {
|
|
1501
|
+
isStart: e.isStart,
|
|
1502
|
+
isEnd: e.isEnd
|
|
1503
|
+
}), y = (e, n = !1) => /* @__PURE__ */ W(cn, {
|
|
1504
|
+
eventData: e,
|
|
1505
|
+
weekDays: t,
|
|
1506
|
+
resizable: !d,
|
|
1507
|
+
resize: s,
|
|
1508
|
+
isResizeSource: n,
|
|
1509
|
+
isAnyResizing: _,
|
|
1510
|
+
children: v(e)
|
|
1511
|
+
}, e.key);
|
|
1512
|
+
return /* @__PURE__ */ G("div", {
|
|
1513
|
+
className: Z.root__week,
|
|
1514
|
+
children: [
|
|
1515
|
+
t.map((e, t) => /* @__PURE__ */ W(Ut, {
|
|
1516
|
+
targetDate: e,
|
|
1517
|
+
"data-day-index": n + t,
|
|
1518
|
+
"data-is-outside": !p(e, c) || void 0,
|
|
1519
|
+
"data-is-today": m(e) ? !0 : void 0,
|
|
1520
|
+
style: Bt({ "--ww-column": t + 1 }),
|
|
1521
|
+
children: /* @__PURE__ */ W("span", {
|
|
1522
|
+
className: Z.root__dayNumber,
|
|
1523
|
+
children: f(e)
|
|
1524
|
+
})
|
|
1525
|
+
}, h(e))),
|
|
1526
|
+
[...r.bars.map((e) => e.key === o ? /* @__PURE__ */ W(ln, {
|
|
1527
|
+
bar: e,
|
|
1528
|
+
children: v(e)
|
|
1529
|
+
}, `preview-${e.key}`) : y(e)), ...i.map((e) => y(e, !0))],
|
|
1530
|
+
t.map((e, t) => r.hidden[t] > 0 && /* @__PURE__ */ W("span", {
|
|
1531
|
+
className: Z.root__more,
|
|
1532
|
+
style: Bt({
|
|
1533
|
+
"--ww-column": t + 1,
|
|
1534
|
+
"--ww-row": a + 2
|
|
1535
|
+
}),
|
|
1536
|
+
children: g.more(r.hidden[t])
|
|
1537
|
+
}, `more-${h(e)}`))
|
|
1538
|
+
]
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
// src/components/month-view/useMonthLanes.ts
|
|
1542
|
+
function dn(e, t) {
|
|
1543
|
+
let [n, r] = d(t), i = () => {
|
|
1544
|
+
let n = e.current?.firstElementChild;
|
|
1545
|
+
n?.clientHeight && r(R(n.clientHeight, t));
|
|
1546
|
+
}, a = qe(i);
|
|
1547
|
+
return Ke(() => {
|
|
1548
|
+
i();
|
|
1549
|
+
let t = e.current?.firstElementChild;
|
|
1550
|
+
return t && a?.observe(t), () => {
|
|
1551
|
+
t && a?.unobserve(t);
|
|
1552
|
+
};
|
|
1553
|
+
}, [a, t]), n;
|
|
1554
|
+
}
|
|
1555
|
+
// src/components/month-view/useMonthResize.ts
|
|
1556
|
+
function fn(e) {
|
|
1557
|
+
let { days: t, viewportRef: n, dateUtils: r, eventMap: i, disabled: a, getIsDayDisabled: o, onEventChange: s } = e, [l, u, d] = ft(null), { addGlobalListener: f, removeAllGlobalListeners: p } = it(), m = q((e = !0) => {
|
|
1558
|
+
let t = d.current;
|
|
1559
|
+
t && (p(), u(null), e && t.result && s(t.key, t.result.date, t.result.info));
|
|
1560
|
+
}), h = q((e) => {
|
|
1561
|
+
e.key === "Escape" && m(!1);
|
|
1562
|
+
}), g = q((e, t) => {
|
|
1563
|
+
a || d.current || (u({
|
|
1564
|
+
key: e,
|
|
1565
|
+
edge: t,
|
|
1566
|
+
result: null
|
|
1567
|
+
}), f(document, "keydown", h, !0));
|
|
1568
|
+
}), _ = q((e, a) => {
|
|
1569
|
+
let s = d.current, c = s && i.get(s.key), l = t[Ht(n.current, e, a)];
|
|
1570
|
+
s && c && l && !o?.(l) && u({
|
|
1571
|
+
...s,
|
|
1572
|
+
result: xe(r, c, s.edge, l)
|
|
1573
|
+
});
|
|
1574
|
+
}), v = c(() => ({
|
|
1575
|
+
start: g,
|
|
1576
|
+
move: _,
|
|
1577
|
+
end: m
|
|
1578
|
+
}), [
|
|
1579
|
+
m,
|
|
1580
|
+
_,
|
|
1581
|
+
g
|
|
1582
|
+
]), y = c(() => {
|
|
1583
|
+
let e = l?.result && i.get(l.key);
|
|
1584
|
+
if (!l?.result || !e) return i;
|
|
1585
|
+
let [t] = F(r, l.result.date, l.result.info);
|
|
1586
|
+
return new Map(i).set(l.key, {
|
|
1587
|
+
...e,
|
|
1588
|
+
date: t,
|
|
1589
|
+
duration: l.result.info.duration
|
|
1590
|
+
});
|
|
1591
|
+
}, [
|
|
1592
|
+
r,
|
|
1593
|
+
i,
|
|
1594
|
+
l
|
|
1595
|
+
]);
|
|
1596
|
+
return {
|
|
1597
|
+
resizingKey: l?.key,
|
|
1598
|
+
actions: v,
|
|
1599
|
+
eventMap: y
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
// src/components/month-view/MonthView.tsx
|
|
1603
|
+
var pn = [];
|
|
1604
|
+
function mn(e) {
|
|
1605
|
+
let { className: t, style: n, ...r } = e, { viewValue: i, eventMap: a, startWeek: o, disabled: s, getIsDayDisabled: l, onEventChange: d } = J(), f = K();
|
|
1606
|
+
mt();
|
|
1607
|
+
let p = u(null), m = c(() => L(f, i, o), [
|
|
1608
|
+
f,
|
|
1609
|
+
o,
|
|
1610
|
+
i
|
|
1611
|
+
]), h = c(() => Vt(m), [m]), g = c(() => de(f, o), [f, o]), _ = fn({
|
|
1612
|
+
days: m,
|
|
1613
|
+
viewportRef: p,
|
|
1614
|
+
dateUtils: f,
|
|
1615
|
+
eventMap: a,
|
|
1616
|
+
disabled: s,
|
|
1617
|
+
getIsDayDisabled: l,
|
|
1618
|
+
onEventChange: d
|
|
1619
|
+
}), v = dn(p, 3), y = c(() => h.map((e) => x(a, f, e, v)), [
|
|
1620
|
+
f,
|
|
1621
|
+
a,
|
|
1622
|
+
v,
|
|
1623
|
+
h
|
|
1624
|
+
]), b = c(() => _.eventMap === a ? y : h.map((e) => x(_.eventMap, f, e, v)), [
|
|
1625
|
+
f,
|
|
1626
|
+
a,
|
|
1627
|
+
v,
|
|
1628
|
+
y,
|
|
1629
|
+
_.eventMap,
|
|
1630
|
+
h
|
|
1631
|
+
]), S = c(() => ({ viewportRef: p }), []);
|
|
1632
|
+
return /* @__PURE__ */ G(Nt.Provider, {
|
|
1633
|
+
value: S,
|
|
1634
|
+
children: [/* @__PURE__ */ G("div", {
|
|
1635
|
+
...r,
|
|
1636
|
+
className: D(t, Z.root, { [Z.root_isResizing]: _.resizingKey !== void 0 }),
|
|
1637
|
+
style: Bt({ "--ww-month-lanes": v }, n),
|
|
1638
|
+
children: [/* @__PURE__ */ W("div", {
|
|
1639
|
+
className: Z.root__head,
|
|
1640
|
+
children: g.map((e) => /* @__PURE__ */ W("div", {
|
|
1641
|
+
className: Z.root__weekday,
|
|
1642
|
+
children: e
|
|
1643
|
+
}, e))
|
|
1644
|
+
}), /* @__PURE__ */ W("div", {
|
|
1645
|
+
className: Z.root__body,
|
|
1646
|
+
children: /* @__PURE__ */ W("div", {
|
|
1647
|
+
ref: p,
|
|
1648
|
+
className: Z.root__viewport,
|
|
1649
|
+
children: h.map((e, t) => /* @__PURE__ */ W(un, {
|
|
1650
|
+
days: e,
|
|
1651
|
+
firstDayIndex: t * 7,
|
|
1652
|
+
layout: b[t],
|
|
1653
|
+
sourceBars: _.resizingKey === void 0 ? pn : y[t].bars.filter((e) => e.key === _.resizingKey),
|
|
1654
|
+
lanes: v,
|
|
1655
|
+
resizingKey: _.resizingKey,
|
|
1656
|
+
resize: _.actions
|
|
1657
|
+
}, f.toMillis(e[0])))
|
|
1658
|
+
})
|
|
1659
|
+
})]
|
|
1660
|
+
}), /* @__PURE__ */ W(zt, {
|
|
1661
|
+
className: Z.root__dragOverlay,
|
|
1662
|
+
showPreview: !1
|
|
1663
|
+
})]
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
// src/hooks/useEventResize.ts
|
|
1667
|
+
var hn = 1440;
|
|
1668
|
+
function gn(e) {
|
|
1669
|
+
let { days: t, viewportRef: r, dateUtils: a, bounds: o, timeStep: s, preventOutBoundsChanges: l } = e, [f, p] = d(null), m = u(null), h = u(e);
|
|
1670
|
+
h.current = e;
|
|
1671
|
+
let g = o.hideMinMaxTime ? o.hourMin * 60 : 0, _ = o.hideMinMaxTime ? (o.hourMax - o.hourMin) * 60 : hn, v = n((e, n) => {
|
|
1672
|
+
let i = m.current, c = r.current;
|
|
1673
|
+
if (!i || !c) return;
|
|
1674
|
+
i.x = e, i.y = n;
|
|
1675
|
+
let { disabled: u, getIsDayDisabled: d } = h.current, f = [...c.querySelectorAll("[data-day-index]")], g = c.getBoundingClientRect(), v = ((e) => Math.round(e / s) * s)(Math.min(Math.max((n - g.top) / g.height * _, 0), _)), y = 0, b = 1e400;
|
|
1676
|
+
f.forEach((t) => {
|
|
1677
|
+
let n = t.getBoundingClientRect(), r = e < n.left ? n.left - e : e > n.right ? e - n.right : 0;
|
|
1678
|
+
r < b && (b = r, y = Number(t.dataset.dayIndex));
|
|
1679
|
+
});
|
|
1680
|
+
let x = Se({
|
|
1681
|
+
start: i.original[0],
|
|
1682
|
+
end: i.original[1]
|
|
1683
|
+
}, i.edge, y, v, {
|
|
1684
|
+
dayCount: t.length,
|
|
1685
|
+
bounds: o,
|
|
1686
|
+
timeStep: s,
|
|
1687
|
+
crossDays: !l || o.hourMin <= 0 && o.hourMax >= 24,
|
|
1688
|
+
getFrame: (e) => {
|
|
1689
|
+
if (!l) return [0, _];
|
|
1690
|
+
let [n, r] = ae(a, t[e], o);
|
|
1691
|
+
return [Math.ceil(n / s) * s, Math.min(Math.ceil(r / s) * s, _)];
|
|
1692
|
+
},
|
|
1693
|
+
canEditDay: (e) => !u && !d?.(t[e]) && !(l && ge(a, t[e]))
|
|
1694
|
+
});
|
|
1695
|
+
x && (i.range = x), p({
|
|
1696
|
+
key: i.key,
|
|
1697
|
+
range: i.range,
|
|
1698
|
+
x: e,
|
|
1699
|
+
y: n,
|
|
1700
|
+
blocked: !x
|
|
1701
|
+
});
|
|
1702
|
+
}, [
|
|
1703
|
+
o,
|
|
1704
|
+
a,
|
|
1705
|
+
t,
|
|
1706
|
+
l,
|
|
1707
|
+
s,
|
|
1708
|
+
_,
|
|
1709
|
+
r
|
|
1710
|
+
]), y = c(() => ({
|
|
1711
|
+
start(e, n, r, i) {
|
|
1712
|
+
let o = h.current.eventMap.get(e);
|
|
1713
|
+
if (!o || !t[0]) return;
|
|
1714
|
+
let s = ke(a, t[0], o.date), c = [s, s + o.duration];
|
|
1715
|
+
m.current = {
|
|
1716
|
+
key: e,
|
|
1717
|
+
edge: n,
|
|
1718
|
+
original: c,
|
|
1719
|
+
range: c,
|
|
1720
|
+
x: r,
|
|
1721
|
+
y: i
|
|
1722
|
+
}, p({
|
|
1723
|
+
key: e,
|
|
1724
|
+
range: c,
|
|
1725
|
+
x: r,
|
|
1726
|
+
y: i,
|
|
1727
|
+
blocked: !1
|
|
1728
|
+
});
|
|
1729
|
+
},
|
|
1730
|
+
move: v,
|
|
1731
|
+
end() {
|
|
1732
|
+
let e = m.current;
|
|
1733
|
+
if (m.current = null, p(null), !e) return;
|
|
1734
|
+
let [n, r] = e.range;
|
|
1735
|
+
if (n === e.original[0] && r === e.original[1]) return;
|
|
1736
|
+
let i = Math.floor(n / hn);
|
|
1737
|
+
h.current.onEventChange(e.key, M(a, t[0], i * hn), {
|
|
1738
|
+
from: n - i * hn,
|
|
1739
|
+
duration: r - n
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
}), [
|
|
1743
|
+
a,
|
|
1744
|
+
t,
|
|
1745
|
+
v
|
|
1746
|
+
]), b = f !== null;
|
|
1747
|
+
i(() => {
|
|
1748
|
+
if (!b) return;
|
|
1749
|
+
let e = () => m.current && v(m.current.x, m.current.y);
|
|
1750
|
+
return document.addEventListener("scroll", e, !0), () => document.removeEventListener("scroll", e, !0);
|
|
1751
|
+
}, [b, v]);
|
|
1752
|
+
let x = f?.blocked ?? !1;
|
|
1753
|
+
return i(() => {
|
|
1754
|
+
if (x) return document.documentElement.classList.add("ww-cursor-not-allowed"), () => document.documentElement.classList.remove("ww-cursor-not-allowed");
|
|
1755
|
+
}, [x]), {
|
|
1756
|
+
state: f,
|
|
1757
|
+
actions: y,
|
|
1758
|
+
previewOf: (e) => {
|
|
1759
|
+
let n = Math.floor(e[0] / hn);
|
|
1760
|
+
return {
|
|
1761
|
+
date: M(a, t[0], n * hn),
|
|
1762
|
+
top: e[0] - n * hn - g,
|
|
1763
|
+
duration: e[1] - e[0]
|
|
1764
|
+
};
|
|
1765
|
+
}
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
// src/contexts/DayWeekViewContext.ts
|
|
1769
|
+
var _n = e(void 0);
|
|
1770
|
+
U && (_n.displayName = "DayWeekViewContext");
|
|
1771
|
+
function vn() {
|
|
1772
|
+
let e = r(_n);
|
|
1773
|
+
if (!e) throw Error("DayWeekViewContext is required");
|
|
1774
|
+
return e;
|
|
1775
|
+
}
|
|
1776
|
+
// src/hooks/useTimeOffset.ts
|
|
1777
|
+
function yn(e = !0, t = 6e4) {
|
|
1778
|
+
let { hideMinMaxTime: n, hourMin: r, hourMax: i } = J(), a = K(), o = () => B(a, {
|
|
1779
|
+
hourMin: r,
|
|
1780
|
+
hourMax: i,
|
|
1781
|
+
hideMinMaxTime: n
|
|
1782
|
+
}), [s, c] = d([0, !0]);
|
|
1783
|
+
return pt(() => c(o()), t, e), s;
|
|
1784
|
+
}
|
|
1785
|
+
var bn = {
|
|
1786
|
+
root: "_root_6z2c5_1",
|
|
1787
|
+
root_timeLimit: "_root_timeLimit_6z2c5_8",
|
|
1788
|
+
root_isToday: "_root_isToday_6z2c5_8",
|
|
1789
|
+
root_isPast: "_root_isPast_6z2c5_18",
|
|
1790
|
+
root__container: "_root__container_6z2c5_36",
|
|
1791
|
+
root__spotlight: "_root__spotlight_6z2c5_57",
|
|
1792
|
+
root__timeLine: "_root__timeLine_6z2c5_67",
|
|
1793
|
+
root_offLimits: "_root_offLimits_6z2c5_119"
|
|
1794
|
+
};
|
|
1795
|
+
// src/components/day-week-drawer/DayWeekDrawer.tsx
|
|
1796
|
+
function xn(e) {
|
|
1797
|
+
let { ref: t, targetDate: n, children: r, ...a } = e, { onEventChange: o, onEventCreate: s, getIsDayDisabled: l, pointerPreviewRenderer: d, eventMap: f, ...p } = J(), { viewportRef: m, getTimeFrame: h, pxPerMinute: g } = vn(), { hideMinMaxTime: _, preventOutBoundsChanges: v, timeStep: y, hourMin: b, hourMax: x, disabled: S } = p, w = K(), { isBefore: T, isToday: E } = w, O = y * g, k = (e) => Sn(e, g, y), ee = (e) => h(e).map((e) => e * g), j = u(null), M = u(null), { register: N, getTransform: P } = Ne(({ registerDropTarget: e, getTransform: t }) => ({
|
|
1798
|
+
register: e,
|
|
1799
|
+
getTransform: t
|
|
1800
|
+
})), F = mt(), I = c(() => {
|
|
1801
|
+
let e = E(n);
|
|
1802
|
+
return {
|
|
1803
|
+
isToday: e,
|
|
1804
|
+
isPast: T(n) && !e
|
|
1805
|
+
};
|
|
1806
|
+
}, [
|
|
1807
|
+
T,
|
|
1808
|
+
E,
|
|
1809
|
+
n,
|
|
1810
|
+
F
|
|
1811
|
+
]), [{ isActive: L, transform: R }, z, { scrollAdjustmentActiveNodeRect: B }] = an({
|
|
1812
|
+
activeNode: j.current,
|
|
1813
|
+
containerNode: j.current?.parentElement,
|
|
1814
|
+
modifiers: [
|
|
1815
|
+
function({ activeNodeRect: e, initialTranslate: t, translate: n, transform: r }) {
|
|
1816
|
+
if (!e) return r;
|
|
1817
|
+
let i = t.y - e.top;
|
|
1818
|
+
r.x = r.left + t.x, r.y = r.top + t.y, r.top = Math.floor(i / O) * O, r.height = O, r.left = 0, r.width = e.width;
|
|
1819
|
+
let a;
|
|
1820
|
+
return n.y > 0 ? (a = O - i % O, r.height = Math.ceil((r.height + n.y - a) / O) * O) : (a = i % O, r.height = Math.ceil((r.height - n.y - a) / O) * O, r.top -= r.height - O), r.height = Math.max(r.height, O), r;
|
|
1821
|
+
},
|
|
1822
|
+
function({ transform: e }) {
|
|
1823
|
+
if (!v) return e;
|
|
1824
|
+
let [t, r] = h(n).map((e) => Math.ceil(e / y) * O);
|
|
1825
|
+
return e.top < t && (e.height = Math.max(e.height - (t - e.top), O), e.top = t), e.height + e.top >= r && (e.height = Math.max(r - e.top, O)), e;
|
|
1826
|
+
},
|
|
1827
|
+
C,
|
|
1828
|
+
oe(O)
|
|
1829
|
+
]
|
|
1830
|
+
}), [te, V] = yn(I.isToday);
|
|
1831
|
+
i(() => {
|
|
1832
|
+
let e = j.current;
|
|
1833
|
+
if (e) return N(e, {
|
|
1834
|
+
data: { date: n },
|
|
1835
|
+
onDrop: async (e) => {
|
|
1836
|
+
let [t] = await Promise.all(e.items.filter((e) => e.kind === "text" && e.types.has("event") && "getText" in e).map(async (e) => {
|
|
1837
|
+
let t = await e.getText("event");
|
|
1838
|
+
return JSON.parse(t);
|
|
1839
|
+
})), r = P(), i = Sn(r.top, g, y), a = Sn(r.height, g, y), s = _ ? b * 60 : 0, c = f.get(t.key), l = c ? ke(w, c.date, c.date) : 0;
|
|
1840
|
+
if (c && l + c.duration > 1440) {
|
|
1841
|
+
if (v && (b > 0 || x < 24)) {
|
|
1842
|
+
z.stop({
|
|
1843
|
+
x: e.x,
|
|
1844
|
+
y: e.y
|
|
1845
|
+
});
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
let r = w.getStartOfDay(w.fromMillis(t.date)), a = ke(w, c.date, r) + s + t.start - l, u = s + i - a, d = Math.floor(u / 1440);
|
|
1849
|
+
o(t.key, w.addDays(n, d), {
|
|
1850
|
+
from: u - d * 24 * 60,
|
|
1851
|
+
duration: c.duration
|
|
1852
|
+
});
|
|
1853
|
+
} else _ ? o(t.key, n, {
|
|
1854
|
+
from: i + b * 60,
|
|
1855
|
+
duration: a
|
|
1856
|
+
}) : o(t.key, n, {
|
|
1857
|
+
from: i,
|
|
1858
|
+
duration: a
|
|
1859
|
+
});
|
|
1860
|
+
z.stop({
|
|
1861
|
+
x: e.x,
|
|
1862
|
+
y: e.y
|
|
1863
|
+
});
|
|
1864
|
+
},
|
|
1865
|
+
getDropOperationForPoint: (e, t) => {
|
|
1866
|
+
if (S || !e.has("event") || l && l(n)) return "cancel";
|
|
1867
|
+
let { isPast: r, isToday: i } = I;
|
|
1868
|
+
if (v) {
|
|
1869
|
+
if (!i && r) return "cancel";
|
|
1870
|
+
let [e, t] = h(n).map((e) => e * g), a = P();
|
|
1871
|
+
if (a.y < e || a.y > t || i && a.height > t - e) return "cancel";
|
|
1872
|
+
}
|
|
1873
|
+
return t[0];
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
}, [
|
|
1877
|
+
z,
|
|
1878
|
+
w,
|
|
1879
|
+
S,
|
|
1880
|
+
f,
|
|
1881
|
+
l,
|
|
1882
|
+
h,
|
|
1883
|
+
P,
|
|
1884
|
+
_,
|
|
1885
|
+
x,
|
|
1886
|
+
b,
|
|
1887
|
+
o,
|
|
1888
|
+
v,
|
|
1889
|
+
g,
|
|
1890
|
+
N,
|
|
1891
|
+
n,
|
|
1892
|
+
y,
|
|
1893
|
+
I
|
|
1894
|
+
]);
|
|
1895
|
+
let { listeners: ne } = ct({
|
|
1896
|
+
distance: Math.max(Math.min(5, y), 1),
|
|
1897
|
+
onMoveStart: (e) => {
|
|
1898
|
+
if (!S) {
|
|
1899
|
+
if (v) {
|
|
1900
|
+
let { isToday: e, isPast: t } = I;
|
|
1901
|
+
if (t && !e) return !1;
|
|
1902
|
+
}
|
|
1903
|
+
z.start({
|
|
1904
|
+
x: e.clientX,
|
|
1905
|
+
y: e.clientY
|
|
1906
|
+
});
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
onMove: (e) => {
|
|
1910
|
+
if (L) z.move({
|
|
1911
|
+
x: e.clientX,
|
|
1912
|
+
y: e.clientY
|
|
1913
|
+
});
|
|
1914
|
+
else if (B) {
|
|
1915
|
+
if (v) {
|
|
1916
|
+
let [t, r] = ee(n), i = e.clientY - B.top;
|
|
1917
|
+
if (i < t || i > r) {
|
|
1918
|
+
z.stop({
|
|
1919
|
+
x: e.clientX,
|
|
1920
|
+
y: e.clientY
|
|
1921
|
+
});
|
|
1922
|
+
return;
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
L || z.move({
|
|
1926
|
+
x: e.clientX,
|
|
1927
|
+
y: e.clientY
|
|
1928
|
+
});
|
|
1929
|
+
}
|
|
1930
|
+
},
|
|
1931
|
+
onMoveEnd: (e) => {
|
|
1932
|
+
z.stop({
|
|
1933
|
+
x: e.clientX,
|
|
1934
|
+
y: e.clientY
|
|
1935
|
+
}), L && (_ ? s(n, {
|
|
1936
|
+
from: k(R.top) + b * 60,
|
|
1937
|
+
duration: k(R.height)
|
|
1938
|
+
}) : s(n, {
|
|
1939
|
+
from: k(R.top),
|
|
1940
|
+
duration: k(R.height)
|
|
1941
|
+
}));
|
|
1942
|
+
}
|
|
1943
|
+
}), H = st(j, t), re = A(w, te, {
|
|
1944
|
+
hourMin: b,
|
|
1945
|
+
hideMinMaxTime: _
|
|
1946
|
+
}), ie = () => d.current?.(n, k(R.top), k(R.height));
|
|
1947
|
+
return /* @__PURE__ */ G("div", {
|
|
1948
|
+
...a,
|
|
1949
|
+
...ne,
|
|
1950
|
+
ref: H,
|
|
1951
|
+
className: D(a.className, bn.root, {
|
|
1952
|
+
[bn.root_timeLimit]: v,
|
|
1953
|
+
[bn.root_isToday]: I.isToday,
|
|
1954
|
+
[bn.root_isPast]: I.isPast,
|
|
1955
|
+
[bn.root_offLimits]: V
|
|
1956
|
+
}),
|
|
1957
|
+
style: {
|
|
1958
|
+
...a.style,
|
|
1959
|
+
"--offset": te
|
|
1960
|
+
},
|
|
1961
|
+
children: [
|
|
1962
|
+
I.isToday && !V && /* @__PURE__ */ W(Tt, {
|
|
1963
|
+
container: m.current,
|
|
1964
|
+
children: /* @__PURE__ */ W("span", {
|
|
1965
|
+
tabIndex: -1,
|
|
1966
|
+
className: bn.root__timeLine,
|
|
1967
|
+
"data-now": re,
|
|
1968
|
+
style: { "--offset": te }
|
|
1969
|
+
})
|
|
1970
|
+
}),
|
|
1971
|
+
/* @__PURE__ */ W("div", {
|
|
1972
|
+
ref: M,
|
|
1973
|
+
className: bn.root__container,
|
|
1974
|
+
children: r
|
|
1975
|
+
}),
|
|
1976
|
+
L && /* @__PURE__ */ G(ze, { children: [/* @__PURE__ */ W("div", {
|
|
1977
|
+
className: bn.root__spotlight,
|
|
1978
|
+
style: R ? { ...R } : void 0
|
|
1979
|
+
}), /* @__PURE__ */ W(It, {
|
|
1980
|
+
coordinates: {
|
|
1981
|
+
x: R.x,
|
|
1982
|
+
y: R.y
|
|
1983
|
+
},
|
|
1984
|
+
children: ie()
|
|
1985
|
+
})] })
|
|
1986
|
+
]
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
function Sn(e, t, n) {
|
|
1990
|
+
return Math.round(e / t / n) * n;
|
|
1991
|
+
}
|
|
1992
|
+
// src/hooks/useAbsEventRect.ts
|
|
1993
|
+
function Cn(e, t) {
|
|
1994
|
+
let [n, r] = d(null);
|
|
1995
|
+
return Ke(() => {
|
|
1996
|
+
let n = e.current, i = e.current?.parentElement;
|
|
1997
|
+
if (n && i) {
|
|
1998
|
+
let { height: e, width: a, ...o } = P(n), { left: s, top: c } = Oe(o, P(i));
|
|
1999
|
+
r(Te(t, {
|
|
2000
|
+
height: e,
|
|
2001
|
+
width: a,
|
|
2002
|
+
x: s,
|
|
2003
|
+
y: c
|
|
2004
|
+
}));
|
|
2005
|
+
}
|
|
2006
|
+
}, [e, ...Object.values(t)]), n;
|
|
2007
|
+
}
|
|
2008
|
+
// src/hooks/useCanResizeEvent.ts
|
|
2009
|
+
function wn(e, t) {
|
|
2010
|
+
let [n, r] = d(!0), { preventOutBoundsChanges: i } = J(), { isBefore: a, isToday: o } = K(), { getTimeFrame: s } = vn();
|
|
2011
|
+
return Ke(() => {
|
|
2012
|
+
if (t && i) {
|
|
2013
|
+
if (a(e) && !o(e)) r(!1);
|
|
2014
|
+
else if (o(e)) {
|
|
2015
|
+
let { height: n, y: i } = t, a = n + i, [o, c] = s(e);
|
|
2016
|
+
r(a > o && i < c);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}, [
|
|
2020
|
+
e,
|
|
2021
|
+
t,
|
|
2022
|
+
s,
|
|
2023
|
+
i,
|
|
2024
|
+
a,
|
|
2025
|
+
o
|
|
2026
|
+
]), n;
|
|
2027
|
+
}
|
|
2028
|
+
var Q = {
|
|
2029
|
+
root: "_root_1qnpq_1",
|
|
2030
|
+
root_isDragging: "_root_isDragging_1qnpq_7",
|
|
2031
|
+
root__resizeTop: "_root__resizeTop_1qnpq_7",
|
|
2032
|
+
root__resizeBottom: "_root__resizeBottom_1qnpq_9",
|
|
2033
|
+
root_isResizing: "_root_isResizing_1qnpq_11",
|
|
2034
|
+
root_isDisabled: "_root_isDisabled_1qnpq_38",
|
|
2035
|
+
root__container: "_root__container_1qnpq_54",
|
|
2036
|
+
root__dragPreview: "_root__dragPreview_1qnpq_97",
|
|
2037
|
+
root_isPreview: "_root_isPreview_1qnpq_103",
|
|
2038
|
+
root_isResizeSource: "_root_isResizeSource_1qnpq_108"
|
|
2039
|
+
};
|
|
2040
|
+
// src/components/day-week-event/DayWeekEvent.tsx
|
|
2041
|
+
function Tn(e) {
|
|
2042
|
+
let { ref: t, eventData: n, children: r, ...a } = e, { eventMap: o, ...s } = J(), c = K(), { timeStep: l, preventOutBoundsChanges: d, disabled: f } = s, p = u(null), m = u(null), h = u(null), { viewportRef: g, getTimeFrame: _, pxPerMinute: v, resize: y, resizing: b } = vn(), x = l * v, S = Cn(p, n.rect), C = wn(o.get(n.key)?.date ?? n.date, S), { attributes: w, isDragging: T, overElement: E, overData: O, register: k, setOverlayTransform: ee } = Ne(({ registerDragSource: e, draggable: t, droppable: n, setTransform: r, isActive: i }) => {
|
|
2043
|
+
let a = i(p.current), [o, s] = a ? [...n.dropTargets].pop() ?? [null, null] : [null, null];
|
|
2044
|
+
return {
|
|
2045
|
+
attributes: t.attributes,
|
|
2046
|
+
overElement: o,
|
|
2047
|
+
overData: s,
|
|
2048
|
+
isDragging: a,
|
|
2049
|
+
register: e,
|
|
2050
|
+
setOverlayTransform: r
|
|
2051
|
+
};
|
|
2052
|
+
}), A = Yt(T ? E : null), [{ isActive: j, transform: M, context: N }, P] = an({
|
|
2053
|
+
autoScrollEnabled: !T,
|
|
2054
|
+
activeNode: (e) => e === "overlay" ? p.current : e === "top" ? m.current : h.current,
|
|
2055
|
+
containerNode: (e) => e === "overlay" ? g.current : p.current?.parentElement?.parentElement ?? null,
|
|
2056
|
+
modifiers: [
|
|
2057
|
+
function({ activeNodeRect: e, containerNodeRect: t, context: n, transform: r, translate: i, initialTranslate: a }) {
|
|
2058
|
+
if (n !== "overlay" || !t || !e || !A) return r;
|
|
2059
|
+
r.x = i.x + a.x - t.left, r.y = i.y + a.y - t.top, r.left = A.left - t.left, r.width = A.width, r.top = e.top - t.top, r.height = e.height;
|
|
2060
|
+
let o;
|
|
2061
|
+
return i.y > 0 ? (o = x - (a.y - e.top) % x, r.top += Math.ceil((i.y - o) / x) * x) : (o = (a.y - e.top) % x, r.top += Math.floor((i.y + o) / x) * x), r;
|
|
2062
|
+
},
|
|
2063
|
+
function({ transform: e, context: t }) {
|
|
2064
|
+
if (!d || t !== "overlay" || !O) return e;
|
|
2065
|
+
let [n, r] = _(O.date).map((e) => Math.ceil(e / l) * x);
|
|
2066
|
+
return e.top < n && (e.top = n), e.top + e.height > r && (e.top = r - e.height), e;
|
|
2067
|
+
},
|
|
2068
|
+
En(x)
|
|
2069
|
+
]
|
|
2070
|
+
}), F = ve(() => y.end(), (e) => {
|
|
2071
|
+
P.stop({
|
|
2072
|
+
x: e.clientX,
|
|
2073
|
+
y: e.clientY
|
|
2074
|
+
});
|
|
2075
|
+
}), I = (e) => ({
|
|
2076
|
+
onMoveStart: (t) => (P.start({
|
|
2077
|
+
x: t.clientX,
|
|
2078
|
+
y: t.clientY
|
|
2079
|
+
}, e), y.start(n.key, e, t.clientX, t.clientY), !0),
|
|
2080
|
+
onMove: (e) => {
|
|
2081
|
+
P.move({
|
|
2082
|
+
x: e.clientX,
|
|
2083
|
+
y: e.clientY
|
|
2084
|
+
}), y.move(e.clientX, e.clientY);
|
|
2085
|
+
},
|
|
2086
|
+
onMoveEnd: F
|
|
2087
|
+
}), { listeners: L } = ct(I("bottom")), { listeners: R } = ct(I("top")), z = st(p, t), B = j && T && N === "overlay", te = b?.key === n.key, V = q((e) => {
|
|
2088
|
+
N === "overlay" && ee(e);
|
|
2089
|
+
});
|
|
2090
|
+
i(() => {
|
|
2091
|
+
V(M);
|
|
2092
|
+
}, [V, ...Object.values(M)]), i(() => {
|
|
2093
|
+
if (!p.current) return;
|
|
2094
|
+
let e = {
|
|
2095
|
+
...be(n, "rect"),
|
|
2096
|
+
date: c.toMillis(n.date)
|
|
2097
|
+
}, t = [{ event: JSON.stringify(e) }];
|
|
2098
|
+
return k(p.current, {
|
|
2099
|
+
getItems() {
|
|
2100
|
+
return t;
|
|
2101
|
+
},
|
|
2102
|
+
onDragStart(e) {
|
|
2103
|
+
P.start({
|
|
2104
|
+
x: e.x,
|
|
2105
|
+
y: e.y
|
|
2106
|
+
}, "overlay");
|
|
2107
|
+
},
|
|
2108
|
+
onDragMove(e) {
|
|
2109
|
+
P.move({
|
|
2110
|
+
x: e.x,
|
|
2111
|
+
y: e.y
|
|
2112
|
+
});
|
|
2113
|
+
},
|
|
2114
|
+
onDragEnd(e) {
|
|
2115
|
+
P.stop({
|
|
2116
|
+
x: e.x,
|
|
2117
|
+
y: e.y
|
|
2118
|
+
});
|
|
2119
|
+
},
|
|
2120
|
+
getAllowedDropOperations() {
|
|
2121
|
+
return ["move"];
|
|
2122
|
+
}
|
|
2123
|
+
});
|
|
2124
|
+
}, [
|
|
2125
|
+
P,
|
|
2126
|
+
n,
|
|
2127
|
+
k
|
|
2128
|
+
]);
|
|
2129
|
+
let ne = D(a.className, Q.root, {
|
|
2130
|
+
[Q.root_isDragging]: B,
|
|
2131
|
+
[Q.root_isResizeSource]: te,
|
|
2132
|
+
[Q.root_isDisabled]: f
|
|
2133
|
+
}), H = {
|
|
2134
|
+
...a.style,
|
|
2135
|
+
top: `${n.rect.y}%`,
|
|
2136
|
+
left: `${n.rect.x}%`,
|
|
2137
|
+
width: `${n.rect.width}%`,
|
|
2138
|
+
height: `${n.rect.height}%`
|
|
2139
|
+
}, re = q(ve(a.onPointerDown, (e) => e.stopPropagation()));
|
|
2140
|
+
return /* @__PURE__ */ W(ze, { children: /* @__PURE__ */ G("div", {
|
|
2141
|
+
...a,
|
|
2142
|
+
...w,
|
|
2143
|
+
ref: z,
|
|
2144
|
+
className: ne,
|
|
2145
|
+
style: H,
|
|
2146
|
+
onPointerDown: re,
|
|
2147
|
+
"data-continues-before": n.isStart ? void 0 : "",
|
|
2148
|
+
"data-continues-after": n.isEnd ? void 0 : "",
|
|
2149
|
+
children: [
|
|
2150
|
+
C && n.isStart && /* @__PURE__ */ W("div", {
|
|
2151
|
+
...R,
|
|
2152
|
+
ref: m,
|
|
2153
|
+
className: Q.root__resizeTop
|
|
2154
|
+
}),
|
|
2155
|
+
/* @__PURE__ */ W("div", {
|
|
2156
|
+
role: "button",
|
|
2157
|
+
tabIndex: 0,
|
|
2158
|
+
className: Q.root__container,
|
|
2159
|
+
children: r
|
|
2160
|
+
}),
|
|
2161
|
+
C && n.isEnd && /* @__PURE__ */ W("div", {
|
|
2162
|
+
...L,
|
|
2163
|
+
ref: h,
|
|
2164
|
+
className: Q.root__resizeBottom
|
|
2165
|
+
})
|
|
2166
|
+
]
|
|
2167
|
+
}) });
|
|
2168
|
+
}
|
|
2169
|
+
function En(e) {
|
|
2170
|
+
return (t) => {
|
|
2171
|
+
let n = [oe(e)];
|
|
2172
|
+
return t.context === "overlay" && n.push(S), y(n, t);
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
2175
|
+
// src/components/day-week-event/DayWeekEventPreview.tsx
|
|
2176
|
+
function Dn({ part: e, timelineMinutes: t, children: n }) {
|
|
2177
|
+
let r = (e) => `${e / t * 100}%`;
|
|
2178
|
+
return /* @__PURE__ */ W("div", {
|
|
2179
|
+
"aria-hidden": "true",
|
|
2180
|
+
className: `${Q.root} ${Q.root_isResizing} ${Q.root_isPreview}`,
|
|
2181
|
+
"data-continues-before": e.isStart ? void 0 : "",
|
|
2182
|
+
"data-continues-after": e.isEnd ? void 0 : "",
|
|
2183
|
+
style: {
|
|
2184
|
+
top: r(e.start),
|
|
2185
|
+
height: r(e.duration),
|
|
2186
|
+
left: 0,
|
|
2187
|
+
width: "100%"
|
|
2188
|
+
},
|
|
2189
|
+
children: /* @__PURE__ */ W("div", {
|
|
2190
|
+
className: Q.root__container,
|
|
2191
|
+
children: n
|
|
2192
|
+
})
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
var $ = {
|
|
2196
|
+
root: "_root_1140w_1",
|
|
2197
|
+
root_scrollable: "_root_scrollable_1140w_10",
|
|
2198
|
+
root__body: "_root__body_1140w_10",
|
|
2199
|
+
root__head: "_root__head_1140w_14",
|
|
2200
|
+
root__main: "_root__main_1140w_29",
|
|
2201
|
+
root__viewport: "_root__viewport_1140w_43",
|
|
2202
|
+
root__column: "_root__column_1140w_51",
|
|
2203
|
+
root__headerCell: "_root__headerCell_1140w_76",
|
|
2204
|
+
root__headerCellDay: "_root__headerCellDay_1140w_103",
|
|
2205
|
+
root__headerCellLabel: "_root__headerCellLabel_1140w_110",
|
|
2206
|
+
root__headerCellName: "_root__headerCellName_1140w_117",
|
|
2207
|
+
root__headerCellToday: "_root__headerCellToday_1140w_124",
|
|
2208
|
+
root__row: "_root__row_1140w_139",
|
|
2209
|
+
root__timeStep: "_root__timeStep_1140w_161",
|
|
2210
|
+
root__timeStep_overTime: "_root__timeStep_overTime_1140w_173",
|
|
2211
|
+
root__rowHeadTime: "_root__rowHeadTime_1140w_177",
|
|
2212
|
+
root__hiddenEventsLayer: "_root__hiddenEventsLayer_1140w_191",
|
|
2213
|
+
root__hiddenEventsColumn: "_root__hiddenEventsColumn_1140w_204",
|
|
2214
|
+
root__hiddenEvents: "_root__hiddenEvents_1140w_191",
|
|
2215
|
+
root__hiddenEventsIcon: "_root__hiddenEventsIcon_1140w_251"
|
|
2216
|
+
};
|
|
2217
|
+
// src/components/day-week-view/HiddenEvents.tsx
|
|
2218
|
+
function On({ scrollerRef: e, columns: t, rowHeight: n }) {
|
|
2219
|
+
let { hourMin: r, hideMinMaxTime: a, size: o } = J(), s = K(), l = Ge(), { addGlobalListener: u, removeGlobalListener: f } = it(), [p, m] = d(null), h = n / 60, g = q(() => {
|
|
2220
|
+
let t = e.current;
|
|
2221
|
+
if (!t) return;
|
|
2222
|
+
let n = {
|
|
2223
|
+
top: t.scrollTop,
|
|
2224
|
+
height: t.clientHeight
|
|
2225
|
+
};
|
|
2226
|
+
m((e) => e?.top === n.top && e.height === n.height ? e : n);
|
|
2227
|
+
}), _ = qe(g);
|
|
2228
|
+
i(() => {
|
|
2229
|
+
let t = e.current;
|
|
2230
|
+
if (t) return g(), u(t, "scroll", g, { passive: !0 }), _?.observe(t), () => {
|
|
2231
|
+
f(t, "scroll", g), _?.unobserve(t);
|
|
2232
|
+
};
|
|
2233
|
+
}, [
|
|
2234
|
+
u,
|
|
2235
|
+
g,
|
|
2236
|
+
f,
|
|
2237
|
+
_,
|
|
2238
|
+
e
|
|
2239
|
+
]), i(g, [
|
|
2240
|
+
g,
|
|
2241
|
+
n,
|
|
2242
|
+
t
|
|
2243
|
+
]);
|
|
2244
|
+
let v = c(() => p && p.height > 0 ? t.map((e) => I(e, h, p.top, p.height)) : null, [
|
|
2245
|
+
t,
|
|
2246
|
+
h,
|
|
2247
|
+
p
|
|
2248
|
+
]);
|
|
2249
|
+
if (!v || !p) return null;
|
|
2250
|
+
let y = (t) => e.current?.scrollTo({
|
|
2251
|
+
top: te(t, h, p.top, p.height),
|
|
2252
|
+
behavior: "smooth"
|
|
2253
|
+
}), b = (e, t) => {
|
|
2254
|
+
let [n] = e;
|
|
2255
|
+
if (!n) return null;
|
|
2256
|
+
let i = e.length === 1 && o !== "narrow" ? A(s, n.start, {
|
|
2257
|
+
hourMin: r,
|
|
2258
|
+
hideMinMaxTime: a
|
|
2259
|
+
}) : e.length;
|
|
2260
|
+
return /* @__PURE__ */ G("button", {
|
|
2261
|
+
type: "button",
|
|
2262
|
+
className: $.root__hiddenEvents,
|
|
2263
|
+
"data-direction": t,
|
|
2264
|
+
"aria-label": t === "above" ? l.earlier(e.length) : l.later(e.length),
|
|
2265
|
+
onClick: () => y(n),
|
|
2266
|
+
children: [/* @__PURE__ */ W(yt, {
|
|
2267
|
+
"aria-hidden": "true",
|
|
2268
|
+
className: $.root__hiddenEventsIcon
|
|
2269
|
+
}), i]
|
|
2270
|
+
});
|
|
2271
|
+
};
|
|
2272
|
+
return /* @__PURE__ */ G("div", {
|
|
2273
|
+
className: $.root__hiddenEventsLayer,
|
|
2274
|
+
children: [/* @__PURE__ */ W("div", {}), v.map(({ above: e, below: t }, n) => /* @__PURE__ */ G("div", {
|
|
2275
|
+
className: $.root__hiddenEventsColumn,
|
|
2276
|
+
children: [b(e, "above"), b(t, "below")]
|
|
2277
|
+
}, n))]
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
// src/components/day-week-view/useTimeColumnWidth.ts
|
|
2281
|
+
function kn(e, t, n) {
|
|
2282
|
+
let [r, i] = d();
|
|
2283
|
+
return Ke(() => {
|
|
2284
|
+
let t = !1, r = () => {
|
|
2285
|
+
let r = e.current;
|
|
2286
|
+
if (t || !r) return;
|
|
2287
|
+
let a = 0, o = document.createRange();
|
|
2288
|
+
if (typeof o.getBoundingClientRect != "function") return;
|
|
2289
|
+
for (let e of r.querySelectorAll("time")) {
|
|
2290
|
+
o.selectNodeContents(e);
|
|
2291
|
+
let t = getComputedStyle(e), n = o.getBoundingClientRect().width;
|
|
2292
|
+
a = Math.max(a, n + parseFloat(t.paddingLeft) + parseFloat(t.paddingRight));
|
|
2293
|
+
}
|
|
2294
|
+
let s = r.closest(`.${$.root}`)?.parentElement ?? document.body, c = parseFloat(getComputedStyle(s).getPropertyValue("--ww-time-column"));
|
|
2295
|
+
i(a > (Number.isNaN(c) ? n : c) ? Math.ceil(a) : void 0);
|
|
2296
|
+
};
|
|
2297
|
+
return r(), document.fonts?.ready.then(r), () => {
|
|
2298
|
+
t = !0;
|
|
2299
|
+
};
|
|
2300
|
+
}, [
|
|
2301
|
+
n,
|
|
2302
|
+
t.join("|"),
|
|
2303
|
+
e
|
|
2304
|
+
]), r;
|
|
2305
|
+
}
|
|
2306
|
+
// src/components/day-week-view/DayWeekView.tsx
|
|
2307
|
+
var An = {
|
|
2308
|
+
regular: 64,
|
|
2309
|
+
compact: 44,
|
|
2310
|
+
narrow: 40
|
|
2311
|
+
};
|
|
2312
|
+
function jn({ rowHeight: e, ...t }) {
|
|
2313
|
+
let { viewValue: r, hourMin: i, hourMax: a, view: o, eventMap: s, preventOutBoundsChanges: l, eventRenderer: d, timeStep: f, scrollable: p, size: h, hideMinMaxTime: g, disabled: _, getIsDayDisabled: v, onEventChange: y, pointerPreviewRenderer: x } = J(), S = K(), C = Ge(), { getMonthDay: w, getWeekDay: E, isToday: O, weekDayShortName: k } = S, ee = mt(), A = e ?? m[h], j = u(null), M = u(null), N = c(() => T(S, f, {
|
|
2314
|
+
hourMin: i,
|
|
2315
|
+
hourMax: a,
|
|
2316
|
+
hideMinMaxTime: g
|
|
2317
|
+
}, l), [
|
|
2318
|
+
S,
|
|
2319
|
+
f,
|
|
2320
|
+
i,
|
|
2321
|
+
a,
|
|
2322
|
+
g,
|
|
2323
|
+
l
|
|
2324
|
+
]), P = kn(j, c(() => N.map(({ time: e }) => e), [N]), An[h]), F = c(() => ue(S, o, r), [
|
|
2325
|
+
S,
|
|
2326
|
+
o,
|
|
2327
|
+
r
|
|
2328
|
+
]), I = c(() => ({
|
|
2329
|
+
hourMin: i,
|
|
2330
|
+
hourMax: a,
|
|
2331
|
+
hideMinMaxTime: g
|
|
2332
|
+
}), [
|
|
2333
|
+
i,
|
|
2334
|
+
a,
|
|
2335
|
+
g
|
|
2336
|
+
]), L = c(() => b(s, S, N.length * 60, F, I), [
|
|
2337
|
+
s,
|
|
2338
|
+
S,
|
|
2339
|
+
N.length,
|
|
2340
|
+
F,
|
|
2341
|
+
I
|
|
2342
|
+
]), R = c(() => L.map(({ events: e }) => e), [L]), { state: z, actions: B, previewOf: te } = gn({
|
|
2343
|
+
days: F,
|
|
2344
|
+
viewportRef: j,
|
|
2345
|
+
dateUtils: S,
|
|
2346
|
+
bounds: I,
|
|
2347
|
+
timeStep: f,
|
|
2348
|
+
preventOutBoundsChanges: l,
|
|
2349
|
+
disabled: _,
|
|
2350
|
+
getIsDayDisabled: v,
|
|
2351
|
+
eventMap: s,
|
|
2352
|
+
onEventChange: y
|
|
2353
|
+
}), V = c(() => z ? De(z.range[0], z.range[1], F.length, I) : [], [
|
|
2354
|
+
z,
|
|
2355
|
+
F.length,
|
|
2356
|
+
I
|
|
2357
|
+
]), ne = z ? s.get(z.key)?.value : void 0, H = n((e) => ae(S, e, {
|
|
2358
|
+
hourMin: i,
|
|
2359
|
+
hourMax: a,
|
|
2360
|
+
hideMinMaxTime: g
|
|
2361
|
+
}), [
|
|
2362
|
+
S,
|
|
2363
|
+
g,
|
|
2364
|
+
a,
|
|
2365
|
+
i
|
|
2366
|
+
]), re = c(() => F.map((e, t) => {
|
|
2367
|
+
let n = E(e), r = O(e), i = L[t]?.events ?? [];
|
|
2368
|
+
return {
|
|
2369
|
+
attributes: r ? { "data-is-today": !0 } : void 0,
|
|
2370
|
+
events: i,
|
|
2371
|
+
day: w(e),
|
|
2372
|
+
isToday: r,
|
|
2373
|
+
targetDate: e,
|
|
2374
|
+
weekDayName: k(n),
|
|
2375
|
+
weekDayNumber: n
|
|
2376
|
+
};
|
|
2377
|
+
}), [
|
|
2378
|
+
ee,
|
|
2379
|
+
S,
|
|
2380
|
+
F,
|
|
2381
|
+
L,
|
|
2382
|
+
w,
|
|
2383
|
+
E,
|
|
2384
|
+
O,
|
|
2385
|
+
k
|
|
2386
|
+
]), ie = dt(), oe = t, se = $.root__head, ce = $.root__body, le = $.root__viewport, de = $.root__column, fe = $.root__headerCell, U = $.root__headerCellDay, pe = $.root__row, me = $.root__rowHeadTime, he = $.root__timeStep, ge = st(j), _e = c(() => ({
|
|
2387
|
+
viewportRef: j,
|
|
2388
|
+
getTimeFrame: H,
|
|
2389
|
+
pxPerMinute: A / 60,
|
|
2390
|
+
resize: B,
|
|
2391
|
+
resizing: z
|
|
2392
|
+
}), [
|
|
2393
|
+
j,
|
|
2394
|
+
H,
|
|
2395
|
+
A,
|
|
2396
|
+
B,
|
|
2397
|
+
z
|
|
2398
|
+
]), ve = c(() => ({ viewportRef: j }), [j]), ye = (e, t) => /* @__PURE__ */ W(Tn, {
|
|
2399
|
+
"data-idx": t,
|
|
2400
|
+
eventData: e,
|
|
2401
|
+
children: d.current?.(e.value, o, {
|
|
2402
|
+
isStart: e.isStart,
|
|
2403
|
+
isEnd: e.isEnd
|
|
2404
|
+
})
|
|
2405
|
+
}, e.key);
|
|
2406
|
+
return /* @__PURE__ */ W(_n.Provider, {
|
|
2407
|
+
value: _e,
|
|
2408
|
+
children: /* @__PURE__ */ W(Nt.Provider, {
|
|
2409
|
+
value: ve,
|
|
2410
|
+
children: /* @__PURE__ */ G(ze, { children: [
|
|
2411
|
+
/* @__PURE__ */ G("div", {
|
|
2412
|
+
...oe,
|
|
2413
|
+
className: D(oe.className, $.root, { [$.root_scrollable]: p }),
|
|
2414
|
+
style: {
|
|
2415
|
+
...oe.style,
|
|
2416
|
+
"--calendar-column-count": re.length,
|
|
2417
|
+
"--scrollbar-width": ie.width,
|
|
2418
|
+
"--scrollbar-height": ie.height,
|
|
2419
|
+
...P !== void 0 && { "--ww-time-column": `${P}px` }
|
|
2420
|
+
},
|
|
2421
|
+
children: [/* @__PURE__ */ G("div", {
|
|
2422
|
+
className: se,
|
|
2423
|
+
children: [/* @__PURE__ */ W("div", { className: fe }), re.map((e) => /* @__PURE__ */ G("div", {
|
|
2424
|
+
className: fe,
|
|
2425
|
+
...e.attributes,
|
|
2426
|
+
children: [/* @__PURE__ */ W("span", {
|
|
2427
|
+
className: U,
|
|
2428
|
+
children: e.day
|
|
2429
|
+
}), /* @__PURE__ */ G("span", {
|
|
2430
|
+
className: $.root__headerCellLabel,
|
|
2431
|
+
children: [/* @__PURE__ */ W("span", {
|
|
2432
|
+
className: $.root__headerCellName,
|
|
2433
|
+
children: e.weekDayName
|
|
2434
|
+
}), e.isToday && /* @__PURE__ */ W("span", {
|
|
2435
|
+
className: $.root__headerCellToday,
|
|
2436
|
+
children: C.today
|
|
2437
|
+
})]
|
|
2438
|
+
})]
|
|
2439
|
+
}, e.weekDayNumber))]
|
|
2440
|
+
}), /* @__PURE__ */ G("div", {
|
|
2441
|
+
className: $.root__main,
|
|
2442
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2443
|
+
ref: M,
|
|
2444
|
+
className: ce,
|
|
2445
|
+
children: /* @__PURE__ */ G("div", {
|
|
2446
|
+
ref: ge,
|
|
2447
|
+
className: le,
|
|
2448
|
+
style: { height: N.length * A },
|
|
2449
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2450
|
+
className: de,
|
|
2451
|
+
children: N.map(({ time: e, value: t, steps: n }, r) => /* @__PURE__ */ G("div", {
|
|
2452
|
+
className: pe,
|
|
2453
|
+
style: {
|
|
2454
|
+
height: A,
|
|
2455
|
+
"--translateY": r * A,
|
|
2456
|
+
"--calendar-rows-count": n.length
|
|
2457
|
+
},
|
|
2458
|
+
children: [/* @__PURE__ */ W("time", {
|
|
2459
|
+
className: me,
|
|
2460
|
+
children: e
|
|
2461
|
+
}), n.map(([e, , t]) => /* @__PURE__ */ W("div", { className: D(he, { [$.root__timeStep_overTime]: t }) }, e))]
|
|
2462
|
+
}, t))
|
|
2463
|
+
}), re.map((e, t) => /* @__PURE__ */ W("div", {
|
|
2464
|
+
className: de,
|
|
2465
|
+
"data-day-index": t,
|
|
2466
|
+
...e.attributes,
|
|
2467
|
+
children: /* @__PURE__ */ G(xn, {
|
|
2468
|
+
id: `${e.weekDayNumber}`,
|
|
2469
|
+
targetDate: e.targetDate,
|
|
2470
|
+
children: [e.events.map((e, t) => ye(e, t)), V.filter((e) => e.dayIndex === t).map((e) => /* @__PURE__ */ W(Dn, {
|
|
2471
|
+
part: e,
|
|
2472
|
+
timelineMinutes: N.length * 60,
|
|
2473
|
+
children: ne === void 0 ? null : d.current?.(ne, o, {
|
|
2474
|
+
isStart: e.isStart,
|
|
2475
|
+
isEnd: e.isEnd
|
|
2476
|
+
})
|
|
2477
|
+
}, "resize"))]
|
|
2478
|
+
})
|
|
2479
|
+
}, e.weekDayNumber))]
|
|
2480
|
+
})
|
|
2481
|
+
}), p && /* @__PURE__ */ W(On, {
|
|
2482
|
+
scrollerRef: M,
|
|
2483
|
+
columns: R,
|
|
2484
|
+
rowHeight: A
|
|
2485
|
+
})]
|
|
2486
|
+
})]
|
|
2487
|
+
}),
|
|
2488
|
+
/* @__PURE__ */ W(zt, { pxPerMinute: A / 60 }),
|
|
2489
|
+
z && !z.blocked && /* @__PURE__ */ W(It, {
|
|
2490
|
+
coordinates: {
|
|
2491
|
+
x: z.x,
|
|
2492
|
+
y: z.y
|
|
2493
|
+
},
|
|
2494
|
+
children: (() => {
|
|
2495
|
+
let { date: e, top: t, duration: n } = te(z.range);
|
|
2496
|
+
return x.current?.(e, t, n);
|
|
2497
|
+
})()
|
|
2498
|
+
})
|
|
2499
|
+
] })
|
|
2500
|
+
})
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2503
|
+
var Mn = {
|
|
2504
|
+
root: "_root_1jr3p_2",
|
|
2505
|
+
root__head: "_root__head_1jr3p_22",
|
|
2506
|
+
root__body: "_root__body_1jr3p_26",
|
|
2507
|
+
root__body_readonly: "_root__body_readonly_1jr3p_35"
|
|
2508
|
+
};
|
|
2509
|
+
// src/Calendar.tsx
|
|
2510
|
+
function Nn(e) {
|
|
2511
|
+
let { ref: t, disabled: n = !1, children: r, hideMinMaxTime: a = !1, timeFrame: o, startWeek: s, timeStep: l = 15, items: d, onEventCreate: f, onEventChange: p, onEventDelete: m, onEventEdit: h, eventTimeFrameResolver: g, eventKeyResolver: _, getIsDayDisabled: v, pointerPreviewFormat: y, scrollable: b = !1, view: x, defaultView: S, viewValue: C, defaultViewValue: T, onChangeView: E, onChangeViewValue: O, ...k } = e, { hourMax: ee, hourMin: A } = {
|
|
2512
|
+
hourMin: 0,
|
|
2513
|
+
hourMax: 24,
|
|
2514
|
+
...o
|
|
2515
|
+
}, M = Ye({
|
|
2516
|
+
eventTimeFrameResolver: g,
|
|
2517
|
+
eventKeyResolver: _
|
|
2518
|
+
}), N = K(), P = s ?? N.weekStartsOn, I = u(null), L = st(I, t), { viewValue: R, changeViewValue: z, view: B, changeView: te } = _t({
|
|
2519
|
+
view: x,
|
|
2520
|
+
defaultView: S,
|
|
2521
|
+
viewValue: C,
|
|
2522
|
+
defaultViewValue: T,
|
|
2523
|
+
onChangeView: E,
|
|
2524
|
+
onChangeViewValue: O,
|
|
2525
|
+
dateUtils: N,
|
|
2526
|
+
startWeek: P
|
|
2527
|
+
}), V = Je(I), ne = tt(je).current, H = c(() => w(d, M.current, N, {
|
|
2528
|
+
hourMin: A,
|
|
2529
|
+
hideMinMaxTime: a
|
|
2530
|
+
}), [
|
|
2531
|
+
N,
|
|
2532
|
+
a,
|
|
2533
|
+
A,
|
|
2534
|
+
d,
|
|
2535
|
+
M
|
|
2536
|
+
]), { goBackward: re, goForward: ie, goToday: ae } = vt({
|
|
2537
|
+
changeViewValue: z,
|
|
2538
|
+
dateUtils: N,
|
|
2539
|
+
startWeek: P,
|
|
2540
|
+
view: B,
|
|
2541
|
+
viewValue: R
|
|
2542
|
+
}), oe = q((e, t, n) => {
|
|
2543
|
+
let r = H.get(e);
|
|
2544
|
+
r && p?.(r.value, ...F(N, t, n));
|
|
2545
|
+
}), ce = q((e, t) => {
|
|
2546
|
+
f?.(...F(N, e, t));
|
|
2547
|
+
}), le = q((e) => {
|
|
2548
|
+
let t = H.get(e);
|
|
2549
|
+
t && h?.(t.value);
|
|
2550
|
+
}), ue = q((e) => {
|
|
2551
|
+
let t = H.get(e);
|
|
2552
|
+
t && m?.(t.value);
|
|
2553
|
+
}), de = Ye((e, t, n) => {
|
|
2554
|
+
let [r, i] = se(N, e, t, n, {
|
|
2555
|
+
hourMin: A,
|
|
2556
|
+
hideMinMaxTime: a
|
|
2557
|
+
});
|
|
2558
|
+
return y ? y(r, i) : j(N, r, i);
|
|
2559
|
+
}), fe = Ye(r);
|
|
2560
|
+
i(() => {
|
|
2561
|
+
if (I.current) return ne.getState().registerRootElement(I.current);
|
|
2562
|
+
}, [ne]);
|
|
2563
|
+
let U = {
|
|
2564
|
+
...k,
|
|
2565
|
+
ref: L
|
|
2566
|
+
}, pe = c(() => ({
|
|
2567
|
+
disabled: n,
|
|
2568
|
+
getIsDayDisabled: v,
|
|
2569
|
+
preventOutBoundsChanges: !!o,
|
|
2570
|
+
changeView: te,
|
|
2571
|
+
changeViewValue: z,
|
|
2572
|
+
eventMap: H,
|
|
2573
|
+
goBackward: re,
|
|
2574
|
+
goForward: ie,
|
|
2575
|
+
goToday: ae,
|
|
2576
|
+
hideMinMaxTime: a,
|
|
2577
|
+
hourMax: ee,
|
|
2578
|
+
hourMin: A,
|
|
2579
|
+
timeStep: l,
|
|
2580
|
+
scrollable: b,
|
|
2581
|
+
size: V,
|
|
2582
|
+
startWeek: P,
|
|
2583
|
+
view: B,
|
|
2584
|
+
viewValue: R,
|
|
2585
|
+
onEventCreate: ce,
|
|
2586
|
+
onEventChange: oe,
|
|
2587
|
+
onEventDelete: ue,
|
|
2588
|
+
onEventEdit: le,
|
|
2589
|
+
eventRenderer: fe,
|
|
2590
|
+
pointerPreviewRenderer: de
|
|
2591
|
+
}), [
|
|
2592
|
+
n,
|
|
2593
|
+
de,
|
|
2594
|
+
v,
|
|
2595
|
+
te,
|
|
2596
|
+
z,
|
|
2597
|
+
H,
|
|
2598
|
+
re,
|
|
2599
|
+
ie,
|
|
2600
|
+
ae,
|
|
2601
|
+
a,
|
|
2602
|
+
ee,
|
|
2603
|
+
A,
|
|
2604
|
+
b,
|
|
2605
|
+
V,
|
|
2606
|
+
P,
|
|
2607
|
+
l,
|
|
2608
|
+
B,
|
|
2609
|
+
R,
|
|
2610
|
+
ce,
|
|
2611
|
+
oe,
|
|
2612
|
+
ue,
|
|
2613
|
+
le,
|
|
2614
|
+
fe
|
|
2615
|
+
]);
|
|
2616
|
+
return /* @__PURE__ */ W("div", {
|
|
2617
|
+
...U,
|
|
2618
|
+
className: D(U.className, Mn.root),
|
|
2619
|
+
"data-ww-size": V === "regular" ? void 0 : V,
|
|
2620
|
+
children: /* @__PURE__ */ W(ht.Provider, {
|
|
2621
|
+
value: pe,
|
|
2622
|
+
children: /* @__PURE__ */ W(Me.Provider, {
|
|
2623
|
+
value: ne,
|
|
2624
|
+
children: /* @__PURE__ */ G(gt.Provider, {
|
|
2625
|
+
value: I,
|
|
2626
|
+
children: [/* @__PURE__ */ W("div", {
|
|
2627
|
+
className: Mn.root__head,
|
|
2628
|
+
children: /* @__PURE__ */ W(Mt, {})
|
|
2629
|
+
}), /* @__PURE__ */ W("div", {
|
|
2630
|
+
className: Mn.root__body,
|
|
2631
|
+
children: W(B === "month" ? mn : jn, {})
|
|
2632
|
+
})]
|
|
2633
|
+
})
|
|
2634
|
+
})
|
|
2635
|
+
})
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
export { Nn as Calendar, Nn as default, Ve as DateLocalizationContext, We as DateLocalizationProvider, Ue as MessagesContext, E as builtInMessages, Ce as resolveMessages, He as useDateUtils, Ge as useMessages };
|
|
2639
|
+
|
|
2640
|
+
//# sourceMappingURL=index.js.map
|