@innosolutions/inno-calendar 1.0.64 → 1.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agenda-widget-duVkXi_m.js → agenda-widget-CD_UoYWC.js} +245 -245
- package/dist/{agenda-widget-duVkXi_m.js.map → agenda-widget-CD_UoYWC.js.map} +1 -1
- package/dist/{agenda-widget-A-xsyqRf.cjs → agenda-widget-COxgmpv4.cjs} +2 -2
- package/dist/{agenda-widget-A-xsyqRf.cjs.map → agenda-widget-COxgmpv4.cjs.map} +1 -1
- package/dist/components/index.cjs +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +165 -154
- package/dist/core/utils/index.d.ts +1 -0
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core/utils/view-storage.d.ts +64 -0
- package/dist/core/utils/view-storage.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +210 -199
- package/dist/position-utils-Do2ciBXl.cjs +2 -0
- package/dist/position-utils-Do2ciBXl.cjs.map +1 -0
- package/dist/{position-utils-DMVQFywD.js → position-utils-DpaKqYhO.js} +430 -346
- package/dist/position-utils-DpaKqYhO.js.map +1 -0
- package/dist/presets/index.cjs +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/slot-selection-context-BlrL9b5P.cjs +2 -0
- package/dist/slot-selection-context-BlrL9b5P.cjs.map +1 -0
- package/dist/{slot-selection-context-CRstOosL.js → slot-selection-context-D3MW4WJ7.js} +159 -159
- package/dist/slot-selection-context-D3MW4WJ7.js.map +1 -0
- package/dist/{tailwind-calendar-CNhXkxzW.js → tailwind-calendar-CzbuXRmn.js} +65 -65
- package/dist/{tailwind-calendar-CNhXkxzW.js.map → tailwind-calendar-CzbuXRmn.js.map} +1 -1
- package/dist/{tailwind-calendar-VRvPJQwa.cjs → tailwind-calendar-smlkVdSq.cjs} +2 -2
- package/dist/{tailwind-calendar-VRvPJQwa.cjs.map → tailwind-calendar-smlkVdSq.cjs.map} +1 -1
- package/dist/{use-calendar-DkT1_V3j.cjs → use-calendar-Bd-d8oGj.cjs} +2 -2
- package/dist/{use-calendar-DkT1_V3j.cjs.map → use-calendar-Bd-d8oGj.cjs.map} +1 -1
- package/dist/{use-calendar-D8XaVe44.js → use-calendar-mU1joTwp.js} +53 -53
- package/dist/{use-calendar-D8XaVe44.js.map → use-calendar-mU1joTwp.js.map} +1 -1
- package/dist/{use-slot-selection-Dj_tWg1O.cjs → use-slot-selection-CCOSsRSh.cjs} +2 -2
- package/dist/{use-slot-selection-Dj_tWg1O.cjs.map → use-slot-selection-CCOSsRSh.cjs.map} +1 -1
- package/dist/{use-slot-selection-CWRk_17s.js → use-slot-selection-CauKdLYv.js} +3 -3
- package/dist/{use-slot-selection-CWRk_17s.js.map → use-slot-selection-CauKdLYv.js.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.mjs +120 -109
- package/dist/{week-view-DY167Wok.js → week-view-BQXIaSUZ.js} +3 -3
- package/dist/{week-view-DY167Wok.js.map → week-view-BQXIaSUZ.js.map} +1 -1
- package/dist/{week-view-C1Vu2ErD.cjs → week-view-xrKlAJos.cjs} +2 -2
- package/dist/{week-view-C1Vu2ErD.cjs.map → week-view-xrKlAJos.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/position-utils-BQpbtF6N.cjs +0 -2
- package/dist/position-utils-BQpbtF6N.cjs.map +0 -1
- package/dist/position-utils-DMVQFywD.js.map +0 -1
- package/dist/slot-selection-context-CRstOosL.js.map +0 -1
- package/dist/slot-selection-context-DBCZI2Dn.cjs +0 -2
- package/dist/slot-selection-context-DBCZI2Dn.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slot-selection-context-D3MW4WJ7.js","sources":["../src/core/context/drag-drop-context.tsx","../src/core/preferences/types.ts","../src/core/preferences/use-preferences.ts","../src/core/context/inno-calendar-provider.tsx","../src/core/context/slot-selection-context.tsx"],"sourcesContent":["/**\n * DragDropContext - Drag & Drop State Management for Calendar Events\n *\n * Provides drag & drop state management for calendar events.\n * Enables dragging events between time slots and days.\n *\n * Features:\n * - Generic event type support via CalendarEvent<TData>\n * - Preview position tracking during drag\n * - Duration preservation when dropping\n * - Optional provider pattern (components can work without drag-drop)\n */\n\nimport { createContext, type ReactNode, useCallback, useContext, useState } from 'react';\nimport type { CalendarEvent } from '../types';\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\nexport interface IDragState<TData = Record<string, unknown>> {\n\t/** The event being dragged */\n\tevent: CalendarEvent<TData>;\n\t/** Original start date of the event */\n\toriginalStartDate: Date;\n\t/** Original end date of the event */\n\toriginalEndDate: Date;\n\t/** Current preview position (during drag) */\n\tpreviewDate?: Date | undefined;\n\t/** Current preview hour (for time-based views) */\n\tpreviewHour?: number | undefined;\n\t/** Current preview minute */\n\tpreviewMinute?: number | undefined;\n\t/** Original resource/row ID (for resource/timeline views) */\n\toriginalResourceId?: string | undefined;\n\t/** Current target resource/row ID during drag (for resource/timeline views) */\n\ttargetResourceId?: string | undefined;\n}\n\nexport interface IDropResult<TData = Record<string, unknown>> {\n\t/** The event that was dropped */\n\tevent: CalendarEvent<TData>;\n\t/** New start date after drop */\n\tnewStartDate: Date;\n\t/** New end date after drop (maintains original duration) */\n\tnewEndDate: Date;\n\t/** New resource/row ID after drop (for resource/timeline views) */\n\tnewResourceId?: string | undefined;\n}\n\nexport interface IDragDropContext<TData = Record<string, unknown>> {\n\t/** Current drag state, null when not dragging */\n\tdragState: IDragState<TData> | null;\n\t/** Whether a drag operation is in progress */\n\tisDragging: boolean;\n\t/** Start dragging an event */\n\t// biome-ignore lint/suspicious/noExplicitAny: Accept any event type for flexibility\n\tstartDrag: (event: CalendarEvent<any>) => void;\n\t/** Update drag preview position */\n\tupdateDragPreview: (date: Date, hour?: number, minute?: number, resourceId?: string) => void;\n\t/** End drag operation and return drop result */\n\tendDrag: () => IDropResult<TData> | null;\n\t/** Cancel drag operation */\n\tcancelDrag: () => void;\n}\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n// biome-ignore lint/suspicious/noExplicitAny: Context needs to be flexible for different event types\nconst DragDropContext = createContext<IDragDropContext<any> | undefined>(undefined);\n\n// ============================================================================\n// PROVIDER PROPS\n// ============================================================================\n\nexport interface DragDropProviderProps<TData = Record<string, unknown>> {\n\tchildren: ReactNode;\n\t/** Callback when an event is dropped at a new location */\n\tonEventDrop?: (result: IDropResult<TData>) => void;\n}\n\n// ============================================================================\n// PROVIDER\n// ============================================================================\n\nexport function DragDropProvider<TData = Record<string, unknown>>({\n\tchildren,\n\tonEventDrop,\n}: DragDropProviderProps<TData>) {\n\tconst [dragState, setDragState] = useState<IDragState<TData> | null>(null);\n\n\t// biome-ignore lint/suspicious/noExplicitAny: Accept any event type for flexibility\n\tconst startDrag = useCallback((event: CalendarEvent<any>) => {\n\t\tconst startDate =\n\t\t\ttypeof event.startDate === 'string' ? new Date(event.startDate) : event.startDate;\n\t\tconst endDate = typeof event.endDate === 'string' ? new Date(event.endDate) : event.endDate;\n\n\t\tsetDragState({\n\t\t\tevent: event as CalendarEvent<TData>,\n\t\t\toriginalStartDate: startDate,\n\t\t\toriginalEndDate: endDate,\n\t\t});\n\t}, []);\n\n\tconst updateDragPreview = useCallback((date: Date, hour?: number, minute?: number, resourceId?: string) => {\n\t\tsetDragState((prev) => {\n\t\t\tif (!prev) return null;\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tpreviewDate: date,\n\t\t\t\tpreviewHour: hour,\n\t\t\t\tpreviewMinute: minute,\n\t\t\t\t...(resourceId !== undefined && { targetResourceId: resourceId }),\n\t\t\t};\n\t\t});\n\t}, []);\n\n\tconst endDrag = useCallback(() => {\n\t\tif (!dragState) return null;\n\n\t\tconst { event, originalStartDate, originalEndDate, previewDate, previewHour, previewMinute, targetResourceId } =\n\t\t\tdragState;\n\n\t\t// Calculate duration of original event\n\t\tconst durationMs = originalEndDate.getTime() - originalStartDate.getTime();\n\n\t\t// Calculate new start date\n\t\tlet newStartDate: Date;\n\n\t\tif (previewDate) {\n\t\t\tnewStartDate = new Date(previewDate);\n\n\t\t\tif (typeof previewHour === 'number') {\n\t\t\t\t// Time-based drop (day/week view)\n\t\t\t\tnewStartDate.setHours(previewHour, previewMinute ?? 0, 0, 0);\n\t\t\t} else {\n\t\t\t\t// Day-based drop (month view) - keep original time\n\t\t\t\tnewStartDate.setHours(\n\t\t\t\t\toriginalStartDate.getHours(),\n\t\t\t\t\toriginalStartDate.getMinutes(),\n\t\t\t\t\toriginalStartDate.getSeconds(),\n\t\t\t\t\t0\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\t// No preview, return to original position\n\t\t\tnewStartDate = originalStartDate;\n\t\t}\n\n\t\t// Calculate new end date maintaining duration\n\t\tconst newEndDate = new Date(newStartDate.getTime() + durationMs);\n\n\t\tconst result: IDropResult<TData> = {\n\t\t\tevent,\n\t\t\tnewStartDate,\n\t\t\tnewEndDate,\n\t\t\t...(targetResourceId !== undefined && { newResourceId: targetResourceId }),\n\t\t};\n\n\t\t// Clear drag state\n\t\tsetDragState(null);\n\n\t\t// Notify parent\n\t\tonEventDrop?.(result);\n\n\t\treturn result;\n\t}, [dragState, onEventDrop]);\n\n\tconst cancelDrag = useCallback(() => {\n\t\tsetDragState(null);\n\t}, []);\n\n\treturn (\n\t\t<DragDropContext.Provider\n\t\t\tvalue={{\n\t\t\t\tdragState,\n\t\t\t\tisDragging: dragState !== null,\n\t\t\t\tstartDrag,\n\t\t\t\tupdateDragPreview,\n\t\t\t\tendDrag,\n\t\t\t\tcancelDrag,\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</DragDropContext.Provider>\n\t);\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Access drag & drop context (required)\n *\n * @throws Error if used outside of DragDropProvider\n */\nexport function useDragDrop<TData = Record<string, unknown>>(): IDragDropContext<TData> {\n\tconst context = useContext(DragDropContext);\n\tif (!context) {\n\t\tthrow new Error('useDragDrop must be used within a DragDropProvider');\n\t}\n\treturn context as IDragDropContext<TData>;\n}\n\n/**\n * Access drag & drop context (optional)\n *\n * Use this for components that may be rendered outside of DragDropProvider.\n * Returns null when drag-drop is not available.\n */\nexport function useOptionalDragDrop<\n\tTData = Record<string, unknown>,\n>(): IDragDropContext<TData> | null {\n\tconst context = useContext(DragDropContext);\n\treturn (context as IDragDropContext<TData>) ?? null;\n}\n","/**\n * Calendar Preferences Types\n *\n * Type definitions for the calendar preferences system.\n * This module enables:\n * - Persistent user preferences via localStorage\n * - Developer-controlled defaults and overrides\n * - Locking preferences to prevent user modifications\n * - Complete customization for different deployment scenarios\n */\n\nimport type { TBadgeVariant, TCalendarView, TSlotDuration } from '../types';\n\n// ============================================================================\n// PREFERENCE KEYS\n// ============================================================================\n\n/**\n * All available preference keys\n */\nexport type TPreferenceKey =\n\t| 'view'\n\t| 'badgeVariant'\n\t| 'slotDuration'\n\t| 'visibleHours'\n\t| 'workingHours'\n\t| 'showWorkingHoursOnly'\n\t| 'showWeekends'\n\t| 'firstDayOfWeek';\n\n/**\n * Storage key for localStorage\n */\nexport const PREFERENCES_STORAGE_KEY = 'inno-calendar-preferences';\n\n// ============================================================================\n// PREFERENCE VALUE TYPES\n// ============================================================================\n\n/**\n * Visible hours configuration\n */\nexport interface IVisibleHoursConfig {\n\tfrom: number;\n\tto: number;\n}\n\n/**\n * Working hours configuration per day of week\n * Key: 0 = Sunday, 1 = Monday, ..., 6 = Saturday\n */\nexport type TWorkingHoursConfig = {\n\t[dayIndex: number]: { from: number; to: number };\n};\n\n// ============================================================================\n// PREFERENCE VALUES\n// ============================================================================\n\n/**\n * Complete preferences object structure\n */\nexport interface IPreferences {\n\t/** Default calendar view */\n\tview: TCalendarView;\n\t/** Event badge display style */\n\tbadgeVariant: TBadgeVariant;\n\t/** Time slot duration in minutes (15, 30, 60) */\n\tslotDuration: TSlotDuration;\n\t/** Visible hours range for day/week views */\n\tvisibleHours: IVisibleHoursConfig;\n\t/** Working hours configuration per day */\n\tworkingHours: TWorkingHoursConfig;\n\t/** Show only working hours in day/week views */\n\tshowWorkingHoursOnly: boolean;\n\t/** Show weekend days */\n\tshowWeekends: boolean;\n\t/** First day of week (0 = Sunday, 1 = Monday, etc.) */\n\tfirstDayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6;\n}\n\n/**\n * Partial preferences for updates\n */\nexport type TPartialPreferences = Partial<IPreferences>;\n\n// ============================================================================\n// PREFERENCE CONTROL\n// ============================================================================\n\n/**\n * Control mode for each preference\n * - 'user': User can modify, persisted to localStorage\n * - 'locked': Developer-controlled, cannot be modified by user\n * - 'session': User can modify during session, not persisted\n */\nexport type TPreferenceMode = 'user' | 'locked' | 'session';\n\n/**\n * Configuration for preference control\n * Allows developers to lock certain preferences to specific values\n */\nexport type TPreferenceModes = {\n\t[K in TPreferenceKey]?: TPreferenceMode;\n};\n\n/**\n * Locked values for preferences\n * When a preference mode is 'locked', this value is used\n */\nexport type TLockedPreferences = TPartialPreferences;\n\n// ============================================================================\n// PREFERENCES CONFIG\n// ============================================================================\n\n/**\n * Complete preferences configuration for developers\n *\n * @example\n * // Allow all preferences to be user-controlled (default)\n * const config: IPreferencesConfig = {};\n *\n * @example\n * // Lock slot duration to 30 minutes, let users control the rest\n * const config: IPreferencesConfig = {\n * modes: { slotDuration: 'locked' },\n * locked: { slotDuration: 30 }\n * };\n *\n * @example\n * // Completely override all preferences (no user control)\n * const config: IPreferencesConfig = {\n * modes: {\n * view: 'locked',\n * badgeVariant: 'locked',\n * slotDuration: 'locked',\n * visibleHours: 'locked',\n * workingHours: 'locked',\n * showWorkingHoursOnly: 'locked'\n * },\n * locked: {\n * view: 'week',\n * badgeVariant: 'colored',\n * slotDuration: 30,\n * visibleHours: { from: 8, to: 18 },\n * workingHours: { ... },\n * showWorkingHoursOnly: true\n * }\n * };\n */\nexport interface IPreferencesConfig {\n\t/**\n\t * Control mode for each preference\n\t * Defaults to 'user' for all preferences\n\t */\n\tmodes?: TPreferenceModes;\n\n\t/**\n\t * Values to use when preference mode is 'locked'\n\t */\n\tlocked?: TLockedPreferences;\n\n\t/**\n\t * Custom default values (used when no stored preference exists)\n\t * These override the system defaults\n\t */\n\tdefaults?: TPartialPreferences;\n\n\t/**\n\t * Custom localStorage key (default: 'inno-calendar-preferences')\n\t * Useful when multiple calendar instances need separate storage\n\t */\n\tstorageKey?: string;\n\n\t/**\n\t * Disable localStorage entirely\n\t * All preferences will reset on page reload\n\t */\n\tdisableStorage?: boolean;\n}\n\n// ============================================================================\n// HOOK RETURN TYPE\n// ============================================================================\n\n/**\n * Return type for useCalendarPreferences hook\n */\nexport interface IUsePreferencesReturn {\n\t/** Current preference values */\n\tpreferences: IPreferences;\n\n\t/** Update a single preference */\n\tsetPreference: <K extends TPreferenceKey>(key: K, value: IPreferences[K]) => void;\n\n\t/** Update multiple preferences at once */\n\tsetPreferences: (updates: TPartialPreferences) => void;\n\n\t/** Reset preferences to defaults */\n\tresetPreferences: () => void;\n\n\t/** Reset a single preference to default */\n\tresetPreference: (key: TPreferenceKey) => void;\n\n\t/** Check if a preference is locked */\n\tisLocked: (key: TPreferenceKey) => boolean;\n\n\t/** Check if a preference is persisted */\n\tisPersisted: (key: TPreferenceKey) => boolean;\n\n\t/** Get the mode for a preference */\n\tgetMode: (key: TPreferenceKey) => TPreferenceMode;\n}\n","/**\n * Calendar Preferences Hook\n *\n * Manages calendar preferences with localStorage persistence and developer control.\n *\n * Features:\n * - Automatic localStorage persistence\n * - Developer-controlled defaults and overrides\n * - Preference locking for controlled deployments\n * - Session-only preferences that don't persist\n * - Type-safe preference access and updates\n *\n * @example Basic usage\n * ```tsx\n * const { preferences, setPreference } = useCalendarPreferences();\n * setPreference('slotDuration', 30);\n * ```\n *\n * @example With developer configuration\n * ```tsx\n * const { preferences } = useCalendarPreferences({\n * modes: { slotDuration: 'locked' },\n * locked: { slotDuration: 60 },\n * defaults: { view: 'week' }\n * });\n * ```\n */\n\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { TWorkingHours } from '../types';\nimport {\n\ttype IPreferences,\n\ttype IPreferencesConfig,\n\ttype IUsePreferencesReturn,\n\tPREFERENCES_STORAGE_KEY,\n\ttype TPartialPreferences,\n\ttype TPreferenceKey,\n\ttype TPreferenceMode,\n} from './types';\n\n// ============================================================================\n// SYSTEM DEFAULTS\n// ============================================================================\n\n/**\n * Default visible hours\n */\nexport const DEFAULT_VISIBLE_HOURS = {\n\tfrom: 0,\n\tto: 24,\n};\n\n/**\n * Default working hours (Monday-Friday, 8am-6pm)\n */\nexport const DEFAULT_WORKING_HOURS: TWorkingHours = {\n\t0: { enabled: false, from: 8, to: 18 }, // Sunday - disabled\n\t1: { enabled: true, from: 8, to: 18 }, // Monday\n\t2: { enabled: true, from: 8, to: 18 }, // Tuesday\n\t3: { enabled: true, from: 8, to: 18 }, // Wednesday\n\t4: { enabled: true, from: 8, to: 18 }, // Thursday\n\t5: { enabled: true, from: 8, to: 18 }, // Friday\n\t6: { enabled: false, from: 8, to: 18 }, // Saturday - disabled\n};\n\n/**\n * Default slot duration in minutes\n */\nexport const DEFAULT_SLOT_DURATION = 30;\n\n/**\n * System default preferences\n * These are used when no stored preference or custom default exists\n */\nconst SYSTEM_DEFAULTS: IPreferences = {\n\tview: 'month',\n\tbadgeVariant: 'colored',\n\tslotDuration: DEFAULT_SLOT_DURATION,\n\tvisibleHours: DEFAULT_VISIBLE_HOURS,\n\tworkingHours: DEFAULT_WORKING_HOURS,\n\tshowWorkingHoursOnly: false,\n\tshowWeekends: true,\n\tfirstDayOfWeek: 1,\n};\n\n// ============================================================================\n// STORAGE HELPERS\n// ============================================================================\n\n/**\n * Load preferences from localStorage\n */\nfunction loadFromStorage(key: string): TPartialPreferences {\n\tif (typeof window === 'undefined') return {};\n\n\ttry {\n\t\tconst stored = localStorage.getItem(key);\n\t\tif (!stored) return {};\n\n\t\tconst parsed = JSON.parse(stored);\n\n\t\t// Validate and sanitize stored values\n\t\tconst sanitized: TPartialPreferences = {};\n\n\t\tif (parsed.view && typeof parsed.view === 'string') {\n\t\t\tsanitized.view = parsed.view;\n\t\t}\n\n\t\tif (parsed.badgeVariant && typeof parsed.badgeVariant === 'string') {\n\t\t\tsanitized.badgeVariant = parsed.badgeVariant;\n\t\t}\n\n\t\tif (parsed.slotDuration && typeof parsed.slotDuration === 'number') {\n\t\t\tsanitized.slotDuration = parsed.slotDuration;\n\t\t}\n\n\t\tif (parsed.visibleHours && typeof parsed.visibleHours === 'object') {\n\t\t\tsanitized.visibleHours = parsed.visibleHours;\n\t\t}\n\n\t\tif (parsed.workingHours && typeof parsed.workingHours === 'object') {\n\t\t\tsanitized.workingHours = parsed.workingHours;\n\t\t}\n\n\t\tif (typeof parsed.showWorkingHoursOnly === 'boolean') {\n\t\t\tsanitized.showWorkingHoursOnly = parsed.showWorkingHoursOnly;\n\t\t}\n\n\t\tif (typeof parsed.showWeekends === 'boolean') {\n\t\t\tsanitized.showWeekends = parsed.showWeekends;\n\t\t}\n\n\t\tif (typeof parsed.firstDayOfWeek === 'number') {\n\t\t\tsanitized.firstDayOfWeek = parsed.firstDayOfWeek;\n\t\t}\n\n\t\treturn sanitized;\n\t} catch {\n\t\tconsole.warn('[InnoCalendar] Failed to load preferences from localStorage');\n\t\treturn {};\n\t}\n}\n\n/**\n * Save preferences to localStorage\n */\nfunction saveToStorage(key: string, preferences: TPartialPreferences): void {\n\tif (typeof window === 'undefined') return;\n\n\ttry {\n\t\tlocalStorage.setItem(key, JSON.stringify(preferences));\n\t} catch {\n\t\tconsole.warn('[InnoCalendar] Failed to save preferences to localStorage');\n\t}\n}\n\n// ============================================================================\n// HOOK\n// ============================================================================\n\n/**\n * Calendar preferences hook with localStorage persistence\n *\n * @param config - Optional configuration for preferences behavior\n * @returns Preferences state and control functions\n */\nexport function useCalendarPreferences(config: IPreferencesConfig = {}): IUsePreferencesReturn {\n\tconst {\n\t\tmodes = {},\n\t\tlocked = {},\n\t\tdefaults = {},\n\t\tstorageKey = PREFERENCES_STORAGE_KEY,\n\t\tdisableStorage = false,\n\t} = config;\n\n\t// Compute effective defaults (system + custom)\n\tconst effectiveDefaults = useMemo<IPreferences>(\n\t\t() => ({\n\t\t\t...SYSTEM_DEFAULTS,\n\t\t\t...defaults,\n\t\t}),\n\t\t[defaults]\n\t);\n\n\t// Initialize state with stored + defaults\n\tconst [storedPreferences, setStoredPreferences] = useState<TPartialPreferences>(() => {\n\t\tif (disableStorage) return {};\n\t\treturn loadFromStorage(storageKey);\n\t});\n\n\t// Session-only preferences (not persisted)\n\tconst [sessionPreferences, setSessionPreferences] = useState<TPartialPreferences>({});\n\n\t// Save to localStorage when stored preferences change\n\tuseEffect(() => {\n\t\tif (disableStorage) return;\n\t\tsaveToStorage(storageKey, storedPreferences);\n\t}, [storedPreferences, storageKey, disableStorage]);\n\n\t// Get mode for a preference\n\tconst getMode = useCallback(\n\t\t(key: TPreferenceKey): TPreferenceMode => {\n\t\t\treturn modes[key] ?? 'user';\n\t\t},\n\t\t[modes]\n\t);\n\n\t// Check if preference is locked\n\tconst isLocked = useCallback(\n\t\t(key: TPreferenceKey): boolean => {\n\t\t\treturn getMode(key) === 'locked';\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Check if preference is persisted\n\tconst isPersisted = useCallback(\n\t\t(key: TPreferenceKey): boolean => {\n\t\t\tconst mode = getMode(key);\n\t\t\treturn mode === 'user' && !disableStorage;\n\t\t},\n\t\t[getMode, disableStorage]\n\t);\n\n\t// Compute final preferences (locked > session > stored > defaults)\n\tconst preferences = useMemo<IPreferences>(() => {\n\t\tconst result = { ...effectiveDefaults };\n\n\t\t// Apply stored preferences (for 'user' mode)\n\t\tfor (const key of Object.keys(result) as TPreferenceKey[]) {\n\t\t\tconst mode = getMode(key);\n\n\t\t\tif (mode === 'locked' && key in locked) {\n\t\t\t\t// Use locked value\n\t\t\t\t(result as Record<string, unknown>)[key] = locked[key];\n\t\t\t} else if (mode === 'session' && key in sessionPreferences) {\n\t\t\t\t// Use session value\n\t\t\t\t(result as Record<string, unknown>)[key] = sessionPreferences[key];\n\t\t\t} else if (mode === 'user' && key in storedPreferences) {\n\t\t\t\t// Use stored value\n\t\t\t\t(result as Record<string, unknown>)[key] = storedPreferences[key];\n\t\t\t}\n\t\t\t// Otherwise, keep default\n\t\t}\n\n\t\treturn result;\n\t}, [effectiveDefaults, storedPreferences, sessionPreferences, locked, getMode]);\n\n\t// Set a single preference\n\tconst setPreference = useCallback(\n\t\t<K extends TPreferenceKey>(key: K, value: IPreferences[K]) => {\n\t\t\tconst mode = getMode(key);\n\n\t\t\t// Can't modify locked preferences\n\t\t\tif (mode === 'locked') {\n\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be modified`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mode === 'session') {\n\t\t\t\tsetSessionPreferences((prev) => ({ ...prev, [key]: value }));\n\t\t\t} else {\n\t\t\t\tsetStoredPreferences((prev) => ({ ...prev, [key]: value }));\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Set multiple preferences at once\n\tconst setPreferences = useCallback(\n\t\t(updates: TPartialPreferences) => {\n\t\t\tconst sessionUpdates: TPartialPreferences = {};\n\t\t\tconst storedUpdates: TPartialPreferences = {};\n\n\t\t\tfor (const key of Object.keys(updates) as TPreferenceKey[]) {\n\t\t\t\tconst mode = getMode(key);\n\t\t\t\tconst value = updates[key];\n\n\t\t\t\tif (value === undefined) continue;\n\n\t\t\t\tif (mode === 'locked') {\n\t\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be modified`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'session') {\n\t\t\t\t\t(sessionUpdates as Record<string, unknown>)[key] = value;\n\t\t\t\t} else {\n\t\t\t\t\t(storedUpdates as Record<string, unknown>)[key] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (Object.keys(sessionUpdates).length > 0) {\n\t\t\t\tsetSessionPreferences((prev) => ({ ...prev, ...sessionUpdates }));\n\t\t\t}\n\n\t\t\tif (Object.keys(storedUpdates).length > 0) {\n\t\t\t\tsetStoredPreferences((prev) => ({ ...prev, ...storedUpdates }));\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\t// Reset all preferences to defaults\n\tconst resetPreferences = useCallback(() => {\n\t\tsetStoredPreferences({});\n\t\tsetSessionPreferences({});\n\n\t\tif (!disableStorage) {\n\t\t\tlocalStorage.removeItem(storageKey);\n\t\t}\n\t}, [storageKey, disableStorage]);\n\n\t// Reset a single preference to default\n\tconst resetPreference = useCallback(\n\t\t(key: TPreferenceKey) => {\n\t\t\tconst mode = getMode(key);\n\n\t\t\tif (mode === 'locked') {\n\t\t\t\tconsole.warn(`[InnoCalendar] Preference \"${key}\" is locked and cannot be reset`);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (mode === 'session') {\n\t\t\t\tsetSessionPreferences((prev) => {\n\t\t\t\t\tconst { [key]: _, ...rest } = prev;\n\t\t\t\t\treturn rest;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tsetStoredPreferences((prev) => {\n\t\t\t\t\tconst { [key]: _, ...rest } = prev;\n\t\t\t\t\treturn rest;\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t[getMode]\n\t);\n\n\treturn {\n\t\tpreferences,\n\t\tsetPreference,\n\t\tsetPreferences,\n\t\tresetPreferences,\n\t\tresetPreference,\n\t\tisLocked,\n\t\tisPersisted,\n\t\tgetMode,\n\t};\n}\n\nexport default useCalendarPreferences;\n","/**\n * InnoCalendar Provider\n *\n * A CalendarProvider that matches agenda-v2's API exactly.\n * This is an all-in-one provider that manages state internally\n * rather than requiring consumers to use useCalendar separately.\n *\n * Features:\n * - Automatic preference persistence to localStorage\n * - Developer-controlled preference locking\n * - Same prop interface as agenda-v2's CalendarProvider\n * - Same context shape for component compatibility\n */\n\nimport {\n createContext,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport {\n type IPreferencesConfig,\n type TPreferenceKey,\n useCalendarPreferences,\n} from \"../preferences\";\nimport type {\n CalendarEvent,\n ICalendarUser,\n IScheduleType,\n TBadgeVariant,\n TCalendarView,\n TSlotDuration,\n TWorkingHours,\n} from \"../types\";\nimport { reactNodeToText } from \"../utils/react-node-utils\";\nimport {\n readCalendarView,\n readResourceView,\n saveViewByFamily,\n} from \"../utils/view-storage\";\n\n// ============================================================================\n// TYPES\n// ============================================================================\n\n// Re-export types from core/types for convenience\nexport type { IWorkingHoursDay, TSlotDuration, TWorkingHours } from \"../types\";\n\n/**\n * Visible hours configuration\n * Using start/end to match agenda-v2 naming\n */\nexport interface TVisibleHours {\n start: number;\n end: number;\n}\n\n// ============================================================================\n// CONTEXT INTERFACE - Matches agenda-v2 exactly\n// ============================================================================\n\nexport interface IInnoCalendarContext<TEventData = Record<string, unknown>> {\n // View & Navigation\n view: TCalendarView;\n setView: (view: TCalendarView) => void;\n selectedDate: Date;\n /** Set selected date. Pass optional forView to use that view for date range calculation. */\n setSelectedDate: (date: Date, forView?: TCalendarView) => void;\n\n // User/Participant Filtering\n selectedUserId: string | \"all\";\n setSelectedUserId: (userId: string | \"all\") => void;\n\n // Visual Customization\n badgeVariant: TBadgeVariant;\n setBadgeVariant: (variant: TBadgeVariant) => void;\n\n // Time Configuration\n workingHours: TWorkingHours;\n setWorkingHours: Dispatch<SetStateAction<TWorkingHours>>;\n visibleHours: TVisibleHours;\n setVisibleHours: Dispatch<SetStateAction<TVisibleHours>>;\n showWorkingHoursOnly: boolean;\n setShowWorkingHoursOnly: (show: boolean) => void;\n slotDuration: TSlotDuration;\n setSlotDuration: (duration: TSlotDuration) => void;\n\n // Preferences\n /**\n * Check if a specific preference is locked by the developer.\n * Useful for conditionally disabling UI controls.\n */\n isPreferenceLocked: (key: TPreferenceKey) => boolean;\n\n // Data\n events: CalendarEvent<TEventData>[];\n setEvents: Dispatch<SetStateAction<CalendarEvent<TEventData>[]>>;\n users: ICalendarUser[];\n scheduleTypes: IScheduleType[];\n\n // Filter state (schedule types)\n selectedScheduleTypeIds: number[];\n setSelectedScheduleTypeIds: Dispatch<SetStateAction<number[]>>;\n\n // Search\n searchQuery: string;\n setSearchQuery: (query: string) => void;\n\n // Computed / Filtered Events\n filteredEvents: CalendarEvent<TEventData>[];\n\n // Focus Event (auto-open popover for a specific event)\n /**\n * When set, the EventCard / EventBlock whose `event.id` matches this value\n * will automatically open its popover after rendering.\n * Cleared automatically after the popover opens.\n */\n focusEventId: string | null;\n /** Clear the focused event (called internally after popover opens). */\n clearFocusEventId: () => void;\n}\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\n// biome-ignore lint/suspicious/noExplicitAny: Context needs flexibility for different event types\nconst InnoCalendarContext = createContext<\n IInnoCalendarContext<any> | undefined\n>(undefined);\n\n// ============================================================================\n// DEFAULT WORKING HOURS\n// ============================================================================\n\nconst DEFAULT_WORKING_HOURS: TWorkingHours = {\n 0: { enabled: false, from: 8, to: 17 }, // Sunday\n 1: { enabled: true, from: 8, to: 17 }, // Monday\n 2: { enabled: true, from: 8, to: 17 }, // Tuesday\n 3: { enabled: true, from: 8, to: 17 }, // Wednesday\n 4: { enabled: true, from: 8, to: 17 }, // Thursday\n 5: { enabled: true, from: 8, to: 17 }, // Friday\n 6: { enabled: true, from: 8, to: 12 }, // Saturday\n};\n\nconst DEFAULT_VISIBLE_HOURS: TVisibleHours = { start: 0, end: 24 };\n\n// ============================================================================\n// PROVIDER PROPS - Matches agenda-v2 exactly\n// ============================================================================\n\nexport interface InnoCalendarProviderProps<\n TEventData = Record<string, unknown>,\n> {\n children: ReactNode;\n\n // Initial data from server/loader\n initialEvents?: CalendarEvent<TEventData>[];\n initialUsers?: ICalendarUser[];\n initialScheduleTypes?: IScheduleType[];\n\n // Initial filter state (from URL)\n initialView?: TCalendarView;\n initialDate?: Date;\n initialSelectedUserId?: string | \"all\";\n initialScheduleTypeIds?: number[];\n initialParticipantIds?: string[];\n initialWorkingHoursView?: \"default\" | \"enabled\" | \"disabled\";\n initialSearchQuery?: string;\n\n /**\n * Preferences configuration for developer control\n */\n preferencesConfig?: IPreferencesConfig;\n\n /**\n * When set, the event with this ID will auto-open its popover after rendering.\n * Useful for deep-linking from other pages (e.g. clicking an appointment\n * in an overview card that navigates to the agenda with a specific event).\n */\n initialFocusEventId?: string | null;\n\n // Callbacks for parent sync\n onDateChange?: (date: Date, view: TCalendarView) => void;\n onViewChange?: (view: TCalendarView) => void;\n}\n\n// ============================================================================\n// PROVIDER COMPONENT\n// ============================================================================\n\nexport function InnoCalendarProvider<TEventData = Record<string, unknown>>({\n children,\n initialEvents = [],\n initialUsers = [],\n initialScheduleTypes = [],\n initialView,\n initialDate,\n initialSelectedUserId = \"all\",\n initialScheduleTypeIds = [],\n initialParticipantIds = [],\n initialWorkingHoursView = \"default\",\n initialSearchQuery = \"\",\n preferencesConfig,\n initialFocusEventId = null,\n onDateChange,\n onViewChange,\n}: InnoCalendarProviderProps<TEventData>) {\n // ========================================================================\n // PREFERENCES (persisted to localStorage)\n // ========================================================================\n const { preferences, setPreference, isLocked } =\n useCalendarPreferences(preferencesConfig);\n\n // ========================================================================\n // VIEW & NAVIGATION\n // ========================================================================\n const [view, setViewInternal] = useState<TCalendarView>(\n initialView ??\n (preferences.view as TCalendarView) ??\n readCalendarView() ??\n readResourceView() ??\n \"week\",\n );\n const [selectedDate, setSelectedDateInternal] = useState<Date>(\n initialDate ?? new Date(),\n );\n\n // User Filtering\n const [selectedUserId, setSelectedUserId] = useState<string | \"all\">(\n initialSelectedUserId,\n );\n\n // ========================================================================\n // PREFERENCE-BACKED STATE\n // ========================================================================\n const badgeVariant = (preferences.badgeVariant as TBadgeVariant) ?? \"colored\";\n const setBadgeVariant = useCallback(\n (variant: TBadgeVariant) => {\n if (!isLocked(\"badgeVariant\")) {\n setPreference(\"badgeVariant\", variant);\n }\n },\n [setPreference, isLocked],\n );\n\n const workingHours =\n (preferences.workingHours as TWorkingHours) ?? DEFAULT_WORKING_HOURS;\n const setWorkingHours: Dispatch<SetStateAction<TWorkingHours>> = useCallback(\n (action) => {\n if (!isLocked(\"workingHours\")) {\n const current =\n (preferences.workingHours as TWorkingHours) ?? DEFAULT_WORKING_HOURS;\n const newValue =\n typeof action === \"function\" ? action(current) : action;\n setPreference(\"workingHours\", newValue);\n }\n },\n [setPreference, isLocked, preferences.workingHours],\n );\n\n // Convert preferences format (from/to) to our format (start/end)\n const prefVisibleHours = preferences.visibleHours as\n | { from?: number; to?: number; start?: number; end?: number }\n | undefined;\n const visibleHours: TVisibleHours = useMemo(() => {\n if (!prefVisibleHours) return DEFAULT_VISIBLE_HOURS;\n // Handle both formats\n return {\n start: prefVisibleHours.start ?? prefVisibleHours.from ?? 0,\n end: prefVisibleHours.end ?? prefVisibleHours.to ?? 24,\n };\n }, [prefVisibleHours]);\n\n const setVisibleHours: Dispatch<SetStateAction<TVisibleHours>> = useCallback(\n (action) => {\n if (!isLocked(\"visibleHours\")) {\n const newValue =\n typeof action === \"function\" ? action(visibleHours) : action;\n // Store in preferences format (from/to)\n setPreference(\"visibleHours\", {\n from: newValue.start,\n to: newValue.end,\n });\n }\n },\n [setPreference, isLocked, visibleHours],\n );\n\n // showWorkingHoursOnly can be overridden by URL param\n const [showWorkingHoursOnlyState, setShowWorkingHoursOnlyState] = useState(\n initialWorkingHoursView === \"enabled\"\n ? true\n : initialWorkingHoursView === \"disabled\"\n ? false\n : ((preferences.showWorkingHoursOnly as boolean) ?? false),\n );\n const showWorkingHoursOnly = showWorkingHoursOnlyState;\n const setShowWorkingHoursOnly = useCallback(\n (show: boolean) => {\n setShowWorkingHoursOnlyState(show);\n if (!isLocked(\"showWorkingHoursOnly\")) {\n setPreference(\"showWorkingHoursOnly\", show);\n }\n },\n [setPreference, isLocked],\n );\n\n const slotDuration = (preferences.slotDuration as TSlotDuration) ?? 30;\n const setSlotDuration = useCallback(\n (duration: TSlotDuration) => {\n if (!isLocked(\"slotDuration\")) {\n setPreference(\"slotDuration\", duration);\n }\n },\n [setPreference, isLocked],\n );\n\n // ========================================================================\n // DATA\n // ========================================================================\n const [events, setEvents] =\n useState<CalendarEvent<TEventData>[]>(initialEvents);\n\n // Sync events when initialEvents changes (e.g., after navigation/refetch)\n useEffect(() => {\n setEvents(initialEvents);\n }, [initialEvents]);\n\n // Filter State\n const [selectedScheduleTypeIds, setSelectedScheduleTypeIds] = useState<\n number[]\n >(initialScheduleTypeIds);\n const [selectedParticipantIds, _setSelectedParticipantIds] = useState<\n string[]\n >(initialParticipantIds);\n\n // Search\n const [searchQuery, setSearchQuery] = useState(initialSearchQuery);\n\n // Focus Event (auto-open popover for a specific event)\n const [focusEventId, setFocusEventId] = useState<string | null>(\n initialFocusEventId ?? null,\n );\n\n // Sync focusEventId when the prop changes (e.g. URL navigation)\n useEffect(() => {\n if (initialFocusEventId) {\n setFocusEventId(initialFocusEventId);\n }\n }, [initialFocusEventId]);\n\n const clearFocusEventId = useCallback(() => setFocusEventId(null), []);\n\n // ========================================================================\n // VIEW & DATE SETTERS\n // ========================================================================\n const setView = useCallback(\n (newView: TCalendarView) => {\n setViewInternal(newView);\n if (!isLocked(\"view\")) {\n setPreference(\"view\", newView);\n }\n // Persist the last selection per family (calendar vs resource) so each\n // dropdown remembers its own most-recent value independently.\n saveViewByFamily(newView);\n onViewChange?.(newView);\n },\n [onViewChange, setPreference, isLocked],\n );\n\n const setSelectedDate = useCallback(\n (newDate: Date, forView?: TCalendarView) => {\n setSelectedDateInternal(newDate);\n onDateChange?.(newDate, forView ?? view);\n },\n [onDateChange, view],\n );\n\n // ========================================================================\n // FILTERED EVENTS\n // ========================================================================\n const filteredEvents = useMemo(() => {\n let result = events;\n\n // Filter by schedule type\n if (selectedScheduleTypeIds.length > 0) {\n result = result.filter(\n (event) =>\n event.scheduleTypeId !== undefined &&\n selectedScheduleTypeIds.includes(event.scheduleTypeId),\n );\n }\n\n // Filter by participant\n if (selectedParticipantIds.length > 0) {\n result = result.filter((event) => {\n // Check participants array (includes primary user in this model)\n if (event.participants?.length) {\n return event.participants.some((p) =>\n selectedParticipantIds.includes(p.id),\n );\n }\n return false;\n });\n }\n\n // Filter by selected user (single user view)\n if (selectedUserId !== \"all\") {\n result = result.filter((event) =>\n event.participants?.some((p) => p.id === selectedUserId),\n );\n }\n\n // Filter by search query\n if (searchQuery.trim()) {\n const query = searchQuery.toLowerCase();\n result = result.filter(\n (event) =>\n reactNodeToText(event.title).toLowerCase().includes(query) ||\n reactNodeToText(event.description).toLowerCase().includes(query) ||\n reactNodeToText(event.scheduleTypeName).toLowerCase().includes(query) ||\n event.participants?.some((p) => p.name.toLowerCase().includes(query)),\n );\n }\n\n return result;\n }, [\n events,\n selectedScheduleTypeIds,\n selectedParticipantIds,\n selectedUserId,\n searchQuery,\n ]);\n\n // ========================================================================\n // CONTEXT VALUE\n // ========================================================================\n const value = useMemo<IInnoCalendarContext<TEventData>>(\n () => ({\n // View & Navigation\n view,\n setView,\n selectedDate,\n setSelectedDate,\n\n // User Filtering\n selectedUserId,\n setSelectedUserId,\n\n // Visual Customization\n badgeVariant,\n setBadgeVariant,\n\n // Time Configuration\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n slotDuration,\n setSlotDuration,\n\n // Preferences\n isPreferenceLocked: isLocked,\n\n // Data\n events,\n setEvents,\n users: initialUsers,\n scheduleTypes: initialScheduleTypes,\n\n // Filters\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n\n // Search\n searchQuery,\n setSearchQuery,\n\n // Computed\n filteredEvents,\n\n // Focus Event\n focusEventId,\n clearFocusEventId,\n }),\n [\n view,\n setView,\n selectedDate,\n setSelectedDate,\n selectedUserId,\n badgeVariant,\n setBadgeVariant,\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n slotDuration,\n setSlotDuration,\n isLocked,\n events,\n initialUsers,\n initialScheduleTypes,\n selectedScheduleTypeIds,\n searchQuery,\n filteredEvents,\n focusEventId,\n clearFocusEventId,\n ],\n );\n\n return (\n <InnoCalendarContext.Provider value={value}>\n {children}\n </InnoCalendarContext.Provider>\n );\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\n/**\n * Get the full calendar context\n * This is the primary hook - use this in most components\n */\nexport function useInnoCalendar<\n TEventData = Record<string, unknown>,\n>(): IInnoCalendarContext<TEventData> {\n const context = useContext(InnoCalendarContext);\n if (!context) {\n throw new Error(\n \"useInnoCalendar must be used within an InnoCalendarProvider\",\n );\n }\n return context as IInnoCalendarContext<TEventData>;\n}\n\n/**\n * Optional calendar context hook\n */\nexport function useOptionalInnoCalendar<\n TEventData = Record<string, unknown>,\n>(): IInnoCalendarContext<TEventData> | undefined {\n return useContext(InnoCalendarContext) as\n | IInnoCalendarContext<TEventData>\n | undefined;\n}\n\n// ============================================================================\n// SELECTIVE HOOKS (for performance optimization)\n// ============================================================================\n\n/**\n * Access only view-related state\n */\nexport function useInnoCalendarView() {\n const { view, setView, selectedDate, setSelectedDate, slotDuration } =\n useInnoCalendar();\n return { view, setView, selectedDate, setSelectedDate, slotDuration };\n}\n\n/**\n * Access only events data\n */\nexport function useInnoCalendarEvents<TEventData = Record<string, unknown>>() {\n const { events, setEvents, filteredEvents } = useInnoCalendar<TEventData>();\n return { events, setEvents, filteredEvents };\n}\n\n/**\n * Access only filter state\n */\nexport function useInnoCalendarFilters() {\n const {\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n selectedUserId,\n setSelectedUserId,\n searchQuery,\n setSearchQuery,\n } = useInnoCalendar();\n return {\n selectedScheduleTypeIds,\n setSelectedScheduleTypeIds,\n selectedUserId,\n setSelectedUserId,\n searchQuery,\n setSearchQuery,\n };\n}\n\n/**\n * Access only time configuration\n */\nexport function useInnoCalendarTimeConfig() {\n const {\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n } = useInnoCalendar();\n return {\n workingHours,\n setWorkingHours,\n visibleHours,\n setVisibleHours,\n showWorkingHoursOnly,\n setShowWorkingHoursOnly,\n };\n}\n","/**\n * Slot Selection Context\n *\n * Provides centralized selection state management across all calendar views.\n * This context handles:\n * - Drag-to-select functionality\n * - Selection visualization\n * - Callback integration with parent components\n *\n * Usage:\n * 1. Wrap calendar views with SlotSelectionProvider\n * 2. Use useSlotSelectionContext in child components\n * 3. Connect onSelect callback to event creation dialog\n */\n\nimport {\n\tcreateContext,\n\ttype ReactNode,\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type {\n\tISelectionResult,\n\tISlotSelectionState,\n\tITimeSlot,\n\tTOnSlotSelect,\n\tTSelectionMode,\n} from '../types';\n\n// ============================================================================\n// CONTEXT TYPES\n// ============================================================================\n\ninterface ISlotSelectionContext {\n\t/** Current selection state */\n\tisSelecting: boolean;\n\t/** Start selection at a slot */\n\tstartSelection: (slot: ITimeSlot) => void;\n\t/** Update selection end point */\n\tupdateSelection: (slot: ITimeSlot) => void;\n\t/** Complete the selection */\n\tendSelection: () => void;\n\t/** Cancel the selection */\n\tcancelSelection: () => void;\n\t/** Check if a slot is within the current selection */\n\tisSlotSelected: (slot: ITimeSlot) => boolean;\n\t/** Get the normalized selection result */\n\tgetSelectionResult: () => ISelectionResult | null;\n\t/** Current selection mode */\n\tmode: TSelectionMode;\n\t/** Temporarily suppress selection (e.g. after popover dismiss) */\n\tsuppressSelection: () => void;\n}\n\n// ============================================================================\n// CONTEXT\n// ============================================================================\n\nconst SlotSelectionContext = createContext<ISlotSelectionContext | undefined>(undefined);\n\n// ============================================================================\n// PROVIDER PROPS\n// ============================================================================\n\ninterface SlotSelectionProviderProps {\n\tchildren: ReactNode;\n\t/** Selection mode based on view */\n\tmode?: TSelectionMode;\n\t/** Callback when selection completes */\n\tonSelect?: TOnSlotSelect;\n\t/** Minimum duration in minutes (for time mode) */\n\tminDurationMinutes?: number;\n\t/** Slot duration in minutes (default: 30) */\n\tslotDurationMinutes?: number;\n\t/** Whether selection is enabled */\n\tenabled?: boolean;\n}\n\n// ============================================================================\n// HELPERS\n// ============================================================================\n\n/**\n * Convert a time slot to a Date object\n */\nfunction slotToDate(slot: ITimeSlot): Date {\n\tconst date = new Date(slot.date);\n\tif (typeof slot.hour === 'number') {\n\t\tdate.setHours(slot.hour, slot.minute ?? 0, 0, 0);\n\t}\n\treturn date;\n}\n\n/**\n * Round time to nearest 30-minute interval\n */\nfunction roundToNearest30Minutes(date: Date): Date {\n\tconst result = new Date(date);\n\tconst minutes = result.getMinutes();\n\tconst roundedMinutes = Math.floor(minutes / 30) * 30;\n\tresult.setMinutes(roundedMinutes, 0, 0);\n\treturn result;\n}\n\n/**\n * Check if two dates are the same calendar day\n */\nfunction isSameDay(date1: Date, date2: Date): boolean {\n\treturn (\n\t\tdate1.getFullYear() === date2.getFullYear() &&\n\t\tdate1.getMonth() === date2.getMonth() &&\n\t\tdate1.getDate() === date2.getDate()\n\t);\n}\n\n/**\n * Normalize selection so start is always before end\n */\nfunction normalizeSelection(\n\tstart: ITimeSlot,\n\tend: ITimeSlot,\n\tmode: TSelectionMode,\n\tminDurationMinutes: number,\n\tslotDurationMinutes = 30\n): ISelectionResult {\n\tconst startDate = slotToDate(start);\n\tconst endDate = slotToDate(end);\n\n\t// Swap if end is before start\n\tlet normalizedStart = startDate;\n\tlet normalizedEnd = endDate;\n\n\tif (endDate < startDate) {\n\t\tnormalizedStart = endDate;\n\t\tnormalizedEnd = startDate;\n\t}\n\n\t// Apply mode-specific logic\n\tif (mode === 'day') {\n\t\t// Check if single day selection (same day click)\n\t\tif (isSameDay(normalizedStart, normalizedEnd)) {\n\t\t\t// Single day: use current time rounded to nearest 30 min + default duration\n\t\t\tconst now = new Date();\n\t\t\tconst roundedNow = roundToNearest30Minutes(now);\n\n\t\t\t// Set the date portion from the selected day\n\t\t\tnormalizedStart = new Date(normalizedStart);\n\t\t\tnormalizedStart.setHours(roundedNow.getHours(), roundedNow.getMinutes(), 0, 0);\n\n\t\t\t// End time = start + minimum duration (default 30 min)\n\t\t\tnormalizedEnd = new Date(normalizedStart.getTime() + minDurationMinutes * 60 * 1000);\n\t\t} else {\n\t\t\t// Multi-day selection: full days\n\t\t\tnormalizedStart.setHours(0, 0, 0, 0);\n\t\t\tnormalizedEnd.setHours(23, 59, 59, 999);\n\t\t}\n\t} else {\n\t\t// Time mode: The end slot represents the START of that slot block,\n\t\t// so we need to add slot duration to get the actual end time\n\t\tconst slotDurationMs = slotDurationMinutes * 60 * 1000;\n\t\tnormalizedEnd = new Date(normalizedEnd.getTime() + slotDurationMs);\n\n\t\t// Ensure minimum duration\n\t\tconst durationMs = normalizedEnd.getTime() - normalizedStart.getTime();\n\t\tconst minDurationMs = minDurationMinutes * 60 * 1000;\n\n\t\tif (durationMs < minDurationMs) {\n\t\t\tnormalizedEnd = new Date(normalizedStart.getTime() + minDurationMs);\n\t\t}\n\t}\n\n\treturn {\n\t\tstartDate: normalizedStart,\n\t\tendDate: normalizedEnd,\n\t};\n}\n\n/**\n * Check if a slot is within a selection range\n */\nfunction isSlotWithinRange(\n\tslot: ITimeSlot,\n\tstart: ITimeSlot,\n\tend: ITimeSlot,\n\tmode: TSelectionMode\n): boolean {\n\tconst slotDate = slotToDate(slot);\n\tconst startDate = slotToDate(start);\n\tconst endDate = slotToDate(end);\n\n\t// Normalize the range\n\tconst rangeStart = startDate <= endDate ? startDate : endDate;\n\tconst rangeEnd = startDate <= endDate ? endDate : startDate;\n\n\tif (mode === 'day') {\n\t\t// Day mode: check if slot's date is within range (ignore time)\n\t\tconst slotDay = new Date(slotDate);\n\t\tslotDay.setHours(0, 0, 0, 0);\n\t\tconst startDay = new Date(rangeStart);\n\t\tstartDay.setHours(0, 0, 0, 0);\n\t\tconst endDay = new Date(rangeEnd);\n\t\tendDay.setHours(0, 0, 0, 0);\n\t\treturn slotDay >= startDay && slotDay <= endDay;\n\t}\n\n\t// Time mode: precise check\n\treturn slotDate >= rangeStart && slotDate <= rangeEnd;\n}\n\n// ============================================================================\n// PROVIDER\n// ============================================================================\n\nexport function SlotSelectionProvider({\n\tchildren,\n\tmode = 'time',\n\tonSelect,\n\tminDurationMinutes = 30,\n\tslotDurationMinutes = 30,\n\tenabled = true,\n}: SlotSelectionProviderProps) {\n\tconst [selection, setSelection] = useState<ISlotSelectionState | null>(null);\n\tconst isSelectingRef = useRef(false);\n\tconst isSuppressedRef = useRef(false);\n\tconst suppressTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\t// Temporarily suppress selection (e.g. when a popover is dismissed by clicking outside)\n\tconst suppressSelection = useCallback(() => {\n\t\tisSuppressedRef.current = true;\n\t\tif (suppressTimerRef.current) clearTimeout(suppressTimerRef.current);\n\t\tsuppressTimerRef.current = setTimeout(() => {\n\t\t\tisSuppressedRef.current = false;\n\t\t}, 300);\n\t}, []);\n\n\t// Start selection\n\tconst startSelection = useCallback(\n\t\t(slot: ITimeSlot) => {\n\t\t\tif (!enabled || isSuppressedRef.current) return;\n\n\t\t\tisSelectingRef.current = true;\n\t\t\tsetSelection({\n\t\t\t\tstart: slot,\n\t\t\t\tend: slot,\n\t\t\t\tisSelecting: true,\n\t\t\t});\n\t\t},\n\t\t[enabled]\n\t);\n\n\t// Update selection end point\n\tconst updateSelection = useCallback(\n\t\t(slot: ITimeSlot) => {\n\t\t\tif (!(enabled && isSelectingRef.current)) return;\n\n\t\t\tsetSelection((prev) => {\n\t\t\t\tif (!prev) return null;\n\t\t\t\treturn {\n\t\t\t\t\t...prev,\n\t\t\t\t\tend: slot,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t\t[enabled]\n\t);\n\n\t// Complete selection and fire callback\n\tconst endSelection = useCallback(() => {\n\t\tif (!isSelectingRef.current) return;\n\n\t\tisSelectingRef.current = false;\n\n\t\tsetSelection((prev) => {\n\t\t\tif (!prev) return null;\n\n\t\t\t// Calculate final result\n\t\t\tconst result = normalizeSelection(\n\t\t\t\tprev.start,\n\t\t\t\tprev.end,\n\t\t\t\tmode,\n\t\t\t\tminDurationMinutes,\n\t\t\t\tslotDurationMinutes\n\t\t\t);\n\n\t\t\t// Fire callback\n\t\t\tonSelect?.(result);\n\n\t\t\t// Clear selection after a brief delay for visual feedback\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tisSelecting: false,\n\t\t\t};\n\t\t});\n\n\t\t// Clear selection after callback\n\t\tsetTimeout(() => {\n\t\t\tsetSelection(null);\n\t\t}, 100);\n\t}, [mode, minDurationMinutes, slotDurationMinutes, onSelect]);\n\n\t// Cancel selection without firing callback\n\tconst cancelSelection = useCallback(() => {\n\t\tisSelectingRef.current = false;\n\t\tsetSelection(null);\n\t}, []);\n\n\t// Check if a slot is in the current selection\n\tconst isSlotInSelection = useCallback(\n\t\t(slot: ITimeSlot): boolean => {\n\t\t\tif (!selection) return false;\n\t\t\treturn isSlotWithinRange(slot, selection.start, selection.end, mode);\n\t\t},\n\t\t[selection, mode]\n\t);\n\n\t// Get the normalized selection result\n\tconst getSelectionResult = useCallback((): ISelectionResult | null => {\n\t\tif (!selection) return null;\n\t\treturn normalizeSelection(\n\t\t\tselection.start,\n\t\t\tselection.end,\n\t\t\tmode,\n\t\t\tminDurationMinutes,\n\t\t\tslotDurationMinutes\n\t\t);\n\t}, [selection, mode, minDurationMinutes, slotDurationMinutes]);\n\n\t// Memoize context value\n\tconst value = useMemo<ISlotSelectionContext>(\n\t\t() => ({\n\t\t\tisSelecting: selection?.isSelecting ?? false,\n\t\t\tstartSelection,\n\t\t\tupdateSelection,\n\t\t\tendSelection,\n\t\t\tcancelSelection,\n\t\t\tisSlotSelected: isSlotInSelection,\n\t\t\tgetSelectionResult,\n\t\t\tmode,\n\t\t\tsuppressSelection,\n\t\t}),\n\t\t[\n\t\t\tselection?.isSelecting,\n\t\t\tstartSelection,\n\t\t\tupdateSelection,\n\t\t\tendSelection,\n\t\t\tcancelSelection,\n\t\t\tisSlotInSelection,\n\t\t\tgetSelectionResult,\n\t\t\tmode,\n\t\t\tsuppressSelection,\n\t\t]\n\t);\n\n\treturn <SlotSelectionContext.Provider value={value}>{children}</SlotSelectionContext.Provider>;\n}\n\n// ============================================================================\n// HOOKS\n// ============================================================================\n\nexport function useSlotSelectionContext(): ISlotSelectionContext {\n\tconst context = useContext(SlotSelectionContext);\n\tif (!context) {\n\t\tthrow new Error('useSlotSelectionContext must be used within a SlotSelectionProvider');\n\t}\n\treturn context;\n}\n\n/**\n * Optional hook that returns undefined if not in provider\n * Useful for components that can work with or without selection\n */\nexport function useOptionalSlotSelection(): ISlotSelectionContext | undefined {\n\treturn useContext(SlotSelectionContext);\n}\n\n// ============================================================================\n// TYPE EXPORTS\n// ============================================================================\n\nexport type { ISlotSelectionContext, SlotSelectionProviderProps };\n"],"names":["DragDropContext","createContext","DragDropProvider","children","onEventDrop","dragState","setDragState","useState","startDrag","useCallback","event","startDate","endDate","updateDragPreview","date","hour","minute","resourceId","prev","endDrag","originalStartDate","originalEndDate","previewDate","previewHour","previewMinute","targetResourceId","durationMs","newStartDate","newEndDate","result","cancelDrag","jsx","useDragDrop","context","useContext","useOptionalDragDrop","PREFERENCES_STORAGE_KEY","DEFAULT_VISIBLE_HOURS","DEFAULT_WORKING_HOURS","DEFAULT_SLOT_DURATION","SYSTEM_DEFAULTS","loadFromStorage","key","stored","parsed","sanitized","saveToStorage","preferences","useCalendarPreferences","config","modes","locked","defaults","storageKey","disableStorage","effectiveDefaults","useMemo","storedPreferences","setStoredPreferences","sessionPreferences","setSessionPreferences","useEffect","getMode","isLocked","isPersisted","mode","setPreference","value","setPreferences","updates","sessionUpdates","storedUpdates","resetPreferences","resetPreference","_","rest","InnoCalendarContext","InnoCalendarProvider","initialEvents","initialUsers","initialScheduleTypes","initialView","initialDate","initialSelectedUserId","initialScheduleTypeIds","initialParticipantIds","initialWorkingHoursView","initialSearchQuery","preferencesConfig","initialFocusEventId","onDateChange","onViewChange","view","setViewInternal","readCalendarView","readResourceView","selectedDate","setSelectedDateInternal","selectedUserId","setSelectedUserId","badgeVariant","setBadgeVariant","variant","workingHours","setWorkingHours","action","current","newValue","prefVisibleHours","visibleHours","setVisibleHours","showWorkingHoursOnlyState","setShowWorkingHoursOnlyState","showWorkingHoursOnly","setShowWorkingHoursOnly","show","slotDuration","setSlotDuration","duration","events","setEvents","selectedScheduleTypeIds","setSelectedScheduleTypeIds","selectedParticipantIds","_setSelectedParticipantIds","searchQuery","setSearchQuery","focusEventId","setFocusEventId","clearFocusEventId","setView","newView","saveViewByFamily","setSelectedDate","newDate","forView","filteredEvents","p","query","reactNodeToText","useInnoCalendar","useOptionalInnoCalendar","useInnoCalendarView","useInnoCalendarEvents","useInnoCalendarFilters","useInnoCalendarTimeConfig","SlotSelectionContext","slotToDate","slot","roundToNearest30Minutes","minutes","roundedMinutes","isSameDay","date1","date2","normalizeSelection","start","end","minDurationMinutes","slotDurationMinutes","normalizedStart","normalizedEnd","roundedNow","slotDurationMs","minDurationMs","isSlotWithinRange","slotDate","rangeStart","rangeEnd","slotDay","startDay","endDay","SlotSelectionProvider","onSelect","enabled","selection","setSelection","isSelectingRef","useRef","isSuppressedRef","suppressTimerRef","suppressSelection","startSelection","updateSelection","endSelection","cancelSelection","isSlotInSelection","getSelectionResult","useSlotSelectionContext","useOptionalSlotSelection"],"mappings":";;;AAuEA,MAAMA,IAAkBC,EAAiD,MAAS;AAgB3E,SAASC,GAAkD;AAAA,EACjE,UAAAC;AAAA,EACA,aAAAC;AACD,GAAiC;AAChC,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAmC,IAAI,GAGnEC,IAAYC,EAAY,CAACC,MAA8B;AAC5D,UAAMC,IACL,OAAOD,EAAM,aAAc,WAAW,IAAI,KAAKA,EAAM,SAAS,IAAIA,EAAM,WACnEE,IAAU,OAAOF,EAAM,WAAY,W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gBAAAtJ,EAACmH,EAAqB,UAArB,EAA8B,OAAA/E,GAAe,UAAAhE,EAAA,CAAS;AAC/D;AAMO,SAASyL,KAAiD;AAChE,QAAM3J,IAAUC,EAAWgH,CAAoB;AAC/C,MAAI,CAACjH;AACJ,UAAM,IAAI,MAAM,qEAAqE;AAEtF,SAAOA;AACR;AAMO,SAAS4J,KAA8D;AAC7E,SAAO3J,EAAWgH,CAAoB;AACvC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as T, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useState as g, useMemo as x, useCallback as r } from "react";
|
|
3
|
-
import { C as te, A as ae, M as re, W as se, c as ne } from "./week-view-
|
|
4
|
-
import {
|
|
3
|
+
import { C as te, A as ae, M as re, W as se, c as ne } from "./week-view-BQXIaSUZ.js";
|
|
4
|
+
import { d as oe, aL as ie, aK as de, aM as le } from "./position-utils-DpaKqYhO.js";
|
|
5
5
|
import { c as De } from "./index-DtaLkIY8.js";
|
|
6
6
|
const xe = {
|
|
7
7
|
display: "flex",
|
|
@@ -28,15 +28,15 @@ const xe = {
|
|
|
28
28
|
color: "var(--ic-text-muted, #6b7280)"
|
|
29
29
|
};
|
|
30
30
|
function _e({
|
|
31
|
-
events:
|
|
32
|
-
resources:
|
|
31
|
+
events: c,
|
|
32
|
+
resources: ce,
|
|
33
33
|
scheduleTypes: Q,
|
|
34
|
-
initialView:
|
|
35
|
-
initialDate:
|
|
34
|
+
initialView: M = "week",
|
|
35
|
+
initialDate: j,
|
|
36
36
|
initialFilters: ue,
|
|
37
37
|
preferences: N,
|
|
38
38
|
badgeVariant: s = "colored",
|
|
39
|
-
hideHeader:
|
|
39
|
+
hideHeader: A = !1,
|
|
40
40
|
availableViews: O = ["day", "week", "month", "agenda"],
|
|
41
41
|
onEventClick: u,
|
|
42
42
|
onSlotSelect: t,
|
|
@@ -48,7 +48,7 @@ function _e({
|
|
|
48
48
|
emptyState: o,
|
|
49
49
|
children: fe
|
|
50
50
|
}) {
|
|
51
|
-
const [f, k] = g(
|
|
51
|
+
const [f, k] = g(M), [l, z] = g(j ?? /* @__PURE__ */ new Date()), m = x(
|
|
52
52
|
() => ({
|
|
53
53
|
...oe,
|
|
54
54
|
...N
|
|
@@ -65,20 +65,20 @@ function _e({
|
|
|
65
65
|
},
|
|
66
66
|
[H]
|
|
67
67
|
), W = r(() => {
|
|
68
|
-
const a = ie(
|
|
68
|
+
const a = ie(l, f);
|
|
69
69
|
h(a);
|
|
70
|
-
}, [
|
|
71
|
-
const a = de(
|
|
70
|
+
}, [l, f, h]), _ = r(() => {
|
|
71
|
+
const a = de(l, f);
|
|
72
72
|
h(a);
|
|
73
|
-
}, [
|
|
74
|
-
const a =
|
|
73
|
+
}, [l, f, h]), X = r(() => {
|
|
74
|
+
const a = le();
|
|
75
75
|
h(a);
|
|
76
76
|
}, [h]), i = r(
|
|
77
77
|
(a) => {
|
|
78
78
|
h(a), b("day");
|
|
79
79
|
},
|
|
80
80
|
[h, b]
|
|
81
|
-
),
|
|
81
|
+
), R = x(
|
|
82
82
|
() => ({
|
|
83
83
|
startHour: m.startHour,
|
|
84
84
|
endHour: m.endHour
|
|
@@ -90,10 +90,10 @@ function _e({
|
|
|
90
90
|
return /* @__PURE__ */ n(
|
|
91
91
|
ne,
|
|
92
92
|
{
|
|
93
|
-
events:
|
|
94
|
-
date:
|
|
93
|
+
events: c,
|
|
94
|
+
date: l,
|
|
95
95
|
badgeVariant: s,
|
|
96
|
-
visibleHours:
|
|
96
|
+
visibleHours: R,
|
|
97
97
|
slotDuration: m.slotDuration,
|
|
98
98
|
...u && { onEventClick: u },
|
|
99
99
|
...t && { onSlotSelect: t }
|
|
@@ -103,11 +103,11 @@ function _e({
|
|
|
103
103
|
return /* @__PURE__ */ n(
|
|
104
104
|
se,
|
|
105
105
|
{
|
|
106
|
-
events:
|
|
107
|
-
date:
|
|
106
|
+
events: c,
|
|
107
|
+
date: l,
|
|
108
108
|
badgeVariant: s,
|
|
109
109
|
weekStartsOn: d,
|
|
110
|
-
visibleHours:
|
|
110
|
+
visibleHours: R,
|
|
111
111
|
slotDuration: m.slotDuration,
|
|
112
112
|
onDayClick: i,
|
|
113
113
|
...u && { onEventClick: u },
|
|
@@ -118,8 +118,8 @@ function _e({
|
|
|
118
118
|
return /* @__PURE__ */ n(
|
|
119
119
|
re,
|
|
120
120
|
{
|
|
121
|
-
events:
|
|
122
|
-
date:
|
|
121
|
+
events: c,
|
|
122
|
+
date: l,
|
|
123
123
|
badgeVariant: s,
|
|
124
124
|
weekStartsOn: d,
|
|
125
125
|
onDayClick: i,
|
|
@@ -131,8 +131,8 @@ function _e({
|
|
|
131
131
|
return /* @__PURE__ */ n(
|
|
132
132
|
ae,
|
|
133
133
|
{
|
|
134
|
-
events:
|
|
135
|
-
date:
|
|
134
|
+
events: c,
|
|
135
|
+
date: l,
|
|
136
136
|
badgeVariant: s,
|
|
137
137
|
...u && { onEventClick: u },
|
|
138
138
|
...o && { emptyState: o }
|
|
@@ -147,11 +147,11 @@ function _e({
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
return /* @__PURE__ */ T("div", { className: I, style: { ...xe, ...P }, children: [
|
|
150
|
-
!
|
|
150
|
+
!A && /* @__PURE__ */ n("div", { style: ge, children: /* @__PURE__ */ n(
|
|
151
151
|
te,
|
|
152
152
|
{
|
|
153
153
|
view: f,
|
|
154
|
-
currentDate:
|
|
154
|
+
currentDate: l,
|
|
155
155
|
availableViews: O,
|
|
156
156
|
onViewChange: b,
|
|
157
157
|
onNavigate: (a) => {
|
|
@@ -164,16 +164,16 @@ function _e({
|
|
|
164
164
|
/* @__PURE__ */ n("div", { style: Ne, children: B() })
|
|
165
165
|
] });
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
events:
|
|
169
|
-
resources:
|
|
167
|
+
function Re({
|
|
168
|
+
events: c,
|
|
169
|
+
resources: ce,
|
|
170
170
|
scheduleTypes: Q = [],
|
|
171
|
-
initialView:
|
|
172
|
-
initialDate:
|
|
171
|
+
initialView: M = "week",
|
|
172
|
+
initialDate: j,
|
|
173
173
|
initialFilters: ue,
|
|
174
174
|
preferences: N,
|
|
175
175
|
badgeVariant: s = "colored",
|
|
176
|
-
hideHeader:
|
|
176
|
+
hideHeader: A = !1,
|
|
177
177
|
showFilterSidebar: O = !1,
|
|
178
178
|
availableViews: u = ["day", "week", "month", "agenda"],
|
|
179
179
|
onEventClick: t,
|
|
@@ -186,7 +186,7 @@ function Fe({
|
|
|
186
186
|
renderEventPopover: fe,
|
|
187
187
|
renderFilterSidebar: f,
|
|
188
188
|
renderHeader: k,
|
|
189
|
-
settingsContent:
|
|
189
|
+
settingsContent: l,
|
|
190
190
|
filterContent: z,
|
|
191
191
|
showSettings: m = !0,
|
|
192
192
|
showTimelineViews: b = !1,
|
|
@@ -195,15 +195,15 @@ function Fe({
|
|
|
195
195
|
emptyState: _,
|
|
196
196
|
children: X
|
|
197
197
|
}) {
|
|
198
|
-
const [i,
|
|
198
|
+
const [i, R] = g(M), [d, B] = g(j ?? /* @__PURE__ */ new Date()), [a, Y] = g([]), [L, Z] = g([]), w = x(
|
|
199
199
|
() => ({
|
|
200
200
|
...oe,
|
|
201
201
|
...N
|
|
202
202
|
}),
|
|
203
203
|
[N]
|
|
204
|
-
),
|
|
204
|
+
), U = r(
|
|
205
205
|
(e) => {
|
|
206
|
-
|
|
206
|
+
R(e), H?.(e);
|
|
207
207
|
},
|
|
208
208
|
[H]
|
|
209
209
|
), D = r(
|
|
@@ -211,27 +211,27 @@ function Fe({
|
|
|
211
211
|
B(e), I?.(e);
|
|
212
212
|
},
|
|
213
213
|
[I]
|
|
214
|
-
),
|
|
214
|
+
), K = r(() => {
|
|
215
215
|
const e = ie(d, i);
|
|
216
216
|
D(e);
|
|
217
217
|
}, [d, i, D]), q = r(() => {
|
|
218
218
|
const e = de(d, i);
|
|
219
219
|
D(e);
|
|
220
|
-
}, [d, i, D]),
|
|
221
|
-
const e =
|
|
220
|
+
}, [d, i, D]), G = r(() => {
|
|
221
|
+
const e = le();
|
|
222
222
|
D(e);
|
|
223
223
|
}, [D]), $ = r(
|
|
224
224
|
(e) => {
|
|
225
|
-
D(e),
|
|
225
|
+
D(e), U("day");
|
|
226
226
|
},
|
|
227
|
-
[D,
|
|
227
|
+
[D, U]
|
|
228
228
|
), V = x(
|
|
229
229
|
() => ({
|
|
230
230
|
startHour: 0,
|
|
231
231
|
endHour: 24
|
|
232
232
|
}),
|
|
233
233
|
[]
|
|
234
|
-
),
|
|
234
|
+
), J = w.firstDayOfWeek === 0 ? 0 : 1, C = x(() => {
|
|
235
235
|
const e = {};
|
|
236
236
|
for (let p = 0; p <= 6; p++)
|
|
237
237
|
p === 0 || p === 6 ? w.showWeekends ? p === 6 ? e[p] = { enabled: !0, from: 8, to: 12 } : e[p] = { enabled: !1, from: 0, to: 0 } : e[p] = { enabled: !1, from: 0, to: 0 } : e[p] = { enabled: !0, from: w.startHour, to: w.endHour };
|
|
@@ -240,10 +240,10 @@ function Fe({
|
|
|
240
240
|
(e) => {
|
|
241
241
|
Y(e), v?.({
|
|
242
242
|
scheduleTypeIds: e,
|
|
243
|
-
participantIds:
|
|
243
|
+
participantIds: L
|
|
244
244
|
});
|
|
245
245
|
},
|
|
246
|
-
[v,
|
|
246
|
+
[v, L]
|
|
247
247
|
), ye = r(
|
|
248
248
|
(e) => {
|
|
249
249
|
Z(e), v?.({
|
|
@@ -252,7 +252,7 @@ function Fe({
|
|
|
252
252
|
});
|
|
253
253
|
},
|
|
254
254
|
[v, a]
|
|
255
|
-
),
|
|
255
|
+
), F = x(() => {
|
|
256
256
|
if (o)
|
|
257
257
|
return (e) => o({
|
|
258
258
|
event: e.event,
|
|
@@ -286,7 +286,7 @@ function Fe({
|
|
|
286
286
|
return /* @__PURE__ */ n(
|
|
287
287
|
ne,
|
|
288
288
|
{
|
|
289
|
-
events:
|
|
289
|
+
events: c,
|
|
290
290
|
date: d,
|
|
291
291
|
badgeVariant: s,
|
|
292
292
|
visibleHours: V,
|
|
@@ -294,34 +294,34 @@ function Fe({
|
|
|
294
294
|
slotDuration: w.slotDuration,
|
|
295
295
|
...t && { onEventClick: t },
|
|
296
296
|
...y && { onSlotSelect: y },
|
|
297
|
-
...
|
|
297
|
+
...F && { renderEvent: F }
|
|
298
298
|
}
|
|
299
299
|
);
|
|
300
300
|
case "week":
|
|
301
301
|
return /* @__PURE__ */ n(
|
|
302
302
|
se,
|
|
303
303
|
{
|
|
304
|
-
events:
|
|
304
|
+
events: c,
|
|
305
305
|
date: d,
|
|
306
306
|
badgeVariant: s,
|
|
307
|
-
weekStartsOn:
|
|
307
|
+
weekStartsOn: J,
|
|
308
308
|
visibleHours: V,
|
|
309
309
|
workingHours: C,
|
|
310
310
|
slotDuration: w.slotDuration,
|
|
311
311
|
onDayClick: $,
|
|
312
312
|
...t && { onEventClick: t },
|
|
313
313
|
...y && { onSlotSelect: y },
|
|
314
|
-
...
|
|
314
|
+
...F && { renderEvent: F }
|
|
315
315
|
}
|
|
316
316
|
);
|
|
317
317
|
case "month":
|
|
318
318
|
return /* @__PURE__ */ n(
|
|
319
319
|
re,
|
|
320
320
|
{
|
|
321
|
-
events:
|
|
321
|
+
events: c,
|
|
322
322
|
date: d,
|
|
323
323
|
badgeVariant: s,
|
|
324
|
-
weekStartsOn:
|
|
324
|
+
weekStartsOn: J,
|
|
325
325
|
onDayClick: $,
|
|
326
326
|
...t && { onEventClick: t },
|
|
327
327
|
...y && { onSlotSelect: y },
|
|
@@ -332,7 +332,7 @@ function Fe({
|
|
|
332
332
|
return /* @__PURE__ */ n(
|
|
333
333
|
ae,
|
|
334
334
|
{
|
|
335
|
-
events:
|
|
335
|
+
events: c,
|
|
336
336
|
date: d,
|
|
337
337
|
badgeVariant: s,
|
|
338
338
|
...t && { onEventClick: t },
|
|
@@ -349,26 +349,26 @@ function Fe({
|
|
|
349
349
|
}
|
|
350
350
|
}, we = r(
|
|
351
351
|
(e) => {
|
|
352
|
-
e === "prev" ?
|
|
352
|
+
e === "prev" ? K() : e === "next" ? q() : G();
|
|
353
353
|
},
|
|
354
|
-
[
|
|
354
|
+
[K, q, G]
|
|
355
355
|
), ee = {
|
|
356
356
|
view: i,
|
|
357
357
|
currentDate: d,
|
|
358
358
|
availableViews: u,
|
|
359
|
-
onViewChange:
|
|
359
|
+
onViewChange: U,
|
|
360
360
|
onNavigate: we,
|
|
361
|
-
onNavigatePrev:
|
|
361
|
+
onNavigatePrev: K,
|
|
362
362
|
onNavigateNext: q,
|
|
363
|
-
onNavigateToday:
|
|
363
|
+
onNavigateToday: G,
|
|
364
364
|
...P && { onAddEvent: P },
|
|
365
365
|
...W && { actions: W },
|
|
366
366
|
className: "border-b border-gray-200 p-3"
|
|
367
367
|
}, pe = {
|
|
368
368
|
...ee,
|
|
369
|
-
events:
|
|
370
|
-
weekStartsOn:
|
|
371
|
-
settingsContent:
|
|
369
|
+
events: c,
|
|
370
|
+
weekStartsOn: J,
|
|
371
|
+
settingsContent: l,
|
|
372
372
|
filterContent: z,
|
|
373
373
|
showSettings: m,
|
|
374
374
|
showTimelineViews: b
|
|
@@ -382,19 +382,19 @@ function Fe({
|
|
|
382
382
|
O && /* @__PURE__ */ n("div", { className: "w-64 border-r border-gray-200 flex-shrink-0", children: f ? f({
|
|
383
383
|
scheduleTypes: Q,
|
|
384
384
|
selectedScheduleTypeIds: a,
|
|
385
|
-
selectedParticipantIds:
|
|
385
|
+
selectedParticipantIds: L,
|
|
386
386
|
onScheduleTypeChange: he,
|
|
387
387
|
onParticipantChange: ye,
|
|
388
388
|
onClearAll: ve
|
|
389
389
|
}) : /* @__PURE__ */ n("div", { className: "p-4 text-sm text-gray-500", children: "Filter sidebar not configured" }) }),
|
|
390
390
|
/* @__PURE__ */ T("div", { className: "flex flex-col flex-1 min-w-0", children: [
|
|
391
|
-
!
|
|
391
|
+
!A && (k ? k(ee) : /* @__PURE__ */ n(te, { ...pe })),
|
|
392
392
|
/* @__PURE__ */ n("div", { className: "flex-1 overflow-auto", children: me() })
|
|
393
393
|
] })
|
|
394
394
|
] });
|
|
395
395
|
}
|
|
396
396
|
export {
|
|
397
397
|
_e as D,
|
|
398
|
-
|
|
398
|
+
Re as T
|
|
399
399
|
};
|
|
400
|
-
//# sourceMappingURL=tailwind-calendar-
|
|
400
|
+
//# sourceMappingURL=tailwind-calendar-CzbuXRmn.js.map
|