@innosolutions/inno-calendar 2.0.0 → 2.0.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/CHANGELOG.md +23 -0
- package/dist/components/event/event-card.d.ts +1 -1
- package/dist/components/event/event-card.d.ts.map +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/primitives/field-layer.d.ts +10 -0
- package/dist/components/primitives/field-layer.d.ts.map +1 -1
- package/dist/components/primitives/multi-day-banner.d.ts.map +1 -1
- package/dist/components/primitives/recurrence-field.d.ts.map +1 -1
- package/dist/components/primitives/week-all-day-row.d.ts.map +1 -1
- package/dist/components/primitives/when-row.d.ts.map +1 -1
- package/dist/core/constants.d.ts +7 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +83 -82
- package/dist/core/utils/time-format.d.ts +9 -0
- package/dist/core/utils/time-format.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +83 -82
- package/dist/inno-calendar-DFEaWcSi.cjs +11 -0
- package/dist/inno-calendar-DFEaWcSi.cjs.map +1 -0
- package/dist/{inno-calendar-B6qXIqxY.js → inno-calendar-R7LPGSJU.js} +2225 -2204
- package/dist/inno-calendar-R7LPGSJU.js.map +1 -0
- package/dist/{position-utils-CBSmf90e.js → position-utils-BH6T1FL5.js} +350 -331
- package/dist/position-utils-BH6T1FL5.js.map +1 -0
- package/dist/position-utils-BVt-Bp93.cjs +2 -0
- package/dist/position-utils-BVt-Bp93.cjs.map +1 -0
- package/dist/{use-slot-selection-CxPvMluJ.cjs → use-slot-selection-CSsSyfAi.cjs} +2 -2
- package/dist/{use-slot-selection-CxPvMluJ.cjs.map → use-slot-selection-CSsSyfAi.cjs.map} +1 -1
- package/dist/{use-slot-selection-IXHnP8C1.js → use-slot-selection-CT1z9v9X.js} +28 -28
- package/dist/{use-slot-selection-IXHnP8C1.js.map → use-slot-selection-CT1z9v9X.js.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.mjs +52 -51
- package/dist/{z-layers-r5PdtThu.js → z-layers-CpHPAMdp.js} +35 -35
- package/dist/{z-layers-r5PdtThu.js.map → z-layers-CpHPAMdp.js.map} +1 -1
- package/dist/{z-layers-Bavypndz.cjs → z-layers-D1DivrJg.cjs} +2 -2
- package/dist/{z-layers-Bavypndz.cjs.map → z-layers-D1DivrJg.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/inno-calendar-B6qXIqxY.js.map +0 -1
- package/dist/inno-calendar-BnCt65PZ.cjs +0 -11
- package/dist/inno-calendar-BnCt65PZ.cjs.map +0 -1
- package/dist/position-utils-BzSoogFQ.cjs +0 -2
- package/dist/position-utils-BzSoogFQ.cjs.map +0 -1
- package/dist/position-utils-CBSmf90e.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as b, an as te, ao as ne, T as re, V as se, U as oe, W as ae, X as ce,
|
|
1
|
+
import { useContext as R, createContext as Z, useState as E, useMemo as x, useCallback as s, useEffect as $, useRef as ee } from "react";
|
|
2
|
+
import { d as b, an as te, ao as ne, T as re, V as se, U as oe, W as ae, X as ce, b5 as ie, aO as ue, aP as le, aQ as fe, c as de, bf as M, q as N } from "./position-utils-BH6T1FL5.js";
|
|
3
3
|
import { jsx as ge } from "react/jsx-runtime";
|
|
4
4
|
const k = Z(void 0);
|
|
5
5
|
function Se({ children: t, value: r }) {
|
|
@@ -19,8 +19,8 @@ function ve() {
|
|
|
19
19
|
return { view: t, setView: r };
|
|
20
20
|
}
|
|
21
21
|
function ye() {
|
|
22
|
-
const { currentDate: t, setCurrentDate: r, goToNext: c, goToPrev: u, goToToday: i, goToDate:
|
|
23
|
-
return { currentDate: t, setCurrentDate: r, goToNext: c, goToPrev: u, goToToday: i, goToDate:
|
|
22
|
+
const { currentDate: t, setCurrentDate: r, goToNext: c, goToPrev: u, goToToday: i, goToDate: f } = P();
|
|
23
|
+
return { currentDate: t, setCurrentDate: r, goToNext: c, goToPrev: u, goToToday: i, goToDate: f };
|
|
24
24
|
}
|
|
25
25
|
function me() {
|
|
26
26
|
const { events: t, filteredEvents: r } = P();
|
|
@@ -40,7 +40,7 @@ function pe(t) {
|
|
|
40
40
|
resources: c = [],
|
|
41
41
|
scheduleTypes: u = [],
|
|
42
42
|
initialView: i = "week",
|
|
43
|
-
initialDate:
|
|
43
|
+
initialDate: f,
|
|
44
44
|
initialFilters: S = {},
|
|
45
45
|
preferences: H = {},
|
|
46
46
|
lockedPreferences: e = {},
|
|
@@ -50,16 +50,16 @@ function pe(t) {
|
|
|
50
50
|
onEventClick: Y,
|
|
51
51
|
onSlotSelect: I,
|
|
52
52
|
onFiltersChange: y
|
|
53
|
-
} = t, [
|
|
53
|
+
} = t, [d, D] = E(i), [a, g] = E(() => f ?? /* @__PURE__ */ new Date()), [l, h] = E(S), [m, W] = E(() => ({
|
|
54
54
|
...b,
|
|
55
55
|
...H,
|
|
56
56
|
...e
|
|
57
57
|
})), F = x(
|
|
58
|
-
() => te(a,
|
|
59
|
-
[a,
|
|
58
|
+
() => te(a, d, m.firstDayOfWeek),
|
|
59
|
+
[a, d, m.firstDayOfWeek]
|
|
60
60
|
), U = x(
|
|
61
|
-
() => ne(a,
|
|
62
|
-
[a,
|
|
61
|
+
() => ne(a, d, o),
|
|
62
|
+
[a, d, o]
|
|
63
63
|
), B = x(() => {
|
|
64
64
|
let n = [...r];
|
|
65
65
|
n = re(n, F.startDate, F.endDate);
|
|
@@ -80,13 +80,13 @@ function pe(t) {
|
|
|
80
80
|
},
|
|
81
81
|
[w]
|
|
82
82
|
), L = s(() => {
|
|
83
|
-
const n = ue(a,
|
|
83
|
+
const n = ue(a, d);
|
|
84
84
|
C(n);
|
|
85
|
-
}, [a,
|
|
86
|
-
const n = le(a,
|
|
85
|
+
}, [a, d, C]), j = s(() => {
|
|
86
|
+
const n = le(a, d);
|
|
87
87
|
C(n);
|
|
88
|
-
}, [a,
|
|
89
|
-
C(
|
|
88
|
+
}, [a, d, C]), A = s(() => {
|
|
89
|
+
C(fe());
|
|
90
90
|
}, [C]), J = s(
|
|
91
91
|
(n) => {
|
|
92
92
|
C(n);
|
|
@@ -131,7 +131,7 @@ function pe(t) {
|
|
|
131
131
|
);
|
|
132
132
|
return {
|
|
133
133
|
// State
|
|
134
|
-
view:
|
|
134
|
+
view: d,
|
|
135
135
|
currentDate: a,
|
|
136
136
|
dateRange: F,
|
|
137
137
|
filters: l,
|
|
@@ -186,7 +186,7 @@ function Ee() {
|
|
|
186
186
|
});
|
|
187
187
|
},
|
|
188
188
|
[r]
|
|
189
|
-
),
|
|
189
|
+
), f = s(
|
|
190
190
|
(e) => {
|
|
191
191
|
const o = Object.values(e)[0];
|
|
192
192
|
o && r({
|
|
@@ -207,7 +207,7 @@ function Ee() {
|
|
|
207
207
|
visibleHours: c,
|
|
208
208
|
setVisibleHours: i,
|
|
209
209
|
workingHours: u,
|
|
210
|
-
setWorkingHours:
|
|
210
|
+
setWorkingHours: f,
|
|
211
211
|
slotDuration: t.slotDuration,
|
|
212
212
|
setSlotDuration: S,
|
|
213
213
|
showWorkingHoursOnly: !1,
|
|
@@ -216,7 +216,7 @@ function Ee() {
|
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
function Pe(t = {}) {
|
|
219
|
-
const { initial: r = {}, storageKey: c, onChange: u } = t, [i,
|
|
219
|
+
const { initial: r = {}, storageKey: c, onChange: u } = t, [i, f] = E(() => {
|
|
220
220
|
if (c && typeof window < "u")
|
|
221
221
|
try {
|
|
222
222
|
const o = localStorage.getItem(c);
|
|
@@ -237,7 +237,7 @@ function Pe(t = {}) {
|
|
|
237
237
|
}, [i, c]);
|
|
238
238
|
const S = s(
|
|
239
239
|
(o) => {
|
|
240
|
-
|
|
240
|
+
f((v) => {
|
|
241
241
|
const w = { ...v, ...o };
|
|
242
242
|
return u?.(w), w;
|
|
243
243
|
});
|
|
@@ -245,7 +245,7 @@ function Pe(t = {}) {
|
|
|
245
245
|
[u]
|
|
246
246
|
), H = s(() => {
|
|
247
247
|
const o = { ...b, ...r };
|
|
248
|
-
|
|
248
|
+
f(o), u?.(o);
|
|
249
249
|
}, [r, u]), e = s(
|
|
250
250
|
(o) => i[o],
|
|
251
251
|
[i]
|
|
@@ -269,9 +269,9 @@ function xe(t) {
|
|
|
269
269
|
const {
|
|
270
270
|
dayStart: r,
|
|
271
271
|
visibleHours: c,
|
|
272
|
-
hourHeight: u =
|
|
272
|
+
hourHeight: u = de,
|
|
273
273
|
slotDuration: i = 30,
|
|
274
|
-
resourceId:
|
|
274
|
+
resourceId: f,
|
|
275
275
|
enabled: S = !0,
|
|
276
276
|
onSelect: H
|
|
277
277
|
} = t, [e, o] = E(O), v = ee(0), w = s(
|
|
@@ -286,10 +286,10 @@ function xe(t) {
|
|
|
286
286
|
endDate: N(l, i),
|
|
287
287
|
startY: g,
|
|
288
288
|
currentY: g,
|
|
289
|
-
resourceId:
|
|
289
|
+
resourceId: f
|
|
290
290
|
});
|
|
291
291
|
},
|
|
292
|
-
[S, r, c, u, i,
|
|
292
|
+
[S, r, c, u, i, f]
|
|
293
293
|
), Y = s(
|
|
294
294
|
(D, a) => {
|
|
295
295
|
if (!e.isSelecting || !e.startY) return;
|
|
@@ -319,7 +319,7 @@ function xe(t) {
|
|
|
319
319
|
H?.(g), o(O);
|
|
320
320
|
}, [e, H]), y = s(() => {
|
|
321
321
|
o(O);
|
|
322
|
-
}, []),
|
|
322
|
+
}, []), d = (() => {
|
|
323
323
|
if (!e.isSelecting || e.startY === null || e.currentY === null)
|
|
324
324
|
return { top: 0, height: 0, visible: !1 };
|
|
325
325
|
const D = Math.min(e.startY, e.currentY), a = Math.max(e.startY, e.currentY);
|
|
@@ -332,7 +332,7 @@ function xe(t) {
|
|
|
332
332
|
})();
|
|
333
333
|
return {
|
|
334
334
|
selection: e,
|
|
335
|
-
overlay:
|
|
335
|
+
overlay: d,
|
|
336
336
|
handlePointerDown: w,
|
|
337
337
|
handlePointerMove: Y,
|
|
338
338
|
handlePointerUp: I,
|
|
@@ -354,4 +354,4 @@ export {
|
|
|
354
354
|
xe as j,
|
|
355
355
|
pe as u
|
|
356
356
|
};
|
|
357
|
-
//# sourceMappingURL=use-slot-selection-
|
|
357
|
+
//# sourceMappingURL=use-slot-selection-CT1z9v9X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slot-selection-IXHnP8C1.js","sources":["../src/core/context/calendar-context.tsx","../src/core/hooks/use-calendar.ts","../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\n * CalendarContext - React Context for Calendar State\n *\n * Provides calendar state to deeply nested components without prop drilling.\n */\n\nimport { createContext, type ReactNode, useContext } from 'react';\nimport type { UseCalendarReturn } from '../hooks/use-calendar';\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n/**\n * Calendar context type - generic to support any event data type\n * We use `any` here because context consumers may not know the exact type\n * Use the typed hooks below for type-safe access\n */\n// biome-ignore lint/suspicious/noExplicitAny: Context needs to be flexible for different event types\nconst CalendarContext = createContext<UseCalendarReturn<any, any, any> | undefined>(undefined);\n\n// ============================================================================\n// PROVIDER\n// ============================================================================\n\nexport interface CalendarProviderProps<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\tchildren: ReactNode;\n\tvalue: UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\nexport function CalendarProvider<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>({ children, value }: CalendarProviderProps<TEventData, TScheduleTypeData, TResourceData>) {\n\treturn <CalendarContext.Provider value={value}>{children}</CalendarContext.Provider>;\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context (throws if not in provider)\n */\nexport function useCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst context = useContext(CalendarContext);\n\tif (!context) {\n\t\tthrow new Error('useCalendarContext must be used within a CalendarProvider');\n\t}\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\n/**\n * Get the calendar context or undefined (safe version)\n */\nexport function useOptionalCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined {\n\tconst context = useContext(CalendarContext);\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined;\n}\n\n// ============================================================================\n// CONVENIENCE HOOKS\n// ============================================================================\n\n/**\n * Get current view\n */\nexport function useCalendarView() {\n\tconst { view, setView } = useCalendarContext();\n\treturn { view, setView };\n}\n\n/**\n * Get current date and navigation\n */\nexport function useCalendarDate() {\n\tconst { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate } =\n\t\tuseCalendarContext();\n\treturn { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate };\n}\n\n/**\n * Get filtered events\n */\nexport function useCalendarEvents<TEventData = Record<string, unknown>>() {\n\tconst { events, filteredEvents } = useCalendarContext<TEventData>();\n\treturn { events, filteredEvents };\n}\n\n/**\n * Get filters\n */\nexport function useCalendarFilters() {\n\tconst { filters, setFilters, updateFilters, clearFilters } = useCalendarContext();\n\treturn { filters, setFilters, updateFilters, clearFilters };\n}\n\n/**\n * Get preferences\n */\nexport function useCalendarPreferences() {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\treturn { preferences, setPreferences };\n}\n\n// ============================================================================\n// ALIASES (for agenda-v2 naming convention compatibility)\n// ============================================================================\n\n/**\n * Alias for useCalendarContext - matches agenda-v2 naming convention\n */\nexport { useCalendarContext as useCalendar };\n\n/**\n * Alias for useOptionalCalendarContext - matches agenda-v2 naming convention\n */\nexport { useOptionalCalendarContext as useOptionalCalendar };\n","/**\n * useCalendar - Main Calendar Hook\n *\n * This hook provides all the state and methods needed to build a calendar.\n * It is fully generic, allowing consumers to define their own event data types.\n *\n * @example\n * ```tsx\n * interface MyEventData {\n * projectId: number;\n * priority: 'low' | 'medium' | 'high';\n * }\n *\n * const calendar = useCalendar<MyEventData>({\n * events: myEvents,\n * onEventClick: (event) => {\n * console.log(event.data?.projectId);\n * },\n * });\n * ```\n */\n\nimport { useCallback, useMemo, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type {\n\tCalendarEvent,\n\tICalendarFilters,\n\tICalendarPreferences,\n\tIDateRange,\n\tIResource,\n\tIScheduleType,\n\tISelectionResult,\n\tTCalendarView,\n} from '../types';\nimport {\n\tfilterEventsByDateRange,\n\tfilterEventsByResource,\n\tfilterEventsByScheduleType,\n\tfilterEventsBySearch,\n\tfilterOutCanceled,\n\tsortEventsByStart,\n} from '../utils/event-utils';\nimport {\n\tgetViewDateRange,\n\tgetViewTitle,\n\tnavigateNext,\n\tnavigatePrev,\n\tnavigateToday,\n} from '../utils/grid-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n/**\n * Options for useCalendar hook\n */\nexport interface UseCalendarOptions<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t/** Events to display */\n\tevents: CalendarEvent<TEventData>[];\n\n\t/** Available resources (for resource views) */\n\tresources?: IResource<TResourceData>[] | undefined;\n\n\t/** Available schedule types */\n\tscheduleTypes?: IScheduleType<TScheduleTypeData>[] | undefined;\n\n\t/** Initial view */\n\tinitialView?: TCalendarView | undefined;\n\n\t/** Initial date */\n\tinitialDate?: Date | undefined;\n\n\t/** Initial filters */\n\tinitialFilters?: ICalendarFilters | undefined;\n\n\t/** User preferences */\n\tpreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locked preferences (cannot be changed by user) */\n\tlockedPreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locale for formatting */\n\tlocale?: string | undefined;\n\n\t/** Callback when view changes */\n\tonViewChange?: ((view: TCalendarView) => void) | undefined;\n\n\t/** Callback when date changes */\n\tonDateChange?: ((date: Date) => void) | undefined;\n\n\t/** Callback when event is clicked */\n\tonEventClick?: ((event: CalendarEvent<TEventData>) => void) | undefined;\n\n\t/** Callback when slot is selected */\n\tonSlotSelect?: ((selection: ISelectionResult) => void) | undefined;\n\n\t/** Callback when filters change */\n\tonFiltersChange?: ((filters: ICalendarFilters) => void) | undefined;\n}\n\n/**\n * Return type for useCalendar hook\n */\nexport interface UseCalendarReturn<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t// State\n\tview: TCalendarView;\n\tcurrentDate: Date;\n\tdateRange: IDateRange;\n\tfilters: ICalendarFilters;\n\tpreferences: ICalendarPreferences;\n\n\t// Computed\n\tfilteredEvents: CalendarEvent<TEventData>[];\n\tviewTitle: string;\n\n\t// Data\n\tevents: CalendarEvent<TEventData>[];\n\tresources: IResource<TResourceData>[];\n\tscheduleTypes: IScheduleType<TScheduleTypeData>[];\n\n\t// Actions\n\tsetView: (view: TCalendarView) => void;\n\tsetCurrentDate: (date: Date) => void;\n\tgoToNext: () => void;\n\tgoToPrev: () => void;\n\tgoToToday: () => void;\n\tgoToDate: (date: Date) => void;\n\n\t// Filters\n\tsetFilters: (filters: ICalendarFilters) => void;\n\tupdateFilters: (updates: Partial<ICalendarFilters>) => void;\n\tclearFilters: () => void;\n\n\t// Preferences\n\tsetPreferences: (prefs: Partial<ICalendarPreferences>) => void;\n\n\t// Event handlers\n\thandleEventClick: (event: CalendarEvent<TEventData>) => void;\n\thandleSlotSelect: (selection: ISelectionResult) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useCalendar<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(\n\toptions: UseCalendarOptions<TEventData, TScheduleTypeData, TResourceData>\n): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst {\n\t\tevents,\n\t\tresources = [],\n\t\tscheduleTypes = [],\n\t\tinitialView = 'week',\n\t\tinitialDate,\n\t\tinitialFilters = {},\n\t\tpreferences: userPreferences = {},\n\t\tlockedPreferences = {},\n\t\tlocale = 'en-US',\n\t\tonViewChange,\n\t\tonDateChange,\n\t\tonEventClick,\n\t\tonSlotSelect,\n\t\tonFiltersChange,\n\t} = options;\n\n\t// ========================================================================\n\t// STATE\n\t// ========================================================================\n\n\tconst [view, setViewState] = useState<TCalendarView>(initialView);\n\tconst [currentDate, setCurrentDateState] = useState<Date>(() => initialDate ?? new Date());\n\tconst [filters, setFiltersState] = useState<ICalendarFilters>(initialFilters);\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => ({\n\t\t...DEFAULT_PREFERENCES,\n\t\t...userPreferences,\n\t\t...lockedPreferences,\n\t}));\n\n\t// ========================================================================\n\t// COMPUTED\n\t// ========================================================================\n\n\tconst dateRange = useMemo(\n\t\t() => getViewDateRange(currentDate, view, preferences.firstDayOfWeek),\n\t\t[currentDate, view, preferences.firstDayOfWeek]\n\t);\n\n\tconst viewTitle = useMemo(\n\t\t() => getViewTitle(currentDate, view, locale),\n\t\t[currentDate, view, locale]\n\t);\n\n\tconst filteredEvents = useMemo(() => {\n\t\tlet result = [...events];\n\n\t\t// Filter by date range\n\t\tresult = filterEventsByDateRange(result, dateRange.startDate, dateRange.endDate);\n\n\t\t// Filter by schedule types\n\t\tconst scheduleTypeIds = filters.scheduleTypeIds;\n\t\tif (scheduleTypeIds && scheduleTypeIds.length > 0) {\n\t\t\tresult = filterEventsByScheduleType(result, scheduleTypeIds);\n\t\t}\n\n\t\t// Filter by resources\n\t\tconst resourceIds = filters.resourceIds;\n\t\tif (resourceIds && resourceIds.length > 0) {\n\t\t\tresult = filterEventsByResource(result, resourceIds);\n\t\t}\n\n\t\t// Filter by search\n\t\tconst search = filters.search;\n\t\tif (search) {\n\t\t\tresult = filterEventsBySearch(result, search);\n\t\t}\n\n\t\t// Filter canceled\n\t\tif (!preferences.showCanceledEvents) {\n\t\t\tresult = filterOutCanceled(result);\n\t\t}\n\n\t\t// Sort by start date\n\t\treturn sortEventsByStart(result);\n\t}, [events, dateRange, filters, preferences.showCanceledEvents]);\n\n\t// ========================================================================\n\t// ACTIONS\n\t// ========================================================================\n\n\tconst setView = useCallback(\n\t\t(newView: TCalendarView) => {\n\t\t\tsetViewState(newView);\n\t\t\tonViewChange?.(newView);\n\t\t},\n\t\t[onViewChange]\n\t);\n\n\tconst setCurrentDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDateState(date);\n\t\t\tonDateChange?.(date);\n\t\t},\n\t\t[onDateChange]\n\t);\n\n\tconst goToNext = useCallback(() => {\n\t\tconst newDate = navigateNext(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToPrev = useCallback(() => {\n\t\tconst newDate = navigatePrev(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToToday = useCallback(() => {\n\t\tsetCurrentDate(navigateToday());\n\t}, [setCurrentDate]);\n\n\tconst goToDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDate(date);\n\t\t},\n\t\t[setCurrentDate]\n\t);\n\n\t// ========================================================================\n\t// FILTERS\n\t// ========================================================================\n\n\tconst setFilters = useCallback(\n\t\t(newFilters: ICalendarFilters) => {\n\t\t\tsetFiltersState(newFilters);\n\t\t\tonFiltersChange?.(newFilters);\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst updateFilters = useCallback(\n\t\t(updates: Partial<ICalendarFilters>) => {\n\t\t\tsetFiltersState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonFiltersChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst clearFilters = useCallback(() => {\n\t\tconst emptyFilters: ICalendarFilters = {};\n\t\tsetFiltersState(emptyFilters);\n\t\tonFiltersChange?.(emptyFilters);\n\t}, [onFiltersChange]);\n\n\t// ========================================================================\n\t// PREFERENCES\n\t// ========================================================================\n\n\tconst setPreferences = useCallback(\n\t\t(prefs: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => ({\n\t\t\t\t...prev,\n\t\t\t\t...prefs,\n\t\t\t\t...lockedPreferences, // Locked prefs always override\n\t\t\t}));\n\t\t},\n\t\t[lockedPreferences]\n\t);\n\n\t// ========================================================================\n\t// EVENT HANDLERS\n\t// ========================================================================\n\n\tconst handleEventClick = useCallback(\n\t\t(event: CalendarEvent<TEventData>) => {\n\t\t\tonEventClick?.(event);\n\t\t},\n\t\t[onEventClick]\n\t);\n\n\tconst handleSlotSelect = useCallback(\n\t\t(selection: ISelectionResult) => {\n\t\t\tonSlotSelect?.(selection);\n\t\t},\n\t\t[onSlotSelect]\n\t);\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\t// State\n\t\tview,\n\t\tcurrentDate,\n\t\tdateRange,\n\t\tfilters,\n\t\tpreferences,\n\n\t\t// Computed\n\t\tfilteredEvents,\n\t\tviewTitle,\n\n\t\t// Data\n\t\tevents,\n\t\tresources,\n\t\tscheduleTypes,\n\n\t\t// Actions\n\t\tsetView,\n\t\tsetCurrentDate,\n\t\tgoToNext,\n\t\tgoToPrev,\n\t\tgoToToday,\n\t\tgoToDate,\n\n\t\t// Filters\n\t\tsetFilters,\n\t\tupdateFilters,\n\t\tclearFilters,\n\n\t\t// Preferences\n\t\tsetPreferences,\n\n\t\t// Event handlers\n\t\thandleEventClick,\n\t\thandleSlotSelect,\n\t};\n}\n","/**\n * useCalendarTimeConfig - Time Configuration Hook\n *\n * Convenience hook that provides access to time-related preferences\n * from the calendar context. Matches agenda-v2 naming conventions.\n *\n * @example\n * ```tsx\n * function TimeSettings() {\n * const {\n * visibleHours,\n * setVisibleHours,\n * workingHours,\n * setWorkingHours,\n * slotDuration,\n * setSlotDuration,\n * showWorkingHoursOnly,\n * setShowWorkingHoursOnly,\n * } = useCalendarTimeConfig();\n *\n * return (\n * <div>\n * <p>Visible: {visibleHours.from}:00 - {visibleHours.to}:00</p>\n * <p>Slot duration: {slotDuration} minutes</p>\n * </div>\n * );\n * }\n * ```\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { useCalendarContext } from '../context/calendar-context';\nimport type { IVisibleHoursConfig, TWorkingHoursConfig } from '../preferences/types';\nimport type { TSlotDuration } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseCalendarTimeConfigReturn {\n\t/** Current visible hours range */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Update visible hours */\n\tsetVisibleHours: (hours: IVisibleHoursConfig) => void;\n\t/** Current working hours configuration */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Update working hours */\n\tsetWorkingHours: (hours: TWorkingHoursConfig) => void;\n\t/** Current slot duration in minutes */\n\tslotDuration: TSlotDuration;\n\t/** Update slot duration */\n\tsetSlotDuration: (duration: TSlotDuration) => void;\n\t/** Whether to show only working hours */\n\tshowWorkingHoursOnly: boolean;\n\t/** Toggle show working hours only */\n\tsetShowWorkingHoursOnly: (show: boolean) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Get time configuration from calendar context\n *\n * Provides a focused subset of calendar preferences related to time display.\n * All setters will update the underlying preferences in the calendar context.\n *\n * Note: This hook maps the core preferences (startHour/endHour) to the\n * agenda-v2 naming convention (visibleHours.from/to, workingHours).\n */\nexport function useCalendarTimeConfig(): UseCalendarTimeConfigReturn {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\n\t// Map core preferences to visible hours format\n\tconst visibleHours = useMemo<IVisibleHoursConfig>(\n\t\t() => ({\n\t\t\tfrom: preferences.startHour,\n\t\t\tto: preferences.endHour,\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\t// Default working hours based on visible hours (can be extended later)\n\tconst workingHours = useMemo<TWorkingHoursConfig>(\n\t\t() => ({\n\t\t\t// Default: Mon-Fri same hours\n\t\t\t1: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t2: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t3: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t4: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t5: { from: preferences.startHour, to: preferences.endHour },\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\tconst setVisibleHours = useCallback(\n\t\t(hours: IVisibleHoursConfig) => {\n\t\t\tsetPreferences({\n\t\t\t\tstartHour: hours.from,\n\t\t\t\tendHour: hours.to,\n\t\t\t});\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setWorkingHours = useCallback(\n\t\t(_hours: TWorkingHoursConfig) => {\n\t\t\t// Working hours per-day config would need to be added to core preferences\n\t\t\t// For now, we use the first available day's hours to set visible hours\n\t\t\tconst firstDay = Object.values(_hours)[0];\n\t\t\tif (firstDay) {\n\t\t\t\tsetPreferences({\n\t\t\t\t\tstartHour: firstDay.from,\n\t\t\t\t\tendHour: firstDay.to,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setSlotDuration = useCallback(\n\t\t(duration: TSlotDuration) => {\n\t\t\tsetPreferences({ slotDuration: duration });\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setShowWorkingHoursOnly = useCallback((_show: boolean) => {\n\t\t// This would need to be added to ICalendarPreferences\n\t\t// For now, this is a no-op but provides the API surface\n\t\tconsole.warn('showWorkingHoursOnly is not yet supported in core preferences');\n\t}, []);\n\n\treturn {\n\t\tvisibleHours,\n\t\tsetVisibleHours,\n\t\tworkingHours,\n\t\tsetWorkingHours,\n\t\tslotDuration: preferences.slotDuration as TSlotDuration,\n\t\tsetSlotDuration,\n\t\tshowWorkingHoursOnly: false, // Default until added to core preferences\n\t\tsetShowWorkingHoursOnly,\n\t};\n}\n","/**\n * usePreferences - Calendar Preferences Hook\n *\n * Manages user preferences with optional localStorage persistence.\n */\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type { ICalendarPreferences } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UsePreferencesOptions {\n\t/** Initial preferences (overrides defaults) */\n\tinitial?: Partial<ICalendarPreferences>;\n\t/** Storage key for persistence (if provided, uses localStorage) */\n\tstorageKey?: string;\n\t/** Callback when preferences change */\n\tonChange?: (preferences: ICalendarPreferences) => void;\n}\n\nexport interface UsePreferencesReturn {\n\t/** Current preferences */\n\tpreferences: ICalendarPreferences;\n\t/** Update preferences */\n\tsetPreferences: (updates: Partial<ICalendarPreferences>) => void;\n\t/** Reset to defaults */\n\tresetPreferences: () => void;\n\t/** Get a specific preference */\n\tgetPreference: <K extends keyof ICalendarPreferences>(key: K) => ICalendarPreferences[K];\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function usePreferences(options: UsePreferencesOptions = {}): UsePreferencesReturn {\n\tconst { initial = {}, storageKey, onChange } = options;\n\n\t// Load from storage or use defaults\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tconst stored = localStorage.getItem(storageKey);\n\t\t\t\tif (stored) {\n\t\t\t\t\tconst parsed = JSON.parse(stored) as Partial<ICalendarPreferences>;\n\t\t\t\t\treturn { ...DEFAULT_PREFERENCES, ...parsed, ...initial };\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore parsing errors\n\t\t\t}\n\t\t}\n\t\treturn { ...DEFAULT_PREFERENCES, ...initial };\n\t});\n\n\t// Persist to storage when preferences change\n\tuseEffect(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tlocalStorage.setItem(storageKey, JSON.stringify(preferences));\n\t\t\t} catch {\n\t\t\t\t// Ignore storage errors\n\t\t\t}\n\t\t}\n\t}, [preferences, storageKey]);\n\n\tconst setPreferences = useCallback(\n\t\t(updates: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onChange]\n\t);\n\n\tconst resetPreferences = useCallback(() => {\n\t\tconst defaults = { ...DEFAULT_PREFERENCES, ...initial };\n\t\tsetPreferencesState(defaults);\n\t\tonChange?.(defaults);\n\t}, [initial, onChange]);\n\n\tconst getPreference = useCallback(\n\t\t<K extends keyof ICalendarPreferences>(key: K): ICalendarPreferences[K] => {\n\t\t\treturn preferences[key];\n\t\t},\n\t\t[preferences]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tgetPreference,\n\t};\n}\n","/**\n * useSlotSelection - Drag-to-Select Hook\n *\n * Handles mouse/touch interactions for creating events by\n * selecting time slots in the calendar grid.\n */\n\nimport { useCallback, useRef, useState } from 'react';\nimport { DEFAULT_HOUR_HEIGHT } from '../constants';\nimport type { ISelectionResult, ISlotSelection, IVisibleHours } from '../types';\nimport { addMinutes } from '../utils/date-utils';\nimport { yToTime } from '../utils/position-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseSlotSelectionOptions {\n\t/** Current day being selected on */\n\tdayStart: Date;\n\t/** Visible hours configuration */\n\tvisibleHours: IVisibleHours;\n\t/** Height of one hour in pixels */\n\thourHeight?: number;\n\t/** Slot duration in minutes for snapping */\n\tslotDuration?: number;\n\t/** Resource ID (for resource views) */\n\tresourceId?: string;\n\t/** Whether selection is enabled */\n\tenabled?: boolean;\n\t/** Callback when selection completes */\n\tonSelect?: (selection: ISelectionResult) => void;\n}\n\nexport interface UseSlotSelectionReturn {\n\t/** Current selection state */\n\tselection: ISlotSelection;\n\t/** Selection overlay for rendering */\n\toverlay: { top: number; height: number; visible: boolean };\n\t/** Handler for mouse/touch down */\n\thandlePointerDown: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch move */\n\thandlePointerMove: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch up */\n\thandlePointerUp: () => void;\n\t/** Cancel current selection */\n\tcancel: () => void;\n\t/** Whether currently selecting */\n\tisSelecting: boolean;\n}\n\n// ============================================================================\n// INITIAL STATE\n// ============================================================================\n\nconst INITIAL_SELECTION: ISlotSelection = {\n\tisSelecting: false,\n\tstartDate: null,\n\tendDate: null,\n\tstartY: null,\n\tcurrentY: null,\n\tresourceId: undefined,\n};\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useSlotSelection(options: UseSlotSelectionOptions): UseSlotSelectionReturn {\n\tconst {\n\t\tdayStart,\n\t\tvisibleHours,\n\t\thourHeight = DEFAULT_HOUR_HEIGHT,\n\t\tslotDuration = 30,\n\t\tresourceId,\n\t\tenabled = true,\n\t\tonSelect,\n\t} = options;\n\n\tconst [selection, setSelection] = useState<ISlotSelection>(INITIAL_SELECTION);\n\tconst containerHeightRef = useRef<number>(0);\n\n\t// ========================================================================\n\t// HANDLERS\n\t// ========================================================================\n\n\tconst handlePointerDown = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!enabled) return;\n\n\t\t\tconst y = e.clientY - containerRect.top;\n\t\t\tcontainerHeightRef.current = containerRect.height;\n\n\t\t\tconst startTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection({\n\t\t\t\tisSelecting: true,\n\t\t\t\tstartDate: startTime,\n\t\t\t\tendDate: addMinutes(startTime, slotDuration),\n\t\t\t\tstartY: y,\n\t\t\t\tcurrentY: y,\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t},\n\t\t[enabled, dayStart, visibleHours, hourHeight, slotDuration, resourceId]\n\t);\n\n\tconst handlePointerMove = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!selection.isSelecting || !selection.startY) return;\n\n\t\t\tconst y = Math.max(0, Math.min(e.clientY - containerRect.top, containerRect.height));\n\t\t\tconst currentTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection((prev) => {\n\t\t\t\tif (!prev.startDate) return prev;\n\n\t\t\t\t// Determine if dragging up or down\n\t\t\t\tconst isDraggingDown = y >= (prev.startY ?? 0);\n\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tcurrentY: y,\n\t\t\t\t\tendDate: isDraggingDown ? addMinutes(currentTime, slotDuration) : currentTime,\n\t\t\t\t\tstartDate: isDraggingDown ? prev.startDate : currentTime,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\t[selection.isSelecting, selection.startY, dayStart, visibleHours, hourHeight, slotDuration]\n\t);\n\n\tconst handlePointerUp = useCallback(() => {\n\t\tif (!selection.isSelecting || !selection.startDate || !selection.endDate) {\n\t\t\tsetSelection(INITIAL_SELECTION);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure start is before end\n\t\tconst start = selection.startDate < selection.endDate ? selection.startDate : selection.endDate;\n\t\tconst end = selection.startDate < selection.endDate ? selection.endDate : selection.startDate;\n\n\t\tconst result: ISelectionResult = {\n\t\t\tstartDate: start,\n\t\t\tendDate: end,\n\t\t\tresourceId: selection.resourceId,\n\t\t};\n\n\t\tonSelect?.(result);\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, [selection, onSelect]);\n\n\tconst cancel = useCallback(() => {\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, []);\n\n\t// ========================================================================\n\t// OVERLAY CALCULATION\n\t// ========================================================================\n\n\tconst overlay = (() => {\n\t\tif (!selection.isSelecting || selection.startY === null || selection.currentY === null) {\n\t\t\treturn { top: 0, height: 0, visible: false };\n\t\t}\n\n\t\tconst minY = Math.min(selection.startY, selection.currentY);\n\t\tconst maxY = Math.max(selection.startY, selection.currentY);\n\n\t\treturn {\n\t\t\ttop: minY,\n\t\t\theight: Math.max(maxY - minY, 20), // Minimum height\n\t\t\tvisible: true,\n\t\t};\n\t})();\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\tselection,\n\t\toverlay,\n\t\thandlePointerDown,\n\t\thandlePointerMove,\n\t\thandlePointerUp,\n\t\tcancel,\n\t\tisSelecting: selection.isSelecting,\n\t};\n}\n"],"names":["CalendarContext","createContext","CalendarProvider","children","value","jsx","useCalendarContext","context","useContext","useOptionalCalendarContext","useCalendarView","view","setView","useCalendarDate","currentDate","setCurrentDate","goToNext","goToPrev","goToToday","goToDate","useCalendarEvents","events","filteredEvents","useCalendarFilters","filters","setFilters","updateFilters","clearFilters","useCalendarPreferences","preferences","setPreferences","useCalendar","options","resources","scheduleTypes","initialView","initialDate","initialFilters","userPreferences","lockedPreferences","locale","onViewChange","onDateChange","onEventClick","onSlotSelect","onFiltersChange","setViewState","useState","setCurrentDateState","setFiltersState","setPreferencesState","DEFAULT_PREFERENCES","dateRange","useMemo","getViewDateRange","viewTitle","getViewTitle","result","filterEventsByDateRange","scheduleTypeIds","filterEventsByScheduleType","resourceIds","filterEventsByResource","search","filterEventsBySearch","filterOutCanceled","sortEventsByStart","useCallback","newView","date","newDate","navigateNext","navigatePrev","navigateToday","newFilters","updates","prev","next","emptyFilters","prefs","handleEventClick","event","handleSlotSelect","selection","useCalendarTimeConfig","visibleHours","workingHours","setVisibleHours","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","initial","storageKey","onChange","stored","parsed","useEffect","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","cancel","overlay","minY","maxY"],"mappings":";;;AAmBA,MAAMA,IAAkBC,EAA4D,MAAS;AAetF,SAASC,GAId,EAAE,UAAAC,GAAU,OAAAC,KAA8E;AAC3F,SAAO,gBAAAC,GAACL,EAAgB,UAAhB,EAAyB,OAAAI,GAAe,UAAAD,EAAA,CAAS;AAC1D;AASO,SAASG,IAIqD;AACpE,QAAMC,IAAUC,EAAWR,CAAe;AAC1C,MAAI,CAACO;AACJ,UAAM,IAAI,MAAM,2DAA2D;AAE5E,SAAOA;AACR;AAKO,SAASE,KAIiE;AAEhF,SADgBD,EAAWR,CAAe;AAE3C;AASO,SAASU,KAAkB;AACjC,QAAM,EAAE,MAAAC,GAAM,SAAAC,EAAA,IAAYN,EAAA;AAC1B,SAAO,EAAE,MAAAK,GAAM,SAAAC,EAAA;AAChB;AAKO,SAASC,KAAkB;AACjC,QAAM,EAAE,aAAAC,GAAa,gBAAAC,GAAgB,UAAAC,GAAU,UAAAC,GAAU,WAAAC,GAAW,UAAAC,EAAA,IACnEb,EAAA;AACD,SAAO,EAAE,aAAAQ,GAAa,gBAAAC,GAAgB,UAAAC,GAAU,UAAAC,GAAU,WAAAC,GAAW,UAAAC,EAAA;AACtE;AAKO,SAASC,KAA0D;AACzE,QAAM,EAAE,QAAAC,GAAQ,gBAAAC,EAAA,IAAmBhB,EAAA;AACnC,SAAO,EAAE,QAAAe,GAAQ,gBAAAC,EAAA;AAClB;AAKO,SAASC,KAAqB;AACpC,QAAM,EAAE,SAAAC,GAAS,YAAAC,GAAY,eAAAC,GAAe,cAAAC,EAAA,IAAiBrB,EAAA;AAC7D,SAAO,EAAE,SAAAkB,GAAS,YAAAC,GAAY,eAAAC,GAA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IAAA;AAGvB,IAAAgC,IAAW1D,CAAM,GACjB2D,EAAaT,CAAiB;AAAA,EAC/B,GAAG,CAACxB,GAAWgC,CAAQ,CAAC,GAElBiB,IAASjE,EAAY,MAAM;AAChC,IAAAiD,EAAaT,CAAiB;AAAA,EAC/B,GAAG,CAAA,CAAE,GAMC0B,KAAW,MAAM;AACtB,QAAI,CAAClD,EAAU,eAAeA,EAAU,WAAW,QAAQA,EAAU,aAAa;AACjF,aAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAA;AAGtC,UAAMmD,IAAO,KAAK,IAAInD,EAAU,QAAQA,EAAU,QAAQ,GACpDoD,IAAO,KAAK,IAAIpD,EAAU,QAAQA,EAAU,QAAQ;AAE1D,WAAO;AAAA,MACN,KAAKmD;AAAA,MACL,QAAQ,KAAK,IAAIC,IAAOD,GAAM,EAAE;AAAA;AAAA,MAChC,SAAS;AAAA,IAAA;AAAA,EAEX,GAAA;AAMA,SAAO;AAAA,IACN,WAAAnD;AAAA,IACA,SAAAkD;AAAA,IACA,mBAAAd;AAAA,IACA,mBAAAO;AAAA,IACA,iBAAAG;AAAA,IACA,QAAAG;AAAA,IACA,aAAajD,EAAU;AAAA,EAAA;AAEzB;"}
|
|
1
|
+
{"version":3,"file":"use-slot-selection-CT1z9v9X.js","sources":["../src/core/context/calendar-context.tsx","../src/core/hooks/use-calendar.ts","../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\n * CalendarContext - React Context for Calendar State\n *\n * Provides calendar state to deeply nested components without prop drilling.\n */\n\nimport { createContext, type ReactNode, useContext } from 'react';\nimport type { UseCalendarReturn } from '../hooks/use-calendar';\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n/**\n * Calendar context type - generic to support any event data type\n * We use `any` here because context consumers may not know the exact type\n * Use the typed hooks below for type-safe access\n */\n// biome-ignore lint/suspicious/noExplicitAny: Context needs to be flexible for different event types\nconst CalendarContext = createContext<UseCalendarReturn<any, any, any> | undefined>(undefined);\n\n// ============================================================================\n// PROVIDER\n// ============================================================================\n\nexport interface CalendarProviderProps<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\tchildren: ReactNode;\n\tvalue: UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\nexport function CalendarProvider<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>({ children, value }: CalendarProviderProps<TEventData, TScheduleTypeData, TResourceData>) {\n\treturn <CalendarContext.Provider value={value}>{children}</CalendarContext.Provider>;\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context (throws if not in provider)\n */\nexport function useCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst context = useContext(CalendarContext);\n\tif (!context) {\n\t\tthrow new Error('useCalendarContext must be used within a CalendarProvider');\n\t}\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData>;\n}\n\n/**\n * Get the calendar context or undefined (safe version)\n */\nexport function useOptionalCalendarContext<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined {\n\tconst context = useContext(CalendarContext);\n\treturn context as UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> | undefined;\n}\n\n// ============================================================================\n// CONVENIENCE HOOKS\n// ============================================================================\n\n/**\n * Get current view\n */\nexport function useCalendarView() {\n\tconst { view, setView } = useCalendarContext();\n\treturn { view, setView };\n}\n\n/**\n * Get current date and navigation\n */\nexport function useCalendarDate() {\n\tconst { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate } =\n\t\tuseCalendarContext();\n\treturn { currentDate, setCurrentDate, goToNext, goToPrev, goToToday, goToDate };\n}\n\n/**\n * Get filtered events\n */\nexport function useCalendarEvents<TEventData = Record<string, unknown>>() {\n\tconst { events, filteredEvents } = useCalendarContext<TEventData>();\n\treturn { events, filteredEvents };\n}\n\n/**\n * Get filters\n */\nexport function useCalendarFilters() {\n\tconst { filters, setFilters, updateFilters, clearFilters } = useCalendarContext();\n\treturn { filters, setFilters, updateFilters, clearFilters };\n}\n\n/**\n * Get preferences\n */\nexport function useCalendarPreferences() {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\treturn { preferences, setPreferences };\n}\n\n// ============================================================================\n// ALIASES (for agenda-v2 naming convention compatibility)\n// ============================================================================\n\n/**\n * Alias for useCalendarContext - matches agenda-v2 naming convention\n */\nexport { useCalendarContext as useCalendar };\n\n/**\n * Alias for useOptionalCalendarContext - matches agenda-v2 naming convention\n */\nexport { useOptionalCalendarContext as useOptionalCalendar };\n","/**\n * useCalendar - Main Calendar Hook\n *\n * This hook provides all the state and methods needed to build a calendar.\n * It is fully generic, allowing consumers to define their own event data types.\n *\n * @example\n * ```tsx\n * interface MyEventData {\n * projectId: number;\n * priority: 'low' | 'medium' | 'high';\n * }\n *\n * const calendar = useCalendar<MyEventData>({\n * events: myEvents,\n * onEventClick: (event) => {\n * console.log(event.data?.projectId);\n * },\n * });\n * ```\n */\n\nimport { useCallback, useMemo, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type {\n\tCalendarEvent,\n\tICalendarFilters,\n\tICalendarPreferences,\n\tIDateRange,\n\tIResource,\n\tIScheduleType,\n\tISelectionResult,\n\tTCalendarView,\n} from '../types';\nimport {\n\tfilterEventsByDateRange,\n\tfilterEventsByResource,\n\tfilterEventsByScheduleType,\n\tfilterEventsBySearch,\n\tfilterOutCanceled,\n\tsortEventsByStart,\n} from '../utils/event-utils';\nimport {\n\tgetViewDateRange,\n\tgetViewTitle,\n\tnavigateNext,\n\tnavigatePrev,\n\tnavigateToday,\n} from '../utils/grid-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n/**\n * Options for useCalendar hook\n */\nexport interface UseCalendarOptions<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t/** Events to display */\n\tevents: CalendarEvent<TEventData>[];\n\n\t/** Available resources (for resource views) */\n\tresources?: IResource<TResourceData>[] | undefined;\n\n\t/** Available schedule types */\n\tscheduleTypes?: IScheduleType<TScheduleTypeData>[] | undefined;\n\n\t/** Initial view */\n\tinitialView?: TCalendarView | undefined;\n\n\t/** Initial date */\n\tinitialDate?: Date | undefined;\n\n\t/** Initial filters */\n\tinitialFilters?: ICalendarFilters | undefined;\n\n\t/** User preferences */\n\tpreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locked preferences (cannot be changed by user) */\n\tlockedPreferences?: Partial<ICalendarPreferences> | undefined;\n\n\t/** Locale for formatting */\n\tlocale?: string | undefined;\n\n\t/** Callback when view changes */\n\tonViewChange?: ((view: TCalendarView) => void) | undefined;\n\n\t/** Callback when date changes */\n\tonDateChange?: ((date: Date) => void) | undefined;\n\n\t/** Callback when event is clicked */\n\tonEventClick?: ((event: CalendarEvent<TEventData>) => void) | undefined;\n\n\t/** Callback when slot is selected */\n\tonSlotSelect?: ((selection: ISelectionResult) => void) | undefined;\n\n\t/** Callback when filters change */\n\tonFiltersChange?: ((filters: ICalendarFilters) => void) | undefined;\n}\n\n/**\n * Return type for useCalendar hook\n */\nexport interface UseCalendarReturn<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n> {\n\t// State\n\tview: TCalendarView;\n\tcurrentDate: Date;\n\tdateRange: IDateRange;\n\tfilters: ICalendarFilters;\n\tpreferences: ICalendarPreferences;\n\n\t// Computed\n\tfilteredEvents: CalendarEvent<TEventData>[];\n\tviewTitle: string;\n\n\t// Data\n\tevents: CalendarEvent<TEventData>[];\n\tresources: IResource<TResourceData>[];\n\tscheduleTypes: IScheduleType<TScheduleTypeData>[];\n\n\t// Actions\n\tsetView: (view: TCalendarView) => void;\n\tsetCurrentDate: (date: Date) => void;\n\tgoToNext: () => void;\n\tgoToPrev: () => void;\n\tgoToToday: () => void;\n\tgoToDate: (date: Date) => void;\n\n\t// Filters\n\tsetFilters: (filters: ICalendarFilters) => void;\n\tupdateFilters: (updates: Partial<ICalendarFilters>) => void;\n\tclearFilters: () => void;\n\n\t// Preferences\n\tsetPreferences: (prefs: Partial<ICalendarPreferences>) => void;\n\n\t// Event handlers\n\thandleEventClick: (event: CalendarEvent<TEventData>) => void;\n\thandleSlotSelect: (selection: ISelectionResult) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useCalendar<\n\tTEventData = Record<string, unknown>,\n\tTScheduleTypeData = Record<string, unknown>,\n\tTResourceData = Record<string, unknown>,\n>(\n\toptions: UseCalendarOptions<TEventData, TScheduleTypeData, TResourceData>\n): UseCalendarReturn<TEventData, TScheduleTypeData, TResourceData> {\n\tconst {\n\t\tevents,\n\t\tresources = [],\n\t\tscheduleTypes = [],\n\t\tinitialView = 'week',\n\t\tinitialDate,\n\t\tinitialFilters = {},\n\t\tpreferences: userPreferences = {},\n\t\tlockedPreferences = {},\n\t\tlocale = 'en-US',\n\t\tonViewChange,\n\t\tonDateChange,\n\t\tonEventClick,\n\t\tonSlotSelect,\n\t\tonFiltersChange,\n\t} = options;\n\n\t// ========================================================================\n\t// STATE\n\t// ========================================================================\n\n\tconst [view, setViewState] = useState<TCalendarView>(initialView);\n\tconst [currentDate, setCurrentDateState] = useState<Date>(() => initialDate ?? new Date());\n\tconst [filters, setFiltersState] = useState<ICalendarFilters>(initialFilters);\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => ({\n\t\t...DEFAULT_PREFERENCES,\n\t\t...userPreferences,\n\t\t...lockedPreferences,\n\t}));\n\n\t// ========================================================================\n\t// COMPUTED\n\t// ========================================================================\n\n\tconst dateRange = useMemo(\n\t\t() => getViewDateRange(currentDate, view, preferences.firstDayOfWeek),\n\t\t[currentDate, view, preferences.firstDayOfWeek]\n\t);\n\n\tconst viewTitle = useMemo(\n\t\t() => getViewTitle(currentDate, view, locale),\n\t\t[currentDate, view, locale]\n\t);\n\n\tconst filteredEvents = useMemo(() => {\n\t\tlet result = [...events];\n\n\t\t// Filter by date range\n\t\tresult = filterEventsByDateRange(result, dateRange.startDate, dateRange.endDate);\n\n\t\t// Filter by schedule types\n\t\tconst scheduleTypeIds = filters.scheduleTypeIds;\n\t\tif (scheduleTypeIds && scheduleTypeIds.length > 0) {\n\t\t\tresult = filterEventsByScheduleType(result, scheduleTypeIds);\n\t\t}\n\n\t\t// Filter by resources\n\t\tconst resourceIds = filters.resourceIds;\n\t\tif (resourceIds && resourceIds.length > 0) {\n\t\t\tresult = filterEventsByResource(result, resourceIds);\n\t\t}\n\n\t\t// Filter by search\n\t\tconst search = filters.search;\n\t\tif (search) {\n\t\t\tresult = filterEventsBySearch(result, search);\n\t\t}\n\n\t\t// Filter canceled\n\t\tif (!preferences.showCanceledEvents) {\n\t\t\tresult = filterOutCanceled(result);\n\t\t}\n\n\t\t// Sort by start date\n\t\treturn sortEventsByStart(result);\n\t}, [events, dateRange, filters, preferences.showCanceledEvents]);\n\n\t// ========================================================================\n\t// ACTIONS\n\t// ========================================================================\n\n\tconst setView = useCallback(\n\t\t(newView: TCalendarView) => {\n\t\t\tsetViewState(newView);\n\t\t\tonViewChange?.(newView);\n\t\t},\n\t\t[onViewChange]\n\t);\n\n\tconst setCurrentDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDateState(date);\n\t\t\tonDateChange?.(date);\n\t\t},\n\t\t[onDateChange]\n\t);\n\n\tconst goToNext = useCallback(() => {\n\t\tconst newDate = navigateNext(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToPrev = useCallback(() => {\n\t\tconst newDate = navigatePrev(currentDate, view);\n\t\tsetCurrentDate(newDate);\n\t}, [currentDate, view, setCurrentDate]);\n\n\tconst goToToday = useCallback(() => {\n\t\tsetCurrentDate(navigateToday());\n\t}, [setCurrentDate]);\n\n\tconst goToDate = useCallback(\n\t\t(date: Date) => {\n\t\t\tsetCurrentDate(date);\n\t\t},\n\t\t[setCurrentDate]\n\t);\n\n\t// ========================================================================\n\t// FILTERS\n\t// ========================================================================\n\n\tconst setFilters = useCallback(\n\t\t(newFilters: ICalendarFilters) => {\n\t\t\tsetFiltersState(newFilters);\n\t\t\tonFiltersChange?.(newFilters);\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst updateFilters = useCallback(\n\t\t(updates: Partial<ICalendarFilters>) => {\n\t\t\tsetFiltersState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonFiltersChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onFiltersChange]\n\t);\n\n\tconst clearFilters = useCallback(() => {\n\t\tconst emptyFilters: ICalendarFilters = {};\n\t\tsetFiltersState(emptyFilters);\n\t\tonFiltersChange?.(emptyFilters);\n\t}, [onFiltersChange]);\n\n\t// ========================================================================\n\t// PREFERENCES\n\t// ========================================================================\n\n\tconst setPreferences = useCallback(\n\t\t(prefs: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => ({\n\t\t\t\t...prev,\n\t\t\t\t...prefs,\n\t\t\t\t...lockedPreferences, // Locked prefs always override\n\t\t\t}));\n\t\t},\n\t\t[lockedPreferences]\n\t);\n\n\t// ========================================================================\n\t// EVENT HANDLERS\n\t// ========================================================================\n\n\tconst handleEventClick = useCallback(\n\t\t(event: CalendarEvent<TEventData>) => {\n\t\t\tonEventClick?.(event);\n\t\t},\n\t\t[onEventClick]\n\t);\n\n\tconst handleSlotSelect = useCallback(\n\t\t(selection: ISelectionResult) => {\n\t\t\tonSlotSelect?.(selection);\n\t\t},\n\t\t[onSlotSelect]\n\t);\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\t// State\n\t\tview,\n\t\tcurrentDate,\n\t\tdateRange,\n\t\tfilters,\n\t\tpreferences,\n\n\t\t// Computed\n\t\tfilteredEvents,\n\t\tviewTitle,\n\n\t\t// Data\n\t\tevents,\n\t\tresources,\n\t\tscheduleTypes,\n\n\t\t// Actions\n\t\tsetView,\n\t\tsetCurrentDate,\n\t\tgoToNext,\n\t\tgoToPrev,\n\t\tgoToToday,\n\t\tgoToDate,\n\n\t\t// Filters\n\t\tsetFilters,\n\t\tupdateFilters,\n\t\tclearFilters,\n\n\t\t// Preferences\n\t\tsetPreferences,\n\n\t\t// Event handlers\n\t\thandleEventClick,\n\t\thandleSlotSelect,\n\t};\n}\n","/**\n * useCalendarTimeConfig - Time Configuration Hook\n *\n * Convenience hook that provides access to time-related preferences\n * from the calendar context. Matches agenda-v2 naming conventions.\n *\n * @example\n * ```tsx\n * function TimeSettings() {\n * const {\n * visibleHours,\n * setVisibleHours,\n * workingHours,\n * setWorkingHours,\n * slotDuration,\n * setSlotDuration,\n * showWorkingHoursOnly,\n * setShowWorkingHoursOnly,\n * } = useCalendarTimeConfig();\n *\n * return (\n * <div>\n * <p>Visible: {visibleHours.from}:00 - {visibleHours.to}:00</p>\n * <p>Slot duration: {slotDuration} minutes</p>\n * </div>\n * );\n * }\n * ```\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { useCalendarContext } from '../context/calendar-context';\nimport type { IVisibleHoursConfig, TWorkingHoursConfig } from '../preferences/types';\nimport type { TSlotDuration } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseCalendarTimeConfigReturn {\n\t/** Current visible hours range */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Update visible hours */\n\tsetVisibleHours: (hours: IVisibleHoursConfig) => void;\n\t/** Current working hours configuration */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Update working hours */\n\tsetWorkingHours: (hours: TWorkingHoursConfig) => void;\n\t/** Current slot duration in minutes */\n\tslotDuration: TSlotDuration;\n\t/** Update slot duration */\n\tsetSlotDuration: (duration: TSlotDuration) => void;\n\t/** Whether to show only working hours */\n\tshowWorkingHoursOnly: boolean;\n\t/** Toggle show working hours only */\n\tsetShowWorkingHoursOnly: (show: boolean) => void;\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Get time configuration from calendar context\n *\n * Provides a focused subset of calendar preferences related to time display.\n * All setters will update the underlying preferences in the calendar context.\n *\n * Note: This hook maps the core preferences (startHour/endHour) to the\n * agenda-v2 naming convention (visibleHours.from/to, workingHours).\n */\nexport function useCalendarTimeConfig(): UseCalendarTimeConfigReturn {\n\tconst { preferences, setPreferences } = useCalendarContext();\n\n\t// Map core preferences to visible hours format\n\tconst visibleHours = useMemo<IVisibleHoursConfig>(\n\t\t() => ({\n\t\t\tfrom: preferences.startHour,\n\t\t\tto: preferences.endHour,\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\t// Default working hours based on visible hours (can be extended later)\n\tconst workingHours = useMemo<TWorkingHoursConfig>(\n\t\t() => ({\n\t\t\t// Default: Mon-Fri same hours\n\t\t\t1: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t2: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t3: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t4: { from: preferences.startHour, to: preferences.endHour },\n\t\t\t5: { from: preferences.startHour, to: preferences.endHour },\n\t\t}),\n\t\t[preferences.startHour, preferences.endHour]\n\t);\n\n\tconst setVisibleHours = useCallback(\n\t\t(hours: IVisibleHoursConfig) => {\n\t\t\tsetPreferences({\n\t\t\t\tstartHour: hours.from,\n\t\t\t\tendHour: hours.to,\n\t\t\t});\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setWorkingHours = useCallback(\n\t\t(_hours: TWorkingHoursConfig) => {\n\t\t\t// Working hours per-day config would need to be added to core preferences\n\t\t\t// For now, we use the first available day's hours to set visible hours\n\t\t\tconst firstDay = Object.values(_hours)[0];\n\t\t\tif (firstDay) {\n\t\t\t\tsetPreferences({\n\t\t\t\t\tstartHour: firstDay.from,\n\t\t\t\t\tendHour: firstDay.to,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setSlotDuration = useCallback(\n\t\t(duration: TSlotDuration) => {\n\t\t\tsetPreferences({ slotDuration: duration });\n\t\t},\n\t\t[setPreferences]\n\t);\n\n\tconst setShowWorkingHoursOnly = useCallback((_show: boolean) => {\n\t\t// This would need to be added to ICalendarPreferences\n\t\t// For now, this is a no-op but provides the API surface\n\t\tconsole.warn('showWorkingHoursOnly is not yet supported in core preferences');\n\t}, []);\n\n\treturn {\n\t\tvisibleHours,\n\t\tsetVisibleHours,\n\t\tworkingHours,\n\t\tsetWorkingHours,\n\t\tslotDuration: preferences.slotDuration as TSlotDuration,\n\t\tsetSlotDuration,\n\t\tshowWorkingHoursOnly: false, // Default until added to core preferences\n\t\tsetShowWorkingHoursOnly,\n\t};\n}\n","/**\n * usePreferences - Calendar Preferences Hook\n *\n * Manages user preferences with optional localStorage persistence.\n */\n\nimport { useCallback, useEffect, useState } from 'react';\nimport { DEFAULT_PREFERENCES } from '../constants';\nimport type { ICalendarPreferences } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UsePreferencesOptions {\n\t/** Initial preferences (overrides defaults) */\n\tinitial?: Partial<ICalendarPreferences>;\n\t/** Storage key for persistence (if provided, uses localStorage) */\n\tstorageKey?: string;\n\t/** Callback when preferences change */\n\tonChange?: (preferences: ICalendarPreferences) => void;\n}\n\nexport interface UsePreferencesReturn {\n\t/** Current preferences */\n\tpreferences: ICalendarPreferences;\n\t/** Update preferences */\n\tsetPreferences: (updates: Partial<ICalendarPreferences>) => void;\n\t/** Reset to defaults */\n\tresetPreferences: () => void;\n\t/** Get a specific preference */\n\tgetPreference: <K extends keyof ICalendarPreferences>(key: K) => ICalendarPreferences[K];\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function usePreferences(options: UsePreferencesOptions = {}): UsePreferencesReturn {\n\tconst { initial = {}, storageKey, onChange } = options;\n\n\t// Load from storage or use defaults\n\tconst [preferences, setPreferencesState] = useState<ICalendarPreferences>(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tconst stored = localStorage.getItem(storageKey);\n\t\t\t\tif (stored) {\n\t\t\t\t\tconst parsed = JSON.parse(stored) as Partial<ICalendarPreferences>;\n\t\t\t\t\treturn { ...DEFAULT_PREFERENCES, ...parsed, ...initial };\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore parsing errors\n\t\t\t}\n\t\t}\n\t\treturn { ...DEFAULT_PREFERENCES, ...initial };\n\t});\n\n\t// Persist to storage when preferences change\n\tuseEffect(() => {\n\t\tif (storageKey && typeof window !== 'undefined') {\n\t\t\ttry {\n\t\t\t\tlocalStorage.setItem(storageKey, JSON.stringify(preferences));\n\t\t\t} catch {\n\t\t\t\t// Ignore storage errors\n\t\t\t}\n\t\t}\n\t}, [preferences, storageKey]);\n\n\tconst setPreferences = useCallback(\n\t\t(updates: Partial<ICalendarPreferences>) => {\n\t\t\tsetPreferencesState((prev) => {\n\t\t\t\tconst next = { ...prev, ...updates };\n\t\t\t\tonChange?.(next);\n\t\t\t\treturn next;\n\t\t\t});\n\t\t},\n\t\t[onChange]\n\t);\n\n\tconst resetPreferences = useCallback(() => {\n\t\tconst defaults = { ...DEFAULT_PREFERENCES, ...initial };\n\t\tsetPreferencesState(defaults);\n\t\tonChange?.(defaults);\n\t}, [initial, onChange]);\n\n\tconst getPreference = useCallback(\n\t\t<K extends keyof ICalendarPreferences>(key: K): ICalendarPreferences[K] => {\n\t\t\treturn preferences[key];\n\t\t},\n\t\t[preferences]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tgetPreference,\n\t};\n}\n","/**\n * useSlotSelection - Drag-to-Select Hook\n *\n * Handles mouse/touch interactions for creating events by\n * selecting time slots in the calendar grid.\n */\n\nimport { useCallback, useRef, useState } from 'react';\nimport { DEFAULT_HOUR_HEIGHT } from '../constants';\nimport type { ISelectionResult, ISlotSelection, IVisibleHours } from '../types';\nimport { addMinutes } from '../utils/date-utils';\nimport { yToTime } from '../utils/position-utils';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface UseSlotSelectionOptions {\n\t/** Current day being selected on */\n\tdayStart: Date;\n\t/** Visible hours configuration */\n\tvisibleHours: IVisibleHours;\n\t/** Height of one hour in pixels */\n\thourHeight?: number;\n\t/** Slot duration in minutes for snapping */\n\tslotDuration?: number;\n\t/** Resource ID (for resource views) */\n\tresourceId?: string;\n\t/** Whether selection is enabled */\n\tenabled?: boolean;\n\t/** Callback when selection completes */\n\tonSelect?: (selection: ISelectionResult) => void;\n}\n\nexport interface UseSlotSelectionReturn {\n\t/** Current selection state */\n\tselection: ISlotSelection;\n\t/** Selection overlay for rendering */\n\toverlay: { top: number; height: number; visible: boolean };\n\t/** Handler for mouse/touch down */\n\thandlePointerDown: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch move */\n\thandlePointerMove: (e: React.PointerEvent, containerRect: DOMRect) => void;\n\t/** Handler for mouse/touch up */\n\thandlePointerUp: () => void;\n\t/** Cancel current selection */\n\tcancel: () => void;\n\t/** Whether currently selecting */\n\tisSelecting: boolean;\n}\n\n// ============================================================================\n// INITIAL STATE\n// ============================================================================\n\nconst INITIAL_SELECTION: ISlotSelection = {\n\tisSelecting: false,\n\tstartDate: null,\n\tendDate: null,\n\tstartY: null,\n\tcurrentY: null,\n\tresourceId: undefined,\n};\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\nexport function useSlotSelection(options: UseSlotSelectionOptions): UseSlotSelectionReturn {\n\tconst {\n\t\tdayStart,\n\t\tvisibleHours,\n\t\thourHeight = DEFAULT_HOUR_HEIGHT,\n\t\tslotDuration = 30,\n\t\tresourceId,\n\t\tenabled = true,\n\t\tonSelect,\n\t} = options;\n\n\tconst [selection, setSelection] = useState<ISlotSelection>(INITIAL_SELECTION);\n\tconst containerHeightRef = useRef<number>(0);\n\n\t// ========================================================================\n\t// HANDLERS\n\t// ========================================================================\n\n\tconst handlePointerDown = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!enabled) return;\n\n\t\t\tconst y = e.clientY - containerRect.top;\n\t\t\tcontainerHeightRef.current = containerRect.height;\n\n\t\t\tconst startTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection({\n\t\t\t\tisSelecting: true,\n\t\t\t\tstartDate: startTime,\n\t\t\t\tendDate: addMinutes(startTime, slotDuration),\n\t\t\t\tstartY: y,\n\t\t\t\tcurrentY: y,\n\t\t\t\tresourceId,\n\t\t\t});\n\t\t},\n\t\t[enabled, dayStart, visibleHours, hourHeight, slotDuration, resourceId]\n\t);\n\n\tconst handlePointerMove = useCallback(\n\t\t(e: React.PointerEvent, containerRect: DOMRect) => {\n\t\t\tif (!selection.isSelecting || !selection.startY) return;\n\n\t\t\tconst y = Math.max(0, Math.min(e.clientY - containerRect.top, containerRect.height));\n\t\t\tconst currentTime = yToTime(y, dayStart, visibleHours, hourHeight, slotDuration);\n\n\t\t\tsetSelection((prev) => {\n\t\t\t\tif (!prev.startDate) return prev;\n\n\t\t\t\t// Determine if dragging up or down\n\t\t\t\tconst isDraggingDown = y >= (prev.startY ?? 0);\n\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tcurrentY: y,\n\t\t\t\t\tendDate: isDraggingDown ? addMinutes(currentTime, slotDuration) : currentTime,\n\t\t\t\t\tstartDate: isDraggingDown ? prev.startDate : currentTime,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\t[selection.isSelecting, selection.startY, dayStart, visibleHours, hourHeight, slotDuration]\n\t);\n\n\tconst handlePointerUp = useCallback(() => {\n\t\tif (!selection.isSelecting || !selection.startDate || !selection.endDate) {\n\t\t\tsetSelection(INITIAL_SELECTION);\n\t\t\treturn;\n\t\t}\n\n\t\t// Ensure start is before end\n\t\tconst start = selection.startDate < selection.endDate ? selection.startDate : selection.endDate;\n\t\tconst end = selection.startDate < selection.endDate ? selection.endDate : selection.startDate;\n\n\t\tconst result: ISelectionResult = {\n\t\t\tstartDate: start,\n\t\t\tendDate: end,\n\t\t\tresourceId: selection.resourceId,\n\t\t};\n\n\t\tonSelect?.(result);\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, [selection, onSelect]);\n\n\tconst cancel = useCallback(() => {\n\t\tsetSelection(INITIAL_SELECTION);\n\t}, []);\n\n\t// ========================================================================\n\t// OVERLAY CALCULATION\n\t// ========================================================================\n\n\tconst overlay = (() => {\n\t\tif (!selection.isSelecting || selection.startY === null || selection.currentY === null) {\n\t\t\treturn { top: 0, height: 0, visible: false };\n\t\t}\n\n\t\tconst minY = Math.min(selection.startY, selection.currentY);\n\t\tconst maxY = Math.max(selection.startY, selection.currentY);\n\n\t\treturn {\n\t\t\ttop: minY,\n\t\t\theight: Math.max(maxY - minY, 20), // Minimum height\n\t\t\tvisible: true,\n\t\t};\n\t})();\n\n\t// ========================================================================\n\t// RETURN\n\t// ========================================================================\n\n\treturn {\n\t\tselection,\n\t\toverlay,\n\t\thandlePointerDown,\n\t\thandlePointerMove,\n\t\thandlePointerUp,\n\t\tcancel,\n\t\tisSelecting: selection.isSelecting,\n\t};\n}\n"],"names":["CalendarContext","createContext","CalendarProvider","children","value","jsx","useCalendarContext","context","useContext","useOptionalCalendarContext","useCalendarView","view","setView","useCalendarDate","currentDate","setCurrentDate","goToNext","goToPrev","goToToday","goToDate","useCalendarEvents","events","filteredEvents","useCalendarFilters","filters","setFilters","updateFilters","clearFilters","useCalendarPreferences","preferences","setPreferences","useCalendar","options","resources","scheduleTypes","initialView","initialDate","initialFilters","userPreferences","lockedPreferences","locale","onViewChange","onDateChange","onEventClick","onSlotSelect","onFiltersChange","setViewState","useState","setCurrentDateState","setFiltersState","setPreferencesState","DEFAULT_PREFERENCES","dateRange","useMemo","getViewDateRange","viewTitle","getViewTitle","result","filterEventsByDateRange","scheduleTypeIds","filterEventsByScheduleType","resourceIds","filterEventsByResource","search","filterEventsBySearch","filterOutCanceled","sortEventsByStart","useCallback","newView","date","newDate","navigateNext","navigatePrev","navigateToday","newFilters","updates","prev","next","emptyFilters","prefs","handleEventClick","event","handleSlotSelect","selection","useCalendarTimeConfig","visibleHours","workingHours","setVisibleHours","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","initial","storageKey","onChange","stored","parsed","useEffect","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","cancel","overlay","minY","maxY"],"mappings":";;;AAmBA,MAAMA,IAAkBC,EAA4D,MAAS;AAetF,SAASC,GAId,EAAE,UAAAC,GAAU,OAAAC,KAA8E;AAC3F,SAAO,gBAAAC,GAACL,EAAgB,UAAhB,EAAyB,OAAAI,GAAe,UAAAD,EAAA,CAAS;AAC1D;AASO,SAASG,IAIqD;AACpE,QAAMC,IAAUC,EAAWR,CAAe;AAC1C,MAAI,CAACO;AACJ,UAAM,IAAI,MAAM,2DAA2D;AAE5E,SAAOA;AACR;AAKO,SAASE,KAIiE;AAEhF,SADgBD,EAAWR,CAAe;AAE3C;AASO,SAASU,KAAkB;AACjC,QAAM,EAAE,MAAAC,GAAM,SAAAC,EAAA,IAAYN,EAAA;AAC1B,SAAO,EAAE,MAAAK,GAAM,SAAAC,EAAA;AAChB;AAKO,SAASC,KAAkB;AACjC,QA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A,aAAajD,EAAU;AAAA,EAAA;AAEzB;"}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./position-utils-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./position-utils-BVt-Bp93.cjs");exports.CALENDAR_VIEWS=e.CALENDAR_VIEWS;exports.CALENDAR_VIEW_STORAGE_KEY=e.CALENDAR_VIEW_STORAGE_KEY;exports.DEFAULT_BUSINESS_HOURS=e.DEFAULT_BUSINESS_HOURS;exports.DEFAULT_HEADER_HEIGHT=e.DEFAULT_HEADER_HEIGHT;exports.DEFAULT_HOUR_HEIGHT=e.DEFAULT_HOUR_HEIGHT;exports.DEFAULT_PREFERENCES=e.DEFAULT_PREFERENCES;exports.DEFAULT_RESOURCE_WIDTH=e.DEFAULT_RESOURCE_WIDTH;exports.DEFAULT_SLOT_HEIGHT=e.DEFAULT_SLOT_HEIGHT;exports.DEFAULT_VIEW_CONFIGS=e.DEFAULT_VIEW_CONFIGS;exports.DEFAULT_VISIBLE_HOURS=e.DEFAULT_VISIBLE_HOURS;exports.EVENT_COLORS=e.EVENT_COLORS;exports.EVENT_COLOR_CLASSES=e.EVENT_COLOR_CLASSES;exports.HEX_TO_EVENT_COLOR=e.HEX_TO_EVENT_COLOR;exports.HOURS_IN_DAY=e.HOURS_IN_DAY;exports.MINUTES_IN_HOUR=e.MINUTES_IN_HOUR;exports.MIN_EVENT_HEIGHT=e.MIN_EVENT_HEIGHT;exports.MS_PER_DAY=e.MS_PER_DAY;exports.MS_PER_HOUR=e.MS_PER_HOUR;exports.MS_PER_MINUTE=e.MS_PER_MINUTE;exports.RESOURCE_VIEW_STORAGE_KEY=e.RESOURCE_VIEW_STORAGE_KEY;exports.addDays=e.addDays;exports.addHours=e.addHours;exports.addMinutes=e.addMinutes;exports.addMonths=e.addMonths;exports.addWeeks=e.addWeeks;exports.addYears=e.addYears;exports.applyEventFilters=e.applyEventFilters;exports.calculateEventPosition=e.calculateEventPosition;exports.calculateOverlappingPositions=e.calculateOverlappingPositions;exports.calculateSelectionOverlay=e.calculateSelectionOverlay;exports.clearCalendarView=e.clearCalendarView;exports.clearResourceView=e.clearResourceView;exports.detectAllDayEvent=e.detectAllDayEvent;exports.differenceInDays=e.differenceInDays;exports.differenceInHours=e.differenceInHours;exports.differenceInMilliseconds=e.differenceInMilliseconds;exports.differenceInMinutes=e.differenceInMinutes;exports.eachDayOfInterval=e.eachDayOfInterval;exports.eachHourOfInterval=e.eachHourOfInterval;exports.endOfDay=e.endOfDay;exports.endOfMonth=e.endOfMonth;exports.endOfWeek=e.endOfWeek;exports.endOfYear=e.endOfYear;exports.eventsOverlap=e.eventsOverlap;exports.filterEventsByDateRange=e.filterEventsByDateRange;exports.filterEventsByResource=e.filterEventsByResource;exports.filterEventsByScheduleType=e.filterEventsByScheduleType;exports.filterEventsBySearch=e.filterEventsBySearch;exports.filterOutCanceled=e.filterOutCanceled;exports.formatClock=e.formatClock;exports.formatClockCompact=e.formatClockCompact;exports.formatClockRange=e.formatClockRange;exports.formatDateISO=e.formatDateISO;exports.formatEventTimeDisplay=e.formatEventTimeDisplay;exports.formatHourLabel=e.formatHourLabel;exports.formatTime=e.formatTime;exports.generateHourLabels=e.generateHourLabels;exports.generateMonthCells=e.generateMonthCells;exports.generateMonthGrid=e.generateMonthGrid;exports.generateTimeSlots=e.generateTimeSlots;exports.generateWeekCells=e.generateWeekCells;exports.generateYearCells=e.generateYearCells;exports.getAllDayEvents=e.getAllDayEvents;exports.getDayOfWeek=e.getDayOfWeek;exports.getDaysInMonth=e.getDaysInMonth;exports.getDecimalHours=e.getDecimalHours;exports.getEventColor=e.getEventColor;exports.getEventDurationMinutes=e.getEventDurationMinutes;exports.getEventsCountInView=e.getEventsCountInView;exports.getEventsForDay=e.getEventsForDay;exports.getEventsInRange=e.getEventsInRange;exports.getMonthNames=e.getMonthNames;exports.getMultiDayEvents=e.getMultiDayEvents;exports.getOverlappingGroups=e.getOverlappingGroups;exports.getRangeText=e.getRangeText;exports.getTimedEvents=e.getTimedEvents;exports.getViewDateRange=e.getViewDateRange;exports.getViewTitle=e.getViewTitle;exports.getVisibleHoursArray=e.getVisibleHoursArray;exports.getWeekDays=e.getWeekDays;exports.getWeekNumber=e.getWeekNumber;exports.getWeekdayHeaders=e.getWeekdayHeaders;exports.getWeekdayNames=e.getWeekdayNames;exports.getWorkingHoursForDay=e.getWorkingHoursForDay;exports.getYearMonths=e.getYearMonths;exports.groupEventsByDate=e.groupEventsByDate;exports.groupEventsByResource=e.groupEventsByResource;exports.groupEventsByScheduleType=e.groupEventsByScheduleType;exports.isAfter=e.isAfter;exports.isBefore=e.isBefore;exports.isBetween=e.isBetween;exports.isCalendarGridView=e.isCalendarGridView;exports.isMultiDayEvent=e.isMultiDayEvent;exports.isResourceView=e.isResourceView;exports.isSameDay=e.isSameDay;exports.isSameMonth=e.isSameMonth;exports.isSameWeek=e.isSameWeek;exports.isSameYear=e.isSameYear;exports.isToday=e.isToday;exports.isWeekend=e.isWeekend;exports.isWorkingHour=e.isWorkingHour;exports.maxDate=e.maxDate;exports.minDate=e.minDate;exports.navigateNext=e.navigateNext;exports.navigatePrev=e.navigatePrev;exports.navigateToday=e.navigateToday;exports.parseClockText=e.parseClockText;exports.parseISO=e.parseISO;exports.reactNodeToText=e.reactNodeToText;exports.readCalendarView=e.readCalendarView;exports.readPersistedView=e.readPersistedView;exports.readPreferencesView=e.readPreferencesView;exports.readResourceView=e.readResourceView;exports.resolveEventColor=e.resolveEventColor;exports.saveCalendarView=e.saveCalendarView;exports.saveResourceView=e.saveResourceView;exports.saveViewByFamily=e.saveViewByFamily;exports.separateEventsByDuration=e.separateEventsByDuration;exports.setTime=e.setTime;exports.shouldShowEventTime=e.shouldShowEventTime;exports.sortEventsByDuration=e.sortEventsByDuration;exports.sortEventsByEnd=e.sortEventsByEnd;exports.sortEventsByStart=e.sortEventsByStart;exports.startOfDay=e.startOfDay;exports.startOfMonth=e.startOfMonth;exports.startOfWeek=e.startOfWeek;exports.startOfYear=e.startOfYear;exports.subDays=e.subDays;exports.subMonths=e.subMonths;exports.subWeeks=e.subWeeks;exports.subYears=e.subYears;exports.timeToY=e.timeToY;exports.yToTime=e.yToTime;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as s, a as t, D as r, b as n, c as i, d as E, e as o, f as l, g as d, h as g, E as v, i as D, H as
|
|
1
|
+
import { C as s, a as t, D as r, b as n, c as i, d as E, e as o, f as l, g as d, h as g, E as v, i as D, H as T, j as u, M as y, k as _, l as O, m as c, n as f, R as S, o as R, p as I, q as m, r as H, s as C, t as b, u as V, v as A, w as M, x as p, y as N, z as U, A as W, B as k, F as L, G as h, I as w, J as B, K as F, L as Y, N as G, O as P, Q as x, S as K, T as X, U as j, V as q, W as z, X as J, Y as Q, Z, _ as $, $ as aa, a0 as ea, a1 as sa, a2 as ta, a3 as ra, a4 as na, a5 as ia, a6 as Ea, a7 as oa, a8 as la, a9 as da, aa as ga, ab as va, ac as Da, ad as Ta, ae as ua, af as ya, ag as _a, ah as Oa, ai as ca, aj as fa, ak as Sa, al as Ra, am as Ia, an as ma, ao as Ha, ap as Ca, aq as ba, ar as Va, as as Aa, at as Ma, au as pa, av as Na, aw as Ua, ax as Wa, ay as ka, az as La, aA as ha, aB as wa, aC as Ba, aD as Fa, aE as Ya, aF as Ga, aG as Pa, aH as xa, aI as Ka, aJ as Xa, aK as ja, aL as qa, aM as za, aN as Ja, aO as Qa, aP as Za, aQ as $a, aR as ae, aS as ee, aT as se, aU as te, aV as re, aW as ne, aX as ie, aY as Ee, aZ as oe, a_ as le, a$ as de, b0 as ge, b1 as ve, b2 as De, b3 as Te, b4 as ue, b5 as ye, b6 as _e, b7 as Oe, b8 as ce, b9 as fe, ba as Se, bb as Re, bc as Ie, bd as me, be as He, bf as Ce } from "./position-utils-BH6T1FL5.js";
|
|
2
2
|
export {
|
|
3
3
|
s as CALENDAR_VIEWS,
|
|
4
4
|
t as CALENDAR_VIEW_STORAGE_KEY,
|
|
@@ -12,14 +12,14 @@ export {
|
|
|
12
12
|
g as DEFAULT_VISIBLE_HOURS,
|
|
13
13
|
v as EVENT_COLORS,
|
|
14
14
|
D as EVENT_COLOR_CLASSES,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
T as HEX_TO_EVENT_COLOR,
|
|
16
|
+
u as HOURS_IN_DAY,
|
|
17
|
+
y as MINUTES_IN_HOUR,
|
|
18
18
|
_ as MIN_EVENT_HEIGHT,
|
|
19
19
|
O as MS_PER_DAY,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
c as MS_PER_HOUR,
|
|
21
|
+
f as MS_PER_MINUTE,
|
|
22
|
+
S as RESOURCE_VIEW_STORAGE_KEY,
|
|
23
23
|
R as addDays,
|
|
24
24
|
I as addHours,
|
|
25
25
|
m as addMinutes,
|
|
@@ -29,13 +29,13 @@ export {
|
|
|
29
29
|
V as applyEventFilters,
|
|
30
30
|
A as calculateEventPosition,
|
|
31
31
|
M as calculateOverlappingPositions,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
p as calculateSelectionOverlay,
|
|
33
|
+
N as clearCalendarView,
|
|
34
|
+
U as clearResourceView,
|
|
35
|
+
W as detectAllDayEvent,
|
|
36
|
+
k as differenceInDays,
|
|
37
|
+
L as differenceInHours,
|
|
38
|
+
h as differenceInMilliseconds,
|
|
39
39
|
w as differenceInMinutes,
|
|
40
40
|
B as eachDayOfInterval,
|
|
41
41
|
F as eachHourOfInterval,
|
|
@@ -66,14 +66,14 @@ export {
|
|
|
66
66
|
ga as getDayOfWeek,
|
|
67
67
|
va as getDaysInMonth,
|
|
68
68
|
Da as getDecimalHours,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
Ta as getEventColor,
|
|
70
|
+
ua as getEventDurationMinutes,
|
|
71
|
+
ya as getEventsCountInView,
|
|
72
72
|
_a as getEventsForDay,
|
|
73
73
|
Oa as getEventsInRange,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
ca as getMonthNames,
|
|
75
|
+
fa as getMultiDayEvents,
|
|
76
|
+
Sa as getOverlappingGroups,
|
|
77
77
|
Ra as getRangeText,
|
|
78
78
|
Ia as getTimedEvents,
|
|
79
79
|
ma as getViewDateRange,
|
|
@@ -83,13 +83,13 @@ export {
|
|
|
83
83
|
Va as getWeekNumber,
|
|
84
84
|
Aa as getWeekdayHeaders,
|
|
85
85
|
Ma as getWeekdayNames,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
pa as getWorkingHoursForDay,
|
|
87
|
+
Na as getYearMonths,
|
|
88
|
+
Ua as groupEventsByDate,
|
|
89
|
+
Wa as groupEventsByResource,
|
|
90
|
+
ka as groupEventsByScheduleType,
|
|
91
|
+
La as isAfter,
|
|
92
|
+
ha as isBefore,
|
|
93
93
|
wa as isBetween,
|
|
94
94
|
Ba as isCalendarGridView,
|
|
95
95
|
Fa as isMultiDayEvent,
|
|
@@ -106,31 +106,32 @@ export {
|
|
|
106
106
|
Qa as navigateNext,
|
|
107
107
|
Za as navigatePrev,
|
|
108
108
|
$a as navigateToday,
|
|
109
|
-
ae as
|
|
110
|
-
ee as
|
|
111
|
-
se as
|
|
112
|
-
te as
|
|
113
|
-
re as
|
|
114
|
-
ne as
|
|
115
|
-
ie as
|
|
116
|
-
Ee as
|
|
117
|
-
oe as
|
|
118
|
-
le as
|
|
119
|
-
de as
|
|
120
|
-
ge as
|
|
121
|
-
ve as
|
|
122
|
-
De as
|
|
109
|
+
ae as parseClockText,
|
|
110
|
+
ee as parseISO,
|
|
111
|
+
se as reactNodeToText,
|
|
112
|
+
te as readCalendarView,
|
|
113
|
+
re as readPersistedView,
|
|
114
|
+
ne as readPreferencesView,
|
|
115
|
+
ie as readResourceView,
|
|
116
|
+
Ee as resolveEventColor,
|
|
117
|
+
oe as saveCalendarView,
|
|
118
|
+
le as saveResourceView,
|
|
119
|
+
de as saveViewByFamily,
|
|
120
|
+
ge as separateEventsByDuration,
|
|
121
|
+
ve as setTime,
|
|
122
|
+
De as shouldShowEventTime,
|
|
123
|
+
Te as sortEventsByDuration,
|
|
123
124
|
ue as sortEventsByEnd,
|
|
124
125
|
ye as sortEventsByStart,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
126
|
+
_e as startOfDay,
|
|
127
|
+
Oe as startOfMonth,
|
|
128
|
+
ce as startOfWeek,
|
|
129
|
+
fe as startOfYear,
|
|
130
|
+
Se as subDays,
|
|
131
|
+
Re as subMonths,
|
|
132
|
+
Ie as subWeeks,
|
|
133
|
+
me as subYears,
|
|
134
|
+
He as timeToY,
|
|
135
|
+
Ce as yToTime
|
|
135
136
|
};
|
|
136
137
|
//# sourceMappingURL=utils.mjs.map
|