@weekwise/react 0.3.0 → 0.4.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 (198) hide show
  1. package/README.md +69 -9
  2. package/dist/Calendar.d.ts +4 -3
  3. package/dist/Calendar.js +20 -0
  4. package/dist/Calendar.js.map +1 -0
  5. package/dist/Calendar.module.css.js +11 -0
  6. package/dist/Calendar.module.css.js.map +1 -0
  7. package/dist/Calendar.types.d.ts +34 -6
  8. package/dist/CalendarBase.d.ts +8 -0
  9. package/dist/CalendarBase.js +161 -0
  10. package/dist/CalendarBase.js.map +1 -0
  11. package/dist/components/calendar-toolbar/CalendarToolbar.js +51 -0
  12. package/dist/components/calendar-toolbar/CalendarToolbar.js.map +1 -0
  13. package/dist/components/calendar-toolbar/CalendarToolbar.module.css.js +15 -0
  14. package/dist/components/calendar-toolbar/CalendarToolbar.module.css.js.map +1 -0
  15. package/dist/components/date-navigator/DateNavigator.js +129 -0
  16. package/dist/components/date-navigator/DateNavigator.js.map +1 -0
  17. package/dist/components/date-navigator/DateNavigator.module.css.js +25 -0
  18. package/dist/components/date-navigator/DateNavigator.module.css.js.map +1 -0
  19. package/dist/components/day-week-drawer/DayWeekDrawer.js +227 -0
  20. package/dist/components/day-week-drawer/DayWeekDrawer.js.map +1 -0
  21. package/dist/components/day-week-drawer/DayWeekDrawer.module.css.js +15 -0
  22. package/dist/components/day-week-drawer/DayWeekDrawer.module.css.js.map +1 -0
  23. package/dist/components/day-week-event/DayWeekEvent.js +154 -0
  24. package/dist/components/day-week-event/DayWeekEvent.js.map +1 -0
  25. package/dist/components/day-week-event/DayWeekEvent.module.css.js +17 -0
  26. package/dist/components/day-week-event/DayWeekEvent.module.css.js.map +1 -0
  27. package/dist/components/day-week-event/DayWeekEventPreview.js +26 -0
  28. package/dist/components/day-week-event/DayWeekEventPreview.js.map +1 -0
  29. package/dist/components/day-week-view/DayWeekView.js +226 -0
  30. package/dist/components/day-week-view/DayWeekView.js.map +1 -0
  31. package/dist/components/day-week-view/DayWeekView.module.css.js +27 -0
  32. package/dist/components/day-week-view/DayWeekView.module.css.js.map +1 -0
  33. package/dist/components/day-week-view/HiddenEvents.js +78 -0
  34. package/dist/components/day-week-view/HiddenEvents.js.map +1 -0
  35. package/dist/components/day-week-view/useTimeColumnWidth.js +34 -0
  36. package/dist/components/day-week-view/useTimeColumnWidth.js.map +1 -0
  37. package/dist/components/drag-overlay/DragOverlay.js +98 -0
  38. package/dist/components/drag-overlay/DragOverlay.js.map +1 -0
  39. package/dist/components/drag-overlay/DragOverlay.module.css.js +12 -0
  40. package/dist/components/drag-overlay/DragOverlay.module.css.js.map +1 -0
  41. package/dist/components/index.d.ts +1 -0
  42. package/dist/components/month-view/MonthView.d.ts +8 -2
  43. package/dist/components/month-view/MonthView.js +105 -0
  44. package/dist/components/month-view/MonthView.js.map +1 -0
  45. package/dist/components/month-view/MonthView.module.css.js +30 -0
  46. package/dist/components/month-view/MonthView.module.css.js.map +1 -0
  47. package/dist/components/month-view/MonthView.utils.js +14 -0
  48. package/dist/components/month-view/MonthView.utils.js.map +1 -0
  49. package/dist/components/month-view/MonthViewDay.d.ts +2 -0
  50. package/dist/components/month-view/MonthViewDay.js +75 -0
  51. package/dist/components/month-view/MonthViewDay.js.map +1 -0
  52. package/dist/components/month-view/MonthViewEvent.js +132 -0
  53. package/dist/components/month-view/MonthViewEvent.js.map +1 -0
  54. package/dist/components/month-view/MonthViewEventPreview.js +28 -0
  55. package/dist/components/month-view/MonthViewEventPreview.js.map +1 -0
  56. package/dist/components/month-view/MonthViewWeek.d.ts +5 -0
  57. package/dist/components/month-view/MonthViewWeek.js +67 -0
  58. package/dist/components/month-view/MonthViewWeek.js.map +1 -0
  59. package/dist/components/month-view/useMonthLanes.js +22 -0
  60. package/dist/components/month-view/useMonthLanes.js.map +1 -0
  61. package/dist/components/month-view/useMonthResize.js +57 -0
  62. package/dist/components/month-view/useMonthResize.js.map +1 -0
  63. package/dist/components/nav-btn/NavBtn.js +28 -0
  64. package/dist/components/nav-btn/NavBtn.js.map +1 -0
  65. package/dist/components/nav-btn/NavBtn.module.css.js +11 -0
  66. package/dist/components/nav-btn/NavBtn.module.css.js.map +1 -0
  67. package/dist/components/pointer-popover/PointerPopover.js +22 -0
  68. package/dist/components/pointer-popover/PointerPopover.js.map +1 -0
  69. package/dist/components/pointer-popover/PointerPopover.module.css.js +6 -0
  70. package/dist/components/pointer-popover/PointerPopover.module.css.js.map +1 -0
  71. package/dist/components/timeline-view/TimelineView.d.ts +6 -0
  72. package/dist/components/timeline-view/TimelineView.js +10 -0
  73. package/dist/components/timeline-view/TimelineView.js.map +1 -0
  74. package/dist/components/timeline-view/index.d.ts +1 -0
  75. package/dist/components/view-select/ViewSelect.d.ts +1 -1
  76. package/dist/components/view-select/ViewSelect.js +117 -0
  77. package/dist/components/view-select/ViewSelect.js.map +1 -0
  78. package/dist/components/view-select/ViewSelect.module.css.js +14 -0
  79. package/dist/components/view-select/ViewSelect.module.css.js.map +1 -0
  80. package/dist/contexts/CalendarContext.js +14 -0
  81. package/dist/contexts/CalendarContext.js.map +1 -0
  82. package/dist/contexts/CalendarViewportContext.js +14 -0
  83. package/dist/contexts/CalendarViewportContext.js.map +1 -0
  84. package/dist/contexts/DayWeekDrawerContext.js +14 -0
  85. package/dist/contexts/DayWeekDrawerContext.js.map +1 -0
  86. package/dist/contexts/DayWeekViewContext.js +14 -0
  87. package/dist/contexts/DayWeekViewContext.js.map +1 -0
  88. package/dist/contexts/ThemeSourceContext.js +9 -0
  89. package/dist/contexts/ThemeSourceContext.js.map +1 -0
  90. package/dist/date-localization/DateLocalizationContext.js +9 -0
  91. package/dist/date-localization/DateLocalizationContext.js.map +1 -0
  92. package/dist/date-localization/DateLocalizationProvider.js +20 -0
  93. package/dist/date-localization/DateLocalizationProvider.js.map +1 -0
  94. package/dist/date-localization/MessagesContext.js +9 -0
  95. package/dist/date-localization/MessagesContext.js.map +1 -0
  96. package/dist/date-localization/useDateUtils.js +15 -0
  97. package/dist/date-localization/useDateUtils.js.map +1 -0
  98. package/dist/date-localization/useMessages.js +13 -0
  99. package/dist/date-localization/useMessages.js.map +1 -0
  100. package/dist/hooks/useAbsEventRect.js +27 -0
  101. package/dist/hooks/useAbsEventRect.js.map +1 -0
  102. package/dist/hooks/useAutoScroller.js +83 -0
  103. package/dist/hooks/useAutoScroller.js.map +1 -0
  104. package/dist/hooks/useCalendarSize.js +20 -0
  105. package/dist/hooks/useCalendarSize.js.map +1 -0
  106. package/dist/hooks/useCalendarValue.d.ts +1 -1
  107. package/dist/hooks/useCalendarValue.js +51 -0
  108. package/dist/hooks/useCalendarValue.js.map +1 -0
  109. package/dist/hooks/useCanResizeEvent.js +29 -0
  110. package/dist/hooks/useCanResizeEvent.js.map +1 -0
  111. package/dist/hooks/useComputed.js +14 -0
  112. package/dist/hooks/useComputed.js.map +1 -0
  113. package/dist/hooks/useControlled.js +20 -0
  114. package/dist/hooks/useControlled.js.map +1 -0
  115. package/dist/hooks/useControlled.utils.js +33 -0
  116. package/dist/hooks/useControlled.utils.js.map +1 -0
  117. package/dist/hooks/useCurrentRef.js +10 -0
  118. package/dist/hooks/useCurrentRef.js.map +1 -0
  119. package/dist/hooks/useDocumentCursor.js +13 -0
  120. package/dist/hooks/useDocumentCursor.js.map +1 -0
  121. package/dist/hooks/useEventCallback.js +12 -0
  122. package/dist/hooks/useEventCallback.js.map +1 -0
  123. package/dist/hooks/useEventCallback.utils.js +20 -0
  124. package/dist/hooks/useEventCallback.utils.js.map +1 -0
  125. package/dist/hooks/useEventResize.js +106 -0
  126. package/dist/hooks/useEventResize.js.map +1 -0
  127. package/dist/hooks/useGlobalListeners.js +40 -0
  128. package/dist/hooks/useGlobalListeners.js.map +1 -0
  129. package/dist/hooks/useInterval.js +14 -0
  130. package/dist/hooks/useInterval.js.map +1 -0
  131. package/dist/hooks/useIsomorphicLayoutEffect.js +6 -0
  132. package/dist/hooks/useIsomorphicLayoutEffect.js.map +1 -0
  133. package/dist/hooks/useItemsLayout.js +53 -0
  134. package/dist/hooks/useItemsLayout.js.map +1 -0
  135. package/dist/hooks/useMergedRefs.js +10 -0
  136. package/dist/hooks/useMergedRefs.js.map +1 -0
  137. package/dist/hooks/useMove.js +180 -0
  138. package/dist/hooks/useMove.js.map +1 -0
  139. package/dist/hooks/useMoveTransform.js +118 -0
  140. package/dist/hooks/useMoveTransform.js.map +1 -0
  141. package/dist/hooks/useMutationObserver.js +16 -0
  142. package/dist/hooks/useMutationObserver.js.map +1 -0
  143. package/dist/hooks/useNavigation.js +15 -0
  144. package/dist/hooks/useNavigation.js.map +1 -0
  145. package/dist/hooks/usePrevious.js +12 -0
  146. package/dist/hooks/usePrevious.js.map +1 -0
  147. package/dist/hooks/useRect.js +37 -0
  148. package/dist/hooks/useRect.js.map +1 -0
  149. package/dist/hooks/useRefList.js +21 -0
  150. package/dist/hooks/useRefList.js.map +1 -0
  151. package/dist/hooks/useRefWithInit.js +11 -0
  152. package/dist/hooks/useRefWithInit.js.map +1 -0
  153. package/dist/hooks/useResizeObserver.js +16 -0
  154. package/dist/hooks/useResizeObserver.js.map +1 -0
  155. package/dist/hooks/useScrollBarSize.js +37 -0
  156. package/dist/hooks/useScrollBarSize.js.map +1 -0
  157. package/dist/hooks/useScrollIntent.js +41 -0
  158. package/dist/hooks/useScrollIntent.js.map +1 -0
  159. package/dist/hooks/useScrollOffsets.js +33 -0
  160. package/dist/hooks/useScrollOffsets.js.map +1 -0
  161. package/dist/hooks/useScrollOffsetsDelta.js +16 -0
  162. package/dist/hooks/useScrollOffsetsDelta.js.map +1 -0
  163. package/dist/hooks/useScrollableAncestors.js +14 -0
  164. package/dist/hooks/useScrollableAncestors.js.map +1 -0
  165. package/dist/hooks/useScrollableAncestorsRects.js +32 -0
  166. package/dist/hooks/useScrollableAncestorsRects.js.map +1 -0
  167. package/dist/hooks/useStateRef.js +16 -0
  168. package/dist/hooks/useStateRef.js.map +1 -0
  169. package/dist/hooks/useTimeInterval.js +25 -0
  170. package/dist/hooks/useTimeInterval.js.map +1 -0
  171. package/dist/hooks/useTimeOffset.js +24 -0
  172. package/dist/hooks/useTimeOffset.js.map +1 -0
  173. package/dist/hooks/useToday.js +26 -0
  174. package/dist/hooks/useToday.js.map +1 -0
  175. package/dist/icons/chevron.js +20 -0
  176. package/dist/icons/chevron.js.map +1 -0
  177. package/dist/index.cjs +1 -1
  178. package/dist/index.cjs.map +1 -1
  179. package/dist/index.d.ts +3 -0
  180. package/dist/index.js +12 -2798
  181. package/dist/portal/Portal.js +31 -0
  182. package/dist/portal/Portal.js.map +1 -0
  183. package/dist/style.css +1 -1
  184. package/dist/utils/mergeRefs.js +15 -0
  185. package/dist/utils/mergeRefs.js.map +1 -0
  186. package/dist/views/dayView.d.ts +4 -0
  187. package/dist/views/dayView.js +13 -0
  188. package/dist/views/dayView.js.map +1 -0
  189. package/dist/views/index.d.ts +4 -0
  190. package/dist/views/monthView.d.ts +9 -0
  191. package/dist/views/monthView.js +20 -0
  192. package/dist/views/monthView.js.map +1 -0
  193. package/dist/views/types.d.ts +30 -0
  194. package/dist/views/weekView.d.ts +4 -0
  195. package/dist/views/weekView.js +13 -0
  196. package/dist/views/weekView.js.map +1 -0
  197. package/package.json +7 -7
  198. package/dist/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayWeekEvent.js","names":["styles","_jsx","_Fragment","_jsxs","useEffect","useRef","useDragAndDrop","useEventCallback","useMergedRefs","useMove","applyMoveTransformModifiers","boundingDraggableContainerModifier","cx","getTimeStepEqualizerModifier","mergeCallbacks","omit","useCalendarContext","useDayWeekDrawerContext","useDayWeekViewContext","useAbsEventRect","useCanResizeEvent","useMoveTransform","useRect","useCalendarDateUtils","DayWeekEvent_module_default","Fragment","jsx","jsxs","DayWeekEvent","props","forwardedRef","eventData","children","rootProps","eventMap","options","dateUtils","timeStep","preventOutBoundsChanges","disabled","rootRef","topBarRef","bottomBarRef","viewportRef","getTimeFrame","pxPerMinute","resize","resizing","stepPx","drawerRef","containerRef","absEventRect","canResize","attributes","isDragging","overElement","overData","register","setOverlayTransform","registerDragSource","draggable","droppable","setTransform","isActive","activeDrawerRect","transform","context","actions","ctx","activeNodeRect","containerNodeRect","translate","initialTranslate","compensation","top","bottom","x","getEventTransformModifiers","moveEndHandler","resizeListeners","edge","e","resizeBottomListeners","resizeTopListeners","handleRootRef","isDragginOverlay","isResizeSource","syncTransform","item","items","\"event\"","rootClassName","rootStyle","handlePointerDown","args","modifiers"],"sources":["../../../src/components/day-week-event/DayWeekEvent.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport type { DetailedHTMLProps, HTMLAttributes } from \"react\";\n\nimport { useDragAndDrop } from \"@weekwise/dnd/react\";\nimport { useEventCallback, useMergedRefs, useMove } from \"../../hooks\";\nimport type { MoveEndEvent } from \"../../hooks/useMove.types\";\nimport { cx, mergeCallbacks, omit } from \"@weekwise/core\";\n\nimport { useCalendarContext } from \"../../contexts/CalendarContext\";\nimport { useDayWeekDrawerContext } from \"../../contexts/DayWeekDrawerContext\";\nimport { useDayWeekViewContext } from \"../../contexts/DayWeekViewContext\";\nimport useAbsEventRect from \"../../hooks/useAbsEventRect\";\nimport useCanResizeEvent from \"../../hooks/useCanResizeEvent\";\nimport useMoveTransform, { type MoveTransform, type MoveTransformModifier } from \"../../hooks/useMoveTransform\";\nimport useRect from \"../../hooks/useRect\";\nimport {\n applyMoveTransformModifiers,\n boundingDraggableContainerModifier,\n getTimeStepEqualizerModifier,\n} from \"@weekwise/core\";\n\nimport type { DayWeekDragItem, MeasuredEventData } from \"../day-week-view\";\nimport { useCalendarDateUtils } from \"../../date-localization\";\n\nimport styles from \"./DayWeekEvent.module.css\";\n\nexport type DayWeekEventProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {\n eventData: MeasuredEventData;\n};\n\nexport type DayWeekEventTransformContext = \"bottom\" | \"top\" | \"overlay\";\n\nexport default function DayWeekEvent(props: DayWeekEventProps) {\n const { ref: forwardedRef, eventData, children, ...rootProps } = props;\n\n const { eventMap, ...options } = useCalendarContext();\n const dateUtils = useCalendarDateUtils();\n const { timeStep, preventOutBoundsChanges, disabled } = options;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const topBarRef = useRef<HTMLDivElement | null>(null);\n const bottomBarRef = useRef<HTMLDivElement | null>(null);\n const { viewportRef, getTimeFrame, pxPerMinute, resize, resizing } = useDayWeekViewContext();\n // a time step on screen: the rows are shorter than 60px an hour in a compact calendar\n const stepPx = timeStep * pxPerMinute;\n const { drawerRef, containerRef } = useDayWeekDrawerContext();\n const absEventRect = useAbsEventRect(rootRef, containerRef, eventData.rect);\n // The whole event's start: a part shown today may belong to an event from yesterday.\n const canResize = useCanResizeEvent(eventMap.get(eventData.key)?.date ?? eventData.date, absEventRect);\n\n const { attributes, isDragging, overElement, overData, register, setOverlayTransform } = useDragAndDrop(\n ({ registerDragSource, draggable, droppable, setTransform, isActive }) => {\n const isDragging = isActive(rootRef.current);\n const [overElement, overData] = isDragging ? ([...droppable.dropTargets].pop() ?? [null, null]) : [null, null];\n\n return {\n attributes: draggable.attributes,\n overElement,\n overData,\n isDragging,\n register: registerDragSource,\n setOverlayTransform: setTransform,\n };\n }\n );\n\n const activeDrawerRect = useRect(isDragging ? overElement : null);\n\n const activeNodeResolver = (ctx: DayWeekEventTransformContext | null) => {\n return ctx === \"overlay\" ? rootRef.current : ctx === \"top\" ? topBarRef.current : bottomBarRef.current;\n };\n\n const containerNodeResolver = (ctx: DayWeekEventTransformContext | null) => {\n // the drawer, not the events' container in it: that one leaves a gap on the right\n return ctx === \"overlay\" ? viewportRef.current : drawerRef.current;\n };\n\n const [{ isActive, transform, context }, actions] = useMoveTransform<DayWeekEventTransformContext>({\n activeNode: activeNodeResolver,\n containerNode: containerNodeResolver,\n modifiers: [\n function overlayTransformModifier({\n activeNodeRect,\n containerNodeRect,\n context,\n transform,\n translate,\n initialTranslate,\n }) {\n // if context is not overlay do nothing\n if (context !== \"overlay\") {\n return transform;\n }\n\n if (!containerNodeRect || !activeNodeRect || !activeDrawerRect) {\n return transform;\n }\n\n transform.x = translate.x + initialTranslate.x - containerNodeRect.left;\n transform.y = translate.y + initialTranslate.y - containerNodeRect.top;\n\n transform.left = activeDrawerRect.left - containerNodeRect.left;\n transform.width = activeDrawerRect.width;\n transform.top = activeNodeRect.top - containerNodeRect.top;\n transform.height = activeNodeRect.height;\n\n let compensation: number;\n if (translate.y > 0) {\n compensation = stepPx - ((initialTranslate.y - activeNodeRect.top) % stepPx);\n transform.top += Math.ceil((translate.y - compensation) / stepPx) * stepPx;\n } else {\n compensation = (initialTranslate.y - activeNodeRect.top) % stepPx;\n transform.top += Math.floor((translate.y + compensation) / stepPx) * stepPx;\n }\n\n return transform;\n },\n function boundingDragTimeFrameModifier({ transform, context }) {\n if (!preventOutBoundsChanges) {\n return transform;\n }\n\n if (context !== \"overlay\" || !overData) {\n return transform;\n }\n\n const [top, bottom] = getTimeFrame(overData.date).map((x) => Math.ceil(x / timeStep) * stepPx);\n // top edge\n if (transform.top < top) {\n transform.top = top;\n }\n\n // bottom edge\n if (transform.top + transform.height > bottom) {\n transform.top = bottom - transform.height;\n }\n\n return transform;\n },\n getEventTransformModifiers(stepPx),\n ],\n });\n\n // Resizing is computed by the view (it may reach into other days); the move transform\n // only keeps auto-scroll running while the pointer is near an edge.\n const moveEndHandler = mergeCallbacks<[MoveEndEvent]>(\n () => resize.end(),\n (e) => {\n actions.stop({ x: e.clientX, y: e.clientY });\n }\n );\n\n const resizeListeners = (edge: \"top\" | \"bottom\") => ({\n onMoveStart: (e: { clientX: number; clientY: number }) => {\n actions.start({ x: e.clientX, y: e.clientY }, edge);\n resize.start(eventData.key, edge, e.clientX, e.clientY);\n return true;\n },\n onMove: (e: { clientX: number; clientY: number }) => {\n actions.move({ x: e.clientX, y: e.clientY });\n resize.move(e.clientX, e.clientY);\n },\n onMoveEnd: moveEndHandler,\n });\n\n const { listeners: resizeBottomListeners } = useMove(resizeListeners(\"bottom\"));\n const { listeners: resizeTopListeners } = useMove(resizeListeners(\"top\"));\n\n const handleRootRef = useMergedRefs(rootRef, forwardedRef);\n const isDragginOverlay = isActive && isDragging && context === \"overlay\";\n // While resized, the view draws the event's new range; its own parts step aside.\n const isResizeSource = resizing?.key === eventData.key;\n\n // Away from every day the overlay keeps its last place: the transform has no day to fit in.\n const syncTransform = useEventCallback((transform: MoveTransform) => {\n if (context === \"overlay\" && overElement) {\n setOverlayTransform(transform);\n }\n });\n\n useEffect(() => {\n syncTransform(transform);\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n }, [syncTransform, ...Object.values(transform)]);\n\n useEffect(() => {\n if (!rootRef.current) {\n return;\n }\n\n const item: DayWeekDragItem = { ...omit(eventData, \"rect\"), date: dateUtils.toMillis(eventData.date) };\n const items = [{ [\"event\"]: JSON.stringify(item) }];\n\n return register(rootRef.current, {\n getItems() {\n return items;\n },\n onDragStart(e) {\n actions.start({ x: e.x, y: e.y }, \"overlay\");\n },\n onDragMove(e) {\n actions.move({ x: e.x, y: e.y });\n },\n onDragEnd(e) {\n actions.stop({ x: e.x, y: e.y });\n },\n getAllowedDropOperations() {\n return [\"move\"];\n },\n });\n }, [actions, eventData, register]);\n\n const rootClassName = cx(rootProps.className, styles.root, {\n [styles.root_isDragging]: isDragginOverlay,\n [styles.root_isResizeSource]: isResizeSource,\n [styles.root_isDisabled]: disabled,\n });\n\n const rootStyle = {\n ...rootProps.style,\n top: `${eventData.rect.y}%`,\n left: `${eventData.rect.x}%`,\n width: `${eventData.rect.width}%`,\n height: `${eventData.rect.height}%`,\n };\n\n const handlePointerDown = useEventCallback(mergeCallbacks(rootProps.onPointerDown, (e) => e.stopPropagation()));\n\n return (\n <>\n <div\n {...rootProps}\n {...attributes}\n ref={handleRootRef}\n className={rootClassName}\n style={rootStyle}\n onPointerDown={handlePointerDown}\n data-continues-before={eventData.isStart ? undefined : \"\"}\n data-continues-after={eventData.isEnd ? undefined : \"\"}\n >\n {/* Edges only where the event starts and ends, not at midnight between its days. */}\n {canResize && eventData.isStart && (\n <div {...resizeTopListeners} ref={topBarRef} className={styles.root__resizeTop} />\n )}\n <div role=\"button\" tabIndex={0} className={styles.root__container}>\n {children}\n </div>\n {canResize && eventData.isEnd && (\n <div {...resizeBottomListeners} ref={bottomBarRef} className={styles.root__resizeBottom} />\n )}\n </div>\n </>\n );\n}\n\nfunction getEventTransformModifiers(timeStep: number): MoveTransformModifier<DayWeekEventTransformContext> {\n return (args) => {\n const modifiers: MoveTransformModifier<DayWeekEventTransformContext>[] = [getTimeStepEqualizerModifier(timeStep)];\n\n if (args.context === \"overlay\") {\n modifiers.push(boundingDraggableContainerModifier);\n }\n\n return applyMoveTransformModifiers(modifiers, args);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAwB4B,EAAaC,GAA0B;CAC7D,IAAM,EAAE,KAAKC,GAAcC,cAAWC,aAAU,GAAGC,MAAcJ,GAE3D,EAAEK,cAAU,GAAGC,OAAYnB,EAAmB,GAC9CoB,KAAYb,EAAqB,GACjC,EAAEc,aAAUC,6BAAyBC,gBAAaJ,IAClDK,IAAUnC,EAA8B,IAAI,GAC5CoC,IAAYpC,EAA8B,IAAI,GAC9CqC,IAAerC,EAA8B,IAAI,GACjD,EAAEsC,gBAAaC,iBAAcC,gBAAaC,WAAQC,gBAAa7B,GAAsB,GAErF8B,IAASX,IAAWQ,GACpB,EAAEI,cAAWC,oBAAiBjC,EAAwB,GACtDkC,IAAehC,EAAgBqB,GAASU,GAAcnB,EAAU,IAAI,GAEpEqB,IAAYhC,EAAkBc,GAAS,IAAIH,EAAU,GAAG,CAAC,EAAE,QAAQA,EAAU,MAAMoB,CAAY,GAE/F,EAAEE,eAAYC,eAAYC,gBAAaC,aAAUC,aAAUC,2BAAwBpD,GACtF,EAAEqD,uBAAoBC,cAAWC,cAAWC,iBAAcC,kBAAe;EACxE,IAAMT,IAAaS,EAASvB,EAAQ,OAAO,GACrC,CAACe,GAAaC,KAAYF,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A,IAAY;EARtD,UAAA;GAWGqB,KAAarB,EAAU,WACtB9B,kBAAC,OAAD;IAAK,GAAIkF;IAAoB,KAAK1C;IAAW,WAAWzC,EAAO;GAAkB,CAAA;GAEnFC,kBAAC,OAAD;IAAK,MAAK;IAAS,UAAU;IAAG,WAAWD,EAAO;IAC/CgC;GACE,CAAA;GACJoB,KAAarB,EAAU,SACtB9B,kBAAC,OAAD;IAAK,GAAIiF;IAAuB,KAAKxC;IAAc,WAAW1C,EAAO;GAAqB,CAAA;EAEzF;CACL,CAAA,EAAA,CAAA;AAEN;AAEA,SAAS6E,EAA2BxC,GAAuE;CACzG,QAAQyD,MAAS;EACf,IAAMC,IAAmE,CAAClF,EAA6BwB,CAAQ,CAAC;EAMhH,OAJIyD,EAAK,YAAY,aACnBC,EAAU,KAAKpF,CAAkC,GAG5CD,EAA4BqF,GAAWD,CAAI;CACpD;AACF"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ // src/components/day-week-event/DayWeekEvent.module.css
3
+ var e = "_root_1g6ad_1", t = "_root_isDragging_1g6ad_12", n = "_root__resizeTop_1g6ad_12", r = "_root__resizeBottom_1g6ad_14", i = "_root_isResizing_1g6ad_16", a = "_root_isDisabled_1g6ad_43", o = "_root__container_1g6ad_59", s = "_root__dragPreview_1g6ad_108", c = "_root_isPreview_1g6ad_114", l = "_root_isResizeSource_1g6ad_119", u = {
4
+ root: e,
5
+ root_isDragging: t,
6
+ root__resizeTop: n,
7
+ root__resizeBottom: r,
8
+ root_isResizing: i,
9
+ root_isDisabled: a,
10
+ root__container: o,
11
+ root__dragPreview: s,
12
+ root_isPreview: c,
13
+ root_isResizeSource: l
14
+ };
15
+ export { u as default, e as root, o as root__container, s as root__dragPreview, r as root__resizeBottom, n as root__resizeTop, a as root_isDisabled, t as root_isDragging, c as root_isPreview, l as root_isResizeSource, i as root_isResizing };
16
+
17
+ //# sourceMappingURL=DayWeekEvent.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayWeekEvent.module.css.js","names":["root","root_isDragging","root__resizeTop","root__resizeBottom","root_isResizing","root_isDisabled","root__container","root__dragPreview","root_isPreview","root_isResizeSource","DayWeekEvent_module_default"],"sources":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import e from "./DayWeekEvent.module.css.js";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ // src/components/day-week-event/DayWeekEventPreview.tsx
5
+ function n({ part: n, timelineMinutes: r, children: i }) {
6
+ let a = (e) => `${e / r * 100}%`;
7
+ return /* @__PURE__ */ t("div", {
8
+ "aria-hidden": "true",
9
+ className: `${e.root} ${e.root_isResizing} ${e.root_isPreview}`,
10
+ "data-continues-before": n.isStart ? void 0 : "",
11
+ "data-continues-after": n.isEnd ? void 0 : "",
12
+ style: {
13
+ top: a(n.start),
14
+ height: a(n.duration),
15
+ left: 0,
16
+ width: "100%"
17
+ },
18
+ children: /* @__PURE__ */ t("div", {
19
+ className: e.root__container,
20
+ children: i
21
+ })
22
+ });
23
+ }
24
+ export { n as default };
25
+
26
+ //# sourceMappingURL=DayWeekEventPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayWeekEventPreview.js","names":["_jsx","styles","DayWeekEvent_module_default","jsx","DayWeekEventPreview","part","timelineMinutes","children","percent","minutes"],"sources":["../../../src/components/day-week-event/DayWeekEventPreview.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\nimport type { EventSegment } from \"@weekwise/core\";\n\nimport styles from \"./DayWeekEvent.module.css\";\n\nexport type DayWeekEventPreviewProps = {\n /** The day's part of the event's new range. */\n part: EventSegment;\n /** Length of the timeline in minutes: the part is placed in percent of it. */\n timelineMinutes: number;\n children?: ReactNode;\n};\n\n/** An event while it is resized: one per day its new range covers, across the full width. */\nexport default function DayWeekEventPreview({ part, timelineMinutes, children }: DayWeekEventPreviewProps) {\n const percent = (minutes: number) => `${(minutes / timelineMinutes) * 100}%`;\n return (\n <div\n aria-hidden=\"true\"\n className={`${styles.root} ${styles.root_isResizing} ${styles.root_isPreview}`}\n data-continues-before={part.isStart ? undefined : \"\"}\n data-continues-after={part.isEnd ? undefined : \"\"}\n style={{ top: percent(part.start), height: percent(part.duration), left: 0, width: \"100%\" }}\n >\n <div className={styles.root__container}>{children}</div>\n </div>\n );\n}\n"],"mappings":";;;;AAeA,SAAwBI,EAAoB,EAAEC,SAAMC,oBAAiBC,eAAsC;CACzG,IAAMC,KAAWC,MAAoB,GAAIA,IAAUH,IAAmB,IAAI;CAC1E,OACEN,kBAAC,OAAD;EACE,eAAY;EACZ,WAAW,GAAGC,EAAO,KAAK,GAAGA,EAAO,gBAAgB,GAAGA,EAAO;EAC9D,yBAAuBI,EAAK,UAAU,KAAA,IAAY;EAClD,wBAAsBA,EAAK,QAAQ,KAAA,IAAY;EAC/C,OAAO;GAAE,KAAKG,EAAQH,EAAK,KAAK;GAAG,QAAQG,EAAQH,EAAK,QAAQ;GAAG,MAAM;GAAG,OAAO;EAAO;EAE1F,UAAAL,kBAAC,OAAD;GAAK,WAAWC,EAAO;GAAkBM;EAAc,CAAA;CACpD,CAAA;AAET"}
@@ -0,0 +1,226 @@
1
+ "use client";
2
+ import { useCallback as e, useMemo as t, useRef as n } from "react";
3
+ import { useCalendarDateUtils as r } from "../../date-localization/useDateUtils.js";
4
+ import i from "../../date-localization/useMessages.js";
5
+ import ee from "../../hooks/useMergedRefs.js";
6
+ import a from "../../hooks/useRefList.js";
7
+ import { useScrollBarSize as o } from "../../hooks/useScrollBarSize.js";
8
+ import s from "../../hooks/useToday.js";
9
+ import te from "../../hooks/useEventResize.js";
10
+ import { useCalendarContext as ne } from "../../contexts/CalendarContext.js";
11
+ import re from "../../contexts/CalendarViewportContext.js";
12
+ import ie from "../../contexts/DayWeekViewContext.js";
13
+ import { ROW_HEIGHTS as ae, arrangeEventsByDay as c, buildTimeRows as l, cx as u, getTimeFrame as oe, getVisibleDays as se, splitIntoDays as ce } from "@weekwise/core";
14
+ import le from "../day-week-drawer/DayWeekDrawer.js";
15
+ import ue from "../day-week-event/DayWeekEvent.js";
16
+ import de from "../day-week-event/DayWeekEventPreview.js";
17
+ import fe from "../drag-overlay/DragOverlay.js";
18
+ import pe from "../pointer-popover/PointerPopover.js";
19
+ import me from "./HiddenEvents.js";
20
+ import he from "./useTimeColumnWidth.js";
21
+ import d from "./DayWeekView.module.css.js";
22
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
23
+ // src/components/day-week-view/DayWeekView.tsx
24
+ var ge = {
25
+ regular: 64,
26
+ compact: 44,
27
+ narrow: 40
28
+ };
29
+ function h({ rowHeight: h, ..._e }) {
30
+ let { viewValue: g, hourMin: _, hourMax: v, view: y, eventMap: b, preventOutBoundsChanges: x, eventRenderer: S, timeStep: C, scrollable: w, size: T, hideMinMaxTime: E, disabled: ve, getIsDayDisabled: ye, onEventChange: be, pointerPreviewRenderer: xe } = ne(), D = r(), O = i(), { getMonthDay: k, getWeekDay: A, isToday: j, weekDayShortName: M } = D, Se = s(), N = h ?? ae[T], P = n(null), F = n(null), I = n(null), L = a(), R = t(() => l(D, C, {
31
+ hourMin: _,
32
+ hourMax: v,
33
+ hideMinMaxTime: E
34
+ }, x), [
35
+ D,
36
+ C,
37
+ _,
38
+ v,
39
+ E,
40
+ x
41
+ ]), Ce = t(() => R.map(({ time: e }) => e), [R]), z = a(), B = he(P, z.elements, Ce, ge[T]), V = t(() => se(D, y, g), [
42
+ D,
43
+ y,
44
+ g
45
+ ]), H = t(() => ({
46
+ hourMin: _,
47
+ hourMax: v,
48
+ hideMinMaxTime: E
49
+ }), [
50
+ _,
51
+ v,
52
+ E
53
+ ]), U = t(() => c(b, D, R.length * 60, V, H), [
54
+ b,
55
+ D,
56
+ R.length,
57
+ V,
58
+ H
59
+ ]), we = t(() => U.map(({ events: e }) => e), [U]), { state: W, actions: G, previewOf: Te } = te({
60
+ days: V,
61
+ viewportRef: F,
62
+ columnsRef: L.elements,
63
+ dateUtils: D,
64
+ bounds: H,
65
+ timeStep: C,
66
+ preventOutBoundsChanges: x,
67
+ disabled: ve,
68
+ getIsDayDisabled: ye,
69
+ eventMap: b,
70
+ onEventChange: be
71
+ }), Ee = t(() => W ? ce(W.range[0], W.range[1], V.length, H) : [], [
72
+ W,
73
+ V.length,
74
+ H
75
+ ]), K = W ? b.get(W.key)?.value : void 0, q = e((e) => oe(D, e, {
76
+ hourMin: _,
77
+ hourMax: v,
78
+ hideMinMaxTime: E
79
+ }), [
80
+ D,
81
+ E,
82
+ v,
83
+ _
84
+ ]), J = t(() => V.map((e, t) => {
85
+ let n = A(e), r = j(e), i = U[t]?.events ?? [];
86
+ return {
87
+ attributes: r ? { "data-is-today": !0 } : void 0,
88
+ events: i,
89
+ day: k(e),
90
+ isToday: r,
91
+ targetDate: e,
92
+ weekDayName: M(n),
93
+ weekDayNumber: n
94
+ };
95
+ }), [
96
+ Se,
97
+ D,
98
+ V,
99
+ U,
100
+ k,
101
+ A,
102
+ j,
103
+ M
104
+ ]), Y = o(), X = _e, De = d.root__head, Oe = d.root__body, ke = d.root__viewport, Z = d.root__column, Q = d.root__headerCell, Ae = d.root__headerCellDay, je = d.root__row, Me = d.root__rowHeadTime, Ne = d.root__timeStep, Pe = ee(F), $ = t(() => ({
105
+ viewportRef: F,
106
+ getTimeFrame: q,
107
+ pxPerMinute: N / 60,
108
+ resize: G,
109
+ resizing: W
110
+ }), [
111
+ F,
112
+ q,
113
+ N,
114
+ G,
115
+ W
116
+ ]), Fe = t(() => ({ viewportRef: F }), [F]), Ie = (e, t) => /* @__PURE__ */ p(ue, {
117
+ "data-idx": t,
118
+ eventData: e,
119
+ children: S.current?.(e.value, y, {
120
+ isStart: e.isStart,
121
+ isEnd: e.isEnd
122
+ })
123
+ }, e.key);
124
+ return /* @__PURE__ */ p(ie.Provider, {
125
+ value: $,
126
+ children: /* @__PURE__ */ p(re.Provider, {
127
+ value: Fe,
128
+ children: /* @__PURE__ */ m(f, { children: [
129
+ /* @__PURE__ */ m("div", {
130
+ ...X,
131
+ ref: P,
132
+ className: u(X.className, d.root, { [d.root_scrollable]: w }),
133
+ style: {
134
+ ...X.style,
135
+ "--calendar-column-count": J.length,
136
+ "--scrollbar-width": Y.width,
137
+ "--scrollbar-height": Y.height,
138
+ ...B !== void 0 && { "--ww-time-column": `${B}px` }
139
+ },
140
+ children: [/* @__PURE__ */ m("div", {
141
+ className: De,
142
+ children: [/* @__PURE__ */ p("div", { className: Q }), J.map((e) => /* @__PURE__ */ m("div", {
143
+ className: Q,
144
+ ...e.attributes,
145
+ children: [/* @__PURE__ */ p("span", {
146
+ className: Ae,
147
+ children: e.day
148
+ }), /* @__PURE__ */ m("span", {
149
+ className: d.root__headerCellLabel,
150
+ children: [/* @__PURE__ */ p("span", {
151
+ className: d.root__headerCellName,
152
+ children: e.weekDayName
153
+ }), e.isToday && /* @__PURE__ */ p("span", {
154
+ className: d.root__headerCellToday,
155
+ children: O.today
156
+ })]
157
+ })]
158
+ }, e.weekDayNumber))]
159
+ }), /* @__PURE__ */ m("div", {
160
+ className: d.root__main,
161
+ children: [/* @__PURE__ */ p("div", {
162
+ ref: I,
163
+ className: Oe,
164
+ children: /* @__PURE__ */ m("div", {
165
+ ref: Pe,
166
+ className: ke,
167
+ style: { height: R.length * N },
168
+ children: [/* @__PURE__ */ p("div", {
169
+ className: Z,
170
+ children: R.map(({ time: e, value: t, steps: n }, r) => /* @__PURE__ */ m("div", {
171
+ className: je,
172
+ style: {
173
+ height: N,
174
+ "--translateY": r * N,
175
+ "--calendar-rows-count": n.length
176
+ },
177
+ children: [/* @__PURE__ */ p("time", {
178
+ ref: z.refAt(r),
179
+ className: Me,
180
+ children: e
181
+ }), n.map(([e, , t]) => /* @__PURE__ */ p("div", { className: u(Ne, { [d.root__timeStep_overTime]: t }) }, e))]
182
+ }, t))
183
+ }), J.map((e, t) => /* @__PURE__ */ p("div", {
184
+ ref: L.refAt(t),
185
+ className: Z,
186
+ "data-day-index": t,
187
+ ...e.attributes,
188
+ children: /* @__PURE__ */ m(le, {
189
+ id: `${e.weekDayNumber}`,
190
+ targetDate: e.targetDate,
191
+ children: [e.events.map((e, t) => Ie(e, t)), Ee.filter((e) => e.dayIndex === t).map((e) => /* @__PURE__ */ p(de, {
192
+ part: e,
193
+ timelineMinutes: R.length * 60,
194
+ children: K === void 0 ? null : S.current?.(K, y, {
195
+ isStart: e.isStart,
196
+ isEnd: e.isEnd
197
+ })
198
+ }, "resize"))]
199
+ })
200
+ }, e.weekDayNumber))]
201
+ })
202
+ }), w && /* @__PURE__ */ p(me, {
203
+ scrollerRef: I,
204
+ columns: we,
205
+ rowHeight: N
206
+ })]
207
+ })]
208
+ }),
209
+ /* @__PURE__ */ p(fe, { pxPerMinute: N / 60 }),
210
+ W && !W.blocked && /* @__PURE__ */ p(pe, {
211
+ coordinates: {
212
+ x: W.x,
213
+ y: W.y
214
+ },
215
+ children: (() => {
216
+ let { date: e, top: t, duration: n } = Te(W.range);
217
+ return xe.current?.(e, t, n);
218
+ })()
219
+ })
220
+ ] })
221
+ })
222
+ });
223
+ }
224
+ export { h as default };
225
+
226
+ //# sourceMappingURL=DayWeekView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayWeekView.js","names":["getTimeFrame","getDayTimeFrame","styles","_jsx","_jsxs","_Fragment","useCallback","useMemo","useRef","useCalendarDateUtils","useMessages","useMergedRefs","useRefList","useScrollBarSize","useToday","useEventResize","useCalendarContext","CalendarViewportContext","DayWeekViewContext","ROW_HEIGHTS","arrangeEventsByDay","buildTimeRows","cx","getTimeFrame","getVisibleDays","splitIntoDays","DayWeekDrawer","DayWeekEvent","DayWeekEventPreview","DragOverlay","PointerPopover","HiddenEvents","useTimeColumnWidth","DayWeekView_module_default","Fragment","jsx","jsxs","TIME_COLUMN_WIDTH","DayWeekView","rowHeightProp","props","viewValue","hourMin","hourMax","view","eventMap","preventOutBoundsChanges","eventRenderer","timeStep","scrollable","size","hideMinMaxTime","disabled","getIsDayDisabled","onEventChange","pointerPreviewRenderer","dateUtils","messages","getMonthDay","getWeekDay","isToday","weekDayShortName","today","rowHeight","rootRef","viewportRef","bodyRef","columns","timeRows","timeLabels","time","timeLabelElements","timeColumnWidth","days","bounds","eventGroups","eventColumns","events","resizing","resize","previewOf","resizeParts","resizingValue","getTimeFrame$1","targetDate","weekDays","date","idx","weekDayNumber","eventsByDay","scrollbarSize","rootProps","headClassName","bodyClassName","viewportClassName","columnClassName","headerCellClassName","headerCellDayClassName","rowClassName","timeClassName","timeStepClassName","handleViewportRef","contextValue","viewportContextValue","renderEvent","eventData","weekDay","value","steps","step","overTime","dayIndex","part","top","duration"],"sources":["../../../src/components/day-week-view/DayWeekView.tsx"],"sourcesContent":["import type { CalendarDate } from \"@weekwise/core\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport type { HTMLAttributes } from \"react\";\n\nimport { useCalendarDateUtils, useMessages } from \"../../date-localization\";\nimport { useMergedRefs, useRefList, useScrollBarSize, useToday } from \"../../hooks\";\nimport useEventResize from \"../../hooks/useEventResize\";\n\nimport type { EventData } from \"../../Calendar.types\";\nimport { useCalendarContext } from \"../../contexts/CalendarContext\";\nimport CalendarViewportContext from \"../../contexts/CalendarViewportContext\";\nimport DayWeekViewContext from \"../../contexts/DayWeekViewContext\";\nimport {\n arrangeEventsByDay,\n buildTimeRows,\n cx,\n getTimeFrame as getDayTimeFrame,\n getVisibleDays,\n ROW_HEIGHTS,\n splitIntoDays,\n type MeasuredEventData as CoreMeasuredEventData,\n type TimeRowData,\n} from \"@weekwise/core\";\n\nimport DayWeekDrawer from \"../day-week-drawer\";\nimport DayWeekEvent from \"../day-week-event\";\nimport DragOverlay from \"../drag-overlay\";\nimport PointerPopover from \"../pointer-popover\";\nimport { DayWeekEventPreview } from \"../day-week-event\";\nimport type { CSSVarStyle } from \"../../utils/css\";\n\nimport HiddenEvents from \"./HiddenEvents\";\nimport useTimeColumnWidth from \"./useTimeColumnWidth\";\n\nimport styles from \"./DayWeekView.module.css\";\n\nexport type DayWeekViewProps = HTMLAttributes<HTMLDivElement> & {\n /** Height of an hour, in pixels. Defaults to the one of the calendar's size. */\n rowHeight?: number;\n};\n\nexport interface DayWeekHeaderCellData {\n day: number;\n events: MeasuredEventData[];\n weekDayName: string;\n weekDayNumber: number;\n isToday: boolean;\n attributes?: Record<string, string | number | boolean>;\n targetDate: CalendarDate;\n}\n\n/** A laid-out event in a day column; its dates are the adapter's, only the adapter reads them. */\nexport type MeasuredEventData = CoreMeasuredEventData<unknown, CalendarDate>;\n\n/**\n * What a day/week event carries while dragged. Dragged items travel as JSON, so the date\n * is a timestamp: not every date type survives JSON.\n */\nexport type DayWeekDragItem = Omit<MeasuredEventData, \"rect\" | \"date\"> & { date: number };\n\nexport type { TimeRowData };\n\nexport interface EventGroup {\n date: CalendarDate;\n events: EventData[];\n}\n\nexport interface EventArrangedGroup {\n date: CalendarDate;\n events: MeasuredEventData[];\n}\n\nexport interface DayWeekViewDropTargetData {\n date: CalendarDate;\n}\n\n/** Width of the time column when `--ww-time-column` is not set, per calendar size. */\nconst TIME_COLUMN_WIDTH = { regular: 64, compact: 44, narrow: 40 } as const;\n\nexport default function DayWeekView({ rowHeight: rowHeightProp, ...props }: DayWeekViewProps) {\n const {\n viewValue,\n hourMin,\n hourMax,\n view,\n eventMap,\n preventOutBoundsChanges,\n eventRenderer,\n timeStep,\n scrollable,\n size,\n hideMinMaxTime,\n disabled,\n getIsDayDisabled,\n onEventChange,\n pointerPreviewRenderer,\n } = useCalendarContext();\n\n const dateUtils = useCalendarDateUtils();\n const messages = useMessages();\n const { getMonthDay, getWeekDay, isToday, weekDayShortName } = dateUtils;\n const today = useToday();\n\n const rowHeight = rowHeightProp ?? ROW_HEIGHTS[size];\n const rootRef = useRef<HTMLDivElement>(null);\n const viewportRef = useRef<HTMLDivElement>(null);\n const bodyRef = useRef<HTMLDivElement>(null);\n // the day columns by day index: resizing an event picks its day among them\n const columns = useRefList<HTMLDivElement>();\n\n const timeRows = useMemo(\n () => buildTimeRows(dateUtils, timeStep, { hourMin, hourMax, hideMinMaxTime }, preventOutBoundsChanges),\n [dateUtils, timeStep, hourMin, hourMax, hideMinMaxTime, preventOutBoundsChanges]\n );\n\n const timeLabels = useMemo(() => timeRows.map(({ time }) => time), [timeRows]);\n // the time labels by row: the time column is as wide as the longest of them needs\n const timeLabelElements = useRefList<HTMLTimeElement>();\n const timeColumnWidth = useTimeColumnWidth(rootRef, timeLabelElements.elements, timeLabels, TIME_COLUMN_WIDTH[size]);\n\n const days = useMemo(() => getVisibleDays(dateUtils, view, viewValue), [dateUtils, view, viewValue]);\n const bounds = useMemo(() => ({ hourMin, hourMax, hideMinMaxTime }), [hourMin, hourMax, hideMinMaxTime]);\n\n // Laid out in minutes (rects are percentages of the timeline).\n const eventGroups = useMemo<EventArrangedGroup[]>(\n () => arrangeEventsByDay(eventMap, dateUtils, timeRows.length * 60, days, bounds),\n [eventMap, dateUtils, timeRows.length, days, bounds]\n );\n\n const eventColumns = useMemo(() => eventGroups.map(({ events }) => events), [eventGroups]);\n\n const {\n state: resizing,\n actions: resize,\n previewOf,\n } = useEventResize({\n days,\n viewportRef,\n columnsRef: columns.elements,\n dateUtils,\n bounds,\n timeStep,\n preventOutBoundsChanges,\n disabled,\n getIsDayDisabled,\n eventMap: eventMap,\n onEventChange,\n });\n\n // The resized event, one part per day its new range covers.\n const resizeParts = useMemo(\n () => (resizing ? splitIntoDays(resizing.range[0], resizing.range[1], days.length, bounds) : []),\n [resizing, days.length, bounds]\n );\n const resizingValue = resizing ? eventMap.get(resizing.key)?.value : undefined;\n\n const getTimeFrame = useCallback<(date: CalendarDate) => [number, number]>(\n (targetDate: CalendarDate) => getDayTimeFrame(dateUtils, targetDate, { hourMin, hourMax, hideMinMaxTime }),\n [dateUtils, hideMinMaxTime, hourMax, hourMin]\n );\n\n const weekDays = useMemo(\n () =>\n days.map<DayWeekHeaderCellData>((date, idx) => {\n const weekDayNumber = getWeekDay(date);\n const today = isToday(date);\n const eventsByDay = eventGroups[idx]?.events ?? [];\n return {\n attributes: today ? { [\"data-is-today\"]: true } : undefined,\n events: eventsByDay,\n day: getMonthDay(date),\n isToday: today,\n targetDate: date,\n weekDayName: weekDayShortName(weekDayNumber),\n weekDayNumber,\n };\n }),\n [today, dateUtils, days, eventGroups, getMonthDay, getWeekDay, isToday, weekDayShortName]\n );\n\n const scrollbarSize = useScrollBarSize();\n\n const rootProps = props;\n\n const headClassName = styles.root__head;\n const bodyClassName = styles.root__body;\n const viewportClassName = styles.root__viewport;\n const columnClassName = styles.root__column;\n const headerCellClassName = styles.root__headerCell;\n const headerCellDayClassName = styles.root__headerCellDay;\n const rowClassName = styles.root__row;\n const timeClassName = styles.root__rowHeadTime;\n const timeStepClassName = styles.root__timeStep;\n\n const handleViewportRef = useMergedRefs(viewportRef);\n\n const contextValue = useMemo(\n () => ({ viewportRef, getTimeFrame, pxPerMinute: rowHeight / 60, resize, resizing }),\n [viewportRef, getTimeFrame, rowHeight, resize, resizing]\n );\n\n const viewportContextValue = useMemo(() => ({ viewportRef }), [viewportRef]);\n\n const renderEvent = (eventData: MeasuredEventData, idx: number) => {\n return (\n <DayWeekEvent key={eventData.key} data-idx={idx} eventData={eventData}>\n {eventRenderer.current?.(eventData.value, view, { isStart: eventData.isStart, isEnd: eventData.isEnd })}\n </DayWeekEvent>\n );\n };\n\n return (\n <DayWeekViewContext.Provider value={contextValue}>\n <CalendarViewportContext.Provider value={viewportContextValue}>\n <>\n <div\n {...rootProps}\n ref={rootRef}\n className={cx(rootProps.className, styles.root, {\n [styles.root_scrollable]: scrollable,\n })}\n style={\n {\n ...rootProps.style,\n [\"--calendar-column-count\"]: weekDays.length,\n [\"--scrollbar-width\"]: scrollbarSize.width,\n [\"--scrollbar-height\"]: scrollbarSize.height,\n ...(timeColumnWidth !== undefined && { [\"--ww-time-column\"]: `${timeColumnWidth}px` }),\n } as CSSVarStyle\n }\n >\n <div className={headClassName}>\n <div className={headerCellClassName} />\n {weekDays.map((weekDay) => (\n <div key={weekDay.weekDayNumber} className={headerCellClassName} {...weekDay.attributes}>\n <span className={headerCellDayClassName}>{weekDay.day}</span>\n <span className={styles.root__headerCellLabel}>\n <span className={styles.root__headerCellName}>{weekDay.weekDayName}</span>\n {weekDay.isToday && <span className={styles.root__headerCellToday}>{messages.today}</span>}\n </span>\n </div>\n ))}\n </div>\n <div className={styles.root__main}>\n <div ref={bodyRef} className={bodyClassName}>\n <div\n ref={handleViewportRef}\n className={viewportClassName}\n style={{ height: timeRows.length * rowHeight }}\n >\n <div className={columnClassName}>\n {timeRows.map(({ time, value, steps }, idx) => (\n <div\n key={value}\n className={rowClassName}\n style={\n {\n height: rowHeight,\n [\"--translateY\"]: idx * rowHeight,\n [\"--calendar-rows-count\"]: steps.length,\n } as CSSVarStyle\n }\n >\n <time ref={timeLabelElements.refAt(idx)} className={timeClassName}>\n {time}\n </time>\n {steps.map(([step, , overTime]) => (\n <div\n key={step}\n className={cx(timeStepClassName, {\n [styles.root__timeStep_overTime]: overTime,\n })}\n />\n ))}\n </div>\n ))}\n </div>\n {weekDays.map((weekDay, dayIndex) => (\n <div\n key={weekDay.weekDayNumber}\n ref={columns.refAt(dayIndex)}\n className={columnClassName}\n data-day-index={dayIndex}\n {...weekDay.attributes}\n >\n <DayWeekDrawer id={`${weekDay.weekDayNumber}`} targetDate={weekDay.targetDate}>\n {weekDay.events.map((eventData, idx) => renderEvent(eventData, idx))}\n {resizeParts\n .filter((part) => part.dayIndex === dayIndex)\n .map((part) => (\n <DayWeekEventPreview key=\"resize\" part={part} timelineMinutes={timeRows.length * 60}>\n {resizingValue !== undefined\n ? eventRenderer.current?.(resizingValue, view, {\n isStart: part.isStart,\n isEnd: part.isEnd,\n })\n : null}\n </DayWeekEventPreview>\n ))}\n </DayWeekDrawer>\n </div>\n ))}\n </div>\n </div>\n {scrollable && <HiddenEvents scrollerRef={bodyRef} columns={eventColumns} rowHeight={rowHeight} />}\n </div>\n </div>\n\n <DragOverlay pxPerMinute={rowHeight / 60} />\n {resizing && !resizing.blocked && (\n <PointerPopover coordinates={{ x: resizing.x, y: resizing.y }}>\n {(() => {\n const { date, top, duration } = previewOf(resizing.range);\n return pointerPreviewRenderer.current?.(date, top, duration);\n })()}\n </PointerPopover>\n )}\n </>\n </CalendarViewportContext.Provider>\n </DayWeekViewContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA6EA,IAAMqC,KAAoB;CAAE,SAAS;CAAI,SAAS;CAAI,QAAQ;AAAG;AAEjE,SAAwBC,EAAY,EAAE,WAAWC,GAAe,GAAGC,MAA2B;CAC5F,IAAM,EACJC,cACAC,YACAC,YACAC,SACAC,aACAC,4BACAC,kBACAC,aACAC,eACAC,SACAC,mBACAC,cACAC,sBACAC,mBACAC,+BACEvC,GAAmB,GAEjBwC,IAAY/C,EAAqB,GACjCgD,IAAW/C,EAAY,GACvB,EAAEgD,gBAAaC,eAAYC,YAASC,wBAAqBL,GACzDM,KAAQhD,EAAS,GAEjBiD,IAAYxB,KAAiBpB,GAAY+B,IACzCc,IAAUxD,EAAuB,IAAI,GACrCyD,IAAczD,EAAuB,IAAI,GACzC0D,IAAU1D,EAAuB,IAAI,GAErC2D,IAAUvD,EAA2B,GAErCwD,IAAW7D,QACTc,EAAcmC,GAAWR,GAAU;EAAEN;EAASC;EAASQ;CAAe,GAAGL,CAAuB,GACtG;EAACU;EAAWR;EAAUN;EAASC;EAASQ;EAAgBL;CAAuB,CACjF,GAEMuB,KAAa9D,QAAc6D,EAAS,KAAK,EAAEE,cAAWA,CAAI,GAAG,CAACF,CAAQ,CAAC,GAEvEG,IAAoB3D,EAA4B,GAChD4D,IAAkBxC,GAAmBgC,GAASO,EAAkB,UAAUF,IAAYhC,GAAkBa,EAAK,GAE7GuB,IAAOlE,QAAciB,GAAegC,GAAWZ,GAAMH,CAAS,GAAG;EAACe;EAAWZ;EAAMH;CAAS,CAAC,GAC7FiC,IAASnE,SAAe;EAAEmC;EAASC;EAASQ;CAAe,IAAI;EAACT;EAASC;EAASQ;CAAc,CAAC,GAGjG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WhB;SACX,kBAAgBgB;SAChB,GAAIL,EAAQ;SAEZ,UAAAtG,kBAACsB,IAAD;UAAe,IAAI,GAAGgF,EAAQ;UAAiB,YAAYA,EAAQ;UAAnE,UAAA,CACGA,EAAQ,OAAO,KAAKD,GAAWlB,MAAQiB,GAAYC,GAAWlB,CAAG,CAAC,GAClEN,GACE,QAAQ+B,MAASA,EAAK,aAAaD,CAAQ,CAAC,CAC5C,KAAKC,MACJ7G,kBAACyB,IAAD;WAAwCoF;WAAM,iBAAiB5C,EAAS,SAAS;WAC9E,UAAAc,MAAkB,KAAA,IAKf,OAJAnC,EAAc,UAAUmC,GAAetC,GAAM;YAC3C,SAASoE,EAAK;YACd,OAAOA,EAAK;WACd,CAAC;UAEc,GAPI,QAOJ,CACtB,CACU;;QACZ,GArBEN,EAAQ,aAqBV,CACN,CACE;;MACF,CAAA,GACJzD,KAAc9C,kBAAC4B,IAAD;OAAc,aAAamC;OAAS,SAASU;OAAyBb;MAAY,CAAA,CAC9F;KACF,CAAA,CAAA;;IAEL5D,kBAAC0B,IAAD,EAAa,aAAakC,IAAY,GAAK,CAAA;IAC1Ce,KAAY,CAACA,EAAS,WACrB3E,kBAAC2B,IAAD;KAAgB,aAAa;MAAE,GAAGgD,EAAS;MAAG,GAAGA,EAAS;KAAE;KAClD,iBAAA;MACN,IAAM,EAAEQ,SAAM2B,QAAKC,gBAAalC,GAAUF,EAAS,KAAK;MACxD,OAAOvB,GAAuB,UAAU+B,GAAM2B,GAAKC,CAAQ;KAC7D,EAAA,CAAG;IACW,CAAA;GAElB,EAAA,CAAA;EAC8B,CAAA;CACP,CAAA;AAEjC"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ // src/components/day-week-view/DayWeekView.module.css
3
+ var e = "_root_143fq_1", t = "_root_scrollable_143fq_11", n = "_root__body_143fq_11", r = "_root__head_143fq_15", i = "_root__main_143fq_33", a = "_root__viewport_143fq_47", o = "_root__column_143fq_58", s = "_root__headerCell_143fq_83", c = "_root__headerCellDay_143fq_110", l = "_root__headerCellLabel_143fq_117", u = "_root__headerCellName_143fq_124", d = "_root__headerCellToday_143fq_131", f = "_root__row_143fq_146", p = "_root__timeStep_143fq_168", m = "_root__timeStep_overTime_143fq_180", h = "_root__rowHeadTime_143fq_184", g = "_root__hiddenEventsLayer_143fq_200", _ = "_root__hiddenEventsColumn_143fq_216", v = "_root__hiddenEvents_143fq_200", y = "_root__hiddenEventsIcon_143fq_265", b = {
4
+ root: e,
5
+ root_scrollable: t,
6
+ root__body: n,
7
+ root__head: r,
8
+ root__main: i,
9
+ root__viewport: a,
10
+ root__column: o,
11
+ root__headerCell: s,
12
+ root__headerCellDay: c,
13
+ root__headerCellLabel: l,
14
+ root__headerCellName: u,
15
+ root__headerCellToday: d,
16
+ root__row: f,
17
+ root__timeStep: p,
18
+ root__timeStep_overTime: m,
19
+ root__rowHeadTime: h,
20
+ root__hiddenEventsLayer: g,
21
+ root__hiddenEventsColumn: _,
22
+ root__hiddenEvents: v,
23
+ root__hiddenEventsIcon: y
24
+ };
25
+ export { b as default, e as root, n as root__body, o as root__column, r as root__head, s as root__headerCell, c as root__headerCellDay, l as root__headerCellLabel, u as root__headerCellName, d as root__headerCellToday, v as root__hiddenEvents, _ as root__hiddenEventsColumn, y as root__hiddenEventsIcon, g as root__hiddenEventsLayer, i as root__main, f as root__row, h as root__rowHeadTime, p as root__timeStep, m as root__timeStep_overTime, a as root__viewport, t as root_scrollable };
26
+
27
+ //# sourceMappingURL=DayWeekView.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayWeekView.module.css.js","names":["root","root_scrollable","root__body","root__head","root__main","root__viewport","root__column","root__headerCell","root__headerCellDay","root__headerCellLabel","root__headerCellName","root__headerCellToday","root__row","root__timeStep","root__timeStep_overTime","root__rowHeadTime","root__hiddenEventsLayer","root__hiddenEventsColumn","root__hiddenEvents","root__hiddenEventsIcon","DayWeekView_module_default"],"sources":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { useEffect as e, useMemo as t, useState as n } from "react";
3
+ import { formatNowOffset as r, getHiddenEvents as i, getRevealScrollTop as a } from "@weekwise/core";
4
+ import { useCalendarContext as o } from "../../contexts/CalendarContext.js";
5
+ import { useCalendarDateUtils as s } from "../../date-localization/useDateUtils.js";
6
+ import c from "../../date-localization/useMessages.js";
7
+ import l from "../../hooks/useEventCallback.js";
8
+ import u from "../../hooks/useGlobalListeners.js";
9
+ import d from "../../hooks/useResizeObserver.js";
10
+ import f from "../../icons/chevron.js";
11
+ import p from "./DayWeekView.module.css.js";
12
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
13
+ // src/components/day-week-view/HiddenEvents.tsx
14
+ function g({ scrollerRef: g, columns: _, rowHeight: v }) {
15
+ let { hourMin: y, hideMinMaxTime: b, size: x } = o(), S = s(), C = c(), { addGlobalListener: w, removeGlobalListener: T } = u(), [E, D] = n(null), O = v / 60, k = l(() => {
16
+ let e = g.current;
17
+ if (!e) return;
18
+ let t = {
19
+ top: e.scrollTop,
20
+ height: e.clientHeight
21
+ };
22
+ D((e) => e?.top === t.top && e.height === t.height ? e : t);
23
+ }), A = d(k);
24
+ e(() => {
25
+ let e = g.current;
26
+ if (e) return k(), w(e, "scroll", k, { passive: !0 }), A?.observe(e), () => {
27
+ T(e, "scroll", k), A?.unobserve(e);
28
+ };
29
+ }, [
30
+ w,
31
+ k,
32
+ T,
33
+ A,
34
+ g
35
+ ]), e(k, [
36
+ k,
37
+ v,
38
+ _
39
+ ]);
40
+ let j = t(() => E && E.height > 0 ? _.map((e) => i(e, O, E.top, E.height)) : null, [
41
+ _,
42
+ O,
43
+ E
44
+ ]);
45
+ if (!j || !E) return null;
46
+ let M = (e) => g.current?.scrollTo({
47
+ top: a(e, O, E.top, E.height),
48
+ behavior: "smooth"
49
+ }), N = (e, t) => {
50
+ let [n] = e;
51
+ if (!n) return null;
52
+ let i = e.length === 1 && x !== "narrow" ? r(S, n.start, {
53
+ hourMin: y,
54
+ hideMinMaxTime: b
55
+ }) : e.length;
56
+ return /* @__PURE__ */ h("button", {
57
+ type: "button",
58
+ className: p.root__hiddenEvents,
59
+ "data-direction": t,
60
+ "aria-label": t === "above" ? C.earlier(e.length) : C.later(e.length),
61
+ onClick: () => M(n),
62
+ children: [/* @__PURE__ */ m(f, {
63
+ "aria-hidden": "true",
64
+ className: p.root__hiddenEventsIcon
65
+ }), i]
66
+ });
67
+ };
68
+ return /* @__PURE__ */ h("div", {
69
+ className: p.root__hiddenEventsLayer,
70
+ children: [/* @__PURE__ */ m("div", {}), j.map(({ above: e, below: t }, n) => /* @__PURE__ */ h("div", {
71
+ className: p.root__hiddenEventsColumn,
72
+ children: [N(e, "above"), N(t, "below")]
73
+ }, n))]
74
+ });
75
+ }
76
+ export { g as default };
77
+
78
+ //# sourceMappingURL=HiddenEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiddenEvents.js","names":["_jsxs","styles","_jsx","useEffect","useMemo","useState","formatNowOffset","getHiddenEvents","getRevealScrollTop","useCalendarContext","useCalendarDateUtils","useMessages","useEventCallback","useGlobalListeners","useResizeObserver","ChevronIcon","DayWeekView_module_default","jsx","jsxs","HiddenEvents","scrollerRef","columns","rowHeight","hourMin","hideMinMaxTime","size","dateUtils","messages","addGlobalListener","removeGlobalListener","scroll","setScroll","pxPerMinute","measure","scroller","next","prev","resizeObserver","hidden","events","reveal","event","renderButton","direction","nearest","label","above","below","idx"],"sources":["../../../src/components/day-week-view/HiddenEvents.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, type RefObject } from \"react\";\n\nimport { formatNowOffset, getHiddenEvents, getRevealScrollTop } from \"@weekwise/core\";\n\nimport { useCalendarContext } from \"../../contexts/CalendarContext\";\nimport { useCalendarDateUtils, useMessages } from \"../../date-localization\";\nimport { useEventCallback, useGlobalListeners, useResizeObserver } from \"../../hooks\";\nimport ChevronIcon from \"../../icons/chevron\";\n\nimport type { MeasuredEventData } from \"./DayWeekView\";\nimport styles from \"./DayWeekView.module.css\";\n\nexport type HiddenEventsProps = {\n /** The scrolled timeline. */\n scrollerRef: RefObject<HTMLDivElement | null>;\n /** Events of each day column. */\n columns: readonly MeasuredEventData[][];\n rowHeight: number;\n};\n\ntype ScrollState = { top: number; height: number };\n\n/**\n * Buttons at the top and bottom of each day column of a scrolled timeline, to the events\n * above or below what is in view.\n */\nexport default function HiddenEvents({ scrollerRef, columns, rowHeight }: HiddenEventsProps) {\n const { hourMin, hideMinMaxTime, size } = useCalendarContext();\n const dateUtils = useCalendarDateUtils();\n const messages = useMessages();\n const { addGlobalListener, removeGlobalListener } = useGlobalListeners();\n const [scroll, setScroll] = useState<ScrollState | null>(null);\n const pxPerMinute = rowHeight / 60;\n\n const measure = useEventCallback(() => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n const next = { top: scroller.scrollTop, height: scroller.clientHeight };\n setScroll((prev) => (prev?.top === next.top && prev.height === next.height ? prev : next));\n });\n\n const resizeObserver = useResizeObserver(measure);\n\n useEffect(() => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n measure();\n addGlobalListener(scroller, \"scroll\", measure, { passive: true });\n resizeObserver?.observe(scroller);\n return () => {\n removeGlobalListener(scroller, \"scroll\", measure);\n resizeObserver?.unobserve(scroller);\n };\n }, [addGlobalListener, measure, removeGlobalListener, resizeObserver, scrollerRef]);\n\n // the timeline's height changes with the rows: what is out of view changes too\n useEffect(measure, [measure, rowHeight, columns]);\n\n const hidden = useMemo(\n () =>\n // no layout to measure (jsdom, the server)\n scroll && scroll.height > 0\n ? columns.map((events) => getHiddenEvents(events, pxPerMinute, scroll.top, scroll.height))\n : null,\n [columns, pxPerMinute, scroll]\n );\n\n if (!hidden || !scroll) return null;\n\n const reveal = (event: MeasuredEventData) =>\n scrollerRef.current?.scrollTo({\n top: getRevealScrollTop(event, pxPerMinute, scroll.top, scroll.height),\n behavior: \"smooth\",\n });\n\n const renderButton = (events: MeasuredEventData[], direction: \"above\" | \"below\") => {\n const [nearest] = events;\n if (!nearest) return null;\n // a narrow column has room for a count only\n const label =\n events.length === 1 && size !== \"narrow\"\n ? formatNowOffset(dateUtils, nearest.start, { hourMin, hideMinMaxTime })\n : events.length;\n return (\n <button\n type=\"button\"\n className={styles.root__hiddenEvents}\n data-direction={direction}\n aria-label={direction === \"above\" ? messages.earlier(events.length) : messages.later(events.length)}\n onClick={() => reveal(nearest)}\n >\n <ChevronIcon aria-hidden=\"true\" className={styles.root__hiddenEventsIcon} />\n {label}\n </button>\n );\n };\n\n return (\n <div className={styles.root__hiddenEventsLayer}>\n <div />\n {hidden.map(({ above, below }, idx) => (\n <div key={idx} className={styles.root__hiddenEventsColumn}>\n {renderButton(above, \"above\")}\n {renderButton(below, \"below\")}\n </div>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA0BA,SAAwBmB,EAAa,EAAEC,gBAAaC,YAASC,gBAAgC;CAC3F,IAAM,EAAEC,YAASC,mBAAgBC,YAAShB,EAAmB,GACvDiB,IAAYhB,EAAqB,GACjCiB,IAAWhB,EAAY,GACvB,EAAEiB,sBAAmBC,4BAAyBhB,EAAmB,GACjE,CAACiB,GAAQC,KAAa1B,EAA6B,IAAI,GACvD2B,IAAcV,IAAY,IAE1BW,IAAUrB,QAAuB;EACrC,IAAMsB,IAAWd,EAAY;EAC7B,IAAI,CAACc,GAAU;EACf,IAAMC,IAAO;GAAE,KAAKD,EAAS;GAAW,QAAQA,EAAS;EAAa;EACtEH,GAAWK,MAAUA,GAAM,QAAQD,EAAK,OAAOC,EAAK,WAAWD,EAAK,SAASC,IAAOD,CAAK;CAC3F,CAAC,GAEKE,IAAiBvB,EAAkBmB,CAAO;CAEhD9B,QAAgB;EACd,IAAM+B,IAAWd,EAAY;EAC7B,IAAKc,GAIL,OAHAD,EAAQ,GACRL,EAAkBM,GAAU,UAAUD,GAAS,EAAE,SAAS,GAAK,CAAC,GAChEI,GAAgB,QAAQH,CAAQ,SACnB;GACXL,EAAqBK,GAAU,UAAUD,CAAO,GAChDI,GA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GAAO,OAAO,CACzB;EAHK,GAAAC,CAGL,CACN,CACE;;AAET"}
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { useState as e } from "react";
3
+ import t from "../../hooks/useIsomorphicLayoutEffect.js";
4
+ // src/components/day-week-view/useTimeColumnWidth.ts
5
+ function n(n, r, i, a) {
6
+ let [o, s] = e(), c = i.join("|");
7
+ return t(() => {
8
+ let e = !1, t = () => {
9
+ let t = n.current;
10
+ if (e || !t) return;
11
+ let i = 0, o = document.createRange();
12
+ if (typeof o.getBoundingClientRect != "function") return;
13
+ for (let e of r.current) {
14
+ if (!e) continue;
15
+ o.selectNodeContents(e);
16
+ let t = getComputedStyle(e), n = o.getBoundingClientRect().width;
17
+ i = Math.max(i, n + parseFloat(t.paddingLeft) + parseFloat(t.paddingRight));
18
+ }
19
+ let c = t.parentElement ?? document.body, l = parseFloat(getComputedStyle(c).getPropertyValue("--ww-time-column"));
20
+ s(i > (Number.isNaN(l) ? a : l) ? Math.ceil(i) : void 0);
21
+ };
22
+ return t(), document.fonts?.ready.then(t), () => {
23
+ e = !0;
24
+ };
25
+ }, [
26
+ a,
27
+ c,
28
+ r,
29
+ n
30
+ ]), o;
31
+ }
32
+ export { n as default };
33
+
34
+ //# sourceMappingURL=useTimeColumnWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTimeColumnWidth.js","names":["useState","useIsomorphicLayoutEffect","useTimeColumnWidth","rootRef","labelsRef","labels","defaultWidth","width","setWidth","labelsKey","cancelled","measure","root","needed","range","label","style","text","outside","themed"],"sources":["../../../src/components/day-week-view/useTimeColumnWidth.ts"],"sourcesContent":["import { useState, type RefObject } from \"react\";\n\nimport { useIsomorphicLayoutEffect } from \"../../hooks\";\n\n/**\n * Width the time column needs for its labels (\"10:00 PM\", \"下午10:00\"…) on one line, or\n * `undefined` while the theme's `--ww-time-column` holds them. Measured again when the\n * labels change and once the fonts have loaded.\n */\nexport default function useTimeColumnWidth(\n /** The view's root, which sets `--ww-time-column` for its own content. */\n rootRef: RefObject<HTMLElement | null>,\n /** The `<time>` label elements, e.g. from `useRefList`. */\n labelsRef: { readonly current: readonly (HTMLElement | null)[] },\n labels: readonly string[],\n /** Width of the time column when `--ww-time-column` is not set. */\n defaultWidth: number\n): number | undefined {\n const [width, setWidth] = useState<number>();\n // measured again only when the text of the labels changes\n const labelsKey = labels.join(\"|\");\n\n useIsomorphicLayoutEffect(() => {\n let cancelled = false;\n\n const measure = () => {\n const root = rootRef.current;\n if (cancelled || !root) return;\n\n let needed = 0;\n const range = document.createRange();\n // no layout to measure (jsdom)\n if (typeof range.getBoundingClientRect !== \"function\") return;\n for (const label of labelsRef.current) {\n if (!label) continue;\n range.selectNodeContents(label);\n const style = getComputedStyle(label);\n const text = range.getBoundingClientRect().width;\n needed = Math.max(needed, text + parseFloat(style.paddingLeft) + parseFloat(style.paddingRight));\n }\n\n // the theme's width, from outside the view: the view's root overrides the variable\n const outside = root.parentElement ?? document.body;\n const themed = parseFloat(getComputedStyle(outside).getPropertyValue(\"--ww-time-column\"));\n const base = Number.isNaN(themed) ? defaultWidth : themed;\n\n setWidth(needed > base ? Math.ceil(needed) : undefined);\n };\n\n measure();\n void document.fonts?.ready.then(measure);\n return () => {\n cancelled = true;\n };\n }, [defaultWidth, labelsKey, labelsRef, rootRef]);\n\n return width;\n}\n"],"mappings":";;;;AASA,SAAwBE,EAEtBC,GAEAC,GACAC,GAEAC,GACoB;CACpB,IAAM,CAACC,GAAOC,KAAYR,EAAiB,GAErCS,IAAYJ,EAAO,KAAK,GAAG;CAoCjC,OAlCAJ,QAAgC;EAC9B,IAAIS,IAAY,IAEVC,UAAgB;GACpB,IAAMC,IAAOT,EAAQ;GACrB,IAAIO,KAAa,CAACE,GAAM;GAExB,IAAIC,IAAS,GACPC,IAAQ,SAAS,YAAY;GAEnC,IAAI,OAAOA,EAAM,yBAA0B,YAAY;GACvD,KAAK,IAAMC,KAASX,EAAU,SAAS;IACrC,IAAI,CAACW,GAAO;IACZD,EAAM,mBAAmBC,CAAK;IAC9B,IAAMC,IAAQ,iBAAiBD,CAAK,GAC9BE,IAAOH,EAAM,sBAAsB,CAAC,CAAC;IAC3CD,IAAS,KAAK,IAAIA,GAAQI,IAAO,WAAWD,EAAM,WAAW,IAAI,WAAWA,EAAM,YAAY,CAAC;GACjG;GAGA,IAAME,IAAUN,EAAK,iBAAiB,SAAS,MACzCO,IAAS,WAAW,iBAAiBD,CAAO,CAAC,CAAC,iBAAiB,kBAAkB,CAAC;GAGxFV,EAASK,KAFI,OAAO,MAAMM,CAAM,IAAIb,IAAea,KAE1B,KAAK,KAAKN,CAAM,IAAI,KAAA,CAAS;EACxD;EAIA,OAFAF,EAAQ,GACH,SAAS,OAAO,MAAM,KAAKA,CAAO,SAC1B;GACXD,IAAY;EACd;CACF,GAAG;EAACJ;EAAcG;EAAWL;EAAWD;CAAO,CAAC,GAEzCI;AACT"}
@@ -0,0 +1,98 @@
1
+ "use client";
2
+ import { useMemo as e, useRef as t, useState as n } from "react";
3
+ import { useDragAndDrop as r } from "@weekwise/dnd/react";
4
+ import { cx as i } from "@weekwise/core";
5
+ import { useCalendarContext as a } from "../../contexts/CalendarContext.js";
6
+ import { useCalendarViewportContext as o } from "../../contexts/CalendarViewportContext.js";
7
+ import s from "../../hooks/useDocumentCursor.js";
8
+ import c from "../../hooks/useIsomorphicLayoutEffect.js";
9
+ import l from "../../portal/Portal.js";
10
+ import u from "../pointer-popover/PointerPopover.js";
11
+ import d from "./DragOverlay.module.css.js";
12
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
13
+ // src/components/drag-overlay/DragOverlay.tsx
14
+ var m = {
15
+ isStart: !0,
16
+ isEnd: !0
17
+ };
18
+ function h({ showPreview: h = !0, pxPerMinute: g = 1, ..._ }) {
19
+ let { eventMap: v, eventRenderer: y, pointerPreviewRenderer: b, view: x } = a(), { viewportRef: S } = o(), { isDragging: C, canDrop: w, dropData: T, eventItem: E, source: D, x: O, y: k, ...A } = r(({ draggable: e, overlay: t, droppable: n, canDrop: r }) => {
20
+ let i = [...n.dropTargets.values()].shift(), a = [...e.dragTargets.values()].shift();
21
+ return {
22
+ ...t.transform,
23
+ source: [...e.dragTargets.keys()].shift() ?? null,
24
+ canDrop: r(),
25
+ dropData: i,
26
+ eventItem: a ? a.filter((e) => e.event)[0] : null,
27
+ isDragging: e.isDragging,
28
+ x: e.x,
29
+ y: e.y
30
+ };
31
+ }), j = e(() => {
32
+ if (!E) return null;
33
+ let { key: e } = JSON.parse(E.event);
34
+ return v.get(e)?.value ?? null;
35
+ }, [E, v]), M = t(null), N = t(!1), [P, F] = n(!1), [I, L] = n(null);
36
+ if (c(() => {
37
+ if (C) {
38
+ N.current = w, T && D && (M.current = {
39
+ transform: A,
40
+ source: D,
41
+ eventValue: j
42
+ }, F(!0), L(null));
43
+ return;
44
+ }
45
+ F(!1);
46
+ let e = M.current;
47
+ M.current = null;
48
+ let t = S.current;
49
+ if (!e || N.current || !t || !e.source.isConnected) return;
50
+ let { transform: n } = e, r = e.source.getBoundingClientRect(), i = t.getBoundingClientRect();
51
+ L({
52
+ container: t,
53
+ eventValue: e.eventValue,
54
+ style: {
55
+ left: r.left - i.left,
56
+ top: r.top - i.top,
57
+ width: r.width,
58
+ height: r.height,
59
+ "--ww-return-left": `${n.left}px`,
60
+ "--ww-return-top": `${n.top}px`,
61
+ "--ww-return-width": `${n.width}px`,
62
+ "--ww-return-height": `${n.height}px`
63
+ }
64
+ });
65
+ }), s(C ? w ? "grabbing" : "not-allowed" : null), !C) return I ? /* @__PURE__ */ f(l, {
66
+ container: I.container,
67
+ children: /* @__PURE__ */ f("div", {
68
+ ..._,
69
+ className: i(_.className, d.root, d.root_isReturning),
70
+ style: I.style,
71
+ onAnimationEnd: () => L(null),
72
+ children: I.eventValue == null ? null : y.current?.(I.eventValue, x, m)
73
+ })
74
+ }) : null;
75
+ if (!P) return null;
76
+ let R = !w;
77
+ return /* @__PURE__ */ p(l, {
78
+ container: S.current,
79
+ children: [/* @__PURE__ */ f("div", {
80
+ ..._,
81
+ className: i(_.className, d.root, {
82
+ [d.root_isDragging]: C,
83
+ [d.root_isBlocked]: R
84
+ }),
85
+ style: { ...A },
86
+ children: j == null ? null : y.current?.(j, x, m)
87
+ }), h && !R && /* @__PURE__ */ f(u, {
88
+ coordinates: {
89
+ x: O,
90
+ y: k
91
+ },
92
+ children: T ? b.current?.(T.date, Math.round(A.top / g), Math.round(A.height / g)) : null
93
+ })]
94
+ });
95
+ }
96
+ export { h as default };
97
+
98
+ //# sourceMappingURL=DragOverlay.js.map