@mantine/schedule 9.0.0-alpha.6 → 9.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/cjs/components/DayView/DayView.cjs +27 -7
  2. package/cjs/components/DayView/DayView.cjs.map +1 -1
  3. package/cjs/components/MonthView/MonthView.cjs.map +1 -1
  4. package/cjs/components/Schedule/Schedule.cjs.map +1 -1
  5. package/cjs/components/WeekView/WeekView.cjs +16 -3
  6. package/cjs/components/WeekView/WeekView.cjs.map +1 -1
  7. package/cjs/components/WeekView/WeekViewDay.cjs +14 -3
  8. package/cjs/components/WeekView/WeekViewDay.cjs.map +1 -1
  9. package/cjs/hooks/use-drag-drop-handlers.cjs +6 -1
  10. package/cjs/hooks/use-drag-drop-handlers.cjs.map +1 -1
  11. package/cjs/hooks/use-event-resize.cjs +7 -2
  12. package/cjs/hooks/use-event-resize.cjs.map +1 -1
  13. package/esm/components/DayView/DayView.mjs +27 -7
  14. package/esm/components/DayView/DayView.mjs.map +1 -1
  15. package/esm/components/MonthView/MonthView.mjs.map +1 -1
  16. package/esm/components/Schedule/Schedule.mjs.map +1 -1
  17. package/esm/components/WeekView/WeekView.mjs +16 -3
  18. package/esm/components/WeekView/WeekView.mjs.map +1 -1
  19. package/esm/components/WeekView/WeekViewDay.mjs +14 -3
  20. package/esm/components/WeekView/WeekViewDay.mjs.map +1 -1
  21. package/esm/hooks/use-drag-drop-handlers.mjs +6 -1
  22. package/esm/hooks/use-drag-drop-handlers.mjs.map +1 -1
  23. package/esm/hooks/use-event-resize.mjs +7 -2
  24. package/esm/hooks/use-event-resize.mjs.map +1 -1
  25. package/lib/components/DayView/DayView.d.ts +22 -3
  26. package/lib/components/MonthView/MonthView.d.ts +6 -1
  27. package/lib/components/Schedule/Schedule.d.ts +17 -3
  28. package/lib/components/WeekView/WeekView.d.ts +22 -3
  29. package/lib/components/WeekView/WeekViewDay.d.ts +7 -2
  30. package/lib/hooks/use-drag-drop-handlers.d.ts +6 -1
  31. package/lib/hooks/use-event-resize.d.ts +15 -2
  32. package/package.json +4 -4
@@ -80,7 +80,12 @@ export interface WeekViewProps extends BoxProps, StylesApiProps<WeekViewFactory>
80
80
  /** If true, events can be dragged and dropped @default false */
81
81
  withEventsDragAndDrop?: boolean;
82
82
  /** Called when event is dropped at new time */
83
- onEventDrop?: (eventId: string | number, newStart: DateTimeStringValue, newEnd: DateTimeStringValue, event: ScheduleEventData) => void;
83
+ onEventDrop?: (data: {
84
+ eventId: string | number;
85
+ newStart: DateTimeStringValue;
86
+ newEnd: DateTimeStringValue;
87
+ event: ScheduleEventData;
88
+ }) => void;
84
89
  /** Function to determine if event can be dragged */
85
90
  canDragEvent?: (event: ScheduleEventData) => boolean;
86
91
  /** Called when any event drag starts */
@@ -88,7 +93,11 @@ export interface WeekViewProps extends BoxProps, StylesApiProps<WeekViewFactory>
88
93
  /** Called when any event drag ends */
89
94
  onEventDragEnd?: () => void;
90
95
  /** Called when time slot is clicked */
91
- onTimeSlotClick?: (slotStart: DateTimeStringValue, slotEnd: DateTimeStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;
96
+ onTimeSlotClick?: (data: {
97
+ slotStart: DateTimeStringValue;
98
+ slotEnd: DateTimeStringValue;
99
+ nativeEvent: React.MouseEvent<HTMLButtonElement>;
100
+ }) => void;
92
101
  /** Called when all-day slot is clicked */
93
102
  onAllDaySlotClick?: (day: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;
94
103
  /** Called when event is clicked */
@@ -111,11 +120,21 @@ export interface WeekViewProps extends BoxProps, StylesApiProps<WeekViewFactory>
111
120
  /** If true, events can be resized by dragging their edges @default false */
112
121
  withEventResize?: boolean;
113
122
  /** Called when event is resized */
114
- onEventResize?: (eventId: string | number, newStart: DateTimeStringValue, newEnd: DateTimeStringValue, event: ScheduleEventData) => void;
123
+ onEventResize?: (data: {
124
+ eventId: string | number;
125
+ newStart: DateTimeStringValue;
126
+ newEnd: DateTimeStringValue;
127
+ event: ScheduleEventData;
128
+ }) => void;
115
129
  /** Function to determine if event can be resized */
116
130
  canResizeEvent?: (event: ScheduleEventData) => boolean;
117
131
  /** Max number of generated recurring instances per recurring series @default 2000 */
118
132
  recurrenceExpansionLimit?: number;
133
+ /** 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. */
134
+ getTimeSlotProps?: (data: {
135
+ start: DateTimeStringValue;
136
+ end: DateTimeStringValue;
137
+ }) => Record<string, any> | undefined;
119
138
  }
120
139
  export type WeekViewFactory = Factory<{
121
140
  props: WeekViewProps;
@@ -1,6 +1,6 @@
1
1
  import { GetStylesApi } from '@mantine/core';
2
2
  import { ScheduleLabelsOverride } from '../../labels';
3
- import { DateStringValue, DayOfWeek, ScheduleMode } from '../../types';
3
+ import { DateStringValue, DateTimeStringValue, DayOfWeek, ScheduleMode } from '../../types';
4
4
  import { DayTimeInterval } from '../../utils';
5
5
  import type { WeekViewControlsRef } from './handle-week-view-key-down';
6
6
  import type { WeekViewFactory } from './WeekView';
@@ -56,5 +56,10 @@ export interface WeekViewDayProps {
56
56
  isSlotDragSelected?: (index: number, group: string) => boolean;
57
57
  /** Ref callback for the day slots container */
58
58
  daySlotsContainerRef?: (node: HTMLDivElement | null) => void;
59
+ /** Function to get additional props for each time slot */
60
+ getTimeSlotProps?: (data: {
61
+ start: DateTimeStringValue;
62
+ end: DateTimeStringValue;
63
+ }) => Record<string, any> | undefined;
59
64
  }
60
- export declare function WeekViewDay({ day, dayIndex, slots, getStyles, weekendDays, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onDaySlotsDragOver, onDaySlotsDragLeave, onDaySlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, onFirstSlotArrowUp, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, daySlotsContainerRef, }: WeekViewDayProps): import("react/jsx-runtime").JSX.Element;
65
+ export declare function WeekViewDay({ day, dayIndex, slots, getStyles, weekendDays, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onDaySlotsDragOver, onDaySlotsDragLeave, onDaySlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, onFirstSlotArrowUp, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, daySlotsContainerRef, getTimeSlotProps, }: WeekViewDayProps): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,12 @@ export interface UseDragDropHandlersOptions<T = any> {
6
6
  /** Schedule interaction mode */
7
7
  mode: ScheduleMode;
8
8
  /** Called when event is dropped at new location */
9
- onEventDrop?: (eventId: string | number, newStart: DateTimeStringValue, newEnd: DateTimeStringValue, event: ScheduleEventData) => void;
9
+ onEventDrop?: (data: {
10
+ eventId: string | number;
11
+ newStart: DateTimeStringValue;
12
+ newEnd: DateTimeStringValue;
13
+ event: ScheduleEventData;
14
+ }) => void;
10
15
  /** Function to determine if event can be dragged */
11
16
  canDragEvent?: (event: ScheduleEventData) => boolean;
12
17
  /** Called when any event drag starts */
@@ -6,11 +6,24 @@ export interface UseEventResizeInput {
6
6
  startTime: string;
7
7
  endTime: string;
8
8
  intervalMinutes: number;
9
- onEventResize?: (eventId: string | number, newStart: DateTimeStringValue, newEnd: DateTimeStringValue, event: ScheduleEventData) => void;
9
+ onEventResize?: (data: {
10
+ eventId: string | number;
11
+ newStart: DateTimeStringValue;
12
+ newEnd: DateTimeStringValue;
13
+ event: ScheduleEventData;
14
+ }) => void;
10
15
  canResizeEvent?: (event: ScheduleEventData) => boolean;
11
16
  }
12
17
  export declare function useEventResize({ enabled, mode, startTime, endTime, intervalMinutes, onEventResize, canResizeEvent, }: UseEventResizeInput): {
13
- handleResizeStart: (event: ScheduleEventData, edge: ResizeEdge, container: HTMLElement, originalTop: number, originalHeight: number, eventDate: string, pointerEvent: React.PointerEvent) => void;
18
+ handleResizeStart: ({ event, edge, container, originalTop, originalHeight, eventDate, pointerEvent, }: {
19
+ event: ScheduleEventData;
20
+ edge: ResizeEdge;
21
+ container: HTMLElement;
22
+ originalTop: number;
23
+ originalHeight: number;
24
+ eventDate: string;
25
+ pointerEvent: React.PointerEvent;
26
+ }) => void;
14
27
  isResizing: boolean;
15
28
  resizingEventId: string | number | null;
16
29
  getResizePosition: (eventId: string | number) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine/schedule",
3
- "version": "9.0.0-alpha.6",
3
+ "version": "9.0.0-alpha.7",
4
4
  "description": "Schedule Mantine component",
5
5
  "homepage": "https://mantine.dev/",
6
6
  "license": "MIT",
@@ -35,9 +35,9 @@
35
35
  "directory": "packages/@mantine/schedule"
36
36
  },
37
37
  "peerDependencies": {
38
- "@mantine/core": "9.0.0-alpha.6",
39
- "@mantine/dates": "9.0.0-alpha.6",
40
- "@mantine/hooks": "9.0.0-alpha.6",
38
+ "@mantine/core": "9.0.0-alpha.7",
39
+ "@mantine/dates": "9.0.0-alpha.7",
40
+ "@mantine/hooks": "9.0.0-alpha.7",
41
41
  "react": "^19.2.0",
42
42
  "react-dom": "^19.2.0"
43
43
  },