@mantine/schedule 9.0.0-alpha.7 → 9.0.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.
Files changed (28) hide show
  1. package/README.md +2 -2
  2. package/cjs/components/MobileMonthView/MobileMonthView.cjs +1 -10
  3. package/cjs/components/MobileMonthView/MobileMonthView.cjs.map +1 -1
  4. package/cjs/components/MobileMonthView/MobileMonthView.module.cjs +2 -1
  5. package/cjs/components/MobileMonthView/MobileMonthView.module.cjs.map +1 -1
  6. package/cjs/components/MonthView/MonthView.cjs +1 -1
  7. package/cjs/components/MonthView/MonthView.cjs.map +1 -1
  8. package/cjs/components/ScheduleHeader/HeaderControl/HeaderControl.cjs +2 -2
  9. package/cjs/components/ScheduleHeader/HeaderControl/HeaderControl.cjs.map +1 -1
  10. package/cjs/components/WeekView/WeekView.cjs +1 -1
  11. package/cjs/components/WeekView/WeekView.cjs.map +1 -1
  12. package/cjs/components/YearView/YearView.cjs +1 -1
  13. package/cjs/components/YearView/YearView.cjs.map +1 -1
  14. package/esm/components/MobileMonthView/MobileMonthView.mjs +1 -10
  15. package/esm/components/MobileMonthView/MobileMonthView.mjs.map +1 -1
  16. package/esm/components/MobileMonthView/MobileMonthView.module.mjs +2 -1
  17. package/esm/components/MobileMonthView/MobileMonthView.module.mjs.map +1 -1
  18. package/esm/components/MonthView/MonthView.mjs +1 -1
  19. package/esm/components/MonthView/MonthView.mjs.map +1 -1
  20. package/esm/components/ScheduleHeader/HeaderControl/HeaderControl.mjs +2 -2
  21. package/esm/components/ScheduleHeader/HeaderControl/HeaderControl.mjs.map +1 -1
  22. package/esm/components/WeekView/WeekView.mjs +1 -1
  23. package/esm/components/WeekView/WeekView.mjs.map +1 -1
  24. package/esm/components/YearView/YearView.mjs +1 -1
  25. package/esm/components/YearView/YearView.mjs.map +1 -1
  26. package/package.json +4 -4
  27. package/styles.css +12 -0
  28. package/styles.layer.css +12 -0
@@ -1 +1 @@
1
- {"version":3,"file":"MonthView.mjs","names":["classes"],"sources":["../../../src/components/MonthView/MonthView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n ScrollArea,\n ScrollAreaProps,\n StylesApiProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateMonthDropDate,\n expandRecurringEvents,\n getMonthDays,\n getMonthRange,\n getWeekdaysNames,\n getWeekNumber,\n isSameMonth,\n toDateString,\n} from '../../utils';\nimport { DragContext } from '../DragContext/DragContext';\nimport { MoreEvents, MoreEventsProps } from '../MoreEvents/MoreEvents';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { MonthYearSelectProps } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getMonthViewEvents } from './get-month-view-events/get-month-view-events';\nimport { handleMonthViewKeyDown, MonthViewControlsRef } from './handle-month-view-key-down';\nimport classes from './MonthView.module.css';\n\nexport type MonthViewStylesNames =\n | 'monthView'\n | 'monthViewScrollArea'\n | 'monthViewInner'\n | 'monthViewWeek'\n | 'monthViewDay'\n | 'monthViewDayLabel'\n | 'monthViewWeekNumber'\n | 'monthViewWeekday'\n | 'monthViewWeekdays'\n | 'monthViewWeekdaysCorner'\n | 'monthViewEvents'\n | 'monthViewBackgroundEvent'\n | CombinedScheduleHeaderStylesNames;\n\nexport type MonthViewCssVariables = {\n monthView: '--month-view-radius' | '--month-view-max-events';\n};\n\nexport interface MonthViewProps\n extends BoxProps, StylesApiProps<MonthViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Date to display, Date object or date string in `YYYY-MM-DD 00:00:00` 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 /** If set, week numbers are displayed in the first column @default false */\n withWeekNumbers?: boolean;\n\n /** If set, weekdays names are displayed in the first row @default true */\n withWeekDays?: boolean;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. By default, the first letter of the weekday. */\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 /** Props passed down to the week number button */\n getWeekNumberProps?: (weekStartDate: DateStringValue) => Record<string, any>;\n\n /** Props passed down to the day button */\n getDayProps?: (date: DateStringValue) => Record<string, any>;\n\n /** Called when day is clicked */\n onDayClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called with first day of the week when week number is clicked */\n onWeekNumberClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, always renders 6 weeks in the month view @default true */\n consistentWeeks?: boolean;\n\n /** If set, highlights the current day @default true */\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 /** If set, days from the previous and next months are displayed to fill the weeks @default true */\n withOutsideDays?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Props passed down to `MonthYearSelect` component in the header */\n monthYearSelectProps?: Partial<MonthYearSelectProps>;\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 /** Events to display */\n events?: ScheduleEventData[];\n\n /** Props passed down to `MoreEvents` component */\n moreEventsProps?: Partial<MoreEventsProps>;\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 on new date */\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 event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select day ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a day range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Props passed down to `ScrollArea` component */\n scrollAreaProps?: Partial<ScrollAreaProps> & DataAttributes;\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 /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Maximum number of events visible per day before \"+more\" indicator shows, value is clamped between 1 and 10 @default 2 */\n maxEventsPerDay?: number;\n}\n\nexport type MonthViewFactory = Factory<{\n props: MonthViewProps;\n ref: HTMLDivElement;\n stylesNames: MonthViewStylesNames;\n vars: MonthViewCssVariables;\n}>;\n\nconst varsResolver = createVarsResolver<MonthViewFactory>(\n (_theme, { radius, maxEventsPerDay }) => ({\n monthView: {\n '--month-view-radius': radius ? getRadius(radius) : undefined,\n '--month-view-max-events':\n maxEventsPerDay !== undefined ? `${Math.min(10, Math.max(1, maxEventsPerDay))}` : undefined,\n },\n })\n);\n\nconst defaultProps = {\n __staticSelector: 'MonthView',\n withWeekDays: true,\n consistentWeeks: true,\n highlightToday: true,\n withOutsideDays: true,\n withHeader: true,\n weekdayFormat: 'ddd',\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n mode: 'default',\n} satisfies Partial<MonthViewProps>;\n\nexport const MonthView = factory<MonthViewFactory>((_props) => {\n const props = useProps('MonthView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n mod,\n date,\n onDateChange,\n withWeekNumbers,\n withWeekDays,\n locale,\n weekdayFormat,\n firstDayOfWeek,\n weekendDays,\n __staticSelector,\n getDayProps,\n getWeekNumberProps,\n onDayClick,\n onWeekNumberClick,\n consistentWeeks,\n highlightToday,\n radius,\n withOutsideDays,\n withHeader,\n monthYearSelectProps,\n onViewChange,\n todayControlProps,\n nextControlProps,\n previousControlProps,\n viewSelectProps,\n events,\n moreEventsProps,\n renderEventBody,\n renderEvent,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n labels,\n mode,\n scrollAreaProps,\n onExternalEventDrop,\n recurrenceExpansionLimit,\n maxEventsPerDay: _maxEventsPerDay,\n ...others\n } = props;\n\n const maxEventsPerDay = Math.min(10, Math.max(1, _maxEventsPerDay ?? 2));\n\n const getStyles = useStyles<MonthViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'monthView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MonthViewFactory>({\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 ctx = useDatesContext();\n\n const range = getMonthRange({\n month: date,\n withOutsideDays,\n consistentWeeks,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(range.start).startOf('day').toDate(),\n rangeEnd: dayjs(range.end).endOf('day').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const monthEvents = getMonthViewEvents({\n date,\n events: expandedEvents,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n withOutsideDays,\n consistentWeeks,\n });\n\n const handleExternalDrop = 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<string>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (targetDay: string, draggedEvent: ScheduleEventData) => {\n return calculateMonthDropDate({\n draggedEvent,\n targetDay,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const flatDaysRef = useRef<string[]>([]);\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex) => {\n if (!onSlotDragEnd) {\n return;\n }\n const startDay = flatDaysRef.current[startIndex];\n const endDay = flatDaysRef.current[endIndex];\n if (startDay && endDay) {\n onSlotDragEnd(\n dayjs(startDay).startOf('day').format('YYYY-MM-DD HH:mm:ss'),\n dayjs(endDay).endOf('day').format('YYYY-MM-DD HH:mm:ss')\n );\n }\n },\n });\n\n const daysRef: MonthViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n\n const monthDays = getMonthDays({\n month: dayjs(date).format('YYYY-MM-DD 00:00:00'),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n consistentWeeks: consistentWeeks && withOutsideDays,\n });\n\n const firstDayIndex = (() => {\n for (let weekIndex = 0; weekIndex < monthDays.length; weekIndex++) {\n const week = monthDays[weekIndex];\n for (let dayIndex = 0; dayIndex < week.length; dayIndex++) {\n const day = week[dayIndex];\n const outside = !isSameMonth(date, day);\n if (!outside || withOutsideDays) {\n return { weekIndex, dayIndex };\n }\n }\n }\n return { weekIndex: 0, dayIndex: 0 };\n })();\n\n const weekdays = withWeekDays\n ? getWeekdaysNames({\n locale: ctx.getLocale(locale),\n format: weekdayFormat,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n }).map((day, index) => (\n <div {...getStyles('monthViewWeekday')} key={index}>\n {day}\n </div>\n ))\n : null;\n\n const monthGroup = 'month';\n flatDaysRef.current = monthDays.flat();\n\n const weeks = monthDays.map((week, weekIndex) => {\n if (!daysRef.current[weekIndex]) {\n daysRef.current[weekIndex] = [];\n }\n\n const days = week.map((day, dayIndex) => {\n const outside = !isSameMonth(date, day);\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayjs(day).day());\n const ariaLabel = dayjs(day)\n .locale(locale || ctx.locale)\n .format('MMMM D, YYYY');\n\n const dayProps = getDayProps?.(dayjs(day).format('YYYY-MM-DD')) || {};\n const today = dayjs(day).isSame(dayjs(), 'day') && highlightToday;\n\n if (outside && !withOutsideDays) {\n return (\n <div key={day} data-static {...getStyles('monthViewDay', { style: dayProps.style })} />\n );\n }\n\n const isFirstDay =\n weekIndex === firstDayIndex.weekIndex && dayIndex === firstDayIndex.dayIndex;\n\n const isDropTarget = dragDrop.isDropTarget(day);\n const flatIndex = weekIndex * 7 + dayIndex;\n const isDragSelected = slotDragSelect.isSlotSelected(flatIndex, monthGroup);\n\n return (\n <UnstyledButton\n aria-label={ariaLabel}\n {...dayProps}\n {...getStyles('monthViewDay', { className: dayProps.className, style: dayProps.style })}\n key={day}\n ref={(node) => {\n if (node) {\n if (!daysRef.current[weekIndex]) {\n daysRef.current[weekIndex] = [];\n }\n daysRef.current[weekIndex][dayIndex] = node;\n }\n }}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? flatIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? monthGroup : undefined}\n onClick={\n mode === 'static'\n ? undefined\n : (event) => {\n onDayClick?.(dayjs(day).format('YYYY-MM-DD'), event);\n dayProps.onClick?.(event);\n }\n }\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) =>\n slotDragSelect.handleSlotPointerDown(\n e as React.PointerEvent<HTMLButtonElement>,\n flatIndex,\n monthGroup\n )\n : undefined\n }\n onKeyDown={(event) => {\n handleMonthViewKeyDown({\n controlsRef: daysRef,\n weekIndex,\n dayIndex,\n event,\n });\n dayProps.onKeyDown?.(event);\n }}\n mod={[\n {\n outside,\n weekend,\n today,\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n },\n dayProps.mod,\n ]}\n data-outside={outside || undefined}\n tabIndex={mode === 'static' ? -1 : isFirstDay ? 0 : -1}\n onDragOver={withDragHandlers ? (e) => dragDrop.handleDragOver(e, day) : undefined}\n onDragLeave={withDragHandlers ? dragDrop.handleDragLeave : undefined}\n onDrop={withDragHandlers ? (e) => dragDrop.handleDrop(e, day) : undefined}\n >\n <span data-today={today || undefined} {...getStyles('monthViewDayLabel')}>\n {dayjs(day).format('D')}\n </span>\n </UnstyledButton>\n );\n });\n\n const weekNumberProps = getWeekNumberProps?.(dayjs(week[0]).format('YYYY-MM-DD')) || {};\n const weekNumber = getWeekNumber(week);\n\n const backgroundEventNodes = (monthEvents.backgroundByWeek[weekIndex] || []).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}-${weekIndex}`,\n ...getStyles('monthViewBackgroundEvent', {\n style: {\n left: `calc(${event.position.startOffset}% + 2px)`,\n width: `calc(${event.position.width}% - 3px)`,\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 return <Box {...bgEventProps} />;\n });\n\n const rowHeightPercent = 100 / maxEventsPerDay;\n\n const events = (monthEvents.groupedByWeek[weekIndex] || [])\n .filter((event) => event.position.row < maxEventsPerDay)\n .map((event) => {\n const isDraggable = dragDrop.isDraggableEvent(event);\n\n return (\n <ScheduleEvent\n key={event.id}\n event={event}\n nowrap\n autoSize\n hanging={event.position.hanging}\n draggable={isDraggable}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{\n position: 'absolute',\n top: `calc(${event.position.row * rowHeightPercent}% + 1px)`,\n left: `calc(${event.position.startOffset}% + 1px)`,\n width: `calc(${event.position.width}% - 2px)`,\n height: `calc(${rowHeightPercent}% - 2px)`,\n }}\n />\n );\n });\n\n const moreEventsNodes = week.map((day, dayIndex) => {\n const dayEvents = monthEvents.groupedByDay[day] || [];\n const hiddenEventsCount = Math.max(0, dayEvents.length - maxEventsPerDay);\n\n if (hiddenEventsCount <= 0) {\n return null;\n }\n\n // Calculate position based on day's position within the week (each day is 1/7 of the week)\n const dayStartOffset = (dayIndex / 7) * 100;\n const dayWidth = (1 / 7) * 100;\n\n return (\n <MoreEvents\n key={`more-${day}`}\n events={dayEvents}\n moreEventsCount={hiddenEventsCount}\n mode={mode}\n style={{\n position: 'absolute',\n top: `calc(100% - 2px)`,\n left: `calc(${dayStartOffset}% + 1px)`,\n width: `calc(${dayWidth}% - 1px)`,\n height: '22px',\n paddingInline: 4,\n }}\n {...moreEventsProps}\n />\n );\n });\n\n return (\n <div {...getStyles('monthViewWeek')} key={weekIndex}>\n {withWeekNumbers && (\n <UnstyledButton\n key={weekNumber}\n aria-label={`Week ${weekNumber}`}\n {...weekNumberProps}\n onClick={\n mode === 'static'\n ? undefined\n : (event) => {\n onViewChange?.('week');\n onDateChange?.(toDateString(week[0]));\n onWeekNumberClick?.(dayjs(week[0]).format('YYYY-MM-DD'), event);\n weekNumberProps.onClick?.(event);\n }\n }\n mod={{ static: mode === 'static' }}\n tabIndex={mode === 'static' ? -1 : 0}\n {...getStyles('monthViewWeekNumber', {\n className: weekNumberProps.className,\n style: weekNumberProps.style,\n })}\n >\n {weekNumber}\n </UnstyledButton>\n )}\n\n <div {...getStyles('monthViewEvents')} key=\"week-events\">\n {backgroundEventNodes}\n {events}\n {moreEventsNodes}\n </div>\n\n {days}\n </div>\n );\n });\n\n const content = (\n <Box\n mod={[\n {\n 'with-week-numbers': withWeekNumbers,\n 'with-weekdays': withWeekDays,\n static: mode === 'static',\n 'slot-dragging': slotDragSelect.isDragging,\n },\n mod,\n ]}\n {...getStyles('monthView')}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"month\"\n navigationHandlers={{\n previous: () => toDateString(dayjs(date).subtract(1, 'month').startOf('month')),\n next: () => toDateString(dayjs(date).add(1, 'month').startOf('month')),\n today: () => toDateString(dayjs()),\n }}\n control={{\n monthYearSelect: {\n locale,\n yearValue: dayjs(date).get('year'),\n monthValue: dayjs(date).get('month'),\n onYearChange: (year) =>\n onDateChange?.(toDateString(dayjs(date).set('year', year).startOf('month'))),\n onMonthChange: (month) =>\n onDateChange?.(toDateString(dayjs(date).set('month', month).startOf('month'))),\n ...monthYearSelectProps,\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 <ScrollArea\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('monthViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n >\n <div {...getStyles('monthViewInner')}>\n {weekdays && (\n <div {...getStyles('monthViewWeekdays')}>\n {withWeekNumbers && <div {...getStyles('monthViewWeekdaysCorner')} />}\n {weekdays}\n </div>\n )}\n\n {weeks}\n </div>\n </ScrollArea>\n </Box>\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={dragDrop.dragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nMonthView.displayName = '@mantine/schedule/MonthView';\nMonthView.classes = classes;\nMonthView.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsNA,MAAM,eAAe,oBAClB,QAAQ,EAAE,QAAQ,uBAAuB,EACxC,WAAW;CACT,uBAAuB,SAAS,UAAU,OAAO,GAAG,KAAA;CACpD,2BACE,oBAAoB,KAAA,IAAY,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,gBAAgB,CAAC,KAAK,KAAA;CACrF,EACF,EACF;AAED,MAAM,eAAe;CACnB,kBAAkB;CACl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D,SAAS,EACP,iBAAiB;IACf;IACA,WAAW,MAAM,KAAK,CAAC,IAAI,OAAO;IAClC,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ;IACpC,eAAe,SACb,eAAe,aAAa,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,QAAQ,QAAQ,CAAC,CAAC;IAC9E,gBAAgB,UACd,eAAe,aAAa,MAAM,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,QAAQ,QAAQ,CAAC,CAAC;IAChF,GAAG;IACJ,EACF;GACO;GACM;GACA;GACQ;GACJ;GACC;GACF;GACD;GAChB,CAAA,EAGJ,oBAAC,YAAD;GACE,eAAe;GACf,GAAI;GACJ,GAAI,UAAU,uBAAuB;IACnC,WAAW,iBAAiB;IAC5B,OAAO,iBAAiB;IACzB,CAAC;aAEF,qBAAC,OAAD;IAAK,GAAI,UAAU,iBAAiB;cAApC,CACG,YACC,qBAAC,OAAD;KAAK,GAAI,UAAU,oBAAoB;eAAvC,CACG,mBAAmB,oBAAC,OAAD,EAAK,GAAI,UAAU,0BAA0B,EAAI,CAAA,EACpE,SACG;QAGP,MACG;;GACK,CAAA,CACT;;AAGR,KAAI,sBACF,QAAO,oBAAC,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,UAAU,cAAc;AACxB,UAAU,UAAUA;AACpB,UAAU,eAAe"}
1
+ {"version":3,"file":"MonthView.mjs","names":["classes"],"sources":["../../../src/components/MonthView/MonthView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useCallback, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n ScrollArea,\n ScrollAreaProps,\n StylesApiProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useDragDropHandlers } from '../../hooks/use-drag-drop-handlers';\nimport { useSlotDragSelect } from '../../hooks/use-slot-drag-select';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n DateLabelFormat,\n DateStringValue,\n DateTimeStringValue,\n DayOfWeek,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateMonthDropDate,\n expandRecurringEvents,\n getMonthDays,\n getMonthRange,\n getWeekdaysNames,\n getWeekNumber,\n isSameMonth,\n toDateString,\n} from '../../utils';\nimport { DragContext } from '../DragContext/DragContext';\nimport { MoreEvents, MoreEventsProps } from '../MoreEvents/MoreEvents';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport { MonthYearSelectProps } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getMonthViewEvents } from './get-month-view-events/get-month-view-events';\nimport { handleMonthViewKeyDown, MonthViewControlsRef } from './handle-month-view-key-down';\nimport classes from './MonthView.module.css';\n\nexport type MonthViewStylesNames =\n | 'monthView'\n | 'monthViewScrollArea'\n | 'monthViewInner'\n | 'monthViewWeek'\n | 'monthViewDay'\n | 'monthViewDayLabel'\n | 'monthViewWeekNumber'\n | 'monthViewWeekday'\n | 'monthViewWeekdays'\n | 'monthViewWeekdaysCorner'\n | 'monthViewEvents'\n | 'monthViewBackgroundEvent'\n | CombinedScheduleHeaderStylesNames;\n\nexport type MonthViewCssVariables = {\n monthView: '--month-view-radius' | '--month-view-max-events';\n};\n\nexport interface MonthViewProps\n extends BoxProps, StylesApiProps<MonthViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Date to display, Date object or date string in `YYYY-MM-DD 00:00:00` 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 /** If set, week numbers are displayed in the first column @default false */\n withWeekNumbers?: boolean;\n\n /** If set, weekdays names are displayed in the first row @default true */\n withWeekDays?: boolean;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */\n firstDayOfWeek?: DayOfWeek;\n\n /** `dayjs` format for weekdays names. By default, the first letter of the weekday. */\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 /** Props passed down to the week number button */\n getWeekNumberProps?: (weekStartDate: DateStringValue) => Record<string, any>;\n\n /** Props passed down to the day button */\n getDayProps?: (date: DateStringValue) => Record<string, any>;\n\n /** Called when day is clicked */\n onDayClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called with first day of the week when week number is clicked */\n onWeekNumberClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, always renders 6 weeks in the month view @default true */\n consistentWeeks?: boolean;\n\n /** If set, highlights the current day @default true */\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 /** If set, days from the previous and next months are displayed to fill the weeks @default true */\n withOutsideDays?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Props passed down to `MonthYearSelect` component in the header */\n monthYearSelectProps?: Partial<MonthYearSelectProps>;\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 /** Events to display */\n events?: ScheduleEventData[];\n\n /** Props passed down to `MoreEvents` component */\n moreEventsProps?: Partial<MoreEventsProps>;\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 on new date */\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 event is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select day ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a day range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Props passed down to `ScrollArea` component */\n scrollAreaProps?: Partial<ScrollAreaProps> & DataAttributes;\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 /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Maximum number of events visible per day before \"+more\" indicator shows, value is clamped between 1 and 10 @default 2 */\n maxEventsPerDay?: number;\n}\n\nexport type MonthViewFactory = Factory<{\n props: MonthViewProps;\n ref: HTMLDivElement;\n stylesNames: MonthViewStylesNames;\n vars: MonthViewCssVariables;\n}>;\n\nconst varsResolver = createVarsResolver<MonthViewFactory>(\n (_theme, { radius, maxEventsPerDay }) => ({\n monthView: {\n '--month-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--month-view-max-events':\n maxEventsPerDay !== undefined ? `${Math.min(10, Math.max(1, maxEventsPerDay))}` : undefined,\n },\n })\n);\n\nconst defaultProps = {\n __staticSelector: 'MonthView',\n withWeekDays: true,\n consistentWeeks: true,\n highlightToday: true,\n withOutsideDays: true,\n withHeader: true,\n weekdayFormat: 'ddd',\n withEventsDragAndDrop: false,\n withDragSlotSelect: false,\n mode: 'default',\n} satisfies Partial<MonthViewProps>;\n\nexport const MonthView = factory<MonthViewFactory>((_props) => {\n const props = useProps('MonthView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n mod,\n date,\n onDateChange,\n withWeekNumbers,\n withWeekDays,\n locale,\n weekdayFormat,\n firstDayOfWeek,\n weekendDays,\n __staticSelector,\n getDayProps,\n getWeekNumberProps,\n onDayClick,\n onWeekNumberClick,\n consistentWeeks,\n highlightToday,\n radius,\n withOutsideDays,\n withHeader,\n monthYearSelectProps,\n onViewChange,\n todayControlProps,\n nextControlProps,\n previousControlProps,\n viewSelectProps,\n events,\n moreEventsProps,\n renderEventBody,\n renderEvent,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n labels,\n mode,\n scrollAreaProps,\n onExternalEventDrop,\n recurrenceExpansionLimit,\n maxEventsPerDay: _maxEventsPerDay,\n ...others\n } = props;\n\n const maxEventsPerDay = Math.min(10, Math.max(1, _maxEventsPerDay ?? 2));\n\n const getStyles = useStyles<MonthViewFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'monthView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MonthViewFactory>({\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 ctx = useDatesContext();\n\n const range = getMonthRange({\n month: date,\n withOutsideDays,\n consistentWeeks,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(range.start).startOf('day').toDate(),\n rangeEnd: dayjs(range.end).endOf('day').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const monthEvents = getMonthViewEvents({\n date,\n events: expandedEvents,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n withOutsideDays,\n consistentWeeks,\n });\n\n const handleExternalDrop = 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<string>({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (targetDay: string, draggedEvent: ScheduleEventData) => {\n return calculateMonthDropDate({\n draggedEvent,\n targetDay,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\n });\n\n const withDragHandlers = (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static';\n\n const flatDaysRef = useRef<string[]>([]);\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex) => {\n if (!onSlotDragEnd) {\n return;\n }\n const startDay = flatDaysRef.current[startIndex];\n const endDay = flatDaysRef.current[endIndex];\n if (startDay && endDay) {\n onSlotDragEnd(\n dayjs(startDay).startOf('day').format('YYYY-MM-DD HH:mm:ss'),\n dayjs(endDay).endOf('day').format('YYYY-MM-DD HH:mm:ss')\n );\n }\n },\n });\n\n const daysRef: MonthViewControlsRef = useRef<HTMLButtonElement[][]>([]);\n\n const monthDays = getMonthDays({\n month: dayjs(date).format('YYYY-MM-DD 00:00:00'),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n consistentWeeks: consistentWeeks && withOutsideDays,\n });\n\n const firstDayIndex = (() => {\n for (let weekIndex = 0; weekIndex < monthDays.length; weekIndex++) {\n const week = monthDays[weekIndex];\n for (let dayIndex = 0; dayIndex < week.length; dayIndex++) {\n const day = week[dayIndex];\n const outside = !isSameMonth(date, day);\n if (!outside || withOutsideDays) {\n return { weekIndex, dayIndex };\n }\n }\n }\n return { weekIndex: 0, dayIndex: 0 };\n })();\n\n const weekdays = withWeekDays\n ? getWeekdaysNames({\n locale: ctx.getLocale(locale),\n format: weekdayFormat,\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n }).map((day, index) => (\n <div {...getStyles('monthViewWeekday')} key={index}>\n {day}\n </div>\n ))\n : null;\n\n const monthGroup = 'month';\n flatDaysRef.current = monthDays.flat();\n\n const weeks = monthDays.map((week, weekIndex) => {\n if (!daysRef.current[weekIndex]) {\n daysRef.current[weekIndex] = [];\n }\n\n const days = week.map((day, dayIndex) => {\n const outside = !isSameMonth(date, day);\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayjs(day).day());\n const ariaLabel = dayjs(day)\n .locale(locale || ctx.locale)\n .format('MMMM D, YYYY');\n\n const dayProps = getDayProps?.(dayjs(day).format('YYYY-MM-DD')) || {};\n const today = dayjs(day).isSame(dayjs(), 'day') && highlightToday;\n\n if (outside && !withOutsideDays) {\n return (\n <div key={day} data-static {...getStyles('monthViewDay', { style: dayProps.style })} />\n );\n }\n\n const isFirstDay =\n weekIndex === firstDayIndex.weekIndex && dayIndex === firstDayIndex.dayIndex;\n\n const isDropTarget = dragDrop.isDropTarget(day);\n const flatIndex = weekIndex * 7 + dayIndex;\n const isDragSelected = slotDragSelect.isSlotSelected(flatIndex, monthGroup);\n\n return (\n <UnstyledButton\n aria-label={ariaLabel}\n {...dayProps}\n {...getStyles('monthViewDay', { className: dayProps.className, style: dayProps.style })}\n key={day}\n ref={(node) => {\n if (node) {\n if (!daysRef.current[weekIndex]) {\n daysRef.current[weekIndex] = [];\n }\n daysRef.current[weekIndex][dayIndex] = node;\n }\n }}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? flatIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? monthGroup : undefined}\n onClick={\n mode === 'static'\n ? undefined\n : (event) => {\n onDayClick?.(dayjs(day).format('YYYY-MM-DD'), event);\n dayProps.onClick?.(event);\n }\n }\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) =>\n slotDragSelect.handleSlotPointerDown(\n e as React.PointerEvent<HTMLButtonElement>,\n flatIndex,\n monthGroup\n )\n : undefined\n }\n onKeyDown={(event) => {\n handleMonthViewKeyDown({\n controlsRef: daysRef,\n weekIndex,\n dayIndex,\n event,\n });\n dayProps.onKeyDown?.(event);\n }}\n mod={[\n {\n outside,\n weekend,\n today,\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n },\n dayProps.mod,\n ]}\n data-outside={outside || undefined}\n tabIndex={mode === 'static' ? -1 : isFirstDay ? 0 : -1}\n onDragOver={withDragHandlers ? (e) => dragDrop.handleDragOver(e, day) : undefined}\n onDragLeave={withDragHandlers ? dragDrop.handleDragLeave : undefined}\n onDrop={withDragHandlers ? (e) => dragDrop.handleDrop(e, day) : undefined}\n >\n <span data-today={today || undefined} {...getStyles('monthViewDayLabel')}>\n {dayjs(day).format('D')}\n </span>\n </UnstyledButton>\n );\n });\n\n const weekNumberProps = getWeekNumberProps?.(dayjs(week[0]).format('YYYY-MM-DD')) || {};\n const weekNumber = getWeekNumber(week);\n\n const backgroundEventNodes = (monthEvents.backgroundByWeek[weekIndex] || []).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}-${weekIndex}`,\n ...getStyles('monthViewBackgroundEvent', {\n style: {\n left: `calc(${event.position.startOffset}% + 2px)`,\n width: `calc(${event.position.width}% - 3px)`,\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 return <Box {...bgEventProps} />;\n });\n\n const rowHeightPercent = 100 / maxEventsPerDay;\n\n const events = (monthEvents.groupedByWeek[weekIndex] || [])\n .filter((event) => event.position.row < maxEventsPerDay)\n .map((event) => {\n const isDraggable = dragDrop.isDraggableEvent(event);\n\n return (\n <ScheduleEvent\n key={event.id}\n event={event}\n nowrap\n autoSize\n hanging={event.position.hanging}\n draggable={isDraggable}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n radius={radius}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n style={{\n position: 'absolute',\n top: `calc(${event.position.row * rowHeightPercent}% + 1px)`,\n left: `calc(${event.position.startOffset}% + 1px)`,\n width: `calc(${event.position.width}% - 2px)`,\n height: `calc(${rowHeightPercent}% - 2px)`,\n }}\n />\n );\n });\n\n const moreEventsNodes = week.map((day, dayIndex) => {\n const dayEvents = monthEvents.groupedByDay[day] || [];\n const hiddenEventsCount = Math.max(0, dayEvents.length - maxEventsPerDay);\n\n if (hiddenEventsCount <= 0) {\n return null;\n }\n\n // Calculate position based on day's position within the week (each day is 1/7 of the week)\n const dayStartOffset = (dayIndex / 7) * 100;\n const dayWidth = (1 / 7) * 100;\n\n return (\n <MoreEvents\n key={`more-${day}`}\n events={dayEvents}\n moreEventsCount={hiddenEventsCount}\n mode={mode}\n style={{\n position: 'absolute',\n top: `calc(100% - 2px)`,\n left: `calc(${dayStartOffset}% + 1px)`,\n width: `calc(${dayWidth}% - 1px)`,\n height: '22px',\n paddingInline: 4,\n }}\n {...moreEventsProps}\n />\n );\n });\n\n return (\n <div {...getStyles('monthViewWeek')} key={weekIndex}>\n {withWeekNumbers && (\n <UnstyledButton\n key={weekNumber}\n aria-label={`Week ${weekNumber}`}\n {...weekNumberProps}\n onClick={\n mode === 'static'\n ? undefined\n : (event) => {\n onViewChange?.('week');\n onDateChange?.(toDateString(week[0]));\n onWeekNumberClick?.(dayjs(week[0]).format('YYYY-MM-DD'), event);\n weekNumberProps.onClick?.(event);\n }\n }\n mod={{ static: mode === 'static' }}\n tabIndex={mode === 'static' ? -1 : 0}\n {...getStyles('monthViewWeekNumber', {\n className: weekNumberProps.className,\n style: weekNumberProps.style,\n })}\n >\n {weekNumber}\n </UnstyledButton>\n )}\n\n <div {...getStyles('monthViewEvents')} key=\"week-events\">\n {backgroundEventNodes}\n {events}\n {moreEventsNodes}\n </div>\n\n {days}\n </div>\n );\n });\n\n const content = (\n <Box\n mod={[\n {\n 'with-week-numbers': withWeekNumbers,\n 'with-weekdays': withWeekDays,\n static: mode === 'static',\n 'slot-dragging': slotDragSelect.isDragging,\n },\n mod,\n ]}\n {...getStyles('monthView')}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"month\"\n navigationHandlers={{\n previous: () => toDateString(dayjs(date).subtract(1, 'month').startOf('month')),\n next: () => toDateString(dayjs(date).add(1, 'month').startOf('month')),\n today: () => toDateString(dayjs()),\n }}\n control={{\n monthYearSelect: {\n locale,\n yearValue: dayjs(date).get('year'),\n monthValue: dayjs(date).get('month'),\n onYearChange: (year) =>\n onDateChange?.(toDateString(dayjs(date).set('year', year).startOf('month'))),\n onMonthChange: (month) =>\n onDateChange?.(toDateString(dayjs(date).set('month', month).startOf('month'))),\n ...monthYearSelectProps,\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 <ScrollArea\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('monthViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n >\n <div {...getStyles('monthViewInner')}>\n {weekdays && (\n <div {...getStyles('monthViewWeekdays')}>\n {withWeekNumbers && <div {...getStyles('monthViewWeekdaysCorner')} />}\n {weekdays}\n </div>\n )}\n\n {weeks}\n </div>\n </ScrollArea>\n </Box>\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={dragDrop.dragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nMonthView.displayName = '@mantine/schedule/MonthView';\nMonthView.classes = classes;\nMonthView.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsNA,MAAM,eAAe,oBAClB,QAAQ,EAAE,QAAQ,uBAAuB,EACxC,WAAW;CACT,uBAAuB,WAAW,KAAA,IAAY,UAAU,OAAO,GAAG,KAAA;CAClE,2BACE,oBAAoB,KAAA,IAAY,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,gBAAgB,CAAC,KAAK,KAAA;CACrF,EACF,EACF;AAED,MAAM,eAAe;CACnB,kBAAkB;CAClB,cAAc;CACd,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,YAAY;CACZ,eAAe;CACf,uBAAuB;CACvB,oBAAoB;CACpB,MAAM;CACP;AAED,MAAa,YAAY,SAA2B,WAAW;CAC7D,MAAM,QAAQ,SAAS,aAAa,cAAc,OAAO;CACzD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,YACA,MACA,KACA,MACA,cACA,iBACA,cACA,QACA,eACA,gBACA,aACA,kBACA,aACA,oBACA,YACA,mBACA,i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G;IACJ,EACF;GACO;GACM;GACA;GACQ;GACJ;GACC;GACF;GACD;GAChB,CAAA,EAGJ,oBAAC,YAAD;GACE,eAAe;GACf,GAAI;GACJ,GAAI,UAAU,uBAAuB;IACnC,WAAW,iBAAiB;IAC5B,OAAO,iBAAiB;IACzB,CAAC;aAEF,qBAAC,OAAD;IAAK,GAAI,UAAU,iBAAiB;cAApC,CACG,YACC,qBAAC,OAAD;KAAK,GAAI,UAAU,oBAAoB;eAAvC,CACG,mBAAmB,oBAAC,OAAD,EAAK,GAAI,UAAU,0BAA0B,EAAI,CAAA,EACpE,SACG;QAGP,MACG;;GACK,CAAA,CACT;;AAGR,KAAI,sBACF,QAAO,oBAAC,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,UAAU,cAAc;AACxB,UAAU,UAAUA;AACpB,UAAU,eAAe"}
@@ -46,7 +46,7 @@ function ScheduleHeaderNext(props) {
46
46
  "aria-label": getLabel("next", props.labels),
47
47
  square: true,
48
48
  ...props,
49
- children: /* @__PURE__ */ jsx(AccordionChevron, { transform: `rotate(${dir === "rtl" ? 90 : -90} 0 0)` })
49
+ children: /* @__PURE__ */ jsx(AccordionChevron, { style: { transform: `rotate(${dir === "rtl" ? 90 : -90}deg)` } })
50
50
  });
51
51
  }
52
52
  function ScheduleHeaderPrevious(props) {
@@ -56,7 +56,7 @@ function ScheduleHeaderPrevious(props) {
56
56
  "aria-label": getLabel("previous", props.labels),
57
57
  square: true,
58
58
  ...props,
59
- children: /* @__PURE__ */ jsx(AccordionChevron, { transform: `rotate(${dir === "rtl" ? -90 : 90} 0 0)` })
59
+ children: /* @__PURE__ */ jsx(AccordionChevron, { style: { transform: `rotate(${dir === "rtl" ? -90 : 90}deg)` } })
60
60
  });
61
61
  }
62
62
  function ScheduleHeaderToday(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderControl.mjs","names":["classes"],"sources":["../../../../src/components/ScheduleHeader/HeaderControl/HeaderControl.tsx"],"sourcesContent":["import {\n AccordionChevron,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useDirection,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport classes from './HeaderControl.module.css';\n\nexport type HeaderControlStylesNames = 'headerControl';\nexport type HeaderControlCssVariables = {\n headerControl: '--control-radius';\n};\n\nexport interface HeaderControlProps\n extends BoxProps, StylesApiProps<HeaderControlFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Applies active styles */\n active?: boolean;\n\n /** Removes inline padding */\n square?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set to `false`, the control will not be clickable */\n interactive?: boolean;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type HeaderControlFactory = Factory<{\n props: HeaderControlProps;\n ref: HTMLButtonElement;\n stylesNames: HeaderControlStylesNames;\n vars: HeaderControlCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'HeaderControl',\n interactive: true,\n} satisfies Partial<HeaderControlProps>;\n\nconst varsResolver = createVarsResolver<HeaderControlFactory>((_theme, { radius }) => ({\n headerControl: {\n '--control-radius': radius === undefined ? undefined : getRadius(radius),\n },\n}));\n\nexport const HeaderControl = factory<HeaderControlFactory>((_props) => {\n const props = useProps('HeaderControl', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n __staticSelector,\n mod,\n attributes,\n active,\n square,\n radius,\n interactive,\n ...others\n } = props;\n\n const getStyles = useStyles<HeaderControlFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'headerControl',\n });\n\n return (\n <UnstyledButton\n {...getStyles('headerControl', { active: interactive })}\n mod={[{ active, square, interactive }, mod]}\n tabIndex={interactive ? undefined : -1}\n {...others}\n />\n );\n});\n\nHeaderControl.displayName = '@mantine/schedule/HeaderControl';\nHeaderControl.classes = classes;\nHeaderControl.varsResolver = varsResolver;\n\nexport function ScheduleHeaderNext(props: HeaderControlProps) {\n const { dir } = useDirection();\n\n return (\n <HeaderControl data-type=\"next\" aria-label={getLabel('next', props.labels)} square {...props}>\n <AccordionChevron transform={`rotate(${dir === 'rtl' ? 90 : -90} 0 0)`} />\n </HeaderControl>\n );\n}\n\nexport function ScheduleHeaderPrevious(props: HeaderControlProps) {\n const { dir } = useDirection();\n\n return (\n <HeaderControl\n data-type=\"previous\"\n aria-label={getLabel('previous', props.labels)}\n square\n {...props}\n >\n <AccordionChevron transform={`rotate(${dir === 'rtl' ? -90 : 90} 0 0)`} />\n </HeaderControl>\n );\n}\n\nexport function ScheduleHeaderToday(props: HeaderControlProps) {\n return (\n <HeaderControl data-type=\"today\" aria-label={getLabel('today', props.labels)} {...props}>\n {getLabel('today', props.labels)}\n </HeaderControl>\n );\n}\n\nScheduleHeaderNext.displayName = '@mantine/schedule/ScheduleHeaderNext';\nScheduleHeaderPrevious.displayName = '@mantine/schedule/ScheduleHeaderPrevious';\nScheduleHeaderToday.displayName = '@mantine/schedule/ScheduleHeaderToday';\n"],"mappings":";;;;;;AAkDA,MAAM,eAAe;CACnB,kBAAkB;CAClB,aAAa;CACd;AAED,MAAM,eAAe,oBAA0C,QAAQ,EAAE,cAAc,EACrF,eAAe,EACb,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,OAAO,EACzE,EACF,EAAE;AAEH,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,OAAO;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,kBACA,KACA,YACA,QACA,QACA,QACA,aACA,GAAG,WACD;AAiBJ,QACE,oBAAC,gBAAD;EACE,GAjBc,UAAgC;GAChD,MAAM;GACN,SAAA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,cAAc;GACf,CAAC,CAIgB,iBAAiB,EAAE,QAAQ,aAAa,CAAC;EACvD,KAAK,CAAC;GAAE;GAAQ;GAAQ;GAAa,EAAE,IAAI;EAC3C,UAAU,cAAc,KAAA,IAAY;EACpC,GAAI;EACJ,CAAA;EAEJ;AAEF,cAAc,cAAc;AAC5B,cAAc,UAAUA;AACxB,cAAc,eAAe;AAE7B,SAAgB,mBAAmB,OAA2B;CAC5D,MAAM,EAAE,QAAQ,cAAc;AAE9B,QACE,oBAAC,eAAD;EAAe,aAAU;EAAO,cAAY,SAAS,QAAQ,MAAM,OAAO;EAAE,QAAA;EAAO,GAAI;YACrF,oBAAC,kBAAD,EAAkB,WAAW,UAAU,QAAQ,QAAQ,KAAK,IAAI,QAAU,CAAA;EAC5D,CAAA;;AAIpB,SAAgB,uBAAuB,OAA2B;CAChE,MAAM,EAAE,QAAQ,cAAc;AAE9B,QACE,oBAAC,eAAD;EACE,aAAU;EACV,cAAY,SAAS,YAAY,MAAM,OAAO;EAC9C,QAAA;EACA,GAAI;YAEJ,oBAAC,kBAAD,EAAkB,WAAW,UAAU,QAAQ,QAAQ,MAAM,GAAG,QAAU,CAAA;EAC5D,CAAA;;AAIpB,SAAgB,oBAAoB,OAA2B;AAC7D,QACE,oBAAC,eAAD;EAAe,aAAU;EAAQ,cAAY,SAAS,SAAS,MAAM,OAAO;EAAE,GAAI;YAC/E,SAAS,SAAS,MAAM,OAAO;EAClB,CAAA;;AAIpB,mBAAmB,cAAc;AACjC,uBAAuB,cAAc;AACrC,oBAAoB,cAAc"}
1
+ {"version":3,"file":"HeaderControl.mjs","names":["classes"],"sources":["../../../../src/components/ScheduleHeader/HeaderControl/HeaderControl.tsx"],"sourcesContent":["import {\n AccordionChevron,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useDirection,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport classes from './HeaderControl.module.css';\n\nexport type HeaderControlStylesNames = 'headerControl';\nexport type HeaderControlCssVariables = {\n headerControl: '--control-radius';\n};\n\nexport interface HeaderControlProps\n extends BoxProps, StylesApiProps<HeaderControlFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Applies active styles */\n active?: boolean;\n\n /** Removes inline padding */\n square?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set to `false`, the control will not be clickable */\n interactive?: boolean;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type HeaderControlFactory = Factory<{\n props: HeaderControlProps;\n ref: HTMLButtonElement;\n stylesNames: HeaderControlStylesNames;\n vars: HeaderControlCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'HeaderControl',\n interactive: true,\n} satisfies Partial<HeaderControlProps>;\n\nconst varsResolver = createVarsResolver<HeaderControlFactory>((_theme, { radius }) => ({\n headerControl: {\n '--control-radius': radius === undefined ? undefined : getRadius(radius),\n },\n}));\n\nexport const HeaderControl = factory<HeaderControlFactory>((_props) => {\n const props = useProps('HeaderControl', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n __staticSelector,\n mod,\n attributes,\n active,\n square,\n radius,\n interactive,\n ...others\n } = props;\n\n const getStyles = useStyles<HeaderControlFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'headerControl',\n });\n\n return (\n <UnstyledButton\n {...getStyles('headerControl', { active: interactive })}\n mod={[{ active, square, interactive }, mod]}\n tabIndex={interactive ? undefined : -1}\n {...others}\n />\n );\n});\n\nHeaderControl.displayName = '@mantine/schedule/HeaderControl';\nHeaderControl.classes = classes;\nHeaderControl.varsResolver = varsResolver;\n\nexport function ScheduleHeaderNext(props: HeaderControlProps) {\n const { dir } = useDirection();\n\n return (\n <HeaderControl data-type=\"next\" aria-label={getLabel('next', props.labels)} square {...props}>\n <AccordionChevron style={{ transform: `rotate(${dir === 'rtl' ? 90 : -90}deg)` }} />\n </HeaderControl>\n );\n}\n\nexport function ScheduleHeaderPrevious(props: HeaderControlProps) {\n const { dir } = useDirection();\n\n return (\n <HeaderControl\n data-type=\"previous\"\n aria-label={getLabel('previous', props.labels)}\n square\n {...props}\n >\n <AccordionChevron style={{ transform: `rotate(${dir === 'rtl' ? -90 : 90}deg)` }} />\n </HeaderControl>\n );\n}\n\nexport function ScheduleHeaderToday(props: HeaderControlProps) {\n return (\n <HeaderControl data-type=\"today\" aria-label={getLabel('today', props.labels)} {...props}>\n {getLabel('today', props.labels)}\n </HeaderControl>\n );\n}\n\nScheduleHeaderNext.displayName = '@mantine/schedule/ScheduleHeaderNext';\nScheduleHeaderPrevious.displayName = '@mantine/schedule/ScheduleHeaderPrevious';\nScheduleHeaderToday.displayName = '@mantine/schedule/ScheduleHeaderToday';\n"],"mappings":";;;;;;AAkDA,MAAM,eAAe;CACnB,kBAAkB;CAClB,aAAa;CACd;AAED,MAAM,eAAe,oBAA0C,QAAQ,EAAE,cAAc,EACrF,eAAe,EACb,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,OAAO,EACzE,EACF,EAAE;AAEH,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,OAAO;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,kBACA,KACA,YACA,QACA,QACA,QACA,aACA,GAAG,WACD;AAiBJ,QACE,oBAAC,gBAAD;EACE,GAjBc,UAAgC;GAChD,MAAM;GACN,SAAA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,cAAc;GACf,CAAC,CAIgB,iBAAiB,EAAE,QAAQ,aAAa,CAAC;EACvD,KAAK,CAAC;GAAE;GAAQ;GAAQ;GAAa,EAAE,IAAI;EAC3C,UAAU,cAAc,KAAA,IAAY;EACpC,GAAI;EACJ,CAAA;EAEJ;AAEF,cAAc,cAAc;AAC5B,cAAc,UAAUA;AACxB,cAAc,eAAe;AAE7B,SAAgB,mBAAmB,OAA2B;CAC5D,MAAM,EAAE,QAAQ,cAAc;AAE9B,QACE,oBAAC,eAAD;EAAe,aAAU;EAAO,cAAY,SAAS,QAAQ,MAAM,OAAO;EAAE,QAAA;EAAO,GAAI;YACrF,oBAAC,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,KAAK,IAAI,OAAO,EAAI,CAAA;EACtE,CAAA;;AAIpB,SAAgB,uBAAuB,OAA2B;CAChE,MAAM,EAAE,QAAQ,cAAc;AAE9B,QACE,oBAAC,eAAD;EACE,aAAU;EACV,cAAY,SAAS,YAAY,MAAM,OAAO;EAC9C,QAAA;EACA,GAAI;YAEJ,oBAAC,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,MAAM,GAAG,OAAO,EAAI,CAAA;EACtE,CAAA;;AAIpB,SAAgB,oBAAoB,OAA2B;AAC7D,QACE,oBAAC,eAAD;EAAe,aAAU;EAAQ,cAAY,SAAS,SAAS,MAAM,OAAO;EAAE,GAAI;YAC/E,SAAS,SAAS,MAAM,OAAO;EAClB,CAAA;;AAIpB,mBAAmB,cAAc;AACjC,uBAAuB,cAAc;AACrC,oBAAoB,cAAc"}
@@ -53,7 +53,7 @@ const defaultProps = {
53
53
  mode: "default"
54
54
  };
55
55
  const varsResolver = createVarsResolver((_theme, { radius, allDaySlotHeight, slotHeight }) => ({ weekView: {
56
- "--week-view-radius": radius ? getRadius(radius) : void 0,
56
+ "--week-view-radius": radius !== void 0 ? getRadius(radius) : void 0,
57
57
  "--week-view-all-day-slots-height": rem(allDaySlotHeight),
58
58
  "--week-view-slot-height": rem(slotHeight)
59
59
  } }));
@@ -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 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 ? 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 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 ? 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 return <Box {...bgEventProps} />;\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={onEventClick ? (e) => onEventClick(event, e) : undefined}\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 return <Box {...bgEventProps} />;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4RA,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,SAAS,UAAU,OAAO,GAAG,KAAA;CACnD,oCAAoC,IAAI,iBAAiB;CACzD,2BAA2B,IAAI,WAAW;CAC3C,EACF,EACF;AAED,MAAa,WAAW,SAA0B,WAAW;CAC3D,MAAM,QAAQ,SAAS,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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OAE3D,4BAA4B,wBAAwB,MACnD,oBAAC,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,yBAAyB,eACtB;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,oBAAC,YAAY,UAAb;EAAsB,OAAO;YAAyB;EAA+B,CAAA;AAG9F,QAAO;EACP;AAEF,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 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 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 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 ? 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 return <Box {...bgEventProps} />;\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={onEventClick ? (e) => onEventClick(event, e) : undefined}\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 return <Box {...bgEventProps} />;\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4RA,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,WAAW;CAC3C,EACF,EACF;AAED,MAAa,WAAW,SAA0B,WAAW;CAC3D,MAAM,QAAQ,SAAS,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,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,YAAY,UAA2B;EAC3C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACf,CAAC;CAEF,M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B,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,oBAAC,YAAY,UAAb;EAAsB,OAAO;YAAyB;EAA+B,CAAA;AAG9F,QAAO;EACP;AAEF,SAAS,cAAc;AACvB,SAAS,UAAUA;AACnB,SAAS,eAAe"}
@@ -24,7 +24,7 @@ const defaultProps = {
24
24
  withOutsideDays: true,
25
25
  mode: "default"
26
26
  };
27
- const varsResolver = createVarsResolver((_theme, { radius }) => ({ yearView: { "--year-view-radius": radius ? getRadius(radius) : void 0 } }));
27
+ const varsResolver = createVarsResolver((_theme, { radius }) => ({ yearView: { "--year-view-radius": radius !== void 0 ? getRadius(radius) : void 0 } }));
28
28
  const YearView = factory((_props) => {
29
29
  const props = useProps("YearView", defaultProps, _props);
30
30
  const { date, onDateChange, events, monthLabelFormat, withWeekNumbers, withWeekDays, locale, firstDayOfWeek, weekdayFormat, weekendDays, onMonthClick, onDayClick, onWeekNumberClick, getDayProps, getWeekNumberProps, highlightToday, labels, withOutsideDays, withHeader, monthYearSelectProps, onViewChange, previousControlProps, nextControlProps, todayControlProps, viewSelectProps, __staticSelector, classNames, className, style, styles, unstyled, vars, attributes, radius, mode, recurrenceExpansionLimit, ...others } = props;
@@ -1 +1 @@
1
- {"version":3,"file":"YearView.mjs","names":["classes"],"sources":["../../../src/components/YearView/YearView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { DateStringValue, ScheduleEventData, ScheduleMode, ScheduleViewLevel } from '../../types';\nimport {\n expandRecurringEvents,\n getMonthDays,\n getMonthsByQuarter,\n isSameMonth,\n toDateString,\n} from '../../utils';\nimport { MonthYearSelectProps } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getYearViewEvents } from './get-year-view-events/get-year-view-events';\nimport { handleYearViewKeyDown, YearViewControlsRef } from './handle-year-view-key-down';\nimport { YearViewMonth, YearViewMonthSettings } from './YearViewMonth';\nimport classes from './YearView.module.css';\n\nexport type YearViewStylesNames =\n | 'yearView'\n | 'yearViewMonths'\n | 'yearViewMonth'\n | 'yearViewWeekday'\n | 'yearViewDay'\n | 'yearViewWeek'\n | 'yearViewWeekNumber'\n | 'yearViewWeekdays'\n | 'yearViewWeekdaysCorner'\n | 'yearViewMonthCaption'\n | 'yearViewDayIndicators'\n | 'yearViewDayIndicator'\n | CombinedScheduleHeaderStylesNames;\n\nexport type YearViewCssVariables = {\n yearView: '--year-view-radius';\n};\n\nexport interface YearViewProps\n extends YearViewMonthSettings, BoxProps, StylesApiProps<YearViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Date to display, Date object or date string in `YYYY-MM-DD 00:00:00` 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 /** Events to display, must be a stable reference */\n events?: ScheduleEventData[];\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set, highlights the current day @default true */\n highlightToday?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Props passed down to `MonthYearSelect` component in the header */\n monthYearSelectProps?: Partial<MonthYearSelectProps>;\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 /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n}\n\nexport type YearViewFactory = Factory<{\n props: YearViewProps;\n ref: HTMLDivElement;\n stylesNames: YearViewStylesNames;\n vars: YearViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'YearView',\n monthLabelFormat: 'MMMM',\n withWeekDays: true,\n highlightToday: true,\n withHeader: true,\n withOutsideDays: true,\n mode: 'default',\n} satisfies Partial<YearViewProps>;\n\nconst varsResolver = createVarsResolver<YearViewFactory>((_theme, { radius }) => ({\n yearView: { '--year-view-radius': radius ? getRadius(radius) : undefined },\n}));\n\nexport const YearView = factory<YearViewFactory>((_props) => {\n const props = useProps('YearView', defaultProps, _props);\n const {\n // YearView props\n date,\n onDateChange,\n events,\n\n // YearViewMonth settings\n monthLabelFormat,\n withWeekNumbers,\n withWeekDays,\n locale,\n firstDayOfWeek,\n weekdayFormat,\n weekendDays,\n onMonthClick,\n onDayClick,\n onWeekNumberClick,\n getDayProps,\n getWeekNumberProps,\n highlightToday,\n labels,\n withOutsideDays,\n\n // ScheduleHeader props\n withHeader,\n monthYearSelectProps,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n\n // System props\n __staticSelector,\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n radius,\n mode,\n recurrenceExpansionLimit,\n ...others\n } = props;\n\n const ctx = useDatesContext();\n\n const getStyles = useStyles<YearViewFactory>({\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: 'yearView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<YearViewFactory>({\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 expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(date).startOf('year').toDate(),\n rangeEnd: dayjs(date).endOf('year').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const groupedEvents = getYearViewEvents({ date, events: expandedEvents });\n\n // [monthIndex][weekIndex][dayIndex]\n const daysRef = useRef<HTMLButtonElement[][][]>([]) as YearViewControlsRef;\n\n const getFirstDayIndex = (month: string): { weekIndex: number; dayIndex: number } | undefined => {\n const weeks = getMonthDays({\n month: dayjs(month).format('YYYY-MM-DD'),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n consistentWeeks: true,\n });\n\n for (let weekIndex = 0; weekIndex < weeks.length; weekIndex++) {\n const week = weeks[weekIndex];\n for (let dayIndex = 0; dayIndex < week.length; dayIndex++) {\n const dayDate = week[dayIndex];\n if (isSameMonth(dayDate, month)) {\n return { weekIndex, dayIndex };\n }\n }\n }\n\n return undefined;\n };\n\n let globalMonthIndex = 0;\n const months = getMonthsByQuarter(dayjs(date).format('YYYY-MM-DD'))\n .flat()\n .map((month) => {\n const currentMonthIndex = globalMonthIndex;\n globalMonthIndex++;\n\n return (\n <YearViewMonth\n key={month}\n month={month}\n getStyles={getStyles}\n monthLabelFormat={monthLabelFormat}\n withWeekNumbers={withWeekNumbers}\n withWeekDays={withWeekDays}\n locale={locale}\n firstDayOfWeek={firstDayOfWeek}\n weekdayFormat={\n weekdayFormat ||\n ((date) => dayjs(date).locale(ctx.getLocale(locale)).format('dd').slice(0, 1))\n }\n weekendDays={weekendDays}\n getDayProps={getDayProps}\n getWeekNumberProps={getWeekNumberProps}\n onMonthClick={onMonthClick}\n onDayClick={onDayClick}\n onWeekNumberClick={onWeekNumberClick}\n highlightToday={highlightToday}\n groupedEvents={groupedEvents}\n mode={mode}\n withOutsideDays={withOutsideDays}\n firstDayIndex={getFirstDayIndex(month)}\n __getDayRef={(weekIndex, dayIndex, node) => {\n if (!Array.isArray(daysRef.current[currentMonthIndex])) {\n daysRef.current[currentMonthIndex] = [];\n }\n if (!Array.isArray(daysRef.current[currentMonthIndex][weekIndex])) {\n daysRef.current[currentMonthIndex][weekIndex] = [];\n }\n daysRef.current[currentMonthIndex][weekIndex][dayIndex] = node;\n }}\n __onDayKeyDown={(event, payload) => {\n handleYearViewKeyDown({\n controlsRef: daysRef,\n monthIndex: currentMonthIndex,\n weekIndex: payload.weekIndex,\n dayIndex: payload.dayIndex,\n event,\n });\n }}\n />\n );\n });\n\n return (\n <Box {...getStyles('yearView')} mod={{ static: mode === 'static' }} {...others}>\n {withHeader && (\n <ScheduleHeaderBase\n view=\"year\"\n navigationHandlers={{\n previous: () => toDateString(dayjs(date).subtract(1, 'year').startOf('year')),\n next: () => toDateString(dayjs(date).add(1, 'year').startOf('year')),\n today: () => toDateString(dayjs()),\n }}\n control={{\n monthYearSelect: {\n locale,\n withMonths: false,\n yearValue: dayjs(date).get('year'),\n monthValue: dayjs(date).get('month'),\n onYearChange: (year) =>\n onDateChange?.(toDateString(dayjs(date).set('year', year).startOf('year'))),\n ...monthYearSelectProps,\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 <div {...getStyles('yearViewMonths')}>{months}</div>\n </Box>\n );\n});\n\nYearView.displayName = '@mantine/schedule/YearView';\nYearView.classes = classes;\nYearView.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;AA4GA,MAAM,eAAe;CACnB,kBAAkB;CAClB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,MAAM;CACP;AAED,MAAM,eAAe,oBAAqC,QAAQ,EAAE,cAAc,EAChF,UAAU,EAAE,sBAAsB,SAAS,UAAU,OAAO,GAAG,KAAA,GAAW,EAC3E,EAAE;AAEH,MAAa,WAAW,SAA0B,WAAW;CAC3D,MAAM,QAAQ,SAAS,YAAY,cAAc,OAAO;CACxD,MAAM,EAEJ,MACA,cACA,QAGA,kBACA,iBACA,cACA,QACA,gBACA,eACA,aACA,cACA,YACA,mBACA,aACA,oBACA,gBACA,QACA,iBAGA,YACA,sBACA,cACA,sBACA,kBACA,mBACA,iBAGA,kBACA,YACA,WACA,OACA,QACA,UACA,MACA,YACA,QACA,MACA,0BACA,GAAG,WACD;CAEJ,MAAM,MAAM,iBAAiB;CAE7B,MAAM,YAAY,UAA2B;EAC3C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACf,CAAC;CAEF,MAAM,EAAE,oBAAoB,mBAAmB,qBAAsC;EACnF;EACA;EACA;EACD,CAAC;CAEF,MAAM,iBAAiB;EACrB,YAAY;EACZ,QAAQ;EACR;EACA;EACA;EACD;CASD,MAAM,gBAAgB,kBAAkB;EAAE;EAAM,QAPzB,sBAAsB;GAC3C;GACA,YAAY,MAAM,KAAK,CAAC,QAAQ,OAAO,CAAC,QAAQ;GAChD,UAAU,MAAM,KAAK,CAAC,MAAM,OAAO,CAAC,QAAQ;GAC5C,gBAAgB;GACjB,CAAC;EAEsE,CAAC;CAGzE,MAAM,UAAU,OAAgC,EAAE,CAAC;CAEnD,MAAM,oBAAoB,UAAuE;EAC/F,MA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AAU;EAAE,GAAI;YAAxE,CACG,cACC,oBAAC,oBAAD;GACE,MAAK;GACL,oBAAoB;IAClB,gBAAgB,aAAa,MAAM,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,OAAO,CAAC;IAC7E,YAAY,aAAa,MAAM,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,QAAQ,OAAO,CAAC;IACpE,aAAa,aAAa,OAAO,CAAC;IACnC;GACD,SAAS,EACP,iBAAiB;IACf;IACA,YAAY;IACZ,WAAW,MAAM,KAAK,CAAC,IAAI,OAAO;IAClC,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ;IACpC,eAAe,SACb,eAAe,aAAa,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC;IAC7E,GAAG;IACJ,EACF;GACO;GACM;GACA;GACQ;GACJ;GACC;GACF;GACD;GAChB,CAAA,EAGJ,oBAAC,OAAD;GAAK,GAAI,UAAU,iBAAiB;aAAG;GAAa,CAAA,CAChD;;EAER;AAEF,SAAS,cAAc;AACvB,SAAS,UAAUA;AACnB,SAAS,eAAe"}
1
+ {"version":3,"file":"YearView.mjs","names":["classes"],"sources":["../../../src/components/YearView/YearView.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { DateStringValue, ScheduleEventData, ScheduleMode, ScheduleViewLevel } from '../../types';\nimport {\n expandRecurringEvents,\n getMonthDays,\n getMonthsByQuarter,\n isSameMonth,\n toDateString,\n} from '../../utils';\nimport { MonthYearSelectProps } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getYearViewEvents } from './get-year-view-events/get-year-view-events';\nimport { handleYearViewKeyDown, YearViewControlsRef } from './handle-year-view-key-down';\nimport { YearViewMonth, YearViewMonthSettings } from './YearViewMonth';\nimport classes from './YearView.module.css';\n\nexport type YearViewStylesNames =\n | 'yearView'\n | 'yearViewMonths'\n | 'yearViewMonth'\n | 'yearViewWeekday'\n | 'yearViewDay'\n | 'yearViewWeek'\n | 'yearViewWeekNumber'\n | 'yearViewWeekdays'\n | 'yearViewWeekdaysCorner'\n | 'yearViewMonthCaption'\n | 'yearViewDayIndicators'\n | 'yearViewDayIndicator'\n | CombinedScheduleHeaderStylesNames;\n\nexport type YearViewCssVariables = {\n yearView: '--year-view-radius';\n};\n\nexport interface YearViewProps\n extends YearViewMonthSettings, BoxProps, StylesApiProps<YearViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Date to display, Date object or date string in `YYYY-MM-DD 00:00:00` 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 /** Events to display, must be a stable reference */\n events?: ScheduleEventData[];\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set, highlights the current day @default true */\n highlightToday?: boolean;\n\n /** If set, the header is displayed @default true */\n withHeader?: boolean;\n\n /** Props passed down to `MonthYearSelect` component in the header */\n monthYearSelectProps?: Partial<MonthYearSelectProps>;\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 /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n}\n\nexport type YearViewFactory = Factory<{\n props: YearViewProps;\n ref: HTMLDivElement;\n stylesNames: YearViewStylesNames;\n vars: YearViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'YearView',\n monthLabelFormat: 'MMMM',\n withWeekDays: true,\n highlightToday: true,\n withHeader: true,\n withOutsideDays: true,\n mode: 'default',\n} satisfies Partial<YearViewProps>;\n\nconst varsResolver = createVarsResolver<YearViewFactory>((_theme, { radius }) => ({\n yearView: { '--year-view-radius': radius !== undefined ? getRadius(radius) : undefined },\n}));\n\nexport const YearView = factory<YearViewFactory>((_props) => {\n const props = useProps('YearView', defaultProps, _props);\n const {\n // YearView props\n date,\n onDateChange,\n events,\n\n // YearViewMonth settings\n monthLabelFormat,\n withWeekNumbers,\n withWeekDays,\n locale,\n firstDayOfWeek,\n weekdayFormat,\n weekendDays,\n onMonthClick,\n onDayClick,\n onWeekNumberClick,\n getDayProps,\n getWeekNumberProps,\n highlightToday,\n labels,\n withOutsideDays,\n\n // ScheduleHeader props\n withHeader,\n monthYearSelectProps,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n\n // System props\n __staticSelector,\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n radius,\n mode,\n recurrenceExpansionLimit,\n ...others\n } = props;\n\n const ctx = useDatesContext();\n\n const getStyles = useStyles<YearViewFactory>({\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: 'yearView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<YearViewFactory>({\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 expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(date).startOf('year').toDate(),\n rangeEnd: dayjs(date).endOf('year').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const groupedEvents = getYearViewEvents({ date, events: expandedEvents });\n\n // [monthIndex][weekIndex][dayIndex]\n const daysRef = useRef<HTMLButtonElement[][][]>([]) as YearViewControlsRef;\n\n const getFirstDayIndex = (month: string): { weekIndex: number; dayIndex: number } | undefined => {\n const weeks = getMonthDays({\n month: dayjs(month).format('YYYY-MM-DD'),\n firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek),\n consistentWeeks: true,\n });\n\n for (let weekIndex = 0; weekIndex < weeks.length; weekIndex++) {\n const week = weeks[weekIndex];\n for (let dayIndex = 0; dayIndex < week.length; dayIndex++) {\n const dayDate = week[dayIndex];\n if (isSameMonth(dayDate, month)) {\n return { weekIndex, dayIndex };\n }\n }\n }\n\n return undefined;\n };\n\n let globalMonthIndex = 0;\n const months = getMonthsByQuarter(dayjs(date).format('YYYY-MM-DD'))\n .flat()\n .map((month) => {\n const currentMonthIndex = globalMonthIndex;\n globalMonthIndex++;\n\n return (\n <YearViewMonth\n key={month}\n month={month}\n getStyles={getStyles}\n monthLabelFormat={monthLabelFormat}\n withWeekNumbers={withWeekNumbers}\n withWeekDays={withWeekDays}\n locale={locale}\n firstDayOfWeek={firstDayOfWeek}\n weekdayFormat={\n weekdayFormat ||\n ((date) => dayjs(date).locale(ctx.getLocale(locale)).format('dd').slice(0, 1))\n }\n weekendDays={weekendDays}\n getDayProps={getDayProps}\n getWeekNumberProps={getWeekNumberProps}\n onMonthClick={onMonthClick}\n onDayClick={onDayClick}\n onWeekNumberClick={onWeekNumberClick}\n highlightToday={highlightToday}\n groupedEvents={groupedEvents}\n mode={mode}\n withOutsideDays={withOutsideDays}\n firstDayIndex={getFirstDayIndex(month)}\n __getDayRef={(weekIndex, dayIndex, node) => {\n if (!Array.isArray(daysRef.current[currentMonthIndex])) {\n daysRef.current[currentMonthIndex] = [];\n }\n if (!Array.isArray(daysRef.current[currentMonthIndex][weekIndex])) {\n daysRef.current[currentMonthIndex][weekIndex] = [];\n }\n daysRef.current[currentMonthIndex][weekIndex][dayIndex] = node;\n }}\n __onDayKeyDown={(event, payload) => {\n handleYearViewKeyDown({\n controlsRef: daysRef,\n monthIndex: currentMonthIndex,\n weekIndex: payload.weekIndex,\n dayIndex: payload.dayIndex,\n event,\n });\n }}\n />\n );\n });\n\n return (\n <Box {...getStyles('yearView')} mod={{ static: mode === 'static' }} {...others}>\n {withHeader && (\n <ScheduleHeaderBase\n view=\"year\"\n navigationHandlers={{\n previous: () => toDateString(dayjs(date).subtract(1, 'year').startOf('year')),\n next: () => toDateString(dayjs(date).add(1, 'year').startOf('year')),\n today: () => toDateString(dayjs()),\n }}\n control={{\n monthYearSelect: {\n locale,\n withMonths: false,\n yearValue: dayjs(date).get('year'),\n monthValue: dayjs(date).get('month'),\n onYearChange: (year) =>\n onDateChange?.(toDateString(dayjs(date).set('year', year).startOf('year'))),\n ...monthYearSelectProps,\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 <div {...getStyles('yearViewMonths')}>{months}</div>\n </Box>\n );\n});\n\nYearView.displayName = '@mantine/schedule/YearView';\nYearView.classes = classes;\nYearView.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;;;;;AA4GA,MAAM,eAAe;CACnB,kBAAkB;CAClB,kBAAkB;CAClB,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,MAAM;CACP;AAED,MAAM,eAAe,oBAAqC,QAAQ,EAAE,cAAc,EAChF,UAAU,EAAE,sBAAsB,WAAW,KAAA,IAAY,UAAU,OAAO,GAAG,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,IAAI,OAAO;IAClC,YAAY,MAAM,KAAK,CAAC,IAAI,QAAQ;IACpC,eAAe,SACb,eAAe,aAAa,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,QAAQ,OAAO,CAAC,CAAC;IAC7E,GAAG;IACJ,EACF;GACO;GACM;GACA;GACQ;GACJ;GACC;GACF;GACD;GAChB,CAAA,EAGJ,oBAAC,OAAD;GAAK,GAAI,UAAU,iBAAiB;aAAG;GAAa,CAAA,CAChD;;EAER;AAEF,SAAS,cAAc;AACvB,SAAS,UAAUA;AACnB,SAAS,eAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine/schedule",
3
- "version": "9.0.0-alpha.7",
3
+ "version": "9.0.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.0.0-alpha.7",
39
- "@mantine/dates": "9.0.0-alpha.7",
40
- "@mantine/hooks": "9.0.0-alpha.7",
38
+ "@mantine/core": "9.0.0",
39
+ "@mantine/dates": "9.0.0",
40
+ "@mantine/hooks": "9.0.0",
41
41
  "react": "^19.2.0",
42
42
  "react-dom": "^19.2.0"
43
43
  },
package/styles.css CHANGED
@@ -804,6 +804,8 @@
804
804
 
805
805
  .m_7b47db0e {
806
806
  user-select: none;
807
+ font-weight: var(--mantine-font-weight-semibold);
808
+ text-transform: capitalize;
807
809
  }
808
810
 
809
811
  .m_a20935f7 {
@@ -1007,6 +1009,8 @@
1007
1009
 
1008
1010
  .m_9a1cef3f {
1009
1011
  margin-bottom: var(--mantine-spacing-sm);
1012
+ font-weight: var(--mantine-font-weight-semibold);
1013
+ text-transform: capitalize;
1010
1014
  }
1011
1015
 
1012
1016
  .m_16b7da81 {
@@ -1054,6 +1058,14 @@
1054
1058
 
1055
1059
  .m_ea7c78ee {
1056
1060
  margin-top: calc(0.125rem * var(--mantine-scale));
1061
+ font-size: var(--mantine-font-size-xs);
1062
+ color: var(--mantine-color-dimmed);
1063
+ }
1064
+
1065
+ .m_bbac00f3 {
1066
+ color: var(--mantine-color-dimmed);
1067
+ text-align: center;
1068
+ padding-block: var(--mantine-spacing-xl);
1057
1069
  }
1058
1070
 
1059
1071
  .m_8eceba9d {