@mantine/schedule 9.7.2 → 9.7.3

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 (105) hide show
  1. package/cjs/components/DayView/DayView.cjs +45 -29
  2. package/cjs/components/DayView/DayView.cjs.map +1 -1
  3. package/cjs/components/DayView/DayView.module.cjs.map +1 -1
  4. package/cjs/components/MobileMonthView/MobileMonthView.cjs +54 -22
  5. package/cjs/components/MobileMonthView/MobileMonthView.cjs.map +1 -1
  6. package/cjs/components/MobileMonthView/MobileMonthView.module.cjs.map +1 -1
  7. package/cjs/components/MobileMonthView/get-mobile-month-view-weeks.cjs +32 -0
  8. package/cjs/components/MobileMonthView/get-mobile-month-view-weeks.cjs.map +1 -0
  9. package/cjs/components/ResourcesDayView/ResourcesDayView.cjs +15 -7
  10. package/cjs/components/ResourcesDayView/ResourcesDayView.cjs.map +1 -1
  11. package/cjs/components/ResourcesDayView/ResourcesDayView.module.cjs.map +1 -1
  12. package/cjs/components/ResourcesDayView/ResourcesDayViewColumn.cjs +11 -6
  13. package/cjs/components/ResourcesDayView/ResourcesDayViewColumn.cjs.map +1 -1
  14. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs +15 -7
  15. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs.map +1 -1
  16. package/cjs/components/ResourcesWeekView/ResourcesWeekView.module.cjs.map +1 -1
  17. package/cjs/components/ResourcesWeekView/ResourcesWeekViewRow.cjs +11 -6
  18. package/cjs/components/ResourcesWeekView/ResourcesWeekViewRow.cjs.map +1 -1
  19. package/cjs/components/Schedule/Schedule.cjs +2 -0
  20. package/cjs/components/Schedule/Schedule.cjs.map +1 -1
  21. package/cjs/components/WeekView/WeekView.cjs +29 -19
  22. package/cjs/components/WeekView/WeekView.cjs.map +1 -1
  23. package/cjs/components/WeekView/WeekView.module.cjs.map +1 -1
  24. package/cjs/components/WeekView/WeekViewDay.cjs +13 -7
  25. package/cjs/components/WeekView/WeekViewDay.cjs.map +1 -1
  26. package/cjs/components/YearView/YearView.cjs +1 -1
  27. package/cjs/components/YearView/YearView.cjs.map +1 -1
  28. package/cjs/components/YearView/YearViewMonth.cjs +1 -1
  29. package/cjs/components/YearView/YearViewMonth.cjs.map +1 -1
  30. package/cjs/index.cjs +10 -0
  31. package/cjs/utils/add-minutes-to-time/add-minutes-to-time.cjs +17 -0
  32. package/cjs/utils/add-minutes-to-time/add-minutes-to-time.cjs.map +1 -0
  33. package/cjs/utils/clamp-slot-label-interval/clamp-slot-label-interval.cjs +22 -0
  34. package/cjs/utils/clamp-slot-label-interval/clamp-slot-label-interval.cjs.map +1 -0
  35. package/cjs/utils/get-business-hours-mod/get-business-hours-mod.cjs +74 -17
  36. package/cjs/utils/get-business-hours-mod/get-business-hours-mod.cjs.map +1 -1
  37. package/cjs/utils/get-day-time-intervals/get-day-time-intervals.cjs +7 -2
  38. package/cjs/utils/get-day-time-intervals/get-day-time-intervals.cjs.map +1 -1
  39. package/cjs/utils/get-slot-label-groups/get-slot-label-groups.cjs +26 -0
  40. package/cjs/utils/get-slot-label-groups/get-slot-label-groups.cjs.map +1 -0
  41. package/cjs/{components/YearView → utils/get-visible-week-days}/get-visible-week-days.cjs +1 -1
  42. package/cjs/utils/get-visible-week-days/get-visible-week-days.cjs.map +1 -0
  43. package/esm/components/DayView/DayView.mjs +46 -30
  44. package/esm/components/DayView/DayView.mjs.map +1 -1
  45. package/esm/components/DayView/DayView.module.mjs.map +1 -1
  46. package/esm/components/MobileMonthView/MobileMonthView.mjs +54 -22
  47. package/esm/components/MobileMonthView/MobileMonthView.mjs.map +1 -1
  48. package/esm/components/MobileMonthView/MobileMonthView.module.mjs.map +1 -1
  49. package/esm/components/MobileMonthView/get-mobile-month-view-weeks.mjs +30 -0
  50. package/esm/components/MobileMonthView/get-mobile-month-view-weeks.mjs.map +1 -0
  51. package/esm/components/ResourcesDayView/ResourcesDayView.mjs +16 -8
  52. package/esm/components/ResourcesDayView/ResourcesDayView.mjs.map +1 -1
  53. package/esm/components/ResourcesDayView/ResourcesDayView.module.mjs.map +1 -1
  54. package/esm/components/ResourcesDayView/ResourcesDayViewColumn.mjs +12 -7
  55. package/esm/components/ResourcesDayView/ResourcesDayViewColumn.mjs.map +1 -1
  56. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs +16 -8
  57. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs.map +1 -1
  58. package/esm/components/ResourcesWeekView/ResourcesWeekView.module.mjs.map +1 -1
  59. package/esm/components/ResourcesWeekView/ResourcesWeekViewRow.mjs +12 -7
  60. package/esm/components/ResourcesWeekView/ResourcesWeekViewRow.mjs.map +1 -1
  61. package/esm/components/Schedule/Schedule.mjs +2 -0
  62. package/esm/components/Schedule/Schedule.mjs.map +1 -1
  63. package/esm/components/WeekView/WeekView.mjs +30 -20
  64. package/esm/components/WeekView/WeekView.mjs.map +1 -1
  65. package/esm/components/WeekView/WeekView.module.mjs.map +1 -1
  66. package/esm/components/WeekView/WeekViewDay.mjs +14 -8
  67. package/esm/components/WeekView/WeekViewDay.mjs.map +1 -1
  68. package/esm/components/YearView/YearView.mjs +1 -1
  69. package/esm/components/YearView/YearView.mjs.map +1 -1
  70. package/esm/components/YearView/YearViewMonth.mjs +1 -1
  71. package/esm/components/YearView/YearViewMonth.mjs.map +1 -1
  72. package/esm/index.mjs +6 -2
  73. package/esm/utils/add-minutes-to-time/add-minutes-to-time.mjs +17 -0
  74. package/esm/utils/add-minutes-to-time/add-minutes-to-time.mjs.map +1 -0
  75. package/esm/utils/clamp-slot-label-interval/clamp-slot-label-interval.mjs +22 -0
  76. package/esm/utils/clamp-slot-label-interval/clamp-slot-label-interval.mjs.map +1 -0
  77. package/esm/utils/get-business-hours-mod/get-business-hours-mod.mjs +74 -18
  78. package/esm/utils/get-business-hours-mod/get-business-hours-mod.mjs.map +1 -1
  79. package/esm/utils/get-day-time-intervals/get-day-time-intervals.mjs +7 -2
  80. package/esm/utils/get-day-time-intervals/get-day-time-intervals.mjs.map +1 -1
  81. package/esm/utils/get-slot-label-groups/get-slot-label-groups.mjs +26 -0
  82. package/esm/utils/get-slot-label-groups/get-slot-label-groups.mjs.map +1 -0
  83. package/esm/{components/YearView → utils/get-visible-week-days}/get-visible-week-days.mjs +1 -1
  84. package/esm/utils/get-visible-week-days/get-visible-week-days.mjs.map +1 -0
  85. package/lib/components/DayView/DayView.d.ts +3 -1
  86. package/lib/components/MobileMonthView/MobileMonthView.d.ts +2 -0
  87. package/lib/components/MobileMonthView/get-mobile-month-view-weeks.d.ts +11 -0
  88. package/lib/components/ResourcesDayView/ResourcesDayView.d.ts +1 -1
  89. package/lib/components/ResourcesDayView/ResourcesDayViewColumn.d.ts +2 -1
  90. package/lib/components/ResourcesWeekView/ResourcesWeekView.d.ts +1 -1
  91. package/lib/components/ResourcesWeekView/ResourcesWeekViewRow.d.ts +2 -1
  92. package/lib/components/Schedule/Schedule.d.ts +1 -1
  93. package/lib/components/WeekView/WeekView.d.ts +3 -1
  94. package/lib/utils/add-minutes-to-time/add-minutes-to-time.d.ts +1 -0
  95. package/lib/utils/clamp-slot-label-interval/clamp-slot-label-interval.d.ts +9 -0
  96. package/lib/utils/get-business-hours-mod/get-business-hours-mod.d.ts +24 -5
  97. package/lib/utils/get-day-time-intervals/get-day-time-intervals.d.ts +5 -1
  98. package/lib/utils/get-slot-label-groups/get-slot-label-groups.d.ts +15 -0
  99. package/lib/utils/index.d.ts +7 -2
  100. package/package.json +4 -4
  101. package/styles.css +175 -6
  102. package/styles.layer.css +175 -6
  103. package/cjs/components/YearView/get-visible-week-days.cjs.map +0 -1
  104. package/esm/components/YearView/get-visible-week-days.mjs.map +0 -1
  105. /package/lib/{components/YearView → utils/get-visible-week-days}/get-visible-week-days.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-slot-label-groups.mjs","names":[],"sources":["../../../src/utils/get-slot-label-groups/get-slot-label-groups.ts"],"sourcesContent":["import { DayTimeInterval } from '../get-day-time-intervals/get-day-time-intervals';\n\nexport interface SlotLabelGroup {\n /** Start time of the first slot in the group in HH:mm:ss format */\n startTime: string;\n\n /** End time of the last slot in the group in HH:mm:ss format */\n endTime: string;\n\n /** Number of slots covered by the group */\n slotsCount: number;\n\n /** Indicates if the group starts at a label boundary, `false` for the leading group without a label */\n isLabelStart: boolean;\n\n /** Indicates if the group starts at the beginning of an hour */\n isHourStart: boolean;\n}\n\n/** Groups consecutive time intervals by label boundaries, the first group may start before the first label */\nexport function getSlotLabelGroups(intervals: DayTimeInterval[]): SlotLabelGroup[] {\n const groups: SlotLabelGroup[] = [];\n\n intervals.forEach((interval) => {\n const current = groups[groups.length - 1];\n\n if (current && !interval.isLabelStart) {\n current.endTime = interval.endTime;\n current.slotsCount += 1;\n return;\n }\n\n groups.push({\n startTime: interval.startTime,\n endTime: interval.endTime,\n slotsCount: 1,\n isLabelStart: interval.isLabelStart,\n isHourStart: interval.isHourStart,\n });\n });\n\n return groups;\n}\n"],"mappings":";;;AAoBA,SAAgB,mBAAmB,WAAgD;CACjF,MAAM,SAA2B,CAAC;CAElC,UAAU,SAAS,aAAa;EAC9B,MAAM,UAAU,OAAO,OAAO,SAAS;EAEvC,IAAI,WAAW,CAAC,SAAS,cAAc;GACrC,QAAQ,UAAU,SAAS;GAC3B,QAAQ,cAAc;GACtB;EACF;EAEA,OAAO,KAAK;GACV,WAAW,SAAS;GACpB,SAAS,SAAS;GAClB,YAAY;GACZ,cAAc,SAAS;GACvB,aAAa,SAAS;EACxB,CAAC;CACH,CAAC;CAED,OAAO;AACT"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import dayjs from "dayjs";
3
- //#region packages/@mantine/schedule/src/components/YearView/get-visible-week-days.ts
3
+ //#region packages/@mantine/schedule/src/utils/get-visible-week-days/get-visible-week-days.ts
4
4
  const DAYS_IN_WEEK = 7;
5
5
  /**
6
6
  * Returns indices of week columns (0-6, relative to `firstDayOfWeek`) that are
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-visible-week-days.mjs","names":[],"sources":["../../../src/utils/get-visible-week-days/get-visible-week-days.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { DateStringValue, DayOfWeek } from '../../types';\n\nconst DAYS_IN_WEEK = 7;\n\ninterface HiddenWeekendColumnsInput {\n weekendDays: DayOfWeek[];\n firstDayOfWeek: DayOfWeek;\n withWeekendDays: boolean | undefined;\n}\n\n/**\n * Returns indices of week columns (0-6, relative to `firstDayOfWeek`) that are\n * hidden because they fall on a weekend day and `withWeekendDays` is `false`.\n */\nexport function getHiddenWeekendColumns({\n weekendDays,\n firstDayOfWeek,\n withWeekendDays,\n}: HiddenWeekendColumnsInput): number[] {\n if (withWeekendDays !== false) {\n return [];\n }\n\n return Array.from({ length: DAYS_IN_WEEK }, (_, index) => index).filter((index) =>\n weekendDays.includes(((firstDayOfWeek + index) % DAYS_IN_WEEK) as DayOfWeek)\n );\n}\n\ninterface VisibleWeekDaysInput {\n week: DateStringValue[];\n weekendDays: DayOfWeek[];\n withWeekendDays: boolean | undefined;\n}\n\n/** Filters out weekend days from a week when `withWeekendDays` is `false` */\nexport function getVisibleWeekDays({\n week,\n weekendDays,\n withWeekendDays,\n}: VisibleWeekDaysInput): DateStringValue[] {\n if (withWeekendDays !== false) {\n return week;\n }\n\n return week.filter((date) => !weekendDays.includes(dayjs(date).day() as DayOfWeek));\n}\n"],"mappings":";;;AAGA,MAAM,eAAe;;;;;AAYrB,SAAgB,wBAAwB,EACtC,aACA,gBACA,mBACsC;CACtC,IAAI,oBAAoB,OACtB,OAAO,CAAC;CAGV,OAAO,MAAM,KAAK,EAAE,QAAQ,aAAa,IAAI,GAAG,UAAU,KAAK,CAAC,CAAC,QAAQ,UACvE,YAAY,UAAW,iBAAiB,SAAS,YAA0B,CAC7E;AACF;;AASA,SAAgB,mBAAmB,EACjC,MACA,aACA,mBAC0C;CAC1C,IAAI,oBAAoB,OACtB,OAAO;CAGT,OAAO,KAAK,QAAQ,SAAS,CAAC,YAAY,SAAS,MAAM,IAAI,CAAC,CAAC,IAAI,CAAc,CAAC;AACpF"}
@@ -10,7 +10,7 @@ import { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHea
10
10
  import { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';
11
11
  export type DayViewStylesNames = 'dayView' | 'dayViewInner' | 'dayViewScrollArea' | 'dayViewAllDay' | 'dayViewAllDayEvents' | 'dayViewSlot' | 'dayViewSlots' | 'dayViewTimeSlots' | 'dayViewSlotLabel' | 'dayViewSlotLabels' | 'dayViewBackgroundEvent' | 'dayViewBackgroundEventResizeHandle' | 'dayViewDragPreview' | MoreEventsStylesNames | ScheduleEventStylesNames | Exclude<CombinedScheduleHeaderStylesNames, MonthYearSelectStylesNames> | CurrentTimeIndicatorStylesNames | AgendaViewStylesNames;
12
12
  export type DayViewCssVariables = {
13
- dayView: '--day-view-radius' | '--day-view-slot-height' | '--day-view-all-day-slot-height';
13
+ dayView: '--day-view-radius' | '--day-view-slot-height' | '--day-view-all-day-slot-height' | '--day-view-business-hours-bg' | '--day-view-non-business-hours-bg';
14
14
  };
15
15
  export interface DayViewProps extends BoxProps, StylesApiProps<DayViewFactory>, ElementProps<'div'> {
16
16
  __staticSelector?: string;
@@ -40,6 +40,8 @@ export interface DayViewProps extends BoxProps, StylesApiProps<DayViewFactory>,
40
40
  radius?: MantineRadius;
41
41
  /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */
42
42
  slotLabelFormat?: DateLabelFormat;
43
+ /** Interval between time labels in minutes. Must be a multiple of `intervalMinutes` that divides evenly into an hour (e.g. `15`, `30`) or is a whole number of hours. Values that do not satisfy these rules are rounded up to the nearest valid value, `60` is used for invalid values. @default 60 */
44
+ slotLabelInterval?: number;
43
45
  /** Date format in the header @default MMMM D, YYYY */
44
46
  headerFormat?: DateLabelFormat;
45
47
  /** If set, displays a line indicating the current time. By default, displayed only for the current day. */
@@ -39,6 +39,8 @@ export interface MobileMonthViewProps extends BoxProps, StylesApiProps<MobileMon
39
39
  weekdayFormat?: DateLabelFormat;
40
40
  /** Indices of weekend days, 0-6, where 0 is Sunday and 6 is Saturday. The default value is defined by `DatesProvider`. */
41
41
  weekendDays?: DayOfWeek[];
42
+ /** If set, weekend days are displayed. When `false`, weekend columns are hidden and the month grid shrinks. @default true */
43
+ withWeekendDays?: boolean;
42
44
  /** Props passed down to the week number button */
43
45
  getWeekNumberProps?: (weekStartDate: DateStringValue) => Record<string, any>;
44
46
  /** Props passed down to the day button */
@@ -0,0 +1,11 @@
1
+ import { AnyDateValue, DateStringValue, DayOfWeek } from '../../types';
2
+ interface GetMobileMonthViewWeeksInput {
3
+ month: AnyDateValue;
4
+ firstDayOfWeek: DayOfWeek;
5
+ consistentWeeks: boolean | undefined;
6
+ withOutsideDays: boolean | undefined;
7
+ weekendDays: DayOfWeek[];
8
+ withWeekendDays: boolean | undefined;
9
+ }
10
+ export declare function getMobileMonthViewWeeks({ month, firstDayOfWeek, consistentWeeks, withOutsideDays, weekendDays, withWeekendDays, }: GetMobileMonthViewWeeksInput): DateStringValue[][];
11
+ export {};
@@ -7,7 +7,7 @@ import { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHea
7
7
  import { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';
8
8
  export type ResourcesDayViewStylesNames = 'resourcesDayView' | 'resourcesDayViewRoot' | 'resourcesDayViewInner' | 'resourcesDayViewTimeLabelsRow' | 'resourcesDayViewScrollArea' | 'resourcesDayViewCorner' | 'resourcesDayViewTimeLabel' | 'resourcesDayViewResourceLabel' | 'resourcesDayViewRow' | 'resourcesDayViewRowSlot' | 'resourcesDayViewRowSlots' | 'resourcesDayViewBackgroundEvent' | 'resourcesDayViewAllDayEvent' | 'resourcesDayViewCurrentTimeIndicator' | 'resourcesDayViewCurrentTimeIndicatorLine' | 'resourcesDayViewCurrentTimeIndicatorThumb' | 'resourcesDayViewCurrentTimeIndicatorTimeBubble' | 'resourcesDayViewEventWrapper' | 'resourcesDayViewDragPreview' | 'resourcesDayViewResizeHandle' | 'resourcesDayViewGroupColumn' | 'resourcesDayViewGroupColumnEmpty' | MoreEventsStylesNames | CombinedScheduleHeaderStylesNames;
9
9
  export type ResourcesDayViewCssVariables = {
10
- resourcesDayView: '--resources-day-view-radius' | '--resources-day-view-slot-width' | '--resources-day-view-row-height' | '--resources-day-view-group-label-width';
10
+ resourcesDayView: '--resources-day-view-radius' | '--resources-day-view-slot-width' | '--resources-day-view-row-height' | '--resources-day-view-group-label-width' | '--resources-day-view-business-hours-bg' | '--resources-day-view-non-business-hours-bg';
11
11
  };
12
12
  export interface ResourcesDayViewProps extends BoxProps, StylesApiProps<ResourcesDayViewFactory>, ElementProps<'div'> {
13
13
  __staticSelector?: string;
@@ -8,6 +8,7 @@ export interface ResourcesDayViewRowProps {
8
8
  resourceIndex: number;
9
9
  date: string;
10
10
  slots: DayTimeInterval[];
11
+ intervalMinutes: number;
11
12
  getStyles: GetStylesApi<ResourcesDayViewFactory>;
12
13
  children?: React.ReactNode;
13
14
  labels?: ScheduleLabelsOverride;
@@ -36,4 +37,4 @@ export interface ResourcesDayViewRowProps {
36
37
  groupInfo?: ResourceGroupInfo | null;
37
38
  allDayCount?: number;
38
39
  }
39
- export declare function ResourcesDayViewRow({ resource, resourceIndex, date, slots, getStyles, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onRowSlotsDragOver, onRowSlotsDragLeave, onRowSlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, rowSlotsContainerRef, renderResourceLabel, renderGroupLabel, scrolledX, groupInfo, allDayCount, }: ResourcesDayViewRowProps): import("react").JSX.Element;
40
+ export declare function ResourcesDayViewRow({ resource, resourceIndex, date, slots, intervalMinutes, getStyles, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onRowSlotsDragOver, onRowSlotsDragLeave, onRowSlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, rowSlotsContainerRef, renderResourceLabel, renderGroupLabel, scrolledX, groupInfo, allDayCount, }: ResourcesDayViewRowProps): import("react").JSX.Element;
@@ -7,7 +7,7 @@ import { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHea
7
7
  import { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';
8
8
  export type ResourcesWeekViewStylesNames = 'resourcesWeekView' | 'resourcesWeekViewRoot' | 'resourcesWeekViewInner' | 'resourcesWeekViewHeaderRows' | 'resourcesWeekViewHeaderContent' | 'resourcesWeekViewDayLabelsRow' | 'resourcesWeekViewDayLabel' | 'resourcesWeekViewTimeLabelsRow' | 'resourcesWeekViewScrollArea' | 'resourcesWeekViewCorner' | 'resourcesWeekViewTimeLabel' | 'resourcesWeekViewResourceLabel' | 'resourcesWeekViewRow' | 'resourcesWeekViewRowSlot' | 'resourcesWeekViewRowSlots' | 'resourcesWeekViewBackgroundEvent' | 'resourcesWeekViewAllDayEvent' | 'resourcesWeekViewCurrentTimeIndicator' | 'resourcesWeekViewCurrentTimeIndicatorLine' | 'resourcesWeekViewCurrentTimeIndicatorThumb' | 'resourcesWeekViewCurrentTimeIndicatorTimeBubble' | 'resourcesWeekViewEventWrapper' | 'resourcesWeekViewDragPreview' | 'resourcesWeekViewResizeHandle' | 'resourcesWeekViewGroupColumn' | 'resourcesWeekViewGroupColumnEmpty' | MoreEventsStylesNames | CombinedScheduleHeaderStylesNames;
9
9
  export type ResourcesWeekViewCssVariables = {
10
- resourcesWeekView: '--resources-week-view-radius' | '--resources-week-view-slot-width' | '--resources-week-view-row-height' | '--resources-week-view-group-label-width';
10
+ resourcesWeekView: '--resources-week-view-radius' | '--resources-week-view-slot-width' | '--resources-week-view-row-height' | '--resources-week-view-group-label-width' | '--resources-week-view-business-hours-bg' | '--resources-week-view-non-business-hours-bg';
11
11
  };
12
12
  export interface ResourcesWeekViewProps extends BoxProps, StylesApiProps<ResourcesWeekViewFactory>, ElementProps<'div'> {
13
13
  __staticSelector?: string;
@@ -8,6 +8,7 @@ export interface ResourcesWeekViewRowProps {
8
8
  resourceIndex: number;
9
9
  weekdays: string[];
10
10
  slots: DayTimeInterval[];
11
+ intervalMinutes: number;
11
12
  getStyles: GetStylesApi<ResourcesWeekViewFactory>;
12
13
  children?: React.ReactNode;
13
14
  labels?: ScheduleLabelsOverride;
@@ -36,4 +37,4 @@ export interface ResourcesWeekViewRowProps {
36
37
  groupInfo?: ResourceGroupInfo | null;
37
38
  allDayCount?: number;
38
39
  }
39
- export declare function ResourcesWeekViewRow({ resource, resourceIndex, weekdays, slots, getStyles, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onRowSlotsDragOver, onRowSlotsDragLeave, onRowSlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, rowSlotsContainerRef, renderResourceLabel, renderGroupLabel, scrolledX, groupInfo, allDayCount, }: ResourcesWeekViewRowProps): import("react").JSX.Element;
40
+ export declare function ResourcesWeekViewRow({ resource, resourceIndex, weekdays, slots, intervalMinutes, getStyles, children, labels, highlightBusinessHours, businessHours, withEventsDragAndDrop, onRowSlotsDragOver, onRowSlotsDragLeave, onRowSlotsDrop, onSlotClick, dropTargetSlotIndex, mode, slotsRef, firstSlotIndex, onSlotKeyDown, withDragSlotSelect, onSlotPointerDown, isSlotDragSelected, rowSlotsContainerRef, renderResourceLabel, renderGroupLabel, scrolledX, groupInfo, allDayCount, }: ResourcesWeekViewRowProps): import("react").JSX.Element;
@@ -111,7 +111,7 @@ export interface ScheduleProps extends BoxProps, StylesApiProps<ScheduleFactory>
111
111
  monthViewProps?: ScheduleViewProps<MonthViewProps>;
112
112
  /** Props specific to YearView (includes `firstDayOfWeek`, `weekendDays`, etc.) */
113
113
  yearViewProps?: ScheduleViewProps<YearViewProps>;
114
- /** Props specific to MobileMonthView (used in responsive layout) */
114
+ /** Props specific to MobileMonthView (used in responsive layout). `weekendDays` and `withWeekendDays` default to the values set in `monthViewProps`. */
115
115
  mobileMonthViewProps?: ScheduleViewProps<MobileMonthViewProps>;
116
116
  /** If set, displays an Agenda button in the header of DayView, WeekView and MonthView @default false */
117
117
  withAgenda?: boolean;
@@ -9,7 +9,7 @@ import { CombinedScheduleHeaderStylesNames } from '../ScheduleHeader/ScheduleHea
9
9
  import { ViewSelectProps } from '../ScheduleHeader/ViewSelect/ViewSelect';
10
10
  export type WeekViewStylesNames = 'weekView' | 'weekViewRoot' | 'weekViewHeader' | 'weekViewInner' | 'weekViewAllDaySlotsEvents' | 'weekViewAllDaySlots' | 'weekViewAllDaySlotsList' | 'weekViewAllDaySlot' | 'weekViewAllDaySlotsLabel' | 'weekViewScrollArea' | 'weekViewCorner' | 'weekViewSlotLabels' | 'weekViewSlotLabel' | 'weekViewDayLabel' | 'weekViewDayWeekday' | 'weekViewDay' | 'weekViewDayNumber' | 'weekViewDaySlot' | 'weekViewDaySlots' | 'weekViewWeekLabel' | 'weekViewWeekNumber' | 'weekViewBackgroundEvent' | 'weekViewBackgroundEventResizeHandle' | 'weekViewDragPreview' | CurrentTimeIndicatorStylesNames | CombinedScheduleHeaderStylesNames | AgendaViewStylesNames;
11
11
  export type WeekViewCssVariables = {
12
- weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height';
12
+ weekView: '--week-view-radius' | '--week-view-slot-height' | '--week-view-all-day-slots-height' | '--week-view-business-hours-bg' | '--week-view-non-business-hours-bg';
13
13
  };
14
14
  export interface WeekViewProps extends BoxProps, StylesApiProps<WeekViewFactory>, ElementProps<'div'> {
15
15
  __staticSelector?: string;
@@ -27,6 +27,8 @@ export interface WeekViewProps extends BoxProps, StylesApiProps<WeekViewFactory>
27
27
  withSubHourGridLines?: boolean;
28
28
  /** Dayjs format for slot labels or a callback function that returns formatted value @default HH:mm */
29
29
  slotLabelFormat?: DateLabelFormat;
30
+ /** Interval between time labels in minutes. Must be a multiple of `intervalMinutes` that divides evenly into an hour (e.g. `15`, `30`) or is a whole number of hours. Values that do not satisfy these rules are rounded up to the nearest valid value, `60` is used for invalid values. @default 60 */
31
+ slotLabelInterval?: number;
30
32
  /** Number 0-6, where 0 – Sunday and 6 – Saturday. @default 1 – Monday */
31
33
  firstDayOfWeek?: DayOfWeek;
32
34
  /** `dayjs` format for weekdays names. @default 'ddd' */
@@ -0,0 +1 @@
1
+ export declare function addMinutesToTime(time: string, minutes: number): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Clamps slot label interval so that every label lines up with a slot boundary:
3
+ *
4
+ * - Non-positive and non-finite values fall back to `60`.
5
+ * - The value is clamped with the same rules as `intervalMinutes` (see `clampIntervalMinutes`).
6
+ * - The result is rounded up to the next multiple of the clamped `intervalMinutes` that
7
+ * satisfies the same rules and is never smaller than it. It is capped to a single day (`1440`).
8
+ */
9
+ export declare function clampSlotLabelInterval(slotLabelInterval: number, intervalMinutes: number): number;
@@ -1,12 +1,15 @@
1
1
  import { DayOfWeek } from '../../types';
2
- /** Business hours range in `HH:mm:ss` format */
2
+ /** Business hours range in `HH:mm:ss` or `HH:mm` format */
3
3
  export type BusinessHoursRange = [string, string];
4
4
  /** Per-day business hours map keyed by day of the week (0 – Sunday, 6 – Saturday). `null` marks a day as fully outside business hours. */
5
5
  export type BusinessHoursPerDay = Partial<Record<DayOfWeek, BusinessHoursRange | null>>;
6
6
  /** Business hours value – tuple applies to every day, record configures business hours per day */
7
7
  export type BusinessHoursValue = BusinessHoursRange | BusinessHoursPerDay;
8
8
  export interface GetBusinessHoursModInput {
9
+ /** Start of the interval in `HH:mm:ss` format */
9
10
  time: string;
11
+ /** End of the interval in `HH:mm:ss` format. When set, intervals that contain a business hours boundary get the partial state. */
12
+ endTime?: string;
10
13
  businessHours?: BusinessHoursValue;
11
14
  highlightBusinessHours?: boolean;
12
15
  dayOfWeek?: DayOfWeek;
@@ -14,13 +17,29 @@ export interface GetBusinessHoursModInput {
14
17
  export interface BusinessHoursMod {
15
18
  'business-hours': boolean;
16
19
  'non-business-hours': boolean;
20
+ 'partial-business-hours': boolean;
17
21
  }
22
+ /** CSS variables applied to partial intervals, percentage of the interval where business hours start and end */
23
+ export type BusinessHoursVars = {
24
+ '--business-hours-from': string;
25
+ '--business-hours-to': string;
26
+ };
27
+ export interface BusinessHoursState {
28
+ mod: BusinessHoursMod;
29
+ vars: BusinessHoursVars | undefined;
30
+ }
31
+ /**
32
+ * Resolves business hours state of a time interval
33
+ * @returns `mod` – modifiers for styling business/non-business/partial intervals, `vars` – CSS variables with the business hours boundaries inside a partial interval
34
+ */
35
+ export declare function getBusinessHoursState({ time, endTime, businessHours, highlightBusinessHours, dayOfWeek, }: GetBusinessHoursModInput): BusinessHoursState;
18
36
  /**
19
- * Determines if a given time is within business hours and returns modifier object
20
- * @param time - Time string in HH:mm:ss format
21
- * @param businessHours - Tuple of [start, end] times in HH:mm:ss format, or per-day record keyed by day of the week
37
+ * Determines if a given time interval is within business hours and returns modifier object
38
+ * @param time - Start time in HH:mm:ss format
39
+ * @param endTime - End time in HH:mm:ss format, enables the partial state for intervals that contain a boundary
40
+ * @param businessHours - Tuple of [start, end] times in HH:mm:ss or HH:mm format, or per-day record keyed by day of the week
22
41
  * @param highlightBusinessHours - Whether to highlight business hours
23
42
  * @param dayOfWeek - Day of the week (0 – Sunday, 6 – Saturday), used to resolve per-day business hours
24
43
  * @returns Modifier object for styling business/non-business hours
25
44
  */
26
- export declare function getBusinessHoursMod({ time, businessHours, highlightBusinessHours, dayOfWeek, }: GetBusinessHoursModInput): BusinessHoursMod;
45
+ export declare function getBusinessHoursMod(input: GetBusinessHoursModInput): BusinessHoursMod;
@@ -7,6 +7,8 @@ export interface DayTimeInterval {
7
7
  duration: number;
8
8
  /** Indicates if the interval starts at the beginning of an hour */
9
9
  isHourStart: boolean;
10
+ /** Indicates if the interval starts at a label boundary defined by `labelIntervalMinutes`. Boundaries are aligned to the clock when the slots grid reaches them, otherwise they are counted from `startTime`. */
11
+ isLabelStart: boolean;
10
12
  }
11
13
  export interface GetDayTimeIntervalsInput {
12
14
  /** Start time in HH:mm:ss format */
@@ -15,5 +17,7 @@ export interface GetDayTimeIntervalsInput {
15
17
  endTime?: string;
16
18
  /** Interval in minutes, 60 by default */
17
19
  intervalMinutes?: number;
20
+ /** Interval between labeled slots in minutes, 60 by default */
21
+ labelIntervalMinutes?: number;
18
22
  }
19
- export declare function getDayTimeIntervals({ startTime, endTime, intervalMinutes: _intervalMinutes, }: GetDayTimeIntervalsInput): DayTimeInterval[];
23
+ export declare function getDayTimeIntervals({ startTime, endTime, intervalMinutes: _intervalMinutes, labelIntervalMinutes: _labelIntervalMinutes, }: GetDayTimeIntervalsInput): DayTimeInterval[];
@@ -0,0 +1,15 @@
1
+ import { DayTimeInterval } from '../get-day-time-intervals/get-day-time-intervals';
2
+ export interface SlotLabelGroup {
3
+ /** Start time of the first slot in the group in HH:mm:ss format */
4
+ startTime: string;
5
+ /** End time of the last slot in the group in HH:mm:ss format */
6
+ endTime: string;
7
+ /** Number of slots covered by the group */
8
+ slotsCount: number;
9
+ /** Indicates if the group starts at a label boundary, `false` for the leading group without a label */
10
+ isLabelStart: boolean;
11
+ /** Indicates if the group starts at the beginning of an hour */
12
+ isHourStart: boolean;
13
+ }
14
+ /** Groups consecutive time intervals by label boundaries, the first group may start before the first label */
15
+ export declare function getSlotLabelGroups(intervals: DayTimeInterval[]): SlotLabelGroup[];
@@ -16,6 +16,8 @@ export { toDateString } from './to-date-string/to-date-string';
16
16
  export { nextWeek } from './next-week/next-week';
17
17
  export { previousWeek } from './previous-week/previous-week';
18
18
  export { clampIntervalMinutes } from './clamp-interval-minutes/clamp-interval-minutes';
19
+ export { clampSlotLabelInterval } from './clamp-slot-label-interval/clamp-slot-label-interval';
20
+ export { getSlotLabelGroups } from './get-slot-label-groups/get-slot-label-groups';
19
21
  export { getCurrentTimePosition } from './get-current-time-position/get-current-time-position';
20
22
  export { isInTimeRange } from './is-in-time-range/is-in-time-range';
21
23
  export { isAllDayEvent } from './is-all-day-event/is-all-day-event';
@@ -33,14 +35,16 @@ export { getDayPosition } from './get-day-position/get-day-position';
33
35
  export { getTimeAxisEventStyle } from './get-time-axis-event-style/get-time-axis-event-style';
34
36
  export { calculateDropTime } from './calculate-drop-time/calculate-drop-time';
35
37
  export { calculateMonthDropDate } from './calculate-month-drop-date/calculate-month-drop-date';
36
- export { getBusinessHoursMod } from './get-business-hours-mod/get-business-hours-mod';
38
+ export { getBusinessHoursMod, getBusinessHoursState, } from './get-business-hours-mod/get-business-hours-mod';
37
39
  export { expandRecurringEvents } from './expand-recurring-events/expand-recurring-events';
38
40
  export type { DayTimeInterval } from './get-day-time-intervals/get-day-time-intervals';
41
+ export type { SlotLabelGroup } from './get-slot-label-groups/get-slot-label-groups';
39
42
  export type { ParsedTime } from './parse-time-string/parse-time-string';
40
43
  export type { CalculateDropTimeInput, CalculateDropTimeResult, } from './calculate-drop-time/calculate-drop-time';
41
44
  export type { CalculateMonthDropDateInput, CalculateMonthDropDateResult, } from './calculate-month-drop-date/calculate-month-drop-date';
42
- export type { BusinessHoursMod, BusinessHoursPerDay, BusinessHoursRange, BusinessHoursValue, GetBusinessHoursModInput, } from './get-business-hours-mod/get-business-hours-mod';
45
+ export type { BusinessHoursMod, BusinessHoursPerDay, BusinessHoursRange, BusinessHoursState, BusinessHoursValue, BusinessHoursVars, GetBusinessHoursModInput, } from './get-business-hours-mod/get-business-hours-mod';
43
46
  export { getOrderedResources } from './get-ordered-resources/get-ordered-resources';
47
+ export { addMinutesToTime } from './add-minutes-to-time/add-minutes-to-time';
44
48
  export type { GroupRange, OrderedResourcesResult, ResourceGroupInfo, } from './get-ordered-resources/get-ordered-resources';
45
49
  export { handleResourcesGridKeyDown } from './handle-resources-grid-key-down/handle-resources-grid-key-down';
46
50
  export type { HandleResourcesGridKeyDownInput, ResourcesGridControlsRef, } from './handle-resources-grid-key-down/handle-resources-grid-key-down';
@@ -52,3 +56,4 @@ export { applyCascadeLayout } from './apply-cascade-layout/apply-cascade-layout'
52
56
  export type { CascadePositionedEvent } from './apply-cascade-layout/apply-cascade-layout';
53
57
  export { isEventPlacementAllowed } from './is-event-placement-allowed/is-event-placement-allowed';
54
58
  export type { IsEventPlacementAllowedInput, IsEventPlacementAllowedResult, } from './is-event-placement-allowed/is-event-placement-allowed';
59
+ export { getHiddenWeekendColumns, getVisibleWeekDays, } from './get-visible-week-days/get-visible-week-days';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantine/schedule",
3
- "version": "9.7.2",
3
+ "version": "9.7.3",
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.7.2",
39
- "@mantine/dates": "9.7.2",
40
- "@mantine/hooks": "9.7.2",
38
+ "@mantine/core": "9.7.3",
39
+ "@mantine/dates": "9.7.3",
40
+ "@mantine/hooks": "9.7.3",
41
41
  "react": "^19.2.0",
42
42
  "react-dom": "^19.2.0"
43
43
  },