@mantine/schedule 9.1.1 → 9.2.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"WeekView.cjs","names":["getDayTimeIntervals","useDragDropHandlers","calculateDropTime","useSlotDragSelect","useEventResize","getWeekDays","getWeekViewEvents","expandRecurringEvents","formatDate","Box","getBusinessHoursMod","UnstyledButton","getLabel","toDateString","isAllDayEvent","ScheduleEvent","WeekViewDay","ScheduleHeaderBase","previousWeek","nextWeek","getWeekLabel","ScrollArea","getWeekNumber","CurrentTimeIndicator","DragContext","classes"],"sources":["../../../src/components/WeekView/WeekView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n rem,\n ScrollArea,\n ScrollAreaAutosizeProps,\n StylesApiProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useIsomorphicEffect, useMergedRef } from '@mantine/hooks';\nimport { useAutoScrollOnDrag } from '../../hooks/use-auto-scroll-on-drag';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useEventResize } from '../../hooks/use-event-resize';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateDropTime,\n expandRecurringEvents,\n formatDate,\n getBusinessHoursMod,\n getDayTimeIntervals,\n getWeekDays,\n getWeekNumber,\n isAllDayEvent,\n nextWeek,\n previousWeek,\n toDateString,\n} from '../../utils';\nimport {\n CurrentTimeIndicator,\n CurrentTimeIndicatorStylesNames,\n} from '../CurrentTimeIndicator/CurrentTimeIndicator';\nimport { DragContext, DragContextValue } from '../DragContext/DragContext';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getWeekLabel } from './get-week-label/get-week-label';\nimport { getWeekViewEvents } from './get-week-view-events/get-week-view-events';\nimport { handleWeekViewKeyDown, WeekViewControlsRef } from './handle-week-view-key-down';\nimport { WeekViewDay } from './WeekViewDay';\nimport classes from './WeekView.module.css';\n\nexport type WeekViewStylesNames =\n | 'weekView'\n | 'weekViewRoot'\n | 'weekViewHeader'\n | 'weekViewInner'\n | 'weekViewAllDaySlotsEvents'\n | 'weekViewAllDaySlots'\n | 'weekViewAllDaySlotsList'\n | 'weekViewAllDaySlot'\n | 'weekViewAllDaySlotsLabel'\n | 'weekViewScrollArea'\n | 'weekViewCorner'\n | 'weekViewSlotLabels'\n | 'weekViewSlotLabel'\n | 'weekViewDayLabel'\n | 'weekViewDayWeekday'\n | 'weekViewDay'\n | 'weekViewDayNumber'\n | 'weekViewDaySlot'\n | 'weekViewDaySlots'\n | 'weekViewWeekLabel'\n | 'weekViewWeekNumber'\n | 'weekViewBackgroundEvent'\n | CurrentTimeIndicatorStylesNames\n | CombinedScheduleHeaderStylesNames;\n\nexport type WeekViewCssVariables = {\n weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height';\n};\n\nexport interface WeekViewProps\n extends BoxProps, StylesApiProps<WeekViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Week to display, Date object or date string in `YYYY-MM-DD` format */\n date: Date | string;\n\n /** Called with the new date value when a date is selected */\n onDateChange?: (value: DateStringValue) => void;\n\n /** Start time for the day view, in `HH:mm:ss` format @default 00:00:00 */\n startTime?: string;\n\n /** End time for the day view, in `HH:mm:ss` format @default 23:59:59 */\n endTime?: string;\n\n /** Number of minutes for each interval in the day view @default 60 */\n intervalMinutes?: number;\n\n /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */\n slotLabelFormat?: DateLabelFormat;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. @default 'ddd' */\n weekdayFormat?: DateLabelFormat;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** If set to false, weekend days are hidden @default true */\n withWeekendDays?: boolean;\n\n /** If set to true, highlights today in the weekday row @default false */\n highlightToday?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to the `ScrollArea.Autosize` component */\n scrollAreaProps?: ScrollAreaAutosizeProps & DataAttributes;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** If set, the week number is displayed at the top left corner @default true */\n withWeekNumber?: boolean;\n\n /** If set, displays a line indicating the current time @default true */\n withCurrentTimeIndicator?: boolean;\n\n /** If set, the time indicator displays the current time in the bubble @default true */\n withCurrentTimeBubble?: boolean;\n\n /** If set, displays the current time indicator on the same day of week even when viewing a different week @default false */\n forceCurrentTimeIndicator?: boolean;\n\n /** If set, displays all-day slots at the top of the view @default true */\n withAllDaySlots?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Called when view level select button is clicked */\n onViewChange?: (view: ScheduleViewLevel) => void;\n\n /** Props passed to previous month control */\n previousControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to next month control */\n nextControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to today control */\n todayControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to view level select */\n viewSelectProps?: Partial<ViewSelectProps> & DataAttributes;\n\n /** Format for week label @default 'MMM DD' */\n weekLabelFormat?: DateLabelFormat;\n\n /** List of events to display in the week view */\n events?: ScheduleEventData[];\n\n /** Height of 1hr slot @default 64px */\n slotHeight?: React.CSSProperties['height'];\n\n /** Height of all-day slot @default 48px */\n allDaySlotHeight?: React.CSSProperties['height'];\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background @default false */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format @default ['09:00:00', '17:00:00'] */\n businessHours?: [string, string];\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** If true, events can be dragged and dropped @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped at new time */\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be dragged */\n canDragEvent?: (event: ScheduleEventData) => boolean;\n\n /** Called when any event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when any event drag ends */\n onEventDragEnd?: () => void;\n\n /** Called when time slot is clicked */\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n }) => void;\n\n /** Called when all-day slot is clicked */\n onAllDaySlotClick?: (day: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select time slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a time slot range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Time to scroll to on initial render, in `HH:mm:ss` format */\n startScrollTime?: string;\n\n /** Function to customize week label in the header */\n renderWeekLabel?: (params: {\n weekStart: DateStringValue;\n weekEnd: DateStringValue;\n }) => React.ReactNode;\n\n /** Called when an external item is dropped onto the schedule. Receives the `DataTransfer` object and the drop target datetime. */\n onExternalEventDrop?: (dataTransfer: DataTransfer, dropDateTime: DateTimeStringValue) => void;\n\n /** If true, events can be resized by dragging their edges @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Function to get additional props for each time slot. Receives slot start and end datetime strings. Returned props are spread onto the slot element. Event handlers returned by this function are composed with internal handlers (e.g. onClick) rather than overriding them. */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport type WeekViewFactory = Factory<{\n props: WeekViewProps;\n ref: HTMLDivElement;\n stylesNames: WeekViewStylesNames;\n vars: WeekViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'WeekView',\n withWeekendDays: true,\n withCurrentTimeIndicator: true,\n startTime: '00:00:00',\n endTime: '23:59:59',\n slotLabelFormat: 'HH:mm',\n intervalMinutes: 60,\n weekdayFormat: 'ddd',\n withWeekNumber: true,\n withCurrentTimeBubble: true,\n withAllDaySlots: true,\n withHeader: true,\n weekLabelFormat: 'MMM DD',\n highlightBusinessHours: false,\n businessHours: ['09:00:00', '17:00:00'],\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n withEventResize: false,\n mode: 'default',\n} satisfies Partial<WeekViewProps>;\n\nconst varsResolver = createVarsResolver<WeekViewFactory>(\n (_theme, { radius, allDaySlotHeight, slotHeight }) => ({\n weekView: {\n '--week-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--week-view-all-day-slots-height': rem(allDaySlotHeight),\n '--week-view-slot-height': rem(slotHeight),\n },\n })\n);\n\nexport const WeekView = factory<WeekViewFactory>((_props) => {\n const props = useProps('WeekView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n startTime,\n endTime,\n date,\n onDateChange,\n intervalMinutes,\n slotLabelFormat,\n withWeekendDays,\n weekendDays,\n firstDayOfWeek,\n weekdayFormat,\n radius,\n highlightToday,\n withCurrentTimeIndicator,\n forceCurrentTimeIndicator,\n scrollAreaProps,\n locale,\n withWeekNumber,\n withCurrentTimeBubble,\n withAllDaySlots,\n __staticSelector,\n withHeader,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n weekLabelFormat,\n events,\n allDaySlotHeight,\n slotHeight,\n labels,\n highlightBusinessHours,\n businessHours,\n renderEventBody,\n renderEvent,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n mode,\n startScrollTime,\n renderWeekLabel,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n getTimeSlotProps,\n ...others\n } = props;\n\n const getStyles = useStyles<WeekViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'weekView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<WeekViewFactory>({\n classNames,\n styles,\n props,\n });\n\n const stylesApiProps = {\n classNames: resolvedClassNames,\n styles: resolvedStyles,\n attributes,\n __staticSelector,\n radius,\n };\n\n const theme = useMantineTheme();\n const [scrolled, setScrolled] = useState(false);\n const ctx = useDatesContext();\n const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const viewportRef = useRef<HTMLDivElement>(null);\n\n useAutoScrollOnDrag({\n viewportRef,\n enabled: (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static',\n });\n\n type DropTargetSlot = { day: string; slotIndex: number };\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, target: DropTargetSlot) => {\n if (!onExternalEventDrop) {\n return;\n }\n const slotDate = dayjs(target.day).format('YYYY-MM-DD');\n onExternalEventDrop(e.dataTransfer, `${slotDate} ${slots[target.slotIndex].startTime}`);\n },\n [onExternalEventDrop, slots]\n );\n\n const handleExternalAllDayDrop = useCallback(\n (e: React.DragEvent, day: string) => {\n if (!onExternalEventDrop) {\n return;\n }\n onExternalEventDrop(e.dataTransfer, `${dayjs(day).format('YYYY-MM-DD')} 00:00:00`);\n },\n [onExternalEventDrop]\n );\n\n const dragDrop = useDragDropHandlers<DropTargetSlot>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (target: DropTargetSlot, draggedEvent: ScheduleEventData) => {\n const slotTime = slots[target.slotIndex].startTime;\n return calculateDropTime({\n draggedEvent,\n targetDate: target.day,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const allDayDragDrop = useDragDropHandlers<string>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (targetDay: string, draggedEvent: ScheduleEventData) => {\n const eventDuration = dayjs(draggedEvent.end).diff(dayjs(draggedEvent.start), 'millisecond');\n const newStart = dayjs(targetDay).startOf('day');\n return { start: newStart.toDate(), end: newStart.add(eventDuration, 'millisecond').toDate() };\n },\n onExternalDrop: onExternalEventDrop ? handleExternalAllDayDrop : undefined,\n });\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex, group) => {\n if (!onSlotDragEnd) {\n return;\n }\n const slotDate = dayjs(group).format('YYYY-MM-DD');\n onSlotDragEnd(\n `${slotDate} ${slots[startIndex].startTime}`,\n `${slotDate} ${slots[endIndex].endTime}`\n );\n },\n });\n\n const eventResize = useEventResize({\n enabled: withEventResize,\n mode,\n startTime,\n endTime,\n intervalMinutes,\n onEventResize,\n canResizeEvent,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const handleTimeSlotClick = (\n day: string,\n slotTime: string,\n e: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (!onTimeSlotClick) {\n return;\n }\n\n const slotDate = dayjs(day).format('YYYY-MM-DD');\n const slotIndex = slots.findIndex((s) => s.startTime === slotTime);\n if (slotIndex === -1) {\n return;\n }\n\n const slot = slots[slotIndex];\n onTimeSlotClick({\n slotStart: `${slotDate} ${slot.startTime}`,\n slotEnd: `${slotDate} ${slot.endTime}`,\n nativeEvent: e,\n });\n };\n\n const weekdays = getWeekDays({\n week: date,\n withWeekendDays,\n weekendDays: ctx.getWeekendDays(weekendDays),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(weekdays[0]).startOf('day').toDate(),\n rangeEnd: dayjs(weekdays[weekdays.length - 1])\n .endOf('day')\n .toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const weekEvents = getWeekViewEvents({\n date,\n events: expandedEvents,\n startTime,\n endTime,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n weekendDays: ctx.getWeekendDays(weekendDays),\n withWeekendDays,\n });\n\n const timeValues = slots.map((interval) => {\n const intervalTime = dayjs(`${dayjs(date).format('YYYY-MM-DD')} ${interval.startTime}`);\n const label = formatDate({\n date: intervalTime,\n locale: ctx.getLocale(locale),\n format: slotLabelFormat,\n });\n\n return (\n <Box\n {...getStyles('weekViewSlotLabel')}\n key={interval.startTime}\n mod={{\n 'hour-start': interval.isHourStart,\n ...getBusinessHoursMod({\n time: interval.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n }}\n >\n {label}\n </Box>\n );\n });\n\n const slotsRef: WeekViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n const allDaySlotsRef = useRef<HTMLButtonElement[]>([]);\n const weekdaysRef = useRef<HTMLButtonElement[]>([]);\n const daySlotsContainersRef = useRef<(HTMLDivElement | null)[]>([]);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n const firstSlotIndex = { dayIndex: 0, slotIndex: 0 };\n\n useIsomorphicEffect(() => {\n if (!startScrollTime || !viewportRef.current) {\n return;\n }\n\n const firstDaySlots = slotsRef.current[0];\n if (!firstDaySlots || firstDaySlots.length === 0) {\n return;\n }\n\n const targetIndex = slots.findIndex((s) => s.startTime >= startScrollTime);\n if (targetIndex < 0) {\n return;\n }\n\n const targetSlot = firstDaySlots[targetIndex];\n if (!targetSlot) {\n return;\n }\n\n const slotRect = targetSlot.getBoundingClientRect();\n const viewportRect = viewportRef.current.getBoundingClientRect();\n viewportRef.current.scrollTo({ left: 0, top: slotRect.top - viewportRect.top });\n }, []);\n\n const getSlotIndexFromDragPoint = useCallback((event: React.DragEvent, dayIndex: number) => {\n const daySlots = slotsRef.current[dayIndex] ?? [];\n const slotIndex = daySlots.findIndex((slotNode) => {\n if (!slotNode) {\n return false;\n }\n\n const rect = slotNode.getBoundingClientRect();\n return event.clientY >= rect.top && event.clientY <= rect.bottom;\n });\n\n if (slotIndex >= 0) {\n return slotIndex;\n }\n\n const firstSlot = daySlots[0];\n const lastSlot = daySlots[daySlots.length - 1];\n\n if (!firstSlot || !lastSlot) {\n return null;\n }\n\n const firstRect = firstSlot.getBoundingClientRect();\n const lastRect = lastSlot.getBoundingClientRect();\n\n if (event.clientY < firstRect.top) {\n return 0;\n }\n\n if (event.clientY > lastRect.bottom) {\n return daySlots.length - 1;\n }\n\n return null;\n }, []);\n\n const handleSlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => {\n handleWeekViewKeyDown({\n controlsRef: slotsRef,\n dayIndex,\n slotIndex,\n event,\n });\n };\n\n const handleAllDaySlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex - 1]?.focus();\n } else if (direction === 'ArrowDown') {\n event.preventDefault();\n slotsRef.current?.[dayIndex]?.[0]?.focus();\n }\n };\n\n const handleWeekdayKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n weekdaysRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n weekdaysRef.current[dayIndex - 1]?.focus();\n }\n };\n\n const currentWeekdayIndex = withCurrentTimeIndicator\n ? forceCurrentTimeIndicator\n ? weekdays.findIndex((day) => dayjs(day).day() === dayjs().day())\n : weekdays.findIndex((day) => dayjs(day).isSame(dayjs(), 'date'))\n : -1;\n\n const weekdaysLabels = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n {...getStyles('weekViewDayLabel')}\n key={day}\n ref={(node) => {\n weekdaysRef.current[dayIndex] = node!;\n }}\n aria-label={`${getLabel('weekday', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n mod={{\n today: dayjs(day).isSame(dayjs(), 'day') && !!highlightToday,\n weekend: ctx.getWeekendDays(weekendDays).includes(dayjs(day).day() as DayOfWeek),\n static: mode === 'static',\n }}\n tabIndex={mode === 'static' ? -1 : dayIndex === 0 ? 0 : -1}\n onKeyDown={mode === 'static' ? undefined : (event) => handleWeekdayKeyDown(event, dayIndex)}\n onClick={\n mode === 'static'\n ? undefined\n : () => {\n onViewChange?.('day');\n onDateChange?.(toDateString(day));\n }\n }\n >\n <Box {...getStyles('weekViewDayWeekday')} key=\"weekday\">\n {formatDate({ locale: ctx.getLocale(locale), date: day, format: weekdayFormat })}\n </Box>\n <div {...getStyles('weekViewDayNumber')} key=\"date\">\n {dayjs(day).date()}\n </div>\n </UnstyledButton>\n ));\n\n const days = weekdays.map((day, dayIndex) => {\n const allBgEvents = weekEvents.backgroundEvents[day] || [];\n\n const backgroundEventNodes = allBgEvents\n .filter((event) => !event.position.allDay)\n .map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-${event.id}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: `${event.position.top}%`,\n height: `${event.position.height}%`,\n width: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const dayEvents = (weekEvents.regularEvents[day] || []).map((event) => {\n const eventIsAllDay = isAllDayEvent({ event, date: day });\n const isDraggable = !eventIsAllDay && dragDrop.isDraggableEvent(event);\n const isResizable = !eventIsAllDay && eventResize.isResizableEvent(event);\n const resizePosition = eventResize.getResizePosition(event.id);\n const eventTop = resizePosition ? resizePosition.top : event.position.top;\n const eventHeight = resizePosition ? resizePosition.height : event.position.height;\n\n return (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n hanging={event.position.hanging}\n draggable={isDraggable}\n withResize={isResizable}\n isResizing={resizePosition !== null}\n onResizeStart={\n isResizable\n ? (edge, e) => {\n const container = daySlotsContainersRef.current[dayIndex];\n if (container) {\n eventResize.handleResizeStart({\n event,\n edge,\n container,\n originalTop: event.position.top,\n originalHeight: event.position.height,\n eventDate: dayjs(day).format('YYYY-MM-DD'),\n pointerEvent: e,\n });\n }\n }\n : undefined\n }\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n style={{\n position: 'absolute',\n top: `calc(${eventTop}% + 1px)`,\n left: `${event.position.offset}%`,\n width: `${event.position.width}%`,\n height: `calc(${eventHeight}% - 1px)`,\n }}\n />\n );\n });\n\n return (\n <WeekViewDay\n key={day}\n day={day}\n dayIndex={dayIndex}\n slots={slots}\n getStyles={getStyles}\n weekendDays={weekendDays}\n highlightBusinessHours={highlightBusinessHours}\n businessHours={businessHours}\n labels={labels}\n withEventsDragAndDrop={withDragHandlers}\n mode={mode}\n slotsRef={slotsRef}\n firstSlotIndex={firstSlotIndex}\n onSlotKeyDown={handleSlotKeyDown}\n onSlotClick={handleTimeSlotClick}\n onFirstSlotArrowUp={\n withAllDaySlots\n ? (dayIdx) => {\n allDaySlotsRef.current[dayIdx]?.focus();\n }\n : undefined\n }\n onDaySlotsDragOver={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, { day: dayStr, slotIndex });\n }\n }}\n onDaySlotsDragLeave={dragDrop.handleDragLeave}\n onDaySlotsDrop={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, { day: dayStr, slotIndex });\n }\n }}\n dropTargetSlotIndex={\n dragDrop.dropTarget?.day === day ? dragDrop.dropTarget.slotIndex : undefined\n }\n withDragSlotSelect={withDragSlotSelect}\n onSlotPointerDown={slotDragSelect.handleSlotPointerDown}\n isSlotDragSelected={slotDragSelect.isSlotSelected}\n daySlotsContainerRef={(node) => {\n daySlotsContainersRef.current[dayIndex] = node;\n }}\n getTimeSlotProps={getTimeSlotProps}\n >\n {backgroundEventNodes}\n {dayEvents}\n </WeekViewDay>\n );\n });\n\n const allDaySlots = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n aria-label={`${getLabel('allDay', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n key={day}\n ref={(node) => {\n allDaySlotsRef.current[dayIndex] = node!;\n }}\n tabIndex={dayIndex === 0 ? 0 : -1}\n onKeyDown={(event) => handleAllDaySlotKeyDown(event, dayIndex)}\n onClick={\n mode === 'static' || !onAllDaySlotClick\n ? undefined\n : (e) => onAllDaySlotClick(dayjs(day).format('YYYY-MM-DD'), e)\n }\n onDragOver={withDragHandlers ? (e) => allDayDragDrop.handleDragOver(e, day) : undefined}\n onDragLeave={withDragHandlers ? allDayDragDrop.handleDragLeave : undefined}\n onDrop={withDragHandlers ? (e) => allDayDragDrop.handleDrop(e, day) : undefined}\n {...getStyles('weekViewDaySlot')}\n mod={{ 'drop-target': allDayDragDrop.isDropTarget(day) }}\n />\n ));\n\n const allDayEventIds = useMemo(\n () => new Set(weekEvents.allDayEvents.map((e) => e.id)),\n [weekEvents.allDayEvents]\n );\n\n const allDayEvents = weekEvents.allDayEvents.map((event) => (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n nowrap\n hanging={event.position.hanging}\n draggable={allDayDragDrop.isDraggableEvent(event)}\n renderEvent={renderEvent}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{\n position: 'absolute',\n zIndex: 2,\n top: `calc(${event.position.row * 50}% + 1px)`,\n left: `calc(${event.position.offset}% + 1px)`,\n width: `calc(${event.position.width}% - 1px)`,\n height: 'calc(50% - 2px)',\n maxHeight: 'calc(50% - 2px)',\n }}\n />\n ));\n\n const allDayBackgroundEventNodes = weekdays.flatMap((day, dayIndex) => {\n const allDayBgEvents = (weekEvents.backgroundEvents[day] || []).filter(\n (event) => event.position.allDay\n );\n const dayWidth = 100 / weekdays.length;\n const dayOffset = dayIndex * dayWidth;\n\n return allDayBgEvents.map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-allday-${event.id}-${day}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: 0,\n height: '100%',\n left: `${dayOffset}%`,\n width: `${dayWidth}%`,\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n });\n\n // Extra rows show on hover = total rows - 2 visible rows (starts from 0, so -1)\n const extraRows = Math.max(...weekEvents.allDayEvents.map((event) => event.position.row), 1) - 1;\n\n const content = (\n <Box\n {...getStyles('weekView')}\n mod={{ static: mode === 'static', 'slot-dragging': slotDragSelect.isDragging }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"week\"\n navigationHandlers={{\n previous: () => previousWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n next: () => nextWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n today: () => toDateString(dayjs()),\n }}\n control={{\n miw: 140,\n title: getWeekLabel({\n weekdays,\n locale: ctx.getLocale(locale),\n weekLabelFormat,\n renderWeekLabel,\n }),\n }}\n labels={labels}\n onDateChange={onDateChange}\n onViewChange={onViewChange}\n previousControlProps={previousControlProps}\n nextControlProps={nextControlProps}\n todayControlProps={todayControlProps}\n viewSelectProps={viewSelectProps}\n stylesApiProps={stylesApiProps}\n />\n )}\n\n <Box\n {...getStyles('weekViewRoot')}\n __vars={{\n '--indicator-offset-index':\n currentWeekdayIndex === -1 ? undefined : `${currentWeekdayIndex + 1}`,\n '--number-of-days': withWeekendDays\n ? '7'\n : `${7 - ctx.getWeekendDays(weekendDays).length}`,\n }}\n mod={{ 'with-weekends': withWeekendDays }}\n >\n <ScrollArea.Autosize\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('weekViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n onScrollPositionChange={(position) => {\n scrollAreaProps?.onScrollPositionChange?.(position);\n setScrolled(position.y !== 0);\n }}\n viewportRef={mergedViewportRef}\n >\n <Box {...getStyles('weekViewHeader')} mod={{ scrolled }}>\n <div {...getStyles('weekViewCorner')} key=\"corner\">\n {withWeekNumber && (\n <>\n <div {...getStyles('weekViewWeekLabel')}>{getLabel('week', labels)}</div>\n <div {...getStyles('weekViewWeekNumber')}>{getWeekNumber(date)}</div>\n </>\n )}\n </div>\n\n {weekdaysLabels}\n </Box>\n\n {withAllDaySlots && (\n <div {...getStyles('weekViewAllDaySlots')}>\n <div {...getStyles('weekViewAllDaySlotsLabel')}>{getLabel('allDay', labels)}</div>\n <div {...getStyles('weekViewAllDaySlotsList')}>\n {allDayBackgroundEventNodes}\n <Box\n {...getStyles('weekViewAllDaySlotsEvents')}\n __vars={{ '--extra-rows': `${extraRows}` }}\n >\n {allDayEvents}\n </Box>\n {allDaySlots}\n </div>\n </div>\n )}\n\n <div {...getStyles('weekViewInner')}>\n <div {...getStyles('weekViewSlotLabels')}>{timeValues}</div>\n\n {withCurrentTimeIndicator && currentWeekdayIndex !== -1 && (\n <CurrentTimeIndicator\n startOffset=\"calc(100% - (100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index) + 1) + ((var(--number-of-days) - var(--indicator-offset-index) + 1) * var(--indicator-labels-offset)))\"\n endOffset=\"calc((100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index)) - (var(--number-of-days) - var(--indicator-offset-index)) * var(--indicator-labels-offset))\"\n timeBubbleStartOffset=\"calc(var(--week-view-slots-label-width) - var(--time-bubble-width))\"\n currentTimeFormat={slotLabelFormat}\n withTimeBubble={withCurrentTimeBubble}\n withThumb={withCurrentTimeBubble ? currentWeekdayIndex !== 0 : true}\n locale={locale}\n startTime={startTime}\n endTime={endTime}\n {...stylesApiProps}\n />\n )}\n {days}\n </div>\n </ScrollArea.Autosize>\n </Box>\n </Box>\n );\n\n const mergedDragContextValue = useMemo<DragContextValue>(\n () => ({\n isDragging:\n dragDrop.dragContextValue.isDragging || allDayDragDrop.dragContextValue.isDragging,\n draggedEventId:\n dragDrop.dragContextValue.draggedEventId ?? allDayDragDrop.dragContextValue.draggedEventId,\n draggedEvent:\n dragDrop.dragContextValue.draggedEvent ?? allDayDragDrop.dragContextValue.draggedEvent,\n dropTarget:\n dragDrop.dragContextValue.dropTarget ?? allDayDragDrop.dragContextValue.dropTarget,\n onDragStart: (event: ScheduleEventData) => {\n if (allDayEventIds.has(event.id)) {\n allDayDragDrop.handleDragStart(event);\n } else {\n dragDrop.handleDragStart(event);\n }\n },\n onDragEnd: () => {\n dragDrop.handleDragEnd();\n allDayDragDrop.handleDragEnd();\n },\n setDropTarget: dragDrop.dragContextValue.setDropTarget,\n }),\n [dragDrop.dragContextValue, allDayDragDrop.dragContextValue, allDayEventIds]\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={mergedDragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nWeekView.displayName = '@mantine/schedule/WeekView';\nWeekView.classes = classes;\nWeekView.varsResolver = varsResolver;\n\nexport namespace WeekView {\n export type Props = WeekViewProps;\n export type Factory = WeekViewFactory;\n export type StylesNames = WeekViewStylesNames;\n export type CssVariables = WeekViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+RA,MAAM,eAAe;CACnB,kBAAkB;CAClB,iBAAiB;CACjB,0BAA0B;CAC1B,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,uBAAuB;CACvB,iBAAiB;CACjB,YAAY;CACZ,iBAAiB;CACjB,wBAAwB;CACxB,eAAe,CAAC,YAAY,WAAW;CACvC,uBAAuB;CACvB,oBAAoB;CACpB,iBAAiB;CACjB,MAAM;CACP;AAED,MAAM,gBAAA,GAAA,cAAA,qBACH,QAAQ,EAAE,QAAQ,kBAAkB,kBAAkB,EACrD,UAAU;CACR,sBAAsB,WAAW,KAAA,KAAA,GAAA,cAAA,WAAsB,OAAO,GAAG,KAAA;CACjE,qCAAA,GAAA,cAAA,KAAwC,iBAAiB;CACzD,4BAAA,GAAA,cAAA,KAA+B,WAAW;CAC3C,EACF,EACF;AAED,MAAa,YAAA,GAAA,cAAA,UAAqC,WAAW;CAC3D,MAAM,SAAA,GAAA,cAAA,UAAiB,YAAY,cAAc,OAAO;CACxD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,YACA,MACA,WACA,SACA,MACA,cACA,iBACA,iBACA,iBACA,aACA,gBACA,eACA,QACA,gBACA,0BACA,2BACA,iBACA,QACA,gBACA,uBACA,iBACA,kBACA,YACA,cACA,sBACA,kBACA,mBACA,iBACA,iBACA,QACA,kBACA,YACA,QACA,wBACA,eACA,iBACA,aACA,uBACA,aACA,cACA,kBACA,gBACA,iBACA,mBACA,cACA,oBACA,eACA,MACA,iBACA,iBACA,qBACA,iBACA,eACA,gBACA,0BACA,kBACA,GAAG,WACD;CAEJ,MAAM,aAAA,GAAA,cAAA,WAAuC;EAC3C,MAAM;EACN,SAAA,wBAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cA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kBAAA,KAACc,6BAAAA,sBAAD;QACE,aAAY;QACZ,WAAU;QACV,uBAAsB;QACtB,mBAAmB;QACnB,gBAAgB;QAChB,WAAW,wBAAwB,wBAAwB,IAAI;QACvD;QACG;QACF;QACT,GAAI;QACJ,CAAA;OAEH;OACG;;KACc;;GAClB,CAAA,CACF;;CAGR,MAAM,0BAAA,GAAA,MAAA,gBACG;EACL,YACE,SAAS,iBAAiB,cAAc,eAAe,iBAAiB;EAC1E,gBACE,SAAS,iBAAiB,kBAAkB,eAAe,iBAAiB;EAC9E,cACE,SAAS,iBAAiB,gBAAgB,eAAe,iBAAiB;EAC5E,YACE,SAAS,iBAAiB,cAAc,eAAe,iBAAiB;EAC1E,cAAc,UAA6B;AACzC,OAAI,eAAe,IAAI,MAAM,GAAG,CAC9B,gBAAe,gBAAgB,MAAM;OAErC,UAAS,gBAAgB,MAAM;;EAGnC,iBAAiB;AACf,YAAS,eAAe;AACxB,kBAAe,eAAe;;EAEhC,eAAe,SAAS,iBAAiB;EAC1C,GACD;EAAC,SAAS;EAAkB,eAAe;EAAkB;EAAe,CAC7E;AAED,KAAI,sBACF,QAAO,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAY,UAAb;EAAsB,OAAO;YAAyB;EAA+B,CAAA;AAG9F,QAAO;EACP;AAEF,SAAS,cAAc;AACvB,SAAS,UAAUC,wBAAAA;AACnB,SAAS,eAAe"}
1
+ {"version":3,"file":"WeekView.cjs","names":["getDayTimeIntervals","useDragDropHandlers","calculateDropTime","useSlotDragSelect","useEventResize","getWeekDays","getWeekViewEvents","expandRecurringEvents","formatDate","Box","getBusinessHoursMod","UnstyledButton","getLabel","toDateString","isAllDayEvent","ScheduleEvent","WeekViewDay","ScheduleHeaderBase","previousWeek","nextWeek","getWeekLabel","ScrollArea","getWeekNumber","CurrentTimeIndicator","DragContext","classes"],"sources":["../../../src/components/WeekView/WeekView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n rem,\n ScrollArea,\n ScrollAreaAutosizeProps,\n StylesApiProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useIsomorphicEffect, useMergedRef } from '@mantine/hooks';\nimport { useAutoScrollOnDrag } from '../../hooks/use-auto-scroll-on-drag';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useEventResize } from '../../hooks/use-event-resize';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n BusinessHoursValue,\n calculateDropTime,\n expandRecurringEvents,\n formatDate,\n getBusinessHoursMod,\n getDayTimeIntervals,\n getWeekDays,\n getWeekNumber,\n isAllDayEvent,\n nextWeek,\n previousWeek,\n toDateString,\n} from '../../utils';\nimport {\n CurrentTimeIndicator,\n CurrentTimeIndicatorStylesNames,\n} from '../CurrentTimeIndicator/CurrentTimeIndicator';\nimport { DragContext, DragContextValue } from '../DragContext/DragContext';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getWeekLabel } from './get-week-label/get-week-label';\nimport { getWeekViewEvents } from './get-week-view-events/get-week-view-events';\nimport { handleWeekViewKeyDown, WeekViewControlsRef } from './handle-week-view-key-down';\nimport { WeekViewDay } from './WeekViewDay';\nimport classes from './WeekView.module.css';\n\nexport type WeekViewStylesNames =\n | 'weekView'\n | 'weekViewRoot'\n | 'weekViewHeader'\n | 'weekViewInner'\n | 'weekViewAllDaySlotsEvents'\n | 'weekViewAllDaySlots'\n | 'weekViewAllDaySlotsList'\n | 'weekViewAllDaySlot'\n | 'weekViewAllDaySlotsLabel'\n | 'weekViewScrollArea'\n | 'weekViewCorner'\n | 'weekViewSlotLabels'\n | 'weekViewSlotLabel'\n | 'weekViewDayLabel'\n | 'weekViewDayWeekday'\n | 'weekViewDay'\n | 'weekViewDayNumber'\n | 'weekViewDaySlot'\n | 'weekViewDaySlots'\n | 'weekViewWeekLabel'\n | 'weekViewWeekNumber'\n | 'weekViewBackgroundEvent'\n | CurrentTimeIndicatorStylesNames\n | CombinedScheduleHeaderStylesNames;\n\nexport type WeekViewCssVariables = {\n weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height';\n};\n\nexport interface WeekViewProps\n extends BoxProps, StylesApiProps<WeekViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Week to display, Date object or date string in `YYYY-MM-DD` format */\n date: Date | string;\n\n /** Called with the new date value when a date is selected */\n onDateChange?: (value: DateStringValue) => void;\n\n /** Start time for the day view, in `HH:mm:ss` format @default 00:00:00 */\n startTime?: string;\n\n /** End time for the day view, in `HH:mm:ss` format @default 23:59:59 */\n endTime?: string;\n\n /** Number of minutes for each interval in the day view @default 60 */\n intervalMinutes?: number;\n\n /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */\n slotLabelFormat?: DateLabelFormat;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. @default 'ddd' */\n weekdayFormat?: DateLabelFormat;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** If set to false, weekend days are hidden @default true */\n withWeekendDays?: boolean;\n\n /** If set to true, highlights today in the weekday row @default false */\n highlightToday?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to the `ScrollArea.Autosize` component */\n scrollAreaProps?: ScrollAreaAutosizeProps & DataAttributes;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** If set, the week number is displayed at the top left corner @default true */\n withWeekNumber?: boolean;\n\n /** If set, displays a line indicating the current time @default true */\n withCurrentTimeIndicator?: boolean;\n\n /** If set, the time indicator displays the current time in the bubble @default true */\n withCurrentTimeBubble?: boolean;\n\n /** If set, displays the current time indicator on the same day of week even when viewing a different week @default false */\n forceCurrentTimeIndicator?: boolean;\n\n /** If set, displays all-day slots at the top of the view @default true */\n withAllDaySlots?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Called when view level select button is clicked */\n onViewChange?: (view: ScheduleViewLevel) => void;\n\n /** Props passed to previous month control */\n previousControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to next month control */\n nextControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to today control */\n todayControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to view level select */\n viewSelectProps?: Partial<ViewSelectProps> & DataAttributes;\n\n /** Format for week label @default 'MMM DD' */\n weekLabelFormat?: DateLabelFormat;\n\n /** List of events to display in the week view */\n events?: ScheduleEventData[];\n\n /** Height of 1hr slot @default 64px */\n slotHeight?: React.CSSProperties['height'];\n\n /** Height of all-day slot @default 48px */\n allDaySlotHeight?: React.CSSProperties['height'];\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background @default false */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format shared across all days, or a per-day record keyed by day of the week (`0` – Sunday, `6` – Saturday) for day-specific ranges. Set a day to `null` to mark it as fully outside business hours. @default ['09:00:00', '17:00:00'] */\n businessHours?: BusinessHoursValue;\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** If true, events can be dragged and dropped @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped at new time */\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be dragged */\n canDragEvent?: (event: ScheduleEventData) => boolean;\n\n /** Called when any event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when any event drag ends */\n onEventDragEnd?: () => void;\n\n /** Called when time slot is clicked */\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n }) => void;\n\n /** Called when all-day slot is clicked */\n onAllDaySlotClick?: (day: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select time slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a time slot range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Time to scroll to on initial render, in `HH:mm:ss` format */\n startScrollTime?: string;\n\n /** Function to customize week label in the header */\n renderWeekLabel?: (params: {\n weekStart: DateStringValue;\n weekEnd: DateStringValue;\n }) => React.ReactNode;\n\n /** Called when an external item is dropped onto the schedule. Receives the `DataTransfer` object and the drop target datetime. */\n onExternalEventDrop?: (dataTransfer: DataTransfer, dropDateTime: DateTimeStringValue) => void;\n\n /** If true, events can be resized by dragging their edges @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Function to get additional props for each time slot. Receives slot start and end datetime strings. Returned props are spread onto the slot element. Event handlers returned by this function are composed with internal handlers (e.g. onClick) rather than overriding them. */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport type WeekViewFactory = Factory<{\n props: WeekViewProps;\n ref: HTMLDivElement;\n stylesNames: WeekViewStylesNames;\n vars: WeekViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'WeekView',\n withWeekendDays: true,\n withCurrentTimeIndicator: true,\n startTime: '00:00:00',\n endTime: '23:59:59',\n slotLabelFormat: 'HH:mm',\n intervalMinutes: 60,\n weekdayFormat: 'ddd',\n withWeekNumber: true,\n withCurrentTimeBubble: true,\n withAllDaySlots: true,\n withHeader: true,\n weekLabelFormat: 'MMM DD',\n highlightBusinessHours: false,\n businessHours: ['09:00:00', '17:00:00'],\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n withEventResize: false,\n mode: 'default',\n} satisfies Partial<WeekViewProps>;\n\nconst varsResolver = createVarsResolver<WeekViewFactory>(\n (_theme, { radius, allDaySlotHeight, slotHeight }) => ({\n weekView: {\n '--week-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--week-view-all-day-slots-height': rem(allDaySlotHeight),\n '--week-view-slot-height': rem(slotHeight),\n },\n })\n);\n\nexport const WeekView = factory<WeekViewFactory>((_props) => {\n const props = useProps('WeekView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n startTime,\n endTime,\n date,\n onDateChange,\n intervalMinutes,\n slotLabelFormat,\n withWeekendDays,\n weekendDays,\n firstDayOfWeek,\n weekdayFormat,\n radius,\n highlightToday,\n withCurrentTimeIndicator,\n forceCurrentTimeIndicator,\n scrollAreaProps,\n locale,\n withWeekNumber,\n withCurrentTimeBubble,\n withAllDaySlots,\n __staticSelector,\n withHeader,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n weekLabelFormat,\n events,\n allDaySlotHeight,\n slotHeight,\n labels,\n highlightBusinessHours,\n businessHours,\n renderEventBody,\n renderEvent,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n mode,\n startScrollTime,\n renderWeekLabel,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n getTimeSlotProps,\n ...others\n } = props;\n\n const getStyles = useStyles<WeekViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'weekView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<WeekViewFactory>({\n classNames,\n styles,\n props,\n });\n\n const stylesApiProps = {\n classNames: resolvedClassNames,\n styles: resolvedStyles,\n attributes,\n __staticSelector,\n radius,\n };\n\n const theme = useMantineTheme();\n const [scrolled, setScrolled] = useState(false);\n const ctx = useDatesContext();\n const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const viewportRef = useRef<HTMLDivElement>(null);\n\n useAutoScrollOnDrag({\n viewportRef,\n enabled: (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static',\n });\n\n type DropTargetSlot = { day: string; slotIndex: number };\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, target: DropTargetSlot) => {\n if (!onExternalEventDrop) {\n return;\n }\n const slotDate = dayjs(target.day).format('YYYY-MM-DD');\n onExternalEventDrop(e.dataTransfer, `${slotDate} ${slots[target.slotIndex].startTime}`);\n },\n [onExternalEventDrop, slots]\n );\n\n const handleExternalAllDayDrop = useCallback(\n (e: React.DragEvent, day: string) => {\n if (!onExternalEventDrop) {\n return;\n }\n onExternalEventDrop(e.dataTransfer, `${dayjs(day).format('YYYY-MM-DD')} 00:00:00`);\n },\n [onExternalEventDrop]\n );\n\n const dragDrop = useDragDropHandlers<DropTargetSlot>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (target: DropTargetSlot, draggedEvent: ScheduleEventData) => {\n const slotTime = slots[target.slotIndex].startTime;\n return calculateDropTime({\n draggedEvent,\n targetDate: target.day,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const allDayDragDrop = useDragDropHandlers<string>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (targetDay: string, draggedEvent: ScheduleEventData) => {\n const eventDuration = dayjs(draggedEvent.end).diff(dayjs(draggedEvent.start), 'millisecond');\n const newStart = dayjs(targetDay).startOf('day');\n return { start: newStart.toDate(), end: newStart.add(eventDuration, 'millisecond').toDate() };\n },\n onExternalDrop: onExternalEventDrop ? handleExternalAllDayDrop : undefined,\n });\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex, group) => {\n if (!onSlotDragEnd) {\n return;\n }\n const slotDate = dayjs(group).format('YYYY-MM-DD');\n onSlotDragEnd(\n `${slotDate} ${slots[startIndex].startTime}`,\n `${slotDate} ${slots[endIndex].endTime}`\n );\n },\n });\n\n const eventResize = useEventResize({\n enabled: withEventResize,\n mode,\n startTime,\n endTime,\n intervalMinutes,\n onEventResize,\n canResizeEvent,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const handleTimeSlotClick = (\n day: string,\n slotTime: string,\n e: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (!onTimeSlotClick) {\n return;\n }\n\n const slotDate = dayjs(day).format('YYYY-MM-DD');\n const slotIndex = slots.findIndex((s) => s.startTime === slotTime);\n if (slotIndex === -1) {\n return;\n }\n\n const slot = slots[slotIndex];\n onTimeSlotClick({\n slotStart: `${slotDate} ${slot.startTime}`,\n slotEnd: `${slotDate} ${slot.endTime}`,\n nativeEvent: e,\n });\n };\n\n const weekdays = getWeekDays({\n week: date,\n withWeekendDays,\n weekendDays: ctx.getWeekendDays(weekendDays),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(weekdays[0]).startOf('day').toDate(),\n rangeEnd: dayjs(weekdays[weekdays.length - 1])\n .endOf('day')\n .toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const weekEvents = getWeekViewEvents({\n date,\n events: expandedEvents,\n startTime,\n endTime,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n weekendDays: ctx.getWeekendDays(weekendDays),\n withWeekendDays,\n });\n\n const timeValues = slots.map((interval) => {\n const intervalTime = dayjs(`${dayjs(date).format('YYYY-MM-DD')} ${interval.startTime}`);\n const label = formatDate({\n date: intervalTime,\n locale: ctx.getLocale(locale),\n format: slotLabelFormat,\n });\n\n return (\n <Box\n {...getStyles('weekViewSlotLabel')}\n key={interval.startTime}\n mod={{\n 'hour-start': interval.isHourStart,\n ...getBusinessHoursMod({\n time: interval.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n }}\n >\n {label}\n </Box>\n );\n });\n\n const slotsRef: WeekViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n const allDaySlotsRef = useRef<HTMLButtonElement[]>([]);\n const weekdaysRef = useRef<HTMLButtonElement[]>([]);\n const daySlotsContainersRef = useRef<(HTMLDivElement | null)[]>([]);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n const firstSlotIndex = { dayIndex: 0, slotIndex: 0 };\n\n useIsomorphicEffect(() => {\n if (!startScrollTime || !viewportRef.current) {\n return;\n }\n\n const firstDaySlots = slotsRef.current[0];\n if (!firstDaySlots || firstDaySlots.length === 0) {\n return;\n }\n\n const targetIndex = slots.findIndex((s) => s.startTime >= startScrollTime);\n if (targetIndex < 0) {\n return;\n }\n\n const targetSlot = firstDaySlots[targetIndex];\n if (!targetSlot) {\n return;\n }\n\n const slotRect = targetSlot.getBoundingClientRect();\n const viewportRect = viewportRef.current.getBoundingClientRect();\n viewportRef.current.scrollTo({ left: 0, top: slotRect.top - viewportRect.top });\n }, []);\n\n const getSlotIndexFromDragPoint = useCallback((event: React.DragEvent, dayIndex: number) => {\n const daySlots = slotsRef.current[dayIndex] ?? [];\n const slotIndex = daySlots.findIndex((slotNode) => {\n if (!slotNode) {\n return false;\n }\n\n const rect = slotNode.getBoundingClientRect();\n return event.clientY >= rect.top && event.clientY <= rect.bottom;\n });\n\n if (slotIndex >= 0) {\n return slotIndex;\n }\n\n const firstSlot = daySlots[0];\n const lastSlot = daySlots[daySlots.length - 1];\n\n if (!firstSlot || !lastSlot) {\n return null;\n }\n\n const firstRect = firstSlot.getBoundingClientRect();\n const lastRect = lastSlot.getBoundingClientRect();\n\n if (event.clientY < firstRect.top) {\n return 0;\n }\n\n if (event.clientY > lastRect.bottom) {\n return daySlots.length - 1;\n }\n\n return null;\n }, []);\n\n const handleSlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => {\n handleWeekViewKeyDown({\n controlsRef: slotsRef,\n dayIndex,\n slotIndex,\n event,\n });\n };\n\n const handleAllDaySlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex - 1]?.focus();\n } else if (direction === 'ArrowDown') {\n event.preventDefault();\n slotsRef.current?.[dayIndex]?.[0]?.focus();\n }\n };\n\n const handleWeekdayKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n weekdaysRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n weekdaysRef.current[dayIndex - 1]?.focus();\n }\n };\n\n const currentWeekdayIndex = withCurrentTimeIndicator\n ? forceCurrentTimeIndicator\n ? weekdays.findIndex((day) => dayjs(day).day() === dayjs().day())\n : weekdays.findIndex((day) => dayjs(day).isSame(dayjs(), 'date'))\n : -1;\n\n const weekdaysLabels = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n {...getStyles('weekViewDayLabel')}\n key={day}\n ref={(node) => {\n weekdaysRef.current[dayIndex] = node!;\n }}\n aria-label={`${getLabel('weekday', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n mod={{\n today: dayjs(day).isSame(dayjs(), 'day') && !!highlightToday,\n weekend: ctx.getWeekendDays(weekendDays).includes(dayjs(day).day() as DayOfWeek),\n static: mode === 'static',\n }}\n tabIndex={mode === 'static' ? -1 : dayIndex === 0 ? 0 : -1}\n onKeyDown={mode === 'static' ? undefined : (event) => handleWeekdayKeyDown(event, dayIndex)}\n onClick={\n mode === 'static'\n ? undefined\n : () => {\n onViewChange?.('day');\n onDateChange?.(toDateString(day));\n }\n }\n >\n <Box {...getStyles('weekViewDayWeekday')} key=\"weekday\">\n {formatDate({ locale: ctx.getLocale(locale), date: day, format: weekdayFormat })}\n </Box>\n <div {...getStyles('weekViewDayNumber')} key=\"date\">\n {dayjs(day).date()}\n </div>\n </UnstyledButton>\n ));\n\n const days = weekdays.map((day, dayIndex) => {\n const allBgEvents = weekEvents.backgroundEvents[day] || [];\n\n const backgroundEventNodes = allBgEvents\n .filter((event) => !event.position.allDay)\n .map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-${event.id}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: `${event.position.top}%`,\n height: `${event.position.height}%`,\n width: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const dayEvents = (weekEvents.regularEvents[day] || []).map((event) => {\n const eventIsAllDay = isAllDayEvent({ event, date: day });\n const isDraggable = !eventIsAllDay && dragDrop.isDraggableEvent(event);\n const isResizable = !eventIsAllDay && eventResize.isResizableEvent(event);\n const resizePosition = eventResize.getResizePosition(event.id);\n const eventTop = resizePosition ? resizePosition.top : event.position.top;\n const eventHeight = resizePosition ? resizePosition.height : event.position.height;\n\n return (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n hanging={event.position.hanging}\n draggable={isDraggable}\n withResize={isResizable}\n isResizing={resizePosition !== null}\n onResizeStart={\n isResizable\n ? (edge, e) => {\n const container = daySlotsContainersRef.current[dayIndex];\n if (container) {\n eventResize.handleResizeStart({\n event,\n edge,\n container,\n originalTop: event.position.top,\n originalHeight: event.position.height,\n eventDate: dayjs(day).format('YYYY-MM-DD'),\n pointerEvent: e,\n });\n }\n }\n : undefined\n }\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n style={{\n position: 'absolute',\n top: `calc(${eventTop}% + 1px)`,\n left: `${event.position.offset}%`,\n width: `${event.position.width}%`,\n height: `calc(${eventHeight}% - 1px)`,\n }}\n />\n );\n });\n\n return (\n <WeekViewDay\n key={day}\n day={day}\n dayIndex={dayIndex}\n slots={slots}\n getStyles={getStyles}\n weekendDays={weekendDays}\n highlightBusinessHours={highlightBusinessHours}\n businessHours={businessHours}\n labels={labels}\n withEventsDragAndDrop={withDragHandlers}\n mode={mode}\n slotsRef={slotsRef}\n firstSlotIndex={firstSlotIndex}\n onSlotKeyDown={handleSlotKeyDown}\n onSlotClick={handleTimeSlotClick}\n onFirstSlotArrowUp={\n withAllDaySlots\n ? (dayIdx) => {\n allDaySlotsRef.current[dayIdx]?.focus();\n }\n : undefined\n }\n onDaySlotsDragOver={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, { day: dayStr, slotIndex });\n }\n }}\n onDaySlotsDragLeave={dragDrop.handleDragLeave}\n onDaySlotsDrop={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, { day: dayStr, slotIndex });\n }\n }}\n dropTargetSlotIndex={\n dragDrop.dropTarget?.day === day ? dragDrop.dropTarget.slotIndex : undefined\n }\n withDragSlotSelect={withDragSlotSelect}\n onSlotPointerDown={slotDragSelect.handleSlotPointerDown}\n isSlotDragSelected={slotDragSelect.isSlotSelected}\n daySlotsContainerRef={(node) => {\n daySlotsContainersRef.current[dayIndex] = node;\n }}\n getTimeSlotProps={getTimeSlotProps}\n >\n {backgroundEventNodes}\n {dayEvents}\n </WeekViewDay>\n );\n });\n\n const allDaySlots = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n aria-label={`${getLabel('allDay', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n key={day}\n ref={(node) => {\n allDaySlotsRef.current[dayIndex] = node!;\n }}\n tabIndex={dayIndex === 0 ? 0 : -1}\n onKeyDown={(event) => handleAllDaySlotKeyDown(event, dayIndex)}\n onClick={\n mode === 'static' || !onAllDaySlotClick\n ? undefined\n : (e) => onAllDaySlotClick(dayjs(day).format('YYYY-MM-DD'), e)\n }\n onDragOver={withDragHandlers ? (e) => allDayDragDrop.handleDragOver(e, day) : undefined}\n onDragLeave={withDragHandlers ? allDayDragDrop.handleDragLeave : undefined}\n onDrop={withDragHandlers ? (e) => allDayDragDrop.handleDrop(e, day) : undefined}\n {...getStyles('weekViewDaySlot')}\n mod={{ 'drop-target': allDayDragDrop.isDropTarget(day) }}\n />\n ));\n\n const allDayEventIds = useMemo(\n () => new Set(weekEvents.allDayEvents.map((e) => e.id)),\n [weekEvents.allDayEvents]\n );\n\n const allDayEvents = weekEvents.allDayEvents.map((event) => (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n nowrap\n hanging={event.position.hanging}\n draggable={allDayDragDrop.isDraggableEvent(event)}\n renderEvent={renderEvent}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{\n position: 'absolute',\n zIndex: 2,\n top: `calc(${event.position.row * 50}% + 1px)`,\n left: `calc(${event.position.offset}% + 1px)`,\n width: `calc(${event.position.width}% - 1px)`,\n height: 'calc(50% - 2px)',\n maxHeight: 'calc(50% - 2px)',\n }}\n />\n ));\n\n const allDayBackgroundEventNodes = weekdays.flatMap((day, dayIndex) => {\n const allDayBgEvents = (weekEvents.backgroundEvents[day] || []).filter(\n (event) => event.position.allDay\n );\n const dayWidth = 100 / weekdays.length;\n const dayOffset = dayIndex * dayWidth;\n\n return allDayBgEvents.map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-allday-${event.id}-${day}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: 0,\n height: '100%',\n left: `${dayOffset}%`,\n width: `${dayWidth}%`,\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n });\n\n // Extra rows show on hover = total rows - 2 visible rows (starts from 0, so -1)\n const extraRows = Math.max(...weekEvents.allDayEvents.map((event) => event.position.row), 1) - 1;\n\n const content = (\n <Box\n {...getStyles('weekView')}\n mod={{ static: mode === 'static', 'slot-dragging': slotDragSelect.isDragging }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"week\"\n navigationHandlers={{\n previous: () => previousWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n next: () => nextWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n today: () => toDateString(dayjs()),\n }}\n control={{\n miw: 140,\n title: getWeekLabel({\n weekdays,\n locale: ctx.getLocale(locale),\n weekLabelFormat,\n renderWeekLabel,\n }),\n }}\n labels={labels}\n onDateChange={onDateChange}\n onViewChange={onViewChange}\n previousControlProps={previousControlProps}\n nextControlProps={nextControlProps}\n todayControlProps={todayControlProps}\n viewSelectProps={viewSelectProps}\n stylesApiProps={stylesApiProps}\n />\n )}\n\n <Box\n {...getStyles('weekViewRoot')}\n __vars={{\n '--indicator-offset-index':\n currentWeekdayIndex === -1 ? undefined : `${currentWeekdayIndex + 1}`,\n '--number-of-days': withWeekendDays\n ? '7'\n : `${7 - ctx.getWeekendDays(weekendDays).length}`,\n }}\n mod={{ 'with-weekends': withWeekendDays }}\n >\n <ScrollArea.Autosize\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('weekViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n onScrollPositionChange={(position) => {\n scrollAreaProps?.onScrollPositionChange?.(position);\n setScrolled(position.y !== 0);\n }}\n viewportRef={mergedViewportRef}\n >\n <Box {...getStyles('weekViewHeader')} mod={{ scrolled }}>\n <div {...getStyles('weekViewCorner')} key=\"corner\">\n {withWeekNumber && (\n <>\n <div {...getStyles('weekViewWeekLabel')}>{getLabel('week', labels)}</div>\n <div {...getStyles('weekViewWeekNumber')}>{getWeekNumber(date)}</div>\n </>\n )}\n </div>\n\n {weekdaysLabels}\n </Box>\n\n {withAllDaySlots && (\n <div {...getStyles('weekViewAllDaySlots')}>\n <div {...getStyles('weekViewAllDaySlotsLabel')}>{getLabel('allDay', labels)}</div>\n <div {...getStyles('weekViewAllDaySlotsList')}>\n {allDayBackgroundEventNodes}\n <Box\n {...getStyles('weekViewAllDaySlotsEvents')}\n __vars={{ '--extra-rows': `${extraRows}` }}\n >\n {allDayEvents}\n </Box>\n {allDaySlots}\n </div>\n </div>\n )}\n\n <div {...getStyles('weekViewInner')}>\n <div {...getStyles('weekViewSlotLabels')}>{timeValues}</div>\n\n {withCurrentTimeIndicator && currentWeekdayIndex !== -1 && (\n <CurrentTimeIndicator\n startOffset=\"calc(100% - (100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index) + 1) + ((var(--number-of-days) - var(--indicator-offset-index) + 1) * var(--indicator-labels-offset)))\"\n endOffset=\"calc((100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index)) - (var(--number-of-days) - var(--indicator-offset-index)) * var(--indicator-labels-offset))\"\n timeBubbleStartOffset=\"calc(var(--week-view-slots-label-width) - var(--time-bubble-width))\"\n currentTimeFormat={slotLabelFormat}\n withTimeBubble={withCurrentTimeBubble}\n withThumb={withCurrentTimeBubble ? currentWeekdayIndex !== 0 : true}\n locale={locale}\n startTime={startTime}\n endTime={endTime}\n {...stylesApiProps}\n />\n )}\n {days}\n </div>\n </ScrollArea.Autosize>\n </Box>\n </Box>\n );\n\n const mergedDragContextValue = useMemo<DragContextValue>(\n () => ({\n isDragging:\n dragDrop.dragContextValue.isDragging || allDayDragDrop.dragContextValue.isDragging,\n draggedEventId:\n dragDrop.dragContextValue.draggedEventId ?? allDayDragDrop.dragContextValue.draggedEventId,\n draggedEvent:\n dragDrop.dragContextValue.draggedEvent ?? allDayDragDrop.dragContextValue.draggedEvent,\n dropTarget:\n dragDrop.dragContextValue.dropTarget ?? allDayDragDrop.dragContextValue.dropTarget,\n onDragStart: (event: ScheduleEventData) => {\n if (allDayEventIds.has(event.id)) {\n allDayDragDrop.handleDragStart(event);\n } else {\n dragDrop.handleDragStart(event);\n }\n },\n onDragEnd: () => {\n dragDrop.handleDragEnd();\n allDayDragDrop.handleDragEnd();\n },\n setDropTarget: dragDrop.dragContextValue.setDropTarget,\n }),\n [dragDrop.dragContextValue, allDayDragDrop.dragContextValue, allDayEventIds]\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={mergedDragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nWeekView.displayName = '@mantine/schedule/WeekView';\nWeekView.classes = classes;\nWeekView.varsResolver = varsResolver;\n\nexport namespace WeekView {\n export type Props = WeekViewProps;\n export type Factory = WeekViewFactory;\n export type StylesNames = WeekViewStylesNames;\n export type CssVariables = WeekViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgSA,MAAM,eAAe;CACnB,kBAAkB;CAClB,iBAAiB;CACjB,0BAA0B;CAC1B,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,uBAAuB;CACvB,iBAAiB;CACjB,YAAY;CACZ,iBAAiB;CACjB,wBAAwB;CACxB,eAAe,CAAC,YAAY,WAAW;CACvC,uBAAuB;CACvB,oBAAoB;CACpB,iBAAi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iB;EAC5E,YACE,SAAS,iBAAiB,cAAc,eAAe,iBAAiB;EAC1E,cAAc,UAA6B;AACzC,OAAI,eAAe,IAAI,MAAM,GAAG,CAC9B,gBAAe,gBAAgB,MAAM;OAErC,UAAS,gBAAgB,MAAM;;EAGnC,iBAAiB;AACf,YAAS,eAAe;AACxB,kBAAe,eAAe;;EAEhC,eAAe,SAAS,iBAAiB;EAC1C,GACD;EAAC,SAAS;EAAkB,eAAe;EAAkB;EAAe,CAC7E;AAED,KAAI,sBACF,QAAO,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAY,UAAb;EAAsB,OAAO;YAAyB;EAA+B,CAAA;AAG9F,QAAO;EACP;AAEF,SAAS,cAAc;AACvB,SAAS,UAAUC,wBAAAA;AACnB,SAAS,eAAe"}
@@ -9,7 +9,9 @@ let _mantine_dates = require("@mantine/dates");
9
9
  let react_jsx_runtime = require("react/jsx-runtime");
10
10
  //#region packages/@mantine/schedule/src/components/WeekView/WeekViewDay.tsx
11
11
  function WeekViewDay({ day, dayIndex, slots, getStyles, weekendDays, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onDaySlotsDragOver, onDaySlotsDragLeave, onDaySlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, onFirstSlotArrowUp, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, daySlotsContainerRef, getTimeSlotProps }) {
12
- const weekend = (0, _mantine_dates.useDatesContext)().getWeekendDays(weekendDays).includes((0, dayjs.default)(day).day());
12
+ const ctx = (0, _mantine_dates.useDatesContext)();
13
+ const dayOfWeek = (0, dayjs.default)(day).day();
14
+ const weekend = ctx.getWeekendDays(weekendDays).includes(dayOfWeek);
13
15
  const today = (0, dayjs.default)(day).isSame((0, dayjs.default)(), "day");
14
16
  const dayGroup = (0, dayjs.default)(day).format("YYYY-MM-DD");
15
17
  const items = slots.map((slot, slotIndex) => {
@@ -39,7 +41,8 @@ function WeekViewDay({ day, dayIndex, slots, getStyles, weekendDays, children, l
39
41
  ...require_get_business_hours_mod.getBusinessHoursMod({
40
42
  time: slot.startTime,
41
43
  businessHours,
42
- highlightBusinessHours
44
+ highlightBusinessHours,
45
+ dayOfWeek
43
46
  }),
44
47
  "drop-target": isDropTarget,
45
48
  "drag-selected": isDragSelected,
@@ -1 +1 @@
1
- {"version":3,"file":"WeekViewDay.cjs","names":["UnstyledButton","getBusinessHoursMod","getLabel","Box"],"sources":["../../../src/components/WeekView/WeekViewDay.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';\nimport { DayTimeInterval, getBusinessHoursMod } from '../../utils';\nimport type { WeekViewControlsRef } from './handle-week-view-key-down';\nimport type { WeekViewFactory } from './WeekView';\n\nexport interface WeekViewDayProps {\n /** Date to display */\n day: Date | DateStringValue;\n\n /** Index of this day in the week */\n dayIndex: number;\n\n /** Slots intervals */\n slots: DayTimeInterval[];\n\n /** `useStyles` return value of `WeekView` */\n getStyles: GetStylesApi<WeekViewFactory>;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Events list */\n children?: React.ReactNode;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format */\n businessHours?: [string, string];\n\n /** If true, slots are drop targets for drag and drop */\n withEventsDragAndDrop?: boolean;\n\n /** Called when dragging over day slots container */\n onDaySlotsDragOver?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when dragging leaves day slots container */\n onDaySlotsDragLeave?: () => void;\n\n /** Called when dropping on day slots container */\n onDaySlotsDrop?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when slot is clicked */\n onSlotClick?: (day: string, slotTime: string, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Index of the slot that is currently a drop target */\n dropTargetSlotIndex?: number;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions */\n mode?: ScheduleMode;\n\n /** Ref for keyboard navigation */\n slotsRef?: WeekViewControlsRef;\n\n /** Index of the first focusable slot */\n firstSlotIndex?: { dayIndex: number; slotIndex: number };\n\n /** Keyboard event handler for slots */\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => void;\n\n /** Called when Arrow Up is pressed on the first slot, used to navigate to all-day slot */\n onFirstSlotArrowUp?: (dayIndex: number) => void;\n\n /** If set, enables drag-to-select time slot ranges */\n withDragSlotSelect?: boolean;\n\n /** Called when pointer down on a slot for drag selection */\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n\n /** Function to check if a slot is drag-selected */\n isSlotDragSelected?: (index: number, group: string) => boolean;\n\n /** Ref callback for the day slots container */\n daySlotsContainerRef?: (node: HTMLDivElement | null) => void;\n\n /** Function to get additional props for each time slot */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport function WeekViewDay({\n day,\n dayIndex,\n slots,\n getStyles,\n weekendDays,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onDaySlotsDragOver,\n onDaySlotsDragLeave,\n onDaySlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n onFirstSlotArrowUp,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n daySlotsContainerRef,\n getTimeSlotProps,\n}: WeekViewDayProps) {\n const ctx = useDatesContext();\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayjs(day).day() as DayOfWeek);\n const today = dayjs(day).isSame(dayjs(), 'day');\n\n const dayGroup = dayjs(day).format('YYYY-MM-DD');\n\n const items = slots.map((slot, slotIndex) => {\n const isDropTarget = dropTargetSlotIndex === slotIndex;\n const isFirstSlot =\n firstSlotIndex?.dayIndex === dayIndex && firstSlotIndex?.slotIndex === slotIndex;\n const isDragSelected = isSlotDragSelected?.(slotIndex, dayGroup) || false;\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onSlotClick?.(String(day), slot.startTime, e);\n externalOnClick?.(e);\n };\n\n return (\n <UnstyledButton\n key={slot.startTime}\n ref={(node) => {\n if (node && slotsRef?.current) {\n if (!slotsRef.current[dayIndex]) {\n slotsRef.current[dayIndex] = [];\n }\n slotsRef.current[dayIndex][slotIndex] = node;\n }\n }}\n {...getStyles('weekViewDaySlot')}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n aria-label={`${getLabel('timeSlot', labels)} ${dayGroup} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? slotIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={(e) => {\n if (slotIndex === 0 && e.key === 'ArrowUp' && onFirstSlotArrowUp) {\n e.preventDefault();\n onFirstSlotArrowUp(dayIndex);\n } else if (onSlotKeyDown) {\n onSlotKeyDown(e, dayIndex, slotIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, slotIndex, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n {...externalSlotProps}\n />\n );\n });\n\n return (\n <Box {...getStyles('weekViewDay')} mod={{ today, weekend }}>\n <Box\n ref={daySlotsContainerRef}\n mod={{ today }}\n {...getStyles('weekViewDaySlots')}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDragOver?.(e, String(day), dayIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onDaySlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDrop?.(e, String(day), dayIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;AAiGA,SAAgB,YAAY,EAC1B,KACA,UACA,OACA,WACA,aACA,UACA,QACA,wBACA,eACA,uBACA,oBACA,qBACA,gBACA,aACA,qBACA,MACA,UACA,gBACA,eACA,oBACA,oBACA,mBACA,oBACA,sBACA,oBACmB;CAEnB,MAAM,WAAA,GAAA,eAAA,kBADuB,CACT,eAAe,YAAY,CAAC,UAAA,GAAA,MAAA,SAAe,IAAI,CAAC,KAAK,CAAc;CACvF,MAAM,SAAA,GAAA,MAAA,SAAc,IAAI,CAAC,QAAA,GAAA,MAAA,UAAc,EAAE,MAAM;CAE/C,MAAM,YAAA,GAAA,MAAA,SAAiB,IAAI,CAAC,OAAO,aAAa;CAEhD,MAAM,QAAQ,MAAM,KAAK,MAAM,cAAc;EAC3C,MAAM,eAAe,wBAAwB;EAC7C,MAAM,cACJ,gBAAgB,aAAa,YAAY,gBAAgB,cAAc;EACzE,MAAM,iBAAiB,qBAAqB,WAAW,SAAS,IAAI;EACpE,MAAM,YAAY,GAAG,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;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,KAAD;EAAK,GAAI,UAAU,cAAc;EAAE,KAAK;GAAE;GAAO;GAAS;YACxD,iBAAA,GAAA,kBAAA,MAACA,cAAAA,KAAD;GACE,KAAK;GACL,KAAK,EAAE,OAAO;GACd,GAAI,UAAU,mBAAmB;GACjC,YACE,yBAAyB,SAAS,YAC7B,MAAM,qBAAqB,GAAG,OAAO,IAAI,EAAE,SAAS,GACrD,KAAA;GAEN,aAAa,yBAAyB,SAAS,WAAW,sBAAsB,KAAA;GAChF,QACE,yBAAyB,SAAS,YAC7B,MAAM,iBAAiB,GAAG,OAAO,IAAI,EAAE,SAAS,GACjD,KAAA;aAbR,CAgBG,UACA,MACG;;EACF,CAAA"}
1
+ {"version":3,"file":"WeekViewDay.cjs","names":["UnstyledButton","getBusinessHoursMod","getLabel","Box"],"sources":["../../../src/components/WeekView/WeekViewDay.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';\nimport { BusinessHoursValue, DayTimeInterval, getBusinessHoursMod } from '../../utils';\nimport type { WeekViewControlsRef } from './handle-week-view-key-down';\nimport type { WeekViewFactory } from './WeekView';\n\nexport interface WeekViewDayProps {\n /** Date to display */\n day: Date | DateStringValue;\n\n /** Index of this day in the week */\n dayIndex: number;\n\n /** Slots intervals */\n slots: DayTimeInterval[];\n\n /** `useStyles` return value of `WeekView` */\n getStyles: GetStylesApi<WeekViewFactory>;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Events list */\n children?: React.ReactNode;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format, or per-day record keyed by day of the week */\n businessHours?: BusinessHoursValue;\n\n /** If true, slots are drop targets for drag and drop */\n withEventsDragAndDrop?: boolean;\n\n /** Called when dragging over day slots container */\n onDaySlotsDragOver?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when dragging leaves day slots container */\n onDaySlotsDragLeave?: () => void;\n\n /** Called when dropping on day slots container */\n onDaySlotsDrop?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when slot is clicked */\n onSlotClick?: (day: string, slotTime: string, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Index of the slot that is currently a drop target */\n dropTargetSlotIndex?: number;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions */\n mode?: ScheduleMode;\n\n /** Ref for keyboard navigation */\n slotsRef?: WeekViewControlsRef;\n\n /** Index of the first focusable slot */\n firstSlotIndex?: { dayIndex: number; slotIndex: number };\n\n /** Keyboard event handler for slots */\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => void;\n\n /** Called when Arrow Up is pressed on the first slot, used to navigate to all-day slot */\n onFirstSlotArrowUp?: (dayIndex: number) => void;\n\n /** If set, enables drag-to-select time slot ranges */\n withDragSlotSelect?: boolean;\n\n /** Called when pointer down on a slot for drag selection */\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n\n /** Function to check if a slot is drag-selected */\n isSlotDragSelected?: (index: number, group: string) => boolean;\n\n /** Ref callback for the day slots container */\n daySlotsContainerRef?: (node: HTMLDivElement | null) => void;\n\n /** Function to get additional props for each time slot */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport function WeekViewDay({\n day,\n dayIndex,\n slots,\n getStyles,\n weekendDays,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onDaySlotsDragOver,\n onDaySlotsDragLeave,\n onDaySlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n onFirstSlotArrowUp,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n daySlotsContainerRef,\n getTimeSlotProps,\n}: WeekViewDayProps) {\n const ctx = useDatesContext();\n const dayOfWeek = dayjs(day).day() as DayOfWeek;\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayOfWeek);\n const today = dayjs(day).isSame(dayjs(), 'day');\n\n const dayGroup = dayjs(day).format('YYYY-MM-DD');\n\n const items = slots.map((slot, slotIndex) => {\n const isDropTarget = dropTargetSlotIndex === slotIndex;\n const isFirstSlot =\n firstSlotIndex?.dayIndex === dayIndex && firstSlotIndex?.slotIndex === slotIndex;\n const isDragSelected = isSlotDragSelected?.(slotIndex, dayGroup) || false;\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onSlotClick?.(String(day), slot.startTime, e);\n externalOnClick?.(e);\n };\n\n return (\n <UnstyledButton\n key={slot.startTime}\n ref={(node) => {\n if (node && slotsRef?.current) {\n if (!slotsRef.current[dayIndex]) {\n slotsRef.current[dayIndex] = [];\n }\n slotsRef.current[dayIndex][slotIndex] = node;\n }\n }}\n {...getStyles('weekViewDaySlot')}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n dayOfWeek,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n aria-label={`${getLabel('timeSlot', labels)} ${dayGroup} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? slotIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={(e) => {\n if (slotIndex === 0 && e.key === 'ArrowUp' && onFirstSlotArrowUp) {\n e.preventDefault();\n onFirstSlotArrowUp(dayIndex);\n } else if (onSlotKeyDown) {\n onSlotKeyDown(e, dayIndex, slotIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, slotIndex, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n {...externalSlotProps}\n />\n );\n });\n\n return (\n <Box {...getStyles('weekViewDay')} mod={{ today, weekend }}>\n <Box\n ref={daySlotsContainerRef}\n mod={{ today }}\n {...getStyles('weekViewDaySlots')}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDragOver?.(e, String(day), dayIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onDaySlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDrop?.(e, String(day), dayIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;;;AAiGA,SAAgB,YAAY,EAC1B,KACA,UACA,OACA,WACA,aACA,UACA,QACA,wBACA,eACA,uBACA,oBACA,qBACA,gBACA,aACA,qBACA,MACA,UACA,gBACA,eACA,oBACA,oBACA,mBACA,oBACA,sBACA,oBACmB;CACnB,MAAM,OAAA,GAAA,eAAA,kBAAuB;CAC7B,MAAM,aAAA,GAAA,MAAA,SAAkB,IAAI,CAAC,KAAK;CAClC,MAAM,UAAU,IAAI,e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sBAAsB,SAAS,WAAW,WAAW,KAAA;GAC3E,YAAY,MAAM;AAChB,QAAI,cAAc,KAAK,EAAE,QAAQ,aAAa,oBAAoB;AAChE,OAAE,gBAAgB;AAClB,wBAAmB,SAAS;eACnB,cACT,eAAc,GAAG,UAAU,UAAU;;GAGzC,eACE,sBAAsB,SAAS,YAC1B,MAAM,oBAAoB,GAAG,WAAW,SAAS,GAClD,KAAA;GAEN,SAAS;GACT,YACE,yBAAyB,SAAS,YAAY,MAAM,EAAE,gBAAgB,GAAG,KAAA;GAE3E,GAAI;GACJ,EA5CK,KAAK,UA4CV;GAEJ;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,KAAD;EAAK,GAAI,UAAU,cAAc;EAAE,KAAK;GAAE;GAAO;GAAS;YACxD,iBAAA,GAAA,kBAAA,MAACA,cAAAA,KAAD;GACE,KAAK;GACL,KAAK,EAAE,OAAO;GACd,GAAI,UAAU,mBAAmB;GACjC,YACE,yBAAyB,SAAS,YAC7B,MAAM,qBAAqB,GAAG,OAAO,IAAI,EAAE,SAAS,GACrD,KAAA;GAEN,aAAa,yBAAyB,SAAS,WAAW,sBAAsB,KAAA;GAChF,QACE,yBAAyB,SAAS,YAC7B,MAAM,iBAAiB,GAAG,OAAO,IAAI,EAAE,SAAS,GACjD,KAAA;aAbR,CAgBG,UACA,MACG;;EACF,CAAA"}
@@ -1,18 +1,35 @@
1
1
  "use client";
2
2
  //#region packages/@mantine/schedule/src/utils/get-business-hours-mod/get-business-hours-mod.ts
3
+ function isBusinessHoursRange(value) {
4
+ return Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "string";
5
+ }
3
6
  /**
4
7
  * Determines if a given time is within business hours and returns modifier object
5
8
  * @param time - Time string in HH:mm:ss format
6
- * @param businessHours - Tuple of [start, end] times in HH:mm:ss format
9
+ * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week
7
10
  * @param highlightBusinessHours - Whether to highlight business hours
11
+ * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours
8
12
  * @returns Modifier object for styling business/non-business hours
9
13
  */
10
- function getBusinessHoursMod({ time, businessHours, highlightBusinessHours }) {
14
+ function getBusinessHoursMod({ time, businessHours, highlightBusinessHours, dayOfWeek }) {
11
15
  if (!highlightBusinessHours || !businessHours) return {
12
16
  "business-hours": false,
13
17
  "non-business-hours": false
14
18
  };
15
- const [start, end] = businessHours;
19
+ let range;
20
+ if (isBusinessHoursRange(businessHours)) range = businessHours;
21
+ else {
22
+ if (dayOfWeek === void 0) return {
23
+ "business-hours": false,
24
+ "non-business-hours": false
25
+ };
26
+ range = businessHours[dayOfWeek] ?? null;
27
+ }
28
+ if (!range) return {
29
+ "business-hours": false,
30
+ "non-business-hours": true
31
+ };
32
+ const [start, end] = range;
16
33
  const isInBusinessHours = time >= start && time < end;
17
34
  return {
18
35
  "business-hours": isInBusinessHours,
@@ -1 +1 @@
1
- {"version":3,"file":"get-business-hours-mod.cjs","names":[],"sources":["../../../src/utils/get-business-hours-mod/get-business-hours-mod.ts"],"sourcesContent":["export interface GetBusinessHoursModInput {\n time: string;\n businessHours?: [string, string];\n highlightBusinessHours?: boolean;\n}\n\nexport interface BusinessHoursMod {\n 'business-hours': boolean;\n 'non-business-hours': boolean;\n}\n\n/**\n * Determines if a given time is within business hours and returns modifier object\n * @param time - Time string in HH:mm:ss format\n * @param businessHours - Tuple of [start, end] times in HH:mm:ss format\n * @param highlightBusinessHours - Whether to highlight business hours\n * @returns Modifier object for styling business/non-business hours\n */\nexport function getBusinessHoursMod({\n time,\n businessHours,\n highlightBusinessHours,\n}: GetBusinessHoursModInput): BusinessHoursMod {\n if (!highlightBusinessHours || !businessHours) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n\n const [start, end] = businessHours;\n const isInBusinessHours = time >= start && time < end;\n\n return {\n 'business-hours': isInBusinessHours,\n 'non-business-hours': !isInBusinessHours,\n };\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgB,oBAAoB,EAClC,MACA,eACA,0BAC6C;AAC7C,KAAI,CAAC,0BAA0B,CAAC,cAC9B,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,MAAM,CAAC,OAAO,OAAO;CACrB,MAAM,oBAAoB,QAAQ,SAAS,OAAO;AAElD,QAAO;EACL,kBAAkB;EAClB,sBAAsB,CAAC;EACxB"}
1
+ {"version":3,"file":"get-business-hours-mod.cjs","names":[],"sources":["../../../src/utils/get-business-hours-mod/get-business-hours-mod.ts"],"sourcesContent":["import { DayOfWeek } from '../../types';\n\n/** Business hours range in `HH:mm:ss` format */\nexport type BusinessHoursRange = [string, string];\n\n/** Per-day business hours map keyed by day of the week (0 – Sunday, 6 – Saturday). `null` marks a day as fully outside business hours. */\nexport type BusinessHoursPerDay = Partial<Record<DayOfWeek, BusinessHoursRange | null>>;\n\n/** Business hours value – tuple applies to every day, record configures business hours per day */\nexport type BusinessHoursValue = BusinessHoursRange | BusinessHoursPerDay;\n\nexport interface GetBusinessHoursModInput {\n time: string;\n businessHours?: BusinessHoursValue;\n highlightBusinessHours?: boolean;\n dayOfWeek?: DayOfWeek;\n}\n\nexport interface BusinessHoursMod {\n 'business-hours': boolean;\n 'non-business-hours': boolean;\n}\n\nfunction isBusinessHoursRange(value: BusinessHoursValue): value is BusinessHoursRange {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'string' &&\n typeof value[1] === 'string'\n );\n}\n\n/**\n * Determines if a given time is within business hours and returns modifier object\n * @param time - Time string in HH:mm:ss format\n * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week\n * @param highlightBusinessHours - Whether to highlight business hours\n * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours\n * @returns Modifier object for styling business/non-business hours\n */\nexport function getBusinessHoursMod({\n time,\n businessHours,\n highlightBusinessHours,\n dayOfWeek,\n}: GetBusinessHoursModInput): BusinessHoursMod {\n if (!highlightBusinessHours || !businessHours) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n\n let range: [string, string] | null;\n if (isBusinessHoursRange(businessHours)) {\n range = businessHours;\n } else {\n if (dayOfWeek === undefined) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n range = businessHours[dayOfWeek] ?? null;\n }\n\n if (!range) {\n return {\n 'business-hours': false,\n 'non-business-hours': true,\n };\n }\n\n const [start, end] = range;\n const isInBusinessHours = time >= start && time < end;\n\n return {\n 'business-hours': isInBusinessHours,\n 'non-business-hours': !isInBusinessHours,\n };\n}\n"],"mappings":";;AAuBA,SAAS,qBAAqB,OAAwD;AACpF,QACE,MAAM,QAAQ,MAAM,IACpB,MAAM,WAAW,KACjB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,OAAO;;;;;;;;;;AAYxB,SAAgB,oBAAoB,EAClC,MACA,eACA,wBACA,aAC6C;AAC7C,KAAI,CAAC,0BAA0B,CAAC,cAC9B,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,IAAI;AACJ,KAAI,qBAAqB,cAAc,CACrC,SAAQ;MACH;AACL,MAAI,cAAc,KAAA,EAChB,QAAO;GACL,kBAAkB;GAClB,sBAAsB;GACvB;AAEH,UAAQ,cAAc,cAAc;;AAGtC,KAAI,CAAC,MACH,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,MAAM,CAAC,OAAO,OAAO;CACrB,MAAM,oBAAoB,QAAQ,SAAS,OAAO;AAElD,QAAO;EACL,kBAAkB;EAClB,sBAAsB,CAAC;EACxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"WeekView.mjs","names":["classes"],"sources":["../../../src/components/WeekView/WeekView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n rem,\n ScrollArea,\n ScrollAreaAutosizeProps,\n StylesApiProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useIsomorphicEffect, useMergedRef } from '@mantine/hooks';\nimport { useAutoScrollOnDrag } from '../../hooks/use-auto-scroll-on-drag';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useEventResize } from '../../hooks/use-event-resize';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateDropTime,\n expandRecurringEvents,\n formatDate,\n getBusinessHoursMod,\n getDayTimeIntervals,\n getWeekDays,\n getWeekNumber,\n isAllDayEvent,\n nextWeek,\n previousWeek,\n toDateString,\n} from '../../utils';\nimport {\n CurrentTimeIndicator,\n CurrentTimeIndicatorStylesNames,\n} from '../CurrentTimeIndicator/CurrentTimeIndicator';\nimport { DragContext, DragContextValue } from '../DragContext/DragContext';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getWeekLabel } from './get-week-label/get-week-label';\nimport { getWeekViewEvents } from './get-week-view-events/get-week-view-events';\nimport { handleWeekViewKeyDown, WeekViewControlsRef } from './handle-week-view-key-down';\nimport { WeekViewDay } from './WeekViewDay';\nimport classes from './WeekView.module.css';\n\nexport type WeekViewStylesNames =\n | 'weekView'\n | 'weekViewRoot'\n | 'weekViewHeader'\n | 'weekViewInner'\n | 'weekViewAllDaySlotsEvents'\n | 'weekViewAllDaySlots'\n | 'weekViewAllDaySlotsList'\n | 'weekViewAllDaySlot'\n | 'weekViewAllDaySlotsLabel'\n | 'weekViewScrollArea'\n | 'weekViewCorner'\n | 'weekViewSlotLabels'\n | 'weekViewSlotLabel'\n | 'weekViewDayLabel'\n | 'weekViewDayWeekday'\n | 'weekViewDay'\n | 'weekViewDayNumber'\n | 'weekViewDaySlot'\n | 'weekViewDaySlots'\n | 'weekViewWeekLabel'\n | 'weekViewWeekNumber'\n | 'weekViewBackgroundEvent'\n | CurrentTimeIndicatorStylesNames\n | CombinedScheduleHeaderStylesNames;\n\nexport type WeekViewCssVariables = {\n weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height';\n};\n\nexport interface WeekViewProps\n extends BoxProps, StylesApiProps<WeekViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Week to display, Date object or date string in `YYYY-MM-DD` format */\n date: Date | string;\n\n /** Called with the new date value when a date is selected */\n onDateChange?: (value: DateStringValue) => void;\n\n /** Start time for the day view, in `HH:mm:ss` format @default 00:00:00 */\n startTime?: string;\n\n /** End time for the day view, in `HH:mm:ss` format @default 23:59:59 */\n endTime?: string;\n\n /** Number of minutes for each interval in the day view @default 60 */\n intervalMinutes?: number;\n\n /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */\n slotLabelFormat?: DateLabelFormat;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. @default 'ddd' */\n weekdayFormat?: DateLabelFormat;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** If set to false, weekend days are hidden @default true */\n withWeekendDays?: boolean;\n\n /** If set to true, highlights today in the weekday row @default false */\n highlightToday?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to the `ScrollArea.Autosize` component */\n scrollAreaProps?: ScrollAreaAutosizeProps & DataAttributes;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** If set, the week number is displayed at the top left corner @default true */\n withWeekNumber?: boolean;\n\n /** If set, displays a line indicating the current time @default true */\n withCurrentTimeIndicator?: boolean;\n\n /** If set, the time indicator displays the current time in the bubble @default true */\n withCurrentTimeBubble?: boolean;\n\n /** If set, displays the current time indicator on the same day of week even when viewing a different week @default false */\n forceCurrentTimeIndicator?: boolean;\n\n /** If set, displays all-day slots at the top of the view @default true */\n withAllDaySlots?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Called when view level select button is clicked */\n onViewChange?: (view: ScheduleViewLevel) => void;\n\n /** Props passed to previous month control */\n previousControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to next month control */\n nextControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to today control */\n todayControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to view level select */\n viewSelectProps?: Partial<ViewSelectProps> & DataAttributes;\n\n /** Format for week label @default 'MMM DD' */\n weekLabelFormat?: DateLabelFormat;\n\n /** List of events to display in the week view */\n events?: ScheduleEventData[];\n\n /** Height of 1hr slot @default 64px */\n slotHeight?: React.CSSProperties['height'];\n\n /** Height of all-day slot @default 48px */\n allDaySlotHeight?: React.CSSProperties['height'];\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background @default false */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format @default ['09:00:00', '17:00:00'] */\n businessHours?: [string, string];\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** If true, events can be dragged and dropped @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped at new time */\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be dragged */\n canDragEvent?: (event: ScheduleEventData) => boolean;\n\n /** Called when any event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when any event drag ends */\n onEventDragEnd?: () => void;\n\n /** Called when time slot is clicked */\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n }) => void;\n\n /** Called when all-day slot is clicked */\n onAllDaySlotClick?: (day: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select time slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a time slot range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Time to scroll to on initial render, in `HH:mm:ss` format */\n startScrollTime?: string;\n\n /** Function to customize week label in the header */\n renderWeekLabel?: (params: {\n weekStart: DateStringValue;\n weekEnd: DateStringValue;\n }) => React.ReactNode;\n\n /** Called when an external item is dropped onto the schedule. Receives the `DataTransfer` object and the drop target datetime. */\n onExternalEventDrop?: (dataTransfer: DataTransfer, dropDateTime: DateTimeStringValue) => void;\n\n /** If true, events can be resized by dragging their edges @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Function to get additional props for each time slot. Receives slot start and end datetime strings. Returned props are spread onto the slot element. Event handlers returned by this function are composed with internal handlers (e.g. onClick) rather than overriding them. */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport type WeekViewFactory = Factory<{\n props: WeekViewProps;\n ref: HTMLDivElement;\n stylesNames: WeekViewStylesNames;\n vars: WeekViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'WeekView',\n withWeekendDays: true,\n withCurrentTimeIndicator: true,\n startTime: '00:00:00',\n endTime: '23:59:59',\n slotLabelFormat: 'HH:mm',\n intervalMinutes: 60,\n weekdayFormat: 'ddd',\n withWeekNumber: true,\n withCurrentTimeBubble: true,\n withAllDaySlots: true,\n withHeader: true,\n weekLabelFormat: 'MMM DD',\n highlightBusinessHours: false,\n businessHours: ['09:00:00', '17:00:00'],\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n withEventResize: false,\n mode: 'default',\n} satisfies Partial<WeekViewProps>;\n\nconst varsResolver = createVarsResolver<WeekViewFactory>(\n (_theme, { radius, allDaySlotHeight, slotHeight }) => ({\n weekView: {\n '--week-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--week-view-all-day-slots-height': rem(allDaySlotHeight),\n '--week-view-slot-height': rem(slotHeight),\n },\n })\n);\n\nexport const WeekView = factory<WeekViewFactory>((_props) => {\n const props = useProps('WeekView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n startTime,\n endTime,\n date,\n onDateChange,\n intervalMinutes,\n slotLabelFormat,\n withWeekendDays,\n weekendDays,\n firstDayOfWeek,\n weekdayFormat,\n radius,\n highlightToday,\n withCurrentTimeIndicator,\n forceCurrentTimeIndicator,\n scrollAreaProps,\n locale,\n withWeekNumber,\n withCurrentTimeBubble,\n withAllDaySlots,\n __staticSelector,\n withHeader,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n weekLabelFormat,\n events,\n allDaySlotHeight,\n slotHeight,\n labels,\n highlightBusinessHours,\n businessHours,\n renderEventBody,\n renderEvent,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n mode,\n startScrollTime,\n renderWeekLabel,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n getTimeSlotProps,\n ...others\n } = props;\n\n const getStyles = useStyles<WeekViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'weekView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<WeekViewFactory>({\n classNames,\n styles,\n props,\n });\n\n const stylesApiProps = {\n classNames: resolvedClassNames,\n styles: resolvedStyles,\n attributes,\n __staticSelector,\n radius,\n };\n\n const theme = useMantineTheme();\n const [scrolled, setScrolled] = useState(false);\n const ctx = useDatesContext();\n const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const viewportRef = useRef<HTMLDivElement>(null);\n\n useAutoScrollOnDrag({\n viewportRef,\n enabled: (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static',\n });\n\n type DropTargetSlot = { day: string; slotIndex: number };\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, target: DropTargetSlot) => {\n if (!onExternalEventDrop) {\n return;\n }\n const slotDate = dayjs(target.day).format('YYYY-MM-DD');\n onExternalEventDrop(e.dataTransfer, `${slotDate} ${slots[target.slotIndex].startTime}`);\n },\n [onExternalEventDrop, slots]\n );\n\n const handleExternalAllDayDrop = useCallback(\n (e: React.DragEvent, day: string) => {\n if (!onExternalEventDrop) {\n return;\n }\n onExternalEventDrop(e.dataTransfer, `${dayjs(day).format('YYYY-MM-DD')} 00:00:00`);\n },\n [onExternalEventDrop]\n );\n\n const dragDrop = useDragDropHandlers<DropTargetSlot>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (target: DropTargetSlot, draggedEvent: ScheduleEventData) => {\n const slotTime = slots[target.slotIndex].startTime;\n return calculateDropTime({\n draggedEvent,\n targetDate: target.day,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const allDayDragDrop = useDragDropHandlers<string>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (targetDay: string, draggedEvent: ScheduleEventData) => {\n const eventDuration = dayjs(draggedEvent.end).diff(dayjs(draggedEvent.start), 'millisecond');\n const newStart = dayjs(targetDay).startOf('day');\n return { start: newStart.toDate(), end: newStart.add(eventDuration, 'millisecond').toDate() };\n },\n onExternalDrop: onExternalEventDrop ? handleExternalAllDayDrop : undefined,\n });\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex, group) => {\n if (!onSlotDragEnd) {\n return;\n }\n const slotDate = dayjs(group).format('YYYY-MM-DD');\n onSlotDragEnd(\n `${slotDate} ${slots[startIndex].startTime}`,\n `${slotDate} ${slots[endIndex].endTime}`\n );\n },\n });\n\n const eventResize = useEventResize({\n enabled: withEventResize,\n mode,\n startTime,\n endTime,\n intervalMinutes,\n onEventResize,\n canResizeEvent,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const handleTimeSlotClick = (\n day: string,\n slotTime: string,\n e: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (!onTimeSlotClick) {\n return;\n }\n\n const slotDate = dayjs(day).format('YYYY-MM-DD');\n const slotIndex = slots.findIndex((s) => s.startTime === slotTime);\n if (slotIndex === -1) {\n return;\n }\n\n const slot = slots[slotIndex];\n onTimeSlotClick({\n slotStart: `${slotDate} ${slot.startTime}`,\n slotEnd: `${slotDate} ${slot.endTime}`,\n nativeEvent: e,\n });\n };\n\n const weekdays = getWeekDays({\n week: date,\n withWeekendDays,\n weekendDays: ctx.getWeekendDays(weekendDays),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(weekdays[0]).startOf('day').toDate(),\n rangeEnd: dayjs(weekdays[weekdays.length - 1])\n .endOf('day')\n .toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const weekEvents = getWeekViewEvents({\n date,\n events: expandedEvents,\n startTime,\n endTime,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n weekendDays: ctx.getWeekendDays(weekendDays),\n withWeekendDays,\n });\n\n const timeValues = slots.map((interval) => {\n const intervalTime = dayjs(`${dayjs(date).format('YYYY-MM-DD')} ${interval.startTime}`);\n const label = formatDate({\n date: intervalTime,\n locale: ctx.getLocale(locale),\n format: slotLabelFormat,\n });\n\n return (\n <Box\n {...getStyles('weekViewSlotLabel')}\n key={interval.startTime}\n mod={{\n 'hour-start': interval.isHourStart,\n ...getBusinessHoursMod({\n time: interval.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n }}\n >\n {label}\n </Box>\n );\n });\n\n const slotsRef: WeekViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n const allDaySlotsRef = useRef<HTMLButtonElement[]>([]);\n const weekdaysRef = useRef<HTMLButtonElement[]>([]);\n const daySlotsContainersRef = useRef<(HTMLDivElement | null)[]>([]);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n const firstSlotIndex = { dayIndex: 0, slotIndex: 0 };\n\n useIsomorphicEffect(() => {\n if (!startScrollTime || !viewportRef.current) {\n return;\n }\n\n const firstDaySlots = slotsRef.current[0];\n if (!firstDaySlots || firstDaySlots.length === 0) {\n return;\n }\n\n const targetIndex = slots.findIndex((s) => s.startTime >= startScrollTime);\n if (targetIndex < 0) {\n return;\n }\n\n const targetSlot = firstDaySlots[targetIndex];\n if (!targetSlot) {\n return;\n }\n\n const slotRect = targetSlot.getBoundingClientRect();\n const viewportRect = viewportRef.current.getBoundingClientRect();\n viewportRef.current.scrollTo({ left: 0, top: slotRect.top - viewportRect.top });\n }, []);\n\n const getSlotIndexFromDragPoint = useCallback((event: React.DragEvent, dayIndex: number) => {\n const daySlots = slotsRef.current[dayIndex] ?? [];\n const slotIndex = daySlots.findIndex((slotNode) => {\n if (!slotNode) {\n return false;\n }\n\n const rect = slotNode.getBoundingClientRect();\n return event.clientY >= rect.top && event.clientY <= rect.bottom;\n });\n\n if (slotIndex >= 0) {\n return slotIndex;\n }\n\n const firstSlot = daySlots[0];\n const lastSlot = daySlots[daySlots.length - 1];\n\n if (!firstSlot || !lastSlot) {\n return null;\n }\n\n const firstRect = firstSlot.getBoundingClientRect();\n const lastRect = lastSlot.getBoundingClientRect();\n\n if (event.clientY < firstRect.top) {\n return 0;\n }\n\n if (event.clientY > lastRect.bottom) {\n return daySlots.length - 1;\n }\n\n return null;\n }, []);\n\n const handleSlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => {\n handleWeekViewKeyDown({\n controlsRef: slotsRef,\n dayIndex,\n slotIndex,\n event,\n });\n };\n\n const handleAllDaySlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex - 1]?.focus();\n } else if (direction === 'ArrowDown') {\n event.preventDefault();\n slotsRef.current?.[dayIndex]?.[0]?.focus();\n }\n };\n\n const handleWeekdayKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n weekdaysRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n weekdaysRef.current[dayIndex - 1]?.focus();\n }\n };\n\n const currentWeekdayIndex = withCurrentTimeIndicator\n ? forceCurrentTimeIndicator\n ? weekdays.findIndex((day) => dayjs(day).day() === dayjs().day())\n : weekdays.findIndex((day) => dayjs(day).isSame(dayjs(), 'date'))\n : -1;\n\n const weekdaysLabels = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n {...getStyles('weekViewDayLabel')}\n key={day}\n ref={(node) => {\n weekdaysRef.current[dayIndex] = node!;\n }}\n aria-label={`${getLabel('weekday', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n mod={{\n today: dayjs(day).isSame(dayjs(), 'day') && !!highlightToday,\n weekend: ctx.getWeekendDays(weekendDays).includes(dayjs(day).day() as DayOfWeek),\n static: mode === 'static',\n }}\n tabIndex={mode === 'static' ? -1 : dayIndex === 0 ? 0 : -1}\n onKeyDown={mode === 'static' ? undefined : (event) => handleWeekdayKeyDown(event, dayIndex)}\n onClick={\n mode === 'static'\n ? undefined\n : () => {\n onViewChange?.('day');\n onDateChange?.(toDateString(day));\n }\n }\n >\n <Box {...getStyles('weekViewDayWeekday')} key=\"weekday\">\n {formatDate({ locale: ctx.getLocale(locale), date: day, format: weekdayFormat })}\n </Box>\n <div {...getStyles('weekViewDayNumber')} key=\"date\">\n {dayjs(day).date()}\n </div>\n </UnstyledButton>\n ));\n\n const days = weekdays.map((day, dayIndex) => {\n const allBgEvents = weekEvents.backgroundEvents[day] || [];\n\n const backgroundEventNodes = allBgEvents\n .filter((event) => !event.position.allDay)\n .map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-${event.id}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: `${event.position.top}%`,\n height: `${event.position.height}%`,\n width: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const dayEvents = (weekEvents.regularEvents[day] || []).map((event) => {\n const eventIsAllDay = isAllDayEvent({ event, date: day });\n const isDraggable = !eventIsAllDay && dragDrop.isDraggableEvent(event);\n const isResizable = !eventIsAllDay && eventResize.isResizableEvent(event);\n const resizePosition = eventResize.getResizePosition(event.id);\n const eventTop = resizePosition ? resizePosition.top : event.position.top;\n const eventHeight = resizePosition ? resizePosition.height : event.position.height;\n\n return (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n hanging={event.position.hanging}\n draggable={isDraggable}\n withResize={isResizable}\n isResizing={resizePosition !== null}\n onResizeStart={\n isResizable\n ? (edge, e) => {\n const container = daySlotsContainersRef.current[dayIndex];\n if (container) {\n eventResize.handleResizeStart({\n event,\n edge,\n container,\n originalTop: event.position.top,\n originalHeight: event.position.height,\n eventDate: dayjs(day).format('YYYY-MM-DD'),\n pointerEvent: e,\n });\n }\n }\n : undefined\n }\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n style={{\n position: 'absolute',\n top: `calc(${eventTop}% + 1px)`,\n left: `${event.position.offset}%`,\n width: `${event.position.width}%`,\n height: `calc(${eventHeight}% - 1px)`,\n }}\n />\n );\n });\n\n return (\n <WeekViewDay\n key={day}\n day={day}\n dayIndex={dayIndex}\n slots={slots}\n getStyles={getStyles}\n weekendDays={weekendDays}\n highlightBusinessHours={highlightBusinessHours}\n businessHours={businessHours}\n labels={labels}\n withEventsDragAndDrop={withDragHandlers}\n mode={mode}\n slotsRef={slotsRef}\n firstSlotIndex={firstSlotIndex}\n onSlotKeyDown={handleSlotKeyDown}\n onSlotClick={handleTimeSlotClick}\n onFirstSlotArrowUp={\n withAllDaySlots\n ? (dayIdx) => {\n allDaySlotsRef.current[dayIdx]?.focus();\n }\n : undefined\n }\n onDaySlotsDragOver={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, { day: dayStr, slotIndex });\n }\n }}\n onDaySlotsDragLeave={dragDrop.handleDragLeave}\n onDaySlotsDrop={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, { day: dayStr, slotIndex });\n }\n }}\n dropTargetSlotIndex={\n dragDrop.dropTarget?.day === day ? dragDrop.dropTarget.slotIndex : undefined\n }\n withDragSlotSelect={withDragSlotSelect}\n onSlotPointerDown={slotDragSelect.handleSlotPointerDown}\n isSlotDragSelected={slotDragSelect.isSlotSelected}\n daySlotsContainerRef={(node) => {\n daySlotsContainersRef.current[dayIndex] = node;\n }}\n getTimeSlotProps={getTimeSlotProps}\n >\n {backgroundEventNodes}\n {dayEvents}\n </WeekViewDay>\n );\n });\n\n const allDaySlots = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n aria-label={`${getLabel('allDay', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n key={day}\n ref={(node) => {\n allDaySlotsRef.current[dayIndex] = node!;\n }}\n tabIndex={dayIndex === 0 ? 0 : -1}\n onKeyDown={(event) => handleAllDaySlotKeyDown(event, dayIndex)}\n onClick={\n mode === 'static' || !onAllDaySlotClick\n ? undefined\n : (e) => onAllDaySlotClick(dayjs(day).format('YYYY-MM-DD'), e)\n }\n onDragOver={withDragHandlers ? (e) => allDayDragDrop.handleDragOver(e, day) : undefined}\n onDragLeave={withDragHandlers ? allDayDragDrop.handleDragLeave : undefined}\n onDrop={withDragHandlers ? (e) => allDayDragDrop.handleDrop(e, day) : undefined}\n {...getStyles('weekViewDaySlot')}\n mod={{ 'drop-target': allDayDragDrop.isDropTarget(day) }}\n />\n ));\n\n const allDayEventIds = useMemo(\n () => new Set(weekEvents.allDayEvents.map((e) => e.id)),\n [weekEvents.allDayEvents]\n );\n\n const allDayEvents = weekEvents.allDayEvents.map((event) => (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n nowrap\n hanging={event.position.hanging}\n draggable={allDayDragDrop.isDraggableEvent(event)}\n renderEvent={renderEvent}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{\n position: 'absolute',\n zIndex: 2,\n top: `calc(${event.position.row * 50}% + 1px)`,\n left: `calc(${event.position.offset}% + 1px)`,\n width: `calc(${event.position.width}% - 1px)`,\n height: 'calc(50% - 2px)',\n maxHeight: 'calc(50% - 2px)',\n }}\n />\n ));\n\n const allDayBackgroundEventNodes = weekdays.flatMap((day, dayIndex) => {\n const allDayBgEvents = (weekEvents.backgroundEvents[day] || []).filter(\n (event) => event.position.allDay\n );\n const dayWidth = 100 / weekdays.length;\n const dayOffset = dayIndex * dayWidth;\n\n return allDayBgEvents.map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-allday-${event.id}-${day}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: 0,\n height: '100%',\n left: `${dayOffset}%`,\n width: `${dayWidth}%`,\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n });\n\n // Extra rows show on hover = total rows - 2 visible rows (starts from 0, so -1)\n const extraRows = Math.max(...weekEvents.allDayEvents.map((event) => event.position.row), 1) - 1;\n\n const content = (\n <Box\n {...getStyles('weekView')}\n mod={{ static: mode === 'static', 'slot-dragging': slotDragSelect.isDragging }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"week\"\n navigationHandlers={{\n previous: () => previousWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n next: () => nextWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n today: () => toDateString(dayjs()),\n }}\n control={{\n miw: 140,\n title: getWeekLabel({\n weekdays,\n locale: ctx.getLocale(locale),\n weekLabelFormat,\n renderWeekLabel,\n }),\n }}\n labels={labels}\n onDateChange={onDateChange}\n onViewChange={onViewChange}\n previousControlProps={previousControlProps}\n nextControlProps={nextControlProps}\n todayControlProps={todayControlProps}\n viewSelectProps={viewSelectProps}\n stylesApiProps={stylesApiProps}\n />\n )}\n\n <Box\n {...getStyles('weekViewRoot')}\n __vars={{\n '--indicator-offset-index':\n currentWeekdayIndex === -1 ? undefined : `${currentWeekdayIndex + 1}`,\n '--number-of-days': withWeekendDays\n ? '7'\n : `${7 - ctx.getWeekendDays(weekendDays).length}`,\n }}\n mod={{ 'with-weekends': withWeekendDays }}\n >\n <ScrollArea.Autosize\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('weekViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n onScrollPositionChange={(position) => {\n scrollAreaProps?.onScrollPositionChange?.(position);\n setScrolled(position.y !== 0);\n }}\n viewportRef={mergedViewportRef}\n >\n <Box {...getStyles('weekViewHeader')} mod={{ scrolled }}>\n <div {...getStyles('weekViewCorner')} key=\"corner\">\n {withWeekNumber && (\n <>\n <div {...getStyles('weekViewWeekLabel')}>{getLabel('week', labels)}</div>\n <div {...getStyles('weekViewWeekNumber')}>{getWeekNumber(date)}</div>\n </>\n )}\n </div>\n\n {weekdaysLabels}\n </Box>\n\n {withAllDaySlots && (\n <div {...getStyles('weekViewAllDaySlots')}>\n <div {...getStyles('weekViewAllDaySlotsLabel')}>{getLabel('allDay', labels)}</div>\n <div {...getStyles('weekViewAllDaySlotsList')}>\n {allDayBackgroundEventNodes}\n <Box\n {...getStyles('weekViewAllDaySlotsEvents')}\n __vars={{ '--extra-rows': `${extraRows}` }}\n >\n {allDayEvents}\n </Box>\n {allDaySlots}\n </div>\n </div>\n )}\n\n <div {...getStyles('weekViewInner')}>\n <div {...getStyles('weekViewSlotLabels')}>{timeValues}</div>\n\n {withCurrentTimeIndicator && currentWeekdayIndex !== -1 && (\n <CurrentTimeIndicator\n startOffset=\"calc(100% - (100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index) + 1) + ((var(--number-of-days) - var(--indicator-offset-index) + 1) * var(--indicator-labels-offset)))\"\n endOffset=\"calc((100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index)) - (var(--number-of-days) - var(--indicator-offset-index)) * var(--indicator-labels-offset))\"\n timeBubbleStartOffset=\"calc(var(--week-view-slots-label-width) - var(--time-bubble-width))\"\n currentTimeFormat={slotLabelFormat}\n withTimeBubble={withCurrentTimeBubble}\n withThumb={withCurrentTimeBubble ? currentWeekdayIndex !== 0 : true}\n locale={locale}\n startTime={startTime}\n endTime={endTime}\n {...stylesApiProps}\n />\n )}\n {days}\n </div>\n </ScrollArea.Autosize>\n </Box>\n </Box>\n );\n\n const mergedDragContextValue = useMemo<DragContextValue>(\n () => ({\n isDragging:\n dragDrop.dragContextValue.isDragging || allDayDragDrop.dragContextValue.isDragging,\n draggedEventId:\n dragDrop.dragContextValue.draggedEventId ?? allDayDragDrop.dragContextValue.draggedEventId,\n draggedEvent:\n dragDrop.dragContextValue.draggedEvent ?? allDayDragDrop.dragContextValue.draggedEvent,\n dropTarget:\n dragDrop.dragContextValue.dropTarget ?? allDayDragDrop.dragContextValue.dropTarget,\n onDragStart: (event: ScheduleEventData) => {\n if (allDayEventIds.has(event.id)) {\n allDayDragDrop.handleDragStart(event);\n } else {\n dragDrop.handleDragStart(event);\n }\n },\n onDragEnd: () => {\n dragDrop.handleDragEnd();\n allDayDragDrop.handleDragEnd();\n },\n setDropTarget: dragDrop.dragContextValue.setDropTarget,\n }),\n [dragDrop.dragContextValue, allDayDragDrop.dragContextValue, allDayEventIds]\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={mergedDragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nWeekView.displayName = '@mantine/schedule/WeekView';\nWeekView.classes = classes;\nWeekView.varsResolver = varsResolver;\n\nexport namespace WeekView {\n export type Props = WeekViewProps;\n export type Factory = WeekViewFactory;\n export type StylesNames = WeekViewStylesNames;\n export type CssVariables = WeekViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+RA,MAAM,eAAe;CACnB,kBAAkB;CAClB,iBAAiB;CACjB,0BAA0B;CAC1B,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,iBAAiB;CACjB,eAAe;CACf,gBAAgB;CAChB,uBAAuB;CACvB,iBAAiB;CACjB,YAAY;CACZ,iBAAiB;CACjB,wBAAwB;CACxB,eAAe,CAAC,YAAY,WAAW;CACvC,uBAAuB;CACvB,oBAAoB;CACpB,iBAAiB;CACjB,MAAM;CACP;AAED,MAAM,eAAe,oBAClB,QAAQ,EAAE,QAAQ,kBAAkB,kBAAkB,EACrD,UAAU;CACR,sBAAsB,WAAW,KAAA,IAAY,UAAU,OAAO,GAAG,KAAA;CACjE,oCAAoC,IAAI,iBAAiB;CACzD,2BAA2B,IAAI,W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,SAAS,cAAc;AACvB,SAAS,UAAUA;AACnB,SAAS,eAAe"}
1
+ {"version":3,"file":"WeekView.mjs","names":["classes"],"sources":["../../../src/components/WeekView/WeekView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useMemo, useRef, useState } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n rem,\n ScrollArea,\n ScrollAreaAutosizeProps,\n StylesApiProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useIsomorphicEffect, useMergedRef } from '@mantine/hooks';\nimport { useAutoScrollOnDrag } from '../../hooks/use-auto-scroll-on-drag';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useEventResize } from '../../hooks/use-event-resize';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n BusinessHoursValue,\n calculateDropTime,\n expandRecurringEvents,\n formatDate,\n getBusinessHoursMod,\n getDayTimeIntervals,\n getWeekDays,\n getWeekNumber,\n isAllDayEvent,\n nextWeek,\n previousWeek,\n toDateString,\n} from '../../utils';\nimport {\n CurrentTimeIndicator,\n CurrentTimeIndicatorStylesNames,\n} from '../CurrentTimeIndicator/CurrentTimeIndicator';\nimport { DragContext, DragContextValue } from '../DragContext/DragContext';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getWeekLabel } from './get-week-label/get-week-label';\nimport { getWeekViewEvents } from './get-week-view-events/get-week-view-events';\nimport { handleWeekViewKeyDown, WeekViewControlsRef } from './handle-week-view-key-down';\nimport { WeekViewDay } from './WeekViewDay';\nimport classes from './WeekView.module.css';\n\nexport type WeekViewStylesNames =\n | 'weekView'\n | 'weekViewRoot'\n | 'weekViewHeader'\n | 'weekViewInner'\n | 'weekViewAllDaySlotsEvents'\n | 'weekViewAllDaySlots'\n | 'weekViewAllDaySlotsList'\n | 'weekViewAllDaySlot'\n | 'weekViewAllDaySlotsLabel'\n | 'weekViewScrollArea'\n | 'weekViewCorner'\n | 'weekViewSlotLabels'\n | 'weekViewSlotLabel'\n | 'weekViewDayLabel'\n | 'weekViewDayWeekday'\n | 'weekViewDay'\n | 'weekViewDayNumber'\n | 'weekViewDaySlot'\n | 'weekViewDaySlots'\n | 'weekViewWeekLabel'\n | 'weekViewWeekNumber'\n | 'weekViewBackgroundEvent'\n | CurrentTimeIndicatorStylesNames\n | CombinedScheduleHeaderStylesNames;\n\nexport type WeekViewCssVariables = {\n weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height';\n};\n\nexport interface WeekViewProps\n extends BoxProps, StylesApiProps<WeekViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Week to display, Date object or date string in `YYYY-MM-DD` format */\n date: Date | string;\n\n /** Called with the new date value when a date is selected */\n onDateChange?: (value: DateStringValue) => void;\n\n /** Start time for the day view, in `HH:mm:ss` format @default 00:00:00 */\n startTime?: string;\n\n /** End time for the day view, in `HH:mm:ss` format @default 23:59:59 */\n endTime?: string;\n\n /** Number of minutes for each interval in the day view @default 60 */\n intervalMinutes?: number;\n\n /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */\n slotLabelFormat?: DateLabelFormat;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. @default 'ddd' */\n weekdayFormat?: DateLabelFormat;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** If set to false, weekend days are hidden @default true */\n withWeekendDays?: boolean;\n\n /** If set to true, highlights today in the weekday row @default false */\n highlightToday?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to the `ScrollArea.Autosize` component */\n scrollAreaProps?: ScrollAreaAutosizeProps & DataAttributes;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** If set, the week number is displayed at the top left corner @default true */\n withWeekNumber?: boolean;\n\n /** If set, displays a line indicating the current time @default true */\n withCurrentTimeIndicator?: boolean;\n\n /** If set, the time indicator displays the current time in the bubble @default true */\n withCurrentTimeBubble?: boolean;\n\n /** If set, displays the current time indicator on the same day of week even when viewing a different week @default false */\n forceCurrentTimeIndicator?: boolean;\n\n /** If set, displays all-day slots at the top of the view @default true */\n withAllDaySlots?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Called when view level select button is clicked */\n onViewChange?: (view: ScheduleViewLevel) => void;\n\n /** Props passed to previous month control */\n previousControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to next month control */\n nextControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to today control */\n todayControlProps?: React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed to view level select */\n viewSelectProps?: Partial<ViewSelectProps> & DataAttributes;\n\n /** Format for week label @default 'MMM DD' */\n weekLabelFormat?: DateLabelFormat;\n\n /** List of events to display in the week view */\n events?: ScheduleEventData[];\n\n /** Height of 1hr slot @default 64px */\n slotHeight?: React.CSSProperties['height'];\n\n /** Height of all-day slot @default 48px */\n allDaySlotHeight?: React.CSSProperties['height'];\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background @default false */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format shared across all days, or a per-day record keyed by day of the week (`0` – Sunday, `6` – Saturday) for day-specific ranges. Set a day to `null` to mark it as fully outside business hours. @default ['09:00:00', '17:00:00'] */\n businessHours?: BusinessHoursValue;\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** If true, events can be dragged and dropped @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped at new time */\n onEventDrop?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be dragged */\n canDragEvent?: (event: ScheduleEventData) => boolean;\n\n /** Called when any event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when any event drag ends */\n onEventDragEnd?: () => void;\n\n /** Called when time slot is clicked */\n onTimeSlotClick?: (data: {\n slotStart: DateTimeStringValue;\n slotEnd: DateTimeStringValue;\n nativeEvent: React.MouseEvent<HTMLButtonElement>;\n }) => void;\n\n /** Called when all-day slot is clicked */\n onAllDaySlotClick?: (day: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called when event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select time slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a time slot range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Time to scroll to on initial render, in `HH:mm:ss` format */\n startScrollTime?: string;\n\n /** Function to customize week label in the header */\n renderWeekLabel?: (params: {\n weekStart: DateStringValue;\n weekEnd: DateStringValue;\n }) => React.ReactNode;\n\n /** Called when an external item is dropped onto the schedule. Receives the `DataTransfer` object and the drop target datetime. */\n onExternalEventDrop?: (dataTransfer: DataTransfer, dropDateTime: DateTimeStringValue) => void;\n\n /** If true, events can be resized by dragging their edges @default false */\n withEventResize?: boolean;\n\n /** Called when event is resized */\n onEventResize?: (data: {\n eventId: string | number;\n newStart: DateTimeStringValue;\n newEnd: DateTimeStringValue;\n event: ScheduleEventData;\n }) => void;\n\n /** Function to determine if event can be resized */\n canResizeEvent?: (event: ScheduleEventData) => boolean;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Function to get additional props for each time slot. Receives slot start and end datetime strings. Returned props are spread onto the slot element. Event handlers returned by this function are composed with internal handlers (e.g. onClick) rather than overriding them. */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport type WeekViewFactory = Factory<{\n props: WeekViewProps;\n ref: HTMLDivElement;\n stylesNames: WeekViewStylesNames;\n vars: WeekViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'WeekView',\n withWeekendDays: true,\n withCurrentTimeIndicator: true,\n startTime: '00:00:00',\n endTime: '23:59:59',\n slotLabelFormat: 'HH:mm',\n intervalMinutes: 60,\n weekdayFormat: 'ddd',\n withWeekNumber: true,\n withCurrentTimeBubble: true,\n withAllDaySlots: true,\n withHeader: true,\n weekLabelFormat: 'MMM DD',\n highlightBusinessHours: false,\n businessHours: ['09:00:00', '17:00:00'],\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n withEventResize: false,\n mode: 'default',\n} satisfies Partial<WeekViewProps>;\n\nconst varsResolver = createVarsResolver<WeekViewFactory>(\n (_theme, { radius, allDaySlotHeight, slotHeight }) => ({\n weekView: {\n '--week-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--week-view-all-day-slots-height': rem(allDaySlotHeight),\n '--week-view-slot-height': rem(slotHeight),\n },\n })\n);\n\nexport const WeekView = factory<WeekViewFactory>((_props) => {\n const props = useProps('WeekView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n startTime,\n endTime,\n date,\n onDateChange,\n intervalMinutes,\n slotLabelFormat,\n withWeekendDays,\n weekendDays,\n firstDayOfWeek,\n weekdayFormat,\n radius,\n highlightToday,\n withCurrentTimeIndicator,\n forceCurrentTimeIndicator,\n scrollAreaProps,\n locale,\n withWeekNumber,\n withCurrentTimeBubble,\n withAllDaySlots,\n __staticSelector,\n withHeader,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n weekLabelFormat,\n events,\n allDaySlotHeight,\n slotHeight,\n labels,\n highlightBusinessHours,\n businessHours,\n renderEventBody,\n renderEvent,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n mode,\n startScrollTime,\n renderWeekLabel,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n getTimeSlotProps,\n ...others\n } = props;\n\n const getStyles = useStyles<WeekViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'weekView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<WeekViewFactory>({\n classNames,\n styles,\n props,\n });\n\n const stylesApiProps = {\n classNames: resolvedClassNames,\n styles: resolvedStyles,\n attributes,\n __staticSelector,\n radius,\n };\n\n const theme = useMantineTheme();\n const [scrolled, setScrolled] = useState(false);\n const ctx = useDatesContext();\n const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const viewportRef = useRef<HTMLDivElement>(null);\n\n useAutoScrollOnDrag({\n viewportRef,\n enabled: (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static',\n });\n\n type DropTargetSlot = { day: string; slotIndex: number };\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, target: DropTargetSlot) => {\n if (!onExternalEventDrop) {\n return;\n }\n const slotDate = dayjs(target.day).format('YYYY-MM-DD');\n onExternalEventDrop(e.dataTransfer, `${slotDate} ${slots[target.slotIndex].startTime}`);\n },\n [onExternalEventDrop, slots]\n );\n\n const handleExternalAllDayDrop = useCallback(\n (e: React.DragEvent, day: string) => {\n if (!onExternalEventDrop) {\n return;\n }\n onExternalEventDrop(e.dataTransfer, `${dayjs(day).format('YYYY-MM-DD')} 00:00:00`);\n },\n [onExternalEventDrop]\n );\n\n const dragDrop = useDragDropHandlers<DropTargetSlot>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (target: DropTargetSlot, draggedEvent: ScheduleEventData) => {\n const slotTime = slots[target.slotIndex].startTime;\n return calculateDropTime({\n draggedEvent,\n targetDate: target.day,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const allDayDragDrop = useDragDropHandlers<string>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (targetDay: string, draggedEvent: ScheduleEventData) => {\n const eventDuration = dayjs(draggedEvent.end).diff(dayjs(draggedEvent.start), 'millisecond');\n const newStart = dayjs(targetDay).startOf('day');\n return { start: newStart.toDate(), end: newStart.add(eventDuration, 'millisecond').toDate() };\n },\n onExternalDrop: onExternalEventDrop ? handleExternalAllDayDrop : undefined,\n });\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex, group) => {\n if (!onSlotDragEnd) {\n return;\n }\n const slotDate = dayjs(group).format('YYYY-MM-DD');\n onSlotDragEnd(\n `${slotDate} ${slots[startIndex].startTime}`,\n `${slotDate} ${slots[endIndex].endTime}`\n );\n },\n });\n\n const eventResize = useEventResize({\n enabled: withEventResize,\n mode,\n startTime,\n endTime,\n intervalMinutes,\n onEventResize,\n canResizeEvent,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const handleTimeSlotClick = (\n day: string,\n slotTime: string,\n e: React.MouseEvent<HTMLButtonElement>\n ) => {\n if (!onTimeSlotClick) {\n return;\n }\n\n const slotDate = dayjs(day).format('YYYY-MM-DD');\n const slotIndex = slots.findIndex((s) => s.startTime === slotTime);\n if (slotIndex === -1) {\n return;\n }\n\n const slot = slots[slotIndex];\n onTimeSlotClick({\n slotStart: `${slotDate} ${slot.startTime}`,\n slotEnd: `${slotDate} ${slot.endTime}`,\n nativeEvent: e,\n });\n };\n\n const weekdays = getWeekDays({\n week: date,\n withWeekendDays,\n weekendDays: ctx.getWeekendDays(weekendDays),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(weekdays[0]).startOf('day').toDate(),\n rangeEnd: dayjs(weekdays[weekdays.length - 1])\n .endOf('day')\n .toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const weekEvents = getWeekViewEvents({\n date,\n events: expandedEvents,\n startTime,\n endTime,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n weekendDays: ctx.getWeekendDays(weekendDays),\n withWeekendDays,\n });\n\n const timeValues = slots.map((interval) => {\n const intervalTime = dayjs(`${dayjs(date).format('YYYY-MM-DD')} ${interval.startTime}`);\n const label = formatDate({\n date: intervalTime,\n locale: ctx.getLocale(locale),\n format: slotLabelFormat,\n });\n\n return (\n <Box\n {...getStyles('weekViewSlotLabel')}\n key={interval.startTime}\n mod={{\n 'hour-start': interval.isHourStart,\n ...getBusinessHoursMod({\n time: interval.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n }}\n >\n {label}\n </Box>\n );\n });\n\n const slotsRef: WeekViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n const allDaySlotsRef = useRef<HTMLButtonElement[]>([]);\n const weekdaysRef = useRef<HTMLButtonElement[]>([]);\n const daySlotsContainersRef = useRef<(HTMLDivElement | null)[]>([]);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n const firstSlotIndex = { dayIndex: 0, slotIndex: 0 };\n\n useIsomorphicEffect(() => {\n if (!startScrollTime || !viewportRef.current) {\n return;\n }\n\n const firstDaySlots = slotsRef.current[0];\n if (!firstDaySlots || firstDaySlots.length === 0) {\n return;\n }\n\n const targetIndex = slots.findIndex((s) => s.startTime >= startScrollTime);\n if (targetIndex < 0) {\n return;\n }\n\n const targetSlot = firstDaySlots[targetIndex];\n if (!targetSlot) {\n return;\n }\n\n const slotRect = targetSlot.getBoundingClientRect();\n const viewportRect = viewportRef.current.getBoundingClientRect();\n viewportRef.current.scrollTo({ left: 0, top: slotRect.top - viewportRect.top });\n }, []);\n\n const getSlotIndexFromDragPoint = useCallback((event: React.DragEvent, dayIndex: number) => {\n const daySlots = slotsRef.current[dayIndex] ?? [];\n const slotIndex = daySlots.findIndex((slotNode) => {\n if (!slotNode) {\n return false;\n }\n\n const rect = slotNode.getBoundingClientRect();\n return event.clientY >= rect.top && event.clientY <= rect.bottom;\n });\n\n if (slotIndex >= 0) {\n return slotIndex;\n }\n\n const firstSlot = daySlots[0];\n const lastSlot = daySlots[daySlots.length - 1];\n\n if (!firstSlot || !lastSlot) {\n return null;\n }\n\n const firstRect = firstSlot.getBoundingClientRect();\n const lastRect = lastSlot.getBoundingClientRect();\n\n if (event.clientY < firstRect.top) {\n return 0;\n }\n\n if (event.clientY > lastRect.bottom) {\n return daySlots.length - 1;\n }\n\n return null;\n }, []);\n\n const handleSlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => {\n handleWeekViewKeyDown({\n controlsRef: slotsRef,\n dayIndex,\n slotIndex,\n event,\n });\n };\n\n const handleAllDaySlotKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n allDaySlotsRef.current[dayIndex - 1]?.focus();\n } else if (direction === 'ArrowDown') {\n event.preventDefault();\n slotsRef.current?.[dayIndex]?.[0]?.focus();\n }\n };\n\n const handleWeekdayKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number\n ) => {\n const direction = event.key;\n if (direction === 'ArrowRight' && dayIndex < weekdays.length - 1) {\n event.preventDefault();\n weekdaysRef.current[dayIndex + 1]?.focus();\n } else if (direction === 'ArrowLeft' && dayIndex > 0) {\n event.preventDefault();\n weekdaysRef.current[dayIndex - 1]?.focus();\n }\n };\n\n const currentWeekdayIndex = withCurrentTimeIndicator\n ? forceCurrentTimeIndicator\n ? weekdays.findIndex((day) => dayjs(day).day() === dayjs().day())\n : weekdays.findIndex((day) => dayjs(day).isSame(dayjs(), 'date'))\n : -1;\n\n const weekdaysLabels = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n {...getStyles('weekViewDayLabel')}\n key={day}\n ref={(node) => {\n weekdaysRef.current[dayIndex] = node!;\n }}\n aria-label={`${getLabel('weekday', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n mod={{\n today: dayjs(day).isSame(dayjs(), 'day') && !!highlightToday,\n weekend: ctx.getWeekendDays(weekendDays).includes(dayjs(day).day() as DayOfWeek),\n static: mode === 'static',\n }}\n tabIndex={mode === 'static' ? -1 : dayIndex === 0 ? 0 : -1}\n onKeyDown={mode === 'static' ? undefined : (event) => handleWeekdayKeyDown(event, dayIndex)}\n onClick={\n mode === 'static'\n ? undefined\n : () => {\n onViewChange?.('day');\n onDateChange?.(toDateString(day));\n }\n }\n >\n <Box {...getStyles('weekViewDayWeekday')} key=\"weekday\">\n {formatDate({ locale: ctx.getLocale(locale), date: day, format: weekdayFormat })}\n </Box>\n <div {...getStyles('weekViewDayNumber')} key=\"date\">\n {dayjs(day).date()}\n </div>\n </UnstyledButton>\n ));\n\n const days = weekdays.map((day, dayIndex) => {\n const allBgEvents = weekEvents.backgroundEvents[day] || [];\n\n const backgroundEventNodes = allBgEvents\n .filter((event) => !event.position.allDay)\n .map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-${event.id}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: `${event.position.top}%`,\n height: `${event.position.height}%`,\n width: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const dayEvents = (weekEvents.regularEvents[day] || []).map((event) => {\n const eventIsAllDay = isAllDayEvent({ event, date: day });\n const isDraggable = !eventIsAllDay && dragDrop.isDraggableEvent(event);\n const isResizable = !eventIsAllDay && eventResize.isResizableEvent(event);\n const resizePosition = eventResize.getResizePosition(event.id);\n const eventTop = resizePosition ? resizePosition.top : event.position.top;\n const eventHeight = resizePosition ? resizePosition.height : event.position.height;\n\n return (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n hanging={event.position.hanging}\n draggable={isDraggable}\n withResize={isResizable}\n isResizing={resizePosition !== null}\n onResizeStart={\n isResizable\n ? (edge, e) => {\n const container = daySlotsContainersRef.current[dayIndex];\n if (container) {\n eventResize.handleResizeStart({\n event,\n edge,\n container,\n originalTop: event.position.top,\n originalHeight: event.position.height,\n eventDate: dayjs(day).format('YYYY-MM-DD'),\n pointerEvent: e,\n });\n }\n }\n : undefined\n }\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n style={{\n position: 'absolute',\n top: `calc(${eventTop}% + 1px)`,\n left: `${event.position.offset}%`,\n width: `${event.position.width}%`,\n height: `calc(${eventHeight}% - 1px)`,\n }}\n />\n );\n });\n\n return (\n <WeekViewDay\n key={day}\n day={day}\n dayIndex={dayIndex}\n slots={slots}\n getStyles={getStyles}\n weekendDays={weekendDays}\n highlightBusinessHours={highlightBusinessHours}\n businessHours={businessHours}\n labels={labels}\n withEventsDragAndDrop={withDragHandlers}\n mode={mode}\n slotsRef={slotsRef}\n firstSlotIndex={firstSlotIndex}\n onSlotKeyDown={handleSlotKeyDown}\n onSlotClick={handleTimeSlotClick}\n onFirstSlotArrowUp={\n withAllDaySlots\n ? (dayIdx) => {\n allDaySlotsRef.current[dayIdx]?.focus();\n }\n : undefined\n }\n onDaySlotsDragOver={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, { day: dayStr, slotIndex });\n }\n }}\n onDaySlotsDragLeave={dragDrop.handleDragLeave}\n onDaySlotsDrop={(event, dayStr, dayIdx) => {\n const slotIndex = getSlotIndexFromDragPoint(event, dayIdx);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, { day: dayStr, slotIndex });\n }\n }}\n dropTargetSlotIndex={\n dragDrop.dropTarget?.day === day ? dragDrop.dropTarget.slotIndex : undefined\n }\n withDragSlotSelect={withDragSlotSelect}\n onSlotPointerDown={slotDragSelect.handleSlotPointerDown}\n isSlotDragSelected={slotDragSelect.isSlotSelected}\n daySlotsContainerRef={(node) => {\n daySlotsContainersRef.current[dayIndex] = node;\n }}\n getTimeSlotProps={getTimeSlotProps}\n >\n {backgroundEventNodes}\n {dayEvents}\n </WeekViewDay>\n );\n });\n\n const allDaySlots = weekdays.map((day, dayIndex) => (\n <UnstyledButton\n aria-label={`${getLabel('allDay', labels)} ${dayjs(day).format('YYYY-MM-DD')}`}\n key={day}\n ref={(node) => {\n allDaySlotsRef.current[dayIndex] = node!;\n }}\n tabIndex={dayIndex === 0 ? 0 : -1}\n onKeyDown={(event) => handleAllDaySlotKeyDown(event, dayIndex)}\n onClick={\n mode === 'static' || !onAllDaySlotClick\n ? undefined\n : (e) => onAllDaySlotClick(dayjs(day).format('YYYY-MM-DD'), e)\n }\n onDragOver={withDragHandlers ? (e) => allDayDragDrop.handleDragOver(e, day) : undefined}\n onDragLeave={withDragHandlers ? allDayDragDrop.handleDragLeave : undefined}\n onDrop={withDragHandlers ? (e) => allDayDragDrop.handleDrop(e, day) : undefined}\n {...getStyles('weekViewDaySlot')}\n mod={{ 'drop-target': allDayDragDrop.isDropTarget(day) }}\n />\n ));\n\n const allDayEventIds = useMemo(\n () => new Set(weekEvents.allDayEvents.map((e) => e.id)),\n [weekEvents.allDayEvents]\n );\n\n const allDayEvents = weekEvents.allDayEvents.map((event) => (\n <ScheduleEvent\n key={event.id}\n event={event}\n autoSize\n nowrap\n hanging={event.position.hanging}\n draggable={allDayDragDrop.isDraggableEvent(event)}\n renderEvent={renderEvent}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{\n position: 'absolute',\n zIndex: 2,\n top: `calc(${event.position.row * 50}% + 1px)`,\n left: `calc(${event.position.offset}% + 1px)`,\n width: `calc(${event.position.width}% - 1px)`,\n height: 'calc(50% - 2px)',\n maxHeight: 'calc(50% - 2px)',\n }}\n />\n ));\n\n const allDayBackgroundEventNodes = weekdays.flatMap((day, dayIndex) => {\n const allDayBgEvents = (weekEvents.backgroundEvents[day] || []).filter(\n (event) => event.position.allDay\n );\n const dayWidth = 100 / weekdays.length;\n const dayOffset = dayIndex * dayWidth;\n\n return allDayBgEvents.map((event) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const bgEventBody =\n typeof renderEventBody === 'function' ? renderEventBody(event) : event.title;\n\n const bgEventProps = {\n key: `bg-allday-${event.id}-${day}`,\n ...getStyles('weekViewBackgroundEvent', {\n style: {\n top: 0,\n height: '100%',\n left: `${dayOffset}%`,\n width: `${dayWidth}%`,\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n });\n\n // Extra rows show on hover = total rows - 2 visible rows (starts from 0, so -1)\n const extraRows = Math.max(...weekEvents.allDayEvents.map((event) => event.position.row), 1) - 1;\n\n const content = (\n <Box\n {...getStyles('weekView')}\n mod={{ static: mode === 'static', 'slot-dragging': slotDragSelect.isDragging }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"week\"\n navigationHandlers={{\n previous: () => previousWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n next: () => nextWeek(date, ctx.getFirstDayOfWeek(firstDayOfWeek)),\n today: () => toDateString(dayjs()),\n }}\n control={{\n miw: 140,\n title: getWeekLabel({\n weekdays,\n locale: ctx.getLocale(locale),\n weekLabelFormat,\n renderWeekLabel,\n }),\n }}\n labels={labels}\n onDateChange={onDateChange}\n onViewChange={onViewChange}\n previousControlProps={previousControlProps}\n nextControlProps={nextControlProps}\n todayControlProps={todayControlProps}\n viewSelectProps={viewSelectProps}\n stylesApiProps={stylesApiProps}\n />\n )}\n\n <Box\n {...getStyles('weekViewRoot')}\n __vars={{\n '--indicator-offset-index':\n currentWeekdayIndex === -1 ? undefined : `${currentWeekdayIndex + 1}`,\n '--number-of-days': withWeekendDays\n ? '7'\n : `${7 - ctx.getWeekendDays(weekendDays).length}`,\n }}\n mod={{ 'with-weekends': withWeekendDays }}\n >\n <ScrollArea.Autosize\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('weekViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n onScrollPositionChange={(position) => {\n scrollAreaProps?.onScrollPositionChange?.(position);\n setScrolled(position.y !== 0);\n }}\n viewportRef={mergedViewportRef}\n >\n <Box {...getStyles('weekViewHeader')} mod={{ scrolled }}>\n <div {...getStyles('weekViewCorner')} key=\"corner\">\n {withWeekNumber && (\n <>\n <div {...getStyles('weekViewWeekLabel')}>{getLabel('week', labels)}</div>\n <div {...getStyles('weekViewWeekNumber')}>{getWeekNumber(date)}</div>\n </>\n )}\n </div>\n\n {weekdaysLabels}\n </Box>\n\n {withAllDaySlots && (\n <div {...getStyles('weekViewAllDaySlots')}>\n <div {...getStyles('weekViewAllDaySlotsLabel')}>{getLabel('allDay', labels)}</div>\n <div {...getStyles('weekViewAllDaySlotsList')}>\n {allDayBackgroundEventNodes}\n <Box\n {...getStyles('weekViewAllDaySlotsEvents')}\n __vars={{ '--extra-rows': `${extraRows}` }}\n >\n {allDayEvents}\n </Box>\n {allDaySlots}\n </div>\n </div>\n )}\n\n <div {...getStyles('weekViewInner')}>\n <div {...getStyles('weekViewSlotLabels')}>{timeValues}</div>\n\n {withCurrentTimeIndicator && currentWeekdayIndex !== -1 && (\n <CurrentTimeIndicator\n startOffset=\"calc(100% - (100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index) + 1) + ((var(--number-of-days) - var(--indicator-offset-index) + 1) * var(--indicator-labels-offset)))\"\n endOffset=\"calc((100% / var(--number-of-days)) * (var(--number-of-days) - var(--indicator-offset-index)) - (var(--number-of-days) - var(--indicator-offset-index)) * var(--indicator-labels-offset))\"\n timeBubbleStartOffset=\"calc(var(--week-view-slots-label-width) - var(--time-bubble-width))\"\n currentTimeFormat={slotLabelFormat}\n withTimeBubble={withCurrentTimeBubble}\n withThumb={withCurrentTimeBubble ? currentWeekdayIndex !== 0 : true}\n locale={locale}\n startTime={startTime}\n endTime={endTime}\n {...stylesApiProps}\n />\n )}\n {days}\n </div>\n </ScrollArea.Autosize>\n </Box>\n </Box>\n );\n\n const mergedDragContextValue = useMemo<DragContextValue>(\n () => ({\n isDragging:\n dragDrop.dragContextValue.isDragging || allDayDragDrop.dragContextValue.isDragging,\n draggedEventId:\n dragDrop.dragContextValue.draggedEventId ?? allDayDragDrop.dragContextValue.draggedEventId,\n draggedEvent:\n dragDrop.dragContextValue.draggedEvent ?? allDayDragDrop.dragContextValue.draggedEvent,\n dropTarget:\n dragDrop.dragContextValue.dropTarget ?? allDayDragDrop.dragContextValue.dropTarget,\n onDragStart: (event: ScheduleEventData) => {\n if (allDayEventIds.has(event.id)) {\n allDayDragDrop.handleDragStart(event);\n } else {\n dragDrop.handleDragStart(event);\n }\n },\n onDragEnd: () => {\n dragDrop.handleDragEnd();\n allDayDragDrop.handleDragEnd();\n },\n setDropTarget: dragDrop.dragContextValue.setDropTarget,\n }),\n [dragDrop.dragContextValue, allDayDragDrop.dragContextValue, allDayEventIds]\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={mergedDragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nWeekView.displayName = '@mantine/schedule/WeekView';\nWeekView.classes = classes;\nWeekView.varsResolver = varsResolver;\n\nexport namespace WeekView {\n export type Props = WeekViewProps;\n export type Factory = WeekViewFactory;\n export type StylesNames = WeekViewStylesNames;\n export type CssVariables = WeekViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgSA,MAAM,eAAe;CACnB,kBAAkB;CAClB,iBAAiB;CACjB,0BAA0B;CAC1B,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,iB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cAAc,eAAe,iBAAiB;EAC1E,cAAc,UAA6B;AACzC,OAAI,eAAe,IAAI,MAAM,GAAG,CAC9B,gBAAe,gBAAgB,MAAM;OAErC,UAAS,gBAAgB,MAAM;;EAGnC,iBAAiB;AACf,YAAS,eAAe;AACxB,kBAAe,eAAe;;EAEhC,eAAe,SAAS,iBAAiB;EAC1C,GACD;EAAC,SAAS;EAAkB,eAAe;EAAkB;EAAe,CAC7E;AAED,KAAI,sBACF,QAAO,oBAAC,YAAY,UAAb;EAAsB,OAAO;YAAyB;EAA+B,CAAA;AAG9F,QAAO;EACP;AAEF,SAAS,cAAc;AACvB,SAAS,UAAUA;AACnB,SAAS,eAAe"}
@@ -7,7 +7,9 @@ import { useDatesContext } from "@mantine/dates";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  //#region packages/@mantine/schedule/src/components/WeekView/WeekViewDay.tsx
9
9
  function WeekViewDay({ day, dayIndex, slots, getStyles, weekendDays, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onDaySlotsDragOver, onDaySlotsDragLeave, onDaySlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, onFirstSlotArrowUp, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, daySlotsContainerRef, getTimeSlotProps }) {
10
- const weekend = useDatesContext().getWeekendDays(weekendDays).includes(dayjs(day).day());
10
+ const ctx = useDatesContext();
11
+ const dayOfWeek = dayjs(day).day();
12
+ const weekend = ctx.getWeekendDays(weekendDays).includes(dayOfWeek);
11
13
  const today = dayjs(day).isSame(dayjs(), "day");
12
14
  const dayGroup = dayjs(day).format("YYYY-MM-DD");
13
15
  const items = slots.map((slot, slotIndex) => {
@@ -37,7 +39,8 @@ function WeekViewDay({ day, dayIndex, slots, getStyles, weekendDays, children, l
37
39
  ...getBusinessHoursMod({
38
40
  time: slot.startTime,
39
41
  businessHours,
40
- highlightBusinessHours
42
+ highlightBusinessHours,
43
+ dayOfWeek
41
44
  }),
42
45
  "drop-target": isDropTarget,
43
46
  "drag-selected": isDragSelected,
@@ -1 +1 @@
1
- {"version":3,"file":"WeekViewDay.mjs","names":[],"sources":["../../../src/components/WeekView/WeekViewDay.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';\nimport { DayTimeInterval, getBusinessHoursMod } from '../../utils';\nimport type { WeekViewControlsRef } from './handle-week-view-key-down';\nimport type { WeekViewFactory } from './WeekView';\n\nexport interface WeekViewDayProps {\n /** Date to display */\n day: Date | DateStringValue;\n\n /** Index of this day in the week */\n dayIndex: number;\n\n /** Slots intervals */\n slots: DayTimeInterval[];\n\n /** `useStyles` return value of `WeekView` */\n getStyles: GetStylesApi<WeekViewFactory>;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Events list */\n children?: React.ReactNode;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format */\n businessHours?: [string, string];\n\n /** If true, slots are drop targets for drag and drop */\n withEventsDragAndDrop?: boolean;\n\n /** Called when dragging over day slots container */\n onDaySlotsDragOver?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when dragging leaves day slots container */\n onDaySlotsDragLeave?: () => void;\n\n /** Called when dropping on day slots container */\n onDaySlotsDrop?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when slot is clicked */\n onSlotClick?: (day: string, slotTime: string, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Index of the slot that is currently a drop target */\n dropTargetSlotIndex?: number;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions */\n mode?: ScheduleMode;\n\n /** Ref for keyboard navigation */\n slotsRef?: WeekViewControlsRef;\n\n /** Index of the first focusable slot */\n firstSlotIndex?: { dayIndex: number; slotIndex: number };\n\n /** Keyboard event handler for slots */\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => void;\n\n /** Called when Arrow Up is pressed on the first slot, used to navigate to all-day slot */\n onFirstSlotArrowUp?: (dayIndex: number) => void;\n\n /** If set, enables drag-to-select time slot ranges */\n withDragSlotSelect?: boolean;\n\n /** Called when pointer down on a slot for drag selection */\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n\n /** Function to check if a slot is drag-selected */\n isSlotDragSelected?: (index: number, group: string) => boolean;\n\n /** Ref callback for the day slots container */\n daySlotsContainerRef?: (node: HTMLDivElement | null) => void;\n\n /** Function to get additional props for each time slot */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport function WeekViewDay({\n day,\n dayIndex,\n slots,\n getStyles,\n weekendDays,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onDaySlotsDragOver,\n onDaySlotsDragLeave,\n onDaySlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n onFirstSlotArrowUp,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n daySlotsContainerRef,\n getTimeSlotProps,\n}: WeekViewDayProps) {\n const ctx = useDatesContext();\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayjs(day).day() as DayOfWeek);\n const today = dayjs(day).isSame(dayjs(), 'day');\n\n const dayGroup = dayjs(day).format('YYYY-MM-DD');\n\n const items = slots.map((slot, slotIndex) => {\n const isDropTarget = dropTargetSlotIndex === slotIndex;\n const isFirstSlot =\n firstSlotIndex?.dayIndex === dayIndex && firstSlotIndex?.slotIndex === slotIndex;\n const isDragSelected = isSlotDragSelected?.(slotIndex, dayGroup) || false;\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onSlotClick?.(String(day), slot.startTime, e);\n externalOnClick?.(e);\n };\n\n return (\n <UnstyledButton\n key={slot.startTime}\n ref={(node) => {\n if (node && slotsRef?.current) {\n if (!slotsRef.current[dayIndex]) {\n slotsRef.current[dayIndex] = [];\n }\n slotsRef.current[dayIndex][slotIndex] = node;\n }\n }}\n {...getStyles('weekViewDaySlot')}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n aria-label={`${getLabel('timeSlot', labels)} ${dayGroup} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? slotIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={(e) => {\n if (slotIndex === 0 && e.key === 'ArrowUp' && onFirstSlotArrowUp) {\n e.preventDefault();\n onFirstSlotArrowUp(dayIndex);\n } else if (onSlotKeyDown) {\n onSlotKeyDown(e, dayIndex, slotIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, slotIndex, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n {...externalSlotProps}\n />\n );\n });\n\n return (\n <Box {...getStyles('weekViewDay')} mod={{ today, weekend }}>\n <Box\n ref={daySlotsContainerRef}\n mod={{ today }}\n {...getStyles('weekViewDaySlots')}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDragOver?.(e, String(day), dayIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onDaySlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDrop?.(e, String(day), dayIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;AAiGA,SAAgB,YAAY,EAC1B,KACA,UACA,OACA,WACA,aACA,UACA,QACA,wBACA,eACA,uBACA,oBACA,qBACA,gBACA,aACA,qBACA,MACA,UACA,gBACA,eACA,oBACA,oBACA,mBACA,oBACA,sBACA,oBACmB;CAEnB,MAAM,UADM,iBAAiB,CACT,eAAe,YAAY,CAAC,SAAS,MAAM,IAAI,CAAC,KAAK,CAAc;CACvF,MAAM,QAAQ,MAAM,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM;CAE/C,MAAM,WAAW,MAAM,IAAI,CAAC,OAAO,aAAa;CAEhD,MAAM,QAAQ,MAAM,KAAK,MAAM,cAAc;EAC3C,MAAM,eAAe,wBAAwB;EAC7C,MAAM,cACJ,gBAAgB,aAAa,YAAY,gBAAgB,cAAc;EACzE,MAAM,iBAAiB,qBAAqB,WAAW,SAAS,IAAI;EACpE,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK;EACtC,MAAM,UAAU,GAAG,SAAS,GAAG,KAAK;EACpC,MAAM,EAAE,SAAS,iBAAiB,GAAG,sBACnC,mBAAmB;GAAE,OAAO;GAAW,KAAK;GAAS,CAAC,IAAI,EAAE;EAE9D,MAAM,cACJ,SAAS,WACL,KAAA,KACC,MAA2C;AAC1C,iBAAc,OAAO,IAAI,E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AAsB,KAAA;GAChF,QACE,yBAAyB,SAAS,YAC7B,MAAM,iBAAiB,GAAG,OAAO,IAAI,EAAE,SAAS,GACjD,KAAA;aAbR,CAgBG,UACA,MACG;;EACF,CAAA"}
1
+ {"version":3,"file":"WeekViewDay.mjs","names":[],"sources":["../../../src/components/WeekView/WeekViewDay.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';\nimport { BusinessHoursValue, DayTimeInterval, getBusinessHoursMod } from '../../utils';\nimport type { WeekViewControlsRef } from './handle-week-view-key-down';\nimport type { WeekViewFactory } from './WeekView';\n\nexport interface WeekViewDayProps {\n /** Date to display */\n day: Date | DateStringValue;\n\n /** Index of this day in the week */\n dayIndex: number;\n\n /** Slots intervals */\n slots: DayTimeInterval[];\n\n /** `useStyles` return value of `WeekView` */\n getStyles: GetStylesApi<WeekViewFactory>;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Events list */\n children?: React.ReactNode;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format, or per-day record keyed by day of the week */\n businessHours?: BusinessHoursValue;\n\n /** If true, slots are drop targets for drag and drop */\n withEventsDragAndDrop?: boolean;\n\n /** Called when dragging over day slots container */\n onDaySlotsDragOver?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when dragging leaves day slots container */\n onDaySlotsDragLeave?: () => void;\n\n /** Called when dropping on day slots container */\n onDaySlotsDrop?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when slot is clicked */\n onSlotClick?: (day: string, slotTime: string, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Index of the slot that is currently a drop target */\n dropTargetSlotIndex?: number;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions */\n mode?: ScheduleMode;\n\n /** Ref for keyboard navigation */\n slotsRef?: WeekViewControlsRef;\n\n /** Index of the first focusable slot */\n firstSlotIndex?: { dayIndex: number; slotIndex: number };\n\n /** Keyboard event handler for slots */\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => void;\n\n /** Called when Arrow Up is pressed on the first slot, used to navigate to all-day slot */\n onFirstSlotArrowUp?: (dayIndex: number) => void;\n\n /** If set, enables drag-to-select time slot ranges */\n withDragSlotSelect?: boolean;\n\n /** Called when pointer down on a slot for drag selection */\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n\n /** Function to check if a slot is drag-selected */\n isSlotDragSelected?: (index: number, group: string) => boolean;\n\n /** Ref callback for the day slots container */\n daySlotsContainerRef?: (node: HTMLDivElement | null) => void;\n\n /** Function to get additional props for each time slot */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport function WeekViewDay({\n day,\n dayIndex,\n slots,\n getStyles,\n weekendDays,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onDaySlotsDragOver,\n onDaySlotsDragLeave,\n onDaySlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n onFirstSlotArrowUp,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n daySlotsContainerRef,\n getTimeSlotProps,\n}: WeekViewDayProps) {\n const ctx = useDatesContext();\n const dayOfWeek = dayjs(day).day() as DayOfWeek;\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayOfWeek);\n const today = dayjs(day).isSame(dayjs(), 'day');\n\n const dayGroup = dayjs(day).format('YYYY-MM-DD');\n\n const items = slots.map((slot, slotIndex) => {\n const isDropTarget = dropTargetSlotIndex === slotIndex;\n const isFirstSlot =\n firstSlotIndex?.dayIndex === dayIndex && firstSlotIndex?.slotIndex === slotIndex;\n const isDragSelected = isSlotDragSelected?.(slotIndex, dayGroup) || false;\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onSlotClick?.(String(day), slot.startTime, e);\n externalOnClick?.(e);\n };\n\n return (\n <UnstyledButton\n key={slot.startTime}\n ref={(node) => {\n if (node && slotsRef?.current) {\n if (!slotsRef.current[dayIndex]) {\n slotsRef.current[dayIndex] = [];\n }\n slotsRef.current[dayIndex][slotIndex] = node;\n }\n }}\n {...getStyles('weekViewDaySlot')}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n dayOfWeek,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n aria-label={`${getLabel('timeSlot', labels)} ${dayGroup} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? slotIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={(e) => {\n if (slotIndex === 0 && e.key === 'ArrowUp' && onFirstSlotArrowUp) {\n e.preventDefault();\n onFirstSlotArrowUp(dayIndex);\n } else if (onSlotKeyDown) {\n onSlotKeyDown(e, dayIndex, slotIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, slotIndex, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n {...externalSlotProps}\n />\n );\n });\n\n return (\n <Box {...getStyles('weekViewDay')} mod={{ today, weekend }}>\n <Box\n ref={daySlotsContainerRef}\n mod={{ today }}\n {...getStyles('weekViewDaySlots')}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDragOver?.(e, String(day), dayIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onDaySlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDrop?.(e, String(day), dayIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;;;AAiGA,SAAgB,YAAY,EAC1B,KACA,UACA,OACA,WACA,aACA,UACA,QACA,wBACA,eACA,uBACA,oBACA,qBACA,gBACA,aACA,qBACA,MACA,UACA,gBACA,eACA,oBACA,oBACA,mBACA,oBACA,sBACA,oBACmB;CACnB,MAAM,MAAM,iBAAiB;CAC7B,MAAM,YAAY,MAAM,IAAI,CAAC,KAAK;CAClC,MAAM,UAAU,IAAI,eAAe,YAAY,CAAC,SAAS,UAAU;CACnE,MAAM,QAAQ,MAAM,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM;CAE/C,MAAM,WAAW,MAAM,IAAI,CAAC,OAAO,aAAa;CAEhD,MAAM,QAAQ,MAAM,KAAK,MAAM,cAAc;EAC3C,MAAM,eAAe,wBAAwB;EAC7C,MAAM,cACJ,gBAAgB,aAAa,YAAY,gBAAgB,cAAc;EACzE,MAAM,iBAAiB,qBAAqB,WAAW,SAAS,IAAI;EACpE,MAAM,YAAY,GAAG,SAAS,GAAG,KAAK;EACtC,MAAM,UAAU,GAAG,SAAS,GAAG,KAAK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;GACE,KAAK;GACL,KAAK,EAAE,OAAO;GACd,GAAI,UAAU,mBAAmB;GACjC,YACE,yBAAyB,SAAS,YAC7B,MAAM,qBAAqB,GAAG,OAAO,IAAI,EAAE,SAAS,GACrD,KAAA;GAEN,aAAa,yBAAyB,SAAS,WAAW,sBAAsB,KAAA;GAChF,QACE,yBAAyB,SAAS,YAC7B,MAAM,iBAAiB,GAAG,OAAO,IAAI,EAAE,SAAS,GACjD,KAAA;aAbR,CAgBG,UACA,MACG;;EACF,CAAA"}
@@ -1,18 +1,35 @@
1
1
  "use client";
2
2
  //#region packages/@mantine/schedule/src/utils/get-business-hours-mod/get-business-hours-mod.ts
3
+ function isBusinessHoursRange(value) {
4
+ return Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "string";
5
+ }
3
6
  /**
4
7
  * Determines if a given time is within business hours and returns modifier object
5
8
  * @param time - Time string in HH:mm:ss format
6
- * @param businessHours - Tuple of [start, end] times in HH:mm:ss format
9
+ * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week
7
10
  * @param highlightBusinessHours - Whether to highlight business hours
11
+ * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours
8
12
  * @returns Modifier object for styling business/non-business hours
9
13
  */
10
- function getBusinessHoursMod({ time, businessHours, highlightBusinessHours }) {
14
+ function getBusinessHoursMod({ time, businessHours, highlightBusinessHours, dayOfWeek }) {
11
15
  if (!highlightBusinessHours || !businessHours) return {
12
16
  "business-hours": false,
13
17
  "non-business-hours": false
14
18
  };
15
- const [start, end] = businessHours;
19
+ let range;
20
+ if (isBusinessHoursRange(businessHours)) range = businessHours;
21
+ else {
22
+ if (dayOfWeek === void 0) return {
23
+ "business-hours": false,
24
+ "non-business-hours": false
25
+ };
26
+ range = businessHours[dayOfWeek] ?? null;
27
+ }
28
+ if (!range) return {
29
+ "business-hours": false,
30
+ "non-business-hours": true
31
+ };
32
+ const [start, end] = range;
16
33
  const isInBusinessHours = time >= start && time < end;
17
34
  return {
18
35
  "business-hours": isInBusinessHours,
@@ -1 +1 @@
1
- {"version":3,"file":"get-business-hours-mod.mjs","names":[],"sources":["../../../src/utils/get-business-hours-mod/get-business-hours-mod.ts"],"sourcesContent":["export interface GetBusinessHoursModInput {\n time: string;\n businessHours?: [string, string];\n highlightBusinessHours?: boolean;\n}\n\nexport interface BusinessHoursMod {\n 'business-hours': boolean;\n 'non-business-hours': boolean;\n}\n\n/**\n * Determines if a given time is within business hours and returns modifier object\n * @param time - Time string in HH:mm:ss format\n * @param businessHours - Tuple of [start, end] times in HH:mm:ss format\n * @param highlightBusinessHours - Whether to highlight business hours\n * @returns Modifier object for styling business/non-business hours\n */\nexport function getBusinessHoursMod({\n time,\n businessHours,\n highlightBusinessHours,\n}: GetBusinessHoursModInput): BusinessHoursMod {\n if (!highlightBusinessHours || !businessHours) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n\n const [start, end] = businessHours;\n const isInBusinessHours = time >= start && time < end;\n\n return {\n 'business-hours': isInBusinessHours,\n 'non-business-hours': !isInBusinessHours,\n };\n}\n"],"mappings":";;;;;;;;;AAkBA,SAAgB,oBAAoB,EAClC,MACA,eACA,0BAC6C;AAC7C,KAAI,CAAC,0BAA0B,CAAC,cAC9B,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,MAAM,CAAC,OAAO,OAAO;CACrB,MAAM,oBAAoB,QAAQ,SAAS,OAAO;AAElD,QAAO;EACL,kBAAkB;EAClB,sBAAsB,CAAC;EACxB"}
1
+ {"version":3,"file":"get-business-hours-mod.mjs","names":[],"sources":["../../../src/utils/get-business-hours-mod/get-business-hours-mod.ts"],"sourcesContent":["import { DayOfWeek } from '../../types';\n\n/** Business hours range in `HH:mm:ss` format */\nexport type BusinessHoursRange = [string, string];\n\n/** Per-day business hours map keyed by day of the week (0 – Sunday, 6 – Saturday). `null` marks a day as fully outside business hours. */\nexport type BusinessHoursPerDay = Partial<Record<DayOfWeek, BusinessHoursRange | null>>;\n\n/** Business hours value – tuple applies to every day, record configures business hours per day */\nexport type BusinessHoursValue = BusinessHoursRange | BusinessHoursPerDay;\n\nexport interface GetBusinessHoursModInput {\n time: string;\n businessHours?: BusinessHoursValue;\n highlightBusinessHours?: boolean;\n dayOfWeek?: DayOfWeek;\n}\n\nexport interface BusinessHoursMod {\n 'business-hours': boolean;\n 'non-business-hours': boolean;\n}\n\nfunction isBusinessHoursRange(value: BusinessHoursValue): value is BusinessHoursRange {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'string' &&\n typeof value[1] === 'string'\n );\n}\n\n/**\n * Determines if a given time is within business hours and returns modifier object\n * @param time - Time string in HH:mm:ss format\n * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week\n * @param highlightBusinessHours - Whether to highlight business hours\n * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours\n * @returns Modifier object for styling business/non-business hours\n */\nexport function getBusinessHoursMod({\n time,\n businessHours,\n highlightBusinessHours,\n dayOfWeek,\n}: GetBusinessHoursModInput): BusinessHoursMod {\n if (!highlightBusinessHours || !businessHours) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n\n let range: [string, string] | null;\n if (isBusinessHoursRange(businessHours)) {\n range = businessHours;\n } else {\n if (dayOfWeek === undefined) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n range = businessHours[dayOfWeek] ?? null;\n }\n\n if (!range) {\n return {\n 'business-hours': false,\n 'non-business-hours': true,\n };\n }\n\n const [start, end] = range;\n const isInBusinessHours = time >= start && time < end;\n\n return {\n 'business-hours': isInBusinessHours,\n 'non-business-hours': !isInBusinessHours,\n };\n}\n"],"mappings":";;AAuBA,SAAS,qBAAqB,OAAwD;AACpF,QACE,MAAM,QAAQ,MAAM,IACpB,MAAM,WAAW,KACjB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,OAAO;;;;;;;;;;AAYxB,SAAgB,oBAAoB,EAClC,MACA,eACA,wBACA,aAC6C;AAC7C,KAAI,CAAC,0BAA0B,CAAC,cAC9B,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,IAAI;AACJ,KAAI,qBAAqB,cAAc,CACrC,SAAQ;MACH;AACL,MAAI,cAAc,KAAA,EAChB,QAAO;GACL,kBAAkB;GAClB,sBAAsB;GACvB;AAEH,UAAQ,cAAc,cAAc;;AAGtC,KAAI,CAAC,MACH,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,MAAM,CAAC,OAAO,OAAO;CACrB,MAAM,oBAAoB,QAAQ,SAAS,OAAO;AAElD,QAAO;EACL,kBAAkB;EAClB,sBAAsB,CAAC;EACxB"}
@@ -1,6 +1,7 @@
1
1
  import { BoxProps, DataAttributes, ElementProps, Factory, MantineRadius, ScrollAreaAutosizeProps, StylesApiProps } from '@mantine/core';
2
2
  import { ScheduleLabelsOverride } from '../../labels';
3
3
  import { DateLabelFormat, DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleEventData, ScheduleMode, ScheduleViewLevel } from '../../types';
4
+ import { BusinessHoursValue } from '../../utils';
4
5
  import { CurrentTimeIndicatorStylesNames } from '../CurrentTimeIndicator/CurrentTimeIndicator';
5
6
  import { RenderEvent, RenderEventBody } from '../ScheduleEvent/ScheduleEvent';
6
7
  import { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';
@@ -73,8 +74,8 @@ export interface WeekViewProps extends BoxProps, StylesApiProps<WeekViewFactory>
73
74
  labels?: ScheduleLabelsOverride;
74
75
  /** If set to true, highlights business hours with white background @default false */
75
76
  highlightBusinessHours?: boolean;
76
- /** Business hours range in `HH:mm:ss` format @default ['09:00:00', '17:00:00'] */
77
- businessHours?: [string, string];
77
+ /** Business hours range in `HH:mm:ss` format shared across all days, or a per-day record keyed by day of the week (`0` – Sunday, `6` – Saturday) for day-specific ranges. Set a day to `null` to mark it as fully outside business hours. @default ['09:00:00', '17:00:00'] */
78
+ businessHours?: BusinessHoursValue;
78
79
  /** Function to customize event body, `event` object is passed as first argument */
79
80
  renderEventBody?: RenderEventBody;
80
81
  /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */
@@ -1,7 +1,7 @@
1
1
  import { GetStylesApi } from '@mantine/core';
2
2
  import { ScheduleLabelsOverride } from '../../labels';
3
3
  import { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';
4
- import { DayTimeInterval } from '../../utils';
4
+ import { BusinessHoursValue, DayTimeInterval } from '../../utils';
5
5
  import type { WeekViewControlsRef } from './handle-week-view-key-down';
6
6
  import type { WeekViewFactory } from './WeekView';
7
7
  export interface WeekViewDayProps {
@@ -21,8 +21,8 @@ export interface WeekViewDayProps {
21
21
  labels?: ScheduleLabelsOverride;
22
22
  /** If set to true, highlights business hours with white background */
23
23
  highlightBusinessHours?: boolean;
24
- /** Business hours range in `HH:mm:ss` format */
25
- businessHours?: [string, string];
24
+ /** Business hours range in `HH:mm:ss` format, or per-day record keyed by day of the week */
25
+ businessHours?: BusinessHoursValue;
26
26
  /** If true, slots are drop targets for drag and drop */
27
27
  withEventsDragAndDrop?: boolean;
28
28
  /** Called when dragging over day slots container */
@@ -1,7 +1,15 @@
1
+ import { DayOfWeek } from '../../types';
2
+ /** Business hours range in `HH:mm:ss` format */
3
+ export type BusinessHoursRange = [string, string];
4
+ /** Per-day business hours map keyed by day of the week (0 – Sunday, 6 – Saturday). `null` marks a day as fully outside business hours. */
5
+ export type BusinessHoursPerDay = Partial<Record<DayOfWeek, BusinessHoursRange | null>>;
6
+ /** Business hours value – tuple applies to every day, record configures business hours per day */
7
+ export type BusinessHoursValue = BusinessHoursRange | BusinessHoursPerDay;
1
8
  export interface GetBusinessHoursModInput {
2
9
  time: string;
3
- businessHours?: [string, string];
10
+ businessHours?: BusinessHoursValue;
4
11
  highlightBusinessHours?: boolean;
12
+ dayOfWeek?: DayOfWeek;
5
13
  }
6
14
  export interface BusinessHoursMod {
7
15
  'business-hours': boolean;
@@ -10,8 +18,9 @@ export interface BusinessHoursMod {
10
18
  /**
11
19
  * Determines if a given time is within business hours and returns modifier object
12
20
  * @param time - Time string in HH:mm:ss format
13
- * @param businessHours - Tuple of [start, end] times in HH:mm:ss format
21
+ * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week
14
22
  * @param highlightBusinessHours - Whether to highlight business hours
23
+ * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours
15
24
  * @returns Modifier object for styling business/non-business hours
16
25
  */
17
- export declare function getBusinessHoursMod({ time, businessHours, highlightBusinessHours, }: GetBusinessHoursModInput): BusinessHoursMod;
26
+ export declare function getBusinessHoursMod({ time, businessHours, highlightBusinessHours, dayOfWeek, }: GetBusinessHoursModInput): BusinessHoursMod;
@@ -38,4 +38,4 @@ export type { DayTimeInterval } from './get-day-time-intervals/get-day-time-inte
38
38
  export type { ParsedTime } from './parse-time-string/parse-time-string';
39
39
  export type { CalculateDropTimeInput, CalculateDropTimeResult, } from './calculate-drop-time/calculate-drop-time';
40
40
  export type { CalculateMonthDropDateInput, CalculateMonthDropDateResult, } from './calculate-month-drop-date/calculate-month-drop-date';
41
- export type { GetBusinessHoursModInput, BusinessHoursMod, } from './get-business-hours-mod/get-business-hours-mod';
41
+ export type { BusinessHoursMod, BusinessHoursPerDay, BusinessHoursRange, BusinessHoursValue, GetBusinessHoursModInput, } from './get-business-hours-mod/get-business-hours-mod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine/schedule",
3
- "version": "9.1.1",
3
+ "version": "9.2.0",
4
4
  "description": "Schedule Mantine component",
5
5
  "homepage": "https://mantine.dev/",
6
6
  "license": "MIT",
@@ -35,9 +35,9 @@
35
35
  "directory": "packages/@mantine/schedule"
36
36
  },
37
37
  "peerDependencies": {
38
- "@mantine/core": "9.1.1",
39
- "@mantine/dates": "9.1.1",
40
- "@mantine/hooks": "9.1.1",
38
+ "@mantine/core": "9.2.0",
39
+ "@mantine/dates": "9.2.0",
40
+ "@mantine/hooks": "9.2.0",
41
41
  "react": "^19.2.0",
42
42
  "react-dom": "^19.2.0"
43
43
  },