@42-central/ui-react 0.17.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +36 -175
  2. package/dist/{chunk-ACE7FBWE.js → chunk-EVVMHTCL.js} +3 -3
  3. package/dist/chunk-EVVMHTCL.js.map +1 -0
  4. package/dist/{chunk-TMMEJKLI.js → chunk-NSOA3GMZ.js} +16 -3
  5. package/dist/chunk-NSOA3GMZ.js.map +1 -0
  6. package/dist/{chunk-PJL4ZL5V.js → chunk-YON5Y336.js} +3 -3
  7. package/dist/{chunk-PJL4ZL5V.js.map → chunk-YON5Y336.js.map} +1 -1
  8. package/dist/components/alert/alert.d.ts +17 -9
  9. package/dist/components/alert/alert.d.ts.map +1 -1
  10. package/dist/components/alert/index.js +2 -2
  11. package/dist/components/alert/index.js.map +1 -1
  12. package/dist/components/calendar/calendar-body.d.ts.map +1 -1
  13. package/dist/components/calendar/index.js +1 -1
  14. package/dist/components/data-table/index.js +2 -2
  15. package/dist/components/date-picker/index.js +3 -3
  16. package/dist/components/notification/create-notifier.d.ts.map +1 -1
  17. package/dist/components/notification/index.js +6 -6
  18. package/dist/components/notification/index.js.map +1 -1
  19. package/dist/components/notification/notification.d.ts +4 -4
  20. package/dist/components/notification/notification.d.ts.map +1 -1
  21. package/dist/components/schedule/index.d.ts +3 -3
  22. package/dist/components/schedule/index.js +163 -89
  23. package/dist/components/schedule/index.js.map +1 -1
  24. package/dist/components/schedule/schedule-agenda-view.d.ts +1 -1
  25. package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
  26. package/dist/components/schedule/schedule-create-draft.d.ts +3 -2
  27. package/dist/components/schedule/schedule-create-draft.d.ts.map +1 -1
  28. package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
  29. package/dist/components/schedule/schedule-days-view.d.ts +1 -1
  30. package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
  31. package/dist/components/schedule/schedule-drag-ghost.d.ts +12 -5
  32. package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -1
  33. package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
  34. package/dist/components/schedule/schedule-geometry.d.ts +16 -0
  35. package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
  36. package/dist/components/schedule/schedule-grid-gesture.d.ts +29 -6
  37. package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
  38. package/dist/components/schedule/schedule-month-view.d.ts +1 -1
  39. package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
  40. package/dist/components/schedule/schedule-next-up.d.ts +1 -1
  41. package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
  42. package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
  43. package/dist/components/schedule/schedule-toolbar.d.ts +3 -3
  44. package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
  45. package/dist/components/schedule/schedule-types.d.ts +4 -1
  46. package/dist/components/schedule/schedule-types.d.ts.map +1 -1
  47. package/dist/components/schedule/schedule-year-view.d.ts +1 -1
  48. package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
  49. package/dist/components/schedule/schedule.d.ts.map +1 -1
  50. package/dist/components/schedule/use-event-create.d.ts.map +1 -1
  51. package/dist/components/schedule/use-event-drag.d.ts.map +1 -1
  52. package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
  53. package/dist/theme.css +9 -3
  54. package/package.json +1 -1
  55. package/src/components/alert/alert.test.tsx +8 -2
  56. package/src/components/alert/alert.tsx +18 -11
  57. package/src/components/calendar/calendar-body.tsx +8 -1
  58. package/src/components/notification/create-notifier.tsx +6 -5
  59. package/src/components/notification/notification.test.tsx +15 -0
  60. package/src/components/notification/notification.tsx +4 -4
  61. package/src/components/schedule/now-cursor-line.tsx +1 -1
  62. package/src/components/schedule/schedule-agenda-view.tsx +6 -4
  63. package/src/components/schedule/schedule-all-day-row.tsx +1 -1
  64. package/src/components/schedule/schedule-create-draft.tsx +14 -5
  65. package/src/components/schedule/schedule-dates.ts +3 -2
  66. package/src/components/schedule/schedule-days-view.tsx +6 -4
  67. package/src/components/schedule/schedule-drag-ghost.tsx +27 -12
  68. package/src/components/schedule/schedule-event-chip.tsx +9 -2
  69. package/src/components/schedule/schedule-event-list-popover-content.tsx +1 -1
  70. package/src/components/schedule/schedule-geometry.ts +21 -0
  71. package/src/components/schedule/schedule-grid-gesture.test.ts +83 -1
  72. package/src/components/schedule/schedule-grid-gesture.ts +67 -28
  73. package/src/components/schedule/schedule-month-view.tsx +7 -5
  74. package/src/components/schedule/schedule-next-up.tsx +5 -3
  75. package/src/components/schedule/schedule-timed-grid.tsx +41 -3
  76. package/src/components/schedule/schedule-toolbar.tsx +23 -17
  77. package/src/components/schedule/schedule-types.ts +4 -1
  78. package/src/components/schedule/schedule-year-view.tsx +7 -5
  79. package/src/components/schedule/schedule.test.tsx +132 -14
  80. package/src/components/schedule/schedule.tsx +6 -4
  81. package/src/components/schedule/use-event-create.ts +7 -6
  82. package/src/components/schedule/use-event-drag.ts +10 -4
  83. package/src/components/schedule/use-event-resize.ts +4 -2
  84. package/src/theme.css +9 -3
  85. package/dist/chunk-ACE7FBWE.js.map +0 -1
  86. package/dist/chunk-TMMEJKLI.js.map +0 -1
@@ -5,7 +5,7 @@ import { Text } from '../../chunk-CSCVTESP.js';
5
5
  import { calendarValueToDate, dateToCalendarValue } from '../../chunk-TCWYBVIL.js';
6
6
  import { mergeRefs } from '../../chunk-UVYTJQTJ.js';
7
7
  import { Button } from '../../chunk-U5GW5EBR.js';
8
- import { devWarn } from '../../chunk-7NZSTCJO.js';
8
+ import { useLocale, useTimeZone, devWarn, DEFAULT_LOCALE } from '../../chunk-7NZSTCJO.js';
9
9
  import { Popover } from '../../chunk-VZ2TPU4B.js';
10
10
  import '../../chunk-AIQG7IIT.js';
11
11
  import { OverlayContainerProvider } from '../../chunk-7P32XCEU.js';
@@ -17,13 +17,14 @@ import '../../chunk-NSDM3FEB.js';
17
17
  import { props } from '../../chunk-WYCMIIRR.js';
18
18
  import { focusStyles } from '../../chunk-B2LCHXUB.js';
19
19
  import { cn } from '../../chunk-QP4I37PA.js';
20
- import { getLocalTimeZone, startOfWeek, getDayOfWeek, startOfMonth, endOfWeek, endOfMonth, startOfYear, endOfYear, isWeekend } from '@internationalized/date';
20
+ import { startOfWeek, getDayOfWeek, startOfMonth, endOfWeek, endOfMonth, startOfYear, endOfYear, getLocalTimeZone, isWeekend } from '@internationalized/date';
21
21
  import { ark } from '@ark-ui/react';
22
22
  import { useEffect, useRef, useCallback, useSyncExternalStore, useId, useState, useMemo, useLayoutEffect, Fragment as Fragment$1 } from 'react';
23
23
  import { match } from 'ts-pattern';
24
24
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
25
25
  import { ChevronRightIcon, ChevronLeftIcon, ChevronUpIcon, ChevronDownIcon, ArrowLeftIcon, XIcon } from 'lucide-react';
26
26
  import { cva } from 'class-variance-authority';
27
+ import { useLocaleContext } from '@ark-ui/react/locale';
27
28
  import { usePresence } from '@ark-ui/react/presence';
28
29
 
29
30
  var WEEKEND_LOCALE = "en-US";
@@ -257,7 +258,7 @@ function allDayRangeLabel(start, end, timeZone, locale) {
257
258
  return formatter.formatRange(start, lastDay).normalize("NFKC");
258
259
  }
259
260
  function formatScheduleTitle(view, date, options) {
260
- const { timeZone, locale, startOfWeek, visibleDays } = options;
261
+ const { timeZone, locale = DEFAULT_LOCALE, startOfWeek, visibleDays } = options;
261
262
  return match(view).with("days", () => {
262
263
  const days = visibleDays ?? 7;
263
264
  if (days === 1) {
@@ -265,7 +266,7 @@ function formatScheduleTitle(view, date, options) {
265
266
  }
266
267
  const range = getVisibleRange("days", date, {
267
268
  timeZone,
268
- locale: locale ?? "en-US",
269
+ locale,
269
270
  startOfWeek,
270
271
  visibleDays: days
271
272
  });
@@ -847,13 +848,14 @@ var ScheduleToolbarPrevTrigger = ({
847
848
  view,
848
849
  date,
849
850
  onDateChange,
850
- timeZone = getLocalTimeZone(),
851
+ timeZone: timeZoneProp,
851
852
  translations,
852
853
  size = "sm",
853
854
  className,
854
855
  testId,
855
856
  visibleDays
856
857
  }) => {
858
+ const timeZone = useTimeZone(timeZoneProp);
857
859
  const t = resolveScheduleTranslations(translations);
858
860
  return /* @__PURE__ */ jsx(
859
861
  ActionIcon,
@@ -865,7 +867,7 @@ var ScheduleToolbarPrevTrigger = ({
865
867
  onClick: () => onDateChange?.(paginateDate(view, date, -1, { timeZone, visibleDays })),
866
868
  className,
867
869
  testId,
868
- children: /* @__PURE__ */ jsx(ChevronLeftIcon, {})
870
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "rtl:rotate-180" })
869
871
  }
870
872
  );
871
873
  };
@@ -873,13 +875,14 @@ var ScheduleToolbarNextTrigger = ({
873
875
  view,
874
876
  date,
875
877
  onDateChange,
876
- timeZone = getLocalTimeZone(),
878
+ timeZone: timeZoneProp,
877
879
  translations,
878
880
  size = "sm",
879
881
  className,
880
882
  testId,
881
883
  visibleDays
882
884
  }) => {
885
+ const timeZone = useTimeZone(timeZoneProp);
883
886
  const t = resolveScheduleTranslations(translations);
884
887
  return /* @__PURE__ */ jsx(
885
888
  ActionIcon,
@@ -891,7 +894,7 @@ var ScheduleToolbarNextTrigger = ({
891
894
  onClick: () => onDateChange?.(paginateDate(view, date, 1, { timeZone, visibleDays })),
892
895
  className,
893
896
  testId,
894
- children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
897
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { className: "rtl:rotate-180" })
895
898
  }
896
899
  );
897
900
  };
@@ -920,23 +923,27 @@ var ScheduleToolbarNowTrigger = ({
920
923
  var ScheduleToolbarTitle = ({
921
924
  view,
922
925
  date,
923
- timeZone = getLocalTimeZone(),
924
- locale,
926
+ timeZone: timeZoneProp,
927
+ locale: localeProp,
925
928
  align,
926
929
  visibleDays,
927
930
  className,
928
931
  testId,
929
932
  ...rest
930
- }) => /* @__PURE__ */ jsx(
931
- ark.h2,
932
- {
933
- "data-schedule-part": "toolbar-title",
934
- className: cn("truncate font-semibold text-sm", className),
935
- ...props({ "data-testid": testId }),
936
- ...rest,
937
- children: formatScheduleTitle(view, date, { timeZone, locale, startOfWeek: align, visibleDays })
938
- }
939
- );
933
+ }) => {
934
+ const locale = useLocale(localeProp);
935
+ const timeZone = useTimeZone(timeZoneProp);
936
+ return /* @__PURE__ */ jsx(
937
+ ark.h2,
938
+ {
939
+ "data-schedule-part": "toolbar-title",
940
+ className: cn("truncate font-semibold text-sm", className),
941
+ ...props({ "data-testid": testId }),
942
+ ...rest,
943
+ children: formatScheduleTitle(view, date, { timeZone, locale, startOfWeek: align, visibleDays })
944
+ }
945
+ );
946
+ };
940
947
  var ScheduleToolbarViewSwitcher = ({
941
948
  view,
942
949
  onViewChange,
@@ -978,8 +985,8 @@ function AgendaView({
978
985
  withSelection = true,
979
986
  withEventDetails = true,
980
987
  renderEventDetails,
981
- locale,
982
- timeZone = getLocalTimeZone(),
988
+ locale: localeProp,
989
+ timeZone: timeZoneProp,
983
990
  translations,
984
991
  classNames,
985
992
  className,
@@ -994,6 +1001,8 @@ function AgendaView({
994
1001
  testId,
995
1002
  ...rest
996
1003
  }) {
1004
+ const locale = useLocale(localeProp);
1005
+ const timeZone = useTimeZone(timeZoneProp);
997
1006
  const [currentDate, setCurrentDate] = useUncontrolled({
998
1007
  value: date,
999
1008
  defaultValue: defaultDate,
@@ -1008,7 +1017,7 @@ function AgendaView({
1008
1017
  });
1009
1018
  const t = resolveScheduleTranslations(translations);
1010
1019
  const current = useNow(now);
1011
- const range = getVisibleRange("agenda", currentDate, { timeZone, locale: locale ?? "en-US" });
1020
+ const range = getVisibleRange("agenda", currentDate, { timeZone, locale });
1012
1021
  const groups = groupUpcomingEvents(
1013
1022
  [...data, ...staticEvents].filter((event) => rangesOverlap(event, range)),
1014
1023
  timeZone
@@ -1121,6 +1130,14 @@ function columnInsets({ column, columnCount }) {
1121
1130
  zIndex: Math.min(column + 1, MAX_CASCADE_Z_INDEX)
1122
1131
  };
1123
1132
  }
1133
+ function poolPieceInsets(columnVar) {
1134
+ const col = `var(${columnVar}, 0)`;
1135
+ const hairline = `min(${col}, 1) * 1px`;
1136
+ return {
1137
+ insetInlineStart: `calc(${col} * 100% / var(--sch-pool-columns, 1) + ${hairline})`,
1138
+ width: `calc(100% / var(--sch-pool-columns, 1) - ${hairline})`
1139
+ };
1140
+ }
1124
1141
  function resolvePxPerMinute(dayColumnEl, rect) {
1125
1142
  const totalMinutes = Number(
1126
1143
  getComputedStyle(dayColumnEl).getPropertyValue("--sch-window-minutes")
@@ -1240,7 +1257,7 @@ function NowCursorLine({
1240
1257
  "div",
1241
1258
  {
1242
1259
  "data-schedule-part": "now-indicator-dot",
1243
- className: "absolute top-0 inset-s-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-(--sch-now-line-color)"
1260
+ className: "absolute top-0 inset-s-0 size-2 -translate-x-1/2 rtl:translate-x-1/2 -translate-y-1/2 rounded-full bg-(--sch-now-line-color)"
1244
1261
  }
1245
1262
  ) : null
1246
1263
  ]
@@ -1375,7 +1392,7 @@ function ScheduleEventListPopoverContent({
1375
1392
  "aria-label": translations.back,
1376
1393
  className: "-ms-1 flex items-center gap-1 rounded-sm px-1 py-0.5 text-gray-light-500 text-xs hover:bg-black/5 dark:text-gray-dark-400 dark:hover:bg-white/8",
1377
1394
  children: [
1378
- /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-3.5" }),
1395
+ /* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-3.5 rtl:rotate-180" }),
1379
1396
  translations.back
1380
1397
  ]
1381
1398
  }
@@ -1603,7 +1620,7 @@ function AllDayEventBar({
1603
1620
  className
1604
1621
  ),
1605
1622
  children: [
1606
- event.icon != null ? /* @__PURE__ */ jsx("span", { className: "mr-1 inline-flex align-[-1px] [&_svg]:size-3", children: event.icon }) : null,
1623
+ event.icon != null ? /* @__PURE__ */ jsx("span", { className: "me-1 inline-flex align-[-1px] [&_svg]:size-3", children: event.icon }) : null,
1607
1624
  event.title
1608
1625
  ]
1609
1626
  }
@@ -1820,7 +1837,7 @@ function ScheduleCreateDraft({ className }) {
1820
1837
  "aria-hidden": true,
1821
1838
  "data-schedule-part": "create-draft",
1822
1839
  className: cn(
1823
- "group pointer-events-none absolute inset-x-0 hidden rounded-sm border-2",
1840
+ "group pointer-events-none absolute hidden rounded-sm border-2",
1824
1841
  // `select-none`, like every other chip surface in the grid. The label
1825
1842
  // rides the box's top edge, which during an upward drag *is* the
1826
1843
  // pointer position — so the browser extended a text selection straight
@@ -1903,9 +1920,15 @@ function ScheduleCreateDraft({ className }) {
1903
1920
  * Easing per direction comes from whichever state the transition heads
1904
1921
  * *to*, so the base carries `ease-in` (the leave) and `data-active` the
1905
1922
  * `ease-out` (the enter). `allow-discrete` rides on `display` alone.
1923
+ *
1924
+ * `inset-inline-start` is the drag ghost's day-change slide. A draft
1925
+ * piece is keyed by its own column (create and resize are pinned where
1926
+ * they began, and only grow or shrink), so it never changes column
1927
+ * mid-gesture; it is listed so the two previews stay one declaration
1928
+ * apart, as `height` is on the ghost.
1906
1929
  */
1907
- "[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
1908
- "data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
1930
+ "[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
1931
+ "data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
1909
1932
  // `!` and the full shorthand, not `transition-none`: the `data-active`
1910
1933
  // rule above is a class *and* an attribute selector, so a plain
1911
1934
  // `motion-reduce:transition-none` loses to it and the preview kept
@@ -1926,7 +1949,8 @@ function ScheduleCreateDraft({ className }) {
1926
1949
  // an 18px floor) a minimum-duration draft was drawn 6px short.
1927
1950
  // Safe for the inactive pieces this component also renders: they are
1928
1951
  // `display: none` without `data-active`, so their height never paints.
1929
- height: "max(var(--sch-create-height, 0px), calc(1rem + 2px))"
1952
+ height: "max(var(--sch-create-height, 0px), calc(1rem + 2px))",
1953
+ ...poolPieceInsets("--sch-create-col")
1930
1954
  },
1931
1955
  children: /* @__PURE__ */ jsx(
1932
1956
  "span",
@@ -1988,7 +2012,7 @@ function ScheduleDragGhost({ className }) {
1988
2012
  "aria-hidden": true,
1989
2013
  "data-schedule-part": "drag-ghost",
1990
2014
  className: cn(
1991
- "group pointer-events-none absolute inset-x-0 z-26 hidden select-none rounded-sm",
2015
+ "group pointer-events-none absolute z-26 hidden select-none rounded-sm",
1992
2016
  // The piece carrying the readout paints above its siblings — same
1993
2017
  // collision the create draft has, for the same reason: the label is
1994
2018
  // deliberately wider than its own column so a cross-day range is not
@@ -2052,12 +2076,15 @@ function ScheduleDragGhost({ className }) {
2052
2076
  * during a move (a move preserves duration) and is listed only so the
2053
2077
  * two previews stay one declaration apart.
2054
2078
  *
2055
- * Only the vertical smooths. Moving to another day swaps to a different
2056
- * element — one ghost piece per day column — so a CSS transition has
2057
- * nothing to interpolate across that axis.
2079
+ * `inset-inline-start` eases a move onto another day the same way. The
2080
+ * piece stays one element across the change (`paintPieces` keys it by
2081
+ * its offset from the pointer's column), so this slides it rather than
2082
+ * fading one column's piece out and the next one's in. Longer than the
2083
+ * vertical step because the distance is: a column is a hundred-odd
2084
+ * pixels where a slot is a dozen.
2058
2085
  */
2059
- "[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
2060
- "data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
2086
+ "[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
2087
+ "data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
2061
2088
  "starting:data-active:opacity-0 starting:data-active:scale-105",
2062
2089
  // `!` and the full shorthand, not `transition-none`: the `data-active`
2063
2090
  // rule above is a class *and* an attribute selector, so a plain
@@ -2074,7 +2101,11 @@ function ScheduleDragGhost({ className }) {
2074
2101
  "data-continues-after:rounded-b-none data-continues-after:border-b-0",
2075
2102
  className
2076
2103
  ),
2077
- style: { top: "var(--sch-ghost-top, 0%)", height: "var(--sch-ghost-height, 0%)" },
2104
+ style: {
2105
+ top: "var(--sch-ghost-top, 0%)",
2106
+ height: "var(--sch-ghost-height, 0%)",
2107
+ ...poolPieceInsets("--sch-ghost-col")
2108
+ },
2078
2109
  children: /* @__PURE__ */ jsx(
2079
2110
  "span",
2080
2111
  {
@@ -2309,16 +2340,20 @@ var tickEdges = (state, options) => {
2309
2340
  const rect = grid.getBoundingClientRect();
2310
2341
  const hx = edgePressure(state.clientX, rect.left, rect.right);
2311
2342
  const vy = edgePressure(state.clientY, rect.top, rect.bottom);
2312
- const maxLeft = state.maxScrollLeft;
2343
+ const rtl = options.dir === "rtl";
2344
+ const [minLeft, maxLeft] = rtl ? [-state.maxScrollLeft, 0] : [0, state.maxScrollLeft];
2313
2345
  const maxTop = state.maxScrollTop;
2314
2346
  const beforeLeft = grid.scrollLeft;
2315
2347
  if (hx !== 0) {
2316
- grid.scrollLeft = Math.max(0, Math.min(maxLeft, grid.scrollLeft + hx * MAX_SCROLL_PX_PER_FRAME));
2348
+ grid.scrollLeft = Math.max(
2349
+ minLeft,
2350
+ Math.min(maxLeft, grid.scrollLeft + hx * MAX_SCROLL_PX_PER_FRAME)
2351
+ );
2317
2352
  }
2318
2353
  if (vy !== 0) {
2319
2354
  grid.scrollTop = Math.max(0, Math.min(maxTop, grid.scrollTop + vy * MAX_SCROLL_PX_PER_FRAME));
2320
2355
  }
2321
- const direction = hx < 0 ? -1 : hx > 0 ? 1 : null;
2356
+ const direction = hx === 0 ? null : hx > 0 !== rtl ? 1 : -1;
2322
2357
  const stuck = hx !== 0 && grid.scrollLeft === beforeLeft;
2323
2358
  if (direction !== null && stuck && options.onPaginate) {
2324
2359
  if (state.paginateDirection !== direction) {
@@ -2352,25 +2387,23 @@ var CREATE_DRAFT = {
2352
2387
  part: "create-draft",
2353
2388
  topVar: "--sch-create-top",
2354
2389
  heightVar: "--sch-create-height",
2390
+ columnVar: "--sch-create-col",
2355
2391
  labelPart: "create-draft-label"
2356
2392
  };
2357
2393
  var DRAG_GHOST = {
2358
2394
  part: "drag-ghost",
2359
2395
  topVar: "--sch-ghost-top",
2360
2396
  heightVar: "--sch-ghost-height",
2397
+ columnVar: "--sch-ghost-col",
2361
2398
  labelPart: "drag-ghost-label"
2362
2399
  };
2363
- var collectPieces = (grid, preview) => {
2364
- const drafts = /* @__PURE__ */ new Map();
2365
- for (const column of grid.querySelectorAll(
2366
- "[data-schedule-part='day-column'][data-day-index]"
2367
- )) {
2368
- if (!isLive(column)) continue;
2369
- const draft = column.querySelector(`[data-schedule-part='${preview.part}']`);
2370
- if (draft) drafts.set(Number(column.dataset["dayIndex"]), draft);
2371
- }
2372
- return drafts;
2373
- };
2400
+ var collectPieces = (grid, preview) => new Map(
2401
+ [
2402
+ ...grid.querySelectorAll(
2403
+ `[data-schedule-part='piece-pool'] > [data-schedule-part='${preview.part}']`
2404
+ )
2405
+ ].map((piece, slot) => [slot, piece])
2406
+ );
2374
2407
  var pieceLabel = (piece, preview) => piece.querySelector(`[data-schedule-part='${preview.labelPart}']`);
2375
2408
  var clearDraft = (draft) => {
2376
2409
  delete draft.dataset["active"];
@@ -2404,11 +2437,12 @@ var paintPieces = ({
2404
2437
  columnIndices,
2405
2438
  bandOfColumn,
2406
2439
  candidates,
2407
- totalWindowMinutes
2440
+ totalWindowMinutes,
2441
+ anchor = 0
2408
2442
  }) => {
2409
2443
  const labelled = /* @__PURE__ */ new Set();
2410
2444
  for (const index of columnIndices) {
2411
- const draft = pieces.get(index);
2445
+ const draft = pieces.get(((index - anchor) % pieces.size + pieces.size) % pieces.size);
2412
2446
  if (!draft) continue;
2413
2447
  const band = bandOfColumn(index);
2414
2448
  const candidate = candidates.find(
@@ -2425,6 +2459,7 @@ var paintPieces = ({
2425
2459
  const height = (pieceEnd - pieceStart) / 6e4 / totalWindowMinutes * 100;
2426
2460
  draft.style.setProperty(preview.topVar, `${top}%`);
2427
2461
  draft.style.setProperty(preview.heightVar, `${height}%`);
2462
+ draft.style.setProperty(preview.columnVar, `${index}`);
2428
2463
  draft.dataset["active"] = "true";
2429
2464
  if (candidate.invalid) draft.dataset["invalid"] = "true";
2430
2465
  else delete draft.dataset["invalid"];
@@ -2486,6 +2521,7 @@ function useEventDrag({
2486
2521
  locale
2487
2522
  }) {
2488
2523
  const dragRef = useRef(null);
2524
+ const { dir } = useLocaleContext();
2489
2525
  const latest = useRef({
2490
2526
  event,
2491
2527
  dayIndex,
@@ -2502,7 +2538,8 @@ function useEventDrag({
2502
2538
  onEventChange,
2503
2539
  onEventClick,
2504
2540
  onPaginate,
2505
- locale
2541
+ locale,
2542
+ dir
2506
2543
  });
2507
2544
  latest.current = {
2508
2545
  event,
@@ -2520,7 +2557,8 @@ function useEventDrag({
2520
2557
  onEventChange,
2521
2558
  onEventClick,
2522
2559
  onPaginate,
2523
- locale
2560
+ locale,
2561
+ dir
2524
2562
  };
2525
2563
  const resolveCandidate = useCallback((state, clientX, clientY) => {
2526
2564
  const o = latest.current;
@@ -2560,7 +2598,7 @@ function useEventDrag({
2560
2598
  const paint = useCallback(
2561
2599
  (state) => {
2562
2600
  const o = latest.current;
2563
- const { next, result } = resolveCandidate(state, state.clientX, state.clientY);
2601
+ const { next, result, renderedIndex } = resolveCandidate(state, state.clientX, state.clientY);
2564
2602
  setChipsDragging(state.chips, true);
2565
2603
  paintPieces({
2566
2604
  pieces: state.ghosts,
@@ -2577,7 +2615,11 @@ function useEventDrag({
2577
2615
  label: formatCandidate(next, o.locale, o.timeZone)
2578
2616
  }
2579
2617
  ],
2580
- totalWindowMinutes: o.totalWindowMinutes
2618
+ totalWindowMinutes: o.totalWindowMinutes,
2619
+ // Pieces keyed from the pointer's column: the candidate moves as one,
2620
+ // so each piece keeps its element when the day changes and the ghost
2621
+ // slides there rather than fading out of one column and into the next.
2622
+ anchor: renderedIndex
2581
2623
  });
2582
2624
  setInvalid(state.chips, !result.ok);
2583
2625
  },
@@ -2588,13 +2630,12 @@ function useEventDrag({
2588
2630
  tickEdges(state, {
2589
2631
  paint: () => paint(state),
2590
2632
  isLive: () => dragRef.current === state,
2633
+ dir: latest.current.dir,
2591
2634
  onPaginate: (direction) => latest.current.onPaginate?.(direction),
2592
2635
  onAfterPaginate: () => {
2593
2636
  const refreshed = liveChipsFor(state.grid, latest.current.event.id);
2594
2637
  setChipsDragging(state.chips, false);
2595
2638
  state.chips = refreshed;
2596
- hidePieces(state.ghosts, DRAG_GHOST);
2597
- state.ghosts = collectPieces(state.grid, DRAG_GHOST);
2598
2639
  }
2599
2640
  });
2600
2641
  },
@@ -2767,6 +2808,7 @@ function useEventResize({
2767
2808
  locale
2768
2809
  }) {
2769
2810
  const resizeRef = useRef(null);
2811
+ const { dir } = useLocaleContext();
2770
2812
  const options = {
2771
2813
  event,
2772
2814
  edge,
@@ -2784,7 +2826,8 @@ function useEventResize({
2784
2826
  overlapCandidates,
2785
2827
  onEventChange,
2786
2828
  onPaginate,
2787
- locale
2829
+ locale,
2830
+ dir
2788
2831
  };
2789
2832
  const latest = useRef(options);
2790
2833
  latest.current = options;
@@ -2900,10 +2943,9 @@ function useEventResize({
2900
2943
  tickEdges(state, {
2901
2944
  paint: () => paint(state),
2902
2945
  isLive: () => resizeRef.current === state,
2946
+ dir: latest.current.dir,
2903
2947
  onPaginate: (direction) => latest.current.onPaginate?.(direction),
2904
2948
  onAfterPaginate: () => {
2905
- hidePieces(state.drafts, CREATE_DRAFT);
2906
- state.drafts = collectPieces(state.grid, CREATE_DRAFT);
2907
2949
  setChipsDimmed(state.chips, false);
2908
2950
  const refreshed = liveChipsFor(state.grid, latest.current.event.id);
2909
2951
  state.chips = refreshed;
@@ -3577,6 +3619,7 @@ function InteractiveEventChip({
3577
3619
  onEventChange: resolvedOnEventChange,
3578
3620
  locale
3579
3621
  });
3622
+ const { dir } = useLocaleContext();
3580
3623
  const handleBodyKeyDown = (e) => {
3581
3624
  if (!present) return;
3582
3625
  if (e.key === "Enter" || e.key === " ") {
@@ -3590,7 +3633,7 @@ function InteractiveEventChip({
3590
3633
  if (!isVertical && !isHorizontal) return;
3591
3634
  e.preventDefault();
3592
3635
  const step = e.shiftKey ? slotDuration * 4 : slotDuration;
3593
- const delta = isHorizontal ? { days: e.key === "ArrowLeft" ? -1 : 1, minutes: 0 } : { days: 0, minutes: e.key === "ArrowUp" ? -step : step };
3636
+ const delta = isHorizontal ? { days: e.key === "ArrowLeft" === (dir === "rtl") ? 1 : -1, minutes: 0 } : { days: 0, minutes: e.key === "ArrowUp" ? -step : step };
3594
3637
  const next = { ...moveRange(event, delta, { timeZone, slotDuration }) };
3595
3638
  const result = checkRangeCommit(next, {
3596
3639
  slotDisabled,
@@ -4056,6 +4099,7 @@ function useEventCreate({
4056
4099
  const stateRef = useRef(null);
4057
4100
  const pendingRef = useRef(null);
4058
4101
  const armTimerRef = useRef(null);
4102
+ const { dir } = useLocaleContext();
4059
4103
  const latest = useRef({
4060
4104
  day,
4061
4105
  dayIndex,
@@ -4072,7 +4116,8 @@ function useEventCreate({
4072
4116
  onEventCreate,
4073
4117
  onGridClick,
4074
4118
  onPaginate,
4075
- locale
4119
+ locale,
4120
+ dir
4076
4121
  });
4077
4122
  latest.current = {
4078
4123
  day,
@@ -4090,7 +4135,8 @@ function useEventCreate({
4090
4135
  onEventCreate,
4091
4136
  onGridClick,
4092
4137
  onPaginate,
4093
- locale
4138
+ locale,
4139
+ dir
4094
4140
  };
4095
4141
  const clearPending = useCallback(() => {
4096
4142
  if (armTimerRef.current != null) clearTimeout(armTimerRef.current);
@@ -4157,11 +4203,8 @@ function useEventCreate({
4157
4203
  tickEdges(state, {
4158
4204
  paint: () => paint(state),
4159
4205
  isLive: () => stateRef.current === state,
4160
- onPaginate: (direction) => latest.current.onPaginate?.(direction),
4161
- onAfterPaginate: () => {
4162
- hidePieces(state.drafts, CREATE_DRAFT);
4163
- state.drafts = collectPieces(state.grid, CREATE_DRAFT);
4164
- }
4206
+ dir: latest.current.dir,
4207
+ onPaginate: (direction) => latest.current.onPaginate?.(direction)
4165
4208
  });
4166
4209
  },
4167
4210
  [paint]
@@ -4586,7 +4629,9 @@ function DayColumn({
4586
4629
  // its own; `align-self: stretch` (the grid default) is what makes
4587
4630
  // that stretch actually apply here.
4588
4631
  "relative row-2 h-full",
4589
- // `overflow-y-clip` contains the create draft's own scale overshoot.
4632
+ // `overflow-y-clip` contained the create draft's own scale overshoot
4633
+ // when the draft was mounted in here; it now lives in the grid's
4634
+ // `piece-pool` layer, which carries the same clip for the same reason.
4590
4635
  // The draft rests at `scale-105` and transitions to `scale-100` on
4591
4636
  // enter (see `schedule-create-draft.tsx` — the >1 resting scale is
4592
4637
  // deliberate, so its *leave* expands outward where it can be seen
@@ -4641,8 +4686,6 @@ function DayColumn({
4641
4686
  },
4642
4687
  run.startMinute
4643
4688
  )),
4644
- /* @__PURE__ */ jsx(ScheduleCreateDraft, { className: classNames?.createDraft }),
4645
- /* @__PURE__ */ jsx(ScheduleDragGhost, { className: classNames?.dragGhost }),
4646
4689
  chips.map((chip) => chip.node),
4647
4690
  withNowIndicator && isToday2 ? /* @__PURE__ */ jsx(
4648
4691
  NowCursorLine,
@@ -5012,6 +5055,8 @@ function ScheduleTimedGrid({
5012
5055
  // details popovers are portalled *into* this subtree, so their panels
5013
5056
  // opt back in with `select-text`.
5014
5057
  "select-none",
5058
+ // Mirrors the page-turn slide: see the `schedule-page-*` keyframes.
5059
+ "rtl:[--sch-inline-dir:-1]",
5015
5060
  classNames?.grid
5016
5061
  ),
5017
5062
  style: {
@@ -5163,6 +5208,25 @@ function ScheduleTimedGrid({
5163
5208
  className: classNames?.nowIndicator
5164
5209
  }
5165
5210
  ) }) : null,
5211
+ /* @__PURE__ */ jsxs(
5212
+ "div",
5213
+ {
5214
+ "aria-hidden": true,
5215
+ "data-schedule-part": "piece-pool",
5216
+ className: "pointer-events-none relative col-[2/-1] row-2 min-w-0 overflow-y-clip",
5217
+ style: { "--sch-pool-columns": `${days.length}` },
5218
+ children: [
5219
+ days.map((_, slot) => (
5220
+ // biome-ignore lint/suspicious/noArrayIndexKey: pool slots, not days — keyed by date, a page turn would remount the pool mid-gesture.
5221
+ /* @__PURE__ */ jsx(ScheduleCreateDraft, { className: classNames?.createDraft }, slot)
5222
+ )),
5223
+ days.map((_, slot) => (
5224
+ // biome-ignore lint/suspicious/noArrayIndexKey: pool slots, not days — keyed by date, a page turn would remount the pool mid-gesture.
5225
+ /* @__PURE__ */ jsx(ScheduleDragGhost, { className: classNames?.dragGhost }, slot)
5226
+ ))
5227
+ ]
5228
+ }
5229
+ ),
5166
5230
  renderBand(days, dataSegments, staticSegments, paging ? "entering" : void 0, ""),
5167
5231
  pageOut ? renderBand(outDays, outDataSegments, outStaticSegments, "exiting", "exit-") : null
5168
5232
  ]
@@ -5184,8 +5248,8 @@ function DaysViewBody({
5184
5248
  withEventDetails = true,
5185
5249
  onDayClick,
5186
5250
  renderEventDetails,
5187
- locale,
5188
- timeZone = getLocalTimeZone(),
5251
+ locale: localeProp,
5252
+ timeZone: timeZoneProp,
5189
5253
  translations,
5190
5254
  classNames,
5191
5255
  className,
@@ -5223,6 +5287,8 @@ function DaysViewBody({
5223
5287
  testId,
5224
5288
  ...rest
5225
5289
  }) {
5290
+ const locale = useLocale(localeProp);
5291
+ const timeZone = useTimeZone(timeZoneProp);
5226
5292
  const [anchorDate, setAnchorDate] = useUncontrolled({
5227
5293
  value: date,
5228
5294
  defaultValue: defaultDate,
@@ -5240,7 +5306,7 @@ function DaysViewBody({
5240
5306
  const t = resolveScheduleTranslations(translations);
5241
5307
  const range = getVisibleRange("days", anchorDate, {
5242
5308
  timeZone,
5243
- locale: locale ?? "en-US",
5309
+ locale,
5244
5310
  startOfWeek: align,
5245
5311
  visibleDays
5246
5312
  });
@@ -5397,7 +5463,7 @@ function MonthEventPill({
5397
5463
  focusStyles({ ring: "palette", offset: false })
5398
5464
  ),
5399
5465
  children: [
5400
- event.icon != null ? /* @__PURE__ */ jsx("span", { className: "mr-1 inline-flex align-[-1px] [&_svg]:size-3", children: event.icon }) : null,
5466
+ event.icon != null ? /* @__PURE__ */ jsx("span", { className: "me-1 inline-flex align-[-1px] [&_svg]:size-3", children: event.icon }) : null,
5401
5467
  event.title
5402
5468
  ]
5403
5469
  }
@@ -5609,8 +5675,8 @@ function MonthView({
5609
5675
  onOverflowClick,
5610
5676
  withOverflowDetails,
5611
5677
  renderOverflowDetails,
5612
- locale,
5613
- timeZone = getLocalTimeZone(),
5678
+ locale: localeProp,
5679
+ timeZone: timeZoneProp,
5614
5680
  translations,
5615
5681
  classNames,
5616
5682
  className,
@@ -5626,6 +5692,8 @@ function MonthView({
5626
5692
  testId,
5627
5693
  ...rest
5628
5694
  }) {
5695
+ const locale = useLocale(localeProp);
5696
+ const timeZone = useTimeZone(timeZoneProp);
5629
5697
  const [currentDate, setCurrentDate] = useUncontrolled({
5630
5698
  value: date,
5631
5699
  defaultValue: defaultDate,
@@ -5642,7 +5710,7 @@ function MonthView({
5642
5710
  const todayRef = now ?? /* @__PURE__ */ new Date();
5643
5711
  const range = getVisibleRange("month", currentDate, {
5644
5712
  timeZone,
5645
- locale: locale ?? "en-US",
5713
+ locale,
5646
5714
  startOfWeek
5647
5715
  });
5648
5716
  const days = enumerateDays(range, timeZone);
@@ -5792,8 +5860,8 @@ function YearView({
5792
5860
  staticEvents = [],
5793
5861
  onDayClick,
5794
5862
  onMonthClick,
5795
- locale,
5796
- timeZone = getLocalTimeZone(),
5863
+ locale: localeProp,
5864
+ timeZone: timeZoneProp,
5797
5865
  translations,
5798
5866
  classNames,
5799
5867
  className,
@@ -5807,6 +5875,8 @@ function YearView({
5807
5875
  testId,
5808
5876
  ...rest
5809
5877
  }) {
5878
+ const locale = useLocale(localeProp);
5879
+ const timeZone = useTimeZone(timeZoneProp);
5810
5880
  const [currentDate, setCurrentDate] = useUncontrolled({
5811
5881
  value: date,
5812
5882
  defaultValue: defaultDate,
@@ -5815,7 +5885,7 @@ function YearView({
5815
5885
  });
5816
5886
  const t = resolveScheduleTranslations(translations);
5817
5887
  const todayRef = now ?? /* @__PURE__ */ new Date();
5818
- const yearRange = getVisibleRange("year", currentDate, { timeZone, locale: locale ?? "en-US" });
5888
+ const yearRange = getVisibleRange("year", currentDate, { timeZone, locale });
5819
5889
  const monthStarts = enumerateMonths(yearRange, timeZone);
5820
5890
  const allEvents = [...data, ...staticEvents];
5821
5891
  return /* @__PURE__ */ jsxs(
@@ -5868,7 +5938,7 @@ function YearView({
5868
5938
  children: monthStarts.map((monthStart) => {
5869
5939
  const monthGrid = getVisibleRange("month", monthStart, {
5870
5940
  timeZone,
5871
- locale: locale ?? "en-US"
5941
+ locale
5872
5942
  });
5873
5943
  const nextMonthStart = monthStarts.find((m) => m.getTime() > monthStart.getTime());
5874
5944
  const monthEnd = nextMonthStart ?? yearRange.end;
@@ -6047,8 +6117,8 @@ function ScheduleRoot(allProps) {
6047
6117
  withEventDetails = true,
6048
6118
  onDayClick,
6049
6119
  renderEventDetails,
6050
- locale,
6051
- timeZone = getLocalTimeZone(),
6120
+ locale: localeProp,
6121
+ timeZone: timeZoneProp,
6052
6122
  translations,
6053
6123
  classNames,
6054
6124
  className,
@@ -6092,6 +6162,8 @@ function ScheduleRoot(allProps) {
6092
6162
  testId,
6093
6163
  ...rest
6094
6164
  } = allProps;
6165
+ const locale = useLocale(localeProp);
6166
+ const timeZone = useTimeZone(timeZoneProp);
6095
6167
  const [currentDate, setCurrentDate] = useUncontrolled({
6096
6168
  value: date,
6097
6169
  defaultValue: defaultDate,
@@ -6224,7 +6296,7 @@ function ScheduleRoot(allProps) {
6224
6296
  }
6225
6297
  if (!isEventInVisibleRange(event, currentView, currentDate, {
6226
6298
  timeZone,
6227
- locale: locale ?? "en-US",
6299
+ locale,
6228
6300
  // The wide `align` value, deliberately un-narrowed: `getVisibleRange`
6229
6301
  // calls `resolveWeekStartDay` itself and the days branch needs the raw
6230
6302
  // `"relative"`.
@@ -6473,8 +6545,8 @@ function ScheduleNextUp({
6473
6545
  data,
6474
6546
  now,
6475
6547
  pastEventsOffset = 30,
6476
- locale,
6477
- timeZone = getLocalTimeZone(),
6548
+ locale: localeProp,
6549
+ timeZone: timeZoneProp,
6478
6550
  translations,
6479
6551
  empty,
6480
6552
  renderEvent,
@@ -6483,6 +6555,8 @@ function ScheduleNextUp({
6483
6555
  testId,
6484
6556
  ...rest
6485
6557
  }) {
6558
+ const locale = useLocale(localeProp);
6559
+ const timeZone = useTimeZone(timeZoneProp);
6486
6560
  const current = useNow(now);
6487
6561
  const agenda = buildNextUpAgenda(data, current, { pastEventsOffset, timeZone });
6488
6562
  const t = resolveScheduleTranslations(translations);