@vesture/react 0.3.0 → 0.3.2

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,11 +1,12 @@
1
- // src/components/Button/Button.tsx
2
- import { forwardRef } from "react";
3
-
4
- // src/components/Button/Button.css.ts
5
- var button = "Button_button__w1yuq20";
6
- var variant = { primary: "Button_variant_primary__w1yuq21", secondary: "Button_variant_secondary__w1yuq22", ghost: "Button_variant_ghost__w1yuq23" };
1
+ import {
2
+ button,
3
+ card,
4
+ elevation,
5
+ variant
6
+ } from "./chunk-QKEAWZP5.js";
7
7
 
8
8
  // src/components/Button/Button.tsx
9
+ import { forwardRef } from "react";
9
10
  import { jsx } from "react/jsx-runtime";
10
11
  var Button = forwardRef(
11
12
  function Button2({ variant: variantProp = "primary", className, ...rest }, ref) {
@@ -152,12 +153,6 @@ var Switch = forwardRef8(function Switch2({ label: label4, className, ...rest },
152
153
 
153
154
  // src/components/Card/Card.tsx
154
155
  import { forwardRef as forwardRef9 } from "react";
155
-
156
- // src/components/Card/Card.css.ts
157
- var card = "Card_card__mv7u2g0";
158
- var elevation = { flat: "Card_elevation_flat__mv7u2g1", raised: "Card_elevation_raised__mv7u2g2", overlay: "Card_elevation_overlay__mv7u2g3" };
159
-
160
- // src/components/Card/Card.tsx
161
156
  import { jsx as jsx9 } from "react/jsx-runtime";
162
157
  var Card = forwardRef9(function Card2({ elevation: elevationProp = "flat", className, ...rest }, ref) {
163
158
  const classes = [card, elevation[elevationProp], className].filter(Boolean).join(" ");
@@ -2001,8 +1996,7 @@ var root2 = "Calendar_root__1uy43my0";
2001
1996
  var weekRow = "Calendar_weekRow__1uy43my5";
2002
1997
  var weekdayCell = "Calendar_weekdayCell__1uy43my6";
2003
1998
 
2004
- // src/components/Calendar/Calendar.tsx
2005
- import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
1999
+ // src/utils/date.ts
2006
2000
  function startOfMonth(date) {
2007
2001
  return new Date(date.getFullYear(), date.getMonth(), 1);
2008
2002
  }
@@ -2038,6 +2032,9 @@ function endOfWeek(date, weekStartsOn) {
2038
2032
  function dateKey(date) {
2039
2033
  return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
2040
2034
  }
2035
+
2036
+ // src/components/Calendar/Calendar.tsx
2037
+ import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
2041
2038
  function getCalendarWeeks(month, weekStartsOn) {
2042
2039
  const gridStart = startOfWeek(startOfMonth(month), weekStartsOn);
2043
2040
  const gridEnd = endOfWeek(endOfMonth(month), weekStartsOn);
@@ -5585,8 +5582,639 @@ function InteractivePieChart({
5585
5582
  ] });
5586
5583
  }
5587
5584
 
5585
+ // src/components/Scheduler/Scheduler.tsx
5586
+ import { useMemo as useMemo10, useRef as useRef12, useState as useState21 } from "react";
5587
+
5588
+ // src/components/Scheduler/Scheduler.css.ts
5589
+ var allDayCell = "Scheduler_allDayCell__1to95h2c";
5590
+ var allDayEventBlock = "Scheduler_allDayEventBlock__1to95h2o";
5591
+ var allDayGutter = "Scheduler_allDayGutter__1to95h2b";
5592
+ var allDayRow = "Scheduler_allDayRow__1to95h2a";
5593
+ var dayColumn = "Scheduler_dayColumn__1to95h2g";
5594
+ var dayHeaderCell = "Scheduler_dayHeaderCell__1to95h28";
5595
+ var dayHeaderDateNumber = "Scheduler_dayHeaderDateNumber__1to95h29";
5596
+ var dayHeaderGutter = "Scheduler_dayHeaderGutter__1to95h27";
5597
+ var dayHeaderRow = "Scheduler_dayHeaderRow__1to95h26";
5598
+ var dragPreview = "Scheduler_dragPreview__1to95h2l";
5599
+ var dragPreviewLabel = "Scheduler_dragPreviewLabel__1to95h2m";
5600
+ var eventBlock = "Scheduler_eventBlock__1to95h2j";
5601
+ var eventTime = "Scheduler_eventTime__1to95h2q";
5602
+ var eventTitle = "Scheduler_eventTitle__1to95h2p";
5603
+ var header2 = "Scheduler_header__1to95h21";
5604
+ var headerNav = "Scheduler_headerNav__1to95h22";
5605
+ var hourLabel = "Scheduler_hourLabel__1to95h2f";
5606
+ var navButton2 = "Scheduler_navButton__1to95h23";
5607
+ var nowLine = "Scheduler_nowLine__1to95h2h";
5608
+ var nowLineDot = "Scheduler_nowLineDot__1to95h2i";
5609
+ var rangeLabel = "Scheduler_rangeLabel__1to95h25";
5610
+ var resizeHandle2 = "Scheduler_resizeHandle__1to95h2k";
5611
+ var root9 = "Scheduler_root__1to95h20";
5612
+ var scrollArea = "Scheduler_scrollArea__1to95h2d";
5613
+ var timeGutter = "Scheduler_timeGutter__1to95h2e";
5614
+ var todayButton = "Scheduler_todayButton__1to95h24";
5615
+ var visuallyHidden = "Scheduler_visuallyHidden__1to95h2n";
5616
+
5617
+ // src/components/Scheduler/scheduler-layout.ts
5618
+ import { vars as vars12 } from "@vesture/tokens";
5619
+ var SLOT_HEIGHT_PX = 24;
5620
+ function layoutOverlappingEvents(events) {
5621
+ if (events.length === 0) return [];
5622
+ const sorted = [...events].sort((a, b) => {
5623
+ const startDiff = a.start.getTime() - b.start.getTime();
5624
+ if (startDiff !== 0) return startDiff;
5625
+ return a.end.getTime() - b.end.getTime();
5626
+ });
5627
+ const results = /* @__PURE__ */ new Map();
5628
+ let cluster = [];
5629
+ let clusterEnd = -Infinity;
5630
+ const flushCluster = () => {
5631
+ if (cluster.length === 0) return;
5632
+ const columnEndTimes = [];
5633
+ for (const event of cluster) {
5634
+ const startTime = event.start.getTime();
5635
+ let columnIndex = columnEndTimes.findIndex((end) => end <= startTime);
5636
+ if (columnIndex === -1) {
5637
+ columnIndex = columnEndTimes.length;
5638
+ columnEndTimes.push(event.end.getTime());
5639
+ } else {
5640
+ columnEndTimes[columnIndex] = event.end.getTime();
5641
+ }
5642
+ results.set(event.id, { id: event.id, columnIndex, columnCount: 0 });
5643
+ }
5644
+ const columnCount = columnEndTimes.length;
5645
+ for (const event of cluster) {
5646
+ results.get(event.id).columnCount = columnCount;
5647
+ }
5648
+ cluster = [];
5649
+ };
5650
+ for (const event of sorted) {
5651
+ const startTime = event.start.getTime();
5652
+ const endTime = event.end.getTime();
5653
+ if (cluster.length === 0 || startTime < clusterEnd) {
5654
+ cluster.push(event);
5655
+ clusterEnd = Math.max(clusterEnd, endTime);
5656
+ } else {
5657
+ flushCluster();
5658
+ cluster.push(event);
5659
+ clusterEnd = endTime;
5660
+ }
5661
+ }
5662
+ flushCluster();
5663
+ return events.map((event) => results.get(event.id));
5664
+ }
5665
+ function getVerticalMetrics(start, end, startHour, endHour) {
5666
+ const rangeStartMinutes = startHour * 60;
5667
+ const rangeEndMinutes = endHour * 60;
5668
+ const totalMinutes = rangeEndMinutes - rangeStartMinutes;
5669
+ if (totalMinutes <= 0) return null;
5670
+ const startMinutes = start.getHours() * 60 + start.getMinutes();
5671
+ const endMinutes = end.getHours() * 60 + end.getMinutes();
5672
+ const clippedStart = Math.max(startMinutes, rangeStartMinutes);
5673
+ const clippedEnd = Math.min(endMinutes, rangeEndMinutes);
5674
+ if (clippedEnd <= clippedStart) return null;
5675
+ return {
5676
+ top: (clippedStart - rangeStartMinutes) / totalMinutes * 100,
5677
+ height: (clippedEnd - clippedStart) / totalMinutes * 100
5678
+ };
5679
+ }
5680
+ function pixelDeltaToSnappedMinutes(deltaPx, slotDuration) {
5681
+ const rawSlots = deltaPx / SLOT_HEIGHT_PX;
5682
+ return Math.round(rawSlots) * slotDuration;
5683
+ }
5684
+ function minutesOfDay(date) {
5685
+ return date.getHours() * 60 + date.getMinutes();
5686
+ }
5687
+ function combineDayAndMinutes(day, minutesOfDayValue) {
5688
+ const result = new Date(day.getFullYear(), day.getMonth(), day.getDate());
5689
+ result.setMinutes(minutesOfDayValue);
5690
+ return result;
5691
+ }
5692
+ function computeMoveResult(params) {
5693
+ const { originalStart, originalEnd, targetDay, deltaYPx, slotDuration, startHour, endHour } = params;
5694
+ const durationMinutes = (originalEnd.getTime() - originalStart.getTime()) / 6e4;
5695
+ const deltaMinutes = pixelDeltaToSnappedMinutes(deltaYPx, slotDuration);
5696
+ const rawStartMinutes = minutesOfDay(originalStart) + deltaMinutes;
5697
+ const rangeStart = startHour * 60;
5698
+ const rangeEnd = endHour * 60;
5699
+ const maxStart = Math.max(rangeStart, rangeEnd - durationMinutes);
5700
+ const clampedStartMinutes = Math.min(Math.max(rawStartMinutes, rangeStart), maxStart);
5701
+ const start = combineDayAndMinutes(targetDay, clampedStartMinutes);
5702
+ const end = new Date(start.getTime() + durationMinutes * 6e4);
5703
+ return { start, end };
5704
+ }
5705
+ function computeResizeResult(params) {
5706
+ const { originalStart, originalEnd, deltaYPx, slotDuration, minEventDuration, endHour } = params;
5707
+ const deltaMinutes = pixelDeltaToSnappedMinutes(deltaYPx, slotDuration);
5708
+ const rawEndMinutes = minutesOfDay(originalEnd) + deltaMinutes;
5709
+ const startMinutes = minutesOfDay(originalStart);
5710
+ const rangeEnd = endHour * 60;
5711
+ const clampedEndMinutes = Math.min(
5712
+ Math.max(rawEndMinutes, startMinutes + minEventDuration),
5713
+ rangeEnd
5714
+ );
5715
+ const end = combineDayAndMinutes(originalStart, clampedEndMinutes);
5716
+ return { end };
5717
+ }
5718
+ var SERIES_COLOR_CYCLE4 = [
5719
+ vars12.chart.series1,
5720
+ vars12.chart.series2,
5721
+ vars12.chart.series3,
5722
+ vars12.chart.series4,
5723
+ vars12.chart.series5,
5724
+ vars12.chart.series6,
5725
+ vars12.chart.series7,
5726
+ vars12.chart.series8
5727
+ ];
5728
+ function hashStringToIndex(value, bucketCount) {
5729
+ let hash = 5381;
5730
+ for (let i = 0; i < value.length; i++) {
5731
+ hash = hash * 33 ^ value.charCodeAt(i);
5732
+ }
5733
+ return Math.abs(hash) % bucketCount;
5734
+ }
5735
+ function getEventColor(id, override) {
5736
+ if (override) return override;
5737
+ return SERIES_COLOR_CYCLE4[hashStringToIndex(id, SERIES_COLOR_CYCLE4.length)];
5738
+ }
5739
+
5740
+ // src/components/Scheduler/Scheduler.tsx
5741
+ import { jsx as jsx51, jsxs as jsxs34 } from "react/jsx-runtime";
5742
+ function formatEventTime(date, locale) {
5743
+ return new Intl.DateTimeFormat(locale, {
5744
+ hour: "numeric",
5745
+ minute: "2-digit"
5746
+ }).format(date);
5747
+ }
5748
+ function Scheduler({
5749
+ events,
5750
+ date,
5751
+ onDateChange,
5752
+ weekStartsOn = 1,
5753
+ startHour = 0,
5754
+ endHour = 24,
5755
+ slotDuration = 30,
5756
+ onEventClick,
5757
+ onEventChange,
5758
+ editable = false,
5759
+ minEventDuration,
5760
+ selectedEventId,
5761
+ locale = "en-US",
5762
+ className
5763
+ }) {
5764
+ const weekStart = useMemo10(
5765
+ () => startOfWeek(clampToMidnight(date), weekStartsOn),
5766
+ [date, weekStartsOn]
5767
+ );
5768
+ const days = useMemo10(
5769
+ () => Array.from({ length: 7 }, (_, i) => addDays(weekStart, i)),
5770
+ [weekStart]
5771
+ );
5772
+ const today = useMemo10(() => clampToMidnight(/* @__PURE__ */ new Date()), []);
5773
+ const now = useMemo10(() => /* @__PURE__ */ new Date(), []);
5774
+ const weekdayFormatter = useMemo10(
5775
+ () => new Intl.DateTimeFormat(locale, { weekday: "short" }),
5776
+ [locale]
5777
+ );
5778
+ const dayNumberFormatter = useMemo10(
5779
+ () => new Intl.DateTimeFormat(locale, { day: "numeric" }),
5780
+ [locale]
5781
+ );
5782
+ const monthDayFormatter = useMemo10(
5783
+ () => new Intl.DateTimeFormat(locale, { month: "short", day: "numeric" }),
5784
+ [locale]
5785
+ );
5786
+ const yearFormatter = useMemo10(
5787
+ () => new Intl.DateTimeFormat(locale, { year: "numeric" }),
5788
+ [locale]
5789
+ );
5790
+ const hourFormatter = useMemo10(
5791
+ () => new Intl.DateTimeFormat(locale, { hour: "numeric" }),
5792
+ [locale]
5793
+ );
5794
+ const weekdayLongFormatter = useMemo10(
5795
+ () => new Intl.DateTimeFormat(locale, { weekday: "long" }),
5796
+ [locale]
5797
+ );
5798
+ const weekEnd = days[6];
5799
+ const rangeLabelText = `${monthDayFormatter.format(weekStart)} \u2013 ${monthDayFormatter.format(weekEnd)}, ${yearFormatter.format(weekEnd)}`;
5800
+ const totalMinutes = (endHour - startHour) * 60;
5801
+ const slotsCount = Math.max(1, Math.ceil(totalMinutes / slotDuration));
5802
+ const totalHeightPx = slotsCount * SLOT_HEIGHT_PX;
5803
+ const resolvedMinEventDuration = minEventDuration ?? slotDuration;
5804
+ const hourMarks = useMemo10(() => {
5805
+ const marks = [];
5806
+ for (let hour = startHour; hour <= endHour; hour++) {
5807
+ const labelDate = new Date(2e3, 0, 1, hour === 24 ? 0 : hour, 0);
5808
+ marks.push({
5809
+ hour,
5810
+ label: hourFormatter.format(labelDate),
5811
+ top: (hour - startHour) * 60 / totalMinutes * 100
5812
+ });
5813
+ }
5814
+ return marks;
5815
+ }, [startHour, endHour, totalMinutes, hourFormatter]);
5816
+ const nowMinutes = now.getHours() * 60 + now.getMinutes();
5817
+ const showNowLine = nowMinutes >= startHour * 60 && nowMinutes < endHour * 60;
5818
+ const nowTop = (nowMinutes - startHour * 60) / totalMinutes * 100;
5819
+ const allDayEventsByDay = useMemo10(
5820
+ () => days.map(
5821
+ (day) => events.filter((event) => event.allDay && isSameDay(event.start, day))
5822
+ ),
5823
+ [days, events]
5824
+ );
5825
+ const timedEventsByDay = useMemo10(
5826
+ () => days.map((day) => {
5827
+ const dayEvents = events.filter(
5828
+ (event) => !event.allDay && isSameDay(event.start, day)
5829
+ );
5830
+ const layout = layoutOverlappingEvents(
5831
+ dayEvents.map((event) => ({
5832
+ id: event.id,
5833
+ start: event.start,
5834
+ end: event.end
5835
+ }))
5836
+ );
5837
+ const layoutById = new Map(layout.map((l) => [l.id, l]));
5838
+ return dayEvents.map((event) => {
5839
+ const metrics = getVerticalMetrics(
5840
+ event.start,
5841
+ event.end,
5842
+ startHour,
5843
+ endHour
5844
+ );
5845
+ if (!metrics) return null;
5846
+ const placement = layoutById.get(event.id);
5847
+ return { event, metrics, placement };
5848
+ }).filter(
5849
+ (entry) => entry !== null
5850
+ );
5851
+ }),
5852
+ [days, events, startHour, endHour]
5853
+ );
5854
+ const [drag, setDrag] = useState21(null);
5855
+ const [announcement, setAnnouncement] = useState21("");
5856
+ const suppressClickRef = useRef12(false);
5857
+ const dayColumnRefs = useRef12([]);
5858
+ const announceMove = (event, start, end) => {
5859
+ setAnnouncement(
5860
+ `${event.title} moved to ${weekdayLongFormatter.format(start)}, ${formatEventTime(start, locale)} to ${formatEventTime(end, locale)}.`
5861
+ );
5862
+ };
5863
+ const announceResize = (event, end) => {
5864
+ setAnnouncement(
5865
+ `${event.title} resized to end at ${formatEventTime(end, locale)}.`
5866
+ );
5867
+ };
5868
+ const handleEventActivate = (event) => {
5869
+ if (suppressClickRef.current) {
5870
+ suppressClickRef.current = false;
5871
+ return;
5872
+ }
5873
+ onEventClick?.(event);
5874
+ };
5875
+ const handleMovePointerDown = (event, dayIndex) => (pointerEvent) => {
5876
+ if (!editable) return;
5877
+ pointerEvent.preventDefault();
5878
+ const target = pointerEvent.currentTarget;
5879
+ try {
5880
+ target.setPointerCapture(pointerEvent.pointerId);
5881
+ } catch {
5882
+ }
5883
+ target.focus();
5884
+ setDrag({
5885
+ kind: "move",
5886
+ event,
5887
+ pointerId: pointerEvent.pointerId,
5888
+ startClientX: pointerEvent.clientX,
5889
+ startClientY: pointerEvent.clientY,
5890
+ startDayIndex: dayIndex,
5891
+ currentDayIndex: dayIndex,
5892
+ currentStart: event.start,
5893
+ currentEnd: event.end,
5894
+ moved: false
5895
+ });
5896
+ };
5897
+ const handleResizePointerDown = (event, dayIndex) => (pointerEvent) => {
5898
+ if (!editable) return;
5899
+ pointerEvent.preventDefault();
5900
+ pointerEvent.stopPropagation();
5901
+ const target = pointerEvent.currentTarget;
5902
+ try {
5903
+ target.setPointerCapture(pointerEvent.pointerId);
5904
+ } catch {
5905
+ }
5906
+ setDrag({
5907
+ kind: "resize",
5908
+ event,
5909
+ pointerId: pointerEvent.pointerId,
5910
+ startClientX: pointerEvent.clientX,
5911
+ startClientY: pointerEvent.clientY,
5912
+ startDayIndex: dayIndex,
5913
+ currentDayIndex: dayIndex,
5914
+ currentStart: event.start,
5915
+ currentEnd: event.end,
5916
+ moved: false
5917
+ });
5918
+ };
5919
+ const handleDragPointerMove = (pointerEvent) => {
5920
+ if (!drag || pointerEvent.pointerId !== drag.pointerId) return;
5921
+ pointerEvent.stopPropagation();
5922
+ const deltaY = pointerEvent.clientY - drag.startClientY;
5923
+ if (drag.kind === "move") {
5924
+ const deltaX = pointerEvent.clientX - drag.startClientX;
5925
+ const columnWidth = dayColumnRefs.current[drag.startDayIndex]?.getBoundingClientRect().width ?? 0;
5926
+ const dayDelta = columnWidth > 0 ? Math.round(deltaX / columnWidth) : 0;
5927
+ const targetDayIndex = Math.min(6, Math.max(0, drag.startDayIndex + dayDelta));
5928
+ const targetDay = days[targetDayIndex];
5929
+ const { start, end } = computeMoveResult({
5930
+ originalStart: drag.event.start,
5931
+ originalEnd: drag.event.end,
5932
+ targetDay,
5933
+ deltaYPx: deltaY,
5934
+ slotDuration,
5935
+ startHour,
5936
+ endHour
5937
+ });
5938
+ const moved = targetDayIndex !== drag.startDayIndex || start.getTime() !== drag.event.start.getTime();
5939
+ setDrag({ ...drag, currentDayIndex: targetDayIndex, currentStart: start, currentEnd: end, moved });
5940
+ } else {
5941
+ const { end } = computeResizeResult({
5942
+ originalStart: drag.event.start,
5943
+ originalEnd: drag.event.end,
5944
+ deltaYPx: deltaY,
5945
+ slotDuration,
5946
+ minEventDuration: resolvedMinEventDuration,
5947
+ endHour
5948
+ });
5949
+ const moved = end.getTime() !== drag.event.end.getTime();
5950
+ setDrag({ ...drag, currentEnd: end, moved });
5951
+ }
5952
+ };
5953
+ const handleDragPointerUp = (pointerEvent) => {
5954
+ if (!drag || pointerEvent.pointerId !== drag.pointerId) return;
5955
+ pointerEvent.stopPropagation();
5956
+ const finished = drag;
5957
+ setDrag(null);
5958
+ if (finished.kind === "move") {
5959
+ if (!finished.moved) {
5960
+ suppressClickRef.current = true;
5961
+ onEventClick?.(finished.event);
5962
+ return;
5963
+ }
5964
+ onEventChange?.(finished.event, finished.currentStart, finished.currentEnd);
5965
+ announceMove(finished.event, finished.currentStart, finished.currentEnd);
5966
+ return;
5967
+ }
5968
+ if (!finished.moved) return;
5969
+ onEventChange?.(finished.event, finished.currentStart, finished.currentEnd);
5970
+ announceResize(finished.event, finished.currentEnd);
5971
+ };
5972
+ const handleDragPointerCancel = (pointerEvent) => {
5973
+ if (!drag || pointerEvent.pointerId !== drag.pointerId) return;
5974
+ pointerEvent.stopPropagation();
5975
+ setDrag(null);
5976
+ };
5977
+ const handleEventKeyDown = (keyboardEvent, event, dayIndex) => {
5978
+ if (!editable) return;
5979
+ if (keyboardEvent.shiftKey && (keyboardEvent.key === "ArrowDown" || keyboardEvent.key === "ArrowUp")) {
5980
+ keyboardEvent.preventDefault();
5981
+ const direction2 = keyboardEvent.key === "ArrowDown" ? 1 : -1;
5982
+ const { end } = computeResizeResult({
5983
+ originalStart: event.start,
5984
+ originalEnd: event.end,
5985
+ deltaYPx: direction2 * SLOT_HEIGHT_PX,
5986
+ slotDuration,
5987
+ minEventDuration: resolvedMinEventDuration,
5988
+ endHour
5989
+ });
5990
+ if (end.getTime() === event.end.getTime()) return;
5991
+ onEventChange?.(event, event.start, end);
5992
+ announceResize(event, end);
5993
+ return;
5994
+ }
5995
+ switch (keyboardEvent.key) {
5996
+ case "ArrowUp":
5997
+ case "ArrowDown": {
5998
+ keyboardEvent.preventDefault();
5999
+ const direction2 = keyboardEvent.key === "ArrowDown" ? 1 : -1;
6000
+ const { start, end } = computeMoveResult({
6001
+ originalStart: event.start,
6002
+ originalEnd: event.end,
6003
+ targetDay: days[dayIndex],
6004
+ deltaYPx: direction2 * SLOT_HEIGHT_PX,
6005
+ slotDuration,
6006
+ startHour,
6007
+ endHour
6008
+ });
6009
+ if (start.getTime() === event.start.getTime()) return;
6010
+ onEventChange?.(event, start, end);
6011
+ announceMove(event, start, end);
6012
+ break;
6013
+ }
6014
+ case "ArrowLeft":
6015
+ case "ArrowRight": {
6016
+ keyboardEvent.preventDefault();
6017
+ const direction2 = keyboardEvent.key === "ArrowRight" ? 1 : -1;
6018
+ const targetDayIndex = Math.min(6, Math.max(0, dayIndex + direction2));
6019
+ if (targetDayIndex === dayIndex) return;
6020
+ const { start, end } = computeMoveResult({
6021
+ originalStart: event.start,
6022
+ originalEnd: event.end,
6023
+ targetDay: days[targetDayIndex],
6024
+ deltaYPx: 0,
6025
+ slotDuration,
6026
+ startHour,
6027
+ endHour
6028
+ });
6029
+ onEventChange?.(event, start, end);
6030
+ announceMove(event, start, end);
6031
+ break;
6032
+ }
6033
+ default:
6034
+ return;
6035
+ }
6036
+ };
6037
+ const dragPreviewMetrics = drag && drag.kind === "move" ? getVerticalMetrics(drag.currentStart, drag.currentEnd, startHour, endHour) : null;
6038
+ return /* @__PURE__ */ jsxs34("div", { className: [root9, className].filter(Boolean).join(" "), children: [
6039
+ /* @__PURE__ */ jsx51(
6040
+ "div",
6041
+ {
6042
+ "aria-live": "polite",
6043
+ className: visuallyHidden,
6044
+ children: announcement
6045
+ }
6046
+ ),
6047
+ /* @__PURE__ */ jsxs34("div", { className: header2, children: [
6048
+ /* @__PURE__ */ jsx51("span", { className: rangeLabel, children: rangeLabelText }),
6049
+ /* @__PURE__ */ jsxs34("div", { className: headerNav, children: [
6050
+ /* @__PURE__ */ jsx51(
6051
+ "button",
6052
+ {
6053
+ type: "button",
6054
+ className: navButton2,
6055
+ "aria-label": "Previous week",
6056
+ onClick: () => onDateChange?.(addDays(date, -7)),
6057
+ children: "\u2039"
6058
+ }
6059
+ ),
6060
+ /* @__PURE__ */ jsx51(
6061
+ "button",
6062
+ {
6063
+ type: "button",
6064
+ className: todayButton,
6065
+ onClick: () => onDateChange?.(/* @__PURE__ */ new Date()),
6066
+ children: "Today"
6067
+ }
6068
+ ),
6069
+ /* @__PURE__ */ jsx51(
6070
+ "button",
6071
+ {
6072
+ type: "button",
6073
+ className: navButton2,
6074
+ "aria-label": "Next week",
6075
+ onClick: () => onDateChange?.(addDays(date, 7)),
6076
+ children: "\u203A"
6077
+ }
6078
+ )
6079
+ ] })
6080
+ ] }),
6081
+ /* @__PURE__ */ jsxs34("div", { className: dayHeaderRow, children: [
6082
+ /* @__PURE__ */ jsx51("div", { className: dayHeaderGutter }),
6083
+ days.map((day) => {
6084
+ const isToday = isSameDay(day, today);
6085
+ return /* @__PURE__ */ jsxs34("div", { className: dayHeaderCell, "data-today": isToday || void 0, children: [
6086
+ /* @__PURE__ */ jsx51("span", { children: weekdayFormatter.format(day) }),
6087
+ /* @__PURE__ */ jsx51("span", { className: dayHeaderDateNumber, "data-today": isToday || void 0, children: dayNumberFormatter.format(day) })
6088
+ ] }, day.toISOString());
6089
+ })
6090
+ ] }),
6091
+ /* @__PURE__ */ jsxs34("div", { className: allDayRow, children: [
6092
+ /* @__PURE__ */ jsx51("div", { className: allDayGutter, children: "All day" }),
6093
+ days.map((day, dayIndex) => /* @__PURE__ */ jsx51("div", { className: allDayCell, children: allDayEventsByDay[dayIndex].map((event) => {
6094
+ const color = getEventColor(event.id, event.color);
6095
+ const selected = event.id === selectedEventId;
6096
+ return /* @__PURE__ */ jsx51(
6097
+ "button",
6098
+ {
6099
+ type: "button",
6100
+ className: allDayEventBlock,
6101
+ style: { background: color },
6102
+ "data-selected": selected || void 0,
6103
+ onClick: () => handleEventActivate(event),
6104
+ children: event.title
6105
+ },
6106
+ event.id
6107
+ );
6108
+ }) }, day.toISOString()))
6109
+ ] }),
6110
+ /* @__PURE__ */ jsxs34("div", { className: scrollArea, children: [
6111
+ /* @__PURE__ */ jsx51("div", { className: timeGutter, style: { height: totalHeightPx }, children: hourMarks.map((mark) => /* @__PURE__ */ jsx51(
6112
+ "span",
6113
+ {
6114
+ className: hourLabel,
6115
+ style: { top: `${mark.top}%` },
6116
+ children: mark.label
6117
+ },
6118
+ mark.hour
6119
+ )) }),
6120
+ days.map((day, dayIndex) => {
6121
+ const isToday = isSameDay(day, today);
6122
+ return /* @__PURE__ */ jsxs34(
6123
+ "div",
6124
+ {
6125
+ ref: (el) => {
6126
+ dayColumnRefs.current[dayIndex] = el;
6127
+ },
6128
+ className: dayColumn,
6129
+ style: { height: totalHeightPx },
6130
+ children: [
6131
+ isToday && showNowLine ? /* @__PURE__ */ jsx51("div", { className: nowLine, style: { top: `${nowTop}%` }, children: /* @__PURE__ */ jsx51("span", { className: nowLineDot }) }) : null,
6132
+ timedEventsByDay[dayIndex].map(({ event, metrics, placement }) => {
6133
+ const color = getEventColor(event.id, event.color);
6134
+ const selected = event.id === selectedEventId;
6135
+ const isResizingThis = drag?.kind === "resize" && drag.event.id === event.id;
6136
+ const isDraggingThis = drag?.event.id === event.id;
6137
+ const displayMetrics = isResizingThis ? getVerticalMetrics(event.start, drag.currentEnd, startHour, endHour) ?? metrics : metrics;
6138
+ const displayEnd = isResizingThis ? drag.currentEnd : event.end;
6139
+ const width = 100 / placement.columnCount;
6140
+ const left = placement.columnIndex * width;
6141
+ const showTime = displayMetrics.height > 6;
6142
+ return /* @__PURE__ */ jsxs34(
6143
+ "button",
6144
+ {
6145
+ type: "button",
6146
+ className: eventBlock,
6147
+ "data-selected": selected || void 0,
6148
+ "data-editable": editable || void 0,
6149
+ "data-dragging": isDraggingThis || void 0,
6150
+ style: {
6151
+ top: `${displayMetrics.top}%`,
6152
+ height: `${displayMetrics.height}%`,
6153
+ left: `${left}%`,
6154
+ width: `${width}%`,
6155
+ background: color
6156
+ },
6157
+ onClick: () => handleEventActivate(event),
6158
+ onPointerDown: editable ? handleMovePointerDown(event, dayIndex) : void 0,
6159
+ onPointerMove: editable ? handleDragPointerMove : void 0,
6160
+ onPointerUp: editable ? handleDragPointerUp : void 0,
6161
+ onPointerCancel: editable ? handleDragPointerCancel : void 0,
6162
+ onKeyDown: editable ? (e) => handleEventKeyDown(e, event, dayIndex) : void 0,
6163
+ children: [
6164
+ /* @__PURE__ */ jsx51("span", { className: eventTitle, children: event.title }),
6165
+ showTime ? /* @__PURE__ */ jsxs34("span", { className: eventTime, children: [
6166
+ formatEventTime(event.start, locale),
6167
+ " \u2013",
6168
+ " ",
6169
+ formatEventTime(displayEnd, locale)
6170
+ ] }) : null,
6171
+ editable ? /* @__PURE__ */ jsx51(
6172
+ "span",
6173
+ {
6174
+ className: resizeHandle2,
6175
+ onPointerDown: handleResizePointerDown(event, dayIndex),
6176
+ onPointerMove: handleDragPointerMove,
6177
+ onPointerUp: handleDragPointerUp,
6178
+ onPointerCancel: handleDragPointerCancel
6179
+ }
6180
+ ) : null
6181
+ ]
6182
+ },
6183
+ event.id
6184
+ );
6185
+ }),
6186
+ drag && drag.kind === "move" && drag.currentDayIndex === dayIndex && dragPreviewMetrics ? /* @__PURE__ */ jsxs34(
6187
+ "div",
6188
+ {
6189
+ className: dragPreview,
6190
+ style: {
6191
+ top: `${dragPreviewMetrics.top}%`,
6192
+ height: `${dragPreviewMetrics.height}%`,
6193
+ left: 0,
6194
+ width: "100%"
6195
+ },
6196
+ children: [
6197
+ /* @__PURE__ */ jsx51("span", { className: dragPreviewLabel, children: drag.event.title }),
6198
+ /* @__PURE__ */ jsxs34("span", { className: dragPreviewLabel, children: [
6199
+ formatEventTime(drag.currentStart, locale),
6200
+ " \u2013",
6201
+ " ",
6202
+ formatEventTime(drag.currentEnd, locale)
6203
+ ] })
6204
+ ]
6205
+ }
6206
+ ) : null
6207
+ ]
6208
+ },
6209
+ day.toISOString()
6210
+ );
6211
+ })
6212
+ ] })
6213
+ ] });
6214
+ }
6215
+
5588
6216
  // src/index.ts
5589
- import { vars as vars12, defaultThemeClass, defaultThemeVars } from "@vesture/tokens";
6217
+ import { vars as vars13, defaultThemeClass, defaultThemeVars } from "@vesture/tokens";
5590
6218
  export {
5591
6219
  Accordion2 as Accordion,
5592
6220
  AccordionContent,
@@ -5625,6 +6253,7 @@ export {
5625
6253
  Popover,
5626
6254
  Progress,
5627
6255
  Radio,
6256
+ Scheduler,
5628
6257
  Select,
5629
6258
  Slider,
5630
6259
  Spinner,
@@ -5642,6 +6271,6 @@ export {
5642
6271
  defaultThemeVars,
5643
6272
  useCommandPaletteShortcut,
5644
6273
  useToast,
5645
- vars12 as vars
6274
+ vars13 as vars
5646
6275
  };
5647
6276
  //# sourceMappingURL=index.js.map