@mantine/schedule 9.5.2 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/cjs/_virtual/_rolldown/runtime.cjs +1 -1
  2. package/cjs/components/AgendaView/AgendaView.cjs +7 -6
  3. package/cjs/components/AgendaView/AgendaView.cjs.map +1 -1
  4. package/cjs/components/AgendaView/get-agenda-view-events.cjs.map +1 -1
  5. package/cjs/components/CurrentTimeIndicator/CurrentTimeIndicator.cjs +3 -2
  6. package/cjs/components/CurrentTimeIndicator/CurrentTimeIndicator.cjs.map +1 -1
  7. package/cjs/components/DayView/DayView.cjs +144 -78
  8. package/cjs/components/DayView/DayView.cjs.map +1 -1
  9. package/cjs/components/DayView/DayView.module.cjs +2 -1
  10. package/cjs/components/DayView/DayView.module.cjs.map +1 -1
  11. package/cjs/components/DayView/get-day-view-events/get-day-view-events.cjs.map +1 -1
  12. package/cjs/components/DragContext/DragContext.cjs.map +1 -1
  13. package/cjs/components/MobileMonthView/MobileMonthView.cjs +7 -6
  14. package/cjs/components/MobileMonthView/MobileMonthView.cjs.map +1 -1
  15. package/cjs/components/MobileMonthView/get-mobile-month-view-events.cjs.map +1 -1
  16. package/cjs/components/MonthView/MonthView.cjs +24 -34
  17. package/cjs/components/MonthView/MonthView.cjs.map +1 -1
  18. package/cjs/components/MonthView/MonthView.module.cjs.map +1 -1
  19. package/cjs/components/MonthView/get-month-view-events/find-available-row.cjs.map +1 -1
  20. package/cjs/components/MonthView/get-month-view-events/get-month-positioned-events.cjs +4 -2
  21. package/cjs/components/MonthView/get-month-view-events/get-month-positioned-events.cjs.map +1 -1
  22. package/cjs/components/MonthView/get-month-view-events/get-month-view-events.cjs.map +1 -1
  23. package/cjs/components/MonthView/get-month-view-events/get-weeks-in-range.cjs +3 -2
  24. package/cjs/components/MonthView/get-month-view-events/get-weeks-in-range.cjs.map +1 -1
  25. package/cjs/components/MonthView/get-renderable-month-event-segments.cjs +1 -1
  26. package/cjs/components/MonthView/get-renderable-month-event-segments.cjs.map +1 -1
  27. package/cjs/components/MoreEvents/MoreEvents.cjs.map +1 -1
  28. package/cjs/components/ResourcesDayView/ResourcesDayView.cjs +136 -52
  29. package/cjs/components/ResourcesDayView/ResourcesDayView.cjs.map +1 -1
  30. package/cjs/components/ResourcesDayView/ResourcesDayView.module.cjs +2 -1
  31. package/cjs/components/ResourcesDayView/ResourcesDayView.module.cjs.map +1 -1
  32. package/cjs/components/ResourcesDayView/ResourcesDayViewColumn.cjs.map +1 -1
  33. package/cjs/components/ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events.cjs.map +1 -1
  34. package/cjs/components/ResourcesMonthView/ResourcesMonthView.cjs.map +1 -1
  35. package/cjs/components/ResourcesSchedule/ResourcesSchedule.cjs +3 -1
  36. package/cjs/components/ResourcesSchedule/ResourcesSchedule.cjs.map +1 -1
  37. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs +150 -59
  38. package/cjs/components/ResourcesWeekView/ResourcesWeekView.cjs.map +1 -1
  39. package/cjs/components/ResourcesWeekView/ResourcesWeekView.module.cjs +2 -1
  40. package/cjs/components/ResourcesWeekView/ResourcesWeekView.module.cjs.map +1 -1
  41. package/cjs/components/ResourcesWeekView/ResourcesWeekViewRow.cjs.map +1 -1
  42. package/cjs/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.cjs +6 -3
  43. package/cjs/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.cjs.map +1 -1
  44. package/cjs/components/Schedule/Schedule.cjs +4 -1
  45. package/cjs/components/Schedule/Schedule.cjs.map +1 -1
  46. package/cjs/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.cjs +53 -0
  47. package/cjs/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.cjs.map +1 -0
  48. package/cjs/components/ScheduleEvent/ScheduleEvent.cjs.map +1 -1
  49. package/cjs/components/ScheduleHeader/HeaderControl/HeaderControl.cjs +15 -14
  50. package/cjs/components/ScheduleHeader/HeaderControl/HeaderControl.cjs.map +1 -1
  51. package/cjs/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.cjs.map +1 -1
  52. package/cjs/components/ScheduleHeader/ScheduleHeader.cjs.map +1 -1
  53. package/cjs/components/ScheduleHeader/ScheduleHeaderBase.cjs.map +1 -1
  54. package/cjs/components/ScheduleHeader/ScheduleHeaderContext.cjs.map +1 -1
  55. package/cjs/components/ScheduleHeader/ViewSelect/ViewSelect.cjs.map +1 -1
  56. package/cjs/components/WeekView/WeekView.cjs +159 -82
  57. package/cjs/components/WeekView/WeekView.cjs.map +1 -1
  58. package/cjs/components/WeekView/WeekView.module.cjs +2 -1
  59. package/cjs/components/WeekView/WeekView.module.cjs.map +1 -1
  60. package/cjs/components/WeekView/WeekViewDay.cjs.map +1 -1
  61. package/cjs/components/WeekView/get-week-label/get-week-label.cjs.map +1 -1
  62. package/cjs/components/WeekView/get-week-view-events/calculate-all-day-event-offset.cjs.map +1 -1
  63. package/cjs/components/WeekView/get-week-view-events/calculate-all-day-event-width.cjs.map +1 -1
  64. package/cjs/components/WeekView/get-week-view-events/calculate-event-days.cjs.map +1 -1
  65. package/cjs/components/WeekView/get-week-view-events/get-event-end-date.cjs.map +1 -1
  66. package/cjs/components/WeekView/get-week-view-events/get-hanging-status.cjs.map +1 -1
  67. package/cjs/components/WeekView/get-week-view-events/get-week-positioned-events.cjs.map +1 -1
  68. package/cjs/components/YearView/YearView.cjs +7 -6
  69. package/cjs/components/YearView/YearView.cjs.map +1 -1
  70. package/cjs/components/YearView/YearViewMonth.cjs.map +1 -1
  71. package/cjs/components/YearView/get-visible-week-days.cjs.map +1 -1
  72. package/cjs/components/YearView/get-year-view-events/get-year-view-events.cjs.map +1 -1
  73. package/cjs/hooks/use-auto-scroll-on-drag.cjs.map +1 -1
  74. package/cjs/hooks/use-day-grid-event-resize.cjs.map +1 -1
  75. package/cjs/hooks/use-drag-drop-handlers.cjs +13 -2
  76. package/cjs/hooks/use-drag-drop-handlers.cjs.map +1 -1
  77. package/cjs/hooks/use-drag-state.cjs.map +1 -1
  78. package/cjs/hooks/use-event-resize.cjs +30 -15
  79. package/cjs/hooks/use-event-resize.cjs.map +1 -1
  80. package/cjs/hooks/use-horizontal-event-resize.cjs +30 -15
  81. package/cjs/hooks/use-horizontal-event-resize.cjs.map +1 -1
  82. package/cjs/hooks/use-slot-drag-select.cjs.map +1 -1
  83. package/cjs/index.cjs +2 -0
  84. package/cjs/utils/calculate-drop-time/calculate-drop-time.cjs +25 -4
  85. package/cjs/utils/calculate-drop-time/calculate-drop-time.cjs.map +1 -1
  86. package/cjs/utils/calculate-month-drop-date/calculate-month-drop-date.cjs.map +1 -1
  87. package/cjs/utils/calculate-month-resize-dates/calculate-month-resize-dates.cjs.map +1 -1
  88. package/cjs/utils/expand-recurring-events/expand-recurring-events.cjs.map +1 -1
  89. package/cjs/utils/format-date/format-date.cjs.map +1 -1
  90. package/cjs/utils/get-current-time-position/get-current-time-position.cjs.map +1 -1
  91. package/cjs/utils/get-day-position/get-day-position.cjs.map +1 -1
  92. package/cjs/utils/get-end-of-week/get-end-of-week.cjs.map +1 -1
  93. package/cjs/utils/get-month-days/get-month-days.cjs +4 -2
  94. package/cjs/utils/get-month-days/get-month-days.cjs.map +1 -1
  95. package/cjs/utils/get-month-range/get-month-range.cjs.map +1 -1
  96. package/cjs/utils/get-months-by-quarter/get-months-by-quarter.cjs.map +1 -1
  97. package/cjs/utils/get-months-list/get-months-list.cjs.map +1 -1
  98. package/cjs/utils/get-start-of-week/get-start-of-week.cjs.map +1 -1
  99. package/cjs/utils/get-week-days/get-week-days.cjs.map +1 -1
  100. package/cjs/utils/get-week-number/get-week-number.cjs +4 -1
  101. package/cjs/utils/get-week-number/get-week-number.cjs.map +1 -1
  102. package/cjs/utils/get-weekdays-names/get-weekdays-names.cjs.map +1 -1
  103. package/cjs/utils/is-after-min-date/is-after-min-date.cjs.map +1 -1
  104. package/cjs/utils/is-all-day-event/is-all-day-event.cjs.map +1 -1
  105. package/cjs/utils/is-before-max-date/is-before-max-date.cjs.map +1 -1
  106. package/cjs/utils/is-event-in-time-range/is-event-in-time-range.cjs.map +1 -1
  107. package/cjs/utils/is-events-overlap/is-events-overlap.cjs.map +1 -1
  108. package/cjs/utils/is-in-time-range/is-in-time-range.cjs.map +1 -1
  109. package/cjs/utils/is-multiday-event/is-multiday-event.cjs.map +1 -1
  110. package/cjs/utils/is-same-month/is-same-month.cjs.map +1 -1
  111. package/cjs/utils/is-within-week/is-within-week.cjs.map +1 -1
  112. package/cjs/utils/next-week/next-week.cjs.map +1 -1
  113. package/cjs/utils/previous-week/previous-week.cjs.map +1 -1
  114. package/cjs/utils/sort-events/sort-events.cjs.map +1 -1
  115. package/cjs/utils/to-date-string/to-date-string.cjs.map +1 -1
  116. package/cjs/utils/validate-event/validate-event.cjs.map +1 -1
  117. package/esm/components/AgendaView/AgendaView.mjs +7 -6
  118. package/esm/components/AgendaView/AgendaView.mjs.map +1 -1
  119. package/esm/components/CurrentTimeIndicator/CurrentTimeIndicator.mjs +4 -3
  120. package/esm/components/CurrentTimeIndicator/CurrentTimeIndicator.mjs.map +1 -1
  121. package/esm/components/DayView/DayView.mjs +145 -79
  122. package/esm/components/DayView/DayView.mjs.map +1 -1
  123. package/esm/components/DayView/DayView.module.mjs +2 -1
  124. package/esm/components/DayView/DayView.module.mjs.map +1 -1
  125. package/esm/components/MobileMonthView/MobileMonthView.mjs +7 -6
  126. package/esm/components/MobileMonthView/MobileMonthView.mjs.map +1 -1
  127. package/esm/components/MonthView/MonthView.mjs +25 -35
  128. package/esm/components/MonthView/MonthView.mjs.map +1 -1
  129. package/esm/components/MonthView/MonthView.module.mjs.map +1 -1
  130. package/esm/components/MonthView/get-month-view-events/get-month-positioned-events.mjs +4 -2
  131. package/esm/components/MonthView/get-month-view-events/get-month-positioned-events.mjs.map +1 -1
  132. package/esm/components/MonthView/get-month-view-events/get-weeks-in-range.mjs +3 -2
  133. package/esm/components/MonthView/get-month-view-events/get-weeks-in-range.mjs.map +1 -1
  134. package/esm/components/MonthView/get-renderable-month-event-segments.mjs +1 -1
  135. package/esm/components/MonthView/get-renderable-month-event-segments.mjs.map +1 -1
  136. package/esm/components/MoreEvents/MoreEvents.mjs.map +1 -1
  137. package/esm/components/ResourcesDayView/ResourcesDayView.mjs +138 -54
  138. package/esm/components/ResourcesDayView/ResourcesDayView.mjs.map +1 -1
  139. package/esm/components/ResourcesDayView/ResourcesDayView.module.mjs +2 -1
  140. package/esm/components/ResourcesDayView/ResourcesDayView.module.mjs.map +1 -1
  141. package/esm/components/ResourcesDayView/ResourcesDayViewColumn.mjs.map +1 -1
  142. package/esm/components/ResourcesMonthView/ResourcesMonthView.mjs.map +1 -1
  143. package/esm/components/ResourcesSchedule/ResourcesSchedule.mjs +3 -1
  144. package/esm/components/ResourcesSchedule/ResourcesSchedule.mjs.map +1 -1
  145. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs +152 -61
  146. package/esm/components/ResourcesWeekView/ResourcesWeekView.mjs.map +1 -1
  147. package/esm/components/ResourcesWeekView/ResourcesWeekView.module.mjs +2 -1
  148. package/esm/components/ResourcesWeekView/ResourcesWeekView.module.mjs.map +1 -1
  149. package/esm/components/ResourcesWeekView/ResourcesWeekViewRow.mjs.map +1 -1
  150. package/esm/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.mjs +6 -3
  151. package/esm/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.mjs.map +1 -1
  152. package/esm/components/Schedule/Schedule.mjs +4 -1
  153. package/esm/components/Schedule/Schedule.mjs.map +1 -1
  154. package/esm/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.mjs +53 -0
  155. package/esm/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.mjs.map +1 -0
  156. package/esm/components/ScheduleEvent/ScheduleEvent.mjs.map +1 -1
  157. package/esm/components/ScheduleHeader/HeaderControl/HeaderControl.mjs +15 -14
  158. package/esm/components/ScheduleHeader/HeaderControl/HeaderControl.mjs.map +1 -1
  159. package/esm/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.mjs.map +1 -1
  160. package/esm/components/ScheduleHeader/ScheduleHeader.mjs.map +1 -1
  161. package/esm/components/ScheduleHeader/ScheduleHeaderBase.mjs.map +1 -1
  162. package/esm/components/ScheduleHeader/ViewSelect/ViewSelect.mjs.map +1 -1
  163. package/esm/components/WeekView/WeekView.mjs +160 -83
  164. package/esm/components/WeekView/WeekView.mjs.map +1 -1
  165. package/esm/components/WeekView/WeekView.module.mjs +2 -1
  166. package/esm/components/WeekView/WeekView.module.mjs.map +1 -1
  167. package/esm/components/WeekView/WeekViewDay.mjs.map +1 -1
  168. package/esm/components/YearView/YearView.mjs +7 -6
  169. package/esm/components/YearView/YearView.mjs.map +1 -1
  170. package/esm/components/YearView/YearViewMonth.mjs.map +1 -1
  171. package/esm/hooks/use-drag-drop-handlers.mjs +13 -2
  172. package/esm/hooks/use-drag-drop-handlers.mjs.map +1 -1
  173. package/esm/hooks/use-event-resize.mjs +30 -15
  174. package/esm/hooks/use-event-resize.mjs.map +1 -1
  175. package/esm/hooks/use-horizontal-event-resize.mjs +30 -15
  176. package/esm/hooks/use-horizontal-event-resize.mjs.map +1 -1
  177. package/esm/index.mjs +2 -1
  178. package/esm/utils/calculate-drop-time/calculate-drop-time.mjs +25 -4
  179. package/esm/utils/calculate-drop-time/calculate-drop-time.mjs.map +1 -1
  180. package/esm/utils/get-month-days/get-month-days.mjs +4 -2
  181. package/esm/utils/get-month-days/get-month-days.mjs.map +1 -1
  182. package/esm/utils/get-week-number/get-week-number.mjs +4 -1
  183. package/esm/utils/get-week-number/get-week-number.mjs.map +1 -1
  184. package/lib/components/DayView/DayView.d.ts +7 -1
  185. package/lib/components/MonthView/MonthView.d.ts +2 -0
  186. package/lib/components/ResourcesDayView/ResourcesDayView.d.ts +7 -1
  187. package/lib/components/ResourcesDayView/ResourcesDayViewColumn.d.ts +1 -1
  188. package/lib/components/ResourcesSchedule/ResourcesSchedule.d.ts +3 -1
  189. package/lib/components/ResourcesWeekView/ResourcesWeekView.d.ts +7 -1
  190. package/lib/components/ResourcesWeekView/ResourcesWeekViewRow.d.ts +1 -1
  191. package/lib/components/Schedule/Schedule.d.ts +3 -1
  192. package/lib/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.d.ts +19 -0
  193. package/lib/components/ScheduleBackgroundEvent/index.d.ts +2 -0
  194. package/lib/components/ScheduleHeader/HeaderControl/HeaderControl.d.ts +3 -3
  195. package/lib/components/ScheduleHeader/ScheduleHeaderBase.d.ts +1 -1
  196. package/lib/components/WeekView/WeekView.d.ts +7 -1
  197. package/lib/components/WeekView/WeekViewDay.d.ts +1 -1
  198. package/lib/components/YearView/YearViewMonth.d.ts +1 -1
  199. package/lib/hooks/use-drag-drop-handlers.d.ts +10 -1
  200. package/lib/hooks/use-event-resize.d.ts +2 -1
  201. package/lib/hooks/use-horizontal-event-resize.d.ts +2 -1
  202. package/lib/index.d.mts +1 -0
  203. package/lib/index.d.ts +1 -0
  204. package/lib/types.d.ts +1 -1
  205. package/lib/utils/calculate-drop-time/calculate-drop-time.d.ts +11 -1
  206. package/package.json +8 -5
  207. package/styles.css +160 -0
  208. package/styles.layer.css +160 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ResourcesWeekView.module.mjs","names":[],"sources":["../../../src/components/ResourcesWeekView/ResourcesWeekView.module.css"],"sourcesContent":[".resourcesWeekView {\n --resources-week-view-radius: var(--schedule-radius, var(--mantine-radius-default));\n --resources-week-view-resource-label-width: 120px;\n --resources-week-view-slot-width: 60px;\n --resources-week-view-row-height: 64px;\n --resources-week-view-group-label-width: 80px;\n --resources-week-view-all-day-height: 20px;\n\n @mixin where-light {\n --resources-week-view-border-color: var(--mantine-color-gray-3);\n --resources-week-view-business-hours-bg: var(--mantine-color-white);\n --resources-week-view-non-business-hours-bg: var(--mantine-color-gray-0);\n }\n\n @mixin where-dark {\n --resources-week-view-border-color: var(--mantine-color-dark-4);\n --resources-week-view-business-hours-bg: var(--mantine-color-dark-7);\n --resources-week-view-non-business-hours-bg: var(--mantine-color-dark-6);\n }\n}\n\n.resourcesWeekViewRoot {\n border: 1px solid var(--resources-week-view-border-color);\n border-radius: var(--resources-week-view-radius);\n overflow: hidden;\n max-width: fit-content;\n position: relative;\n}\n\n.resourcesWeekViewScrollArea {\n :where([data-mantine-scrollbar]) {\n z-index: 20;\n }\n\n :where([data-scrollarea-viewport]) {\n overscroll-behavior-x: none;\n }\n}\n\n.resourcesWeekViewInner {\n display: inline-flex;\n flex-direction: column;\n position: relative;\n}\n\n.resourcesWeekViewHeaderRows {\n display: flex;\n position: sticky;\n top: 0;\n z-index: 5;\n background-color: var(--mantine-color-body);\n border-bottom: 1px solid var(--resources-week-view-border-color);\n margin-bottom: -1px;\n}\n\n.resourcesWeekViewCorner {\n flex: 0 0 var(--resources-week-view-resource-label-width);\n min-width: var(--resources-week-view-resource-label-width);\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n position: sticky;\n left: 0;\n z-index: 6;\n background-color: var(--mantine-color-body);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n}\n\n.resourcesWeekViewHeaderContent {\n display: flex;\n flex-direction: column;\n}\n\n.resourcesWeekViewDayLabelsRow {\n display: flex;\n border-bottom: 1px solid var(--resources-week-view-border-color);\n}\n\n.resourcesWeekViewDayLabel {\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n cursor: default;\n height: 32px;\n text-transform: capitalize;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n\n &:where(:last-of-type) {\n border-inline-end: none;\n }\n\n &:where([data-weekend]) {\n color: var(--mantine-color-red-6);\n }\n\n &:where([data-today]) {\n color: var(--mantine-primary-color-contrast);\n background-color: var(--mantine-primary-color-filled);\n font-weight: var(--mantine-font-weight-bold);\n }\n}\n\n.resourcesWeekViewTimeLabelsRow {\n display: flex;\n}\n\n.resourcesWeekViewTimeLabel {\n flex: 0 0 var(--resources-week-view-slot-width);\n min-width: var(--resources-week-view-slot-width);\n max-width: var(--resources-week-view-slot-width);\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-xs);\n user-select: none;\n cursor: default;\n font-variant-numeric: tabular-nums;\n text-transform: uppercase;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n\n &:where(:last-of-type) {\n border-inline-end: none;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--resources-week-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--resources-week-view-non-business-hours-bg);\n }\n}\n\n.resourcesWeekViewRow {\n display: flex;\n border-top: 1px solid var(--resources-week-view-border-color);\n}\n\n.resourcesWeekViewResourceLabel {\n flex: 0 0 var(--resources-week-view-resource-label-width);\n min-width: var(--resources-week-view-resource-label-width);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 4px 8px;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n min-height: var(--resources-week-view-row-height);\n position: sticky;\n left: 0;\n z-index: 4;\n background-color: var(--mantine-color-body);\n transition: box-shadow 100ms ease;\n\n &:where([data-scrolled-x]) {\n box-shadow: var(--mantine-shadow-sm);\n }\n\n &:where([data-has-groups]) {\n left: var(--resources-week-view-group-label-width);\n }\n}\n\n.resourcesWeekViewGroupColumn {\n flex: 0 0 var(--resources-week-view-group-label-width);\n min-width: var(--resources-week-view-group-label-width);\n min-height: var(--resources-week-view-row-height);\n position: sticky;\n left: 0;\n z-index: 12;\n background-color: var(--mantine-color-body);\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n overflow-wrap: break-word;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n overflow: visible;\n\n &:where([data-group-position='first']),\n &:where([data-group-position='only']) {\n z-index: 13;\n }\n\n &:where([data-group-position='middle']),\n &:where([data-group-position='last']) {\n margin-top: -1px;\n min-height: calc(var(--resources-week-view-row-height) + 1px);\n }\n}\n\n.resourcesWeekViewGroupColumnEmpty {\n flex: 0 0 var(--resources-week-view-group-label-width);\n min-width: var(--resources-week-view-group-label-width);\n min-height: var(--resources-week-view-row-height);\n position: sticky;\n left: 0;\n z-index: 12;\n background-color: var(--mantine-color-body);\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n}\n\n.resourcesWeekViewRowSlots {\n display: flex;\n position: relative;\n min-height: var(--resources-week-view-row-height);\n}\n\n.resourcesWeekViewRowSlot {\n flex: 0 0 var(--resources-week-view-slot-width);\n min-width: var(--resources-week-view-slot-width);\n max-width: var(--resources-week-view-slot-width);\n min-height: var(--resources-week-view-row-height);\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n cursor: pointer;\n position: relative;\n\n &:where(:last-of-type) {\n border-inline-end: none;\n }\n\n @mixin hover {\n @mixin where-light {\n background-color: var(--mantine-color-gray-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n }\n\n &:where(:focus) {\n z-index: 1;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--resources-week-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--resources-week-view-non-business-hours-bg);\n }\n\n &:where([data-drop-target]) {\n @mixin where-light {\n background-color: var(--mantine-color-blue-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n border-radius: 2px;\n\n @mixin where-light {\n border-color: var(--mantine-color-blue-4);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-color-blue-6);\n }\n }\n }\n\n &:where([data-drag-selected]) {\n &,\n &:hover {\n background-color: var(--mantine-primary-color-light);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: -1px;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n\n @mixin where-light {\n border-color: var(--mantine-primary-color-2);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-primary-color-9);\n }\n }\n }\n\n &:where([data-drag-slot-index]) {\n touch-action: none;\n }\n\n &:where([data-static]) {\n cursor: default;\n pointer-events: none;\n }\n}\n\n.resourcesWeekViewBackgroundEvent {\n position: absolute;\n pointer-events: none;\n z-index: 2;\n border-radius: var(--resources-week-view-radius);\n background-color: var(--bg-event-bg);\n overflow: hidden;\n font-size: 12px;\n font-weight: var(--mantine-font-weight-medium);\n padding: 3px 4px;\n color: var(--bg-event-color);\n}\n\n.resourcesWeekViewAllDayEvent {\n position: absolute;\n height: var(--resources-week-view-all-day-height);\n z-index: 2;\n}\n\n.resourcesWeekViewResizeHandle {\n position: absolute;\n top: 20%;\n width: 4px;\n height: 60%;\n cursor: ew-resize;\n z-index: 5;\n border-radius: 2px;\n opacity: 0;\n transition: opacity 100ms ease;\n pointer-events: all;\n background-color: var(--event-color);\n\n &::before {\n content: '';\n position: absolute;\n inset: -4px -6px;\n }\n\n &:where([data-edge='start']) {\n left: -2px;\n }\n\n &:where([data-edge='end']) {\n right: -2px;\n }\n}\n\n.resourcesWeekViewEventWrapper {\n position: absolute;\n z-index: 3;\n\n &:hover .resourcesWeekViewResizeHandle {\n opacity: 0.5;\n }\n\n & .resourcesWeekViewResizeHandle:hover {\n opacity: 0.8;\n }\n\n &:where([data-resizing]) .resourcesWeekViewResizeHandle:where([data-active]) {\n opacity: 0.8;\n }\n\n &:where([data-resizing]) .resourcesWeekViewResizeHandle:not([data-active]) {\n opacity: 0;\n pointer-events: none;\n }\n}\n\n.resourcesWeekView:where([data-event-interaction]) .resourcesWeekViewRowSlot {\n pointer-events: none;\n}\n\n.resourcesWeekView:where([data-resizing]) {\n & * {\n cursor: ew-resize !important;\n }\n\n & .resourcesWeekViewEventWrapper:not([data-resizing]) {\n pointer-events: none;\n\n & .resourcesWeekViewResizeHandle {\n opacity: 0;\n }\n }\n}\n\n.resourcesWeekViewCurrentTimeIndicator {\n --_indicator-color: var(--resources-week-view-indicator-color, var(--mantine-color-red-7));\n --_time-bubble-height: 18px;\n --_thumb-size: 12px;\n\n position: absolute;\n pointer-events: none;\n top: 62px;\n bottom: 0;\n left: var(--indicator-left-offset);\n width: 2px;\n z-index: 3;\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--_indicator-color);\n opacity: 0.2;\n }\n}\n\n.resourcesWeekViewCurrentTimeIndicatorLine {\n width: 100%;\n position: absolute;\n top: 0;\n bottom: 0;\n background-color: var(--_indicator-color);\n}\n\n.resourcesWeekViewCurrentTimeIndicatorThumb {\n position: absolute;\n top: calc(-1 * (var(--_thumb-size) / 2 - 1px));\n width: var(--_thumb-size);\n height: var(--_thumb-size);\n border-radius: 50%;\n border: 1px solid var(--mantine-color-body);\n background-color: var(--_indicator-color);\n left: calc(-1 * (var(--_thumb-size) / 2 - 1px));\n}\n\n.resourcesWeekViewCurrentTimeIndicatorTimeBubble {\n position: absolute;\n top: 0;\n height: var(--_time-bubble-height);\n width: var(--_time-bubble-width);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 1000px;\n background-color: var(--_indicator-color);\n color: var(--mantine-color-white);\n font-size: var(--mantine-font-size-xs);\n font-weight: var(--mantine-font-weight-bold);\n box-shadow: var(--mantine-shadow-sm);\n white-space: nowrap;\n font-variant-numeric: tabular-nums;\n text-transform: uppercase;\n left: calc(-1 * (var(--_time-bubble-width) / 2 - 1px));\n z-index: 3;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"ResourcesWeekView.module.mjs","names":[],"sources":["../../../src/components/ResourcesWeekView/ResourcesWeekView.module.css"],"sourcesContent":[".resourcesWeekView {\n --resources-week-view-radius: var(--schedule-radius, var(--mantine-radius-default));\n --resources-week-view-resource-label-width: 120px;\n --resources-week-view-slot-width: 60px;\n --resources-week-view-row-height: 64px;\n --resources-week-view-group-label-width: 80px;\n --resources-week-view-all-day-height: 20px;\n\n @mixin where-light {\n --resources-week-view-border-color: var(--mantine-color-gray-3);\n --resources-week-view-business-hours-bg: var(--mantine-color-white);\n --resources-week-view-non-business-hours-bg: var(--mantine-color-gray-0);\n }\n\n @mixin where-dark {\n --resources-week-view-border-color: var(--mantine-color-dark-4);\n --resources-week-view-business-hours-bg: var(--mantine-color-dark-7);\n --resources-week-view-non-business-hours-bg: var(--mantine-color-dark-6);\n }\n}\n\n.resourcesWeekViewRoot {\n border: 1px solid var(--resources-week-view-border-color);\n border-radius: var(--resources-week-view-radius);\n overflow: hidden;\n max-width: fit-content;\n position: relative;\n}\n\n.resourcesWeekViewScrollArea {\n :where([data-mantine-scrollbar]) {\n z-index: 20;\n }\n\n :where([data-scrollarea-viewport]) {\n overscroll-behavior-x: none;\n }\n}\n\n.resourcesWeekViewInner {\n display: inline-flex;\n flex-direction: column;\n position: relative;\n}\n\n.resourcesWeekViewHeaderRows {\n display: flex;\n position: sticky;\n top: 0;\n z-index: 5;\n background-color: var(--mantine-color-body);\n border-bottom: 1px solid var(--resources-week-view-border-color);\n margin-bottom: -1px;\n}\n\n.resourcesWeekViewCorner {\n flex: 0 0 var(--resources-week-view-resource-label-width);\n min-width: var(--resources-week-view-resource-label-width);\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n position: sticky;\n left: 0;\n z-index: 6;\n background-color: var(--mantine-color-body);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n}\n\n.resourcesWeekViewHeaderContent {\n display: flex;\n flex-direction: column;\n}\n\n.resourcesWeekViewDayLabelsRow {\n display: flex;\n border-bottom: 1px solid var(--resources-week-view-border-color);\n}\n\n.resourcesWeekViewDayLabel {\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n cursor: default;\n height: 32px;\n text-transform: capitalize;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n\n &:where(:last-of-type) {\n border-inline-end: none;\n }\n\n &:where([data-weekend]) {\n color: var(--mantine-color-red-6);\n }\n\n &:where([data-today]) {\n color: var(--mantine-primary-color-contrast);\n background-color: var(--mantine-primary-color-filled);\n font-weight: var(--mantine-font-weight-bold);\n }\n}\n\n.resourcesWeekViewTimeLabelsRow {\n display: flex;\n}\n\n.resourcesWeekViewTimeLabel {\n flex: 0 0 var(--resources-week-view-slot-width);\n min-width: var(--resources-week-view-slot-width);\n max-width: var(--resources-week-view-slot-width);\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--mantine-font-size-xs);\n user-select: none;\n cursor: default;\n font-variant-numeric: tabular-nums;\n text-transform: uppercase;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n\n &:where(:last-of-type) {\n border-inline-end: none;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--resources-week-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--resources-week-view-non-business-hours-bg);\n }\n}\n\n.resourcesWeekViewRow {\n display: flex;\n border-top: 1px solid var(--resources-week-view-border-color);\n}\n\n.resourcesWeekViewResourceLabel {\n flex: 0 0 var(--resources-week-view-resource-label-width);\n min-width: var(--resources-week-view-resource-label-width);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 4px 8px;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n min-height: var(--resources-week-view-row-height);\n position: sticky;\n left: 0;\n z-index: 4;\n background-color: var(--mantine-color-body);\n transition: box-shadow 100ms ease;\n\n &:where([data-scrolled-x]) {\n box-shadow: var(--mantine-shadow-sm);\n }\n\n &:where([data-has-groups]) {\n left: var(--resources-week-view-group-label-width);\n }\n}\n\n.resourcesWeekViewGroupColumn {\n flex: 0 0 var(--resources-week-view-group-label-width);\n min-width: var(--resources-week-view-group-label-width);\n min-height: var(--resources-week-view-row-height);\n position: sticky;\n left: 0;\n z-index: 12;\n background-color: var(--mantine-color-body);\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: center;\n overflow-wrap: break-word;\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n user-select: none;\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n overflow: visible;\n\n &:where([data-group-position='first']),\n &:where([data-group-position='only']) {\n z-index: 13;\n }\n\n &:where([data-group-position='middle']),\n &:where([data-group-position='last']) {\n margin-top: -1px;\n min-height: calc(var(--resources-week-view-row-height) + 1px);\n }\n}\n\n.resourcesWeekViewGroupColumnEmpty {\n flex: 0 0 var(--resources-week-view-group-label-width);\n min-width: var(--resources-week-view-group-label-width);\n min-height: var(--resources-week-view-row-height);\n position: sticky;\n left: 0;\n z-index: 12;\n background-color: var(--mantine-color-body);\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n}\n\n.resourcesWeekViewRowSlots {\n display: flex;\n position: relative;\n min-height: var(--resources-week-view-row-height);\n}\n\n.resourcesWeekViewRowSlot {\n flex: 0 0 var(--resources-week-view-slot-width);\n min-width: var(--resources-week-view-slot-width);\n max-width: var(--resources-week-view-slot-width);\n min-height: var(--resources-week-view-row-height);\n border-inline-end: 1px solid var(--resources-week-view-border-color);\n cursor: pointer;\n position: relative;\n\n &:where(:last-of-type) {\n border-inline-end: none;\n }\n\n @mixin hover {\n @mixin where-light {\n background-color: var(--mantine-color-gray-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n }\n\n &:where(:focus) {\n z-index: 1;\n }\n\n &:where([data-business-hours]) {\n background-color: var(--resources-week-view-business-hours-bg);\n }\n\n &:where([data-non-business-hours]) {\n background-color: var(--resources-week-view-non-business-hours-bg);\n }\n\n &:where([data-drop-target]) {\n @mixin where-light {\n background-color: var(--mantine-color-blue-1);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-dark-5);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n border-radius: 2px;\n\n @mixin where-light {\n border-color: var(--mantine-color-blue-4);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-color-blue-6);\n }\n }\n }\n\n &:where([data-drag-selected]) {\n &,\n &:hover {\n background-color: var(--mantine-primary-color-light);\n }\n\n &::before {\n content: '';\n position: absolute;\n inset: -1px;\n pointer-events: none;\n z-index: 2;\n border: 1px solid;\n\n @mixin where-light {\n border-color: var(--mantine-primary-color-2);\n }\n\n @mixin where-dark {\n border-color: var(--mantine-primary-color-9);\n }\n }\n }\n\n &:where([data-drag-slot-index]) {\n touch-action: none;\n }\n\n &:where([data-static]) {\n cursor: default;\n pointer-events: none;\n }\n}\n\n.resourcesWeekViewBackgroundEvent {\n position: absolute;\n pointer-events: none;\n z-index: 2;\n border-radius: var(--resources-week-view-radius);\n background-color: var(--bg-event-bg);\n overflow: hidden;\n font-size: 12px;\n font-weight: var(--mantine-font-weight-medium);\n padding: 3px 4px;\n color: var(--bg-event-color);\n\n &:where([data-interactive]) {\n pointer-events: auto;\n cursor: pointer;\n user-select: none;\n\n @mixin hover {\n background-color: var(--bg-event-hover);\n }\n }\n}\n\n.resourcesWeekViewAllDayEvent {\n position: absolute;\n height: var(--resources-week-view-all-day-height);\n z-index: 2;\n}\n\n.resourcesWeekViewResizeHandle {\n position: absolute;\n top: 20%;\n width: 4px;\n height: 60%;\n cursor: ew-resize;\n z-index: 5;\n border-radius: 2px;\n opacity: 0;\n transition: opacity 100ms ease;\n pointer-events: all;\n background-color: var(--event-color);\n\n &::before {\n content: '';\n position: absolute;\n inset: -4px -6px;\n }\n\n &:where([data-edge='start']) {\n left: -2px;\n }\n\n &:where([data-edge='end']) {\n right: -2px;\n }\n}\n\n.resourcesWeekViewEventWrapper {\n position: absolute;\n z-index: 3;\n\n &:hover .resourcesWeekViewResizeHandle {\n opacity: 0.5;\n }\n\n & .resourcesWeekViewResizeHandle:hover {\n opacity: 0.8;\n }\n\n &:where([data-resizing]) .resourcesWeekViewResizeHandle:where([data-active]) {\n opacity: 0.8;\n }\n\n &:where([data-resizing]) .resourcesWeekViewResizeHandle:not([data-active]) {\n opacity: 0;\n pointer-events: none;\n }\n}\n\n.resourcesWeekView:where([data-event-interaction]) .resourcesWeekViewRowSlot {\n pointer-events: none;\n}\n\n.resourcesWeekView:where([data-event-interaction], [data-slot-dragging])\n .resourcesWeekViewBackgroundEvent {\n pointer-events: none;\n}\n\n.resourcesWeekView:where([data-resizing]) {\n & * {\n cursor: ew-resize !important;\n }\n\n & .resourcesWeekViewEventWrapper:not([data-resizing]) {\n pointer-events: none;\n\n & .resourcesWeekViewResizeHandle {\n opacity: 0;\n }\n }\n}\n\n.resourcesWeekViewCurrentTimeIndicator {\n --_indicator-color: var(--resources-week-view-indicator-color, var(--mantine-color-red-7));\n --_time-bubble-height: 18px;\n --_thumb-size: 12px;\n\n position: absolute;\n pointer-events: none;\n top: 62px;\n bottom: 0;\n left: var(--indicator-left-offset);\n width: 2px;\n z-index: 3;\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--_indicator-color);\n opacity: 0.2;\n }\n}\n\n.resourcesWeekViewCurrentTimeIndicatorLine {\n width: 100%;\n position: absolute;\n top: 0;\n bottom: 0;\n background-color: var(--_indicator-color);\n}\n\n.resourcesWeekViewCurrentTimeIndicatorThumb {\n position: absolute;\n top: calc(-1 * (var(--_thumb-size) / 2 - 1px));\n width: var(--_thumb-size);\n height: var(--_thumb-size);\n border-radius: 50%;\n border: 1px solid var(--mantine-color-body);\n background-color: var(--_indicator-color);\n left: calc(-1 * (var(--_thumb-size) / 2 - 1px));\n}\n\n.resourcesWeekViewCurrentTimeIndicatorTimeBubble {\n position: absolute;\n top: 0;\n height: var(--_time-bubble-height);\n width: var(--_time-bubble-width);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 1000px;\n background-color: var(--_indicator-color);\n color: var(--mantine-color-white);\n font-size: var(--mantine-font-size-xs);\n font-weight: var(--mantine-font-weight-bold);\n box-shadow: var(--mantine-shadow-sm);\n white-space: nowrap;\n font-variant-numeric: tabular-nums;\n text-transform: uppercase;\n left: calc(-1 * (var(--_time-bubble-width) / 2 - 1px));\n z-index: 3;\n}\n\n.resourcesWeekViewDragPreview {\n pointer-events: none;\n z-index: 3;\n border-radius: var(--resources-week-view-radius);\n border: 1px dashed var(--mantine-color-blue-filled);\n background-color: var(--mantine-color-blue-light);\n opacity: 0.6;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ResourcesWeekViewRow.mjs","names":[],"sources":["../../../src/components/ResourcesWeekView/ResourcesWeekViewRow.tsx"],"sourcesContent":["import { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { ScheduleMode, ScheduleResourceData, ScheduleResourceGroup } from '../../types';\nimport {\n DayTimeInterval,\n getBusinessHoursMod,\n ResourceGroupInfo,\n ResourcesGridControlsRef,\n} from '../../utils';\nimport type { ResourcesWeekViewFactory } from './ResourcesWeekView';\n\nexport interface ResourcesWeekViewRowProps {\n resource: ScheduleResourceData;\n resourceIndex: number;\n weekdays: string[];\n slots: DayTimeInterval[];\n getStyles: GetStylesApi<ResourcesWeekViewFactory>;\n children?: React.ReactNode;\n labels?: ScheduleLabelsOverride;\n highlightBusinessHours?: boolean;\n businessHours?: [string, string];\n withEventsDragAndDrop?: boolean;\n onRowSlotsDragOver?: (\n e: React.DragEvent<HTMLDivElement>,\n resourceId: string | number,\n resourceIndex: number\n ) => void;\n onRowSlotsDragLeave?: () => void;\n onRowSlotsDrop?: (\n e: React.DragEvent<HTMLDivElement>,\n resourceId: string | number,\n resourceIndex: number\n ) => void;\n onSlotClick?: (\n resourceId: string | number,\n day: string,\n slotTime: string,\n event: React.MouseEvent<HTMLButtonElement>\n ) => void;\n dropTargetSlotIndex?: number;\n mode?: ScheduleMode;\n slotsRef?: ResourcesGridControlsRef;\n firstSlotIndex?: { resourceIndex: number; slotIndex: number };\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n resourceIndex: number,\n slotIndex: number\n ) => void;\n withDragSlotSelect?: boolean;\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n isSlotDragSelected?: (index: number, group: string) => boolean;\n rowSlotsContainerRef?: (node: HTMLDivElement | null) => void;\n renderResourceLabel?: (resource: ScheduleResourceData) => React.ReactNode;\n renderGroupLabel?: (group: ScheduleResourceGroup) => React.ReactNode;\n scrolledX?: boolean;\n groupInfo?: ResourceGroupInfo | null;\n allDayCount?: number;\n}\n\nexport function ResourcesWeekViewRow({\n resource,\n resourceIndex,\n weekdays,\n slots,\n getStyles,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onRowSlotsDragOver,\n onRowSlotsDragLeave,\n onRowSlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n rowSlotsContainerRef,\n renderResourceLabel,\n renderGroupLabel,\n scrolledX,\n groupInfo,\n allDayCount,\n}: ResourcesWeekViewRowProps) {\n const slotGroup = String(resource.id);\n\n const items = weekdays.flatMap((day, dayIndex) =>\n slots.map((slot, slotIndex) => {\n const flatIndex = dayIndex * slots.length + slotIndex;\n const isDropTarget = dropTargetSlotIndex === flatIndex;\n const isFirstSlot =\n firstSlotIndex?.resourceIndex === resourceIndex && firstSlotIndex?.slotIndex === flatIndex;\n const isDragSelected = isSlotDragSelected?.(flatIndex, slotGroup) || false;\n\n return (\n <UnstyledButton\n key={`${day}-${slot.startTime}`}\n ref={(node) => {\n if (!slotsRef?.current) {\n return;\n }\n if (!slotsRef.current[resourceIndex]) {\n slotsRef.current[resourceIndex] = [];\n }\n const row = slotsRef.current[resourceIndex];\n if (node) {\n row[flatIndex] = node;\n } else {\n delete row[flatIndex];\n while (row.length > 0 && row[row.length - 1] == null) {\n row.length -= 1;\n }\n }\n }}\n {...getStyles('resourcesWeekViewRowSlot')}\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 aria-label={`${getLabel('resourceSlot', labels)} ${resource.label} ${day} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? flatIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? slotGroup : undefined}\n onKeyDown={(e) => {\n if (onSlotKeyDown) {\n onSlotKeyDown(e, resourceIndex, flatIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, flatIndex, slotGroup)\n : undefined\n }\n onClick={\n mode === 'static' || !onSlotClick\n ? undefined\n : (e) => onSlotClick(resource.id, day, slot.startTime, e)\n }\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n />\n );\n })\n );\n\n const isGroupStart = groupInfo?.position === 'first' || groupInfo?.position === 'only';\n const groupCell =\n groupInfo !== undefined ? (\n groupInfo !== null ? (\n <Box\n {...getStyles('resourcesWeekViewGroupColumn')}\n mod={{ 'scrolled-x': scrolledX, 'group-position': groupInfo.position }}\n >\n {isGroupStart && (\n <span\n style={\n groupInfo.count > 1\n ? {\n transform: `translateY(calc((${groupInfo.count - 1} * (var(--resources-week-view-row-height) + 1px)) / 2))`,\n }\n : undefined\n }\n >\n {renderGroupLabel ? renderGroupLabel(groupInfo.group) : groupInfo.group.label}\n </span>\n )}\n </Box>\n ) : (\n <Box\n {...getStyles('resourcesWeekViewGroupColumnEmpty')}\n mod={{ 'scrolled-x': scrolledX }}\n />\n )\n ) : null;\n\n return (\n <Box {...getStyles('resourcesWeekViewRow')}>\n {groupCell}\n <Box\n {...getStyles('resourcesWeekViewResourceLabel')}\n mod={{ 'scrolled-x': scrolledX, 'has-groups': groupInfo !== undefined }}\n >\n {renderResourceLabel ? renderResourceLabel(resource) : resource.label}\n </Box>\n <Box\n ref={rowSlotsContainerRef}\n {...getStyles('resourcesWeekViewRowSlots', {\n style: allDayCount\n ? {\n minHeight: `max(var(--resources-week-view-row-height), calc(${allDayCount} * (var(--resources-week-view-all-day-height) + 2px) + 4px))`,\n }\n : undefined,\n })}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onRowSlotsDragOver?.(e, resource.id, resourceIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onRowSlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onRowSlotsDrop?.(e, resource.id, resourceIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;AA+DA,SAAgB,qBAAqB,EACnC,UACA,eACA,UACA,OACA,WACA,UACA,QACA,wBACA,eACA,uBACA,oBACA,qBACA,gBACA,aACA,qBACA,MACA,UACA,gBACA,eACA,oBACA,mBACA,oBACA,sBACA,qBACA,kBACA,WACA,WACA,eAC4B;CAC5B,MAAM,YAAY,OAAO,SAAS,EAAE;CAEpC,MAAM,QAAQ,SAAS,SAAS,KAAK,aACnC,MAAM,KAAK,MAAM,cAAc;EAC7B,MAAM,YAAY,WAAW,MAAM,SAAS;EAC5C,MAAM,eAAe,wBAAwB;EAC7C,MAAM,cACJ,gBAAgB,kBAAkB,iBAAiB,gBAAgB,cAAc;EACnF,MAAM,iBAAiB,qBAAqB,WAAW,SAAS,KAAK;EAErE,OACE,oBAAC,gBAAD;GAEE,MAAM,SAAS;IACb,IAAI,CAAC,UAAU,SACb;IAEF,IAAI,CAAC,SAAS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oB,UAAU,QAAQ,EAAE,yDACrD,IACA,KAAA;aAGL,mBAAmB,iBAAiB,UAAU,KAAK,IAAI,UAAU,MAAM;EACpE,CAAA;CAEL,CAAA,IAEL,oBAAC,KAAD;EACE,GAAI,UAAU,mCAAmC;EACjD,KAAK,EAAE,cAAc,UAAU;CAChC,CAAA,IAED;CAEN,OACE,qBAAC,KAAD;EAAK,GAAI,UAAU,sBAAsB;YAAzC;GACG;GACD,oBAAC,KAAD;IACE,GAAI,UAAU,gCAAgC;IAC9C,KAAK;KAAE,cAAc;KAAW,cAAc,cAAc,KAAA;IAAU;cAErE,sBAAsB,oBAAoB,QAAQ,IAAI,SAAS;GAC7D,CAAA;GACL,qBAAC,KAAD;IACE,KAAK;IACL,GAAI,UAAU,6BAA6B,EACzC,OAAO,cACH,EACE,WAAW,mDAAmD,YAAY,8DAC5E,IACA,KAAA,EACN,CAAC;IACD,YACE,yBAAyB,SAAS,YAC7B,MAAM,qBAAqB,GAAG,SAAS,IAAI,aAAa,IACzD,KAAA;IAEN,aAAa,yBAAyB,SAAS,WAAW,sBAAsB,KAAA;IAChF,QACE,yBAAyB,SAAS,YAC7B,MAAM,iBAAiB,GAAG,SAAS,IAAI,aAAa,IACrD,KAAA;cAlBR,CAqBG,UACA,KACE;;EACF;;AAET"}
1
+ {"version":3,"file":"ResourcesWeekViewRow.mjs","names":[],"sources":["../../../src/components/ResourcesWeekView/ResourcesWeekViewRow.tsx"],"sourcesContent":["import { Box, GetStylesApi, UnstyledButton } from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../labels';\nimport { ScheduleMode, ScheduleResourceData, ScheduleResourceGroup } from '../../types';\nimport {\n DayTimeInterval,\n getBusinessHoursMod,\n ResourceGroupInfo,\n ResourcesGridControlsRef,\n} from '../../utils';\nimport type { ResourcesWeekViewFactory } from './ResourcesWeekView';\n\nexport interface ResourcesWeekViewRowProps {\n resource: ScheduleResourceData;\n resourceIndex: number;\n weekdays: string[];\n slots: DayTimeInterval[];\n getStyles: GetStylesApi<ResourcesWeekViewFactory>;\n children?: React.ReactNode;\n labels?: ScheduleLabelsOverride;\n highlightBusinessHours?: boolean;\n businessHours?: [string, string];\n withEventsDragAndDrop?: boolean;\n onRowSlotsDragOver?: (\n e: React.DragEvent<HTMLDivElement>,\n resourceId: string | number,\n resourceIndex: number\n ) => void;\n onRowSlotsDragLeave?: () => void;\n onRowSlotsDrop?: (\n e: React.DragEvent<HTMLDivElement>,\n resourceId: string | number,\n resourceIndex: number\n ) => void;\n onSlotClick?: (\n resourceId: string | number,\n day: string,\n slotTime: string,\n event: React.MouseEvent<HTMLButtonElement>\n ) => void;\n dropTargetSlotIndex?: number;\n mode?: ScheduleMode;\n slotsRef?: ResourcesGridControlsRef;\n firstSlotIndex?: { resourceIndex: number; slotIndex: number };\n onSlotKeyDown?: (\n event: React.KeyboardEvent<HTMLButtonElement>,\n resourceIndex: number,\n slotIndex: number\n ) => void;\n withDragSlotSelect?: boolean;\n onSlotPointerDown?: (\n event: React.PointerEvent<HTMLButtonElement>,\n index: number,\n group: string\n ) => void;\n isSlotDragSelected?: (index: number, group: string) => boolean;\n rowSlotsContainerRef?: (node: HTMLDivElement | null) => void;\n renderResourceLabel?: (resource: ScheduleResourceData) => React.ReactNode;\n renderGroupLabel?: (group: ScheduleResourceGroup) => React.ReactNode;\n scrolledX?: boolean;\n groupInfo?: ResourceGroupInfo | null;\n allDayCount?: number;\n}\n\nexport function ResourcesWeekViewRow({\n resource,\n resourceIndex,\n weekdays,\n slots,\n getStyles,\n children,\n labels,\n highlightBusinessHours,\n businessHours,\n withEventsDragAndDrop,\n onRowSlotsDragOver,\n onRowSlotsDragLeave,\n onRowSlotsDrop,\n onSlotClick,\n dropTargetSlotIndex,\n mode,\n slotsRef,\n firstSlotIndex,\n onSlotKeyDown,\n withDragSlotSelect,\n onSlotPointerDown,\n isSlotDragSelected,\n rowSlotsContainerRef,\n renderResourceLabel,\n renderGroupLabel,\n scrolledX,\n groupInfo,\n allDayCount,\n}: ResourcesWeekViewRowProps) {\n const slotGroup = String(resource.id);\n\n const items = weekdays.flatMap((day, dayIndex) =>\n slots.map((slot, slotIndex) => {\n const flatIndex = dayIndex * slots.length + slotIndex;\n const isDropTarget = dropTargetSlotIndex === flatIndex;\n const isFirstSlot =\n firstSlotIndex?.resourceIndex === resourceIndex && firstSlotIndex?.slotIndex === flatIndex;\n const isDragSelected = isSlotDragSelected?.(flatIndex, slotGroup) || false;\n\n return (\n <UnstyledButton\n key={`${day}-${slot.startTime}`}\n ref={(node) => {\n if (!slotsRef?.current) {\n return;\n }\n if (!slotsRef.current[resourceIndex]) {\n slotsRef.current[resourceIndex] = [];\n }\n const row = slotsRef.current[resourceIndex];\n if (node) {\n row[flatIndex] = node;\n } else {\n delete row[flatIndex];\n while (row.length > 0 && row[row.length - 1] == null) {\n row.length -= 1;\n }\n }\n }}\n {...getStyles('resourcesWeekViewRowSlot')}\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 aria-label={`${getLabel('resourceSlot', labels)} ${resource.label} ${day} ${slot.startTime} - ${slot.endTime}`}\n tabIndex={mode === 'static' ? -1 : isFirstSlot ? 0 : -1}\n data-drag-slot-index={withDragSlotSelect && mode !== 'static' ? flatIndex : undefined}\n data-drag-slot-group={withDragSlotSelect && mode !== 'static' ? slotGroup : undefined}\n onKeyDown={(e) => {\n if (onSlotKeyDown) {\n onSlotKeyDown(e, resourceIndex, flatIndex);\n }\n }}\n onPointerDown={\n withDragSlotSelect && mode !== 'static'\n ? (e) => onSlotPointerDown?.(e, flatIndex, slotGroup)\n : undefined\n }\n onClick={\n mode === 'static' || !onSlotClick\n ? undefined\n : (e) => onSlotClick(resource.id, day, slot.startTime, e)\n }\n onDragOver={\n withEventsDragAndDrop && mode !== 'static' ? (e) => e.preventDefault() : undefined\n }\n />\n );\n })\n );\n\n const isGroupStart = groupInfo?.position === 'first' || groupInfo?.position === 'only';\n const groupCell =\n groupInfo !== undefined ? (\n groupInfo !== null ? (\n <Box\n {...getStyles('resourcesWeekViewGroupColumn')}\n mod={{ 'scrolled-x': scrolledX, 'group-position': groupInfo.position }}\n >\n {isGroupStart && (\n <span\n style={\n groupInfo.count > 1\n ? {\n transform: `translateY(calc((${groupInfo.count - 1} * (var(--resources-week-view-row-height) + 1px)) / 2))`,\n }\n : undefined\n }\n >\n {renderGroupLabel ? renderGroupLabel(groupInfo.group) : groupInfo.group.label}\n </span>\n )}\n </Box>\n ) : (\n <Box\n {...getStyles('resourcesWeekViewGroupColumnEmpty')}\n mod={{ 'scrolled-x': scrolledX }}\n />\n )\n ) : null;\n\n return (\n <Box {...getStyles('resourcesWeekViewRow')}>\n {groupCell}\n <Box\n {...getStyles('resourcesWeekViewResourceLabel')}\n mod={{ 'scrolled-x': scrolledX, 'has-groups': groupInfo !== undefined }}\n >\n {renderResourceLabel ? renderResourceLabel(resource) : resource.label}\n </Box>\n <Box\n ref={rowSlotsContainerRef}\n {...getStyles('resourcesWeekViewRowSlots', {\n style: allDayCount\n ? {\n minHeight: `max(var(--resources-week-view-row-height), calc(${allDayCount} * (var(--resources-week-view-all-day-height) + 2px) + 4px))`,\n }\n : undefined,\n })}\n onDragOver={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onRowSlotsDragOver?.(e, resource.id, resourceIndex)\n : undefined\n }\n onDragLeave={withEventsDragAndDrop && mode !== 'static' ? onRowSlotsDragLeave : undefined}\n onDrop={\n withEventsDragAndDrop && mode !== 'static'\n ? (e) => onRowSlotsDrop?.(e, resource.id, resourceIndex)\n : undefined\n }\n >\n {children}\n {items}\n </Box>\n </Box>\n );\n}\n"],"mappings":";;;;;;AA+DA,SAAgB,qBAAqB,EACnC,UACA,eACA,UACA,OACA,WACA,UACA,QACA,wBACA,eACA,uBACA,oBACA,qBACA,gBACA,aACA,qBACA,MACA,UACA,gBACA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AqBG,UACA,KACE;;EACF;;AAET"}
@@ -22,10 +22,12 @@ function assignAllDayRows(bars) {
22
22
  }
23
23
  }
24
24
  function getResourcesWeekViewEvents({ events, resources, weekdays, startTime, endTime, intervalMinutes, expansionLimit }) {
25
+ const rangeStart = dayjs(weekdays[0]).startOf("day").toDate();
26
+ const rangeEnd = dayjs(weekdays[weekdays.length - 1]).endOf("day").toDate();
25
27
  const expandedEvents = expandRecurringEvents({
26
28
  events,
27
- rangeStart: dayjs(weekdays[0]).startOf("day").toDate(),
28
- rangeEnd: dayjs(weekdays[weekdays.length - 1]).endOf("day").toDate(),
29
+ rangeStart,
30
+ rangeEnd,
29
31
  expansionLimit
30
32
  });
31
33
  if (expandedEvents) {
@@ -71,10 +73,11 @@ function getResourcesWeekViewEvents({ events, resources, weekdays, startTime, en
71
73
  });
72
74
  if (expandedEvents) for (const event of expandedEvents) {
73
75
  if (!isSpanningRegularEvent(event) || event.resourceId === void 0 || !(event.resourceId in allDayBars)) continue;
76
+ const actualEndDate = getEventEndDate(event);
74
77
  const eventWeekDays = calculateEventDays({
75
78
  event,
76
79
  weekDays: weekdays,
77
- actualEndDate: getEventEndDate(event)
80
+ actualEndDate
78
81
  });
79
82
  if (eventWeekDays.length === 0) continue;
80
83
  allDayBars[event.resourceId].push({
@@ -1 +1 @@
1
- {"version":3,"file":"get-resources-week-view-events.mjs","names":[],"sources":["../../../../src/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { ScheduleEventData, ScheduleResourceData } from '../../../types';\nimport { expandRecurringEvents, isMultidayEvent } from '../../../utils';\nimport {\n getResourcesDayViewEvents,\n ResourcesDayViewEventsResult,\n} from '../../ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events';\nimport { calculateEventDays } from '../../WeekView/get-week-view-events/calculate-event-days';\nimport { getEventEndDate } from '../../WeekView/get-week-view-events/get-event-end-date';\n\n/** A single all-day bar (single-day all-day event or a multi-day event) spanning one or more\n * consecutive visible weekdays, placed on a shared row so overlapping bars do not collide. */\nexport interface ResourcesWeekViewAllDayBar {\n /** The original event, with its declared start/end preserved for display and interaction */\n event: ScheduleEventData;\n /** Index of the first visible weekday the bar covers */\n startDayIndex: number;\n /** Index of the last visible weekday the bar covers */\n endDayIndex: number;\n /** Row within the all-day band, assigned so overlapping bars stack instead of overlapping */\n row: number;\n}\n\nexport interface ResourcesWeekViewEventsResult {\n byDay: Record<string, ResourcesDayViewEventsResult>;\n /** All-day bars per resource, each spanning the days it covers as a single continuous bar */\n allDayBars: Record<string | number, ResourcesWeekViewAllDayBar[]>;\n}\n\n/** Assigns each bar the lowest row whose previously placed bars all end before this bar starts,\n * so bars overlapping in days are stacked on separate rows (mutates `bar.row`). */\nfunction assignAllDayRows(bars: ResourcesWeekViewAllDayBar[]): void {\n const order = bars\n .map((bar, index) => ({ bar, index }))\n .sort(\n (a, b) =>\n a.bar.startDayIndex - b.bar.startDayIndex ||\n a.bar.endDayIndex - b.bar.endDayIndex ||\n a.index - b.index\n );\n\n const rowEnds: number[] = [];\n for (const { bar } of order) {\n let row = 0;\n while (row < rowEnds.length && rowEnds[row] >= bar.startDayIndex) {\n row += 1;\n }\n rowEnds[row] = bar.endDayIndex;\n bar.row = row;\n }\n}\n\ninterface GetResourcesWeekViewEventsInput {\n events: ScheduleEventData[] | undefined;\n resources: ScheduleResourceData[];\n weekdays: string[];\n startTime?: string;\n endTime?: string;\n intervalMinutes?: number;\n expansionLimit?: number;\n}\n\nexport function getResourcesWeekViewEvents({\n events,\n resources,\n weekdays,\n startTime,\n endTime,\n intervalMinutes,\n expansionLimit,\n}: GetResourcesWeekViewEventsInput): ResourcesWeekViewEventsResult {\n const rangeStart = dayjs(weekdays[0]).startOf('day').toDate();\n const rangeEnd = dayjs(weekdays[weekdays.length - 1])\n .endOf('day')\n .toDate();\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart,\n rangeEnd,\n expansionLimit,\n });\n\n if (expandedEvents) {\n const seenIds = new Set<string | number>();\n for (const event of expandedEvents) {\n if (seenIds.has(event.id)) {\n throw new Error(\n `[@mantine/schedule] ResourcesWeekView: Duplicated event ids found: ${event.id}`\n );\n }\n seenIds.add(event.id);\n }\n }\n\n const byDay: Record<string, ResourcesDayViewEventsResult> = {};\n\n const assignedIds = new Set<string | number>();\n\n // Multi-day regular events are rendered as a single all-day bar spanning the days they cover\n // (matching the base WeekView, which treats any multi-day event as all-day), so they are excluded\n // from the per-day timed flow and collected as spanning bars below.\n const isSpanningRegularEvent = (event: ScheduleEventData) =>\n event.display !== 'background' && isMultidayEvent(event);\n\n for (const day of weekdays) {\n const dayEvents = expandedEvents?.filter((event) => {\n if (assignedIds.has(event.id) || isSpanningRegularEvent(event)) {\n return false;\n }\n\n const eventStart = dayjs(event.start);\n const dayStart = dayjs(day).startOf('day');\n\n if (eventStart.isSame(dayStart, 'day')) {\n assignedIds.add(event.id);\n return true;\n }\n\n if (\n event.display === 'background' &&\n eventStart.isBefore(dayjs(day).endOf('day')) &&\n dayjs(event.end).isAfter(dayStart)\n ) {\n return true;\n }\n\n return false;\n });\n\n byDay[day] = getResourcesDayViewEvents({\n events: dayEvents,\n resources,\n date: day,\n startTime,\n endTime,\n intervalMinutes,\n });\n }\n\n const allDayBars: Record<string | number, ResourcesWeekViewAllDayBar[]> = {};\n for (const resource of resources) {\n allDayBars[resource.id] = [];\n }\n\n // Single-day all-day events keep the per-day classification done by getResourcesDayViewEvents and\n // become single-day bars.\n weekdays.forEach((day, dayIndex) => {\n for (const resource of resources) {\n for (const positioned of byDay[day].allDayEvents[resource.id] ?? []) {\n allDayBars[resource.id].push({\n event: positioned,\n startDayIndex: dayIndex,\n endDayIndex: dayIndex,\n row: 0,\n });\n }\n }\n });\n\n // Multi-day regular events become a single bar spanning the visible days they cover.\n if (expandedEvents) {\n for (const event of expandedEvents) {\n if (\n !isSpanningRegularEvent(event) ||\n event.resourceId === undefined ||\n !(event.resourceId in allDayBars)\n ) {\n continue;\n }\n\n const actualEndDate = getEventEndDate(event);\n const eventWeekDays = calculateEventDays({ event, weekDays: weekdays, actualEndDate });\n if (eventWeekDays.length === 0) {\n continue;\n }\n\n allDayBars[event.resourceId].push({\n event,\n startDayIndex: weekdays.indexOf(eventWeekDays[0]),\n endDayIndex: weekdays.indexOf(eventWeekDays[eventWeekDays.length - 1]),\n row: 0,\n });\n }\n }\n\n for (const resource of resources) {\n assignAllDayRows(allDayBars[resource.id]);\n }\n\n return { byDay, allDayBars };\n}\n"],"mappings":";;;;;;;;;;AA+BA,SAAS,iBAAiB,MAA0C;CAClE,MAAM,QAAQ,KACX,KAAK,KAAK,WAAW;EAAE;EAAK;CAAM,EAAE,CAAC,CACrC,MACE,GAAG,MACF,EAAE,IAAI,gBAAgB,EAAE,IAAI,iBAC5B,EAAE,IAAI,cAAc,EAAE,IAAI,eAC1B,EAAE,QAAQ,EAAE,KAChB;CAEF,MAAM,UAAoB,CAAC;CAC3B,KAAK,MAAM,EAAE,SAAS,OAAO;EAC3B,IAAI,MAAM;EACV,OAAO,MAAM,QAAQ,UAAU,QAAQ,QAAQ,IAAI,eACjD,OAAO;EAET,QAAQ,OAAO,IAAI;EACnB,IAAI,MAAM;CACZ;AACF;AAYA,SAAgB,2BAA2B,EACzC,QACA,WACA,UACA,WACA,SACA,iBACA,kBACiE;CAMjE,MAAM,iBAAiB,sBAAsB;EAC3C;EACA,YAPiB,MAAM,SAAS,EAAE,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,OAO1C;EACT,UAPe,MAAM,SAAS,SAAS,SAAS,EAAE,CAAC,CAClD,MAAM,KAAK,CAAC,CACZ,OAKM;EACP;CACF,CAAC;CAED,IAAI,gBAAgB;EAClB,MAAM,0BAAU,IAAI,IAAqB;EACzC,KAAK,MAAM,SAAS,gBAAgB;GAClC,IAAI,QAAQ,IAAI,MAAM,EAAE,GACtB,MAAM,IAAI,MACR,sEAAsE,MAAM,IAC9E;GAEF,QAAQ,IAAI,MAAM,EAAE;EACtB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C;EACrF,IAAI,cAAc,WAAW,GAC3B;EAGF,WAAW,MAAM,WAAW,CAAC,KAAK;GAChC;GACA,eAAe,SAAS,QAAQ,cAAc,EAAE;GAChD,aAAa,SAAS,QAAQ,cAAc,cAAc,SAAS,EAAE;GACrE,KAAK;EACP,CAAC;CACH;CAGF,KAAK,MAAM,YAAY,WACrB,iBAAiB,WAAW,SAAS,GAAG;CAG1C,OAAO;EAAE;EAAO;CAAW;AAC7B"}
1
+ {"version":3,"file":"get-resources-week-view-events.mjs","names":[],"sources":["../../../../src/components/ResourcesWeekView/get-resources-week-view-events/get-resources-week-view-events.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport { ScheduleEventData, ScheduleResourceData } from '../../../types';\nimport { expandRecurringEvents, isMultidayEvent } from '../../../utils';\nimport {\n getResourcesDayViewEvents,\n ResourcesDayViewEventsResult,\n} from '../../ResourcesDayView/get-resources-day-view-events/get-resources-day-view-events';\nimport { calculateEventDays } from '../../WeekView/get-week-view-events/calculate-event-days';\nimport { getEventEndDate } from '../../WeekView/get-week-view-events/get-event-end-date';\n\n/** A single all-day bar (single-day all-day event or a multi-day event) spanning one or more\n * consecutive visible weekdays, placed on a shared row so overlapping bars do not collide. */\nexport interface ResourcesWeekViewAllDayBar {\n /** The original event, with its declared start/end preserved for display and interaction */\n event: ScheduleEventData;\n /** Index of the first visible weekday the bar covers */\n startDayIndex: number;\n /** Index of the last visible weekday the bar covers */\n endDayIndex: number;\n /** Row within the all-day band, assigned so overlapping bars stack instead of overlapping */\n row: number;\n}\n\nexport interface ResourcesWeekViewEventsResult {\n byDay: Record<string, ResourcesDayViewEventsResult>;\n /** All-day bars per resource, each spanning the days it covers as a single continuous bar */\n allDayBars: Record<string | number, ResourcesWeekViewAllDayBar[]>;\n}\n\n/** Assigns each bar the lowest row whose previously placed bars all end before this bar starts,\n * so bars overlapping in days are stacked on separate rows (mutates `bar.row`). */\nfunction assignAllDayRows(bars: ResourcesWeekViewAllDayBar[]): void {\n const order = bars\n .map((bar, index) => ({ bar, index }))\n .sort(\n (a, b) =>\n a.bar.startDayIndex - b.bar.startDayIndex ||\n a.bar.endDayIndex - b.bar.endDayIndex ||\n a.index - b.index\n );\n\n const rowEnds: number[] = [];\n for (const { bar } of order) {\n let row = 0;\n while (row < rowEnds.length && rowEnds[row] >= bar.startDayIndex) {\n row += 1;\n }\n rowEnds[row] = bar.endDayIndex;\n bar.row = row;\n }\n}\n\ninterface GetResourcesWeekViewEventsInput {\n events: ScheduleEventData[] | undefined;\n resources: ScheduleResourceData[];\n weekdays: string[];\n startTime?: string;\n endTime?: string;\n intervalMinutes?: number;\n expansionLimit?: number;\n}\n\nexport function getResourcesWeekViewEvents({\n events,\n resources,\n weekdays,\n startTime,\n endTime,\n intervalMinutes,\n expansionLimit,\n}: GetResourcesWeekViewEventsInput): ResourcesWeekViewEventsResult {\n const rangeStart = dayjs(weekdays[0]).startOf('day').toDate();\n const rangeEnd = dayjs(weekdays[weekdays.length - 1])\n .endOf('day')\n .toDate();\n\n const expandedEvents = expandRecurringEvents({\n events,\n rangeStart,\n rangeEnd,\n expansionLimit,\n });\n\n if (expandedEvents) {\n const seenIds = new Set<string | number>();\n for (const event of expandedEvents) {\n if (seenIds.has(event.id)) {\n throw new Error(\n `[@mantine/schedule] ResourcesWeekView: Duplicated event ids found: ${event.id}`\n );\n }\n seenIds.add(event.id);\n }\n }\n\n const byDay: Record<string, ResourcesDayViewEventsResult> = {};\n\n const assignedIds = new Set<string | number>();\n\n // Multi-day regular events are rendered as a single all-day bar spanning the days they cover\n // (matching the base WeekView, which treats any multi-day event as all-day), so they are excluded\n // from the per-day timed flow and collected as spanning bars below.\n const isSpanningRegularEvent = (event: ScheduleEventData) =>\n event.display !== 'background' && isMultidayEvent(event);\n\n for (const day of weekdays) {\n const dayEvents = expandedEvents?.filter((event) => {\n if (assignedIds.has(event.id) || isSpanningRegularEvent(event)) {\n return false;\n }\n\n const eventStart = dayjs(event.start);\n const dayStart = dayjs(day).startOf('day');\n\n if (eventStart.isSame(dayStart, 'day')) {\n assignedIds.add(event.id);\n return true;\n }\n\n if (\n event.display === 'background' &&\n eventStart.isBefore(dayjs(day).endOf('day')) &&\n dayjs(event.end).isAfter(dayStart)\n ) {\n return true;\n }\n\n return false;\n });\n\n byDay[day] = getResourcesDayViewEvents({\n events: dayEvents,\n resources,\n date: day,\n startTime,\n endTime,\n intervalMinutes,\n });\n }\n\n const allDayBars: Record<string | number, ResourcesWeekViewAllDayBar[]> = {};\n for (const resource of resources) {\n allDayBars[resource.id] = [];\n }\n\n // Single-day all-day events keep the per-day classification done by getResourcesDayViewEvents and\n // become single-day bars.\n weekdays.forEach((day, dayIndex) => {\n for (const resource of resources) {\n for (const positioned of byDay[day].allDayEvents[resource.id] ?? []) {\n allDayBars[resource.id].push({\n event: positioned,\n startDayIndex: dayIndex,\n endDayIndex: dayIndex,\n row: 0,\n });\n }\n }\n });\n\n // Multi-day regular events become a single bar spanning the visible days they cover.\n if (expandedEvents) {\n for (const event of expandedEvents) {\n if (\n !isSpanningRegularEvent(event) ||\n event.resourceId === undefined ||\n !(event.resourceId in allDayBars)\n ) {\n continue;\n }\n\n const actualEndDate = getEventEndDate(event);\n const eventWeekDays = calculateEventDays({ event, weekDays: weekdays, actualEndDate });\n if (eventWeekDays.length === 0) {\n continue;\n }\n\n allDayBars[event.resourceId].push({\n event,\n startDayIndex: weekdays.indexOf(eventWeekDays[0]),\n endDayIndex: weekdays.indexOf(eventWeekDays[eventWeekDays.length - 1]),\n row: 0,\n });\n }\n }\n\n for (const resource of resources) {\n assignAllDayRows(allDayBars[resource.id]);\n }\n\n return { byDay, allDayBars };\n}\n"],"mappings":";;;;;;;;;;AA+BA,SAAS,iBAAiB,MAA0C;CAClE,MAAM,QAAQ,KACX,KAAK,KAAK,WAAW;EAAE;EAAK;CAAM,EAAE,CAAC,CACrC,MACE,GAAG,MACF,EAAE,IAAI,gBAAgB,EAAE,IAAI,iBAC5B,EAAE,IAAI,cAAc,EAAE,IAAI,eA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,CAAC,CAAC,MAAM,KAAK,CAAC,KAC3C,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,QAAQ,GAEjC,OAAO;GAGT,OAAO;EACT,CAAC;EAED,MAAM,OAAO,0BAA0B;GACrC,QAAQ;GACR;GACA,MAAM;GACN;GACA;GACA;EACF,CAAC;CACH;CAEA,MAAM,aAAoE,CAAC;CAC3E,KAAK,MAAM,YAAY,WACrB,WAAW,SAAS,MAAM,CAAC;CAK7B,SAAS,SAAS,KAAK,aAAa;EAClC,KAAK,MAAM,YAAY,WACrB,KAAK,MAAM,cAAc,MAAM,IAAI,CAAC,aAAa,SAAS,OAAO,CAAC,GAChE,WAAW,SAAS,GAAG,CAAC,KAAK;GAC3B,OAAO;GACP,eAAe;GACf,aAAa;GACb,KAAK;EACP,CAAC;CAGP,CAAC;CAGD,IAAI,gBACF,KAAK,MAAM,SAAS,gBAAgB;EAClC,IACE,CAAC,uBAAuB,KAAK,KAC7B,MAAM,eAAe,KAAA,KACrB,EAAE,MAAM,cAAc,aAEtB;EAGF,MAAM,gBAAgB,gBAAgB,KAAK;EAC3C,MAAM,gBAAgB,mBAAmB;GAAE;GAAO,UAAU;GAAU;EAAc,CAAC;EACrF,IAAI,cAAc,WAAW,GAC3B;EAGF,WAAW,MAAM,WAAW,CAAC,KAAK;GAChC;GACA,eAAe,SAAS,QAAQ,cAAc,EAAE;GAChD,aAAa,SAAS,QAAQ,cAAc,cAAc,SAAS,EAAE;GACrE,KAAK;EACP,CAAC;CACH;CAGF,KAAK,MAAM,YAAY,WACrB,iBAAiB,WAAW,SAAS,GAAG;CAG1C,OAAO;EAAE;EAAO;CAAW;AAC7B"}
@@ -16,7 +16,7 @@ const defaultProps = {
16
16
  };
17
17
  const Schedule = factory((_props) => {
18
18
  const props = useProps("Schedule", defaultProps, _props);
19
- const { classNames, className, style, styles, unstyled, vars, date, defaultDate, onDateChange, view, defaultView, onViewChange, events, locale, radius, labels, renderEventBody, withEventsDragAndDrop, onEventDrop, canDragEvent, onEventDragStart, onEventDragEnd, onTimeSlotClick, onAllDaySlotClick, onDayClick, onEventClick, withDragSlotSelect, onSlotDragEnd, onExternalEventDrop, withEventResize, onEventResize, canResizeEvent, recurrenceExpansionLimit, mode, layout, dayViewProps, weekViewProps, monthViewProps, yearViewProps, mobileMonthViewProps, withAgenda, __staticSelector, mod, ...others } = props;
19
+ const { classNames, className, style, styles, unstyled, vars, date, defaultDate, onDateChange, view, defaultView, onViewChange, events, locale, radius, labels, renderEventBody, withEventsDragAndDrop, onEventDrop, canDragEvent, onEventDragStart, onEventDragEnd, onTimeSlotClick, onAllDaySlotClick, onDayClick, onEventClick, withDragSlotSelect, onSlotDragEnd, onExternalEventDrop, withEventResize, onEventResize, canResizeEvent, withInteractiveBackgroundEvents, recurrenceExpansionLimit, mode, layout, dayViewProps, weekViewProps, monthViewProps, yearViewProps, mobileMonthViewProps, withAgenda, __staticSelector, mod, ...others } = props;
20
20
  const getStyles = useStyles({
21
21
  name: __staticSelector || "Schedule",
22
22
  classes: Schedule_module_default,
@@ -82,14 +82,17 @@ const Schedule = factory((_props) => {
82
82
  switch (_view) {
83
83
  case "day": return /* @__PURE__ */ jsx(DayView, {
84
84
  ...commonProps,
85
+ withInteractiveBackgroundEvents: mode === "static" ? false : withInteractiveBackgroundEvents,
85
86
  ...dayViewProps
86
87
  });
87
88
  case "week": return /* @__PURE__ */ jsx(WeekView, {
88
89
  ...commonProps,
90
+ withInteractiveBackgroundEvents: mode === "static" ? false : withInteractiveBackgroundEvents,
89
91
  ...weekViewProps
90
92
  });
91
93
  case "month": return /* @__PURE__ */ jsx(MonthView, {
92
94
  ...commonProps,
95
+ withInteractiveBackgroundEvents: mode === "static" ? false : withInteractiveBackgroundEvents,
93
96
  ...monthViewProps
94
97
  });
95
98
  case "year": return /* @__PURE__ */ jsx(YearView, {
@@ -1 +1 @@
1
- {"version":3,"file":"Schedule.mjs","names":["classes"],"sources":["../../../src/components/Schedule/Schedule.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n DateStringValue,\n DateTimeStringValue,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport { DayView, DayViewProps, DayViewStylesNames } from '../DayView/DayView';\nimport {\n MobileMonthView,\n MobileMonthViewProps,\n MobileMonthViewStylesNames,\n} from '../MobileMonthView/MobileMonthView';\nimport { MonthView, MonthViewProps, MonthViewStylesNames } from '../MonthView/MonthView';\nimport { RenderEventBody } from '../ScheduleEvent/ScheduleEvent';\nimport { WeekView, WeekViewProps, WeekViewStylesNames } from '../WeekView/WeekView';\nimport { YearView, YearViewProps, YearViewStylesNames } from '../YearView/YearView';\nimport classes from './Schedule.module.css';\n\nexport type ScheduleStylesNames =\n | 'root'\n | 'desktopView'\n | 'mobileView'\n | DayViewStylesNames\n | WeekViewStylesNames\n | MonthViewStylesNames\n | YearViewStylesNames\n | MobileMonthViewStylesNames;\n\nexport type ScheduleLayout = 'default' | 'responsive';\n\ntype ScheduleCommonProps =\n | 'date'\n | 'onDateChange'\n | 'events'\n | 'locale'\n | 'radius'\n | 'labels'\n | 'renderEventBody'\n | 'withEventsDragAndDrop'\n | 'onEventDrop'\n | 'canDragEvent'\n | 'onEventDragStart'\n | 'onEventDragEnd'\n | 'onTimeSlotClick'\n | 'onAllDaySlotClick'\n | 'onEventClick'\n | 'onDayClick'\n | 'onMonthClick'\n | 'withDragSlotSelect'\n | 'onSlotDragEnd'\n | 'view'\n | 'onViewChange'\n | 'mode'\n | 'withAgenda'\n | 'onExternalEventDrop'\n | 'withEventResize'\n | 'onEventResize'\n | 'canResizeEvent'\n | 'recurrenceExpansionLimit';\n\ntype ScheduleViewProps<T> = Partial<Omit<T, ScheduleCommonProps>>;\n\nexport interface ScheduleProps\n extends BoxProps, StylesApiProps<ScheduleFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Current date to display (controlled) */\n date?: Date | DateStringValue;\n\n /** Default date (uncontrolled) */\n defaultDate?: Date | DateStringValue;\n\n /** Called when date changes via navigation */\n onDateChange?: (date: DateStringValue) => void;\n\n /** Current view level (controlled) */\n view?: ScheduleViewLevel;\n\n /** Default view level (uncontrolled) */\n defaultView?: ScheduleViewLevel;\n\n /** Called when view level changes */\n onViewChange?: (view: ScheduleViewLevel) => void;\n\n /** Events to display across all views */\n events?: ScheduleEventData[];\n\n /** Locale for date formatting (overrides `DatesProvider`) */\n locale?: string;\n\n /** Key of theme.radius or any valid CSS value to set border-radius */\n radius?: MantineRadius;\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Custom event body renderer */\n renderEventBody?: RenderEventBody;\n\n /** Enable drag and drop for events @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped */\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 in DayView/WeekView */\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 in DayView/WeekView */\n onAllDaySlotClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called when a day is clicked in MonthView and YearView */\n onDayClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a slot range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Called when event is clicked in any view */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Interaction mode:\n * - `'default'` allows all interactions\n * - `'static'` disables event interactions\n * @default 'default' */\n mode?: ScheduleMode;\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 /** Layout mode:\n * - `'default'` uses same views on all screen sizes\n * - `'responsive'` switches to YearView/MobileMonthView on small screens\n * @default 'default' */\n layout?: ScheduleLayout;\n\n /** Props specific to DayView (includes `startTime`, `endTime`, `intervalMinutes`, etc.) */\n dayViewProps?: ScheduleViewProps<DayViewProps>;\n\n /** Props specific to WeekView (includes `startTime`, `endTime`, `intervalMinutes`, etc.) */\n weekViewProps?: ScheduleViewProps<WeekViewProps>;\n\n /** Props specific to MonthView (includes `firstDayOfWeek`, `weekendDays`, etc.) */\n monthViewProps?: ScheduleViewProps<MonthViewProps>;\n\n /** Props specific to YearView (includes `firstDayOfWeek`, `weekendDays`, etc.) */\n yearViewProps?: ScheduleViewProps<YearViewProps>;\n\n /** Props specific to MobileMonthView (used in responsive layout) */\n mobileMonthViewProps?: ScheduleViewProps<MobileMonthViewProps>;\n\n /** If set, displays an Agenda button in the header of DayView, WeekView and MonthView @default false */\n withAgenda?: boolean;\n}\n\nexport type ScheduleFactory = Factory<{\n props: ScheduleProps;\n ref: HTMLDivElement;\n stylesNames: ScheduleStylesNames;\n}>;\n\nconst defaultProps: Partial<ScheduleProps> = {\n defaultView: 'week',\n mode: 'default',\n layout: 'default',\n};\n\nexport const Schedule = factory<ScheduleFactory>((_props) => {\n const props = useProps('Schedule', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n date,\n defaultDate,\n onDateChange,\n view,\n defaultView,\n onViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onDayClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n mode,\n layout,\n dayViewProps,\n weekViewProps,\n monthViewProps,\n yearViewProps,\n mobileMonthViewProps,\n withAgenda,\n __staticSelector,\n mod,\n ...others\n } = props;\n\n const getStyles = useStyles<ScheduleFactory>({\n name: __staticSelector || 'Schedule',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n });\n\n const [_view, _setView] = useUncontrolled<ScheduleViewLevel>({\n value: view,\n defaultValue: defaultView,\n onChange: onViewChange,\n });\n\n const [_date, _setDate] = useUncontrolled<Date | DateStringValue>({\n value: date,\n defaultValue: defaultDate ?? new Date(),\n });\n\n const handleDateChange = (newDate: DateStringValue) => {\n _setDate(newDate);\n onDateChange?.(newDate);\n };\n\n const handleViewChange = (newView: ScheduleViewLevel) => {\n _setView(newView);\n onViewChange?.(newView);\n };\n\n const handleMonthClick = (monthDate: DateStringValue) => {\n handleDateChange(monthDate);\n handleViewChange('month');\n };\n\n const commonProps = {\n date: _date,\n onDateChange: handleDateChange,\n view: _view,\n onViewChange: handleViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n withEventsDragAndDrop: mode === 'static' ? false : withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onDayClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n withEventResize: mode === 'static' ? false : withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n mode,\n withAgenda,\n };\n\n const desktopContent = (() => {\n switch (_view) {\n case 'day':\n return <DayView {...commonProps} {...dayViewProps} />;\n case 'week':\n return <WeekView {...commonProps} {...weekViewProps} />;\n case 'month':\n return <MonthView {...commonProps} {...monthViewProps} />;\n case 'year':\n return <YearView {...commonProps} onMonthClick={handleMonthClick} {...yearViewProps} />;\n default:\n return null;\n }\n })();\n\n const mobileContent = (() => {\n switch (_view) {\n case 'day':\n case 'week':\n case 'month':\n return (\n <MobileMonthView\n date={_date}\n onDateChange={handleDateChange}\n events={events}\n locale={locale}\n radius={radius}\n labels={labels}\n mode={mode}\n recurrenceExpansionLimit={recurrenceExpansionLimit}\n onYearClick={() => handleViewChange('year')}\n onEventClick={onEventClick}\n {...mobileMonthViewProps}\n />\n );\n case 'year':\n return <YearView {...commonProps} onMonthClick={handleMonthClick} {...yearViewProps} />;\n default:\n return null;\n }\n })();\n\n if (layout === 'responsive') {\n return (\n <Box {...getStyles('root')} mod={[{ layout }, mod]} {...others}>\n <Box {...getStyles('desktopView')}>{desktopContent}</Box>\n <Box {...getStyles('mobileView')}>{mobileContent}</Box>\n </Box>\n );\n }\n\n return (\n <Box {...getStyles('root')} mod={mod} {...others}>\n {desktopContent}\n </Box>\n );\n});\n\nSchedule.displayName = '@mantine/schedule/Schedule';\nSchedule.classes = classes;\n\nexport namespace Schedule {\n export type Props = ScheduleProps;\n export type StylesNames = ScheduleStylesNames;\n export type Factory = ScheduleFactory;\n export type Layout = ScheduleLayout;\n}\n"],"mappings":";;;;;;;;;;;AAoNA,MAAM,eAAuC;CAC3C,aAAa;CACb,MAAM;CACN,QAAQ;AACV;AAEA,MAAa,WAAW,SAA0B,WAAW;CAC3D,MAAM,QA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AAD;IAAW,GAAI;IAAa,GAAI;GAAiB,CAAA;GAC1D,KAAK,QACH,OAAO,oBAAC,UAAD;IAAU,GAAI;IAAa,cAAc;IAAkB,GAAI;GAAgB,CAAA;GACxF,SACE,OAAO;EACX;CACF,EAAA,CAAG;CAEH,MAAM,uBAAuB;EAC3B,QAAQ,OAAR;GACE,KAAK;GACL,KAAK;GACL,KAAK,SACH,OACE,oBAAC,iBAAD;IACE,MAAM;IACN,cAAc;IACN;IACA;IACA;IACA;IACF;IACoB;IAC1B,mBAAmB,iBAAiB,MAAM;IAC5B;IACd,GAAI;GACL,CAAA;GAEL,KAAK,QACH,OAAO,oBAAC,UAAD;IAAU,GAAI;IAAa,cAAc;IAAkB,GAAI;GAAgB,CAAA;GACxF,SACE,OAAO;EACX;CACF,EAAA,CAAG;CAEH,IAAI,WAAW,cACb,OACE,qBAAC,KAAD;EAAK,GAAI,UAAU,MAAM;EAAG,KAAK,CAAC,EAAE,OAAO,GAAG,GAAG;EAAG,GAAI;YAAxD,CACE,oBAAC,KAAD;GAAK,GAAI,UAAU,aAAa;aAAI;EAAoB,CAAA,GACxD,oBAAC,KAAD;GAAK,GAAI,UAAU,YAAY;aAAI;EAAmB,CAAA,CACnD;;CAIT,OACE,oBAAC,KAAD;EAAK,GAAI,UAAU,MAAM;EAAQ;EAAK,GAAI;YACvC;CACE,CAAA;AAET,CAAC;AAED,SAAS,cAAc;AACvB,SAAS,UAAUA"}
1
+ {"version":3,"file":"Schedule.mjs","names":["classes"],"sources":["../../../src/components/Schedule/Schedule.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n ElementProps,\n factory,\n Factory,\n MantineRadius,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n DateStringValue,\n DateTimeStringValue,\n ScheduleEventData,\n ScheduleMode,\n ScheduleViewLevel,\n} from '../../types';\nimport { DayView, DayViewProps, DayViewStylesNames } from '../DayView/DayView';\nimport {\n MobileMonthView,\n MobileMonthViewProps,\n MobileMonthViewStylesNames,\n} from '../MobileMonthView/MobileMonthView';\nimport { MonthView, MonthViewProps, MonthViewStylesNames } from '../MonthView/MonthView';\nimport { RenderEventBody } from '../ScheduleEvent/ScheduleEvent';\nimport { WeekView, WeekViewProps, WeekViewStylesNames } from '../WeekView/WeekView';\nimport { YearView, YearViewProps, YearViewStylesNames } from '../YearView/YearView';\nimport classes from './Schedule.module.css';\n\nexport type ScheduleStylesNames =\n | 'root'\n | 'desktopView'\n | 'mobileView'\n | DayViewStylesNames\n | WeekViewStylesNames\n | MonthViewStylesNames\n | YearViewStylesNames\n | MobileMonthViewStylesNames;\n\nexport type ScheduleLayout = 'default' | 'responsive';\n\ntype ScheduleCommonProps =\n | 'date'\n | 'onDateChange'\n | 'events'\n | 'locale'\n | 'radius'\n | 'labels'\n | 'renderEventBody'\n | 'withEventsDragAndDrop'\n | 'onEventDrop'\n | 'canDragEvent'\n | 'onEventDragStart'\n | 'onEventDragEnd'\n | 'onTimeSlotClick'\n | 'onAllDaySlotClick'\n | 'onEventClick'\n | 'onDayClick'\n | 'onMonthClick'\n | 'withDragSlotSelect'\n | 'onSlotDragEnd'\n | 'view'\n | 'onViewChange'\n | 'mode'\n | 'withAgenda'\n | 'onExternalEventDrop'\n | 'withEventResize'\n | 'onEventResize'\n | 'canResizeEvent'\n | 'recurrenceExpansionLimit'\n | 'withInteractiveBackgroundEvents';\n\ntype ScheduleViewProps<T> = Partial<Omit<T, ScheduleCommonProps>>;\n\nexport interface ScheduleProps\n extends BoxProps, StylesApiProps<ScheduleFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Current date to display (controlled) */\n date?: Date | DateStringValue;\n\n /** Default date (uncontrolled) */\n defaultDate?: Date | DateStringValue;\n\n /** Called when date changes via navigation */\n onDateChange?: (date: DateStringValue) => void;\n\n /** Current view level (controlled) */\n view?: ScheduleViewLevel;\n\n /** Default view level (uncontrolled) */\n defaultView?: ScheduleViewLevel;\n\n /** Called when view level changes */\n onViewChange?: (view: ScheduleViewLevel) => void;\n\n /** Events to display across all views */\n events?: ScheduleEventData[];\n\n /** Locale for date formatting (overrides `DatesProvider`) */\n locale?: string;\n\n /** Key of theme.radius or any valid CSS value to set border-radius */\n radius?: MantineRadius;\n\n /** Labels override for i18n */\n labels?: ScheduleLabelsOverride;\n\n /** Custom event body renderer */\n renderEventBody?: RenderEventBody;\n\n /** Enable drag and drop for events @default false */\n withEventsDragAndDrop?: boolean;\n\n /** Called when event is dropped */\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 in DayView/WeekView */\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 in DayView/WeekView */\n onAllDaySlotClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Called when a day is clicked in MonthView and YearView */\n onDayClick?: (date: DateStringValue, event: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** If set, enables drag-to-select slot ranges @default false */\n withDragSlotSelect?: boolean;\n\n /** Called when a slot range is selected by dragging */\n onSlotDragEnd?: (rangeStart: DateTimeStringValue, rangeEnd: DateTimeStringValue) => void;\n\n /** Called when event is clicked in any view */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Interaction mode:\n * - `'default'` allows all interactions\n * - `'static'` disables event interactions\n * @default 'default' */\n mode?: ScheduleMode;\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 /** If set, background events (`display: 'background'`) can be clicked and trigger `onEventClick`. Applies to `day`, `week` and `month` views only – `YearView` and the `MobileMonthView` used by `layout=\"responsive\"` on small screens do not render background events at all. @default false */\n withInteractiveBackgroundEvents?: boolean;\n\n /** Max number of generated recurring instances per recurring series @default 2000 */\n recurrenceExpansionLimit?: number;\n\n /** Layout mode:\n * - `'default'` uses same views on all screen sizes\n * - `'responsive'` switches to YearView/MobileMonthView on small screens\n * @default 'default' */\n layout?: ScheduleLayout;\n\n /** Props specific to DayView (includes `startTime`, `endTime`, `intervalMinutes`, etc.) */\n dayViewProps?: ScheduleViewProps<DayViewProps>;\n\n /** Props specific to WeekView (includes `startTime`, `endTime`, `intervalMinutes`, etc.) */\n weekViewProps?: ScheduleViewProps<WeekViewProps>;\n\n /** Props specific to MonthView (includes `firstDayOfWeek`, `weekendDays`, etc.) */\n monthViewProps?: ScheduleViewProps<MonthViewProps>;\n\n /** Props specific to YearView (includes `firstDayOfWeek`, `weekendDays`, etc.) */\n yearViewProps?: ScheduleViewProps<YearViewProps>;\n\n /** Props specific to MobileMonthView (used in responsive layout) */\n mobileMonthViewProps?: ScheduleViewProps<MobileMonthViewProps>;\n\n /** If set, displays an Agenda button in the header of DayView, WeekView and MonthView @default false */\n withAgenda?: boolean;\n}\n\nexport type ScheduleFactory = Factory<{\n props: ScheduleProps;\n ref: HTMLDivElement;\n stylesNames: ScheduleStylesNames;\n}>;\n\nconst defaultProps: Partial<ScheduleProps> = {\n defaultView: 'week',\n mode: 'default',\n layout: 'default',\n};\n\nexport const Schedule = factory<ScheduleFactory>((_props) => {\n const props = useProps('Schedule', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n date,\n defaultDate,\n onDateChange,\n view,\n defaultView,\n onViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onDayClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n withEventResize,\n onEventResize,\n canResizeEvent,\n withInteractiveBackgroundEvents,\n recurrenceExpansionLimit,\n mode,\n layout,\n dayViewProps,\n weekViewProps,\n monthViewProps,\n yearViewProps,\n mobileMonthViewProps,\n withAgenda,\n __staticSelector,\n mod,\n ...others\n } = props;\n\n const getStyles = useStyles<ScheduleFactory>({\n name: __staticSelector || 'Schedule',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n });\n\n const [_view, _setView] = useUncontrolled<ScheduleViewLevel>({\n value: view,\n defaultValue: defaultView,\n onChange: onViewChange,\n });\n\n const [_date, _setDate] = useUncontrolled<Date | DateStringValue>({\n value: date,\n defaultValue: defaultDate ?? new Date(),\n });\n\n const handleDateChange = (newDate: DateStringValue) => {\n _setDate(newDate);\n onDateChange?.(newDate);\n };\n\n const handleViewChange = (newView: ScheduleViewLevel) => {\n _setView(newView);\n onViewChange?.(newView);\n };\n\n const handleMonthClick = (monthDate: DateStringValue) => {\n handleDateChange(monthDate);\n handleViewChange('month');\n };\n\n const commonProps = {\n date: _date,\n onDateChange: handleDateChange,\n view: _view,\n onViewChange: handleViewChange,\n events,\n locale,\n radius,\n labels,\n renderEventBody,\n withEventsDragAndDrop: mode === 'static' ? false : withEventsDragAndDrop,\n onEventDrop,\n canDragEvent,\n onEventDragStart,\n onEventDragEnd,\n onTimeSlotClick,\n onAllDaySlotClick,\n onDayClick,\n onEventClick,\n withDragSlotSelect,\n onSlotDragEnd,\n onExternalEventDrop,\n withEventResize: mode === 'static' ? false : withEventResize,\n onEventResize,\n canResizeEvent,\n recurrenceExpansionLimit,\n mode,\n withAgenda,\n };\n\n const desktopContent = (() => {\n switch (_view) {\n case 'day':\n return (\n <DayView\n {...commonProps}\n withInteractiveBackgroundEvents={\n mode === 'static' ? false : withInteractiveBackgroundEvents\n }\n {...dayViewProps}\n />\n );\n case 'week':\n return (\n <WeekView\n {...commonProps}\n withInteractiveBackgroundEvents={\n mode === 'static' ? false : withInteractiveBackgroundEvents\n }\n {...weekViewProps}\n />\n );\n case 'month':\n return (\n <MonthView\n {...commonProps}\n withInteractiveBackgroundEvents={\n mode === 'static' ? false : withInteractiveBackgroundEvents\n }\n {...monthViewProps}\n />\n );\n case 'year':\n return <YearView {...commonProps} onMonthClick={handleMonthClick} {...yearViewProps} />;\n default:\n return null;\n }\n })();\n\n const mobileContent = (() => {\n switch (_view) {\n case 'day':\n case 'week':\n case 'month':\n return (\n <MobileMonthView\n date={_date}\n onDateChange={handleDateChange}\n events={events}\n locale={locale}\n radius={radius}\n labels={labels}\n mode={mode}\n recurrenceExpansionLimit={recurrenceExpansionLimit}\n onYearClick={() => handleViewChange('year')}\n onEventClick={onEventClick}\n {...mobileMonthViewProps}\n />\n );\n case 'year':\n return <YearView {...commonProps} onMonthClick={handleMonthClick} {...yearViewProps} />;\n default:\n return null;\n }\n })();\n\n if (layout === 'responsive') {\n return (\n <Box {...getStyles('root')} mod={[{ layout }, mod]} {...others}>\n <Box {...getStyles('desktopView')}>{desktopContent}</Box>\n <Box {...getStyles('mobileView')}>{mobileContent}</Box>\n </Box>\n );\n }\n\n return (\n <Box {...getStyles('root')} mod={mod} {...others}>\n {desktopContent}\n </Box>\n );\n});\n\nSchedule.displayName = '@mantine/schedule/Schedule';\nSchedule.classes = classes;\n\nexport namespace Schedule {\n export type Props = ScheduleProps;\n export type StylesNames = ScheduleStylesNames;\n export type Factory = ScheduleFactory;\n export type Layout = ScheduleLayout;\n}\n"],"mappings":";;;;;;;;;;;AAwNA,MAAM,eAAuC;CAC3C,aAAa;CACb,MAAM;CACN,QAAQ;AACV;AAEA,MAAa,WAAW,SAA0B,WAAW;CAC3D,MAAM,QAAQ,SAAS,YAAY,cAAc,MAAM;CACvD,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,aACA,cACA,MACA,aACA,cACA,QACA,QACA,QACA,QACA,iBACA,uBACA,aACA,cACA,kBACA,gBACA,iBACA,mBACA,YACA,cACA,oBACA,eACA,qBACA,iBACA,eACA,gBACA,iCACA,0BACA,MACA,QACA,cACA,eACA,gBACA,eACA,sBACA,YACA,kBACA,KACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAA2B;EAC3C,MAAM,oBAAoB;EAC1B,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,CAAC,OAAO,YAAY,gBAAmC;EAC3D,OAAO;EACP,cAAc;EACd,UAAU;CACZ,CAAC;CAED,MAAM,CAAC,OAAO,YAAY,gBAAwC;EAChE,OAAO;EACP,cAAc,+BAAe,IAAI,KAAK;CACxC,CAAC;CAED,MAAM,oBAAoB,YAA6B;EACrD,SAAS,OAAO;EAChB,eAAe,OAAO;CACxB;CAEA,MAAM,oBAAoB,YAA+B;EACvD,SAAS,OAAO;EAChB,eAAe,OAAO;CACxB;CAEA,MAAM,oBAAoB,cAA+B;EACvD,iBAAiB,SAAS;EAC1B,iBAAiB,OAAO;CAC1B;CAEA,MAAM,cAAc;EAClB,MAAM;EACN,cAAc;EACd,MAAM;EACN,cAAc;EACd;EACA;EACA;EACA;EACA;EACA,uBAAuB,SAAS,WAAW,QAAQ;EACnD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,iBAAiB,SAAS,WAAW,QAAQ;EAC7C;EACA;EACA;EACA;EACA;CACF;CAEA,MAAM,wBAAwB;EAC5B,QAAQ,OAAR;GACE,KAAK,OACH,OACE,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3
+ import { useEffect, useState } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region packages/@mantine/schedule/src/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.tsx
6
+ function ScheduleBackgroundEvent(props) {
7
+ const { event, interactive, onEventClick, renderEvent, renderEventBody, mod, ...others } = useProps("ScheduleBackgroundEvent", null, props);
8
+ const theme = useMantineTheme();
9
+ const [dragPassthrough, setDragPassthrough] = useState(false);
10
+ useEffect(() => {
11
+ if (!dragPassthrough) return;
12
+ const reset = () => setDragPassthrough(false);
13
+ document.addEventListener("dragend", reset);
14
+ document.addEventListener("drop", reset);
15
+ document.addEventListener("pointermove", reset);
16
+ return () => {
17
+ document.removeEventListener("dragend", reset);
18
+ document.removeEventListener("drop", reset);
19
+ document.removeEventListener("pointermove", reset);
20
+ };
21
+ }, [dragPassthrough]);
22
+ const colors = theme.variantColorResolver({
23
+ color: event.color || theme.primaryColor,
24
+ theme,
25
+ variant: "light",
26
+ autoContrast: true
27
+ });
28
+ const rootProps = {
29
+ ...others,
30
+ __vars: {
31
+ "--bg-event-bg": colors.background,
32
+ "--bg-event-color": colors.color,
33
+ "--bg-event-hover": colors.hover
34
+ },
35
+ children: typeof renderEventBody === "function" ? renderEventBody(event) : event.title,
36
+ mod: interactive ? [mod, { interactive: true }] : mod,
37
+ ...interactive ? {
38
+ "data-event-id": event.id,
39
+ title: event.title,
40
+ onClick: (e) => onEventClick?.(event, e),
41
+ onDragEnter: () => setDragPassthrough(true),
42
+ onDragOver: () => setDragPassthrough(true)
43
+ } : null,
44
+ ...interactive && dragPassthrough ? { style: [others.style, { pointerEvents: "none" }] } : null
45
+ };
46
+ if (typeof renderEvent === "function") return renderEvent(event, rootProps);
47
+ return interactive ? /* @__PURE__ */ jsx(UnstyledButton, { ...rootProps }) : /* @__PURE__ */ jsx(Box, { ...rootProps });
48
+ }
49
+ ScheduleBackgroundEvent.displayName = "@mantine/schedule/ScheduleBackgroundEvent";
50
+ //#endregion
51
+ export { ScheduleBackgroundEvent };
52
+
53
+ //# sourceMappingURL=ScheduleBackgroundEvent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScheduleBackgroundEvent.mjs","names":[],"sources":["../../../src/components/ScheduleBackgroundEvent/ScheduleBackgroundEvent.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport {\n Box,\n BoxProps,\n ElementProps,\n UnstyledButton,\n useMantineTheme,\n useProps,\n} from '@mantine/core';\nimport { ScheduleEventData } from '../../types';\nimport { RenderEvent, RenderEventBody } from '../ScheduleEvent/ScheduleEvent';\n\nexport interface ScheduleBackgroundEventProps extends BoxProps, ElementProps<'div', 'onClick'> {\n /** Background event to display */\n event: ScheduleEventData;\n\n /** If set, the root element is a `button` instead of a `div` and the event can be clicked @default false */\n interactive?: boolean;\n\n /** Called when the event is clicked, only when `interactive` is set */\n onEventClick?: (event: ScheduleEventData, e: React.MouseEvent<HTMLButtonElement>) => void;\n\n /** Function to fully customize event rendering */\n renderEvent?: RenderEvent;\n\n /** Function to customize event body */\n renderEventBody?: RenderEventBody;\n}\n\nexport function ScheduleBackgroundEvent(props: ScheduleBackgroundEventProps) {\n const { event, interactive, onEventClick, renderEvent, renderEventBody, mod, ...others } =\n useProps('ScheduleBackgroundEvent', null, props);\n\n const theme = useMantineTheme();\n\n // An interactive background event captures pointer events so it can be clicked, which\n // also makes it the target of drag events – the drop targets underneath (day cells and\n // slots) would then never receive `dragover` and could not accept a drop. Stepping out\n // of the way for the duration of the drag keeps both behaviours working, including for\n // drags started outside the schedule.\n const [dragPassthrough, setDragPassthrough] = useState(false);\n\n useEffect(() => {\n if (!dragPassthrough) {\n return undefined;\n }\n\n const reset = () => setDragPassthrough(false);\n\n document.addEventListener('dragend', reset);\n document.addEventListener('drop', reset);\n // A drag can end without either of those firing – dropped on another window, or with\n // propagation stopped. Pointer events are suppressed for the duration of a drag, so\n // seeing one means the drag is over and the element can capture input again.\n document.addEventListener('pointermove', reset);\n\n return () => {\n document.removeEventListener('dragend', reset);\n document.removeEventListener('drop', reset);\n document.removeEventListener('pointermove', reset);\n };\n }, [dragPassthrough]);\n\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: 'light',\n autoContrast: true,\n });\n\n const eventProps = {\n ...others,\n __vars: {\n '--bg-event-bg': colors.background,\n '--bg-event-color': colors.color,\n '--bg-event-hover': colors.hover,\n },\n children: typeof renderEventBody === 'function' ? renderEventBody(event) : event.title,\n // Composed rather than replaced – `mod` is a public prop, and overwriting it would\n // silently drop the caller's data modifiers whenever `interactive` is set.\n mod: interactive ? [mod, { interactive: true }] : mod,\n ...(interactive\n ? {\n 'data-event-id': event.id,\n title: event.title,\n onClick: (e: React.MouseEvent<HTMLButtonElement>) => onEventClick?.(event, e),\n onDragEnter: () => setDragPassthrough(true),\n onDragOver: () => setDragPassthrough(true),\n }\n : null),\n // Appended rather than replaced – the views position background events with `style`,\n // and the array form preserves the function and array style values Box supports.\n ...(interactive && dragPassthrough\n ? { style: [others.style, { pointerEvents: 'none' as const }] }\n : null),\n };\n\n // The root element switches between a div and a button depending on `interactive`, so\n // the shared prop bag cannot satisfy both element types at once.\n const rootProps = eventProps as Parameters<RenderEvent>[1];\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, rootProps);\n }\n\n return interactive ? (\n <UnstyledButton {...rootProps} />\n ) : (\n <Box {...(rootProps as React.ComponentPropsWithoutRef<'div'>)} />\n );\n}\n\nScheduleBackgroundEvent.displayName = '@mantine/schedule/ScheduleBackgroundEvent';\n"],"mappings":";;;;;AA6BA,SAAgB,wBAAwB,OAAqC;CAC3E,MAAM,EAAE,OAAO,aAAa,cAAc,aAAa,iBAAiB,KAAK,GAAG,WAC9E,SAAS,2BAA2B,MAAM,KAAK;CAEjD,MAAM,QAAQ,gBAAgB;CAO9B,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,KAAK;CAE5D,gBAAgB;EACd,IAAI,CAAC,iBACH;EAGF,MAAM,cAAc,mBAAmB,KAAK;EAE5C,SAAS,iBAAiB,WAAW,KAAK;EAC1C,SAAS,iBAAiB,QAAQ,KAAK;EAIvC,SAAS,iBAAiB,eAAe,KAAK;EAE9C,aAAa;GACX,SAAS,oBAAoB,WAAW,KAAK;GAC7C,SAAS,oBAAoB,QAAQ,KAAK;GAC1C,SAAS,oBAAoB,eAAe,KAAK;EACnD;CACF,GAAG,CAAC,eAAe,CAAC;CAEpB,MAAM,SAAS,MAAM,qBAAqB;EACxC,OAAO,MAAM,SAAS,MAAM;EAC5B;EACA,SAAS;EACT,cAAc;CAChB,CAAC;CA+BD,MAAM,YAAY;EA5BhB,GAAG;EACH,QAAQ;GACN,iBAAiB,OAAO;GACxB,oBAAoB,OAAO;GAC3B,oBAAoB,OAAO;EAC7B;EACA,UAAU,OAAO,oBAAoB,aAAa,gBAAgB,KAAK,IAAI,MAAM;EAGjF,KAAK,cAAc,CAAC,KAAK,EAAE,aAAa,KAAK,CAAC,IAAI;EAClD,GAAI,cACA;GACE,iBAAiB,MAAM;GACvB,OAAO,MAAM;GACb,UAAU,MAA2C,eAAe,OAAO,CAAC;GAC5E,mBAAmB,mBAAmB,IAAI;GAC1C,kBAAkB,mBAAmB,IAAI;EAC3C,IACA;EAGJ,GAAI,eAAe,kBACf,EAAE,OAAO,CAAC,OAAO,OAAO,EAAE,eAAe,OAAgB,CAAC,EAAE,IAC5D;CAKqB;CAE3B,IAAI,OAAO,gBAAgB,YACzB,OAAO,YAAY,OAAO,SAAS;CAGrC,OAAO,cACL,oBAAC,gBAAD,EAAgB,GAAI,UAAY,CAAA,IAEhC,oBAAC,KAAD,EAAK,GAAK,UAAsD,CAAA;AAEpE;AAEA,wBAAwB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScheduleEvent.mjs","names":["classes"],"sources":["../../../src/components/ScheduleEvent/ScheduleEvent.tsx"],"sourcesContent":["import { use, useEffect, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { ScheduleEventData, ScheduleMode } from '../../types';\nimport { DragContext } from '../DragContext/DragContext';\nimport classes from './ScheduleEvent.module.css';\n\nexport type ScheduleEventStylesNames = 'event' | 'eventInner' | 'eventResizeHandle';\n\nexport type ScheduleEventVariant = 'filled' | 'light';\nexport type ScheduleEventCssVariables = {\n event: '--event-bg' | '--event-color' | '--event-radius' | '--event-hover';\n};\n\nexport type RenderEventBody = (event: ScheduleEventData<any>) => React.ReactNode;\n\nexport type RenderEvent = (\n event: ScheduleEventData,\n props: React.ComponentPropsWithoutRef<'button'> & { children: React.ReactNode }\n) => React.ReactElement;\n\nexport interface ScheduleEventProps\n extends BoxProps, StylesApiProps<ScheduleEventFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Event to display */\n event: ScheduleEventData;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius @default 'sm' */\n radius?: MantineRadius;\n\n /** If set, event has `white-space: nowrap` @default false */\n nowrap?: boolean;\n\n /** If set, event shrinks its font-size with limited height @default false */\n autoSize?: boolean;\n\n /** Event size @default 'sm' */\n size?: 'sm' | 'md' | (string & {});\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** Event hanging position */\n hanging?: 'start' | 'end' | 'both' | 'none';\n\n /** If true, event can be dragged @default false */\n draggable?: boolean;\n\n /** Called when event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when event drag ends */\n onEventDragEnd?: () => void;\n\n /** If true, event is currently being dragged @default false */\n isDragging?: boolean;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** If true, event can be resized by dragging its edges @default false */\n withResize?: boolean;\n\n /** Called when resize starts on an edge */\n onResizeStart?: (edge: 'top' | 'bottom', e: React.PointerEvent) => void;\n\n /** If true, event is currently being resized @default false */\n isResizing?: boolean;\n}\n\nexport type ScheduleEventFactory = Factory<{\n props: ScheduleEventProps;\n ref: HTMLButtonElement;\n stylesNames: ScheduleEventStylesNames;\n vars: ScheduleEventCssVariables;\n variant: ScheduleEventVariant;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'ScheduleEvent',\n mode: 'default',\n radius: 'sm' as MantineRadius,\n} satisfies Partial<ScheduleEventProps>;\n\nconst varsResolver = createVarsResolver<ScheduleEventFactory>(\n (theme, { event, variant, radius }) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: variant || event.variant || 'light',\n autoContrast: true,\n });\n\n return {\n event: {\n '--event-bg': colors.background,\n '--event-hover': colors.hover,\n '--event-color': colors.color,\n '--event-radius': getRadius(radius),\n },\n };\n }\n);\n\nexport const ScheduleEvent = factory<ScheduleEventFactory>((_props) => {\n const props = useProps('ScheduleEvent', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n children,\n nowrap,\n radius,\n color,\n __staticSelector,\n event,\n renderEventBody,\n renderEvent,\n size,\n autoSize,\n mod,\n hanging,\n draggable = false,\n onEventDragStart,\n onEventDragEnd,\n isDragging = false,\n mode,\n withResize = false,\n onResizeStart,\n isResizing = false,\n ...others\n } = props;\n\n const ctx = use(DragContext);\n\n const getStyles = useStyles<ScheduleEventFactory>({\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: 'event',\n });\n\n const handleDragStart = (e: React.DragEvent<HTMLButtonElement>) => {\n if (!draggable) {\n e.preventDefault();\n return;\n }\n\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('application/json', JSON.stringify({ eventId: event.id }));\n onEventDragStart?.(event);\n ctx.onDragStart?.(event);\n };\n\n const handleDragEnd = () => {\n onEventDragEnd?.();\n ctx.onDragEnd?.();\n };\n\n const isCurrentlyDragging = isDragging || ctx.draggedEventId === event.id;\n const isAnyEventDragging = ctx.isDragging || false;\n\n const dragEndRef = useRef(ctx.onDragEnd);\n dragEndRef.current = ctx.onDragEnd;\n\n useEffect(() => {\n if (isCurrentlyDragging) {\n return () => {\n dragEndRef.current?.();\n };\n }\n return undefined;\n }, [isCurrentlyDragging]);\n\n const showResizeHandles = withResize && mode !== 'static';\n\n const eventChildren = (\n <>\n {showResizeHandles && (\n <Box\n {...getStyles('eventResizeHandle')}\n mod={{ edge: 'top' }}\n onPointerDown={(e: React.PointerEvent) => onResizeStart?.('top', e)}\n />\n )}\n <Box mod={{ nowrap, size, autoSize, hanging }} {...getStyles('eventInner')}>\n {typeof renderEventBody === 'function' ? renderEventBody(event) : event.title}\n </Box>\n {showResizeHandles && (\n <Box\n {...getStyles('eventResizeHandle')}\n mod={{ edge: 'bottom' }}\n onPointerDown={(e: React.PointerEvent) => onResizeStart?.('bottom', e)}\n />\n )}\n </>\n );\n\n const rootProps = {\n ...getStyles('event'),\n 'data-event-id': event.id,\n size,\n title: event.title,\n mod: [\n {\n autoSize,\n hanging,\n draggable,\n dragging: isCurrentlyDragging,\n 'any-dragging': isAnyEventDragging,\n static: mode === 'static',\n resizing: isResizing,\n resizable: showResizeHandles,\n },\n mod,\n ],\n ...others,\n draggable: draggable && mode !== 'static',\n tabIndex: mode === 'static' ? -1 : 0,\n onDragStart: mode === 'static' ? undefined : handleDragStart,\n onDragEnd: mode === 'static' ? undefined : handleDragEnd,\n onClick: mode === 'static' ? undefined : others.onClick,\n children: eventChildren,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, rootProps);\n }\n\n return <UnstyledButton {...rootProps} />;\n});\n\nScheduleEvent.displayName = '@mantine/schedule/ScheduleEvent';\nScheduleEvent.classes = classes;\nScheduleEvent.varsResolver = varsResolver;\n"],"mappings":";;;;;;;AA8FA,MAAM,eAAe;CACnB,kBAAkB;CAClB,MAAM;CACN,QAAQ;AACV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AG,CAAC,mBAAmB,CAAC;CAExB,MAAM,oBAAoB,cAAc,SAAS;CAEjD,MAAM,gBACJ,qBAAA,UAAA,EAAA,UAAA;EACG,qBACC,oBAAC,KAAD;GACE,GAAI,UAAU,mBAAmB;GACjC,KAAK,EAAE,MAAM,MAAM;GACnB,gBAAgB,MAA0B,gBAAgB,OAAO,CAAC;EACnE,CAAA;EAEH,oBAAC,KAAD;GAAK,KAAK;IAAE;IAAQ;IAAM;IAAU;GAAQ;GAAG,GAAI,UAAU,YAAY;aACtE,OAAO,oBAAoB,aAAa,gBAAgB,KAAK,IAAI,MAAM;EACrE,CAAA;EACJ,qBACC,oBAAC,KAAD;GACE,GAAI,UAAU,mBAAmB;GACjC,KAAK,EAAE,MAAM,SAAS;GACtB,gBAAgB,MAA0B,gBAAgB,UAAU,CAAC;EACtE,CAAA;CAEH,EAAA,CAAA;CAGJ,MAAM,YAAY;EAChB,GAAG,UAAU,OAAO;EACpB,iBAAiB,MAAM;EACvB;EACA,OAAO,MAAM;EACb,KAAK,CACH;GACE;GACA;GACA;GACA,UAAU;GACV,gBAAgB;GAChB,QAAQ,SAAS;GACjB,UAAU;GACV,WAAW;EACb,GACA,GACF;EACA,GAAG;EACH,WAAW,aAAa,SAAS;EACjC,UAAU,SAAS,WAAW,KAAK;EACnC,aAAa,SAAS,WAAW,KAAA,IAAY;EAC7C,WAAW,SAAS,WAAW,KAAA,IAAY;EAC3C,SAAS,SAAS,WAAW,KAAA,IAAY,OAAO;EAChD,UAAU;CACZ;CAEA,IAAI,OAAO,gBAAgB,YACzB,OAAO,YAAY,OAAO,SAAS;CAGrC,OAAO,oBAAC,gBAAD,EAAgB,GAAI,UAAY,CAAA;AACzC,CAAC;AAED,cAAc,cAAc;AAC5B,cAAc,UAAUA;AACxB,cAAc,eAAe"}
1
+ {"version":3,"file":"ScheduleEvent.mjs","names":["classes"],"sources":["../../../src/components/ScheduleEvent/ScheduleEvent.tsx"],"sourcesContent":["import { use, useEffect, useRef } from 'react';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { ScheduleEventData, ScheduleMode } from '../../types';\nimport { DragContext } from '../DragContext/DragContext';\nimport classes from './ScheduleEvent.module.css';\n\nexport type ScheduleEventStylesNames = 'event' | 'eventInner' | 'eventResizeHandle';\n\nexport type ScheduleEventVariant = 'filled' | 'light';\nexport type ScheduleEventCssVariables = {\n event: '--event-bg' | '--event-color' | '--event-radius' | '--event-hover';\n};\n\nexport type RenderEventBody = (event: ScheduleEventData<any>) => React.ReactNode;\n\nexport type RenderEvent = (\n event: ScheduleEventData,\n props: React.ComponentPropsWithoutRef<'button'> & { children: React.ReactNode }\n) => React.ReactElement;\n\nexport interface ScheduleEventProps\n extends BoxProps, StylesApiProps<ScheduleEventFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Event to display */\n event: ScheduleEventData;\n\n /** Key of `theme.radius` or any valid CSS value to set border-radius @default 'sm' */\n radius?: MantineRadius;\n\n /** If set, event has `white-space: nowrap` @default false */\n nowrap?: boolean;\n\n /** If set, event shrinks its font-size with limited height @default false */\n autoSize?: boolean;\n\n /** Event size @default 'sm' */\n size?: 'sm' | 'md' | (string & {});\n\n /** Function to customize event body, `event` object is passed as first argument */\n renderEventBody?: RenderEventBody;\n\n /** Function to fully customize event rendering, receives all props that would be passed to the root element including children */\n renderEvent?: RenderEvent;\n\n /** Event hanging position */\n hanging?: 'start' | 'end' | 'both' | 'none';\n\n /** If true, event can be dragged @default false */\n draggable?: boolean;\n\n /** Called when event drag starts */\n onEventDragStart?: (event: ScheduleEventData) => void;\n\n /** Called when event drag ends */\n onEventDragEnd?: () => void;\n\n /** If true, event is currently being dragged @default false */\n isDragging?: boolean;\n\n /** Interaction mode: 'default' allows all interactions, 'static' disables event interactions @default default */\n mode?: ScheduleMode;\n\n /** If true, event can be resized by dragging its edges @default false */\n withResize?: boolean;\n\n /** Called when resize starts on an edge */\n onResizeStart?: (edge: 'top' | 'bottom', e: React.PointerEvent) => void;\n\n /** If true, event is currently being resized @default false */\n isResizing?: boolean;\n}\n\nexport type ScheduleEventFactory = Factory<{\n props: ScheduleEventProps;\n ref: HTMLButtonElement;\n stylesNames: ScheduleEventStylesNames;\n vars: ScheduleEventCssVariables;\n variant: ScheduleEventVariant;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'ScheduleEvent',\n mode: 'default',\n radius: 'sm' as MantineRadius,\n} satisfies Partial<ScheduleEventProps>;\n\nconst varsResolver = createVarsResolver<ScheduleEventFactory>(\n (theme, { event, variant, radius }) => {\n const colors = theme.variantColorResolver({\n color: event.color || theme.primaryColor,\n theme,\n variant: variant || event.variant || 'light',\n autoContrast: true,\n });\n\n return {\n event: {\n '--event-bg': colors.background,\n '--event-hover': colors.hover,\n '--event-color': colors.color,\n '--event-radius': getRadius(radius),\n },\n };\n }\n);\n\nexport const ScheduleEvent = factory<ScheduleEventFactory>((_props) => {\n const props = useProps('ScheduleEvent', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n children,\n nowrap,\n radius,\n color,\n __staticSelector,\n event,\n renderEventBody,\n renderEvent,\n size,\n autoSize,\n mod,\n hanging,\n draggable = false,\n onEventDragStart,\n onEventDragEnd,\n isDragging = false,\n mode,\n withResize = false,\n onResizeStart,\n isResizing = false,\n ...others\n } = props;\n\n const ctx = use(DragContext);\n\n const getStyles = useStyles<ScheduleEventFactory>({\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: 'event',\n });\n\n const handleDragStart = (e: React.DragEvent<HTMLButtonElement>) => {\n if (!draggable) {\n e.preventDefault();\n return;\n }\n\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('application/json', JSON.stringify({ eventId: event.id }));\n onEventDragStart?.(event);\n ctx.onDragStart?.(event);\n };\n\n const handleDragEnd = () => {\n onEventDragEnd?.();\n ctx.onDragEnd?.();\n };\n\n const isCurrentlyDragging = isDragging || ctx.draggedEventId === event.id;\n const isAnyEventDragging = ctx.isDragging || false;\n\n const dragEndRef = useRef(ctx.onDragEnd);\n dragEndRef.current = ctx.onDragEnd;\n\n useEffect(() => {\n if (isCurrentlyDragging) {\n return () => {\n dragEndRef.current?.();\n };\n }\n return undefined;\n }, [isCurrentlyDragging]);\n\n const showResizeHandles = withResize && mode !== 'static';\n\n const eventChildren = (\n <>\n {showResizeHandles && (\n <Box\n {...getStyles('eventResizeHandle')}\n mod={{ edge: 'top' }}\n onPointerDown={(e: React.PointerEvent) => onResizeStart?.('top', e)}\n />\n )}\n <Box mod={{ nowrap, size, autoSize, hanging }} {...getStyles('eventInner')}>\n {typeof renderEventBody === 'function' ? renderEventBody(event) : event.title}\n </Box>\n {showResizeHandles && (\n <Box\n {...getStyles('eventResizeHandle')}\n mod={{ edge: 'bottom' }}\n onPointerDown={(e: React.PointerEvent) => onResizeStart?.('bottom', e)}\n />\n )}\n </>\n );\n\n const rootProps = {\n ...getStyles('event'),\n 'data-event-id': event.id,\n size,\n title: event.title,\n mod: [\n {\n autoSize,\n hanging,\n draggable,\n dragging: isCurrentlyDragging,\n 'any-dragging': isAnyEventDragging,\n static: mode === 'static',\n resizing: isResizing,\n resizable: showResizeHandles,\n },\n mod,\n ],\n ...others,\n draggable: draggable && mode !== 'static',\n tabIndex: mode === 'static' ? -1 : 0,\n onDragStart: mode === 'static' ? undefined : handleDragStart,\n onDragEnd: mode === 'static' ? undefined : handleDragEnd,\n onClick: mode === 'static' ? undefined : others.onClick,\n children: eventChildren,\n };\n\n if (typeof renderEvent === 'function') {\n return renderEvent(event, rootProps);\n }\n\n return <UnstyledButton {...rootProps} />;\n});\n\nScheduleEvent.displayName = '@mantine/schedule/ScheduleEvent';\nScheduleEvent.classes = classes;\nScheduleEvent.varsResolver = varsResolver;\n"],"mappings":";;;;;;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) => ({ headerControl
13
13
  const HeaderControl = factory((_props) => {
14
14
  const props = useProps("HeaderControl", defaultProps, _props);
15
15
  const { classNames, className, style, styles, unstyled, vars, __staticSelector, mod, attributes, active, square, radius, interactive, labels, ...others } = props;
16
+ const getStyles = useStyles({
17
+ name: __staticSelector,
18
+ classes: HeaderControl_module_default,
19
+ props,
20
+ className,
21
+ style,
22
+ classNames,
23
+ styles,
24
+ unstyled,
25
+ attributes,
26
+ vars,
27
+ varsResolver,
28
+ rootSelector: "headerControl"
29
+ });
16
30
  return /* @__PURE__ */ jsx(UnstyledButton, {
17
- ...useStyles({
18
- name: __staticSelector,
19
- classes: HeaderControl_module_default,
20
- props,
21
- className,
22
- style,
23
- classNames,
24
- styles,
25
- unstyled,
26
- attributes,
27
- vars,
28
- varsResolver,
29
- rootSelector: "headerControl"
30
- })("headerControl", { active: interactive }),
31
+ ...getStyles("headerControl", { active: interactive }),
31
32
  mod: [{
32
33
  active,
33
34
  square,
@@ -1 +1 @@
1
- {"version":3,"file":"HeaderControl.mjs","names":["classes"],"sources":["../../../../src/components/ScheduleHeader/HeaderControl/HeaderControl.tsx"],"sourcesContent":["import {\n AccordionChevron,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useDirection,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport { 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;AACf;AAEA,MAAM,eAAe,oBAA0C,QAAQ,EAAE,cAAc,EACrF,eAAe,EACb,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM,EACzE,EACF,EAAE;AAEF,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,MAAM;CAC5D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,kBACA,KACA,YACA,QACA,QACA,QACA,aACA,QACA,GAAG,WACD;CAiBJ,OACE,oBAAC,gBAAD;EACE,GAjBc,UAAgC;GAChD,MAAM;GACN,SAAA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,cAAc;EAChB,CAIgB,CAAC,CAAC,iBAAiB,EAAE,QAAQ,YAAY,CAAC;EACtD,KAAK,CAAC;GAAE;GAAQ;GAAQ;EAAY,GAAG,GAAG;EAC1C,UAAU,cAAc,KAAA,IAAY;EACpC,GAAI;CACL,CAAA;AAEL,CAAC;AAED,cAAc,cAAc;AAC5B,cAAc,UAAUA;AACxB,cAAc,eAAe;AAE7B,SAAgB,mBAAmB,OAA2B;CAC5D,MAAM,EAAE,QAAQ,aAAa;CAC7B,MAAM,iBAAiB,wBAAwB,MAAM,MAAM;CAE3D,OACE,oBAAC,eAAD;EAAe,aAAU;EAAO,cAAY,SAAS,QAAQ,cAAc;EAAG,QAAA;EAAO,GAAI;YACvF,oBAAC,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,KAAK,IAAI,MAAM,EAAI,CAAA;CACtE,CAAA;AAEnB;AAEA,SAAgB,uBAAuB,OAA2B;CAChE,MAAM,EAAE,QAAQ,aAAa;CAC7B,MAAM,iBAAiB,wBAAwB,MAAM,MAAM;CAE3D,OACE,oBAAC,eAAD;EACE,aAAU;EACV,cAAY,SAAS,YAAY,cAAc;EAC/C,QAAA;EACA,GAAI;YAEJ,oBAAC,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,MAAM,GAAG,MAAM,EAAI,CAAA;CACtE,CAAA;AAEnB;AAEA,SAAgB,oBAAoB,OAA2B;CAC7D,MAAM,iBAAiB,wBAAwB,MAAM,MAAM;CAE3D,OACE,oBAAC,eAAD;EAAe,aAAU;EAAQ,cAAY,SAAS,SAAS,cAAc;EAAG,GAAI;YACjF,SAAS,SAAS,cAAc;CACpB,CAAA;AAEnB;AAEA,mBAAmB,cAAc;AACjC,uBAAuB,cAAc;AACrC,oBAAoB,cAAc"}
1
+ {"version":3,"file":"HeaderControl.mjs","names":["classes"],"sources":["../../../../src/components/ScheduleHeader/HeaderControl/HeaderControl.tsx"],"sourcesContent":["import {\n AccordionChevron,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n StylesApiProps,\n UnstyledButton,\n useDirection,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport { 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;AACf;AAEA,MAAM,eAAe,oBAA0C,QAAQ,EAAE,cAAc,EACrF,eAAe,EACb,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM,EACzE,EACF,EAAE;AAEF,MAAa,gBAAgB,SAA+B,WAAW;CACrE,MAAM,QAAQ,SAAS,iBAAiB,cAAc,MAAM;CAC5D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,kBACA,KACA,YACA,QACA,QACA,QACA,aACA,QACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAgC;EAChD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,oBAAC,gBAAD;EACE,GAAI,UAAU,iBAAiB,EAAE,QAAQ,YAAY,CAAC;EACtD,KAAK,CAAC;GAAE;GAAQ;GAAQ;EAAY,GAAG,GAAG;EAC1C,UAAU,cAAc,KAAA,IAAY;EACpC,GAAI;CACL,CAAA;AAEL,CAAC;AAED,cAAc,cAAc;AAC5B,cAAc,UAAUA;AACxB,cAAc,eAAe;AAE7B,SAAgB,mBAAmB,OAA2B;CAC5D,MAAM,EAAE,QAAQ,aAAa;CAC7B,MAAM,iBAAiB,wBAAwB,MAAM,MAAM;CAE3D,OACE,oBAAC,eAAD;EAAe,aAAU;EAAO,cAAY,SAAS,QAAQ,cAAc;EAAG,QAAA;EAAO,GAAI;EACvF,UAAA,oBAAC,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,KAAK,IAAI,MAAM,EAAI,CAAA;CACtE,CAAA;AAEnB;AAEA,SAAgB,uBAAuB,OAA2B;CAChE,MAAM,EAAE,QAAQ,aAAa;CAC7B,MAAM,iBAAiB,wBAAwB,MAAM,MAAM;CAE3D,OACE,oBAAC,eAAD;EACE,aAAU;EACV,cAAY,SAAS,YAAY,cAAc;EAC/C,QAAA;EACA,GAAI;EAEJ,UAAA,oBAAC,kBAAD,EAAkB,OAAO,EAAE,WAAW,UAAU,QAAQ,QAAQ,MAAM,GAAG,MAAM,EAAI,CAAA;CACtE,CAAA;AAEnB;AAEA,SAAgB,oBAAoB,OAA2B;CAC7D,MAAM,iBAAiB,wBAAwB,MAAM,MAAM;CAE3D,OACE,oBAAC,eAAD;EAAe,aAAU;EAAQ,cAAY,SAAS,SAAS,cAAc;EAAG,GAAI;EACjF,UAAA,SAAS,SAAS,cAAc;CACpB,CAAA;AAEnB;AAEA,mBAAmB,cAAc;AACjC,uBAAuB,cAAc;AACrC,oBAAoB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"MonthYearSelect.mjs","names":["classes"],"sources":["../../../../src/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.tsx"],"sourcesContent":["import {\n BoxProps,\n createScopedKeydownHandler,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n Popover,\n PopoverProps,\n StylesApiProps,\n UnstyledButton,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useDisclosure } from '@mantine/hooks';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport { DateLabelFormat } from '../../../types';\nimport { formatDate, getMonthsList, getYearsList } from '../../../utils';\nimport { HeaderControl } from '../HeaderControl/HeaderControl';\nimport { useScheduleHeaderLabels } from '../ScheduleHeaderContext';\nimport classes from './MonthYearSelect.module.css';\n\nexport type MonthYearSelectStylesNames =\n | 'monthYearSelectTarget'\n | 'monthYearSelectDropdown'\n | 'monthYearSelectControl'\n | 'monthYearSelectList'\n | 'monthYearSelectLabel';\n\nexport type MonthYearSelectCssVariables = {\n monthYearSelectDropdown: '--control-radius';\n};\n\nexport interface MonthYearSelectProps\n extends BoxProps, StylesApiProps<MonthYearSelectFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Props passed down to the underlying Popover component */\n popoverProps?: PopoverProps;\n\n /** Start year for year selection, calculated from the current date by default */\n startYear?: number;\n\n /** End year for year selection, calculated from the current date by default */\n endYear?: number;\n\n /** Current year value (e.g. `2025`) */\n yearValue?: number;\n\n /** Current month value (0-11) */\n monthValue?: number;\n\n /** Called with year value (e.g. `2025`) when year is selected in the dropdown */\n onYearChange?: (year: number) => void;\n\n /** Called with month value (0-11) when month is selected in the dropdown */\n onMonthChange?: (month: number) => void;\n\n /** Format for displaying months in the dropdown, dayjs format or custom formatter function @default 'MMM' */\n monthsListFormat?: DateLabelFormat;\n\n /** Format for displaying month label in the control, dayjs format @default 'MMMM YYYY' */\n labelFormat?: DateLabelFormat;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to year controls */\n getYearControlProps?: (year: number) => React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed down to month controls */\n getMonthControlProps?: (month: number) => React.ComponentProps<'button'> & DataAttributes;\n\n /** If set to false, months are not displayed in the dropdown @default true */\n withMonths?: boolean;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type MonthYearSelectFactory = Factory<{\n props: MonthYearSelectProps;\n ref: HTMLButtonElement;\n stylesNames: MonthYearSelectStylesNames;\n vars: MonthYearSelectCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'MonthYearSelect',\n withMonths: true,\n} satisfies Partial<MonthYearSelectProps>;\n\nconst varsResolver = createVarsResolver<MonthYearSelectFactory>((_theme, { radius }) => ({\n monthYearSelectDropdown: {\n '--control-radius': radius === undefined ? undefined : getRadius(radius),\n },\n}));\n\nexport const MonthYearSelect = factory<MonthYearSelectFactory>((_props) => {\n const props = useProps('MonthYearSelect', defaultProps, _props);\n const {\n __staticSelector,\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n popoverProps,\n startYear,\n endYear,\n onYearChange,\n onMonthChange,\n locale,\n monthsListFormat,\n monthValue,\n yearValue,\n labelFormat,\n radius,\n getMonthControlProps,\n getYearControlProps,\n withMonths,\n id,\n labels,\n ...others\n } = props;\n\n const getStyles = useStyles<MonthYearSelectFactory>({\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: 'monthYearSelectTarget',\n });\n\n const [opened, handlers] = useDisclosure(false);\n const resolvedLabels = useScheduleHeaderLabels(labels);\n\n const today = new Date();\n const ctx = useDatesContext();\n const _startYear = startYear ?? today.getFullYear() - 5;\n const _endYear = endYear ?? today.getFullYear() + 5;\n const hasActiveYear = yearValue !== undefined && yearValue >= _startYear && yearValue <= _endYear;\n\n const years = getYearsList({ startYear: _startYear, endYear: _endYear }).map((year, index) => {\n const controlProps = getYearControlProps?.(year);\n return (\n <UnstyledButton\n key={year}\n onClick={() => {\n onYearChange?.(year);\n if (!withMonths) {\n handlers.close();\n }\n }}\n mod={{ type: 'year', active: year === yearValue }}\n aria-label={`${getLabel('selectYear', resolvedLabels)} ${year}`}\n tabIndex={hasActiveYear ? (year === yearValue ? 0 : -1) : index === 0 ? 0 : -1}\n {...controlProps}\n onKeyDown={createScopedKeydownHandler({\n siblingSelector: '[data-type=\"year\"]:not(:disabled)',\n parentSelector: '[data-list]',\n activateOnFocus: false,\n loop: true,\n orientation: 'vertical',\n onKeyDown: controlProps?.onKeyDown,\n })}\n {...getStyles('monthYearSelectControl', {\n className: controlProps?.className,\n style: controlProps?.style,\n })}\n >\n {year}\n </UnstyledButton>\n );\n });\n\n const months = withMonths\n ? getMonthsList({\n locale: ctx.getLocale(locale),\n format: monthsListFormat || 'MMMM',\n }).map((month) => {\n const controlProps = getMonthControlProps?.(month.month);\n return (\n <UnstyledButton\n key={month.name}\n onClick={() => onMonthChange?.(month.month)}\n mod={{ type: 'month', active: month.month === monthValue }}\n tabIndex={month.month === monthValue ? 0 : -1}\n onKeyDown={createScopedKeydownHandler({\n siblingSelector: '[data-type=\"month\"]:not(:disabled)',\n parentSelector: '[data-list]',\n activateOnFocus: false,\n loop: true,\n orientation: 'vertical',\n onKeyDown: controlProps?.onKeyDown,\n })}\n {...controlProps}\n {...getStyles('monthYearSelectControl', {\n className: controlProps?.className,\n style: controlProps?.style,\n })}\n aria-label={`${getLabel('selectMonth', resolvedLabels)} ${month.name}`}\n >\n {month.name}\n </UnstyledButton>\n );\n })\n : null;\n\n return (\n <Popover\n position=\"bottom-start\"\n __staticSelector={__staticSelector}\n trapFocus\n transitionProps={{ transition: 'pop', duration: 120 }}\n radius={radius || 'var(--schedule-radius, var(--mantine-radius-default))'}\n shadow=\"md\"\n offset={3}\n width={withMonths ? undefined : 'target'}\n opened={opened}\n onChange={handlers.set}\n id={id}\n {...popoverProps}\n >\n <Popover.Target>\n <HeaderControl\n {...getStyles('monthYearSelectTarget')}\n __staticSelector={__staticSelector}\n radius={radius}\n data-with-months={withMonths || undefined}\n onClick={handlers.toggle}\n {...others}\n >\n {formatDate({\n locale: ctx.getLocale(locale),\n date: new Date(yearValue ?? today.getFullYear(), monthValue ?? today.getMonth()),\n format: labelFormat || (withMonths ? 'MMMM YYYY' : 'YYYY'),\n })}\n </HeaderControl>\n </Popover.Target>\n\n <Popover.Dropdown\n data-with-months={withMonths || undefined}\n {...getStyles('monthYearSelectDropdown')}\n >\n {withMonths && (\n <div data-list {...getStyles('monthYearSelectList')}>\n <div {...getStyles('monthYearSelectLabel')}>{getLabel('month', resolvedLabels)}</div>\n {months}\n </div>\n )}\n <div data-list {...getStyles('monthYearSelectList')}>\n {withMonths && (\n <div {...getStyles('monthYearSelectLabel')}>{getLabel('year', resolvedLabels)}</div>\n )}\n {years}\n </div>\n </Popover.Dropdown>\n </Popover>\n );\n});\n\nMonthYearSelect.displayName = '@mantine/schedule/MonthYearSelect';\nMonthYearSelect.classes = classes;\nMonthYearSelect.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;AA8FA,MAAM,eAAe;CACnB,kBAAkB;CAClB,YAAY;AACd;AAEA,MAAM,eAAe,oBAA4C,QAAQ,EAAE,cAAc,EACvF,yBAAyB,EACvB,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM,EACzE,EACF,EAAE;AAEF,MAAa,kBAAkB,SAAiC,WAAW;CACzE,MAAM,QAAQ,SAAS,mBAAmB,cAAc,MAAM;CAC9D,MAAM,EACJ,kBACA,YACA,WACA,OACA,QACA,UACA,MACA,YACA,cACA,WACA,SACA,cACA,eACA,QACA,kBACA,YACA,WACA,aACA,QACA,sBACA,qBACA,YACA,IACA,QACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAkC;EAClD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;CAChB,CAAC;CAED,MAAM,CAAC,QAAQ,YAAY,cAAc,KAAK;CAC9C,MAAM,iBAAiB,wBAAwB,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AUA;AAC1B,gBAAgB,eAAe"}
1
+ {"version":3,"file":"MonthYearSelect.mjs","names":["classes"],"sources":["../../../../src/components/ScheduleHeader/MonthYearSelect/MonthYearSelect.tsx"],"sourcesContent":["import {\n BoxProps,\n createScopedKeydownHandler,\n createVarsResolver,\n DataAttributes,\n ElementProps,\n factory,\n Factory,\n getRadius,\n MantineRadius,\n Popover,\n PopoverProps,\n StylesApiProps,\n UnstyledButton,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { useDatesContext } from '@mantine/dates';\nimport { useDisclosure } from '@mantine/hooks';\nimport { getLabel, ScheduleLabelsOverride } from '../../../labels';\nimport { DateLabelFormat } from '../../../types';\nimport { formatDate, getMonthsList, getYearsList } from '../../../utils';\nimport { HeaderControl } from '../HeaderControl/HeaderControl';\nimport { useScheduleHeaderLabels } from '../ScheduleHeaderContext';\nimport classes from './MonthYearSelect.module.css';\n\nexport type MonthYearSelectStylesNames =\n | 'monthYearSelectTarget'\n | 'monthYearSelectDropdown'\n | 'monthYearSelectControl'\n | 'monthYearSelectList'\n | 'monthYearSelectLabel';\n\nexport type MonthYearSelectCssVariables = {\n monthYearSelectDropdown: '--control-radius';\n};\n\nexport interface MonthYearSelectProps\n extends BoxProps, StylesApiProps<MonthYearSelectFactory>, ElementProps<'button'> {\n __staticSelector?: string;\n\n /** Locale passed down to dayjs, overrides value defined on `DatesProvider` */\n locale?: string;\n\n /** Props passed down to the underlying Popover component */\n popoverProps?: PopoverProps;\n\n /** Start year for year selection, calculated from the current date by default */\n startYear?: number;\n\n /** End year for year selection, calculated from the current date by default */\n endYear?: number;\n\n /** Current year value (e.g. `2025`) */\n yearValue?: number;\n\n /** Current month value (0-11) */\n monthValue?: number;\n\n /** Called with year value (e.g. `2025`) when year is selected in the dropdown */\n onYearChange?: (year: number) => void;\n\n /** Called with month value (0-11) when month is selected in the dropdown */\n onMonthChange?: (month: number) => void;\n\n /** Format for displaying months in the dropdown, dayjs format or custom formatter function @default 'MMM' */\n monthsListFormat?: DateLabelFormat;\n\n /** Format for displaying month label in the control, dayjs format @default 'MMMM YYYY' */\n labelFormat?: DateLabelFormat;\n\n /** Key of `theme.radius` or any valid CSS value to set `border-radius` @default theme.defaultRadius */\n radius?: MantineRadius;\n\n /** Props passed down to year controls */\n getYearControlProps?: (year: number) => React.ComponentProps<'button'> & DataAttributes;\n\n /** Props passed down to month controls */\n getMonthControlProps?: (month: number) => React.ComponentProps<'button'> & DataAttributes;\n\n /** If set to false, months are not displayed in the dropdown @default true */\n withMonths?: boolean;\n\n /** Labels override */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type MonthYearSelectFactory = Factory<{\n props: MonthYearSelectProps;\n ref: HTMLButtonElement;\n stylesNames: MonthYearSelectStylesNames;\n vars: MonthYearSelectCssVariables;\n}>;\n\nconst defaultProps = {\n __staticSelector: 'MonthYearSelect',\n withMonths: true,\n} satisfies Partial<MonthYearSelectProps>;\n\nconst varsResolver = createVarsResolver<MonthYearSelectFactory>((_theme, { radius }) => ({\n monthYearSelectDropdown: {\n '--control-radius': radius === undefined ? undefined : getRadius(radius),\n },\n}));\n\nexport const MonthYearSelect = factory<MonthYearSelectFactory>((_props) => {\n const props = useProps('MonthYearSelect', defaultProps, _props);\n const {\n __staticSelector,\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n popoverProps,\n startYear,\n endYear,\n onYearChange,\n onMonthChange,\n locale,\n monthsListFormat,\n monthValue,\n yearValue,\n labelFormat,\n radius,\n getMonthControlProps,\n getYearControlProps,\n withMonths,\n id,\n labels,\n ...others\n } = props;\n\n const getStyles = useStyles<MonthYearSelectFactory>({\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: 'monthYearSelectTarget',\n });\n\n const [opened, handlers] = useDisclosure(false);\n const resolvedLabels = useScheduleHeaderLabels(labels);\n\n const today = new Date();\n const ctx = useDatesContext();\n const _startYear = startYear ?? today.getFullYear() - 5;\n const _endYear = endYear ?? today.getFullYear() + 5;\n const hasActiveYear = yearValue !== undefined && yearValue >= _startYear && yearValue <= _endYear;\n\n const years = getYearsList({ startYear: _startYear, endYear: _endYear }).map((year, index) => {\n const controlProps = getYearControlProps?.(year);\n return (\n <UnstyledButton\n key={year}\n onClick={() => {\n onYearChange?.(year);\n if (!withMonths) {\n handlers.close();\n }\n }}\n mod={{ type: 'year', active: year === yearValue }}\n aria-label={`${getLabel('selectYear', resolvedLabels)} ${year}`}\n tabIndex={hasActiveYear ? (year === yearValue ? 0 : -1) : index === 0 ? 0 : -1}\n {...controlProps}\n onKeyDown={createScopedKeydownHandler({\n siblingSelector: '[data-type=\"year\"]:not(:disabled)',\n parentSelector: '[data-list]',\n activateOnFocus: false,\n loop: true,\n orientation: 'vertical',\n onKeyDown: controlProps?.onKeyDown,\n })}\n {...getStyles('monthYearSelectControl', {\n className: controlProps?.className,\n style: controlProps?.style,\n })}\n >\n {year}\n </UnstyledButton>\n );\n });\n\n const months = withMonths\n ? getMonthsList({\n locale: ctx.getLocale(locale),\n format: monthsListFormat || 'MMMM',\n }).map((month) => {\n const controlProps = getMonthControlProps?.(month.month);\n return (\n <UnstyledButton\n key={month.name}\n onClick={() => onMonthChange?.(month.month)}\n mod={{ type: 'month', active: month.month === monthValue }}\n tabIndex={month.month === monthValue ? 0 : -1}\n onKeyDown={createScopedKeydownHandler({\n siblingSelector: '[data-type=\"month\"]:not(:disabled)',\n parentSelector: '[data-list]',\n activateOnFocus: false,\n loop: true,\n orientation: 'vertical',\n onKeyDown: controlProps?.onKeyDown,\n })}\n {...controlProps}\n {...getStyles('monthYearSelectControl', {\n className: controlProps?.className,\n style: controlProps?.style,\n })}\n aria-label={`${getLabel('selectMonth', resolvedLabels)} ${month.name}`}\n >\n {month.name}\n </UnstyledButton>\n );\n })\n : null;\n\n return (\n <Popover\n position=\"bottom-start\"\n __staticSelector={__staticSelector}\n trapFocus\n transitionProps={{ transition: 'pop', duration: 120 }}\n radius={radius || 'var(--schedule-radius, var(--mantine-radius-default))'}\n shadow=\"md\"\n offset={3}\n width={withMonths ? undefined : 'target'}\n opened={opened}\n onChange={handlers.set}\n id={id}\n {...popoverProps}\n >\n <Popover.Target>\n <HeaderControl\n {...getStyles('monthYearSelectTarget')}\n __staticSelector={__staticSelector}\n radius={radius}\n data-with-months={withMonths || undefined}\n onClick={handlers.toggle}\n {...others}\n >\n {formatDate({\n locale: ctx.getLocale(locale),\n date: new Date(yearValue ?? today.getFullYear(), monthValue ?? today.getMonth()),\n format: labelFormat || (withMonths ? 'MMMM YYYY' : 'YYYY'),\n })}\n </HeaderControl>\n </Popover.Target>\n\n <Popover.Dropdown\n data-with-months={withMonths || undefined}\n {...getStyles('monthYearSelectDropdown')}\n >\n {withMonths && (\n <div data-list {...getStyles('monthYearSelectList')}>\n <div {...getStyles('monthYearSelectLabel')}>{getLabel('month', resolvedLabels)}</div>\n {months}\n </div>\n )}\n <div data-list {...getStyles('monthYearSelectList')}>\n {withMonths && (\n <div {...getStyles('monthYearSelectLabel')}>{getLabel('year', resolvedLabels)}</div>\n )}\n {years}\n </div>\n </Popover.Dropdown>\n </Popover>\n );\n});\n\nMonthYearSelect.displayName = '@mantine/schedule/MonthYearSelect';\nMonthYearSelect.classes = classes;\nMonthYearSelect.varsResolver = varsResolver;\n"],"mappings":";;;;;;;;;;;;;AA8FA,MAAM,eAAe;CACnB,kBAAkB;CAClB,YAAY;AACd;AAEA,MAAM,eAAe,oBAA4C,QAAQ,EAAE,cAAc,EACvF,yBAAyB,EACvB,oBAAoB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM,EACzE,EACF,EAAE;AAEF,MAAa,kBAAkB,SAAiC,WAAW;CACzE,MAAM,QAAQ,SAAS,mBAAmB,cAAc,MAAM;CAC9D,MAAM,EACJ,kBACA,YACA,WACA,OACA,QACA,UACA,MACA,YACA,cACA,WACA,SACA,cACA,eACA,QACA,kBACA,YACA,WACA,aACA,QACA,sBACA,qBACA,YACA,IAC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;IAAO,CAAA,GACnF,MACE;GAEP,CAAA,GAAA,qBAAC,OAAD;IAAK,aAAA;IAAU,GAAI,UAAU,qBAAqB;IAAlD,UAAA,CACG,cACC,oBAAC,OAAD;KAAK,GAAI,UAAU,sBAAsB;KAAI,UAAA,SAAS,QAAQ,cAAc;IAAO,CAAA,GAEpF,KACE;GACW,CAAA,CAAA;EACX,CAAA,CAAA;;AAEb,CAAC;AAED,gBAAgB,cAAc;AAC9B,gBAAgB,UAAUA;AAC1B,gBAAgB,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScheduleHeader.mjs","names":["classes"],"sources":["../../../src/components/ScheduleHeader/ScheduleHeader.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n HeaderControl,\n HeaderControlStylesNames,\n ScheduleHeaderNext,\n ScheduleHeaderPrevious,\n ScheduleHeaderToday,\n} from './HeaderControl/HeaderControl';\nimport { MonthYearSelect, MonthYearSelectStylesNames } from './MonthYearSelect/MonthYearSelect';\nimport { ScheduleHeaderLabelsContext } from './ScheduleHeaderContext';\nimport { ViewSelect, ViewSelectStylesNames } from './ViewSelect/ViewSelect';\nimport classes from './ScheduleHeader.module.css';\n\nexport type CombinedScheduleHeaderStylesNames =\n | ScheduleHeaderStylesNames\n | ViewSelectStylesNames\n | HeaderControlStylesNames\n | MonthYearSelectStylesNames;\n\nexport type ScheduleHeaderStylesNames = 'header';\nexport type ScheduleHeaderCssVariables = {\n scheduleHeader: '--test';\n};\n\nexport interface ScheduleHeaderProps\n extends BoxProps, StylesApiProps<ScheduleHeaderFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Labels override shared with compound components rendered inside */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type ScheduleHeaderFactory = Factory<{\n props: ScheduleHeaderProps;\n ref: HTMLDivElement;\n stylesNames: ScheduleHeaderStylesNames;\n vars: ScheduleHeaderCssVariables;\n staticComponents: {\n Control: typeof HeaderControl;\n Previous: typeof ScheduleHeaderPrevious;\n Next: typeof ScheduleHeaderNext;\n Today: typeof ScheduleHeaderToday;\n ViewSelect: typeof ViewSelect;\n MonthYearSelect: typeof MonthYearSelect;\n };\n}>;\n\nconst defaultProps = {\n __staticSelector: 'ScheduleHeader',\n} satisfies Partial<ScheduleHeaderProps>;\n\nconst varsResolver = createVarsResolver<ScheduleHeaderFactory>(() => ({\n scheduleHeader: {\n '--test': 'test',\n },\n}));\n\nexport const ScheduleHeader = factory<ScheduleHeaderFactory>((_props) => {\n const props = useProps('ScheduleHeader', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n __staticSelector,\n labels,\n ...others\n } = props;\n\n const getStyles = useStyles<ScheduleHeaderFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'header',\n });\n\n return (\n <ScheduleHeaderLabelsContext.Provider value={labels}>\n <Box {...getStyles('header')} {...others} />\n </ScheduleHeaderLabelsContext.Provider>\n );\n});\n\nScheduleHeader.displayName = '@mantine/schedule/ScheduleHeader';\nScheduleHeader.classes = classes;\nScheduleHeader.varsResolver = varsResolver;\nScheduleHeader.Control = HeaderControl;\nScheduleHeader.Next = ScheduleHeaderNext;\nScheduleHeader.Previous = ScheduleHeaderPrevious;\nScheduleHeader.Today = ScheduleHeaderToday;\nScheduleHeader.ViewSelect = ViewSelect;\nScheduleHeader.MonthYearSelect = MonthYearSelect;\n"],"mappings":";;;;;;;;;AA0DA,MAAM,eAAe,EACnB,kBAAkB,iBACpB;AAEA,MAAM,eAAe,0BAAiD,EACpE,gBAAgB,EACd,UAAU,OACZ,EACF,EAAE;AAEF,MAAa,iBAAiB,SAAgC,WAAW;CACvE,MAAM,QAAQ,SAAS,kBAAkB,cAAc,MAAM;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,YACA,kBACA,QACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAiC;EACjD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,oBAAC,4BAA4B,UAA7B;EAAsC,OAAO;YAC3C,oBAAC,KAAD;GAAK,GAAI,UAAU,QAAQ;GAAG,GAAI;EAAS,CAAA;CACP,CAAA;AAE1C,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUA;AACzB,eAAe,eAAe;AAC9B,eAAe,UAAU;AACzB,eAAe,OAAO;AACtB,eAAe,WAAW;AAC1B,eAAe,QAAQ;AACvB,eAAe,aAAa;AAC5B,eAAe,kBAAkB"}
1
+ {"version":3,"file":"ScheduleHeader.mjs","names":["classes"],"sources":["../../../src/components/ScheduleHeader/ScheduleHeader.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { ScheduleLabelsOverride } from '../../labels';\nimport {\n HeaderControl,\n HeaderControlStylesNames,\n ScheduleHeaderNext,\n ScheduleHeaderPrevious,\n ScheduleHeaderToday,\n} from './HeaderControl/HeaderControl';\nimport { MonthYearSelect, MonthYearSelectStylesNames } from './MonthYearSelect/MonthYearSelect';\nimport { ScheduleHeaderLabelsContext } from './ScheduleHeaderContext';\nimport { ViewSelect, ViewSelectStylesNames } from './ViewSelect/ViewSelect';\nimport classes from './ScheduleHeader.module.css';\n\nexport type CombinedScheduleHeaderStylesNames =\n | ScheduleHeaderStylesNames\n | ViewSelectStylesNames\n | HeaderControlStylesNames\n | MonthYearSelectStylesNames;\n\nexport type ScheduleHeaderStylesNames = 'header';\nexport type ScheduleHeaderCssVariables = {\n scheduleHeader: '--test';\n};\n\nexport interface ScheduleHeaderProps\n extends BoxProps, StylesApiProps<ScheduleHeaderFactory>, ElementProps<'div'> {\n __staticSelector?: string;\n\n /** Labels override shared with compound components rendered inside */\n labels?: ScheduleLabelsOverride;\n}\n\nexport type ScheduleHeaderFactory = Factory<{\n props: ScheduleHeaderProps;\n ref: HTMLDivElement;\n stylesNames: ScheduleHeaderStylesNames;\n vars: ScheduleHeaderCssVariables;\n staticComponents: {\n Control: typeof HeaderControl;\n Previous: typeof ScheduleHeaderPrevious;\n Next: typeof ScheduleHeaderNext;\n Today: typeof ScheduleHeaderToday;\n ViewSelect: typeof ViewSelect;\n MonthYearSelect: typeof MonthYearSelect;\n };\n}>;\n\nconst defaultProps = {\n __staticSelector: 'ScheduleHeader',\n} satisfies Partial<ScheduleHeaderProps>;\n\nconst varsResolver = createVarsResolver<ScheduleHeaderFactory>(() => ({\n scheduleHeader: {\n '--test': 'test',\n },\n}));\n\nexport const ScheduleHeader = factory<ScheduleHeaderFactory>((_props) => {\n const props = useProps('ScheduleHeader', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n __staticSelector,\n labels,\n ...others\n } = props;\n\n const getStyles = useStyles<ScheduleHeaderFactory>({\n name: __staticSelector,\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n vars,\n varsResolver,\n attributes,\n rootSelector: 'header',\n });\n\n return (\n <ScheduleHeaderLabelsContext.Provider value={labels}>\n <Box {...getStyles('header')} {...others} />\n </ScheduleHeaderLabelsContext.Provider>\n );\n});\n\nScheduleHeader.displayName = '@mantine/schedule/ScheduleHeader';\nScheduleHeader.classes = classes;\nScheduleHeader.varsResolver = varsResolver;\nScheduleHeader.Control = HeaderControl;\nScheduleHeader.Next = ScheduleHeaderNext;\nScheduleHeader.Previous = ScheduleHeaderPrevious;\nScheduleHeader.Today = ScheduleHeaderToday;\nScheduleHeader.ViewSelect = ViewSelect;\nScheduleHeader.MonthYearSelect = MonthYearSelect;\n"],"mappings":";;;;;;;;;AA0DA,MAAM,eAAe,EACnB,kBAAkB,iBACpB;AAEA,MAAM,eAAe,0BAAiD,EACpE,gBAAgB,EACd,UAAU,OACZ,EACF,EAAE;AAEF,MAAa,iBAAiB,SAAgC,WAAW;CACvE,MAAM,QAAQ,SAAS,kBAAkB,cAAc,MAAM;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,YACA,kBACA,QACA,GAAG,WACD;CAEJ,MAAM,YAAY,UAAiC;EACjD,MAAM;EACN,SAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;CAChB,CAAC;CAED,OACE,oBAAC,4BAA4B,UAA7B;EAAsC,OAAO;EAC3C,UAAA,oBAAC,KAAD;GAAK,GAAI,UAAU,QAAQ;GAAG,GAAI;EAAS,CAAA;CACP,CAAA;AAE1C,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUA;AACzB,eAAe,eAAe;AAC9B,eAAe,UAAU;AACzB,eAAe,OAAO;AACtB,eAAe,WAAW;AAC1B,eAAe,QAAQ;AACvB,eAAe,aAAa;AAC5B,eAAe,kBAAkB"}