@mantine/schedule 9.1.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/DayView/DayView.cjs +3 -0
- package/cjs/components/DayView/DayView.cjs.map +1 -1
- package/cjs/components/MonthView/MonthView.cjs +4 -0
- package/cjs/components/MonthView/MonthView.cjs.map +1 -1
- package/cjs/components/MoreEvents/MoreEvents.cjs +3 -1
- package/cjs/components/MoreEvents/MoreEvents.cjs.map +1 -1
- package/cjs/components/ScheduleHeader/HeaderControl/HeaderControl.cjs +7 -5
- package/cjs/components/ScheduleHeader/HeaderControl/HeaderControl.cjs.map +1 -1
- package/cjs/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.cjs +6 -4
- package/cjs/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.cjs.map +1 -1
- package/cjs/components/ScheduleHeader/ScheduleHeader.cjs +22 -17
- package/cjs/components/ScheduleHeader/ScheduleHeader.cjs.map +1 -1
- package/cjs/components/ScheduleHeader/ScheduleHeaderBase.cjs +1 -0
- package/cjs/components/ScheduleHeader/ScheduleHeaderBase.cjs.map +1 -1
- package/cjs/components/ScheduleHeader/ScheduleHeaderContext.cjs +20 -0
- package/cjs/components/ScheduleHeader/ScheduleHeaderContext.cjs.map +1 -0
- package/cjs/components/ScheduleHeader/ViewSelect/ViewSelect.cjs +5 -3
- package/cjs/components/ScheduleHeader/ViewSelect/ViewSelect.cjs.map +1 -1
- package/cjs/components/WeekView/WeekView.cjs.map +1 -1
- package/cjs/components/WeekView/WeekViewDay.cjs +5 -2
- package/cjs/components/WeekView/WeekViewDay.cjs.map +1 -1
- package/cjs/utils/get-business-hours-mod/get-business-hours-mod.cjs +20 -3
- package/cjs/utils/get-business-hours-mod/get-business-hours-mod.cjs.map +1 -1
- package/esm/components/DayView/DayView.mjs +3 -0
- package/esm/components/DayView/DayView.mjs.map +1 -1
- package/esm/components/MonthView/MonthView.mjs +4 -0
- package/esm/components/MonthView/MonthView.mjs.map +1 -1
- package/esm/components/MoreEvents/MoreEvents.mjs +3 -1
- package/esm/components/MoreEvents/MoreEvents.mjs.map +1 -1
- package/esm/components/ScheduleHeader/HeaderControl/HeaderControl.mjs +7 -5
- package/esm/components/ScheduleHeader/HeaderControl/HeaderControl.mjs.map +1 -1
- package/esm/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.mjs +6 -4
- package/esm/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.mjs.map +1 -1
- package/esm/components/ScheduleHeader/ScheduleHeader.mjs +22 -17
- package/esm/components/ScheduleHeader/ScheduleHeader.mjs.map +1 -1
- package/esm/components/ScheduleHeader/ScheduleHeaderBase.mjs +1 -0
- package/esm/components/ScheduleHeader/ScheduleHeaderBase.mjs.map +1 -1
- package/esm/components/ScheduleHeader/ScheduleHeaderContext.mjs +18 -0
- package/esm/components/ScheduleHeader/ScheduleHeaderContext.mjs.map +1 -0
- package/esm/components/ScheduleHeader/ViewSelect/ViewSelect.mjs +5 -3
- package/esm/components/ScheduleHeader/ViewSelect/ViewSelect.mjs.map +1 -1
- package/esm/components/WeekView/WeekView.mjs.map +1 -1
- package/esm/components/WeekView/WeekViewDay.mjs +5 -2
- package/esm/components/WeekView/WeekViewDay.mjs.map +1 -1
- package/esm/utils/get-business-hours-mod/get-business-hours-mod.mjs +20 -3
- package/esm/utils/get-business-hours-mod/get-business-hours-mod.mjs.map +1 -1
- package/lib/components/MoreEvents/MoreEvents.d.ts +5 -1
- package/lib/components/ScheduleHeader/ScheduleHeader.d.ts +3 -0
- package/lib/components/ScheduleHeader/ScheduleHeaderContext.d.ts +3 -0
- package/lib/components/WeekView/WeekView.d.ts +3 -2
- package/lib/components/WeekView/WeekViewDay.d.ts +3 -3
- package/lib/utils/get-business-hours-mod/get-business-hours-mod.d.ts +12 -3
- package/lib/utils/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WeekViewDay.cjs","names":["UnstyledButton","getBusinessHoursMod","getLabel","Box"],"sources":["../../../src/components/WeekView/WeekViewDay.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';\nimport { DayTimeInterval, getBusinessHoursMod } from '../../utils';\nimport type { WeekViewControlsRef } from './handle-week-view-key-down';\nimport type { WeekViewFactory } from './WeekView';\n\nexport interface WeekViewDayProps {\n /** Date to display */\n day: Date | DateStringValue;\n\n /** Index of this day in the week */\n dayIndex: number;\n\n /** Slots intervals */\n slots: DayTimeInterval[];\n\n /** `useStyles` return value of `WeekView` */\n getStyles: GetStylesApi<WeekViewFactory>;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Events list */\n children?: React.ReactNode;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format */\n businessHours?:
|
|
1
|
+
{"version":3,"file":"WeekViewDay.cjs","names":["UnstyledButton","getBusinessHoursMod","getLabel","Box"],"sources":["../../../src/components/WeekView/WeekViewDay.tsx"],"sourcesContent":["import dayjs from 'dayjs';\nimport { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';\nimport { BusinessHoursValue, DayTimeInterval, getBusinessHoursMod } from '../../utils';\nimport type { WeekViewControlsRef } from './handle-week-view-key-down';\nimport type { WeekViewFactory } from './WeekView';\n\nexport interface WeekViewDayProps {\n /** Date to display */\n day: Date | DateStringValue;\n\n /** Index of this day in the week */\n dayIndex: number;\n\n /** Slots intervals */\n slots: DayTimeInterval[];\n\n /** `useStyles` return value of `WeekView` */\n getStyles: GetStylesApi<WeekViewFactory>;\n\n /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */\n weekendDays?: DayOfWeek[];\n\n /** Events list */\n children?: React.ReactNode;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** If set to true, highlights business hours with white background */\n highlightBusinessHours?: boolean;\n\n /** Business hours range in `HH:mm:ss` format, or per-day record keyed by day of the week */\n businessHours?: BusinessHoursValue;\n\n /** If true, slots are drop targets for drag and drop */\n withEventsDragAndDrop?: boolean;\n\n /** Called when dragging over day slots container */\n onDaySlotsDragOver?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when dragging leaves day slots container */\n onDaySlotsDragLeave?: () => void;\n\n /** Called when dropping on day slots container */\n onDaySlotsDrop?: (e: React.DragEvent<HTMLDivElement>, day: string, dayIndex: number) => void;\n\n /** Called when slot is clicked */\n onSlotClick?: (day: string, slotTime: string, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Index of the slot that is currently a drop target */\n dropTargetSlotIndex?: number;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions */\n mode?: ScheduleMode;\n\n /** Ref for keyboard navigation */\n slotsRef?: WeekViewControlsRef;\n\n /** Index of the first focusable slot */\n firstSlotIndex?: { dayIndex: number; slotIndex: number };\n\n /** Keyboard event handler for slots */\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n dayIndex: number,\n slotIndex: number\n ) => void;\n\n /** Called when Arrow Up is pressed on the first slot, used to navigate to all-day slot */\n onFirstSlotArrowUp?: (dayIndex: number) => void;\n\n /** If set, enables drag-to-select time slot ranges */\n withDragSlotSelect?: boolean;\n\n /** Called when pointer down on a slot for drag selection */\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n\n /** Function to check if a slot is drag-selected */\n isSlotDragSelected?: (index: number, group: string) => boolean;\n\n /** Ref callback for the day slots container */\n daySlotsContainerRef?: (node: HTMLDivElement | null) => void;\n\n /** Function to get additional props for each time slot */\n getTimeSlotProps?: (data: {\n start: DateTimeStringValue;\n end: DateTimeStringValue;\n }) => Record<string, any> | undefined;\n}\n\nexport function WeekViewDay({\n day,\n dayIndex,\n slots,\n getStyles,\n weekendDays,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onDaySlotsDragOver,\n onDaySlotsDragLeave,\n onDaySlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n onFirstSlotArrowUp,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n daySlotsContainerRef,\n getTimeSlotProps,\n}: WeekViewDayProps) {\n const ctx = useDatesContext();\n const dayOfWeek = dayjs(day).day() as DayOfWeek;\n const weekend = ctx.getWeekendDays(weekendDays).includes(dayOfWeek);\n const today = dayjs(day).isSame(dayjs(), 'day');\n\n const dayGroup = dayjs(day).format('YYYY-MM-DD');\n\n const items = slots.map((slot, slotIndex) => {\n const isDropTarget = dropTargetSlotIndex === slotIndex;\n const isFirstSlot =\n firstSlotIndex?.dayIndex === dayIndex && firstSlotIndex?.slotIndex === slotIndex;\n const isDragSelected = isSlotDragSelected?.(slotIndex, dayGroup) || false;\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (e: React.MouseEvent<HTMLButtonElement>) => {\n onSlotClick?.(String(day), slot.startTime, e);\n externalOnClick?.(e);\n };\n\n return (\n <UnstyledButton\n key={slot.startTime}\n ref={(node) => {\n if (node && slotsRef?.current) {\n if (!slotsRef.current[dayIndex]) {\n slotsRef.current[dayIndex] = [];\n }\n slotsRef.current[dayIndex][slotIndex] = node;\n }\n }}\n {...getStyles('weekViewDaySlot')}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n dayOfWeek,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n aria-label={`${getLabel('timeSlot', labels)} ${dayGroup} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? slotIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={(e) => {\n if (slotIndex === 0 && e.key === 'ArrowUp' && onFirstSlotArrowUp) {\n e.preventDefault();\n onFirstSlotArrowUp(dayIndex);\n } else if (onSlotKeyDown) {\n onSlotKeyDown(e, dayIndex, slotIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, slotIndex, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n {...externalSlotProps}\n />\n );\n });\n\n return (\n <Box {...getStyles('weekViewDay')} mod={{ today, weekend }}>\n <Box\n ref={daySlotsContainerRef}\n mod={{ today }}\n {...getStyles('weekViewDaySlots')}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDragOver?.(e, String(day), dayIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onDaySlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onDaySlotsDrop?.(e, String(day), dayIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";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-hours-mod/get-business-hours-mod.ts
|
|
3
|
+
function isBusinessHoursRange(value) {
|
|
4
|
+
return Array.isArray(value) && value.length === 2 && typeof value[0] === "string" && typeof value[1] === "string";
|
|
5
|
+
}
|
|
3
6
|
/**
|
|
4
7
|
* Determines if a given time is within business hours and returns modifier object
|
|
5
8
|
* @param time - Time string in HH:mm:ss format
|
|
6
|
-
* @param businessHours - Tuple of [start, end] times in HH:mm:ss format
|
|
9
|
+
* @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week
|
|
7
10
|
* @param highlightBusinessHours - Whether to highlight business hours
|
|
11
|
+
* @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours
|
|
8
12
|
* @returns Modifier object for styling business/non-business hours
|
|
9
13
|
*/
|
|
10
|
-
function getBusinessHoursMod({ time, businessHours, highlightBusinessHours }) {
|
|
14
|
+
function getBusinessHoursMod({ time, businessHours, highlightBusinessHours, dayOfWeek }) {
|
|
11
15
|
if (!highlightBusinessHours || !businessHours) return {
|
|
12
16
|
"business-hours": false,
|
|
13
17
|
"non-business-hours": false
|
|
14
18
|
};
|
|
15
|
-
|
|
19
|
+
let range;
|
|
20
|
+
if (isBusinessHoursRange(businessHours)) range = businessHours;
|
|
21
|
+
else {
|
|
22
|
+
if (dayOfWeek === void 0) return {
|
|
23
|
+
"business-hours": false,
|
|
24
|
+
"non-business-hours": false
|
|
25
|
+
};
|
|
26
|
+
range = businessHours[dayOfWeek] ?? null;
|
|
27
|
+
}
|
|
28
|
+
if (!range) return {
|
|
29
|
+
"business-hours": false,
|
|
30
|
+
"non-business-hours": true
|
|
31
|
+
};
|
|
32
|
+
const [start, end] = range;
|
|
16
33
|
const isInBusinessHours = time >= start && time < end;
|
|
17
34
|
return {
|
|
18
35
|
"business-hours": isInBusinessHours,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-business-hours-mod.cjs","names":[],"sources":["../../../src/utils/get-business-hours-mod/get-business-hours-mod.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"get-business-hours-mod.cjs","names":[],"sources":["../../../src/utils/get-business-hours-mod/get-business-hours-mod.ts"],"sourcesContent":["import { DayOfWeek } from '../../types';\n\n/** Business hours range in `HH:mm:ss` format */\nexport type BusinessHoursRange = [string, string];\n\n/** Per-day business hours map keyed by day of the week (0 – Sunday, 6 – Saturday). `null` marks a day as fully outside business hours. */\nexport type BusinessHoursPerDay = Partial<Record<DayOfWeek, BusinessHoursRange | null>>;\n\n/** Business hours value – tuple applies to every day, record configures business hours per day */\nexport type BusinessHoursValue = BusinessHoursRange | BusinessHoursPerDay;\n\nexport interface GetBusinessHoursModInput {\n time: string;\n businessHours?: BusinessHoursValue;\n highlightBusinessHours?: boolean;\n dayOfWeek?: DayOfWeek;\n}\n\nexport interface BusinessHoursMod {\n 'business-hours': boolean;\n 'non-business-hours': boolean;\n}\n\nfunction isBusinessHoursRange(value: BusinessHoursValue): value is BusinessHoursRange {\n return (\n Array.isArray(value) &&\n value.length === 2 &&\n typeof value[0] === 'string' &&\n typeof value[1] === 'string'\n );\n}\n\n/**\n * Determines if a given time is within business hours and returns modifier object\n * @param time - Time string in HH:mm:ss format\n * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week\n * @param highlightBusinessHours - Whether to highlight business hours\n * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours\n * @returns Modifier object for styling business/non-business hours\n */\nexport function getBusinessHoursMod({\n time,\n businessHours,\n highlightBusinessHours,\n dayOfWeek,\n}: GetBusinessHoursModInput): BusinessHoursMod {\n if (!highlightBusinessHours || !businessHours) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n\n let range: [string, string] | null;\n if (isBusinessHoursRange(businessHours)) {\n range = businessHours;\n } else {\n if (dayOfWeek === undefined) {\n return {\n 'business-hours': false,\n 'non-business-hours': false,\n };\n }\n range = businessHours[dayOfWeek] ?? null;\n }\n\n if (!range) {\n return {\n 'business-hours': false,\n 'non-business-hours': true,\n };\n }\n\n const [start, end] = range;\n const isInBusinessHours = time >= start && time < end;\n\n return {\n 'business-hours': isInBusinessHours,\n 'non-business-hours': !isInBusinessHours,\n };\n}\n"],"mappings":";;AAuBA,SAAS,qBAAqB,OAAwD;AACpF,QACE,MAAM,QAAQ,MAAM,IACpB,MAAM,WAAW,KACjB,OAAO,MAAM,OAAO,YACpB,OAAO,MAAM,OAAO;;;;;;;;;;AAYxB,SAAgB,oBAAoB,EAClC,MACA,eACA,wBACA,aAC6C;AAC7C,KAAI,CAAC,0BAA0B,CAAC,cAC9B,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,IAAI;AACJ,KAAI,qBAAqB,cAAc,CACrC,SAAQ;MACH;AACL,MAAI,cAAc,KAAA,EAChB,QAAO;GACL,kBAAkB;GAClB,sBAAsB;GACvB;AAEH,UAAQ,cAAc,cAAc;;AAGtC,KAAI,CAAC,MACH,QAAO;EACL,kBAAkB;EAClB,sBAAsB;EACvB;CAGH,MAAM,CAAC,OAAO,OAAO;CACrB,MAAM,oBAAoB,QAAQ,SAAS,OAAO;AAElD,QAAO;EACL,kBAAkB;EAClB,sBAAsB,CAAC;EACxB"}
|
|
@@ -423,7 +423,10 @@ const DayView = factory((_props) => {
|
|
|
423
423
|
events: eventsData.allDayEvents,
|
|
424
424
|
moreEventsCount: allDayEventsCount.hiddenEventsCount,
|
|
425
425
|
renderEventBody,
|
|
426
|
+
renderEvent,
|
|
426
427
|
mode,
|
|
428
|
+
labels,
|
|
429
|
+
onEventClick,
|
|
427
430
|
...stylesApiProps,
|
|
428
431
|
...moreEventsProps
|
|
429
432
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayView.mjs","names":["classes"],"sources":["../../../src/components/DayView/DayView.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 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 ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateDropTime,\n clampIntervalMinutes,\n expandRecurringEvents,\n formatDate,\n getBusinessHoursMod,\n getDayTimeIntervals,\n getVisibleEvents,\n isAllDayEvent,\n toDateString,\n} from '../../utils';\nimport {\n CurrentTimeIndicator,\n CurrentTimeIndicatorStylesNames,\n} from '../CurrentTimeIndicator/CurrentTimeIndicator';\nimport { DragContext } from '../DragContext/DragContext';\nimport { MoreEvents, MoreEventsProps, MoreEventsStylesNames } from '../MoreEvents/MoreEvents';\nimport {\n RenderEvent,\n RenderEventBody,\n ScheduleEvent,\n ScheduleEventStylesNames,\n} from '../ScheduleEvent/ScheduleEvent';\nimport { MonthYearSelectStylesNames } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getDayViewEvents } from './get-day-view-events/get-day-view-events';\nimport classes from './DayView.module.css';\n\nexport type DayViewStylesNames =\n | 'dayView'\n | 'dayViewInner'\n | 'dayViewScrollArea'\n | 'dayViewAllDay'\n | 'dayViewAllDayEvents'\n | 'dayViewSlot'\n | 'dayViewSlots'\n | 'dayViewTimeSlots'\n | 'dayViewSlotLabel'\n | 'dayViewSlotLabels'\n | 'dayViewBackgroundEvent'\n | MoreEventsStylesNames\n | ScheduleEventStylesNames\n | Exclude<CombinedScheduleHeaderStylesNames, MonthYearSelectStylesNames>\n | CurrentTimeIndicatorStylesNames;\n\nexport type DayViewCssVariables = {\n dayView: '--day-view-radius' | '--day-view-slot-height' | '--day-view-all-day-slot-height';\n};\n\nexport interface DayViewProps\n extends BoxProps, StylesApiProps<DayViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Day to display, Date object or date string in `YYYY-MM-DD` format */\n date: Date | DateStringValue;\n\n /** Called when date is changed */\n onDateChange?: (date: DateStringValue) => void;\n\n /** Events to display, must be a stable reference */\n events?: ScheduleEventData[];\n\n /** Time slots start time, in `HH:mm:ss` format @default 00:00:00 */\n startTime?: string;\n\n /** Time slots end time in `HH:mm:ss` format @default 23:59:59 */\n endTime?: string;\n\n /** Number of minutes for each time slot @default 15 */\n intervalMinutes?: number;\n\n /** If set, the all-day slot is displayed below the header @default true */\n withAllDaySlot?: boolean;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */\n slotLabelFormat?: DateLabelFormat;\n\n /** Date format in the header @default MMMM D, YYYY */\n headerFormat?: DateLabelFormat;\n\n /** If set, displays a line indicating the current time. By default, displayed only for the current day. */\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, 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 /** Height of 1hr slot @default 64px */\n slotHeight?: React.CSSProperties['height'];\n\n /** Height of all-day slot @default 44px */\n allDaySlotHeight?: React.CSSProperties['height'];\n\n /** Props passed down to the `ScrollArea.Autosize` component */\n scrollAreaProps?: ScrollAreaAutosizeProps & DataAttributes;\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 /** 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 /** 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?: (date: 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 /** 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 DayViewFactory = Factory<{\n props: DayViewProps;\n ref: HTMLDivElement;\n stylesNames: DayViewStylesNames;\n vars: DayViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'DayView',\n startTime: '00:00:00',\n endTime: '23:59:59',\n intervalMinutes: 15,\n withAllDaySlot: true,\n slotLabelFormat: 'HH:mm',\n headerFormat: 'MMMM D, YYYY',\n withCurrentTimeBubble: true,\n withHeader: true,\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<DayViewProps>;\n\nconst varsResolver = createVarsResolver<DayViewFactory>(\n (_theme, { radius, slotHeight, allDaySlotHeight }) => ({\n dayView: {\n '--day-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--day-view-slot-height': rem(slotHeight),\n '--day-view-all-day-slot-height': rem(allDaySlotHeight),\n },\n })\n);\n\nexport const DayView = factory<DayViewFactory>((_props) => {\n const props = useProps('DayView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n __staticSelector,\n startTime,\n endTime,\n intervalMinutes,\n withAllDaySlot,\n date,\n locale,\n slotLabelFormat,\n headerFormat,\n withCurrentTimeIndicator = dayjs(date).isSame(dayjs(), 'day'),\n withCurrentTimeBubble,\n withHeader,\n radius,\n onDateChange,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n slotHeight,\n allDaySlotHeight,\n scrollAreaProps,\n events,\n moreEventsProps,\n renderEventBody,\n renderEvent,\n labels,\n highlightBusinessHours,\n businessHours,\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 onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n getTimeSlotProps,\n ...others\n } = props;\n\n const getStyles = useStyles<DayViewFactory>({\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: 'dayView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<DayViewFactory>({\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 const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const slotsRef = useRef<HTMLButtonElement[]>([]);\n const viewportRef = useRef<HTMLDivElement>(null);\n const timeSlotsContainerRef = useRef<HTMLDivElement>(null);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n useAutoScrollOnDrag({\n viewportRef,\n enabled: (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static',\n });\n\n useIsomorphicEffect(() => {\n if (!startScrollTime || !viewportRef.current || slotsRef.current.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 = slotsRef.current[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) => {\n const slotIndex = slotsRef.current.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 = slotsRef.current[0];\n const lastSlot = slotsRef.current[slotsRef.current.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 slotsRef.current.length - 1;\n }\n\n return null;\n }, []);\n\n const handleSlotKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, slotIndex: number) => {\n const direction = event.key;\n if (direction === 'ArrowDown' && slotIndex < slots.length - 1) {\n event.preventDefault();\n slotsRef.current[slotIndex + 1]?.focus();\n } else if (direction === 'ArrowUp' && slotIndex > 0) {\n event.preventDefault();\n slotsRef.current[slotIndex - 1]?.focus();\n }\n };\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex) => {\n if (!onSlotDragEnd) {\n return;\n }\n const slotDate = dayjs(date).format('YYYY-MM-DD');\n onSlotDragEnd(\n `${slotDate} ${slots[startIndex].startTime}`,\n `${slotDate} ${slots[endIndex].endTime}`\n );\n },\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(date).startOf('day').toDate(),\n rangeEnd: dayjs(date).endOf('day').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const eventsData = getDayViewEvents({ events: expandedEvents, date, startTime, endTime });\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, slotIndex: number) => {\n if (!onExternalEventDrop) {\n return;\n }\n const slotDate = dayjs(date).format('YYYY-MM-DD');\n onExternalEventDrop(e.dataTransfer, `${slotDate} ${slots[slotIndex].startTime}`);\n },\n [onExternalEventDrop, date, slots]\n );\n\n const dragDrop = useDragDropHandlers({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (slotIndex: number, draggedEvent: ScheduleEventData) => {\n const slotTime = slots[slotIndex].startTime;\n return calculateDropTime({\n draggedEvent,\n targetDate: date,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\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 eventsNodes = eventsData.regularEvents.map((event) => {\n const eventIsAllDay = isAllDayEvent({ event, date });\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 event={event}\n key={event.id}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n autoSize\n draggable={isDraggable}\n withResize={isResizable}\n isResizing={resizePosition !== null}\n onResizeStart={\n isResizable\n ? (edge, e) => {\n if (timeSlotsContainerRef.current) {\n eventResize.handleResizeStart({\n event,\n edge,\n container: timeSlotsContainerRef.current,\n originalTop: event.position.top,\n originalHeight: event.position.height,\n eventDate: dayjs(date).format('YYYY-MM-DD'),\n pointerEvent: e,\n });\n }\n }\n : undefined\n }\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n {...stylesApiProps}\n style={{\n ...stylesApiProps.styles?.event,\n top: `${eventTop}%`,\n height: `${eventHeight}%`,\n insetInlineStart: `${event.position.offset}%`,\n width: `${event.position.width}%`,\n position: 'absolute',\n }}\n />\n );\n });\n\n const allDayEventsCount = getVisibleEvents({\n maxEvents: 2,\n totalEvents: eventsData.allDayEvents.length,\n });\n\n const allDayEventsNodes = eventsData.allDayEvents\n .slice(0, allDayEventsCount.visibleEventsCount)\n .map((event) => (\n <ScheduleEvent\n key={event.id}\n event={event}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n style={{ maxHeight: '50%' }}\n nowrap\n autoSize\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n {...stylesApiProps}\n />\n ));\n\n const dayGroup = dayjs(date).format('YYYY-MM-DD');\n\n const items = slots.map((slot, index) => {\n const isDropTarget = dragDrop.isDropTarget(index);\n const isDragSelected = slotDragSelect.isSlotSelected(index, dayGroup);\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (event: React.MouseEvent<HTMLButtonElement>) => {\n onTimeSlotClick?.({\n slotStart,\n slotEnd,\n nativeEvent: event,\n });\n externalOnClick?.(event);\n };\n\n return (\n <UnstyledButton\n {...getStyles('dayViewSlot')}\n key={slot.startTime}\n ref={(node) => {\n slotsRef.current[index] = node!;\n }}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n __vars={{ '--slot-size': `${clampIntervalMinutes(intervalMinutes) / 60}` }}\n aria-label={`${getLabel('timeSlot', labels)} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : index === 0 ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? index : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={mode === 'static' ? undefined : (e) => handleSlotKeyDown(e, index)}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => slotDragSelect.handleSlotPointerDown(e, index, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={withDragHandlers ? (event) => event.preventDefault() : undefined}\n {...externalSlotProps}\n />\n );\n });\n\n const slotsLabels = slots.reduce<React.ReactNode[]>((acc, slot) => {\n if (slot.isHourStart) {\n const slotTime = dayjs(`${dayjs(date).format('YYYY-MM-DD')} ${slot.startTime}`);\n const label = formatDate({\n locale: ctx.getLocale(locale),\n date: slotTime,\n format: slotLabelFormat,\n });\n\n acc.push(\n <Box\n {...getStyles('dayViewSlotLabel')}\n key={slot.startTime}\n mod={getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n })}\n >\n {label}\n </Box>\n );\n }\n return acc;\n }, []);\n\n const backgroundAllDayEventNodes = eventsData.backgroundAllDayEvents.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}`,\n ...getStyles('dayViewBackgroundEvent', {\n style: { top: 0, height: '100%', width: '100%' },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const backgroundTimedEventNodes = eventsData.backgroundTimedEvents.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: event.id,\n ...getStyles('dayViewBackgroundEvent', {\n style: {\n top: `calc(${event.position.top}% + 1px)`,\n height: `calc(${event.position.height}% - 2px)`,\n width: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const content = (\n <Box\n {...getStyles('dayView')}\n mod={{ static: mode === 'static', 'slot-dragging': slotDragSelect.isDragging }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"day\"\n navigationHandlers={{\n previous: () => toDateString(dayjs(date).subtract(1, 'day')),\n next: () => toDateString(dayjs(date).add(1, 'day')),\n today: () => toDateString(dayjs()),\n }}\n control={{\n title: formatDate({ locale: ctx.getLocale(locale), date, format: headerFormat }),\n miw: 140,\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.Autosize\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('dayViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n viewportRef={mergedViewportRef}\n >\n <Box {...getStyles('dayViewInner')}>\n <div {...getStyles('dayViewSlotLabels')}>\n {withAllDaySlot && (\n <Box {...getStyles('dayViewSlotLabel')} mod={{ 'all-day': true }}>\n {getLabel('allDay', labels)}\n </Box>\n )}\n {slotsLabels}\n </div>\n\n <div {...getStyles('dayViewSlots')}>\n {withAllDaySlot && (\n <div {...getStyles('dayViewAllDay')}>\n {backgroundAllDayEventNodes}\n <div {...getStyles('dayViewAllDayEvents')}>\n {allDayEventsNodes}\n {allDayEventsCount.hiddenEventsCount > 0 && (\n <MoreEvents\n events={eventsData.allDayEvents}\n moreEventsCount={allDayEventsCount.hiddenEventsCount}\n renderEventBody={renderEventBody}\n mode={mode}\n {...stylesApiProps}\n {...moreEventsProps}\n />\n )}\n </div>\n <UnstyledButton\n {...getStyles('dayViewSlot')}\n mod={{ 'all-day': true, static: mode === 'static' }}\n aria-label={`${getLabel('timeSlot', labels)} ${getLabel('allDay', labels)}`}\n onClick={\n mode === 'static' || !onAllDaySlotClick\n ? undefined\n : (e) => {\n onAllDaySlotClick(dayjs(date).format('YYYY-MM-DD'), e);\n }\n }\n />\n </div>\n )}\n\n <div\n ref={timeSlotsContainerRef}\n {...getStyles('dayViewTimeSlots')}\n onDragOver={\n withDragHandlers\n ? (event) => {\n const slotIndex = getSlotIndexFromDragPoint(event);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, slotIndex);\n }\n }\n : undefined\n }\n onDragLeave={withDragHandlers ? dragDrop.handleDragLeave : undefined}\n onDrop={\n withDragHandlers\n ? (event) => {\n const slotIndex = getSlotIndexFromDragPoint(event);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, slotIndex);\n }\n }\n : undefined\n }\n >\n {backgroundTimedEventNodes}\n\n {eventsNodes}\n\n {withCurrentTimeIndicator && (\n <CurrentTimeIndicator\n startOffset=\"calc(var(--day-view-slot-labels-width) * -1)\"\n endOffset=\"0rem\"\n topOffset=\"0rem\"\n timeBubbleStartOffset=\"calc(var(--day-view-slot-labels-width) * -1 + 30px)\"\n currentTimeFormat={slotLabelFormat}\n withTimeBubble={withCurrentTimeBubble}\n withThumb={!withCurrentTimeBubble}\n locale={locale}\n startTime={startTime}\n endTime={endTime}\n {...stylesApiProps}\n />\n )}\n {items}\n </div>\n </div>\n </Box>\n </ScrollArea.Autosize>\n </Box>\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={dragDrop.dragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nDayView.displayName = '@mantine/schedule/DayView';\nDayView.classes = classes;\nDayView.varsResolver = varsResolver;\n\nexport namespace DayView {\n export type Props = DayViewProps;\n export type Factory = DayViewFactory;\n export type StylesNames = DayViewStylesNames;\n export type CssVariables = DayViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PA,MAAM,eAAe;CACnB,kBAAkB;CAClB,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,cAAc;CACd,uBAAuB;CACvB,YAAY;CACZ,wBAAwB;CACxB,eAAe,CAAC,YAAY,WAAW;CACvC,uBAAuB;CACvB,oBAAoB;CACpB,iBAAiB;CACjB,MAAM;CACP;AAED,MAAM,eAAe,oBAClB,QAAQ,EAAE,QAAQ,YAAY,wBAAwB,EACrD,SAAS;CACP,qBAAqB,WAAW,KAAA,IAAY,UAAU,OAAO,GAAG,KAAA;CAChE,0BAA0B,IAAI,WAA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BAAsB;kBAAzC,CACG,mBACA,kBAAkB,oBAAoB,KACrC,oBAAC,YAAD;SACE,QAAQ,WAAW;SACnB,iBAAiB,kBAAkB;SAClB;SACX;SACN,GAAI;SACJ,GAAI;SACJ,CAAA,CAEA;;OACN,oBAAC,gBAAD;QACE,GAAI,UAAU,cAAc;QAC5B,KAAK;SAAE,WAAW;SAAM,QAAQ,SAAS;SAAU;QACnD,cAAY,GAAG,SAAS,YAAY,OAAO,CAAC,GAAG,SAAS,UAAU,OAAO;QACzE,SACE,SAAS,YAAY,CAAC,oBAClB,KAAA,KACC,MAAM;AACL,2BAAkB,MAAM,KAAK,CAAC,OAAO,aAAa,EAAE,EAAE;;QAG9D,CAAA;OACE;SAGR,qBAAC,OAAD;MACE,KAAK;MACL,GAAI,UAAU,mBAAmB;MACjC,YACE,oBACK,UAAU;OACT,MAAM,YAAY,0BAA0B,MAAM;AAClD,WAAI,cAAc,KAChB,UAAS,eAAe,OAAO,UAAU;UAG7C,KAAA;MAEN,aAAa,mBAAmB,SAAS,kBAAkB,KAAA;MAC3D,QACE,oBACK,UAAU;OACT,MAAM,YAAY,0BAA0B,MAAM;AAClD,WAAI,cAAc,KAChB,UAAS,WAAW,OAAO,UAAU;UAGzC,KAAA;gBAtBR;OAyBG;OAEA;OAEA,4BACC,oBAAC,sBAAD;QACE,aAAY;QACZ,WAAU;QACV,WAAU;QACV,uBAAsB;QACtB,mBAAmB;QACnB,gBAAgB;QAChB,WAAW,CAAC;QACJ;QACG;QACF;QACT,GAAI;QACJ,CAAA;OAEH;OACG;QACF;OACF;;GACc,CAAA,CAClB;;AAGR,KAAI,sBACF,QAAO,oBAAC,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,QAAQ,cAAc;AACtB,QAAQ,UAAUA;AAClB,QAAQ,eAAe"}
|
|
1
|
+
{"version":3,"file":"DayView.mjs","names":["classes"],"sources":["../../../src/components/DayView/DayView.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 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 ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport {\n calculateDropTime,\n clampIntervalMinutes,\n expandRecurringEvents,\n formatDate,\n getBusinessHoursMod,\n getDayTimeIntervals,\n getVisibleEvents,\n isAllDayEvent,\n toDateString,\n} from '../../utils';\nimport {\n CurrentTimeIndicator,\n CurrentTimeIndicatorStylesNames,\n} from '../CurrentTimeIndicator/CurrentTimeIndicator';\nimport { DragContext } from '../DragContext/DragContext';\nimport { MoreEvents, MoreEventsProps, MoreEventsStylesNames } from '../MoreEvents/MoreEvents';\nimport {\n RenderEvent,\n RenderEventBody,\n ScheduleEvent,\n ScheduleEventStylesNames,\n} from '../ScheduleEvent/ScheduleEvent';\nimport { MonthYearSelectStylesNames } from '../ScheduleHeader/MonthYearSelect/MonthYearSelect';\nimport { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHeader';\nimport { ScheduleHeaderBase } from '../ScheduleHeader/ScheduleHeaderBase';\nimport { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';\nimport { getDayViewEvents } from './get-day-view-events/get-day-view-events';\nimport classes from './DayView.module.css';\n\nexport type DayViewStylesNames =\n | 'dayView'\n | 'dayViewInner'\n | 'dayViewScrollArea'\n | 'dayViewAllDay'\n | 'dayViewAllDayEvents'\n | 'dayViewSlot'\n | 'dayViewSlots'\n | 'dayViewTimeSlots'\n | 'dayViewSlotLabel'\n | 'dayViewSlotLabels'\n | 'dayViewBackgroundEvent'\n | MoreEventsStylesNames\n | ScheduleEventStylesNames\n | Exclude<CombinedScheduleHeaderStylesNames, MonthYearSelectStylesNames>\n | CurrentTimeIndicatorStylesNames;\n\nexport type DayViewCssVariables = {\n dayView: '--day-view-radius' | '--day-view-slot-height' | '--day-view-all-day-slot-height';\n};\n\nexport interface DayViewProps\n extends BoxProps, StylesApiProps<DayViewFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Day to display, Date object or date string in `YYYY-MM-DD` format */\n date: Date | DateStringValue;\n\n /** Called when date is changed */\n onDateChange?: (date: DateStringValue) => void;\n\n /** Events to display, must be a stable reference */\n events?: ScheduleEventData[];\n\n /** Time slots start time, in `HH:mm:ss` format @default 00:00:00 */\n startTime?: string;\n\n /** Time slots end time in `HH:mm:ss` format @default 23:59:59 */\n endTime?: string;\n\n /** Number of minutes for each time slot @default 15 */\n intervalMinutes?: number;\n\n /** If set, the all-day slot is displayed below the header @default true */\n withAllDaySlot?: boolean;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */\n slotLabelFormat?: DateLabelFormat;\n\n /** Date format in the header @default MMMM D, YYYY */\n headerFormat?: DateLabelFormat;\n\n /** If set, displays a line indicating the current time. By default, displayed only for the current day. */\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, 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 /** Height of 1hr slot @default 64px */\n slotHeight?: React.CSSProperties['height'];\n\n /** Height of all-day slot @default 44px */\n allDaySlotHeight?: React.CSSProperties['height'];\n\n /** Props passed down to the `ScrollArea.Autosize` component */\n scrollAreaProps?: ScrollAreaAutosizeProps & DataAttributes;\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 /** 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 /** 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?: (date: 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 /** 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 DayViewFactory = Factory<{\n props: DayViewProps;\n ref: HTMLDivElement;\n stylesNames: DayViewStylesNames;\n vars: DayViewCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'DayView',\n startTime: '00:00:00',\n endTime: '23:59:59',\n intervalMinutes: 15,\n withAllDaySlot: true,\n slotLabelFormat: 'HH:mm',\n headerFormat: 'MMMM D, YYYY',\n withCurrentTimeBubble: true,\n withHeader: true,\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<DayViewProps>;\n\nconst varsResolver = createVarsResolver<DayViewFactory>(\n (_theme, { radius, slotHeight, allDaySlotHeight }) => ({\n dayView: {\n '--day-view-radius': radius !== undefined ? getRadius(radius) : undefined,\n '--day-view-slot-height': rem(slotHeight),\n '--day-view-all-day-slot-height': rem(allDaySlotHeight),\n },\n })\n);\n\nexport const DayView = factory<DayViewFactory>((_props) => {\n const props = useProps('DayView', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n attributes,\n vars,\n __staticSelector,\n startTime,\n endTime,\n intervalMinutes,\n withAllDaySlot,\n date,\n locale,\n slotLabelFormat,\n headerFormat,\n withCurrentTimeIndicator = dayjs(date).isSame(dayjs(), 'day'),\n withCurrentTimeBubble,\n withHeader,\n radius,\n onDateChange,\n onViewChange,\n previousControlProps,\n nextControlProps,\n todayControlProps,\n viewSelectProps,\n slotHeight,\n allDaySlotHeight,\n scrollAreaProps,\n events,\n moreEventsProps,\n renderEventBody,\n renderEvent,\n labels,\n highlightBusinessHours,\n businessHours,\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 onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n getTimeSlotProps,\n ...others\n } = props;\n\n const getStyles = useStyles<DayViewFactory>({\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: 'dayView',\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<DayViewFactory>({\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 const slots = getDayTimeIntervals({ startTime, endTime, intervalMinutes });\n const slotsRef = useRef<HTMLButtonElement[]>([]);\n const viewportRef = useRef<HTMLDivElement>(null);\n const timeSlotsContainerRef = useRef<HTMLDivElement>(null);\n const mergedViewportRef = useMergedRef(viewportRef, scrollAreaProps?.viewportRef);\n\n useAutoScrollOnDrag({\n viewportRef,\n enabled: (withEventsDragAndDrop || !!onExternalEventDrop) && mode !== 'static',\n });\n\n useIsomorphicEffect(() => {\n if (!startScrollTime || !viewportRef.current || slotsRef.current.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 = slotsRef.current[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) => {\n const slotIndex = slotsRef.current.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 = slotsRef.current[0];\n const lastSlot = slotsRef.current[slotsRef.current.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 slotsRef.current.length - 1;\n }\n\n return null;\n }, []);\n\n const handleSlotKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, slotIndex: number) => {\n const direction = event.key;\n if (direction === 'ArrowDown' && slotIndex < slots.length - 1) {\n event.preventDefault();\n slotsRef.current[slotIndex + 1]?.focus();\n } else if (direction === 'ArrowUp' && slotIndex > 0) {\n event.preventDefault();\n slotsRef.current[slotIndex - 1]?.focus();\n }\n };\n\n const slotDragSelect = useSlotDragSelect({\n enabled: withDragSlotSelect && mode !== 'static',\n onDragEnd: (startIndex, endIndex) => {\n if (!onSlotDragEnd) {\n return;\n }\n const slotDate = dayjs(date).format('YYYY-MM-DD');\n onSlotDragEnd(\n `${slotDate} ${slots[startIndex].startTime}`,\n `${slotDate} ${slots[endIndex].endTime}`\n );\n },\n });\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart: dayjs(date).startOf('day').toDate(),\n rangeEnd: dayjs(date).endOf('day').toDate(),\n expansionLimit: recurrenceExpansionLimit,\n });\n\n const eventsData = getDayViewEvents({ events: expandedEvents, date, startTime, endTime });\n\n const handleExternalDrop = useCallback(\n (e: React.DragEvent, slotIndex: number) => {\n if (!onExternalEventDrop) {\n return;\n }\n const slotDate = dayjs(date).format('YYYY-MM-DD');\n onExternalEventDrop(e.dataTransfer, `${slotDate} ${slots[slotIndex].startTime}`);\n },\n [onExternalEventDrop, date, slots]\n );\n\n const dragDrop = useDragDropHandlers({\n enabled: withEventsDragAndDrop,\n mode,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n calculateDropTarget: (slotIndex: number, draggedEvent: ScheduleEventData) => {\n const slotTime = slots[slotIndex].startTime;\n return calculateDropTime({\n draggedEvent,\n targetDate: date,\n targetSlotTime: slotTime,\n intervalMinutes,\n });\n },\n onExternalDrop: onExternalEventDrop ? handleExternalDrop : undefined,\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 eventsNodes = eventsData.regularEvents.map((event) => {\n const eventIsAllDay = isAllDayEvent({ event, date });\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 event={event}\n key={event.id}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n autoSize\n draggable={isDraggable}\n withResize={isResizable}\n isResizing={resizePosition !== null}\n onResizeStart={\n isResizable\n ? (edge, e) => {\n if (timeSlotsContainerRef.current) {\n eventResize.handleResizeStart({\n event,\n edge,\n container: timeSlotsContainerRef.current,\n originalTop: event.position.top,\n originalHeight: event.position.height,\n eventDate: dayjs(date).format('YYYY-MM-DD'),\n pointerEvent: e,\n });\n }\n }\n : undefined\n }\n mode={mode}\n onClick={\n onEventClick\n ? (e) => {\n if (!eventResize.wasResizing()) {\n onEventClick(event, e);\n }\n }\n : undefined\n }\n {...stylesApiProps}\n style={{\n ...stylesApiProps.styles?.event,\n top: `${eventTop}%`,\n height: `${eventHeight}%`,\n insetInlineStart: `${event.position.offset}%`,\n width: `${event.position.width}%`,\n position: 'absolute',\n }}\n />\n );\n });\n\n const allDayEventsCount = getVisibleEvents({\n maxEvents: 2,\n totalEvents: eventsData.allDayEvents.length,\n });\n\n const allDayEventsNodes = eventsData.allDayEvents\n .slice(0, allDayEventsCount.visibleEventsCount)\n .map((event) => (\n <ScheduleEvent\n key={event.id}\n event={event}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n style={{ maxHeight: '50%' }}\n nowrap\n autoSize\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n {...stylesApiProps}\n />\n ));\n\n const dayGroup = dayjs(date).format('YYYY-MM-DD');\n\n const items = slots.map((slot, index) => {\n const isDropTarget = dragDrop.isDropTarget(index);\n const isDragSelected = slotDragSelect.isSlotSelected(index, dayGroup);\n const slotStart = `${dayGroup} ${slot.startTime}` as DateTimeStringValue;\n const slotEnd = `${dayGroup} ${slot.endTime}` as DateTimeStringValue;\n const { onClick: externalOnClick, ...externalSlotProps } =\n getTimeSlotProps?.({ start: slotStart, end: slotEnd }) || {};\n\n const handleClick =\n mode === 'static'\n ? undefined\n : (event: React.MouseEvent<HTMLButtonElement>) => {\n onTimeSlotClick?.({\n slotStart,\n slotEnd,\n nativeEvent: event,\n });\n externalOnClick?.(event);\n };\n\n return (\n <UnstyledButton\n {...getStyles('dayViewSlot')}\n key={slot.startTime}\n ref={(node) => {\n slotsRef.current[index] = node!;\n }}\n mod={{\n 'hour-start': slot.isHourStart,\n ...getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n }),\n 'drop-target': isDropTarget,\n 'drag-selected': isDragSelected,\n static: mode === 'static',\n }}\n __vars={{ '--slot-size': `${clampIntervalMinutes(intervalMinutes) / 60}` }}\n aria-label={`${getLabel('timeSlot', labels)} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : index === 0 ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? index : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? dayGroup : undefined}\n onKeyDown={mode === 'static' ? undefined : (e) => handleSlotKeyDown(e, index)}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => slotDragSelect.handleSlotPointerDown(e, index, dayGroup)\n : undefined\n }\n onClick={handleClick}\n onDragOver={withDragHandlers ? (event) => event.preventDefault() : undefined}\n {...externalSlotProps}\n />\n );\n });\n\n const slotsLabels = slots.reduce<React.ReactNode[]>((acc, slot) => {\n if (slot.isHourStart) {\n const slotTime = dayjs(`${dayjs(date).format('YYYY-MM-DD')} ${slot.startTime}`);\n const label = formatDate({\n locale: ctx.getLocale(locale),\n date: slotTime,\n format: slotLabelFormat,\n });\n\n acc.push(\n <Box\n {...getStyles('dayViewSlotLabel')}\n key={slot.startTime}\n mod={getBusinessHoursMod({\n time: slot.startTime,\n businessHours,\n highlightBusinessHours,\n })}\n >\n {label}\n </Box>\n );\n }\n return acc;\n }, []);\n\n const backgroundAllDayEventNodes = eventsData.backgroundAllDayEvents.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}`,\n ...getStyles('dayViewBackgroundEvent', {\n style: { top: 0, height: '100%', width: '100%' },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const backgroundTimedEventNodes = eventsData.backgroundTimedEvents.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: event.id,\n ...getStyles('dayViewBackgroundEvent', {\n style: {\n top: `calc(${event.position.top}% + 1px)`,\n height: `calc(${event.position.height}% - 2px)`,\n width: '100%',\n },\n }),\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n },\n children: bgEventBody,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, bgEventProps as any);\n }\n\n const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\n });\n\n const content = (\n <Box\n {...getStyles('dayView')}\n mod={{ static: mode === 'static', 'slot-dragging': slotDragSelect.isDragging }}\n {...others}\n >\n {withHeader && (\n <ScheduleHeaderBase\n view=\"day\"\n navigationHandlers={{\n previous: () => toDateString(dayjs(date).subtract(1, 'day')),\n next: () => toDateString(dayjs(date).add(1, 'day')),\n today: () => toDateString(dayjs()),\n }}\n control={{\n title: formatDate({ locale: ctx.getLocale(locale), date, format: headerFormat }),\n miw: 140,\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.Autosize\n scrollbarSize={4}\n {...scrollAreaProps}\n {...getStyles('dayViewScrollArea', {\n className: scrollAreaProps?.className,\n style: scrollAreaProps?.style,\n })}\n viewportRef={mergedViewportRef}\n >\n <Box {...getStyles('dayViewInner')}>\n <div {...getStyles('dayViewSlotLabels')}>\n {withAllDaySlot && (\n <Box {...getStyles('dayViewSlotLabel')} mod={{ 'all-day': true }}>\n {getLabel('allDay', labels)}\n </Box>\n )}\n {slotsLabels}\n </div>\n\n <div {...getStyles('dayViewSlots')}>\n {withAllDaySlot && (\n <div {...getStyles('dayViewAllDay')}>\n {backgroundAllDayEventNodes}\n <div {...getStyles('dayViewAllDayEvents')}>\n {allDayEventsNodes}\n {allDayEventsCount.hiddenEventsCount > 0 && (\n <MoreEvents\n events={eventsData.allDayEvents}\n moreEventsCount={allDayEventsCount.hiddenEventsCount}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n mode={mode}\n labels={labels}\n onEventClick={onEventClick}\n {...stylesApiProps}\n {...moreEventsProps}\n />\n )}\n </div>\n <UnstyledButton\n {...getStyles('dayViewSlot')}\n mod={{ 'all-day': true, static: mode === 'static' }}\n aria-label={`${getLabel('timeSlot', labels)} ${getLabel('allDay', labels)}`}\n onClick={\n mode === 'static' || !onAllDaySlotClick\n ? undefined\n : (e) => {\n onAllDaySlotClick(dayjs(date).format('YYYY-MM-DD'), e);\n }\n }\n />\n </div>\n )}\n\n <div\n ref={timeSlotsContainerRef}\n {...getStyles('dayViewTimeSlots')}\n onDragOver={\n withDragHandlers\n ? (event) => {\n const slotIndex = getSlotIndexFromDragPoint(event);\n if (slotIndex !== null) {\n dragDrop.handleDragOver(event, slotIndex);\n }\n }\n : undefined\n }\n onDragLeave={withDragHandlers ? dragDrop.handleDragLeave : undefined}\n onDrop={\n withDragHandlers\n ? (event) => {\n const slotIndex = getSlotIndexFromDragPoint(event);\n if (slotIndex !== null) {\n dragDrop.handleDrop(event, slotIndex);\n }\n }\n : undefined\n }\n >\n {backgroundTimedEventNodes}\n\n {eventsNodes}\n\n {withCurrentTimeIndicator && (\n <CurrentTimeIndicator\n startOffset=\"calc(var(--day-view-slot-labels-width) * -1)\"\n endOffset=\"0rem\"\n topOffset=\"0rem\"\n timeBubbleStartOffset=\"calc(var(--day-view-slot-labels-width) * -1 + 30px)\"\n currentTimeFormat={slotLabelFormat}\n withTimeBubble={withCurrentTimeBubble}\n withThumb={!withCurrentTimeBubble}\n locale={locale}\n startTime={startTime}\n endTime={endTime}\n {...stylesApiProps}\n />\n )}\n {items}\n </div>\n </div>\n </Box>\n </ScrollArea.Autosize>\n </Box>\n );\n\n if (withEventsDragAndDrop) {\n return <DragContext.Provider value={dragDrop.dragContextValue}>{content}</DragContext.Provider>;\n }\n\n return content;\n});\n\nDayView.displayName = '@mantine/schedule/DayView';\nDayView.classes = classes;\nDayView.varsResolver = varsResolver;\n\nexport namespace DayView {\n export type Props = DayViewProps;\n export type Factory = DayViewFactory;\n export type StylesNames = DayViewStylesNames;\n export type CssVariables = DayViewCssVariables;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+PA,MAAM,eAAe;CACnB,kBAAkB;CAClB,WAAW;CACX,SAAS;CACT,iBAAiB;CACjB,gBAAgB;CAChB,iBAAiB;CACjB,cAAc;CACd,uBAAuB;CACvB,YAAY;CACZ,wBAAwB;CACxB,eAAe,CAAC,YAAY,WAAW;CACvC,uBAAuB;CACvB,oBAAoB;CACpB,iBAAiB;CACjB,MAAM;CACP;AAED,MAAM,eAAe,oBAClB,Q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;AAEF,QAAQ,cAAc;AACtB,QAAQ,UAAUA;AAClB,QAAQ,eAAe"}
|
|
@@ -272,6 +272,10 @@ const MonthView = factory((_props) => {
|
|
|
272
272
|
events: dayEvents,
|
|
273
273
|
moreEventsCount: hiddenEventsCount,
|
|
274
274
|
mode,
|
|
275
|
+
labels,
|
|
276
|
+
renderEventBody,
|
|
277
|
+
renderEvent,
|
|
278
|
+
onEventClick,
|
|
275
279
|
style: {
|
|
276
280
|
position: "absolute",
|
|
277
281
|
top: `calc(100% - 2px)`,
|
|
@@ -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 !== 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 const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\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\nexport namespace MonthView {\n export type Props = MonthViewProps;\n export type Factory = MonthViewFactory;\n export type StylesNames = MonthViewStylesNames;\n export type CssVariables = MonthViewCssVariables;\n}\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,iBACA,gBACA,QACA,iBACA,YACA,sBACA,cACA,mBACA,kBACA,sBACA,iBACA,QACA,iBACA,iBACA,aACA,uBACA,aACA,cACA,kBACA,gBACA,cACA,oBACA,eACA,QACA,MACA,iBACA,qBACA,0BACA,iBAAiB,kBACjB,GAAG,WACD;CAEJ,MAAM,kBAAkB,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,oBAAoB,EAAE,CAAC;CAExE,MAAM,YAAY,UAA4B;EAC5C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;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B,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 const { key: bgEventKey, ...restBgEventProps } = bgEventProps;\n return <Box key={bgEventKey} {...restBgEventProps} />;\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 labels={labels}\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n onEventClick={onEventClick}\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\nexport namespace MonthView {\n export type Props = MonthViewProps;\n export type Factory = MonthViewFactory;\n export type StylesNames = MonthViewStylesNames;\n export type CssVariables = MonthViewCssVariables;\n}\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,iBACA,gBACA,QACA,iBACA,YACA,sBACA,cACA,mBACA,kBACA,sBACA,iBACA,QACA,iBACA,iBACA,aACA,uBACA,aACA,cACA,kBACA,gBACA,cACA,oBACA,eACA,QACA,MACA,iBACA,qBACA,0BACA,iBAAiB,kBACjB,GAAG,WACD;CAEJ,MAAM,kBAAkB,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,oBAAoB,EAAE,CAAC;CAExE,MAAM,YAAY,UAA4B;EAC5C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACf,CAAC;CAEF,MAAM,EAAE,oBAAoB,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,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"}
|
|
@@ -9,7 +9,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
9
|
const defaultProps = { dropdownType: "popover" };
|
|
10
10
|
const MoreEvents = factory((_props) => {
|
|
11
11
|
const props = useProps("MoreEvents", defaultProps, _props);
|
|
12
|
-
const { classNames, className, style, styles, unstyled, vars, attributes, radius, dropdownType, events, moreEventsCount, popoverProps, modalProps, onDropdownClose, children, modalTitle, renderEventBody, id, labels, mode, ...others } = props;
|
|
12
|
+
const { classNames, className, style, styles, unstyled, vars, attributes, radius, dropdownType, events, moreEventsCount, popoverProps, modalProps, onDropdownClose, children, modalTitle, renderEventBody, renderEvent, id, labels, mode, onEventClick, ...others } = props;
|
|
13
13
|
const [dropdownOpened, dropdownHandlers] = useDisclosure();
|
|
14
14
|
const getStyles = useStyles({
|
|
15
15
|
name: "MoreEvents",
|
|
@@ -35,7 +35,9 @@ const MoreEvents = factory((_props) => {
|
|
|
35
35
|
event,
|
|
36
36
|
size: "md",
|
|
37
37
|
renderEventBody,
|
|
38
|
+
renderEvent,
|
|
38
39
|
mode,
|
|
40
|
+
onClick: onEventClick ? (e) => onEventClick(event, e) : void 0,
|
|
39
41
|
children: event.title
|
|
40
42
|
}, event.id))
|
|
41
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoreEvents.mjs","names":["classes"],"sources":["../../../src/components/MoreEvents/MoreEvents.tsx"],"sourcesContent":["import {\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineRadius,\n Modal,\n ModalProps,\n Popover,\n PopoverProps,\n StylesApiProps,\n UnstyledButton,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useDisclosure } from '@mantine/hooks';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { ScheduleEventData, ScheduleMode } from '../../types';\nimport { RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport classes from './MoreEvents.module.css';\n\nexport type MoreEventsDropdownType = 'popover' | 'modal';\n\nexport type MoreEventsStylesNames = 'moreEventsButton' | 'moreEventsList' | 'moreEventsDropdown';\n\nexport interface MoreEventsProps\n extends BoxProps, StylesApiProps<MoreEventsFactory>, ElementProps<'button'> {\n /** List of events to display */\n events: ScheduleEventData[];\n\n /** Events count to use for `+X more` label */\n moreEventsCount: number;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Title for the Modal component, ignored if `dropdownType` is not 'modal' */\n modalTitle?: string;\n\n /** Type of dropdown to use for displaying more events @default 'popover' */\n dropdownType?: MoreEventsDropdownType;\n\n /** Props passed down to `Popover` component */\n popoverProps?: Partial<Omit<PopoverProps, 'children'>>;\n\n /** Props passed down to `Modal` component */\n modalProps?: Partial<Omit<ModalProps, 'children'>>;\n\n /** Called when the dropdown is closed */\n onDropdownClose?: () => void;\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n}\n\nexport type MoreEventsFactory = Factory<{\n props: MoreEventsProps;\n ref: HTMLButtonElement;\n stylesNames: MoreEventsStylesNames;\n}>;\n\nconst defaultProps = {\n dropdownType: 'popover',\n} satisfies Partial<MoreEventsProps>;\n\nexport const MoreEvents = factory<MoreEventsFactory>((_props) => {\n const props = useProps('MoreEvents', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n radius,\n dropdownType,\n events,\n moreEventsCount,\n popoverProps,\n modalProps,\n onDropdownClose,\n children,\n modalTitle,\n renderEventBody,\n id,\n labels,\n mode,\n ...others\n } = props;\n const [dropdownOpened, dropdownHandlers] = useDisclosure();\n\n const getStyles = useStyles<MoreEventsFactory>({\n name: 'MoreEvents',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n rootSelector: 'moreEventsButton',\n });\n\n const handleClose = () => {\n dropdownHandlers.close();\n onDropdownClose?.();\n };\n\n const eventsList = (\n <div {...getStyles('moreEventsList')}>\n {events.map((event) => (\n <ScheduleEvent\n key={event.id}\n radius={radius}\n event={event}\n size=\"md\"\n renderEventBody={renderEventBody}\n mode={mode}\n >\n {event.title}\n </ScheduleEvent>\n ))}\n </div>\n );\n\n return (\n <>\n {dropdownType === 'modal' && (\n <Modal\n opened={dropdownOpened}\n onClose={handleClose}\n unstyled={unstyled}\n radius={radius}\n title={modalTitle}\n {...modalProps}\n >\n {eventsList}\n </Modal>\n )}\n\n <Popover\n position=\"bottom-start\"\n width={260}\n opened={dropdownOpened}\n trapFocus\n returnFocus={false}\n unstyled={unstyled}\n disabled={popoverProps?.disabled || dropdownType === 'modal'}\n radius={radius}\n transitionProps={{ transition: 'pop', duration: 120 }}\n offset={-46}\n id={id}\n {...popoverProps}\n onChange={(_opened) => {\n if (!_opened) {\n popoverProps?.onChange?.(_opened);\n handleClose();\n }\n }}\n >\n <Popover.Target>\n <UnstyledButton\n {...getStyles('moreEventsButton')}\n mod={{ static: mode === 'static' }}\n onClick={() => dropdownHandlers.toggle()}\n {...others}\n >\n {getLabel('moreLabel', labels)(moreEventsCount)}\n </UnstyledButton>\n </Popover.Target>\n\n <Popover.Dropdown {...getStyles('moreEventsDropdown')}>{eventsList}</Popover.Dropdown>\n </Popover>\n </>\n );\n});\n\nMoreEvents.displayName = '@mantine/schedule/MoreEvents';\nMoreEvents.classes = classes;\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"MoreEvents.mjs","names":["classes"],"sources":["../../../src/components/MoreEvents/MoreEvents.tsx"],"sourcesContent":["import {\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineRadius,\n Modal,\n ModalProps,\n Popover,\n PopoverProps,\n StylesApiProps,\n UnstyledButton,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useDisclosure } from '@mantine/hooks';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { ScheduleEventData, ScheduleMode } from '../../types';\nimport { RenderEvent, RenderEventBody, ScheduleEvent } from '../ScheduleEvent/ScheduleEvent';\nimport classes from './MoreEvents.module.css';\n\nexport type MoreEventsDropdownType = 'popover' | 'modal';\n\nexport type MoreEventsStylesNames = 'moreEventsButton' | 'moreEventsList' | 'moreEventsDropdown';\n\nexport interface MoreEventsProps\n extends BoxProps, StylesApiProps<MoreEventsFactory>, ElementProps<'button'> {\n /** List of events to display */\n events: ScheduleEventData[];\n\n /** Events count to use for `+X more` label */\n moreEventsCount: number;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Title for the Modal component, ignored if `dropdownType` is not 'modal' */\n modalTitle?: string;\n\n /** Type of dropdown to use for displaying more events @default 'popover' */\n dropdownType?: MoreEventsDropdownType;\n\n /** Props passed down to `Popover` component */\n popoverProps?: Partial<Omit<PopoverProps, 'children'>>;\n\n /** Props passed down to `Modal` component */\n modalProps?: Partial<Omit<ModalProps, 'children'>>;\n\n /** Called when the dropdown is closed */\n onDropdownClose?: () => void;\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 /** Labels override */\n labels?: ScheduleLabelsOverride;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** Called when an event inside the dropdown is clicked */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport type MoreEventsFactory = Factory<{\n props: MoreEventsProps;\n ref: HTMLButtonElement;\n stylesNames: MoreEventsStylesNames;\n}>;\n\nconst defaultProps = {\n dropdownType: 'popover',\n} satisfies Partial<MoreEventsProps>;\n\nexport const MoreEvents = factory<MoreEventsFactory>((_props) => {\n const props = useProps('MoreEvents', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n radius,\n dropdownType,\n events,\n moreEventsCount,\n popoverProps,\n modalProps,\n onDropdownClose,\n children,\n modalTitle,\n renderEventBody,\n renderEvent,\n id,\n labels,\n mode,\n onEventClick,\n ...others\n } = props;\n const [dropdownOpened, dropdownHandlers] = useDisclosure();\n\n const getStyles = useStyles<MoreEventsFactory>({\n name: 'MoreEvents',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n rootSelector: 'moreEventsButton',\n });\n\n const handleClose = () => {\n dropdownHandlers.close();\n onDropdownClose?.();\n };\n\n const eventsList = (\n <div {...getStyles('moreEventsList')}>\n {events.map((event) => (\n <ScheduleEvent\n key={event.id}\n radius={radius}\n event={event}\n size=\"md\"\n renderEventBody={renderEventBody}\n renderEvent={renderEvent}\n mode={mode}\n onClick={onEventClick ? (e) => onEventClick(event, e) : undefined}\n >\n {event.title}\n </ScheduleEvent>\n ))}\n </div>\n );\n\n return (\n <>\n {dropdownType === 'modal' && (\n <Modal\n opened={dropdownOpened}\n onClose={handleClose}\n unstyled={unstyled}\n radius={radius}\n title={modalTitle}\n {...modalProps}\n >\n {eventsList}\n </Modal>\n )}\n\n <Popover\n position=\"bottom-start\"\n width={260}\n opened={dropdownOpened}\n trapFocus\n returnFocus={false}\n unstyled={unstyled}\n disabled={popoverProps?.disabled || dropdownType === 'modal'}\n radius={radius}\n transitionProps={{ transition: 'pop', duration: 120 }}\n offset={-46}\n id={id}\n {...popoverProps}\n onChange={(_opened) => {\n if (!_opened) {\n popoverProps?.onChange?.(_opened);\n handleClose();\n }\n }}\n >\n <Popover.Target>\n <UnstyledButton\n {...getStyles('moreEventsButton')}\n mod={{ static: mode === 'static' }}\n onClick={() => dropdownHandlers.toggle()}\n {...others}\n >\n {getLabel('moreLabel', labels)(moreEventsCount)}\n </UnstyledButton>\n </Popover.Target>\n\n <Popover.Dropdown {...getStyles('moreEventsDropdown')}>{eventsList}</Popover.Dropdown>\n </Popover>\n </>\n );\n});\n\nMoreEvents.displayName = '@mantine/schedule/MoreEvents';\nMoreEvents.classes = classes;\n"],"mappings":";;;;;;;;AAyEA,MAAM,eAAe,EACnB,cAAc,WACf;AAED,MAAa,aAAa,SAA4B,WAAW;CAC/D,MAAM,QAAQ,SAAS,cAAc,cAAc,OAAO;CAC1D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,YACA,QACA,cACA,QACA,iBACA,cACA,YACA,iBACA,UACA,YACA,iBACA,aACA,IACA,QACA,MACA,cACA,GAAG,WACD;CACJ,MAAM,CAAC,gBAAgB,oBAAoB,eAAe;CAE1D,MAAM,YAAY,UAA6B;EAC7C,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACf,CAAC;CAEF,MAAM,oBAAoB;AACxB,mBAAiB,OAAO;AACxB,qBAAmB;;CAGrB,MAAM,aACJ,oBAAC,OAAD;EAAK,GAAI,UAAU,iBAAiB;YACjC,OAAO,KAAK,UACX,oBAAC,eAAD;GAEU;GACD;GACP,MAAK;GACY;GACJ;GACP;GACN,SAAS,gBAAgB,MAAM,aAAa,OAAO,EAAE,GAAG,KAAA;aAEvD,MAAM;GACO,EAVT,MAAM,GAUG,CAChB;EACE,CAAA;AAGR,QACE,qBAAA,UAAA,EAAA,UAAA,CACG,iBAAiB,WAChB,oBAAC,OAAD;EACE,QAAQ;EACR,SAAS;EACC;EACF;EACR,OAAO;EACP,GAAI;YAEH;EACK,CAAA,EAGV,qBAAC,SAAD;EACE,UAAS;EACT,OAAO;EACP,QAAQ;EACR,WAAA;EACA,aAAa;EACH;EACV,UAAU,cAAc,YAAY,iBAAiB;EAC7C;EACR,iBAAiB;GAAE,YAAY;GAAO,UAAU;GAAK;EACrD,QAAQ;EACJ;EACJ,GAAI;EACJ,WAAW,YAAY;AACrB,OAAI,CAAC,SAAS;AACZ,kBAAc,WAAW,QAAQ;AACjC,iBAAa;;;YAhBnB,CAoBE,oBAAC,QAAQ,QAAT,EAAA,UACE,oBAAC,gBAAD;GACE,GAAI,UAAU,mBAAmB;GACjC,KAAK,EAAE,QAAQ,SAAS,UAAU;GAClC,eAAe,iBAAiB,QAAQ;GACxC,GAAI;aAEH,SAAS,aAAa,OAAO,CAAC,gBAAgB;GAChC,CAAA,EACF,CAAA,EAEjB,oBAAC,QAAQ,UAAT;GAAkB,GAAI,UAAU,qBAAqB;aAAG;GAA8B,CAAA,CAC9E;IACT,EAAA,CAAA;EAEL;AAEF,WAAW,cAAc;AACzB,WAAW,UAAUA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getLabel } from "../../../labels.mjs";
|
|
3
|
+
import { useScheduleHeaderLabels } from "../ScheduleHeaderContext.mjs";
|
|
3
4
|
import HeaderControl_module_default from "./HeaderControl.module.mjs";
|
|
4
5
|
import { AccordionChevron, UnstyledButton, createVarsResolver, factory, getRadius, useDirection, useProps, useStyles } from "@mantine/core";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -11,7 +12,7 @@ const defaultProps = {
|
|
|
11
12
|
const varsResolver = createVarsResolver((_theme, { radius }) => ({ headerControl: { "--control-radius": radius === void 0 ? void 0 : getRadius(radius) } }));
|
|
12
13
|
const HeaderControl = factory((_props) => {
|
|
13
14
|
const props = useProps("HeaderControl", defaultProps, _props);
|
|
14
|
-
const { classNames, className, style, styles, unstyled, vars, __staticSelector, mod, attributes, active, square, radius, interactive, ...others } = props;
|
|
15
|
+
const { classNames, className, style, styles, unstyled, vars, __staticSelector, mod, attributes, active, square, radius, interactive, labels, ...others } = props;
|
|
15
16
|
return /* @__PURE__ */ jsx(UnstyledButton, {
|
|
16
17
|
...useStyles({
|
|
17
18
|
name: __staticSelector,
|
|
@@ -43,7 +44,7 @@ function ScheduleHeaderNext(props) {
|
|
|
43
44
|
const { dir } = useDirection();
|
|
44
45
|
return /* @__PURE__ */ jsx(HeaderControl, {
|
|
45
46
|
"data-type": "next",
|
|
46
|
-
"aria-label": getLabel("next", props.labels),
|
|
47
|
+
"aria-label": getLabel("next", useScheduleHeaderLabels(props.labels)),
|
|
47
48
|
square: true,
|
|
48
49
|
...props,
|
|
49
50
|
children: /* @__PURE__ */ jsx(AccordionChevron, { style: { transform: `rotate(${dir === "rtl" ? 90 : -90}deg)` } })
|
|
@@ -53,18 +54,19 @@ function ScheduleHeaderPrevious(props) {
|
|
|
53
54
|
const { dir } = useDirection();
|
|
54
55
|
return /* @__PURE__ */ jsx(HeaderControl, {
|
|
55
56
|
"data-type": "previous",
|
|
56
|
-
"aria-label": getLabel("previous", props.labels),
|
|
57
|
+
"aria-label": getLabel("previous", useScheduleHeaderLabels(props.labels)),
|
|
57
58
|
square: true,
|
|
58
59
|
...props,
|
|
59
60
|
children: /* @__PURE__ */ jsx(AccordionChevron, { style: { transform: `rotate(${dir === "rtl" ? -90 : 90}deg)` } })
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
function ScheduleHeaderToday(props) {
|
|
64
|
+
const resolvedLabels = useScheduleHeaderLabels(props.labels);
|
|
63
65
|
return /* @__PURE__ */ jsx(HeaderControl, {
|
|
64
66
|
"data-type": "today",
|
|
65
|
-
"aria-label": getLabel("today",
|
|
67
|
+
"aria-label": getLabel("today", resolvedLabels),
|
|
66
68
|
...props,
|
|
67
|
-
children: getLabel("today",
|
|
69
|
+
children: getLabel("today", resolvedLabels)
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
ScheduleHeaderNext.displayName = "@mantine/schedule/ScheduleHeaderNext";
|