@innosolutions/inno-calendar 1.0.64 → 1.0.65

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.
Files changed (50) hide show
  1. package/dist/{agenda-widget-duVkXi_m.js → agenda-widget-CD_UoYWC.js} +245 -245
  2. package/dist/{agenda-widget-duVkXi_m.js.map → agenda-widget-CD_UoYWC.js.map} +1 -1
  3. package/dist/{agenda-widget-A-xsyqRf.cjs → agenda-widget-COxgmpv4.cjs} +2 -2
  4. package/dist/{agenda-widget-A-xsyqRf.cjs.map → agenda-widget-COxgmpv4.cjs.map} +1 -1
  5. package/dist/components/index.cjs +1 -1
  6. package/dist/components/index.mjs +2 -2
  7. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  8. package/dist/core/index.cjs +1 -1
  9. package/dist/core/index.mjs +165 -154
  10. package/dist/core/utils/index.d.ts +1 -0
  11. package/dist/core/utils/index.d.ts.map +1 -1
  12. package/dist/core/utils/view-storage.d.ts +64 -0
  13. package/dist/core/utils/view-storage.d.ts.map +1 -0
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.mjs +210 -199
  16. package/dist/position-utils-Do2ciBXl.cjs +2 -0
  17. package/dist/position-utils-Do2ciBXl.cjs.map +1 -0
  18. package/dist/{position-utils-DMVQFywD.js → position-utils-DpaKqYhO.js} +430 -346
  19. package/dist/position-utils-DpaKqYhO.js.map +1 -0
  20. package/dist/presets/index.cjs +1 -1
  21. package/dist/presets/index.mjs +1 -1
  22. package/dist/slot-selection-context-BlrL9b5P.cjs +2 -0
  23. package/dist/slot-selection-context-BlrL9b5P.cjs.map +1 -0
  24. package/dist/{slot-selection-context-CRstOosL.js → slot-selection-context-D3MW4WJ7.js} +159 -159
  25. package/dist/slot-selection-context-D3MW4WJ7.js.map +1 -0
  26. package/dist/{tailwind-calendar-CNhXkxzW.js → tailwind-calendar-CzbuXRmn.js} +65 -65
  27. package/dist/{tailwind-calendar-CNhXkxzW.js.map → tailwind-calendar-CzbuXRmn.js.map} +1 -1
  28. package/dist/{tailwind-calendar-VRvPJQwa.cjs → tailwind-calendar-smlkVdSq.cjs} +2 -2
  29. package/dist/{tailwind-calendar-VRvPJQwa.cjs.map → tailwind-calendar-smlkVdSq.cjs.map} +1 -1
  30. package/dist/{use-calendar-DkT1_V3j.cjs → use-calendar-Bd-d8oGj.cjs} +2 -2
  31. package/dist/{use-calendar-DkT1_V3j.cjs.map → use-calendar-Bd-d8oGj.cjs.map} +1 -1
  32. package/dist/{use-calendar-D8XaVe44.js → use-calendar-mU1joTwp.js} +53 -53
  33. package/dist/{use-calendar-D8XaVe44.js.map → use-calendar-mU1joTwp.js.map} +1 -1
  34. package/dist/{use-slot-selection-Dj_tWg1O.cjs → use-slot-selection-CCOSsRSh.cjs} +2 -2
  35. package/dist/{use-slot-selection-Dj_tWg1O.cjs.map → use-slot-selection-CCOSsRSh.cjs.map} +1 -1
  36. package/dist/{use-slot-selection-CWRk_17s.js → use-slot-selection-CauKdLYv.js} +3 -3
  37. package/dist/{use-slot-selection-CWRk_17s.js.map → use-slot-selection-CauKdLYv.js.map} +1 -1
  38. package/dist/utils.cjs +1 -1
  39. package/dist/utils.mjs +120 -109
  40. package/dist/{week-view-DY167Wok.js → week-view-BQXIaSUZ.js} +3 -3
  41. package/dist/{week-view-DY167Wok.js.map → week-view-BQXIaSUZ.js.map} +1 -1
  42. package/dist/{week-view-C1Vu2ErD.cjs → week-view-xrKlAJos.cjs} +2 -2
  43. package/dist/{week-view-C1Vu2ErD.cjs.map → week-view-xrKlAJos.cjs.map} +1 -1
  44. package/package.json +1 -1
  45. package/dist/position-utils-BQpbtF6N.cjs +0 -2
  46. package/dist/position-utils-BQpbtF6N.cjs.map +0 -1
  47. package/dist/position-utils-DMVQFywD.js.map +0 -1
  48. package/dist/slot-selection-context-CRstOosL.js.map +0 -1
  49. package/dist/slot-selection-context-DBCZI2Dn.cjs +0 -2
  50. package/dist/slot-selection-context-DBCZI2Dn.cjs.map +0 -1
@@ -1,36 +1,36 @@
1
1
  import { jsx as J } from "react/jsx-runtime";
2
- import { createContext as K, useContext as R, useState as D, useMemo as p, useCallback as s } from "react";
3
- import { c as X, af as Y, ag as Z, O as $, Q as ee, P as te, R as ne, S as se, aP as re, aE as ae, aF as oe, aG as ce } from "./position-utils-DMVQFywD.js";
4
- const x = K(void 0);
5
- function fe({ children: t, value: n }) {
2
+ import { createContext as Q, useContext as V, useState as D, useMemo as p, useCallback as s } from "react";
3
+ import { d as X, aj as Y, ak as Z, S as $, U as ee, T as te, V as ne, W as se, a_ as re, aK as ae, aL as oe, aM as ce } from "./position-utils-DpaKqYhO.js";
4
+ const x = Q(void 0);
5
+ function de({ children: t, value: n }) {
6
6
  return /* @__PURE__ */ J(x.Provider, { value: n, children: t });
7
7
  }
8
8
  function v() {
9
- const t = R(x);
9
+ const t = V(x);
10
10
  if (!t)
11
11
  throw new Error("useCalendarContext must be used within a CalendarProvider");
12
12
  return t;
13
13
  }
14
- function de() {
15
- return R(x);
14
+ function fe() {
15
+ return V(x);
16
16
  }
17
17
  function Ce() {
18
18
  const { view: t, setView: n } = v();
19
19
  return { view: t, setView: n };
20
20
  }
21
21
  function ve() {
22
- const { currentDate: t, setCurrentDate: n, goToNext: u, goToPrev: f, goToToday: E, goToDate: h } = v();
23
- return { currentDate: t, setCurrentDate: n, goToNext: u, goToPrev: f, goToToday: E, goToDate: h };
22
+ const { currentDate: t, setCurrentDate: n, goToNext: u, goToPrev: d, goToToday: T, goToDate: h } = v();
23
+ return { currentDate: t, setCurrentDate: n, goToNext: u, goToPrev: d, goToToday: T, goToDate: h };
24
24
  }
25
25
  function ge() {
26
26
  const { events: t, filteredEvents: n } = v();
27
27
  return { events: t, filteredEvents: n };
28
28
  }
29
29
  function De() {
30
- const { filters: t, setFilters: n, updateFilters: u, clearFilters: f } = v();
31
- return { filters: t, setFilters: n, updateFilters: u, clearFilters: f };
30
+ const { filters: t, setFilters: n, updateFilters: u, clearFilters: d } = v();
31
+ return { filters: t, setFilters: n, updateFilters: u, clearFilters: d };
32
32
  }
33
- function Ee() {
33
+ function Te() {
34
34
  const { preferences: t, setPreferences: n } = v();
35
35
  return { preferences: t, setPreferences: n };
36
36
  }
@@ -38,22 +38,22 @@ function he(t) {
38
38
  const {
39
39
  events: n,
40
40
  resources: u = [],
41
- scheduleTypes: f = [],
42
- initialView: E = "week",
41
+ scheduleTypes: d = [],
42
+ initialView: T = "week",
43
43
  initialDate: h,
44
- initialFilters: V = {},
44
+ initialFilters: R = {},
45
45
  preferences: B = {},
46
- lockedPreferences: T = {},
46
+ lockedPreferences: E = {},
47
47
  locale: y = "en-US",
48
- onViewChange: P,
49
- onDateChange: S,
48
+ onViewChange: S,
49
+ onDateChange: P,
50
50
  onEventClick: F,
51
51
  onSlotSelect: m,
52
52
  onFiltersChange: i
53
- } = t, [r, O] = D(E), [a, I] = D(() => h ?? /* @__PURE__ */ new Date()), [d, w] = D(V), [C, N] = D(() => ({
53
+ } = t, [r, I] = D(T), [a, N] = D(() => h ?? /* @__PURE__ */ new Date()), [f, w] = D(R), [C, O] = D(() => ({
54
54
  ...X,
55
55
  ...B,
56
- ...T
56
+ ...E
57
57
  })), g = p(
58
58
  () => Y(a, r, C.firstDayOfWeek),
59
59
  [a, r, C.firstDayOfWeek]
@@ -63,41 +63,41 @@ function he(t) {
63
63
  ), U = p(() => {
64
64
  let e = [...n];
65
65
  e = $(e, g.startDate, g.endDate);
66
- const c = d.scheduleTypeIds;
66
+ const c = f.scheduleTypeIds;
67
67
  c && c.length > 0 && (e = ee(e, c));
68
- const l = d.resourceIds;
68
+ const l = f.resourceIds;
69
69
  l && l.length > 0 && (e = te(e, l));
70
- const k = d.search;
70
+ const k = f.search;
71
71
  return k && (e = ne(e, k)), C.showCanceledEvents || (e = se(e)), re(e);
72
- }, [n, g, d, C.showCanceledEvents]), W = s(
72
+ }, [n, g, f, C.showCanceledEvents]), W = s(
73
73
  (e) => {
74
- O(e), P?.(e);
74
+ I(e), S?.(e);
75
75
  },
76
- [P]
76
+ [S]
77
77
  ), o = s(
78
78
  (e) => {
79
- I(e), S?.(e);
79
+ N(e), P?.(e);
80
80
  },
81
- [S]
81
+ [P]
82
82
  ), j = s(() => {
83
83
  const e = ae(a, r);
84
84
  o(e);
85
- }, [a, r, o]), A = s(() => {
85
+ }, [a, r, o]), L = s(() => {
86
86
  const e = oe(a, r);
87
87
  o(e);
88
- }, [a, r, o]), G = s(() => {
88
+ }, [a, r, o]), M = s(() => {
89
89
  o(ce());
90
- }, [o]), L = s(
90
+ }, [o]), _ = s(
91
91
  (e) => {
92
92
  o(e);
93
93
  },
94
94
  [o]
95
- ), M = s(
95
+ ), A = s(
96
96
  (e) => {
97
97
  w(e), i?.(e);
98
98
  },
99
99
  [i]
100
- ), Q = s(
100
+ ), K = s(
101
101
  (e) => {
102
102
  w((c) => {
103
103
  const l = { ...c, ...e };
@@ -105,20 +105,20 @@ function he(t) {
105
105
  });
106
106
  },
107
107
  [i]
108
- ), _ = s(() => {
108
+ ), q = s(() => {
109
109
  const e = {};
110
110
  w(e), i?.(e);
111
- }, [i]), q = s(
111
+ }, [i]), z = s(
112
112
  (e) => {
113
- N((c) => ({
113
+ O((c) => ({
114
114
  ...c,
115
115
  ...e,
116
- ...T
116
+ ...E
117
117
  // Locked prefs always override
118
118
  }));
119
119
  },
120
- [T]
121
- ), z = s(
120
+ [E]
121
+ ), G = s(
122
122
  (e) => {
123
123
  F?.(e);
124
124
  },
@@ -134,7 +134,7 @@ function he(t) {
134
134
  view: r,
135
135
  currentDate: a,
136
136
  dateRange: g,
137
- filters: d,
137
+ filters: f,
138
138
  preferences: C,
139
139
  // Computed
140
140
  filteredEvents: U,
@@ -142,34 +142,34 @@ function he(t) {
142
142
  // Data
143
143
  events: n,
144
144
  resources: u,
145
- scheduleTypes: f,
145
+ scheduleTypes: d,
146
146
  // Actions
147
147
  setView: W,
148
148
  setCurrentDate: o,
149
149
  goToNext: j,
150
- goToPrev: A,
151
- goToToday: G,
152
- goToDate: L,
150
+ goToPrev: L,
151
+ goToToday: M,
152
+ goToDate: _,
153
153
  // Filters
154
- setFilters: M,
155
- updateFilters: Q,
156
- clearFilters: _,
154
+ setFilters: A,
155
+ updateFilters: K,
156
+ clearFilters: q,
157
157
  // Preferences
158
- setPreferences: q,
158
+ setPreferences: z,
159
159
  // Event handlers
160
- handleEventClick: z,
160
+ handleEventClick: G,
161
161
  handleSlotSelect: H
162
162
  };
163
163
  }
164
164
  export {
165
- fe as C,
165
+ de as C,
166
166
  v as a,
167
167
  ve as b,
168
168
  ge as c,
169
169
  De as d,
170
- Ee as e,
170
+ Te as e,
171
171
  Ce as f,
172
- de as g,
172
+ fe as g,
173
173
  he as u
174
174
  };
175
- //# sourceMappingURL=use-calendar-D8XaVe44.js.map
175
+ //# sourceMappingURL=use-calendar-mU1joTwp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-calendar-D8XaVe44.js","sources":["../src/core/context/calendar-context.tsx","../src/core/hooks/use-calendar.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"],"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"],"mappings":";;;AAmBA,MAAMA,IAAkBC,EAA4D,MAAS;AAetF,SAASC,GAId,EAAE,UAAAC,GAAU,OAAAC,KAA8E;AAC3F,SAAO,gBAAAC,EAACL,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,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AA,QACH,GAAGxC;AAAA;AAAA,MAAA,EACF;AAAA,IACH;AAAA,IACA,CAACA,CAAiB;AAAA,EAAA,GAObyC,IAAmBb;AAAA,IACxB,CAACc,MAAqC;AACrC,MAAAtC,IAAesC,CAAK;AAAA,IACrB;AAAA,IACA,CAACtC,CAAY;AAAA,EAAA,GAGRuC,IAAmBf;AAAA,IACxB,CAACgB,MAAgC;AAChC,MAAAvC,IAAeuC,CAAS;AAAA,IACzB;AAAA,IACA,CAACvC,CAAY;AAAA,EAAA;AAOd,SAAO;AAAA;AAAA,IAEN,MAAAjC;AAAA,IACA,aAAAG;AAAA,IACA,WAAAsC;AAAA,IACA,SAAA5B;AAAA,IACA,aAAAK;AAAA;AAAA,IAGA,gBAAAP;AAAA,IACA,WAAAiC;AAAA;AAAA,IAGA,QAAAlC;AAAA,IACA,WAAAY;AAAA,IACA,eAAAC;AAAA;AAAA,IAGA,SAAAtB;AAAA,IACA,gBAAAG;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA;AAAA,IAGA,YAAAM;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA;AAAA,IAGA,gBAAAG;AAAA;AAAA,IAGA,kBAAAkD;AAAA,IACA,kBAAAE;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"use-calendar-mU1joTwp.js","sources":["../src/core/context/calendar-context.tsx","../src/core/hooks/use-calendar.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"],"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"],"mappings":";;;AAmBA,MAAMA,IAAkBC,EAA4D,MAAS;AAetF,SAASC,GAId,EAAE,UAAAC,GAAU,OAAAC,KAA8E;AAC3F,SAAO,gBAAAC,E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CAAChC,CAAe;AAAA,EAAA,GAGXlB,IAAewC,EAAY,MAAM;AACtC,UAAMW,IAAiC,CAAA;AACvC,IAAA7B,EAAgB6B,CAAY,GAC5BjC,IAAkBiC,CAAY;AAAA,EAC/B,GAAG,CAACjC,CAAe,CAAC,GAMdf,IAAiBqC;AAAA,IACtB,CAACY,MAAyC;AACzC,MAAA7B,EAAoB,CAAC0B,OAAU;AAAA,QAC9B,GAAGA;AAAA,QACH,GAAGG;AAAA,QACH,GAAGxC;AAAA;AAAA,MAAA,EACF;AAAA,IACH;AAAA,IACA,CAACA,CAAiB;AAAA,EAAA,GAObyC,IAAmBb;AAAA,IACxB,CAACc,MAAqC;AACrC,MAAAtC,IAAesC,CAAK;AAAA,IACrB;AAAA,IACA,CAACtC,CAAY;AAAA,EAAA,GAGRuC,IAAmBf;AAAA,IACxB,CAACgB,MAAgC;AAChC,MAAAvC,IAAeuC,CAAS;AAAA,IACzB;AAAA,IACA,CAACvC,CAAY;AAAA,EAAA;AAOd,SAAO;AAAA;AAAA,IAEN,MAAAjC;AAAA,IACA,aAAAG;AAAA,IACA,WAAAsC;AAAA,IACA,SAAA5B;AAAA,IACA,aAAAK;AAAA;AAAA,IAGA,gBAAAP;AAAA,IACA,WAAAiC;AAAA;AAAA,IAGA,QAAAlC;AAAA,IACA,WAAAY;AAAA,IACA,eAAAC;AAAA;AAAA,IAGA,SAAAtB;AAAA,IACA,gBAAAG;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA;AAAA,IAGA,YAAAM;AAAA,IACA,eAAAC;AAAA,IACA,cAAAC;AAAA;AAAA,IAGA,gBAAAG;AAAA;AAAA,IAGA,kBAAAkD;AAAA,IACA,kBAAAE;AAAA,EAAA;AAEF;"}
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react"),T=require("./use-calendar-DkT1_V3j.cjs"),d=require("./position-utils-BQpbtF6N.cjs");function P(){const{preferences:t,setPreferences:s}=T.useCalendarContext(),a=n.useMemo(()=>({from:t.startHour,to:t.endHour}),[t.startHour,t.endHour]),u=n.useMemo(()=>({1:{from:t.startHour,to:t.endHour},2:{from:t.startHour,to:t.endHour},3:{from:t.startHour,to:t.endHour},4:{from:t.startHour,to:t.endHour},5:{from:t.startHour,to:t.endHour}}),[t.startHour,t.endHour]),o=n.useCallback(e=>{s({startHour:e.from,endHour:e.to})},[s]),f=n.useCallback(e=>{const r=Object.values(e)[0];r&&s({startHour:r.from,endHour:r.to})},[s]),D=n.useCallback(e=>{s({slotDuration:e})},[s]),H=n.useCallback(e=>{console.warn("showWorkingHoursOnly is not yet supported in core preferences")},[]);return{visibleHours:a,setVisibleHours:o,workingHours:u,setWorkingHours:f,slotDuration:t.slotDuration,setSlotDuration:D,showWorkingHoursOnly:!1,setShowWorkingHoursOnly:H}}function w(t={}){const{initial:s={},storageKey:a,onChange:u}=t,[o,f]=n.useState(()=>{if(a&&typeof window<"u")try{const r=localStorage.getItem(a);if(r){const S=JSON.parse(r);return{...d.DEFAULT_PREFERENCES,...S,...s}}}catch{}return{...d.DEFAULT_PREFERENCES,...s}});n.useEffect(()=>{if(a&&typeof window<"u")try{localStorage.setItem(a,JSON.stringify(o))}catch{}},[o,a]);const D=n.useCallback(r=>{f(S=>{const m={...S,...r};return u?.(m),m})},[u]),H=n.useCallback(()=>{const r={...d.DEFAULT_PREFERENCES,...s};f(r),u?.(r)},[s,u]),e=n.useCallback(r=>o[r],[o]);return{preferences:o,setPreferences:D,resetPreferences:H,getPreference:e}}const C={isSelecting:!1,startDate:null,endDate:null,startY:null,currentY:null,resourceId:void 0};function p(t){const{dayStart:s,visibleHours:a,hourHeight:u=d.DEFAULT_HOUR_HEIGHT,slotDuration:o=30,resourceId:f,enabled:D=!0,onSelect:H}=t,[e,r]=n.useState(C),S=n.useRef(0),m=n.useCallback((l,c)=>{if(!D)return;const i=l.clientY-c.top;S.current=c.height;const g=d.yToTime(i,s,a,u,o);r({isSelecting:!0,startDate:g,endDate:d.addMinutes(g,o),startY:i,currentY:i,resourceId:f})},[D,s,a,u,o,f]),b=n.useCallback((l,c)=>{if(!e.isSelecting||!e.startY)return;const i=Math.max(0,Math.min(l.clientY-c.top,c.height)),g=d.yToTime(i,s,a,u,o);r(h=>{if(!h.startDate)return h;const E=i>=(h.startY??0);return{...h,currentY:i,endDate:E?d.addMinutes(g,o):g,startDate:E?h.startDate:g}})},[e.isSelecting,e.startY,s,a,u,o]),Y=n.useCallback(()=>{if(!e.isSelecting||!e.startDate||!e.endDate){r(C);return}const l=e.startDate<e.endDate?e.startDate:e.endDate,c=e.startDate<e.endDate?e.endDate:e.startDate,i={startDate:l,endDate:c,resourceId:e.resourceId};H?.(i),r(C)},[e,H]),y=n.useCallback(()=>{r(C)},[]),k=(()=>{if(!e.isSelecting||e.startY===null||e.currentY===null)return{top:0,height:0,visible:!1};const l=Math.min(e.startY,e.currentY),c=Math.max(e.startY,e.currentY);return{top:l,height:Math.max(c-l,20),visible:!0}})();return{selection:e,overlay:k,handlePointerDown:m,handlePointerMove:b,handlePointerUp:Y,cancel:y,isSelecting:e.isSelecting}}exports.useCalendarTimeConfig=P;exports.usePreferences=w;exports.useSlotSelection=p;
2
- //# sourceMappingURL=use-slot-selection-Dj_tWg1O.cjs.map
1
+ "use strict";const n=require("react"),T=require("./use-calendar-Bd-d8oGj.cjs"),d=require("./position-utils-Do2ciBXl.cjs");function P(){const{preferences:t,setPreferences:s}=T.useCalendarContext(),a=n.useMemo(()=>({from:t.startHour,to:t.endHour}),[t.startHour,t.endHour]),u=n.useMemo(()=>({1:{from:t.startHour,to:t.endHour},2:{from:t.startHour,to:t.endHour},3:{from:t.startHour,to:t.endHour},4:{from:t.startHour,to:t.endHour},5:{from:t.startHour,to:t.endHour}}),[t.startHour,t.endHour]),o=n.useCallback(e=>{s({startHour:e.from,endHour:e.to})},[s]),f=n.useCallback(e=>{const r=Object.values(e)[0];r&&s({startHour:r.from,endHour:r.to})},[s]),D=n.useCallback(e=>{s({slotDuration:e})},[s]),H=n.useCallback(e=>{console.warn("showWorkingHoursOnly is not yet supported in core preferences")},[]);return{visibleHours:a,setVisibleHours:o,workingHours:u,setWorkingHours:f,slotDuration:t.slotDuration,setSlotDuration:D,showWorkingHoursOnly:!1,setShowWorkingHoursOnly:H}}function w(t={}){const{initial:s={},storageKey:a,onChange:u}=t,[o,f]=n.useState(()=>{if(a&&typeof window<"u")try{const r=localStorage.getItem(a);if(r){const S=JSON.parse(r);return{...d.DEFAULT_PREFERENCES,...S,...s}}}catch{}return{...d.DEFAULT_PREFERENCES,...s}});n.useEffect(()=>{if(a&&typeof window<"u")try{localStorage.setItem(a,JSON.stringify(o))}catch{}},[o,a]);const D=n.useCallback(r=>{f(S=>{const m={...S,...r};return u?.(m),m})},[u]),H=n.useCallback(()=>{const r={...d.DEFAULT_PREFERENCES,...s};f(r),u?.(r)},[s,u]),e=n.useCallback(r=>o[r],[o]);return{preferences:o,setPreferences:D,resetPreferences:H,getPreference:e}}const C={isSelecting:!1,startDate:null,endDate:null,startY:null,currentY:null,resourceId:void 0};function p(t){const{dayStart:s,visibleHours:a,hourHeight:u=d.DEFAULT_HOUR_HEIGHT,slotDuration:o=30,resourceId:f,enabled:D=!0,onSelect:H}=t,[e,r]=n.useState(C),S=n.useRef(0),m=n.useCallback((l,c)=>{if(!D)return;const i=l.clientY-c.top;S.current=c.height;const g=d.yToTime(i,s,a,u,o);r({isSelecting:!0,startDate:g,endDate:d.addMinutes(g,o),startY:i,currentY:i,resourceId:f})},[D,s,a,u,o,f]),b=n.useCallback((l,c)=>{if(!e.isSelecting||!e.startY)return;const i=Math.max(0,Math.min(l.clientY-c.top,c.height)),g=d.yToTime(i,s,a,u,o);r(h=>{if(!h.startDate)return h;const E=i>=(h.startY??0);return{...h,currentY:i,endDate:E?d.addMinutes(g,o):g,startDate:E?h.startDate:g}})},[e.isSelecting,e.startY,s,a,u,o]),Y=n.useCallback(()=>{if(!e.isSelecting||!e.startDate||!e.endDate){r(C);return}const l=e.startDate<e.endDate?e.startDate:e.endDate,c=e.startDate<e.endDate?e.endDate:e.startDate,i={startDate:l,endDate:c,resourceId:e.resourceId};H?.(i),r(C)},[e,H]),y=n.useCallback(()=>{r(C)},[]),k=(()=>{if(!e.isSelecting||e.startY===null||e.currentY===null)return{top:0,height:0,visible:!1};const l=Math.min(e.startY,e.currentY),c=Math.max(e.startY,e.currentY);return{top:l,height:Math.max(c-l,20),visible:!0}})();return{selection:e,overlay:k,handlePointerDown:m,handlePointerMove:b,handlePointerUp:Y,cancel:y,isSelecting:e.isSelecting}}exports.useCalendarTimeConfig=P;exports.usePreferences=w;exports.useSlotSelection=p;
2
+ //# sourceMappingURL=use-slot-selection-CCOSsRSh.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slot-selection-Dj_tWg1O.cjs","sources":["../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\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":["useCalendarTimeConfig","preferences","setPreferences","useCalendarContext","visibleHours","useMemo","workingHours","setVisibleHours","useCallback","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","options","initial","storageKey","onChange","setPreferencesState","useState","stored","parsed","DEFAULT_PREFERENCES","useEffect","updates","prev","next","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","selection","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","result","cancel","overlay","minY","maxY"],"mappings":"0HAuEO,SAASA,GAAqD,CACpE,KAAM,CAAE,YAAAC,EAAa,eAAAC,CAAA,EAAmBC,qBAAA,EAGlCC,EAAeC,EAAAA,QACpB,KAAO,CACN,KAAMJ,EAAY,UAClB,GAAIA,EAAY,OAAA,GAEjB,CAACA,EAAY,UAAWA,EAAY,OAAO,CAAA,EAItCK,EAAeD,EAAAA,QACpB,KAAO,CAEN,EAAG,CAAE,KAAMJ,EAAY,UAAW,GAAIA,EAAY,OAAA,EAClD,EAAG,CAAE,KAAMA,EAAY,UAAW,GAAIA,EAAY,OAAA,EAClD,EAAG,CAAE,KAAMA,EAAY,UAAW,GAAIA,EAAY,OAAA,EAClD,EAAG,CAAE,KAAMA,EAAY,UAAW,GAAIA,EAAY,OAAA,EAClD,EAAG,CAAE,KAAMA,EAAY,UAAW,GAAIA,EAAY,OAAA,CAAQ,GAE3D,CAACA,EAAY,UAAWA,EAAY,OAAO,CAAA,EAGtCM,EAAkBC,EAAAA,YACtBC,GAA+B,CAC/BP,EAAe,CACd,UAAWO,EAAM,KACjB,QAASA,EAAM,EAAA,CACf,CACF,EACA,CAACP,CAAc,CAAA,EAGVQ,EAAkBF,EAAAA,YACtBG,GAAgC,CAGhC,MAAMC,EAAW,OAAO,OAAOD,CAAM,EAAE,CAAC,EACpCC,GACHV,EAAe,CACd,UAAWU,EAAS,KACpB,QAASA,EAAS,EAAA,CAClB,CAEH,EACA,CAACV,CAAc,CAAA,EAGVW,EAAkBL,EAAAA,YACtBM,GAA4B,CAC5BZ,EAAe,CAAE,aAAcY,EAAU,C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f,EACA,kBAAAO,EACA,gBAAAG,EACA,OAAAI,EACA,YAAalB,EAAU,WAAA,CAEzB"}
1
+ {"version":3,"file":"use-slot-selection-CCOSsRSh.cjs","sources":["../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\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":["useCalendarTimeConfig","preferences","setPreferences","useCalendarContext","visibleHours","useMemo","workingHours","setVisibleHours","useCallback","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","options","initial","storageKey","onChange","setPreferencesState","useState","stored","parsed","DEFAULT_PREFERENCES","useEffect","updates","prev","next","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","selection","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","result","cancel","overlay","minY","maxY"],"mappings":"0HAuEO,SAASA,GAAqD,CACpE,KAAM,CAAE,YAAAC,EAAa,eAAAC,CAAA,EAAmBC,qBAAA,EAGlCC,EAAeC,EAAAA,QACpB,KAAO,CACN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,CAACA,EAAU,WAAa,CAACA,EAAU,QAAS,CACzEC,EAAaV,CAAiB,EAC9B,MACD,CAGA,MAAMwB,EAAQf,EAAU,UAAYA,EAAU,QAAUA,EAAU,UAAYA,EAAU,QAClFgB,EAAMhB,EAAU,UAAYA,EAAU,QAAUA,EAAU,QAAUA,EAAU,UAE9EiB,EAA2B,CAChC,UAAWF,EACX,QAASC,EACT,WAAYhB,EAAU,UAAA,EAGvBD,IAAWkB,CAAM,EACjBhB,EAAaV,CAAiB,CAC/B,EAAG,CAACS,EAAWD,CAAQ,CAAC,EAElBmB,EAAStD,EAAAA,YAAY,IAAM,CAChCqC,EAAaV,CAAiB,CAC/B,EAAG,CAAA,CAAE,EAMC4B,GAAW,IAAM,CACtB,GAAI,CAACnB,EAAU,aAAeA,EAAU,SAAW,MAAQA,EAAU,WAAa,KACjF,MAAO,CAAE,IAAK,EAAG,OAAQ,EAAG,QAAS,EAAA,EAGtC,MAAMoB,EAAO,KAAK,IAAIpB,EAAU,OAAQA,EAAU,QAAQ,EACpDqB,EAAO,KAAK,IAAIrB,EAAU,OAAQA,EAAU,QAAQ,EAE1D,MAAO,CACN,IAAKoB,EACL,OAAQ,KAAK,IAAIC,EAAOD,EAAM,EAAE,EAChC,QAAS,EAAA,CAEX,GAAA,EAMA,MAAO,CACN,UAAApB,EACA,QAAAmB,EACA,kBAAAf,EACA,kBAAAO,EACA,gBAAAG,EACA,OAAAI,EACA,YAAalB,EAAU,WAAA,CAEzB"}
@@ -1,6 +1,6 @@
1
1
  import { useMemo as p, useCallback as i, useState as b, useEffect as M, useRef as O } from "react";
2
- import { a as x } from "./use-calendar-D8XaVe44.js";
3
- import { c as Y, b as k, aZ as w, p as I } from "./position-utils-DMVQFywD.js";
2
+ import { a as x } from "./use-calendar-mU1joTwp.js";
3
+ import { d as Y, c as k, b8 as w, q as I } from "./position-utils-DpaKqYhO.js";
4
4
  function L() {
5
5
  const { preferences: e, setPreferences: n } = x(), o = p(
6
6
  () => ({
@@ -185,4 +185,4 @@ export {
185
185
  W as b,
186
186
  L as u
187
187
  };
188
- //# sourceMappingURL=use-slot-selection-CWRk_17s.js.map
188
+ //# sourceMappingURL=use-slot-selection-CauKdLYv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-slot-selection-CWRk_17s.js","sources":["../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\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":["useCalendarTimeConfig","preferences","setPreferences","useCalendarContext","visibleHours","useMemo","workingHours","setVisibleHours","useCallback","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","options","initial","storageKey","onChange","setPreferencesState","useState","stored","parsed","DEFAULT_PREFERENCES","useEffect","updates","prev","next","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","selection","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","result","cancel","overlay","minY","maxY"],"mappings":";;;AAuEO,SAASA,IAAqD;AACpE,QAAM,EAAE,aAAAC,GAAa,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S,GAAA;AAGtC,UAAMoB,IAAO,KAAK,IAAIpB,EAAU,QAAQA,EAAU,QAAQ,GACpDqB,IAAO,KAAK,IAAIrB,EAAU,QAAQA,EAAU,QAAQ;AAE1D,WAAO;AAAA,MACN,KAAKoB;AAAA,MACL,QAAQ,KAAK,IAAIC,IAAOD,GAAM,EAAE;AAAA;AAAA,MAChC,SAAS;AAAA,IAAA;AAAA,EAEX,GAAA;AAMA,SAAO;AAAA,IACN,WAAApB;AAAA,IACA,SAAAmB;AAAA,IACA,mBAAAf;AAAA,IACA,mBAAAO;AAAA,IACA,iBAAAG;AAAA,IACA,QAAAI;AAAA,IACA,aAAalB,EAAU;AAAA,EAAA;AAEzB;"}
1
+ {"version":3,"file":"use-slot-selection-CauKdLYv.js","sources":["../src/core/hooks/use-calendar-time-config.ts","../src/core/hooks/use-preferences.ts","../src/core/hooks/use-slot-selection.ts"],"sourcesContent":["/**\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":["useCalendarTimeConfig","preferences","setPreferences","useCalendarContext","visibleHours","useMemo","workingHours","setVisibleHours","useCallback","hours","setWorkingHours","_hours","firstDay","setSlotDuration","duration","setShowWorkingHoursOnly","_show","usePreferences","options","initial","storageKey","onChange","setPreferencesState","useState","stored","parsed","DEFAULT_PREFERENCES","useEffect","updates","prev","next","resetPreferences","defaults","getPreference","key","INITIAL_SELECTION","useSlotSelection","dayStart","hourHeight","DEFAULT_HOUR_HEIGHT","slotDuration","resourceId","enabled","onSelect","selection","setSelection","containerHeightRef","useRef","handlePointerDown","e","containerRect","y","startTime","yToTime","addMinutes","handlePointerMove","currentTime","isDraggingDown","handlePointerUp","start","end","result","cancel","overlay","minY","maxY"],"mappings":";;;AAuEO,SAASA,IAAqD;AACpE,QAAM,EAAE,aAAAC,GAAa,gBAAAC,EAAA,IAAmBC,EAAA,GAGlCC,IAAeC;AAAA,IACpB,OAAO;AAAA,MACN,MAAMJ,EAAY;AAAA,MAClB,IAAIA,EAAY;AAAA,IAAA;AAAA,IAEjB,CAACA,EAAY,WAAWA,EAAY,OAAO;AAAA,EAAA,GAItCK,IAAeD;AAAA,IACpB,OAAO;AAAA;AAAA,MAEN,GAAG,EAAE,MAAMJ,EAAY,WAAW,IAAIA,EAAY,QAAA;AAAA,MAClD,GAAG,EAAE,MAAMA,EAAY,WAAW,IAAIA,EAAY,QAAA;AAAA,MAClD,GAAG,EAAE,MAAMA,EAAY,WAAW,IAAIA,EAAY,QAAA;AAAA,MAClD,GAAG,EAAE,MAAMA,EAAY,WAAW,IAAIA,EAAY,QAAA;AAAA,MAClD,GAAG,EAAE,MAAMA,EAAY,WAAW,IAAIA,EAAY,QAAA;AAAA,IAAQ;AAAA,IAE3D,CAACA,EAAY,WAAWA,EAAY,OAAO;AAAA,EAAA,GAGtCM,IAAkBC;AAAA,IACvB,CAACC,MAA+B;AAC/B,MAAAP,EAAe;AAAA,QACd,WAAWO,EAAM;AAAA,QACjB,SAASA,EAAM;AAAA,MAAA,CACf;AAAA,IACF;AAAA,IACA,CAACP,CAAc;AAAA,EAAA,GAGVQ,IAAkBF;AAAA,IACvB,CAACG,MAAgC;AAGhC,YAAMC,IAAW,OAAO,OAAOD,CAAM,EAAE,CAAC;AACxC,MAAIC,KACHV,EAAe;AAAA,QACd,WAAWU,EAAS;AAAA,QACpB,SAASA,EA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AM,GACjBhB,EAAaV,CAAiB;AAAA,EAC/B,GAAG,CAACS,GAAWD,CAAQ,CAAC,GAElBmB,IAAStD,EAAY,MAAM;AAChC,IAAAqC,EAAaV,CAAiB;AAAA,EAC/B,GAAG,CAAA,CAAE,GAMC4B,KAAW,MAAM;AACtB,QAAI,CAACnB,EAAU,eAAeA,EAAU,WAAW,QAAQA,EAAU,aAAa;AACjF,aAAO,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAA;AAGtC,UAAMoB,IAAO,KAAK,IAAIpB,EAAU,QAAQA,EAAU,QAAQ,GACpDqB,IAAO,KAAK,IAAIrB,EAAU,QAAQA,EAAU,QAAQ;AAE1D,WAAO;AAAA,MACN,KAAKoB;AAAA,MACL,QAAQ,KAAK,IAAIC,IAAOD,GAAM,EAAE;AAAA;AAAA,MAChC,SAAS;AAAA,IAAA;AAAA,EAEX,GAAA;AAMA,SAAO;AAAA,IACN,WAAApB;AAAA,IACA,SAAAmB;AAAA,IACA,mBAAAf;AAAA,IACA,mBAAAO;AAAA,IACA,iBAAAG;AAAA,IACA,QAAAI;AAAA,IACA,aAAalB,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-BQpbtF6N.cjs");exports.CALENDAR_VIEWS=e.CALENDAR_VIEWS;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.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.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.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.isMultiDayEvent=e.isMultiDayEvent;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.parseISO=e.parseISO;exports.reactNodeToText=e.reactNodeToText;exports.resolveEventColor=e.resolveEventColor;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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./position-utils-Do2ciBXl.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.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.parseISO=e.parseISO;exports.reactNodeToText=e.reactNodeToText;exports.readCalendarView=e.readCalendarView;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