react-native-resource-calendar 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React18 = require('react');
3
+ var React19 = require('react');
4
4
  var reactNativeGestureHandler = require('react-native-gesture-handler');
5
5
  var Animated2 = require('react-native-reanimated');
6
6
  var reactNative = require('react-native');
@@ -37,7 +37,7 @@ function _interopNamespace(e) {
37
37
  return Object.freeze(n);
38
38
  }
39
39
 
40
- var React18__namespace = /*#__PURE__*/_interopNamespace(React18);
40
+ var React19__namespace = /*#__PURE__*/_interopNamespace(React19);
41
41
  var Animated2__default = /*#__PURE__*/_interopDefault(Animated2);
42
42
  var Haptics__namespace = /*#__PURE__*/_interopNamespace(Haptics);
43
43
  var Svg__default = /*#__PURE__*/_interopDefault(Svg);
@@ -296,8 +296,16 @@ function computeEventFrames(events, containerWidthPx, mode, options) {
296
296
  });
297
297
  }
298
298
  }
299
+ var findResourceIndexFor = (rid, resourceIds) => Math.max(0, Math.min(
300
+ resourceIds.length - 1,
301
+ resourceIds.findIndex((id) => id === rid)
302
+ ));
303
+ var findDayIndexFor = (date, days) => Math.max(0, Math.min(
304
+ days.length - 1,
305
+ days.findIndex((d) => date === dateFns.format(d, "yyyy-MM-dd"))
306
+ ));
299
307
  var Col = ({ children, divider, space, style }) => {
300
- return /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: [{ flexDirection: "column" }, style] }, React18__namespace.default.Children.toArray(children).map((child, index) => /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, { key: index }, child, index !== React18__namespace.default.Children.toArray(children).length - 1 && divider, index !== React18__namespace.default.Children.toArray(children).length - 1 && /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: { height: space, width: "100%" } }))));
308
+ return /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: [{ flexDirection: "column" }, style] }, React19__namespace.default.Children.toArray(children).map((child, index) => /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, { key: index }, child, index !== React19__namespace.default.Children.toArray(children).length - 1 && divider, index !== React19__namespace.default.Children.toArray(children).length - 1 && /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: { height: space, width: "100%" } }))));
301
309
  };
302
310
  var Col_default = Col;
303
311
 
@@ -326,8 +334,8 @@ var defaultTheme = {
326
334
  fontFamily: "System"
327
335
  }
328
336
  };
329
- var ThemeCtx = React18.createContext(defaultTheme);
330
- var useCalendarTheme = () => React18.useContext(ThemeCtx);
337
+ var ThemeCtx = React19.createContext(defaultTheme);
338
+ var useCalendarTheme = () => React19.useContext(ThemeCtx);
331
339
  var useResolvedFont = (overrides) => {
332
340
  const { typography } = useCalendarTheme();
333
341
  const family = overrides?.fontFamily ?? typography?.fontFamily ?? "System";
@@ -341,11 +349,11 @@ var CalendarThemeProvider = ({ theme, children }) => {
341
349
  ...theme,
342
350
  typography: { ...defaultTheme.typography, ...theme?.typography }
343
351
  };
344
- return /* @__PURE__ */ React18__namespace.default.createElement(ThemeCtx.Provider, { value: mergedTheme }, children);
352
+ return /* @__PURE__ */ React19__namespace.default.createElement(ThemeCtx.Provider, { value: mergedTheme }, children);
345
353
  };
346
354
 
347
355
  // src/components/TimeLabels.tsx
348
- var TimeLabels = React18__namespace.forwardRef(({
356
+ var TimeLabels = React19__namespace.forwardRef(({
349
357
  timezone,
350
358
  hourHeight = 120,
351
359
  startMinutes = 0,
@@ -354,8 +362,8 @@ var TimeLabels = React18__namespace.forwardRef(({
354
362
  layout
355
363
  }, ref) => {
356
364
  const isToday = dateFns.isSameDay(/* @__PURE__ */ new Date(), date);
357
- const [currentTimeYPosition, setCurrentTimeYPosition] = React18.useState(timeToYPosition(getCurrentTimeInMinutes(timezone), hourHeight));
358
- const [currentTime, setCurrentTime] = React18.useState(dateFns.format(dateFnsTz.toZonedTime(/* @__PURE__ */ new Date(), timezone), "h:mm"));
365
+ const [currentTimeYPosition, setCurrentTimeYPosition] = React19.useState(timeToYPosition(getCurrentTimeInMinutes(timezone), hourHeight));
366
+ const [currentTime, setCurrentTime] = React19.useState(dateFns.format(dateFnsTz.toZonedTime(/* @__PURE__ */ new Date(), timezone), "h:mm"));
359
367
  const APPOINTMENT_BLOCK_HEIGHT = hourHeight / 4;
360
368
  const updateCurrentTimeYPosition = () => {
361
369
  setCurrentTimeYPosition(timeToYPosition(getCurrentTimeInMinutes(timezone), hourHeight));
@@ -364,7 +372,7 @@ var TimeLabels = React18__namespace.forwardRef(({
364
372
  setCurrentTime(dateFns.format(dateFnsTz.toZonedTime(/* @__PURE__ */ new Date(), timezone), "h:mm"));
365
373
  };
366
374
  const titleFace = useResolvedFont({ fontWeight: "700" });
367
- React18.useEffect(() => {
375
+ React19.useEffect(() => {
368
376
  const update = () => {
369
377
  updateCurrentTime();
370
378
  updateCurrentTimeYPosition();
@@ -373,7 +381,7 @@ var TimeLabels = React18__namespace.forwardRef(({
373
381
  const intervalId = setInterval(update, 300);
374
382
  return () => clearInterval(intervalId);
375
383
  }, [timezone]);
376
- React18.useEffect(() => {
384
+ React19.useEffect(() => {
377
385
  reactNative.InteractionManager.runAfterInteractions(() => {
378
386
  let pos = isToday ? currentTimeYPosition - 240 : timeToYPosition(startMinutes, hourHeight);
379
387
  if (ref.current) {
@@ -385,7 +393,7 @@ var TimeLabels = React18__namespace.forwardRef(({
385
393
  }
386
394
  });
387
395
  }, [date, isToday, APPOINTMENT_BLOCK_HEIGHT, startMinutes, hourHeight]);
388
- return /* @__PURE__ */ React18__namespace.createElement(React18__namespace.Fragment, null, /* @__PURE__ */ React18__namespace.createElement(Col_default, null, Array.from({ length: 24 }).map((_, index) => /* @__PURE__ */ React18__namespace.createElement(reactNative.View, { key: index, style: [styles.timeLabel, { height: hourHeight }] }, /* @__PURE__ */ React18__namespace.createElement(
396
+ return /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, null, /* @__PURE__ */ React19__namespace.createElement(Col_default, null, Array.from({ length: 24 }).map((_, index) => /* @__PURE__ */ React19__namespace.createElement(reactNative.View, { key: index, style: [styles.timeLabel, { height: hourHeight }] }, /* @__PURE__ */ React19__namespace.createElement(
389
397
  reactNative.Text,
390
398
  {
391
399
  allowFontScaling: false,
@@ -397,7 +405,7 @@ var TimeLabels = React18__namespace.forwardRef(({
397
405
  }
398
406
  },
399
407
  indexToDate(index).split(" ")[0]
400
- ), /* @__PURE__ */ React18__namespace.createElement(
408
+ ), /* @__PURE__ */ React19__namespace.createElement(
401
409
  reactNative.Text,
402
410
  {
403
411
  allowFontScaling: false,
@@ -409,10 +417,10 @@ var TimeLabels = React18__namespace.forwardRef(({
409
417
  }
410
418
  },
411
419
  indexToDate(index).split(" ")[1]
412
- ))), isToday && /* @__PURE__ */ React18__namespace.createElement(reactNative.View, { style: [styles.currentTime, {
420
+ ))), isToday && /* @__PURE__ */ React19__namespace.createElement(reactNative.View, { style: [styles.currentTime, {
413
421
  top: currentTimeYPosition - 13,
414
422
  width: TIME_LABEL_WIDTH
415
- }] }, /* @__PURE__ */ React18__namespace.createElement(
423
+ }] }, /* @__PURE__ */ React19__namespace.createElement(
416
424
  reactNative.Text,
417
425
  {
418
426
  allowFontScaling: false,
@@ -425,7 +433,7 @@ var TimeLabels = React18__namespace.forwardRef(({
425
433
  }
426
434
  },
427
435
  currentTime
428
- ))), isToday && /* @__PURE__ */ React18__namespace.createElement(reactNative.View, { style: [styles.currentTimeLine, {
436
+ ))), isToday && /* @__PURE__ */ React19__namespace.createElement(reactNative.View, { style: [styles.currentTimeLine, {
429
437
  pointerEvents: "none",
430
438
  top: currentTimeYPosition,
431
439
  width: totalTimelineWidth,
@@ -461,11 +469,11 @@ var Hidden = ({ isHidden, children }) => {
461
469
  if (isHidden) {
462
470
  return null;
463
471
  }
464
- return /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, null, children);
472
+ return /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, children);
465
473
  };
466
474
  var Hidden_default = Hidden;
467
475
  var Center = ({ children, style }) => {
468
- return /* @__PURE__ */ React18__namespace.default.createElement(
476
+ return /* @__PURE__ */ React19__namespace.default.createElement(
469
477
  reactNative.View,
470
478
  {
471
479
  style: [{
@@ -486,7 +494,7 @@ var Badge = ({
486
494
  textColor = "white"
487
495
  }) => {
488
496
  const titleFace = useResolvedFont({ fontWeight: "600" });
489
- return /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: [styles2.badge, { backgroundColor: color }, style] }, children ? children : /* @__PURE__ */ React18__namespace.default.createElement(
497
+ return /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: [styles2.badge, { backgroundColor: color }, style] }, children ? children : /* @__PURE__ */ React19__namespace.default.createElement(
490
498
  reactNative.Text,
491
499
  {
492
500
  allowFontScaling: false,
@@ -510,13 +518,16 @@ var styles2 = reactNative.StyleSheet.create({
510
518
  });
511
519
  var Badge_default = Badge;
512
520
  var createCalendarStore = () => zustand.createStore((set2) => ({
521
+ date: /* @__PURE__ */ new Date(),
513
522
  resourcesById: {},
514
- eventsByResource: {},
515
- disabledBlocksByResource: {},
516
- disabledIntervalsByResource: {},
523
+ // NEW multi-day
524
+ eventsByDay: {},
525
+ disabledBlocksByDay: {},
526
+ disabledIntervalsByDay: {},
517
527
  selectedEvent: null,
518
528
  draggedEventDraft: null,
519
529
  setSelectedEvent: (evt) => set2({ selectedEvent: evt }),
530
+ setDate: (date) => set2({ date }),
520
531
  upsertResources: (rs) => set2((s) => {
521
532
  const next = { ...s.resourcesById };
522
533
  let changed = false;
@@ -529,39 +540,46 @@ var createCalendarStore = () => zustand.createStore((set2) => ({
529
540
  }
530
541
  return changed ? { resourcesById: next } : {};
531
542
  }),
532
- setDayData: ({ events, disabledBlocks, disableIntervals }) => set2((s) => ({
533
- eventsByResource: events ?? s.eventsByResource,
534
- disabledBlocksByResource: disabledBlocks ?? s.disabledBlocksByResource,
535
- disabledIntervalsByResource: disableIntervals ?? s.disabledIntervalsByResource
543
+ // NEW: multi-day write
544
+ setDayDataFor: (dayKey, { events, disabledBlocks, disableIntervals }) => set2((s) => ({
545
+ eventsByDay: events ? { ...s.eventsByDay, [dayKey]: events } : s.eventsByDay,
546
+ disabledBlocksByDay: disabledBlocks ? { ...s.disabledBlocksByDay, [dayKey]: disabledBlocks } : s.disabledBlocksByDay,
547
+ disabledIntervalsByDay: disableIntervals ? { ...s.disabledIntervalsByDay, [dayKey]: disableIntervals } : s.disabledIntervalsByDay
536
548
  })),
537
- setDraggedEventDraft: (draft) => set2({ draggedEventDraft: draft }),
538
- clearDay: () => set2({
539
- eventsByResource: {},
540
- disabledBlocksByResource: {},
541
- disabledIntervalsByResource: {}
542
- })
549
+ setDraggedEventDraft: (draft) => set2({ draggedEventDraft: draft })
543
550
  }));
544
- var StoreContext = React18.createContext(null);
551
+ var StoreContext = React19.createContext(null);
545
552
  var Provider = ({ children }) => {
546
- const ref = React18.useRef(void 0);
553
+ const ref = React19.useRef(void 0);
547
554
  if (!ref.current) ref.current = createCalendarStore();
548
- return /* @__PURE__ */ React18__namespace.default.createElement(StoreContext.Provider, { value: ref.current }, children);
555
+ return /* @__PURE__ */ React19__namespace.default.createElement(StoreContext.Provider, { value: ref.current }, children);
549
556
  };
550
557
  var useBound = (selector, eq) => {
551
- const store = React18.useContext(StoreContext);
558
+ const store = React19.useContext(StoreContext);
552
559
  if (!store) throw new Error("Calendar store used outside of Provider");
553
560
  return traditional.useStoreWithEqualityFn(store, selector, eq);
554
561
  };
555
562
  var useResourceById = (id) => useBound((s) => s.resourcesById[id]);
556
563
  var useGetSelectedEvent = () => useBound((s) => s.selectedEvent);
557
564
  var useSetSelectedEvent = () => useBound((s) => s.setSelectedEvent);
558
- var useEventsFor = (resourceId) => useBound((s) => s.eventsByResource[resourceId] ?? [], shallow.shallow);
565
+ var useEventsFor = (resourceId, dayDate) => useBound((s) => {
566
+ const key = dateFns.format(dayDate, "yyyy-MM-dd");
567
+ return s.eventsByDay?.[key]?.[resourceId] ?? [];
568
+ }, shallow.shallow);
559
569
  var useGetDraggedEventDraft = () => useBound((s) => s.draggedEventDraft);
560
- var useDisabledBlocksFor = (resourceId) => useBound((s) => s.disabledBlocksByResource[resourceId] ?? [], shallow.shallow);
561
- var useDisabledIntervalsFor = (resourceId) => useBound((s) => s.disabledIntervalsByResource[resourceId] ?? [], shallow.shallow);
570
+ var useDisabledBlocksFor = (resourceId, dayDate) => useBound((s) => {
571
+ const key = dateFns.format(dayDate, "yyyy-MM-dd");
572
+ return s.disabledBlocksByDay?.[key]?.[resourceId] ?? [];
573
+ }, shallow.shallow);
574
+ var useDisabledIntervalsFor = (resourceId, dayDate) => useBound((s) => {
575
+ const key = dateFns.format(dayDate, "yyyy-MM-dd");
576
+ return s.disabledIntervalsByDay?.[key]?.[resourceId] ?? [];
577
+ }, shallow.shallow);
562
578
  var useUpsertResources = () => useBound((s) => s.upsertResources);
563
- var useSetDayData = () => useBound((s) => s.setDayData);
579
+ var useSetDayDataFor = () => useBound((s) => s.setDayDataFor);
564
580
  var useSetDraggedEventDraft = () => useBound((s) => s.setDraggedEventDraft);
581
+ var useSetDate = () => useBound((s) => s.setDate);
582
+ var useGetDate = () => useBound((s) => s.date);
565
583
  var zustandBinding = {
566
584
  Provider,
567
585
  useResourceById,
@@ -569,7 +587,9 @@ var zustandBinding = {
569
587
  useDisabledBlocksFor,
570
588
  useDisabledIntervalsFor,
571
589
  useUpsertResources,
572
- useSetDayData,
590
+ useSetDate,
591
+ useGetDate,
592
+ useSetDayDataFor,
573
593
  useGetSelectedEvent,
574
594
  useSetSelectedEvent,
575
595
  useGetDraggedEventDraft,
@@ -577,28 +597,28 @@ var zustandBinding = {
577
597
  };
578
598
 
579
599
  // src/store/bindings/BindingProvider.tsx
580
- var BindingCtx = React18.createContext(null);
600
+ var BindingCtx = React19.createContext(null);
581
601
  var useCalendarBinding = () => {
582
- const ctx = React18.useContext(BindingCtx);
602
+ const ctx = React19.useContext(BindingCtx);
583
603
  if (!ctx) throw new Error("useCalendarBinding must be used within <CalendarBindingProvider>");
584
604
  return ctx;
585
605
  };
586
606
  var CalendarBindingProvider = ({ binding, children }) => {
587
607
  const active = binding ?? zustandBinding;
588
608
  const StoreProvider = active.Provider;
589
- return /* @__PURE__ */ React18__namespace.default.createElement(BindingCtx.Provider, { value: active }, /* @__PURE__ */ React18__namespace.default.createElement(StoreProvider, null, children));
609
+ return /* @__PURE__ */ React19__namespace.default.createElement(BindingCtx.Provider, { value: active }, /* @__PURE__ */ React19__namespace.default.createElement(StoreProvider, null, children));
590
610
  };
591
611
 
592
612
  // src/components/ResourcesComponent.tsx
593
- var ResourceComponent = ({ id, onResourcePress, APPOINTMENT_BLOCK_WIDTH }) => {
613
+ var ResourceComponent = ({ id, onResourcePress, APPOINTMENT_BLOCK_WIDTH, date }) => {
594
614
  const { useResourceById: useResourceById2, useEventsFor: useEventsFor2 } = useCalendarBinding();
595
615
  const resource = useResourceById2(id);
596
- const events = useEventsFor2(id);
616
+ const events = useEventsFor2(id, date);
597
617
  const titleFace = useResolvedFont({ fontWeight: "700" });
598
- return /* @__PURE__ */ React18__namespace.createElement(Col_default, { style: [{
618
+ return /* @__PURE__ */ React19__namespace.createElement(Col_default, { style: [{
599
619
  alignItems: "center",
600
620
  width: APPOINTMENT_BLOCK_WIDTH
601
- }] }, /* @__PURE__ */ React18__namespace.createElement(reactNative.View, { style: { position: "relative" } }, /* @__PURE__ */ React18__namespace.createElement(
621
+ }] }, /* @__PURE__ */ React19__namespace.createElement(reactNative.View, { style: { position: "relative" } }, /* @__PURE__ */ React19__namespace.createElement(
602
622
  StaffAvatar,
603
623
  {
604
624
  onPress: () => {
@@ -606,12 +626,12 @@ var ResourceComponent = ({ id, onResourcePress, APPOINTMENT_BLOCK_WIDTH }) => {
606
626
  onResourcePress(resource);
607
627
  },
608
628
  name: resource?.name,
609
- circleSize: 40,
629
+ circleSize: Math.min(40, APPOINTMENT_BLOCK_WIDTH - 12),
610
630
  fontSize: 16,
611
631
  badge: events?.length,
612
632
  image: resource?.avatar
613
633
  }
614
- )), /* @__PURE__ */ React18__namespace.createElement(
634
+ )), /* @__PURE__ */ React19__namespace.createElement(
615
635
  reactNative.Text,
616
636
  {
617
637
  style: {
@@ -625,11 +645,12 @@ var ResourceComponent = ({ id, onResourcePress, APPOINTMENT_BLOCK_WIDTH }) => {
625
645
  resource?.name
626
646
  ));
627
647
  };
628
- var ResourcesComponent = ({ resourceIds, onResourcePress, APPOINTMENT_BLOCK_WIDTH }) => {
629
- return /* @__PURE__ */ React18__namespace.createElement(React18__namespace.Fragment, null, resourceIds?.map((id) => {
630
- return /* @__PURE__ */ React18__namespace.createElement(
648
+ var ResourcesComponent = ({ resourceIds, onResourcePress, APPOINTMENT_BLOCK_WIDTH, date }) => {
649
+ return /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, null, resourceIds?.map((id) => {
650
+ return /* @__PURE__ */ React19__namespace.createElement(
631
651
  ResourceComponent,
632
652
  {
653
+ date,
633
654
  key: id,
634
655
  id,
635
656
  APPOINTMENT_BLOCK_WIDTH,
@@ -652,17 +673,17 @@ function StaffAvatar({
652
673
  textColor
653
674
  }) {
654
675
  const titleFace = useResolvedFont({ fontWeight: "700" });
655
- return /* @__PURE__ */ React18__namespace.createElement(
676
+ return /* @__PURE__ */ React19__namespace.createElement(
656
677
  reactNative.TouchableOpacity,
657
678
  {
658
679
  disabled: lodash.isUndefined(onPress),
659
680
  onPress,
660
681
  style: containerStyle
661
682
  },
662
- /* @__PURE__ */ React18__namespace.createElement(Center_default, { style: {
683
+ /* @__PURE__ */ React19__namespace.createElement(Center_default, { style: {
663
684
  borderRadius: 9999,
664
685
  backgroundColor: ringColor
665
- } }, /* @__PURE__ */ React18__namespace.createElement(Hidden_default, { isHidden: lodash.isUndefined(badge) || Number(badge) == 0 }, /* @__PURE__ */ React18__namespace.createElement(
686
+ } }, /* @__PURE__ */ React19__namespace.createElement(Hidden_default, { isHidden: lodash.isUndefined(badge) || Number(badge) == 0 }, /* @__PURE__ */ React19__namespace.createElement(
666
687
  reactNative.View,
667
688
  {
668
689
  style: [{
@@ -675,7 +696,7 @@ function StaffAvatar({
675
696
  padding: 2
676
697
  }, badgeStyle]
677
698
  },
678
- /* @__PURE__ */ React18__namespace.createElement(
699
+ /* @__PURE__ */ React19__namespace.createElement(
679
700
  Badge_default,
680
701
  {
681
702
  fontSize: 12,
@@ -683,18 +704,18 @@ function StaffAvatar({
683
704
  color: "#4d959c"
684
705
  }
685
706
  )
686
- )), /* @__PURE__ */ React18__namespace.createElement(Center_default, { style: {
707
+ )), /* @__PURE__ */ React19__namespace.createElement(Center_default, { style: {
687
708
  margin: 2,
688
709
  borderRadius: 9999,
689
710
  backgroundColor: "white"
690
- } }, /* @__PURE__ */ React18__namespace.createElement(Center_default, { style: {
711
+ } }, /* @__PURE__ */ React19__namespace.createElement(Center_default, { style: {
691
712
  margin: 2,
692
713
  borderRadius: 9999,
693
714
  height: circleSize,
694
715
  width: circleSize,
695
716
  backgroundColor: avatarColor || "#C9E5E8",
696
717
  overflow: "hidden"
697
- } }, image ? /* @__PURE__ */ React18__namespace.createElement(
718
+ } }, image ? /* @__PURE__ */ React19__namespace.createElement(
698
719
  reactNative.Image,
699
720
  {
700
721
  resizeMode: "cover",
@@ -705,7 +726,7 @@ function StaffAvatar({
705
726
  ...reactNative.StyleSheet.absoluteFillObject
706
727
  }
707
728
  }
708
- ) : /* @__PURE__ */ React18__namespace.createElement(
729
+ ) : /* @__PURE__ */ React19__namespace.createElement(
709
730
  reactNative.Text,
710
731
  {
711
732
  allowFontScaling: false,
@@ -721,14 +742,13 @@ function StaffAvatar({
721
742
  );
722
743
  }
723
744
  var EventGridBlocksSkia = ({
724
- dateRef,
725
745
  handleBlockPress,
726
746
  hourHeight,
727
747
  APPOINTMENT_BLOCK_WIDTH
728
748
  }) => {
729
749
  const rowHeight = hourHeight / 4;
730
- const [pressedRow, setPressedRow] = React18__namespace.useState(null);
731
- const timeLabels = React18.useMemo(() => {
750
+ const [pressedRow, setPressedRow] = React19__namespace.useState(null);
751
+ const timeLabels = React19.useMemo(() => {
732
752
  const out = [];
733
753
  for (let h = 0; h < 24; h++) {
734
754
  for (let q = 0; q < 4; q++) {
@@ -740,7 +760,7 @@ var EventGridBlocksSkia = ({
740
760
  }
741
761
  return out;
742
762
  }, []);
743
- const rects = React18.useMemo(
763
+ const rects = React19.useMemo(
744
764
  () => timeLabels.map((_, row) => ({
745
765
  x: 0,
746
766
  y: row * rowHeight,
@@ -754,21 +774,20 @@ var EventGridBlocksSkia = ({
754
774
  const firstRects = rects.slice(0, midIndex);
755
775
  const secondRects = rects.slice(midIndex);
756
776
  const segmentHeight = rowHeight * firstRects.length;
757
- const onSlotPress = React18__namespace.useCallback(
777
+ const onSlotPress = React19__namespace.useCallback(
758
778
  (row) => {
759
779
  setPressedRow(null);
760
780
  const slot = timeLabels[row];
761
781
  if (slot) {
762
- const timestamp = combineDateAndTime(dateRef.current, slot);
763
- handleBlockPress(timestamp);
782
+ handleBlockPress(slot);
764
783
  }
765
784
  },
766
- [dateRef, handleBlockPress, timeLabels]
785
+ [handleBlockPress, timeLabels]
767
786
  );
768
- const onPressBegin = React18__namespace.useCallback((row) => {
787
+ const onPressBegin = React19__namespace.useCallback((row) => {
769
788
  setPressedRow(row);
770
789
  }, []);
771
- const onTouchesUp = React18__namespace.useCallback(() => {
790
+ const onTouchesUp = React19__namespace.useCallback(() => {
772
791
  setPressedRow(null);
773
792
  }, []);
774
793
  const longPressGesture = reactNativeGestureHandler.Gesture.LongPress().onBegin((e) => {
@@ -781,7 +800,7 @@ var EventGridBlocksSkia = ({
781
800
  "worklet";
782
801
  Animated2.runOnJS(onTouchesUp)();
783
802
  });
784
- return /* @__PURE__ */ React18__namespace.createElement(reactNativeGestureHandler.GestureDetector, { gesture: longPressGesture }, /* @__PURE__ */ React18__namespace.createElement(reactNative.View, null, /* @__PURE__ */ React18__namespace.createElement(reactNativeSkia.Canvas, { style: { width: APPOINTMENT_BLOCK_WIDTH, height: segmentHeight } }, firstRects.map(({ x, y, width: w, height: h, row }, idx) => /* @__PURE__ */ React18__namespace.createElement(React18__namespace.Fragment, { key: idx }, /* @__PURE__ */ React18__namespace.createElement(
803
+ return /* @__PURE__ */ React19__namespace.createElement(reactNativeGestureHandler.GestureDetector, { gesture: longPressGesture }, /* @__PURE__ */ React19__namespace.createElement(reactNative.View, null, /* @__PURE__ */ React19__namespace.createElement(reactNativeSkia.Canvas, { style: { width: APPOINTMENT_BLOCK_WIDTH, height: segmentHeight } }, firstRects.map(({ x, y, width: w, height: h, row }, idx) => /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, { key: idx }, /* @__PURE__ */ React19__namespace.createElement(
785
804
  reactNativeSkia.Rect,
786
805
  {
787
806
  x,
@@ -791,7 +810,7 @@ var EventGridBlocksSkia = ({
791
810
  color: pressedRow === row ? "rgba(240,240,240,0.3)" : "rgba(240,240,240,0.6)",
792
811
  style: "fill"
793
812
  }
794
- ), /* @__PURE__ */ React18__namespace.createElement(reactNativeSkia.Line, { p1: { x, y: y + h }, p2: { x: x + w, y: y + h }, color: "#ddd", strokeWidth: 1 })))), /* @__PURE__ */ React18__namespace.createElement(reactNativeSkia.Canvas, { style: { width: APPOINTMENT_BLOCK_WIDTH, height: segmentHeight } }, secondRects.map(({ x, y, width: w, height: h, row }, idx) => /* @__PURE__ */ React18__namespace.createElement(React18__namespace.Fragment, { key: idx }, /* @__PURE__ */ React18__namespace.createElement(
813
+ ), /* @__PURE__ */ React19__namespace.createElement(reactNativeSkia.Line, { p1: { x, y: y + h }, p2: { x: x + w, y: y + h }, color: "#ddd", strokeWidth: 1 })))), /* @__PURE__ */ React19__namespace.createElement(reactNativeSkia.Canvas, { style: { width: APPOINTMENT_BLOCK_WIDTH, height: segmentHeight } }, secondRects.map(({ x, y, width: w, height: h, row }, idx) => /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, { key: idx }, /* @__PURE__ */ React19__namespace.createElement(
795
814
  reactNativeSkia.Rect,
796
815
  {
797
816
  x,
@@ -801,7 +820,7 @@ var EventGridBlocksSkia = ({
801
820
  color: pressedRow === row ? "rgba(240,240,240,0.3)" : "rgba(240,240,240,0.6)",
802
821
  style: "fill"
803
822
  }
804
- ), /* @__PURE__ */ React18__namespace.createElement(
823
+ ), /* @__PURE__ */ React19__namespace.createElement(
805
824
  reactNativeSkia.Line,
806
825
  {
807
826
  p1: { x, y: y - segmentHeight + h },
@@ -811,36 +830,50 @@ var EventGridBlocksSkia = ({
811
830
  }
812
831
  ))))));
813
832
  };
814
- var StoreFeeder = ({ store, resources }) => {
833
+ var StoreFeeder = ({ store, resources, baseDate }) => {
815
834
  const upsertResources = store.useUpsertResources();
816
- const setDayData = store.useSetDayData();
817
- React18.useEffect(() => {
835
+ const setDayDataFor = store.useSetDayDataFor();
836
+ const setDate = store.useSetDate();
837
+ const baseDateKey = React19.useMemo(() => dateFns.format(baseDate, "yyyy-MM-dd"), [baseDate]);
838
+ React19.useEffect(() => {
839
+ setDate(baseDate);
818
840
  upsertResources(resources.map((r) => ({ id: r.id, name: r.name, avatar: r.avatar })));
819
- const eventsByResource = {};
820
- const blocksByResource = {};
821
- const intervalsByResource = {};
841
+ const dayBuckets = /* @__PURE__ */ new Map();
822
842
  for (const r of resources) {
823
- if (r.events?.length) eventsByResource[r.id] = r.events;
824
- if (r.disabledBlocks?.length) blocksByResource[r.id] = r.disabledBlocks;
825
- if (r.disableIntervals?.length) intervalsByResource[r.id] = r.disableIntervals;
843
+ const push = (items, field) => {
844
+ if (!items?.length) return;
845
+ for (const it of items) {
846
+ const key = it.date ?? baseDateKey;
847
+ const bucket = dayBuckets.get(key) ?? dayBuckets.set(key, { events: {}, disabledBlocks: {}, disableIntervals: {} }).get(key);
848
+ const m = bucket[field];
849
+ (m[r.id] ||= []).push(it);
850
+ }
851
+ };
852
+ push(r.events, "events");
853
+ push(r.disabledBlocks, "disabledBlocks");
854
+ push(r.disableIntervals, "disableIntervals");
826
855
  }
827
- setDayData({
828
- events: eventsByResource,
829
- disabledBlocks: blocksByResource,
830
- disableIntervals: intervalsByResource
831
- });
832
- }, [resources, upsertResources, setDayData]);
856
+ for (const [dayKey, payload] of dayBuckets) {
857
+ setDayDataFor(dayKey, payload);
858
+ }
859
+ }, [resources, upsertResources, setDayDataFor, baseDateKey]);
833
860
  return null;
834
861
  };
835
862
  var DisabledInterval = ({ width, top, height }) => {
836
- return /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: [styles3.disabledBlock, { width, top, height }] }, /* @__PURE__ */ React18__namespace.default.createElement(Svg__default.default, { width, height: "100%" }, /* @__PURE__ */ React18__namespace.default.createElement(Svg.Defs, null, /* @__PURE__ */ React18__namespace.default.createElement(Svg.Pattern, { id: "diagonalHatch", patternUnits: "userSpaceOnUse", width: "10", height: "10" }, /* @__PURE__ */ React18__namespace.default.createElement(Svg.Line, { x1: "0", y1: "0", x2: "10", y2: "10", stroke: "rgba(150, 150, 150, 0.8)", strokeWidth: "1" }))), /* @__PURE__ */ React18__namespace.default.createElement(native.Rect, { width, height: "100%", fill: "url(#diagonalHatch)" })));
863
+ return /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: [styles3.disabledBlock, { width, top, height }] }, /* @__PURE__ */ React19__namespace.default.createElement(Svg__default.default, { width, height: "100%" }, /* @__PURE__ */ React19__namespace.default.createElement(Svg.Defs, null, /* @__PURE__ */ React19__namespace.default.createElement(Svg.Pattern, { id: "diagonalHatch", patternUnits: "userSpaceOnUse", width: "10", height: "10" }, /* @__PURE__ */ React19__namespace.default.createElement(Svg.Line, { x1: "0", y1: "0", x2: "10", y2: "10", stroke: "rgba(150, 150, 150, 0.8)", strokeWidth: "1" }))), /* @__PURE__ */ React19__namespace.default.createElement(native.Rect, { width, height: "100%", fill: "url(#diagonalHatch)" })));
837
864
  };
838
- var DisabledIntervals = React18__namespace.default.memo(({ id, APPOINTMENT_BLOCK_WIDTH, hourHeight }) => {
839
- const { useDisabledIntervalsFor: useDisabledIntervalsFor2 } = useCalendarBinding();
840
- const disabledIntervals = useDisabledIntervalsFor2(id);
841
- return /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, null, disabledIntervals.map(
865
+ var DisabledIntervals = React19__namespace.default.memo(({
866
+ id,
867
+ APPOINTMENT_BLOCK_WIDTH,
868
+ hourHeight,
869
+ date: dateProp
870
+ }) => {
871
+ const { useDisabledIntervalsFor: useDisabledIntervalsFor2, useGetDate: useGetDate2 } = useCalendarBinding();
872
+ const date = useGetDate2();
873
+ const disabledIntervals = useDisabledIntervalsFor2(id, dateProp ?? date);
874
+ return /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, disabledIntervals.map(
842
875
  (disabledInterval, index) => {
843
- return /* @__PURE__ */ React18__namespace.default.createElement(
876
+ return /* @__PURE__ */ React19__namespace.default.createElement(
844
877
  DisabledInterval,
845
878
  {
846
879
  key: `${index}-${disabledInterval.from}-${disabledInterval.to}`,
@@ -860,7 +893,7 @@ var styles3 = reactNative.StyleSheet.create({
860
893
  });
861
894
  var DisabledIntervals_default = DisabledIntervals;
862
895
  var Row = ({ children, divider, space, style, ...props }) => {
863
- return /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: [{ flexDirection: "row" }, style], ...props }, React18__namespace.default.Children.toArray(children).map((child, index) => /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, { key: index }, child, index !== React18__namespace.default.Children.toArray(children).length - 1 && divider, index !== React18__namespace.default.Children.toArray(children).length - 1 && /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: { width: space, height: "100%" } }))));
896
+ return /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: [{ flexDirection: "row" }, style], ...props }, React19__namespace.default.Children.toArray(children).map((child, index) => /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, { key: index }, child, index !== React19__namespace.default.Children.toArray(children).length - 1 && divider, index !== React19__namespace.default.Children.toArray(children).length - 1 && /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: { width: space, height: "100%" } }))));
864
897
  };
865
898
  var Row_default = Row;
866
899
  var DisabledBlockComponent = ({
@@ -881,7 +914,7 @@ var DisabledBlockComponent = ({
881
914
  borderColor: "rgba(0,0,0,0.12)"
882
915
  };
883
916
  const titleFace = useResolvedFont({ fontWeight: "600" });
884
- return /* @__PURE__ */ React18__namespace.default.createElement(
917
+ return /* @__PURE__ */ React19__namespace.default.createElement(
885
918
  reactNative.TouchableOpacity,
886
919
  {
887
920
  style: [styles4.event, dynamicStyle],
@@ -889,7 +922,7 @@ var DisabledBlockComponent = ({
889
922
  onDisabledBlockPress && onDisabledBlockPress(disabledBlock);
890
923
  }
891
924
  },
892
- /* @__PURE__ */ React18__namespace.default.createElement(Col_default, { style: { position: "relative" } }, /* @__PURE__ */ React18__namespace.default.createElement(Row_default, { style: { height: 18 } }, /* @__PURE__ */ React18__namespace.default.createElement(
925
+ /* @__PURE__ */ React19__namespace.default.createElement(Col_default, { style: { position: "relative" } }, /* @__PURE__ */ React19__namespace.default.createElement(Row_default, { style: { height: 18 } }, /* @__PURE__ */ React19__namespace.default.createElement(
893
926
  reactNative.Text,
894
927
  {
895
928
  allowFontScaling: false,
@@ -902,7 +935,7 @@ var DisabledBlockComponent = ({
902
935
  minutesToTime(disabledBlock?.from),
903
936
  " - ",
904
937
  minutesToTime(disabledBlock?.to)
905
- )), /* @__PURE__ */ React18__namespace.default.createElement(
938
+ )), /* @__PURE__ */ React19__namespace.default.createElement(
906
939
  reactNative.Text,
907
940
  {
908
941
  allowFontScaling: false,
@@ -916,21 +949,23 @@ var DisabledBlockComponent = ({
916
949
  ))
917
950
  );
918
951
  };
919
- var DisabledBlocks = React18__namespace.default.memo(({
952
+ var DisabledBlocks = React19__namespace.default.memo(({
920
953
  id,
921
954
  APPOINTMENT_BLOCK_WIDTH,
922
955
  hourHeight,
923
- onDisabledBlockPress
956
+ onDisabledBlockPress,
957
+ date: dateProp
924
958
  }) => {
925
- const { useDisabledBlocksFor: useDisabledBlocksFor2 } = useCalendarBinding();
926
- const disabledBlocks = useDisabledBlocksFor2(id);
927
- const layoutMap = React18.useMemo(() => {
959
+ const { useDisabledBlocksFor: useDisabledBlocksFor2, useGetDate: useGetDate2 } = useCalendarBinding();
960
+ const date = useGetDate2();
961
+ const disabledBlocks = useDisabledBlocksFor2(id, dateProp ?? date);
962
+ const layoutMap = React19.useMemo(() => {
928
963
  return columnsToPixels(computeDisabledBlockColumns(disabledBlocks), APPOINTMENT_BLOCK_WIDTH);
929
964
  }, [disabledBlocks]);
930
- return /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, null, disabledBlocks.map(
965
+ return /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, disabledBlocks.map(
931
966
  (disabledBlock, index) => {
932
967
  const key = disabledBlock.id;
933
- return /* @__PURE__ */ React18__namespace.default.createElement(
968
+ return /* @__PURE__ */ React19__namespace.default.createElement(
934
969
  DisabledBlockComponent,
935
970
  {
936
971
  hourHeight,
@@ -956,7 +991,7 @@ var styles4 = reactNative.StyleSheet.create({
956
991
  }
957
992
  });
958
993
  var DisabledBlocks_default = DisabledBlocks;
959
- var EventBlock = React18__namespace.default.memo(({
994
+ var EventBlock = React19__namespace.default.memo(({
960
995
  event,
961
996
  onLongPress,
962
997
  onPress,
@@ -990,7 +1025,7 @@ var EventBlock = React18__namespace.default.memo(({
990
1025
  const Body = slots?.Body;
991
1026
  const titleFace = useResolvedFont({ fontWeight: "700" });
992
1027
  const timeFace = useResolvedFont({ fontWeight: "600" });
993
- return /* @__PURE__ */ React18__namespace.default.createElement(
1028
+ return /* @__PURE__ */ React19__namespace.default.createElement(
994
1029
  reactNative.TouchableOpacity,
995
1030
  {
996
1031
  style: [styles5.event, resolved?.container, dynamicStyle],
@@ -1002,7 +1037,7 @@ var EventBlock = React18__namespace.default.memo(({
1002
1037
  onLongPress && onLongPress(event);
1003
1038
  }
1004
1039
  },
1005
- /* @__PURE__ */ React18__namespace.default.createElement(Hidden_default, { isHidden: !disabled }, /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: {
1040
+ /* @__PURE__ */ React19__namespace.default.createElement(Hidden_default, { isHidden: !disabled }, /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: {
1006
1041
  position: "absolute",
1007
1042
  top: 0,
1008
1043
  width: "150%",
@@ -1010,7 +1045,7 @@ var EventBlock = React18__namespace.default.memo(({
1010
1045
  zIndex: 1,
1011
1046
  backgroundColor: "rgba(255, 255, 255, 0.5)"
1012
1047
  } })),
1013
- /* @__PURE__ */ React18__namespace.default.createElement(Col_default, { style: [{ position: "relative" }, resolved?.content] }, /* @__PURE__ */ React18__namespace.default.createElement(
1048
+ /* @__PURE__ */ React19__namespace.default.createElement(Col_default, { style: [{ position: "relative" }, resolved?.content] }, /* @__PURE__ */ React19__namespace.default.createElement(
1014
1049
  reactNative.TextInput,
1015
1050
  {
1016
1051
  editable: false,
@@ -1026,7 +1061,7 @@ var EventBlock = React18__namespace.default.memo(({
1026
1061
  },
1027
1062
  defaultValue: `${start} - ${end}`
1028
1063
  }
1029
- ), Body ? /* @__PURE__ */ React18__namespace.default.createElement(Body, { event, ctx: { hourHeight } }) : /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, null, /* @__PURE__ */ React18__namespace.default.createElement(Row_default, { style: { alignItems: "center", height: 18 } }, /* @__PURE__ */ React18__namespace.default.createElement(
1064
+ ), Body ? /* @__PURE__ */ React19__namespace.default.createElement(Body, { event, ctx: { hourHeight } }) : /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, /* @__PURE__ */ React19__namespace.default.createElement(Row_default, { style: { alignItems: "center", height: 18 } }, /* @__PURE__ */ React19__namespace.default.createElement(
1030
1065
  reactNative.Text,
1031
1066
  {
1032
1067
  allowFontScaling: false,
@@ -1037,7 +1072,7 @@ var EventBlock = React18__namespace.default.memo(({
1037
1072
  }, resolved?.title]
1038
1073
  },
1039
1074
  event?.title
1040
- )), /* @__PURE__ */ React18__namespace.default.createElement(
1075
+ )), /* @__PURE__ */ React19__namespace.default.createElement(
1041
1076
  reactNative.Text,
1042
1077
  {
1043
1078
  allowFontScaling: false,
@@ -1048,10 +1083,10 @@ var EventBlock = React18__namespace.default.memo(({
1048
1083
  }, resolved?.desc]
1049
1084
  },
1050
1085
  event?.description
1051
- )), /* @__PURE__ */ React18__namespace.default.createElement(Row_default, { style: {
1086
+ )), /* @__PURE__ */ React19__namespace.default.createElement(Row_default, { style: {
1052
1087
  position: "absolute",
1053
1088
  right: 2
1054
- }, space: 2 }, TopRight ? /* @__PURE__ */ React18__namespace.default.createElement(TopRight, { event, ctx: { hourHeight } }) : null))
1089
+ } }, TopRight ? /* @__PURE__ */ React19__namespace.default.createElement(TopRight, { event, ctx: { hourHeight } }) : null))
1055
1090
  );
1056
1091
  });
1057
1092
  var styles5 = reactNative.StyleSheet.create({
@@ -1111,25 +1146,25 @@ var DraggableEvent = ({
1111
1146
  }
1112
1147
  ]
1113
1148
  };
1114
- }, [selectedEvent, eventHeight, APPOINTMENT_BLOCK_WIDTH]);
1115
- const initialDisplayTime = React18.useMemo(() => {
1149
+ }, [selectedEvent, APPOINTMENT_BLOCK_WIDTH]);
1150
+ const initialDisplayTime = React19.useMemo(() => {
1116
1151
  const start = minutesToTime(positionToMinutes(eventStartedTop.value, hourHeight));
1117
1152
  const end = minutesToTime(positionToMinutes(eventStartedTop.value + eventHeight.value, hourHeight));
1118
1153
  return `${start} - ${end}`;
1119
- }, [eventHeight.value, hourHeight, eventStartedTop.value]);
1154
+ }, [hourHeight]);
1120
1155
  const animatedTimeProps = Animated2.useAnimatedProps(() => {
1121
1156
  const start = minutesToTime(positionToMinutes(eventStartedTop.value, hourHeight));
1122
1157
  const end = minutesToTime(positionToMinutes(eventStartedTop.value + eventHeight.value, hourHeight));
1123
1158
  return {
1124
1159
  text: `${start} - ${end}`
1125
1160
  };
1126
- }, []);
1161
+ }, [hourHeight]);
1127
1162
  const resolved = typeof styleOverrides === "function" ? styleOverrides(selectedEvent) ?? {} : styleOverrides ?? {};
1128
1163
  const TopRight = slots?.TopRight;
1129
1164
  const Body = slots?.Body;
1130
1165
  const titleFace = useResolvedFont({ fontWeight: "700" });
1131
1166
  const timeFace = useResolvedFont({ fontWeight: "600" });
1132
- return /* @__PURE__ */ React18__namespace.createElement(Animated2__default.default.View, { style: [styles6.event, dynamicStyle, draggingAnimatedStyle, resolved?.container] }, /* @__PURE__ */ React18__namespace.createElement(Col_default, { style: [{ position: "relative" }, resolved?.content] }, /* @__PURE__ */ React18__namespace.createElement(
1167
+ return /* @__PURE__ */ React19__namespace.createElement(Animated2__default.default.View, { style: [styles6.event, dynamicStyle, draggingAnimatedStyle, resolved?.container] }, /* @__PURE__ */ React19__namespace.createElement(Col_default, { style: [{ position: "relative" }, resolved?.content] }, /* @__PURE__ */ React19__namespace.createElement(
1133
1168
  AnimatedTextInput,
1134
1169
  {
1135
1170
  editable: false,
@@ -1146,7 +1181,7 @@ var DraggableEvent = ({
1146
1181
  defaultValue: initialDisplayTime,
1147
1182
  animatedProps: animatedTimeProps
1148
1183
  }
1149
- ), Body ? /* @__PURE__ */ React18__namespace.createElement(Body, { event: selectedEvent, ctx: { hourHeight } }) : /* @__PURE__ */ React18__namespace.createElement(React18__namespace.Fragment, null, /* @__PURE__ */ React18__namespace.createElement(Row_default, { style: { alignItems: "center", height: 18 } }, /* @__PURE__ */ React18__namespace.createElement(
1184
+ ), Body ? /* @__PURE__ */ React19__namespace.createElement(Body, { event: selectedEvent, ctx: { hourHeight } }) : /* @__PURE__ */ React19__namespace.createElement(React19__namespace.Fragment, null, /* @__PURE__ */ React19__namespace.createElement(Row_default, { style: { alignItems: "center", height: 18 } }, /* @__PURE__ */ React19__namespace.createElement(
1150
1185
  reactNative.Text,
1151
1186
  {
1152
1187
  allowFontScaling: false,
@@ -1157,7 +1192,7 @@ var DraggableEvent = ({
1157
1192
  }, resolved?.title]
1158
1193
  },
1159
1194
  selectedEvent?.title
1160
- )), /* @__PURE__ */ React18__namespace.createElement(
1195
+ )), /* @__PURE__ */ React19__namespace.createElement(
1161
1196
  reactNative.Text,
1162
1197
  {
1163
1198
  allowFontScaling: false,
@@ -1168,14 +1203,14 @@ var DraggableEvent = ({
1168
1203
  }, resolved?.desc]
1169
1204
  },
1170
1205
  selectedEvent?.description
1171
- )), /* @__PURE__ */ React18__namespace.createElement(Row_default, { style: {
1206
+ )), /* @__PURE__ */ React19__namespace.createElement(Row_default, { style: {
1172
1207
  position: "absolute",
1173
1208
  right: 2
1174
- }, space: 2 }, TopRight ? /* @__PURE__ */ React18__namespace.createElement(TopRight, { event: selectedEvent, ctx: { hourHeight } }) : null)), /* @__PURE__ */ React18__namespace.createElement(Row_default, { style: {
1209
+ }, space: 2 }, TopRight ? /* @__PURE__ */ React19__namespace.createElement(TopRight, { event: selectedEvent, ctx: { hourHeight } }) : null)), /* @__PURE__ */ React19__namespace.createElement(Row_default, { style: {
1175
1210
  position: "absolute",
1176
1211
  alignSelf: "center",
1177
1212
  bottom: 0
1178
- } }, /* @__PURE__ */ React18__namespace.createElement(vectorIcons.MaterialIcons, { name: "drag-handle", size: 12, color: "black" })));
1213
+ } }, /* @__PURE__ */ React19__namespace.createElement(vectorIcons.MaterialIcons, { name: "drag-handle", size: 12, color: "black" })));
1179
1214
  };
1180
1215
  var styles6 = reactNative.StyleSheet.create({
1181
1216
  event: {
@@ -1188,7 +1223,7 @@ var styles6 = reactNative.StyleSheet.create({
1188
1223
  // Ensure events stay above the background blocks
1189
1224
  }
1190
1225
  });
1191
- var EventBlocks = React18__namespace.default.memo(({
1226
+ var EventBlocks = React19__namespace.default.memo(({
1192
1227
  id,
1193
1228
  onLongPress,
1194
1229
  onPress,
@@ -1197,11 +1232,13 @@ var EventBlocks = React18__namespace.default.memo(({
1197
1232
  eventRenderer,
1198
1233
  isEventDisabled,
1199
1234
  isEventSelected,
1200
- mode
1235
+ mode,
1236
+ date: dateProp
1201
1237
  }) => {
1202
- const { useEventsFor: useEventsFor2 } = useCalendarBinding();
1203
- const events = useEventsFor2(id);
1204
- const frameMap = React18.useMemo(
1238
+ const { useEventsFor: useEventsFor2, useGetDate: useGetDate2 } = useCalendarBinding();
1239
+ const date = useGetDate2();
1240
+ const events = useEventsFor2(id, dateProp ?? date);
1241
+ const frameMap = React19.useMemo(
1205
1242
  () => computeEventFrames(events, EVENT_BLOCK_WIDTH, mode),
1206
1243
  [events, mode, EVENT_BLOCK_WIDTH]
1207
1244
  );
@@ -1210,7 +1247,7 @@ var EventBlocks = React18__namespace.default.memo(({
1210
1247
  (evt, index) => {
1211
1248
  const selected = isEventSelected?.(evt) ?? false;
1212
1249
  const disabled = isEventDisabled?.(evt) ?? false;
1213
- return /* @__PURE__ */ React18__namespace.default.createElement(
1250
+ return /* @__PURE__ */ React19__namespace.default.createElement(
1214
1251
  Renderer,
1215
1252
  {
1216
1253
  key: `${evt.from}-${evt.to}-${index}`,
@@ -1227,8 +1264,89 @@ var EventBlocks = React18__namespace.default.memo(({
1227
1264
  );
1228
1265
  });
1229
1266
  var EventBlocks_default = EventBlocks;
1230
-
1231
- // src/components/Calendar.tsx
1267
+ var DaysComponent = ({ onResourcePress, activeResourceId, mode, date, APPOINTMENT_BLOCK_WIDTH }) => {
1268
+ const { useResourceById: useResourceById2 } = useCalendarBinding();
1269
+ const resource = useResourceById2(activeResourceId);
1270
+ const titleFace = useResolvedFont({ fontWeight: "700" });
1271
+ const subTitleFace = useResolvedFont({ fontWeight: "600" });
1272
+ const isMultiDay = mode !== "day";
1273
+ const visibleDayCount = isMultiDay ? mode === "week" ? 7 : 3 : 1;
1274
+ const days = React19.useMemo(
1275
+ () => Array.from({ length: visibleDayCount }, (_, i) => dateFns.addDays(date, i)),
1276
+ [date, visibleDayCount]
1277
+ );
1278
+ return /* @__PURE__ */ React19__namespace.createElement(Row_default, null, /* @__PURE__ */ React19__namespace.createElement(Col_default, { style: { width: TIME_LABEL_WIDTH, alignItems: "center", paddingVertical: 4 } }, /* @__PURE__ */ React19__namespace.createElement(
1279
+ StaffAvatar,
1280
+ {
1281
+ onPress: () => {
1282
+ if (onResourcePress)
1283
+ onResourcePress(resource);
1284
+ },
1285
+ name: resource?.name,
1286
+ circleSize: TIME_LABEL_WIDTH - 12,
1287
+ fontSize: 16,
1288
+ image: resource?.avatar
1289
+ }
1290
+ ), /* @__PURE__ */ React19__namespace.createElement(
1291
+ reactNative.Text,
1292
+ {
1293
+ style: {
1294
+ fontSize: 14,
1295
+ fontFamily: titleFace,
1296
+ fontWeight: "700"
1297
+ },
1298
+ numberOfLines: 1,
1299
+ allowFontScaling: false
1300
+ },
1301
+ resource?.name
1302
+ )), /* @__PURE__ */ React19__namespace.createElement(Row_default, { style: { flex: 1 } }, days.map((d, i) => {
1303
+ const selected = dateFns.isSameDay(d, /* @__PURE__ */ new Date());
1304
+ return /* @__PURE__ */ React19__namespace.createElement(
1305
+ Col_default,
1306
+ {
1307
+ style: {
1308
+ alignItems: "center",
1309
+ justifyContent: "center",
1310
+ width: APPOINTMENT_BLOCK_WIDTH
1311
+ },
1312
+ space: 4,
1313
+ key: i
1314
+ },
1315
+ /* @__PURE__ */ React19__namespace.createElement(Center_default, { style: {
1316
+ backgroundColor: selected ? "#4d959c" : void 0,
1317
+ width: 30,
1318
+ height: 30,
1319
+ borderRadius: 999
1320
+ } }, /* @__PURE__ */ React19__namespace.createElement(
1321
+ reactNative.Text,
1322
+ {
1323
+ style: {
1324
+ fontSize: 16,
1325
+ fontFamily: subTitleFace,
1326
+ fontWeight: "600",
1327
+ color: selected ? "#fff" : void 0
1328
+ },
1329
+ numberOfLines: 1,
1330
+ allowFontScaling: false
1331
+ },
1332
+ dateFns.format(d, "d")
1333
+ )),
1334
+ /* @__PURE__ */ React19__namespace.createElement(
1335
+ reactNative.Text,
1336
+ {
1337
+ style: {
1338
+ fontSize: 14,
1339
+ fontFamily: subTitleFace,
1340
+ fontWeight: "600"
1341
+ },
1342
+ numberOfLines: 1,
1343
+ allowFontScaling: false
1344
+ },
1345
+ dateFns.format(d, "EEE")
1346
+ )
1347
+ );
1348
+ })));
1349
+ };
1232
1350
  var AnimatedFlashList = Animated2__default.default.createAnimatedComponent(flashList.FlashList);
1233
1351
  var CalendarInner = (props) => {
1234
1352
  const { width } = reactNative.useWindowDimensions();
@@ -1236,7 +1354,7 @@ var CalendarInner = (props) => {
1236
1354
  const binding = useCalendarBinding();
1237
1355
  const {
1238
1356
  date,
1239
- numberOfColumns = 3,
1357
+ numberOfColumns: numberOfColumnsProp = 3,
1240
1358
  startMinutes,
1241
1359
  hourHeight = 120,
1242
1360
  snapIntervalInMinutes = 5,
@@ -1249,17 +1367,26 @@ var CalendarInner = (props) => {
1249
1367
  onDisabledBlockPress,
1250
1368
  eventSlots,
1251
1369
  eventStyleOverrides,
1252
- overLappingLayoutMode = "stacked"
1370
+ overLappingLayoutMode = "stacked",
1371
+ mode = "day",
1372
+ activeResourceId
1253
1373
  } = props;
1374
+ const numberOfColumns = mode === "day" ? numberOfColumnsProp : mode === "week" ? 7 : 3;
1375
+ const isMultiDay = mode !== "day";
1376
+ const visibleDayCount = isMultiDay ? mode === "week" ? 7 : 3 : 1;
1377
+ const days = React19.useMemo(
1378
+ () => Array.from({ length: visibleDayCount }, (_, i) => dateFns.addDays(date, i)),
1379
+ [date, visibleDayCount]
1380
+ );
1254
1381
  const snapInterval = hourHeight / 60 * snapIntervalInMinutes;
1255
- const onPressRef = React18__namespace.default.useRef(onEventPress);
1256
- const onLongPressRef = React18__namespace.default.useRef(onEventLongPress);
1257
- const internalOnLongPress = React18.useRef(null);
1258
- const onDisabledBlockPressRef = React18__namespace.default.useRef(onDisabledBlockPress);
1259
- const selectedRef = React18.useRef(props.isEventSelected);
1260
- const disabledRef = React18.useRef(props.isEventDisabled);
1261
- const effectiveRenderer = React18.useMemo(() => {
1262
- return (p) => /* @__PURE__ */ React18__namespace.default.createElement(
1382
+ const onPressRef = React19__namespace.default.useRef(onEventPress);
1383
+ const onLongPressRef = React19__namespace.default.useRef(onEventLongPress);
1384
+ const internalOnLongPress = React19.useRef(null);
1385
+ const onDisabledBlockPressRef = React19__namespace.default.useRef(onDisabledBlockPress);
1386
+ const selectedRef = React19.useRef(props.isEventSelected);
1387
+ const disabledRef = React19.useRef(props.isEventDisabled);
1388
+ const effectiveRenderer = React19.useMemo(() => {
1389
+ return (p) => /* @__PURE__ */ React19__namespace.default.createElement(
1263
1390
  EventBlock_default,
1264
1391
  {
1265
1392
  ...p,
@@ -1268,64 +1395,72 @@ var CalendarInner = (props) => {
1268
1395
  }
1269
1396
  );
1270
1397
  }, [eventSlots, eventStyleOverrides]);
1271
- const isEventSelectedStable = React18.useCallback(
1398
+ const isEventSelectedStable = React19.useCallback(
1272
1399
  (ev) => selectedRef.current ? selectedRef.current(ev) : false,
1273
1400
  []
1274
1401
  );
1275
- const isEventDisabledStable = React18.useCallback(
1402
+ const isEventDisabledStable = React19.useCallback(
1276
1403
  (ev) => disabledRef.current ? disabledRef.current(ev) : false,
1277
1404
  []
1278
1405
  );
1279
- React18.useEffect(() => {
1406
+ React19.useEffect(() => {
1280
1407
  onPressRef.current = onEventPress;
1281
1408
  }, [onEventPress]);
1282
- React18.useEffect(() => {
1409
+ React19.useEffect(() => {
1283
1410
  onLongPressRef.current = onEventLongPress;
1284
1411
  }, [onEventLongPress]);
1285
- React18.useEffect(() => {
1412
+ React19.useEffect(() => {
1286
1413
  onDisabledBlockPressRef.current = onDisabledBlockPress;
1287
1414
  }, [onDisabledBlockPress]);
1288
- React18.useEffect(() => {
1415
+ React19.useEffect(() => {
1289
1416
  rendererRef.current = effectiveRenderer;
1290
1417
  }, [effectiveRenderer]);
1291
- React18.useEffect(() => {
1418
+ React19.useEffect(() => {
1292
1419
  selectedRef.current = props.isEventSelected;
1293
1420
  }, [props.isEventSelected]);
1294
- React18.useEffect(() => {
1421
+ React19.useEffect(() => {
1295
1422
  disabledRef.current = props.isEventDisabled;
1296
1423
  }, [props.isEventDisabled]);
1297
- const rendererRef = React18.useRef(effectiveRenderer);
1298
- const stableRenderer = React18.useCallback((p) => rendererRef.current(p), []);
1299
- const stableOnPress = React18__namespace.default.useCallback((e) => onPressRef.current?.(e), []);
1300
- const stableOnDisabledBlockPress = React18__namespace.default.useCallback((b) => onDisabledBlockPressRef.current?.(b), []);
1424
+ const rendererRef = React19.useRef(effectiveRenderer);
1425
+ const stableRenderer = React19.useCallback((p) => rendererRef.current(p), []);
1426
+ const stableOnPress = React19__namespace.default.useCallback((e) => onPressRef.current?.(e), []);
1427
+ const stableOnDisabledBlockPress = React19__namespace.default.useCallback((b) => onDisabledBlockPressRef.current?.(b), []);
1301
1428
  const { useGetSelectedEvent: useGetSelectedEvent2, useSetSelectedEvent: useSetSelectedEvent2, useSetDraggedEventDraft: useSetDraggedEventDraft2, useGetDraggedEventDraft: useGetDraggedEventDraft2 } = useCalendarBinding();
1302
1429
  const selectedEvent = useGetSelectedEvent2();
1303
1430
  const setSelectedEvent = useSetSelectedEvent2();
1304
1431
  const setDraggedEventDraft = useSetDraggedEventDraft2();
1305
1432
  const APPOINTMENT_BLOCK_WIDTH = (width - TIME_LABEL_WIDTH) / numberOfColumns;
1306
- const hourHeightRef = React18.useRef(hourHeight);
1307
- const resourcesRef = React18.useRef(resources);
1308
- const apptWidthRef = React18.useRef(APPOINTMENT_BLOCK_WIDTH);
1309
- React18.useEffect(() => {
1433
+ const hourHeightRef = React19.useRef(hourHeight);
1434
+ const resourcesRef = React19.useRef(resources);
1435
+ const apptWidthRef = React19.useRef(APPOINTMENT_BLOCK_WIDTH);
1436
+ const isMultiDayRef = React19.useRef(isMultiDay);
1437
+ const daysRef = React19.useRef(days);
1438
+ React19.useEffect(() => {
1310
1439
  hourHeightRef.current = hourHeight;
1311
1440
  }, [hourHeight]);
1312
- React18.useEffect(() => {
1441
+ React19.useEffect(() => {
1313
1442
  resourcesRef.current = resources;
1314
1443
  }, [resources]);
1315
- React18.useEffect(() => {
1444
+ React19.useEffect(() => {
1316
1445
  apptWidthRef.current = APPOINTMENT_BLOCK_WIDTH;
1317
1446
  }, [APPOINTMENT_BLOCK_WIDTH]);
1318
- React18.useEffect(() => {
1447
+ React19.useEffect(() => {
1448
+ isMultiDayRef.current = isMultiDay;
1449
+ }, [isMultiDay]);
1450
+ React19.useEffect(() => {
1451
+ daysRef.current = days;
1452
+ }, [days]);
1453
+ React19.useEffect(() => {
1319
1454
  if (!selectedEvent) {
1320
1455
  setDraggedEventDraft(null);
1321
1456
  }
1322
1457
  }, [selectedEvent]);
1323
1458
  const verticalScrollViewRef = Animated2.useAnimatedRef();
1324
1459
  const headerScrollViewRef = Animated2.useAnimatedRef();
1325
- const flashListRef = React18.useRef(null);
1326
- const prevResourceIdsRef = React18.useRef([]);
1327
- const [layout, setLayout] = React18.useState(null);
1328
- const dateRef = React18.useRef(date);
1460
+ const flashListRef = React19.useRef(null);
1461
+ const prevResourceIdsRef = React19.useRef([]);
1462
+ const [layout, setLayout] = React19.useState(null);
1463
+ const dateRef = React19.useRef(date);
1329
1464
  const eventStartedTop = Animated2.useSharedValue(0);
1330
1465
  const eventHeight = Animated2.useSharedValue(0);
1331
1466
  const panXAbs = Animated2.useSharedValue(0);
@@ -1341,9 +1476,35 @@ var CalendarInner = (props) => {
1341
1476
  const startedX = Animated2.useSharedValue(0);
1342
1477
  const startedY = Animated2.useSharedValue(0);
1343
1478
  const touchY = Animated2.useSharedValue(0);
1344
- const triggerHaptic = React18.useCallback(() => {
1479
+ const triggerHaptic = React19.useCallback(() => {
1345
1480
  Haptics__namespace.impactAsync(Haptics__namespace.ImpactFeedbackStyle.Light);
1346
1481
  }, []);
1482
+ const resourceIds = React19.useMemo(() => {
1483
+ const ids = resources?.map((item) => item?.id) || [];
1484
+ if (JSON.stringify(prevResourceIdsRef.current) !== JSON.stringify(ids)) {
1485
+ prevResourceIdsRef.current = ids;
1486
+ }
1487
+ return prevResourceIdsRef.current;
1488
+ }, [resources]);
1489
+ const finalizeDrag = React19__namespace.default.useCallback((colIndex, adjustedTop, height) => {
1490
+ const isMultiDay2 = mode !== "day";
1491
+ const landedResourceId = !isMultiDay2 ? resourceIds[colIndex] : activeResourceId ?? resourceIds[0];
1492
+ const landedDate = dateFns.format(!isMultiDay2 ? date : days[colIndex], "yyyy-MM-dd");
1493
+ setDraggedEventDraft({
1494
+ event: selectedEvent,
1495
+ // ensure this is not stale (store/ref)
1496
+ from: positionToMinutes(adjustedTop, hourHeight),
1497
+ to: positionToMinutes(adjustedTop + height, hourHeight),
1498
+ resourceId: landedResourceId,
1499
+ date: landedDate
1500
+ });
1501
+ }, [mode, resourceIds, activeResourceId, selectedEvent, hourHeight, setDraggedEventDraft, days]);
1502
+ const columns = React19.useMemo(() => {
1503
+ if (!isMultiDay) {
1504
+ return resourceIds.map((resourceId) => ({ kind: "resource", resourceId }));
1505
+ }
1506
+ return days.map((dayDate, dayIndex) => ({ kind: "day", dayIndex, dayDate }));
1507
+ }, [isMultiDay, resourceIds, days]);
1347
1508
  const panGesture = reactNativeGestureHandler.Gesture.Pan().manualActivation(!isIOS).enabled(layout !== null).shouldCancelWhenOutside(false).onTouchesMove((_evt, stateManager) => {
1348
1509
  "worklet";
1349
1510
  if (isIOS) return;
@@ -1451,9 +1612,8 @@ var CalendarInner = (props) => {
1451
1612
  const finalXOnScreen = panXAbs.value;
1452
1613
  const absoluteX = finalXOnScreen + scrollX.value;
1453
1614
  const newStaffIndex = Math.floor((absoluteX - TIME_LABEL_WIDTH) / APPOINTMENT_BLOCK_WIDTH);
1454
- const clampedStaffIndex = Math.max(0, Math.min(newStaffIndex, resources.length - 1));
1455
- const endedResource = resources[clampedStaffIndex];
1456
- const finalPanXValue = TIME_LABEL_WIDTH + clampedStaffIndex * APPOINTMENT_BLOCK_WIDTH - scrollX.value + APPOINTMENT_BLOCK_WIDTH / 2;
1615
+ const colIndex = Math.max(0, Math.min(newStaffIndex, columns.length - 1));
1616
+ const finalPanXValue = TIME_LABEL_WIDTH + colIndex * APPOINTMENT_BLOCK_WIDTH - scrollX.value + APPOINTMENT_BLOCK_WIDTH / 2;
1457
1617
  panYAbs.value = Animated2.withSpring(finalPanYValue);
1458
1618
  panXAbs.value = Animated2.withSpring(finalPanXValue);
1459
1619
  if (!isPulling.value) {
@@ -1463,12 +1623,7 @@ var CalendarInner = (props) => {
1463
1623
  startedX.value = finalPanXValue;
1464
1624
  isPulling.value = false;
1465
1625
  isDragging.value = false;
1466
- Animated2.runOnJS(setDraggedEventDraft)({
1467
- event: selectedEvent,
1468
- from: positionToMinutes(adjustedFinalEventTop, hourHeight),
1469
- to: positionToMinutes(adjustedFinalEventTop + eventHeight.value, hourHeight),
1470
- resourceId: endedResource?.id
1471
- });
1626
+ Animated2.runOnJS(finalizeDrag)(colIndex, adjustedFinalEventTop, eventHeight.value);
1472
1627
  });
1473
1628
  const scrollListTo = (x) => {
1474
1629
  flashListRef.current?.scrollToOffset({ offset: x, animated: false });
@@ -1521,7 +1676,7 @@ var CalendarInner = (props) => {
1521
1676
  Animated2.runOnJS(Haptics__namespace.impactAsync)(Haptics__namespace.ImpactFeedbackStyle.Medium);
1522
1677
  }
1523
1678
  });
1524
- React18.useEffect(() => {
1679
+ React19.useEffect(() => {
1525
1680
  internalOnLongPress.current = (event) => {
1526
1681
  onLongPressRef.current?.(event);
1527
1682
  const hh = hourHeightRef.current;
@@ -1533,10 +1688,17 @@ var CalendarInner = (props) => {
1533
1688
  startedY.value = panAbsValue;
1534
1689
  eventStartedTop.value = eventTop;
1535
1690
  const resources2 = resourcesRef.current;
1691
+ const days2 = daysRef.current;
1536
1692
  const APPOINTMENT_BLOCK_WIDTH2 = apptWidthRef.current;
1537
- const staffIndex = resources2.findIndex((r) => r.id === event.resourceId);
1693
+ const isMultiDay2 = isMultiDayRef.current;
1538
1694
  const leftmostColumnIndex = Math.round(scrollX.value / APPOINTMENT_BLOCK_WIDTH2);
1539
- const screenColumn = staffIndex - leftmostColumnIndex;
1695
+ let absoluteColIndex;
1696
+ if (!isMultiDay2) {
1697
+ absoluteColIndex = findResourceIndexFor(event.resourceId, resources2?.map((r) => r.id));
1698
+ } else {
1699
+ absoluteColIndex = findDayIndexFor(event.date, days2);
1700
+ }
1701
+ const screenColumn = absoluteColIndex - leftmostColumnIndex;
1540
1702
  const selectedAppointmentStartedX = TIME_LABEL_WIDTH + APPOINTMENT_BLOCK_WIDTH2 / 2 + APPOINTMENT_BLOCK_WIDTH2 * screenColumn;
1541
1703
  panXAbs.value = selectedAppointmentStartedX;
1542
1704
  startedX.value = selectedAppointmentStartedX;
@@ -1546,10 +1708,10 @@ var CalendarInner = (props) => {
1546
1708
  Haptics__namespace.impactAsync(Haptics__namespace.ImpactFeedbackStyle.Medium);
1547
1709
  };
1548
1710
  }, []);
1549
- const internalStableOnLongPress = React18.useCallback((e) => {
1711
+ const internalStableOnLongPress = React19.useCallback((e) => {
1550
1712
  internalOnLongPress.current?.(e);
1551
1713
  }, []);
1552
- const onLayout = React18.useCallback((evt) => {
1714
+ const onLayout = React19.useCallback((evt) => {
1553
1715
  setLayout(evt?.nativeEvent?.layout);
1554
1716
  }, []);
1555
1717
  const verticalScrollHandler = Animated2.useAnimatedScrollHandler({
@@ -1559,25 +1721,20 @@ var CalendarInner = (props) => {
1559
1721
  });
1560
1722
  const flashListScrollHandler = Animated2.useAnimatedScrollHandler({
1561
1723
  onScroll: (event) => {
1562
- const offsetX = event?.contentOffset?.x;
1563
- Animated2.scrollTo(headerScrollViewRef, offsetX, 0, false);
1564
- scrollX.value = offsetX;
1724
+ if (!isMultiDay) {
1725
+ const offsetX = event?.contentOffset?.x;
1726
+ Animated2.scrollTo(headerScrollViewRef, offsetX, 0, false);
1727
+ scrollX.value = offsetX;
1728
+ }
1565
1729
  }
1566
1730
  });
1567
- const resourceIds = React18.useMemo(() => {
1568
- const ids = resources?.map((item) => item?.id) || [];
1569
- if (JSON.stringify(prevResourceIdsRef.current) !== JSON.stringify(ids)) {
1570
- prevResourceIdsRef.current = ids;
1571
- }
1572
- return prevResourceIdsRef.current;
1573
- }, [resources]);
1574
- const handleBlockPress = React18.useCallback((resourceId, time) => {
1731
+ const handleBlockPress = React19.useCallback((resourceId, time) => {
1575
1732
  Haptics__namespace.impactAsync(Haptics__namespace.ImpactFeedbackStyle.Medium);
1576
1733
  const resource = resources.find((r) => r.id === resourceId);
1577
1734
  if (onBlockLongPress)
1578
1735
  onBlockLongPress(resource, new Date(time));
1579
1736
  }, [resources, onBlockLongPress]);
1580
- React18.useEffect(() => {
1737
+ React19.useEffect(() => {
1581
1738
  const handleOrientationChange = () => {
1582
1739
  if (selectedEvent)
1583
1740
  setSelectedEvent(null);
@@ -1587,37 +1744,41 @@ var CalendarInner = (props) => {
1587
1744
  subscription.remove();
1588
1745
  };
1589
1746
  }, [setSelectedEvent, selectedEvent]);
1590
- React18.useEffect(() => {
1747
+ React19.useEffect(() => {
1591
1748
  dateRef.current = date;
1592
1749
  }, [date]);
1593
- const renderItem = React18.useCallback(({ item }) => {
1594
- return /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { key: item, style: { width: APPOINTMENT_BLOCK_WIDTH } }, /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: styles7.timelineContainer }, /* @__PURE__ */ React18__namespace.default.createElement(
1750
+ const renderItem = React19.useCallback(({ item, index }) => {
1751
+ const rid = !isMultiDay ? item : activeResourceId ?? resourceIds[0];
1752
+ const dayDate = !isMultiDay ? void 0 : item.dayDate;
1753
+ return /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { key: index, style: { width: APPOINTMENT_BLOCK_WIDTH } }, /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: styles7.timelineContainer }, /* @__PURE__ */ React19__namespace.default.createElement(
1595
1754
  EventGridBlocksSkia,
1596
1755
  {
1597
- dateRef,
1598
1756
  hourHeight,
1599
1757
  APPOINTMENT_BLOCK_WIDTH,
1600
- handleBlockPress: (date2) => handleBlockPress(item, date2)
1758
+ handleBlockPress: (time) => handleBlockPress(rid, combineDateAndTime(dayDate ?? dateRef.current, time))
1601
1759
  }
1602
- ), /* @__PURE__ */ React18__namespace.default.createElement(
1760
+ ), /* @__PURE__ */ React19__namespace.default.createElement(
1603
1761
  DisabledIntervals_default,
1604
1762
  {
1605
- id: item,
1763
+ id: rid,
1764
+ date: dayDate,
1606
1765
  APPOINTMENT_BLOCK_WIDTH,
1607
1766
  hourHeight
1608
1767
  }
1609
- ), /* @__PURE__ */ React18__namespace.default.createElement(
1768
+ ), /* @__PURE__ */ React19__namespace.default.createElement(
1610
1769
  DisabledBlocks_default,
1611
1770
  {
1612
- id: item,
1771
+ id: rid,
1772
+ date: dayDate,
1613
1773
  APPOINTMENT_BLOCK_WIDTH,
1614
1774
  hourHeight,
1615
1775
  onDisabledBlockPress: stableOnDisabledBlockPress
1616
1776
  }
1617
- ), /* @__PURE__ */ React18__namespace.default.createElement(
1777
+ ), /* @__PURE__ */ React19__namespace.default.createElement(
1618
1778
  EventBlocks_default,
1619
1779
  {
1620
- id: item,
1780
+ id: rid,
1781
+ date: dayDate,
1621
1782
  EVENT_BLOCK_WIDTH: APPOINTMENT_BLOCK_WIDTH,
1622
1783
  hourHeight,
1623
1784
  onPress: stableOnPress,
@@ -1629,6 +1790,8 @@ var CalendarInner = (props) => {
1629
1790
  }
1630
1791
  )));
1631
1792
  }, [
1793
+ isMultiDay,
1794
+ activeResourceId,
1632
1795
  resourceIds,
1633
1796
  APPOINTMENT_BLOCK_WIDTH,
1634
1797
  hourHeight,
@@ -1641,7 +1804,7 @@ var CalendarInner = (props) => {
1641
1804
  stableOnDisabledBlockPress,
1642
1805
  dateRef
1643
1806
  ]);
1644
- return /* @__PURE__ */ React18__namespace.default.createElement(React18__namespace.default.Fragment, null, /* @__PURE__ */ React18__namespace.default.createElement(StoreFeeder, { resources, store: binding }), /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: { flex: 1 } }, /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, null, /* @__PURE__ */ React18__namespace.default.createElement(
1807
+ return /* @__PURE__ */ React19__namespace.default.createElement(React19__namespace.default.Fragment, null, /* @__PURE__ */ React19__namespace.default.createElement(StoreFeeder, { resources, store: binding, baseDate: date }), /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: { flex: 1 } }, !isMultiDay ? /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, null, /* @__PURE__ */ React19__namespace.default.createElement(
1645
1808
  Animated2__default.default.ScrollView,
1646
1809
  {
1647
1810
  style: { backgroundColor: "white" },
@@ -1657,15 +1820,25 @@ var CalendarInner = (props) => {
1657
1820
  ref: headerScrollViewRef,
1658
1821
  scrollEnabled: false
1659
1822
  },
1660
- /* @__PURE__ */ React18__namespace.default.createElement(
1823
+ /* @__PURE__ */ React19__namespace.default.createElement(
1661
1824
  ResourcesComponent,
1662
1825
  {
1826
+ date: dateRef.current,
1663
1827
  resourceIds,
1664
1828
  APPOINTMENT_BLOCK_WIDTH,
1665
1829
  onResourcePress
1666
1830
  }
1667
1831
  )
1668
- )), /* @__PURE__ */ React18__namespace.default.createElement(reactNativeGestureHandler.GestureDetector, { gesture: panGesture }, /* @__PURE__ */ React18__namespace.default.createElement(
1832
+ )) : /* @__PURE__ */ React19__namespace.default.createElement(
1833
+ DaysComponent,
1834
+ {
1835
+ APPOINTMENT_BLOCK_WIDTH,
1836
+ date,
1837
+ mode,
1838
+ activeResourceId: activeResourceId ?? resourceIds[0],
1839
+ onResourcePress
1840
+ }
1841
+ ), /* @__PURE__ */ React19__namespace.default.createElement(reactNativeGestureHandler.GestureDetector, { gesture: panGesture }, /* @__PURE__ */ React19__namespace.default.createElement(
1669
1842
  Animated2__default.default.View,
1670
1843
  {
1671
1844
  key: numberOfColumns + width + hourHeight,
@@ -1675,7 +1848,7 @@ var CalendarInner = (props) => {
1675
1848
  overflow: "hidden"
1676
1849
  }
1677
1850
  },
1678
- selectedEvent && /* @__PURE__ */ React18__namespace.default.createElement(reactNative.View, { style: {
1851
+ selectedEvent && /* @__PURE__ */ React19__namespace.default.createElement(reactNative.View, { style: {
1679
1852
  position: "absolute",
1680
1853
  top: 0,
1681
1854
  left: TIME_LABEL_WIDTH,
@@ -1685,7 +1858,7 @@ var CalendarInner = (props) => {
1685
1858
  backgroundColor: "rgba(0, 0, 0, 0.1)",
1686
1859
  zIndex: 1
1687
1860
  } }),
1688
- /* @__PURE__ */ React18__namespace.default.createElement(
1861
+ /* @__PURE__ */ React19__namespace.default.createElement(
1689
1862
  Animated2__default.default.ScrollView,
1690
1863
  {
1691
1864
  scrollEnabled: !selectedEvent,
@@ -1698,7 +1871,7 @@ var CalendarInner = (props) => {
1698
1871
  style: styles7.container,
1699
1872
  contentContainerStyle: { flexDirection: "row", paddingRight: TIME_LABEL_WIDTH }
1700
1873
  },
1701
- /* @__PURE__ */ React18__namespace.default.createElement(
1874
+ /* @__PURE__ */ React19__namespace.default.createElement(
1702
1875
  TimeLabels,
1703
1876
  {
1704
1877
  startMinutes,
@@ -1710,7 +1883,7 @@ var CalendarInner = (props) => {
1710
1883
  ref: verticalScrollViewRef
1711
1884
  }
1712
1885
  ),
1713
- /* @__PURE__ */ React18__namespace.default.createElement(
1886
+ /* @__PURE__ */ React19__namespace.default.createElement(
1714
1887
  AnimatedFlashList,
1715
1888
  {
1716
1889
  extraData: numberOfColumns + width + hourHeight + (overLappingLayoutMode === "stacked" ? 1 : 0),
@@ -1719,7 +1892,7 @@ var CalendarInner = (props) => {
1719
1892
  onScroll: flashListScrollHandler,
1720
1893
  estimatedItemSize: APPOINTMENT_BLOCK_WIDTH,
1721
1894
  removeClippedSubviews: true,
1722
- data: resourceIds,
1895
+ data: !isMultiDay ? resourceIds : columns,
1723
1896
  horizontal: true,
1724
1897
  renderItem,
1725
1898
  keyExtractor: (item, index) => index + "",
@@ -1729,7 +1902,7 @@ var CalendarInner = (props) => {
1729
1902
  }
1730
1903
  )
1731
1904
  ),
1732
- selectedEvent && /* @__PURE__ */ React18__namespace.default.createElement(
1905
+ selectedEvent && /* @__PURE__ */ React19__namespace.default.createElement(
1733
1906
  DraggableEvent,
1734
1907
  {
1735
1908
  selectedEvent,
@@ -1746,7 +1919,7 @@ var CalendarInner = (props) => {
1746
1919
  ))));
1747
1920
  };
1748
1921
  var Calendar = ({ theme, ...rest }) => {
1749
- return /* @__PURE__ */ React18__namespace.default.createElement(CalendarThemeProvider, { theme }, /* @__PURE__ */ React18__namespace.default.createElement(CalendarInner, { ...rest }));
1922
+ return /* @__PURE__ */ React19__namespace.default.createElement(CalendarThemeProvider, { theme }, /* @__PURE__ */ React19__namespace.default.createElement(CalendarInner, { ...rest }));
1750
1923
  };
1751
1924
  var styles7 = reactNative.StyleSheet.create({
1752
1925
  container: {