@innosolutions/inno-calendar 1.0.65 → 1.0.66

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 (49) hide show
  1. package/dist/{agenda-widget-COxgmpv4.cjs → agenda-widget-BNnhQds1.cjs} +2 -2
  2. package/dist/{agenda-widget-COxgmpv4.cjs.map → agenda-widget-BNnhQds1.cjs.map} +1 -1
  3. package/dist/{agenda-widget-CD_UoYWC.js → agenda-widget-qwbBw3IK.js} +245 -245
  4. package/dist/agenda-widget-qwbBw3IK.js.map +1 -0
  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 +147 -145
  10. package/dist/core/utils/view-storage.d.ts +21 -0
  11. package/dist/core/utils/view-storage.d.ts.map +1 -1
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.mjs +201 -199
  14. package/dist/{position-utils-DpaKqYhO.js → position-utils-BzmOPdvQ.js} +294 -276
  15. package/dist/position-utils-BzmOPdvQ.js.map +1 -0
  16. package/dist/position-utils-EQTCC4tZ.cjs +2 -0
  17. package/dist/position-utils-EQTCC4tZ.cjs.map +1 -0
  18. package/dist/presets/index.cjs +1 -1
  19. package/dist/presets/index.mjs +1 -1
  20. package/dist/{slot-selection-context-D3MW4WJ7.js → slot-selection-context-CjS_VIPj.js} +72 -73
  21. package/dist/slot-selection-context-CjS_VIPj.js.map +1 -0
  22. package/dist/slot-selection-context-CmE-aWgt.cjs +2 -0
  23. package/dist/slot-selection-context-CmE-aWgt.cjs.map +1 -0
  24. package/dist/{tailwind-calendar-CzbuXRmn.js → tailwind-calendar-B6qsueM3.js} +15 -15
  25. package/dist/{tailwind-calendar-CzbuXRmn.js.map → tailwind-calendar-B6qsueM3.js.map} +1 -1
  26. package/dist/{tailwind-calendar-smlkVdSq.cjs → tailwind-calendar-KJ1XJ4gr.cjs} +2 -2
  27. package/dist/{tailwind-calendar-smlkVdSq.cjs.map → tailwind-calendar-KJ1XJ4gr.cjs.map} +1 -1
  28. package/dist/{use-calendar-mU1joTwp.js → use-calendar--JnbGA3L.js} +23 -23
  29. package/dist/{use-calendar-mU1joTwp.js.map → use-calendar--JnbGA3L.js.map} +1 -1
  30. package/dist/{use-calendar-Bd-d8oGj.cjs → use-calendar-BwqE_WNA.cjs} +2 -2
  31. package/dist/{use-calendar-Bd-d8oGj.cjs.map → use-calendar-BwqE_WNA.cjs.map} +1 -1
  32. package/dist/{use-slot-selection-CauKdLYv.js → use-slot-selection-BLCDzQzo.js} +8 -8
  33. package/dist/{use-slot-selection-CauKdLYv.js.map → use-slot-selection-BLCDzQzo.js.map} +1 -1
  34. package/dist/{use-slot-selection-CCOSsRSh.cjs → use-slot-selection-C1tk-o0j.cjs} +2 -2
  35. package/dist/{use-slot-selection-CCOSsRSh.cjs.map → use-slot-selection-C1tk-o0j.cjs.map} +1 -1
  36. package/dist/utils.cjs +1 -1
  37. package/dist/utils.mjs +52 -50
  38. package/dist/{week-view-BQXIaSUZ.js → week-view-B1KsZsC3.js} +3 -3
  39. package/dist/{week-view-BQXIaSUZ.js.map → week-view-B1KsZsC3.js.map} +1 -1
  40. package/dist/{week-view-xrKlAJos.cjs → week-view-Dv-Uz0eT.cjs} +2 -2
  41. package/dist/{week-view-xrKlAJos.cjs.map → week-view-Dv-Uz0eT.cjs.map} +1 -1
  42. package/package.json +1 -1
  43. package/dist/agenda-widget-CD_UoYWC.js.map +0 -1
  44. package/dist/position-utils-Do2ciBXl.cjs +0 -2
  45. package/dist/position-utils-Do2ciBXl.cjs.map +0 -1
  46. package/dist/position-utils-DpaKqYhO.js.map +0 -1
  47. package/dist/slot-selection-context-BlrL9b5P.cjs +0 -2
  48. package/dist/slot-selection-context-BlrL9b5P.cjs.map +0 -1
  49. package/dist/slot-selection-context-D3MW4WJ7.js.map +0 -1
@@ -1 +1 @@
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,EAA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AA,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-BLCDzQzo.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,EAAS;AAAA,MAAA,CAClB;AAAA,IAEH;AAAA,IACA,CAACV,CAAc;AAAA,EAAA,GAGVW,IAAkBL;AAAA,IACvB,CAACM,MAA4B;AAC5B,MAAAZ,EAAe,EAAE,cAAcY,GAAU;AAAA,IAC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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;"}
@@ -1,2 +1,2 @@
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
+ "use strict";const n=require("react"),T=require("./use-calendar-BwqE_WNA.cjs"),d=require("./position-utils-EQTCC4tZ.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-C1tk-o0j.cjs.map
@@ -1 +1 @@
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,KAAMJ,EAAY,UAClB,GAAIA,EAAY,OAAA,GAEjB,CAACA,EAAY,UAAWA,EAAY,OAAO,CAAA,EAItCK,EAAeD,EAAAA,QACpB,KAAO,CAEN,EAAG,CAAE,KAAMJ,EAAY,UAAW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AAU,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
+ {"version":3,"file":"use-slot-selection-C1tk-o0j.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,EA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AG,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"}
package/dist/utils.cjs CHANGED
@@ -1,2 +1,2 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./position-utils-EQTCC4tZ.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.readPersistedView=e.readPersistedView;exports.readPreferencesView=e.readPreferencesView;exports.readResourceView=e.readResourceView;exports.resolveEventColor=e.resolveEventColor;exports.saveCalendarView=e.saveCalendarView;exports.saveResourceView=e.saveResourceView;exports.saveViewByFamily=e.saveViewByFamily;exports.separateEventsByDuration=e.separateEventsByDuration;exports.setTime=e.setTime;exports.shouldShowEventTime=e.shouldShowEventTime;exports.sortEventsByDuration=e.sortEventsByDuration;exports.sortEventsByEnd=e.sortEventsByEnd;exports.sortEventsByStart=e.sortEventsByStart;exports.startOfDay=e.startOfDay;exports.startOfMonth=e.startOfMonth;exports.startOfWeek=e.startOfWeek;exports.startOfYear=e.startOfYear;exports.subDays=e.subDays;exports.subMonths=e.subMonths;exports.subWeeks=e.subWeeks;exports.subYears=e.subYears;exports.timeToY=e.timeToY;exports.yToTime=e.yToTime;
2
2
  //# sourceMappingURL=utils.cjs.map
package/dist/utils.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { C as s, a as t, D as r, b as n, c as E, d as i, e as o, f as l, g as d, h as g, E as v, i as D, H as u, j as y, M as T, k as _, l as O, m as S, n as R, R as f, o as c, p as I, q as H, r as m, s as A, t as M, u as V, v as C, w as N, x as U, y as W, z as L, A as b, B as h, F as p, G as B, I as k, J as w, K as F, L as Y, N as G, O as P, P as x, Q as K, S as X, T as j, U as q, V as z, W as J, X as Q, Y as Z, Z as $, _ as aa, $ as ea, a0 as sa, a1 as ta, a2 as ra, a3 as na, a4 as Ea, a5 as ia, a6 as oa, a7 as la, a8 as da, a9 as ga, aa as va, ab as Da, ac as ua, ad as ya, ae as Ta, af as _a, ag as Oa, ah as Sa, ai as Ra, aj as fa, ak as ca, al as Ia, am as Ha, an as ma, ao as Aa, ap as Ma, aq as Va, ar as Ca, as as Na, at as Ua, au as Wa, av as La, aw as ba, ax as ha, ay as pa, az as Ba, aA as ka, aB as wa, aC as Fa, aD as Ya, aE as Ga, aF as Pa, aG as xa, aH as Ka, aI as Xa, aJ as ja, aK as qa, aL as za, aM as Ja, aN as Qa, aO as Za, aP as $a, aQ as ae, aR as ee, aS as se, aT as te, aU as re, aV as ne, aW as Ee, aX as ie, aY as oe, aZ as le, a_ as de, a$ as ge, b0 as ve, b1 as De, b2 as ue, b3 as ye, b4 as Te, b5 as _e, b6 as Oe, b7 as Se, b8 as Re } from "./position-utils-DpaKqYhO.js";
1
+ import { C as s, a as t, D as r, b as n, c as i, d as E, e as o, f as l, g as d, h as g, E as v, i as D, H as u, j as y, M as T, k as _, l as O, m as S, n as R, R as f, o as c, p as I, q as H, r as m, s as V, t as A, u as M, v as b, w as C, x as N, y as U, z as W, A as L, B as h, F as p, G as w, I as B, J as k, K as F, L as Y, N as G, O as P, Q as x, S as K, T as X, U as j, V as q, W as z, X as J, Y as Q, Z, _ as $, $ as aa, a0 as ea, a1 as sa, a2 as ta, a3 as ra, a4 as na, a5 as ia, a6 as Ea, a7 as oa, a8 as la, a9 as da, aa as ga, ab as va, ac as Da, ad as ua, ae as ya, af as Ta, ag as _a, ah as Oa, ai as Sa, aj as Ra, ak as fa, al as ca, am as Ia, an as Ha, ao as ma, ap as Va, aq as Aa, ar as Ma, as as ba, at as Ca, au as Na, av as Ua, aw as Wa, ax as La, ay as ha, az as pa, aA as wa, aB as Ba, aC as ka, aD as Fa, aE as Ya, aF as Ga, aG as Pa, aH as xa, aI as Ka, aJ as Xa, aK as ja, aL as qa, aM as za, aN as Ja, aO as Qa, aP as Za, aQ as $a, aR as ae, aS as ee, aT as se, aU as te, aV as re, aW as ne, aX as ie, aY as Ee, aZ as oe, a_ as le, a$ as de, b0 as ge, b1 as ve, b2 as De, b3 as ue, b4 as ye, b5 as Te, b6 as _e, b7 as Oe, b8 as Se, b9 as Re, ba as fe, bb as ce } from "./position-utils-BzmOPdvQ.js";
2
2
  export {
3
3
  s as CALENDAR_VIEWS,
4
4
  t as CALENDAR_VIEW_STORAGE_KEY,
5
5
  r as DEFAULT_BUSINESS_HOURS,
6
6
  n as DEFAULT_HEADER_HEIGHT,
7
- E as DEFAULT_HOUR_HEIGHT,
8
- i as DEFAULT_PREFERENCES,
7
+ i as DEFAULT_HOUR_HEIGHT,
8
+ E as DEFAULT_PREFERENCES,
9
9
  o as DEFAULT_RESOURCE_WIDTH,
10
10
  l as DEFAULT_SLOT_HEIGHT,
11
11
  d as DEFAULT_VIEW_CONFIGS,
@@ -24,20 +24,20 @@ export {
24
24
  I as addHours,
25
25
  H as addMinutes,
26
26
  m as addMonths,
27
- A as addWeeks,
28
- M as addYears,
29
- V as applyEventFilters,
30
- C as calculateEventPosition,
31
- N as calculateOverlappingPositions,
32
- U as calculateSelectionOverlay,
33
- W as clearCalendarView,
34
- L as clearResourceView,
35
- b as detectAllDayEvent,
27
+ V as addWeeks,
28
+ A as addYears,
29
+ M as applyEventFilters,
30
+ b as calculateEventPosition,
31
+ C as calculateOverlappingPositions,
32
+ N as calculateSelectionOverlay,
33
+ U as clearCalendarView,
34
+ W as clearResourceView,
35
+ L as detectAllDayEvent,
36
36
  h as differenceInDays,
37
37
  p as differenceInHours,
38
- B as differenceInMilliseconds,
39
- k as differenceInMinutes,
40
- w as eachDayOfInterval,
38
+ w as differenceInMilliseconds,
39
+ B as differenceInMinutes,
40
+ k as eachDayOfInterval,
41
41
  F as eachHourOfInterval,
42
42
  Y as endOfDay,
43
43
  G as endOfMonth,
@@ -58,8 +58,8 @@ export {
58
58
  ta as generateMonthGrid,
59
59
  ra as generateTimeSlots,
60
60
  na as generateWeekCells,
61
- Ea as generateYearCells,
62
- ia as getAllDayEvents,
61
+ ia as generateYearCells,
62
+ Ea as getAllDayEvents,
63
63
  oa as getDayOfWeek,
64
64
  la as getDaysInMonth,
65
65
  da as getDecimalHours,
@@ -78,20 +78,20 @@ export {
78
78
  Ia as getVisibleHoursArray,
79
79
  Ha as getWeekDays,
80
80
  ma as getWeekNumber,
81
- Aa as getWeekdayHeaders,
82
- Ma as getWeekdayNames,
83
- Va as getWorkingHoursForDay,
84
- Ca as getYearMonths,
85
- Na as groupEventsByDate,
86
- Ua as groupEventsByResource,
87
- Wa as groupEventsByScheduleType,
88
- La as isAfter,
89
- ba as isBefore,
81
+ Va as getWeekdayHeaders,
82
+ Aa as getWeekdayNames,
83
+ Ma as getWorkingHoursForDay,
84
+ ba as getYearMonths,
85
+ Ca as groupEventsByDate,
86
+ Na as groupEventsByResource,
87
+ Ua as groupEventsByScheduleType,
88
+ Wa as isAfter,
89
+ La as isBefore,
90
90
  ha as isBetween,
91
91
  pa as isCalendarGridView,
92
- Ba as isMultiDayEvent,
93
- ka as isResourceView,
94
- wa as isSameDay,
92
+ wa as isMultiDayEvent,
93
+ Ba as isResourceView,
94
+ ka as isSameDay,
95
95
  Fa as isSameMonth,
96
96
  Ya as isSameWeek,
97
97
  Ga as isSameYear,
@@ -106,26 +106,28 @@ export {
106
106
  Qa as parseISO,
107
107
  Za as reactNodeToText,
108
108
  $a as readCalendarView,
109
- ae as readResourceView,
110
- ee as resolveEventColor,
111
- se as saveCalendarView,
112
- te as saveResourceView,
113
- re as saveViewByFamily,
114
- ne as separateEventsByDuration,
115
- Ee as setTime,
116
- ie as shouldShowEventTime,
117
- oe as sortEventsByDuration,
118
- le as sortEventsByEnd,
119
- de as sortEventsByStart,
120
- ge as startOfDay,
121
- ve as startOfMonth,
122
- De as startOfWeek,
123
- ue as startOfYear,
124
- ye as subDays,
125
- Te as subMonths,
126
- _e as subWeeks,
127
- Oe as subYears,
128
- Se as timeToY,
129
- Re as yToTime
109
+ ae as readPersistedView,
110
+ ee as readPreferencesView,
111
+ se as readResourceView,
112
+ te as resolveEventColor,
113
+ re as saveCalendarView,
114
+ ne as saveResourceView,
115
+ ie as saveViewByFamily,
116
+ Ee as separateEventsByDuration,
117
+ oe as setTime,
118
+ le as shouldShowEventTime,
119
+ de as sortEventsByDuration,
120
+ ge as sortEventsByEnd,
121
+ ve as sortEventsByStart,
122
+ De as startOfDay,
123
+ ue as startOfMonth,
124
+ ye as startOfWeek,
125
+ Te as startOfYear,
126
+ _e as subDays,
127
+ Oe as subMonths,
128
+ Se as subWeeks,
129
+ Re as subYears,
130
+ fe as timeToY,
131
+ ce as yToTime
130
132
  };
131
133
  //# sourceMappingURL=utils.mjs.map
@@ -3,8 +3,8 @@ import * as X from "react";
3
3
  import { forwardRef as je, createElement as $e, useState as Z, useEffect as ke, useCallback as L, useRef as re, useMemo as q, useLayoutEffect as Fe } from "react";
4
4
  import { c as s, a as Dt } from "./index-DtaLkIY8.js";
5
5
  import * as K from "@radix-ui/react-dropdown-menu";
6
- import { Y, aO as Ct, ab as St, ah as Mt, as as Tt, aF as ce, A as ze, aB as ie, ac as Ve, aV as it, w as lt, al as dt, aH as ct, Z as Ae, a1 as zt, a$ as Xe, am as At } from "./position-utils-DpaKqYhO.js";
7
- import { j as Ge, k as ut, l as Ue } from "./slot-selection-context-D3MW4WJ7.js";
6
+ import { Z as Y, aP as Ct, ac as St, ai as Mt, at as Tt, aG as ce, A as ze, aC as ie, ad as Ve, aY as it, w as lt, am as dt, aI as ct, _ as Ae, a2 as zt, b2 as Xe, an as At } from "./position-utils-BzmOPdvQ.js";
7
+ import { j as Ge, k as ut, l as Ue } from "./slot-selection-context-CjS_VIPj.js";
8
8
  import * as V from "@radix-ui/react-dialog";
9
9
  import * as ge from "@radix-ui/react-popover";
10
10
  import * as De from "@radix-ui/react-tooltip";
@@ -3517,4 +3517,4 @@ export {
3517
3517
  oe as y,
3518
3518
  Kn as z
3519
3519
  };
3520
- //# sourceMappingURL=week-view-BQXIaSUZ.js.map
3520
+ //# sourceMappingURL=week-view-B1KsZsC3.js.map