@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
|
@@ -425,7 +425,10 @@ const DayView = (0, _mantine_core.factory)((_props) => {
|
|
|
425
425
|
events: eventsData.allDayEvents,
|
|
426
426
|
moreEventsCount: allDayEventsCount.hiddenEventsCount,
|
|
427
427
|
renderEventBody,
|
|
428
|
+
renderEvent,
|
|
428
429
|
mode,
|
|
430
|
+
labels,
|
|
431
|
+
onEventClick,
|
|
429
432
|
...stylesApiProps,
|
|
430
433
|
...moreEventsProps
|
|
431
434
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayView.cjs","names":["getDayTimeIntervals","useSlotDragSelect","getDayViewEvents","expandRecurringEvents","useDragDropHandlers","calculateDropTime","useEventResize","isAllDayEvent","ScheduleEvent","getVisibleEvents","UnstyledButton","getBusinessHoursMod","clampIntervalMinutes","getLabel","formatDate","Box","ScheduleHeaderBase","toDateString","ScrollArea","MoreEvents","CurrentTimeIndicator","DragContext","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,gBAAA,GAAA,cAAA,qBACH,QAAQ,EAAE,QAAQ,YAAY,wBAAwB,EACrD,SAAS;CACP,qBAAqB,WAAW,KAAA,KAAA,GAAA,cAAA,WAAsB,OAAO,GAAG,KAAA;CAChE,2BAAA,GAAA,cAAA,KAA8B,WAAW;CACzC,mCAAA,GAAA,cAAA,KAAsC,iBAAiB;CACxD,EACF,EACF;AAED,MAAa,WAAA,GAAA,cAAA,UAAmC,WAAW;CACzD,MAAM,SAAA,GAAA,cAAA,UAAiB,WAAW,cAAc,OAAO;CACvD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,YACA,MACA,kBACA,WACA,SACA,iBACA,gBACA,MACA,QACA,iBACA,cACA,4BAAA,GAAA,MAAA,SAAiC,KAAK,CAAC,QAAA,GAAA,MAAA,UAAc,EAAE,MAAM,EAC7D,uBACA,YACA,QACA,cACA,cACA,sBACA,kBACA,mBACA,iBACA,YACA,kBACA,iBACA,QACA,iBACA,iBACA,aACA,QACA,wBACA,eACA,uBACA,aACA,cACA,kBACA,gBACA,iBACA,mBACA,cACA,oBACA,eACA,MACA,iBACA,qBACA,iBACA,eACA,gBACA,0BACA,kBACA,GAAG,WACD;CAEJ,M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AyBG;OAEA;OAEA,4BACC,iBAAA,GAAA,kBAAA,KAACO,6BAAAA,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,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,QAAQ,cAAc;AACtB,QAAQ,UAAUC,uBAAAA;AAClB,QAAQ,eAAe"}
|
|
1
|
+
{"version":3,"file":"DayView.cjs","names":["getDayTimeIntervals","useSlotDragSelect","getDayViewEvents","expandRecurringEvents","useDragDropHandlers","calculateDropTime","useEventResize","isAllDayEvent","ScheduleEvent","getVisibleEvents","UnstyledButton","getBusinessHoursMod","clampIntervalMinutes","getLabel","formatDate","Box","ScheduleHeaderBase","toDateString","ScrollArea","MoreEvents","CurrentTimeIndicator","DragContext","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,gBAAA,GAAA,cAAA,qBACH,QAAQ,EAAE,QAAQ,YAAY,wBAAwB,EACrD,SAAS;CACP,qBAAqB,WAAW,KAAA,KAAA,GAAA,cAAA,WAAsB,OAAO,GAAG,KAAA;CAChE,2BAAA,GAAA,cAAA,KAA8B,WAAW;CACzC,mCAAA,GAAA,cAAA,KAAsC,iBAAiB;CACxD,EACF,EACF;AAED,MAAa,WAAA,GAAA,cAAA,UAAmC,WAAW;CACzD,MAAM,SAAA,GAAA,cAAA,UAAiB,WAAW,cAAc,OAAO;CACvD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,YACA,MACA,kBACA,WACA,SACA,iBACA,gBACA,MACA,QACA,iBACA,cACA,4BAAA,GAAA,MAAA,SAAiC,KAAK,CAAC,QAAA,GAAA,MAAA,UAAc,EAAE,MAAM,EA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,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,iBAAA,GAAA,kBAAA,KAACO,6BAAAA,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,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,QAAQ,cAAc;AACtB,QAAQ,UAAUC,uBAAAA;AAClB,QAAQ,eAAe"}
|
|
@@ -274,6 +274,10 @@ const MonthView = (0, _mantine_core.factory)((_props) => {
|
|
|
274
274
|
events: dayEvents,
|
|
275
275
|
moreEventsCount: hiddenEventsCount,
|
|
276
276
|
mode,
|
|
277
|
+
labels,
|
|
278
|
+
renderEventBody,
|
|
279
|
+
renderEvent,
|
|
280
|
+
onEventClick,
|
|
277
281
|
style: {
|
|
278
282
|
position: "absolute",
|
|
279
283
|
top: `calc(100% - 2px)`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonthView.cjs","names":["getMonthRange","getMonthViewEvents","expandRecurringEvents","useDragDropHandlers","calculateMonthDropDate","useSlotDragSelect","getMonthDays","isSameMonth","getWeekdaysNames","UnstyledButton","getWeekNumber","Box","ScheduleEvent","MoreEvents","toDateString","ScheduleHeaderBase","ScrollArea","DragContext","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,gBAAA,GAAA,cAAA,qBACH,QAAQ,EAAE,QAAQ,uBAAuB,EACxC,WAAW;CACT,uBAAuB,WAAW,KAAA,KAAA,GAAA,cAAA,WAAsB,OAAO,GAAG,KAAA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C9E,gBAAgB,UACd,eAAeA,uBAAAA,cAAAA,GAAAA,MAAAA,SAAmB,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,QAAQ,QAAQ,CAAC,CAAC;IAChF,GAAG;IACJ,EACF;GACO;GACM;GACA;GACQ;GACJ;GACC;GACF;GACD;GAChB,CAAA,EAGJ,iBAAA,GAAA,kBAAA,KAACE,cAAAA,YAAD;GACE,eAAe;GACf,GAAI;GACJ,GAAI,UAAU,uBAAuB;IACnC,WAAW,iBAAiB;IAC5B,OAAO,iBAAiB;IACzB,CAAC;aAEF,iBAAA,GAAA,kBAAA,MAAC,OAAD;IAAK,GAAI,UAAU,iBAAiB;cAApC,CACG,YACC,iBAAA,GAAA,kBAAA,MAAC,OAAD;KAAK,GAAI,UAAU,oBAAoB;eAAvC,CACG,mBAAmB,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,GAAI,UAAU,0BAA0B,EAAI,CAAA,EACpE,SACG;QAGP,MACG;;GACK,CAAA,CACT;;AAGR,KAAI,sBACF,QAAO,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,UAAU,cAAc;AACxB,UAAU,UAAUC,yBAAAA;AACpB,UAAU,eAAe"}
|
|
1
|
+
{"version":3,"file":"MonthView.cjs","names":["getMonthRange","getMonthViewEvents","expandRecurringEvents","useDragDropHandlers","calculateMonthDropDate","useSlotDragSelect","getMonthDays","isSameMonth","getWeekdaysNames","UnstyledButton","getWeekNumber","Box","ScheduleEvent","MoreEvents","toDateString","ScheduleHeaderBase","ScrollArea","DragContext","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,gBAAA,GAAA,cAAA,qBACH,QAAQ,EAAE,QAAQ,uBAAuB,EACxC,WAAW;CACT,uBAAuB,WAAW,KAAA,KAAA,GAAA,cAAA,WAAsB,OAAO,GAAG,KAAA;CAClE,2BACE,oBAAoB,KAAA,IAAY,GAAG,KAAK,IAAI,IAAI,KAAK,IAAI,GAAG,gBAAgB,CAAC,KAAK,KAAA;CACr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AI,SAAS,MAAM,CAAC,QAAQ,QAAQ,CAAC,CAAC;IAChF,GAAG;IACJ,EACF;GACO;GACM;GACA;GACQ;GACJ;GACC;GACF;GACD;GAChB,CAAA,EAGJ,iBAAA,GAAA,kBAAA,KAACE,cAAAA,YAAD;GACE,eAAe;GACf,GAAI;GACJ,GAAI,UAAU,uBAAuB;IACnC,WAAW,iBAAiB;IAC5B,OAAO,iBAAiB;IACzB,CAAC;aAEF,iBAAA,GAAA,kBAAA,MAAC,OAAD;IAAK,GAAI,UAAU,iBAAiB;cAApC,CACG,YACC,iBAAA,GAAA,kBAAA,MAAC,OAAD;KAAK,GAAI,UAAU,oBAAoB;eAAvC,CACG,mBAAmB,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,GAAI,UAAU,0BAA0B,EAAI,CAAA,EACpE,SACG;QAGP,MACG;;GACK,CAAA,CACT;;AAGR,KAAI,sBACF,QAAO,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAY,UAAb;EAAsB,OAAO,SAAS;YAAmB;EAA+B,CAAA;AAGjG,QAAO;EACP;AAEF,UAAU,cAAc;AACxB,UAAU,UAAUC,yBAAAA;AACpB,UAAU,eAAe"}
|
|
@@ -10,7 +10,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
10
10
|
const defaultProps = { dropdownType: "popover" };
|
|
11
11
|
const MoreEvents = (0, _mantine_core.factory)((_props) => {
|
|
12
12
|
const props = (0, _mantine_core.useProps)("MoreEvents", defaultProps, _props);
|
|
13
|
-
const { classNames, className, style, styles, unstyled, vars, attributes, radius, dropdownType, events, moreEventsCount, popoverProps, modalProps, onDropdownClose, children, modalTitle, renderEventBody, id, labels, mode, ...others } = props;
|
|
13
|
+
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;
|
|
14
14
|
const [dropdownOpened, dropdownHandlers] = (0, _mantine_hooks.useDisclosure)();
|
|
15
15
|
const getStyles = (0, _mantine_core.useStyles)({
|
|
16
16
|
name: "MoreEvents",
|
|
@@ -36,7 +36,9 @@ const MoreEvents = (0, _mantine_core.factory)((_props) => {
|
|
|
36
36
|
event,
|
|
37
37
|
size: "md",
|
|
38
38
|
renderEventBody,
|
|
39
|
+
renderEvent,
|
|
39
40
|
mode,
|
|
41
|
+
onClick: onEventClick ? (e) => onEventClick(event, e) : void 0,
|
|
40
42
|
children: event.title
|
|
41
43
|
}, event.id))
|
|
42
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoreEvents.cjs","names":["ScheduleEvent","Modal","Popover","UnstyledButton","getLabel","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.cjs","names":["ScheduleEvent","Modal","Popover","UnstyledButton","getLabel","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,cAAA,GAAA,cAAA,UAAyC,WAAW;CAC/D,MAAM,SAAA,GAAA,cAAA,UAAiB,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,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QAAQ;GACxC,GAAI;aAEHC,eAAAA,SAAS,aAAa,OAAO,CAAC,gBAAgB;GAChC,CAAA,EACF,CAAA,EAEjB,iBAAA,GAAA,kBAAA,KAACF,cAAAA,QAAQ,UAAT;GAAkB,GAAI,UAAU,qBAAqB;aAAG;GAA8B,CAAA,CAC9E;IACT,EAAA,CAAA;EAEL;AAEF,WAAW,cAAc;AACzB,WAAW,UAAUG,0BAAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_labels = require("../../../labels.cjs");
|
|
4
|
+
const require_ScheduleHeaderContext = require("../ScheduleHeaderContext.cjs");
|
|
4
5
|
const require_HeaderControl_module = require("./HeaderControl.module.cjs");
|
|
5
6
|
let _mantine_core = require("@mantine/core");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -12,7 +13,7 @@ const defaultProps = {
|
|
|
12
13
|
const varsResolver = (0, _mantine_core.createVarsResolver)((_theme, { radius }) => ({ headerControl: { "--control-radius": radius === void 0 ? void 0 : (0, _mantine_core.getRadius)(radius) } }));
|
|
13
14
|
const HeaderControl = (0, _mantine_core.factory)((_props) => {
|
|
14
15
|
const props = (0, _mantine_core.useProps)("HeaderControl", defaultProps, _props);
|
|
15
|
-
const { classNames, className, style, styles, unstyled, vars, __staticSelector, mod, attributes, active, square, radius, interactive, ...others } = props;
|
|
16
|
+
const { classNames, className, style, styles, unstyled, vars, __staticSelector, mod, attributes, active, square, radius, interactive, labels, ...others } = props;
|
|
16
17
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.UnstyledButton, {
|
|
17
18
|
...(0, _mantine_core.useStyles)({
|
|
18
19
|
name: __staticSelector,
|
|
@@ -44,7 +45,7 @@ function ScheduleHeaderNext(props) {
|
|
|
44
45
|
const { dir } = (0, _mantine_core.useDirection)();
|
|
45
46
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderControl, {
|
|
46
47
|
"data-type": "next",
|
|
47
|
-
"aria-label": require_labels.getLabel("next", props.labels),
|
|
48
|
+
"aria-label": require_labels.getLabel("next", require_ScheduleHeaderContext.useScheduleHeaderLabels(props.labels)),
|
|
48
49
|
square: true,
|
|
49
50
|
...props,
|
|
50
51
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.AccordionChevron, { style: { transform: `rotate(${dir === "rtl" ? 90 : -90}deg)` } })
|
|
@@ -54,18 +55,19 @@ function ScheduleHeaderPrevious(props) {
|
|
|
54
55
|
const { dir } = (0, _mantine_core.useDirection)();
|
|
55
56
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderControl, {
|
|
56
57
|
"data-type": "previous",
|
|
57
|
-
"aria-label": require_labels.getLabel("previous", props.labels),
|
|
58
|
+
"aria-label": require_labels.getLabel("previous", require_ScheduleHeaderContext.useScheduleHeaderLabels(props.labels)),
|
|
58
59
|
square: true,
|
|
59
60
|
...props,
|
|
60
61
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.AccordionChevron, { style: { transform: `rotate(${dir === "rtl" ? -90 : 90}deg)` } })
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
function ScheduleHeaderToday(props) {
|
|
65
|
+
const resolvedLabels = require_ScheduleHeaderContext.useScheduleHeaderLabels(props.labels);
|
|
64
66
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HeaderControl, {
|
|
65
67
|
"data-type": "today",
|
|
66
|
-
"aria-label": require_labels.getLabel("today",
|
|
68
|
+
"aria-label": require_labels.getLabel("today", resolvedLabels),
|
|
67
69
|
...props,
|
|
68
|
-
children: require_labels.getLabel("today",
|
|
70
|
+
children: require_labels.getLabel("today", resolvedLabels)
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
ScheduleHeaderNext.displayName = "@mantine/schedule/ScheduleHeaderNext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderControl.cjs","names":["UnstyledButton","classes","getLabel","AccordionChevron"],"sources":["../../../../src/components/ScheduleHeader/HeaderControl/HeaderControl.tsx"],"sourcesContent":["import {\n AccordionChevron,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useDirection,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport classes from './HeaderControl.module.css';\n\nexport type HeaderControlStylesNames = 'headerControl';\nexport type HeaderControlCssVariables = {\n headerControl: '--control-radius';\n};\n\nexport interface HeaderControlProps\n extends BoxProps, StylesApiProps<HeaderControlFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Applies active styles */\n active?: boolean;\n\n /** Removes inline padding */\n square?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set to `false`, the control will not be clickable */\n interactive?: boolean;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type HeaderControlFactory = Factory<{\n props: HeaderControlProps;\n ref: HTMLButtonElement;\n stylesNames: HeaderControlStylesNames;\n vars: HeaderControlCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'HeaderControl',\n interactive: true,\n} satisfies Partial<HeaderControlProps>;\n\nconst varsResolver = createVarsResolver<HeaderControlFactory>((_theme, { radius }) => ({\n headerControl: {\n '--control-radius': radius === undefined ? undefined : getRadius(radius),\n },\n}));\n\nexport const HeaderControl = factory<HeaderControlFactory>((_props) => {\n const props = useProps('HeaderControl', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n __staticSelector,\n mod,\n attributes,\n active,\n square,\n radius,\n interactive,\n ...others\n } = props;\n\n const getStyles = useStyles<HeaderControlFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'headerControl',\n });\n\n return (\n <UnstyledButton\n {...getStyles('headerControl', { active: interactive })}\n mod={[{ active, square, interactive }, mod]}\n tabIndex={interactive ? undefined : -1}\n {...others}\n />\n );\n});\n\nHeaderControl.displayName = '@mantine/schedule/HeaderControl';\nHeaderControl.classes = classes;\nHeaderControl.varsResolver = varsResolver;\n\nexport function ScheduleHeaderNext(props: HeaderControlProps) {\n const { dir } = useDirection();\n\n return (\n <HeaderControl data-type=\"next\" aria-label={getLabel('next',
|
|
1
|
+
{"version":3,"file":"HeaderControl.cjs","names":["UnstyledButton","classes","getLabel","useScheduleHeaderLabels","AccordionChevron"],"sources":["../../../../src/components/ScheduleHeader/HeaderControl/HeaderControl.tsx"],"sourcesContent":["import {\n AccordionChevron,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useDirection,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport { useScheduleHeaderLabels } from '../ScheduleHeaderContext';\nimport classes from './HeaderControl.module.css';\n\nexport type HeaderControlStylesNames = 'headerControl';\nexport type HeaderControlCssVariables = {\n headerControl: '--control-radius';\n};\n\nexport interface HeaderControlProps\n extends BoxProps, StylesApiProps<HeaderControlFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Applies active styles */\n active?: boolean;\n\n /** Removes inline padding */\n square?: boolean;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** If set to `false`, the control will not be clickable */\n interactive?: boolean;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type HeaderControlFactory = Factory<{\n props: HeaderControlProps;\n ref: HTMLButtonElement;\n stylesNames: HeaderControlStylesNames;\n vars: HeaderControlCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'HeaderControl',\n interactive: true,\n} satisfies Partial<HeaderControlProps>;\n\nconst varsResolver = createVarsResolver<HeaderControlFactory>((_theme, { radius }) => ({\n headerControl: {\n '--control-radius': radius === undefined ? undefined : getRadius(radius),\n },\n}));\n\nexport const HeaderControl = factory<HeaderControlFactory>((_props) => {\n const props = useProps('HeaderControl', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n __staticSelector,\n mod,\n attributes,\n active,\n square,\n radius,\n interactive,\n labels,\n ...others\n } = props;\n\n const getStyles = useStyles<HeaderControlFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n rootSelector: 'headerControl',\n });\n\n return (\n <UnstyledButton\n {...getStyles('headerControl', { active: interactive })}\n mod={[{ active, square, interactive }, mod]}\n tabIndex={interactive ? undefined : -1}\n {...others}\n />\n );\n});\n\nHeaderControl.displayName = '@mantine/schedule/HeaderControl';\nHeaderControl.classes = classes;\nHeaderControl.varsResolver = varsResolver;\n\nexport function ScheduleHeaderNext(props: HeaderControlProps) {\n const { dir } = useDirection();\n const resolvedLabels = useScheduleHeaderLabels(props.labels);\n\n return (\n <HeaderControl data-type=\"next\" aria-label={getLabel('next', resolvedLabels)} square {...props}>\n <AccordionChevron style={{ transform: `rotate(${dir === 'rtl' ? 90 : -90}deg)` }} />\n </HeaderControl>\n );\n}\n\nexport function ScheduleHeaderPrevious(props: HeaderControlProps) {\n const { dir } = useDirection();\n const resolvedLabels = useScheduleHeaderLabels(props.labels);\n\n return (\n <HeaderControl\n data-type=\"previous\"\n aria-label={getLabel('previous', resolvedLabels)}\n square\n {...props}\n >\n <AccordionChevron style={{ transform: `rotate(${dir === 'rtl' ? -90 : 90}deg)` }} />\n </HeaderControl>\n );\n}\n\nexport function ScheduleHeaderToday(props: HeaderControlProps) {\n const resolvedLabels = useScheduleHeaderLabels(props.labels);\n\n return (\n <HeaderControl data-type=\"today\" aria-label={getLabel('today', resolvedLabels)} {...props}>\n {getLabel('today', resolvedLabels)}\n </HeaderControl>\n );\n}\n\nScheduleHeaderNext.displayName = '@mantine/schedule/ScheduleHeaderNext';\nScheduleHeaderPrevious.displayName = '@mantine/schedule/ScheduleHeaderPrevious';\nScheduleHeaderToday.displayName = '@mantine/schedule/ScheduleHeaderToday';\n"],"mappings":";;;;;;;;AAmDA,MAAM,eAAe;CACnB,kBAAkB;CAClB,aAAa;CACd;AAED,MAAM,gBAAA,GAAA,cAAA,qBAAyD,QAAQ,EAAE,cAAc,EACrF,eAAe,EACb,oBAAoB,WAAW,KAAA,IAAY,KAAA,KAAA,GAAA,cAAA,WAAsB,OAAO,EACzE,EACF,EAAE;AAEH,MAAa,iBAAA,GAAA,cAAA,UAA+C,WAAW;CACrE,MAAM,SAAA,GAAA,cAAA,UAAiB,iBAAiB,cAAc,OAAO;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,kBACA,KACA,YACA,QACA,QACA,QACA,aACA,QACA,GAAG,WACD;AAiBJ,QACE,iBAAA,GAAA,kBAAA,KAACA,cAAAA,gBAAD;EACE,IAAA,GAAA,cAAA,WAjB8C;GAChD,MAAM;GACN,SAAA,6BAAA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,cAAc;GACf,CAAC,CAIgB,iBAAiB,EAAE,QAAQ,aAAa,CAAC;EACvD,KAAK,CAAC;GAAE;GAAQ;GAAQ;GAAa,EAAE,IAAI;EAC3C,UAAU,cAAc,KAAA,IAAY;EACpC,GAAI;EACJ,CAAA;EAEJ;AAEF,cAAc,cAAc;AAC5B,cAAc,UAAUC,6BAAAA;AACxB,cAAc,eAAe;AAE7B,SAAgB,mBAAmB,OAA2B;CAC5D,MAAM,EAAE,SAAA,GAAA,cAAA,eAAsB;AAG9B,QACE,iBAAA,GAAA,kBAAA,KAAC,eAAD;EAAe,aAAU;EAAO,cAAYC,eAAAA,SAAS,QAHhCC,8BAAAA,wBAAwB,MAAM,OAAO,CAGkB;EAAE,QAAA;EAAO,GAAI;YACvF,iBAAA,GAAA,kBAAA,KAACC,cAAAA,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,KAAK,IAAI,OAAO,EAAI,CAAA;EACtE,CAAA;;AAIpB,SAAgB,uBAAuB,OAA2B;CAChE,MAAM,EAAE,SAAA,GAAA,cAAA,eAAsB;AAG9B,QACE,iBAAA,GAAA,kBAAA,KAAC,eAAD;EACE,aAAU;EACV,cAAYF,eAAAA,SAAS,YALFC,8BAAAA,wBAAwB,MAAM,OAAO,CAKR;EAChD,QAAA;EACA,GAAI;YAEJ,iBAAA,GAAA,kBAAA,KAACC,cAAAA,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,MAAM,GAAG,OAAO,EAAI,CAAA;EACtE,CAAA;;AAIpB,SAAgB,oBAAoB,OAA2B;CAC7D,MAAM,iBAAiBD,8BAAAA,wBAAwB,MAAM,OAAO;AAE5D,QACE,iBAAA,GAAA,kBAAA,KAAC,eAAD;EAAe,aAAU;EAAQ,cAAYD,eAAAA,SAAS,SAAS,eAAe;EAAE,GAAI;YACjFA,eAAAA,SAAS,SAAS,eAAe;EACpB,CAAA;;AAIpB,mBAAmB,cAAc;AACjC,uBAAuB,cAAc;AACrC,oBAAoB,cAAc"}
|
|
@@ -4,6 +4,7 @@ const require_labels = require("../../../labels.cjs");
|
|
|
4
4
|
const require_format_date = require("../../../utils/format-date/format-date.cjs");
|
|
5
5
|
const require_get_months_list = require("../../../utils/get-months-list/get-months-list.cjs");
|
|
6
6
|
const require_get_years_list = require("../../../utils/get-years-list/get-years-list.cjs");
|
|
7
|
+
const require_ScheduleHeaderContext = require("../ScheduleHeaderContext.cjs");
|
|
7
8
|
const require_HeaderControl = require("../HeaderControl/HeaderControl.cjs");
|
|
8
9
|
const require_MonthYearSelect_module = require("./MonthYearSelect.module.cjs");
|
|
9
10
|
let _mantine_core = require("@mantine/core");
|
|
@@ -34,6 +35,7 @@ const MonthYearSelect = (0, _mantine_core.factory)((_props) => {
|
|
|
34
35
|
rootSelector: "monthYearSelectTarget"
|
|
35
36
|
});
|
|
36
37
|
const [opened, handlers] = (0, _mantine_hooks.useDisclosure)(false);
|
|
38
|
+
const resolvedLabels = require_ScheduleHeaderContext.useScheduleHeaderLabels(labels);
|
|
37
39
|
const today = /* @__PURE__ */ new Date();
|
|
38
40
|
const ctx = (0, _mantine_dates.useDatesContext)();
|
|
39
41
|
const _startYear = startYear ?? today.getFullYear() - 5;
|
|
@@ -53,7 +55,7 @@ const MonthYearSelect = (0, _mantine_core.factory)((_props) => {
|
|
|
53
55
|
type: "year",
|
|
54
56
|
active: year === yearValue
|
|
55
57
|
},
|
|
56
|
-
"aria-label": `${require_labels.getLabel("selectYear",
|
|
58
|
+
"aria-label": `${require_labels.getLabel("selectYear", resolvedLabels)} ${year}`,
|
|
57
59
|
tabIndex: hasActiveYear ? year === yearValue ? 0 : -1 : index === 0 ? 0 : -1,
|
|
58
60
|
...controlProps,
|
|
59
61
|
onKeyDown: (0, _mantine_core.createScopedKeydownHandler)({
|
|
@@ -96,7 +98,7 @@ const MonthYearSelect = (0, _mantine_core.factory)((_props) => {
|
|
|
96
98
|
className: controlProps?.className,
|
|
97
99
|
style: controlProps?.style
|
|
98
100
|
}),
|
|
99
|
-
"aria-label": `${require_labels.getLabel("selectMonth",
|
|
101
|
+
"aria-label": `${require_labels.getLabel("selectMonth", resolvedLabels)} ${month.name}`,
|
|
100
102
|
children: month.name
|
|
101
103
|
}, month.name);
|
|
102
104
|
}) : null;
|
|
@@ -136,14 +138,14 @@ const MonthYearSelect = (0, _mantine_core.factory)((_props) => {
|
|
|
136
138
|
...getStyles("monthYearSelectList"),
|
|
137
139
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
138
140
|
...getStyles("monthYearSelectLabel"),
|
|
139
|
-
children: require_labels.getLabel("month",
|
|
141
|
+
children: require_labels.getLabel("month", resolvedLabels)
|
|
140
142
|
}), months]
|
|
141
143
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
142
144
|
"data-list": true,
|
|
143
145
|
...getStyles("monthYearSelectList"),
|
|
144
146
|
children: [withMonths && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
145
147
|
...getStyles("monthYearSelectLabel"),
|
|
146
|
-
children: require_labels.getLabel("year",
|
|
148
|
+
children: require_labels.getLabel("year", resolvedLabels)
|
|
147
149
|
}), years]
|
|
148
150
|
})]
|
|
149
151
|
})]
|