beez-ui 2.5.0 → 2.6.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 (92) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/dist/components/alert-dialog.d.ts +15 -4
  4. package/dist/components/alert-dialog.js +84 -44
  5. package/dist/components/alert.d.ts +30 -9
  6. package/dist/components/alert.js +360 -39
  7. package/dist/components/avatar.d.ts +33 -10
  8. package/dist/components/avatar.js +110 -30
  9. package/dist/components/badge.d.ts +39 -7
  10. package/dist/components/badge.js +348 -24
  11. package/dist/components/calendar.d.ts +29 -2
  12. package/dist/components/calendar.js +1035 -223
  13. package/dist/components/card.d.ts +17 -1
  14. package/dist/components/card.js +34 -8
  15. package/dist/components/carousel.d.ts +29 -2
  16. package/dist/components/carousel.js +471 -90
  17. package/dist/components/checkbox.d.ts +13 -2
  18. package/dist/components/checkbox.js +301 -41
  19. package/dist/components/dialog-surface.d.ts +27 -0
  20. package/dist/components/dialog-surface.js +137 -0
  21. package/dist/components/dialog.d.ts +21 -4
  22. package/dist/components/dialog.js +163 -96
  23. package/dist/components/dropdown-menu.d.ts +30 -16
  24. package/dist/components/dropdown-menu.js +139 -83
  25. package/dist/components/hover-card.d.ts +46 -3
  26. package/dist/components/hover-card.js +423 -60
  27. package/dist/components/pagination.d.ts +32 -14
  28. package/dist/components/pagination.js +136 -59
  29. package/dist/components/popover.d.ts +14 -5
  30. package/dist/components/popover.js +78 -36
  31. package/dist/components/radio-group.d.ts +19 -3
  32. package/dist/components/radio-group.js +400 -57
  33. package/dist/components/select.d.ts +17 -6
  34. package/dist/components/select.js +83 -71
  35. package/dist/components/sheet.js +37 -26
  36. package/dist/components/sidebar.js +11 -0
  37. package/dist/components/skeleton.d.ts +19 -5
  38. package/dist/components/skeleton.js +434 -14
  39. package/dist/components/switch.d.ts +14 -4
  40. package/dist/components/switch.js +424 -40
  41. package/dist/components/tabs.d.ts +38 -5
  42. package/dist/components/tabs.js +564 -97
  43. package/dist/components/themed-toaster.d.ts +6 -2
  44. package/dist/components/themed-toaster.js +80 -50
  45. package/dist/components/tooltip.d.ts +33 -2
  46. package/dist/components/tooltip.js +197 -69
  47. package/dist/constants/alert.d.ts +12 -0
  48. package/dist/constants/alert.js +9 -0
  49. package/dist/constants/avatar.d.ts +10 -0
  50. package/dist/constants/avatar.js +7 -0
  51. package/dist/constants/badge.d.ts +6 -0
  52. package/dist/constants/badge.js +6 -0
  53. package/dist/constants/calendar.d.ts +24 -0
  54. package/dist/constants/calendar.js +22 -0
  55. package/dist/constants/carousel.d.ts +37 -0
  56. package/dist/constants/carousel.js +53 -0
  57. package/dist/constants/checkbox.d.ts +17 -0
  58. package/dist/constants/checkbox.js +17 -0
  59. package/dist/constants/dialog.d.ts +6 -0
  60. package/dist/constants/dialog.js +6 -0
  61. package/dist/constants/dropdown-menu.d.ts +5 -0
  62. package/dist/constants/dropdown-menu.js +5 -0
  63. package/dist/constants/hover-card.d.ts +37 -0
  64. package/dist/constants/hover-card.js +85 -0
  65. package/dist/constants/pagination.d.ts +9 -0
  66. package/dist/constants/pagination.js +9 -0
  67. package/dist/constants/popover.d.ts +7 -0
  68. package/dist/constants/popover.js +39 -0
  69. package/dist/constants/radio-group.d.ts +10 -0
  70. package/dist/constants/radio-group.js +10 -0
  71. package/dist/constants/select.d.ts +3 -0
  72. package/dist/constants/select.js +3 -0
  73. package/dist/constants/skeleton.d.ts +17 -0
  74. package/dist/constants/skeleton.js +17 -0
  75. package/dist/constants/switch.d.ts +44 -0
  76. package/dist/constants/switch.js +49 -0
  77. package/dist/constants/tabs.d.ts +17 -0
  78. package/dist/constants/tabs.js +17 -0
  79. package/dist/constants/toast.d.ts +3 -0
  80. package/dist/constants/toast.js +3 -0
  81. package/dist/constants/tooltip.d.ts +13 -0
  82. package/dist/constants/tooltip.js +52 -0
  83. package/dist/lib/toast-layer.d.ts +24 -0
  84. package/dist/lib/toast-layer.js +76 -0
  85. package/dist/motion/arc-floating-slot.d.ts +40 -0
  86. package/dist/motion/arc-floating-slot.js +167 -0
  87. package/dist/motion/glide-indicator.d.ts +6 -7
  88. package/dist/motion/glide-indicator.js +5 -3
  89. package/dist/motion/overlay-warmth.d.ts +24 -0
  90. package/dist/motion/overlay-warmth.js +70 -0
  91. package/dist/styles.css +1 -1
  92. package/package.json +1 -1
@@ -1,17 +1,35 @@
1
1
  "use client";
2
2
  import { c as _c } from "react/compiler-runtime";
3
+ /**
4
+ * Arc's Calendar (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md) on react-day-picker: round day cells
5
+ * on a 4px grid, the month title on the left with quiet pill controls on the right, today marked by a dot under its
6
+ * number, a selected disc that glides between days and an optional Today button. react-day-picker keeps selection
7
+ * modes, ranges, dropdowns, locales and keyboard navigation; only the design and the motion come from Arc.
8
+ */
3
9
  import * as React from "react";
10
+ import { flushSync } from "react-dom";
4
11
  import { es } from "react-day-picker/locale";
5
- import { DayPicker, getDefaultClassNames } from "react-day-picker";
12
+ import { DayPicker, UI, dateMatchModifiers, getDefaultClassNames, useDayPicker } from "react-day-picker";
6
13
  import { animate, frame } from "motion/react";
14
+ import { CALENDAR_COPY, CALENDAR_MONTH_ENTER_OPACITY, CALENDAR_MONTH_SPRING, CALENDAR_MONTHS_PER_YEAR, CALENDAR_SELECTED_DAY_SELECTOR, CALENDAR_SELECTION_DISC_ATTRIBUTE, CALENDAR_SELECTION_ENTER_SCALE, CALENDAR_SELECTION_EXIT_DURATION_S } from "../constants/calendar.js";
7
15
  import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
8
- import { MOTION_EASE, MOTION_MONTH_DISTANCE, MOTION_TIMING } from "../motion/tokens.js";
16
+ import { useIsHydrated } from "../hooks/use-is-hydrated.js";
17
+ import { ARC_DURATION, ARC_EASE, ARC_SPRING_MORPH, ARC_SPRING_SNAPPY } from "../motion/arc-tokens.js";
18
+ import { MOTION_MONTH_DISTANCE } from "../motion/tokens.js";
9
19
  import { cn } from "../lib/utils.js";
10
- import { ControlButton, controlButtonVariants } from "./control-button.js";
20
+ import { controlButtonVariants } from "./control-button.js";
11
21
  import { ChevronLeft, ChevronRight, ChevronDown } from "lucide-react";
12
- import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
+ const CalendarSettingsContext = React.createContext({ todayLabel: CALENDAR_COPY.today });
24
+ /** Arc's quiet header control: a fill on hover-capable pointers, a short press and a dimmed, inert disabled state. */
25
+ const calendarHeaderControlClassName = "h-8 rounded-full p-0 text-text-secondary select-none transition-[color,background-color,opacity,scale] duration-(--duration-fast) ease-(--ease-standard) motion-reduce:transition-none hover-fine:not-aria-disabled:bg-surface-muted hover-fine:not-aria-disabled:text-foreground active:not-aria-disabled:scale-[.96] motion-reduce:active:scale-100 aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-35";
26
+ /**
27
+ * A month grid for picking a day, several days or a range, controlled or uncontrolled like react-day-picker.
28
+ * @param props - Every react-day-picker prop plus the Arc additions `showToday` and `todayLabel`.
29
+ * @returns The calendar, in Spanish by default.
30
+ */
13
31
  function Calendar(t0) {
14
- const $ = _c(57);
32
+ const $ = _c(65);
15
33
  let className;
16
34
  let classNames;
17
35
  let components;
@@ -21,8 +39,10 @@ function Calendar(t0) {
21
39
  let t2;
22
40
  let t3;
23
41
  let t4;
42
+ let t5;
43
+ let t6;
24
44
  if ($[0] !== t0) {
25
- ({className, classNames, showOutsideDays: t1, captionLayout: t2, buttonVariant: t3, locale: t4, formatters, components, ...props} = t0);
45
+ ({className, classNames, showOutsideDays: t1, captionLayout: t2, buttonVariant: t3, locale: t4, formatters, components, showToday: t5, todayLabel: t6, ...props} = t0);
26
46
  $[0] = t0;
27
47
  $[1] = className;
28
48
  $[2] = classNames;
@@ -33,6 +53,8 @@ function Calendar(t0) {
33
53
  $[7] = t2;
34
54
  $[8] = t3;
35
55
  $[9] = t4;
56
+ $[10] = t5;
57
+ $[11] = t6;
36
58
  } else {
37
59
  className = $[1];
38
60
  classNames = $[2];
@@ -43,223 +65,995 @@ function Calendar(t0) {
43
65
  t2 = $[7];
44
66
  t3 = $[8];
45
67
  t4 = $[9];
68
+ t5 = $[10];
69
+ t6 = $[11];
46
70
  }
47
71
  const showOutsideDays = t1 === undefined ? true : t1;
48
72
  const captionLayout = t2 === undefined ? "label" : t2;
49
73
  const buttonVariant = t3 === undefined ? "ghost" : t3;
50
74
  const locale = t4 === undefined ? es : t4;
75
+ const showToday = t5 === undefined ? false : t5;
76
+ const todayLabel = t6 === undefined ? CALENDAR_COPY.today : t6;
51
77
  const defaultClassNames = getDefaultClassNames();
78
+ const isRange = props.mode === "range";
79
+ let t7;
80
+ if ($[12] !== todayLabel) {
81
+ t7 = { todayLabel };
82
+ $[12] = todayLabel;
83
+ $[13] = t7;
84
+ } else {
85
+ t7 = $[13];
86
+ }
87
+ const settings = t7;
88
+ const t8 = CalendarSettingsContext;
52
89
  const T0 = DayPicker;
53
- const t5 = cn("group/calendar bg-background p-2 [--cell-radius:var(--radius-md)] [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className);
54
- let t6;
55
- if ($[10] !== locale?.code) {
56
- t6 = (date) => date.toLocaleString(locale?.code, { month: "short" });
57
- $[10] = locale?.code;
58
- $[11] = t6;
90
+ const t9 = cn("group/calendar bg-background p-2 text-foreground [--cell-radius:var(--radius-pill)] [--cell-size:--spacing(9)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className);
91
+ let t10;
92
+ if ($[14] !== locale?.code) {
93
+ t10 = (date) => date.toLocaleString(locale?.code, { month: "short" });
94
+ $[14] = locale?.code;
95
+ $[15] = t10;
59
96
  } else {
60
- t6 = $[11];
97
+ t10 = $[15];
61
98
  }
62
- let t7;
63
- if ($[12] !== formatters || $[13] !== t6) {
64
- t7 = {
65
- formatMonthDropdown: t6,
99
+ let t11;
100
+ if ($[16] !== formatters || $[17] !== t10) {
101
+ t11 = {
102
+ formatMonthDropdown: t10,
66
103
  ...formatters
67
104
  };
68
- $[12] = formatters;
69
- $[13] = t6;
70
- $[14] = t7;
71
- } else {
72
- t7 = $[14];
73
- }
74
- const t8 = cn("w-fit", defaultClassNames.root);
75
- const t9 = cn("relative flex flex-col gap-4 md:flex-row", defaultClassNames.months);
76
- const t10 = cn("flex w-full flex-col gap-4", defaultClassNames.month);
77
- const t11 = cn("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1", defaultClassNames.nav);
78
- const t12 = cn(controlButtonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_previous);
79
- const t13 = cn(controlButtonVariants({ variant: buttonVariant }), "size-(--cell-size) p-0 select-none aria-disabled:opacity-50", defaultClassNames.button_next);
80
- const t14 = cn("flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)", defaultClassNames.month_caption);
81
- const t15 = cn("flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns);
82
- const t16 = cn("relative rounded-(--cell-radius)", defaultClassNames.dropdown_root);
83
- const t17 = cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown);
84
- const t18 = cn("font-medium select-none", captionLayout === "label" ? "text-sm" : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground", defaultClassNames.caption_label);
85
- const t19 = cn("w-full border-collapse", defaultClassNames.month_grid);
86
- const t20 = cn("flex", defaultClassNames.weekdays);
87
- const t21 = cn("flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none", defaultClassNames.weekday);
88
- const t22 = cn("mt-2 flex w-full", defaultClassNames.week);
89
- const t23 = cn("w-(--cell-size) select-none", defaultClassNames.week_number_header);
90
- const t24 = cn("text-[0.8rem] text-muted-foreground select-none", defaultClassNames.week_number);
91
- const t25 = cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day);
92
- const t26 = cn("relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted", defaultClassNames.range_start);
93
- const t27 = cn("rounded-none", defaultClassNames.range_middle);
94
- const t28 = cn("relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted", defaultClassNames.range_end);
95
- const t29 = cn("rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none", defaultClassNames.today);
96
- const t30 = cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside);
97
- const t31 = cn("text-muted-foreground opacity-50", defaultClassNames.disabled);
98
- const t32 = cn("invisible", defaultClassNames.hidden);
99
- let t33;
100
- if ($[15] !== classNames || $[16] !== t10 || $[17] !== t11 || $[18] !== t12 || $[19] !== t13 || $[20] !== t14 || $[21] !== t15 || $[22] !== t16 || $[23] !== t17 || $[24] !== t18 || $[25] !== t19 || $[26] !== t20 || $[27] !== t21 || $[28] !== t22 || $[29] !== t23 || $[30] !== t24 || $[31] !== t25 || $[32] !== t26 || $[33] !== t27 || $[34] !== t28 || $[35] !== t29 || $[36] !== t30 || $[37] !== t31 || $[38] !== t32 || $[39] !== t8 || $[40] !== t9) {
101
- t33 = {
102
- root: t8,
103
- months: t9,
104
- month: t10,
105
- nav: t11,
106
- button_previous: t12,
107
- button_next: t13,
108
- month_caption: t14,
109
- dropdowns: t15,
110
- dropdown_root: t16,
111
- dropdown: t17,
112
- caption_label: t18,
113
- month_grid: t19,
114
- weekdays: t20,
115
- weekday: t21,
116
- week: t22,
117
- week_number_header: t23,
118
- week_number: t24,
119
- day: t25,
120
- range_start: t26,
121
- range_middle: t27,
122
- range_end: t28,
123
- today: t29,
124
- outside: t30,
125
- disabled: t31,
126
- hidden: t32,
105
+ $[16] = formatters;
106
+ $[17] = t10;
107
+ $[18] = t11;
108
+ } else {
109
+ t11 = $[18];
110
+ }
111
+ const t12 = cn("w-fit", defaultClassNames.root);
112
+ const t13 = cn("relative flex flex-col gap-6 md:flex-row", defaultClassNames.months);
113
+ const t14 = cn("group/calendar-month relative flex w-full flex-col gap-3", defaultClassNames.month);
114
+ const t15 = cn("absolute end-0 top-0 z-20 flex items-center gap-0.5", defaultClassNames.nav);
115
+ const t16 = cn(controlButtonVariants({ variant: buttonVariant }), calendarHeaderControlClassName, "size-8", defaultClassNames.button_previous);
116
+ const t17 = cn(controlButtonVariants({ variant: buttonVariant }), calendarHeaderControlClassName, "size-8", defaultClassNames.button_next);
117
+ const t18 = cn("flex h-8 w-full items-center justify-start pe-18", showToday && "after:invisible after:me-0.5 after:shrink-0 after:px-[11px] after:text-sm after:leading-none after:font-medium after:whitespace-nowrap after:content-[attr(data-today-label)]", defaultClassNames.month_caption);
118
+ const t19 = cn("flex h-8 w-full min-w-0 items-center justify-start gap-1.5 text-base font-medium", defaultClassNames.dropdowns);
119
+ const t20 = cn("relative rounded-(--radius-control)", defaultClassNames.dropdown_root);
120
+ const t21 = cn("absolute inset-0 bg-popover opacity-0", defaultClassNames.dropdown);
121
+ const t22 = cn("font-medium whitespace-nowrap tabular-nums select-none", captionLayout === "label" ? "min-w-0 truncate text-base" : "flex items-center gap-1 rounded-(--radius-control) text-base [&>svg]:size-3.5 [&>svg]:text-text-muted", defaultClassNames.caption_label);
122
+ const t23 = cn("w-full border-collapse", defaultClassNames.month_grid);
123
+ const t24 = cn("flex", !isRange && "gap-1", defaultClassNames.weekdays);
124
+ const t25 = cn("flex-1 text-xs leading-6 font-medium text-text-muted select-none", defaultClassNames.weekday);
125
+ const t26 = cn("mt-1 flex w-full", !isRange && "gap-1", defaultClassNames.week);
126
+ const t27 = cn("w-(--cell-size) select-none", defaultClassNames.week_number_header);
127
+ const t28 = cn("text-xs text-text-muted select-none", defaultClassNames.week_number);
128
+ const t29 = cn("group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)" : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)", defaultClassNames.day);
129
+ const t30 = cn("relative isolate z-0 rounded-l-(--cell-radius) bg-surface-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-surface-muted", defaultClassNames.range_start);
130
+ const t31 = cn("rounded-none", defaultClassNames.range_middle);
131
+ const t32 = cn("relative isolate z-0 rounded-r-(--cell-radius) bg-surface-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-surface-muted", defaultClassNames.range_end);
132
+ const t33 = cn(defaultClassNames.today);
133
+ const t34 = cn(defaultClassNames.outside);
134
+ const t35 = cn(defaultClassNames.disabled);
135
+ const t36 = cn("invisible", defaultClassNames.hidden);
136
+ let t37;
137
+ if ($[19] !== classNames || $[20] !== t12 || $[21] !== t13 || $[22] !== t14 || $[23] !== t15 || $[24] !== t16 || $[25] !== t17 || $[26] !== t18 || $[27] !== t19 || $[28] !== t20 || $[29] !== t21 || $[30] !== t22 || $[31] !== t23 || $[32] !== t24 || $[33] !== t25 || $[34] !== t26 || $[35] !== t27 || $[36] !== t28 || $[37] !== t29 || $[38] !== t30 || $[39] !== t31 || $[40] !== t32 || $[41] !== t33 || $[42] !== t34 || $[43] !== t35 || $[44] !== t36) {
138
+ t37 = {
139
+ root: t12,
140
+ months: t13,
141
+ month: t14,
142
+ nav: t15,
143
+ button_previous: t16,
144
+ button_next: t17,
145
+ month_caption: t18,
146
+ dropdowns: t19,
147
+ dropdown_root: t20,
148
+ dropdown: t21,
149
+ caption_label: t22,
150
+ month_grid: t23,
151
+ weekdays: t24,
152
+ weekday: t25,
153
+ week: t26,
154
+ week_number_header: t27,
155
+ week_number: t28,
156
+ day: t29,
157
+ range_start: t30,
158
+ range_middle: t31,
159
+ range_end: t32,
160
+ today: t33,
161
+ outside: t34,
162
+ disabled: t35,
163
+ hidden: t36,
127
164
  ...classNames
128
165
  };
129
- $[15] = classNames;
130
- $[16] = t10;
131
- $[17] = t11;
132
- $[18] = t12;
133
- $[19] = t13;
134
- $[20] = t14;
135
- $[21] = t15;
136
- $[22] = t16;
137
- $[23] = t17;
138
- $[24] = t18;
139
- $[25] = t19;
140
- $[26] = t20;
141
- $[27] = t21;
142
- $[28] = t22;
143
- $[29] = t23;
144
- $[30] = t24;
145
- $[31] = t25;
146
- $[32] = t26;
147
- $[33] = t27;
148
- $[34] = t28;
149
- $[35] = t29;
150
- $[36] = t30;
151
- $[37] = t31;
152
- $[38] = t32;
153
- $[39] = t8;
154
- $[40] = t9;
166
+ $[19] = classNames;
167
+ $[20] = t12;
168
+ $[21] = t13;
169
+ $[22] = t14;
170
+ $[23] = t15;
171
+ $[24] = t16;
172
+ $[25] = t17;
173
+ $[26] = t18;
174
+ $[27] = t19;
175
+ $[28] = t20;
176
+ $[29] = t21;
177
+ $[30] = t22;
178
+ $[31] = t23;
179
+ $[32] = t24;
180
+ $[33] = t25;
181
+ $[34] = t26;
182
+ $[35] = t27;
183
+ $[36] = t28;
184
+ $[37] = t29;
185
+ $[38] = t30;
186
+ $[39] = t31;
187
+ $[40] = t32;
155
188
  $[41] = t33;
189
+ $[42] = t34;
190
+ $[43] = t35;
191
+ $[44] = t36;
192
+ $[45] = t37;
156
193
  } else {
157
- t33 = $[41];
194
+ t37 = $[45];
158
195
  }
159
- let t34;
160
- if ($[42] !== locale) {
161
- t34 = (t35) => {
162
- const { ...props_2 } = t35;
163
- return /* @__PURE__ */ _jsx(CalendarDayButton, {
164
- locale,
165
- ...props_2
166
- });
167
- };
168
- $[42] = locale;
169
- $[43] = t34;
196
+ let t38;
197
+ if ($[46] !== showToday) {
198
+ t38 = showToday ? {
199
+ Nav: CalendarNav,
200
+ MonthCaption: CalendarMonthCaption
201
+ } : {};
202
+ $[46] = showToday;
203
+ $[47] = t38;
170
204
  } else {
171
- t34 = $[43];
205
+ t38 = $[47];
172
206
  }
173
- let t35;
174
- if ($[44] !== components || $[45] !== t34) {
175
- t35 = {
176
- Root: _temp,
177
- Chevron: _temp2,
178
- DayButton: t34,
207
+ let t39;
208
+ if ($[48] !== components || $[49] !== t38) {
209
+ t39 = {
210
+ Root: CalendarRoot,
211
+ Chevron: CalendarChevron,
212
+ DayButton: CalendarDayButtonSlot,
179
213
  Month: CalendarMonth,
180
- WeekNumber: _temp3,
214
+ ...t38,
215
+ WeekNumber: CalendarWeekNumber,
181
216
  ...components
182
217
  };
183
- $[44] = components;
184
- $[45] = t34;
185
- $[46] = t35;
218
+ $[48] = components;
219
+ $[49] = t38;
220
+ $[50] = t39;
186
221
  } else {
187
- t35 = $[46];
222
+ t39 = $[50];
188
223
  }
189
- let t36;
190
- if ($[47] !== T0 || $[48] !== captionLayout || $[49] !== locale || $[50] !== props || $[51] !== showOutsideDays || $[52] !== t33 || $[53] !== t35 || $[54] !== t5 || $[55] !== t7) {
191
- t36 = /* @__PURE__ */ _jsx(T0, {
224
+ let t40;
225
+ if ($[51] !== T0 || $[52] !== captionLayout || $[53] !== locale || $[54] !== props || $[55] !== showOutsideDays || $[56] !== t11 || $[57] !== t37 || $[58] !== t39 || $[59] !== t9) {
226
+ t40 = /* @__PURE__ */ _jsx(T0, {
192
227
  showOutsideDays,
193
- className: t5,
228
+ className: t9,
194
229
  captionLayout,
195
230
  locale,
196
- formatters: t7,
197
- classNames: t33,
198
- components: t35,
231
+ formatters: t11,
232
+ classNames: t37,
233
+ components: t39,
234
+ ...props
235
+ });
236
+ $[51] = T0;
237
+ $[52] = captionLayout;
238
+ $[53] = locale;
239
+ $[54] = props;
240
+ $[55] = showOutsideDays;
241
+ $[56] = t11;
242
+ $[57] = t37;
243
+ $[58] = t39;
244
+ $[59] = t9;
245
+ $[60] = t40;
246
+ } else {
247
+ t40 = $[60];
248
+ }
249
+ let t41;
250
+ if ($[61] !== settings || $[62] !== t40 || $[63] !== t8.Provider) {
251
+ t41 = /* @__PURE__ */ _jsx(t8.Provider, {
252
+ value: settings,
253
+ children: t40
254
+ });
255
+ $[61] = settings;
256
+ $[62] = t40;
257
+ $[63] = t8.Provider;
258
+ $[64] = t41;
259
+ } else {
260
+ t41 = $[64];
261
+ }
262
+ return t41;
263
+ }
264
+ /*
265
+ * The slots below live at module level so their component identity is stable across renders. Inline slot functions
266
+ * would be new component types on every render: React would remount the whole calendar (Root wraps it) and every month
267
+ * would lose its state, which cancels the month slide and the selected disc glide when nothing memoizes them.
268
+ */
269
+ /** The calendar root, tagged with `data-slot="calendar"`. */
270
+ function CalendarRoot(t0) {
271
+ const $ = _c(10);
272
+ let className;
273
+ let props;
274
+ let rootRef;
275
+ if ($[0] !== t0) {
276
+ ({className, rootRef, ...props} = t0);
277
+ $[0] = t0;
278
+ $[1] = className;
279
+ $[2] = props;
280
+ $[3] = rootRef;
281
+ } else {
282
+ className = $[1];
283
+ props = $[2];
284
+ rootRef = $[3];
285
+ }
286
+ let t1;
287
+ if ($[4] !== className) {
288
+ t1 = cn(className);
289
+ $[4] = className;
290
+ $[5] = t1;
291
+ } else {
292
+ t1 = $[5];
293
+ }
294
+ let t2;
295
+ if ($[6] !== props || $[7] !== rootRef || $[8] !== t1) {
296
+ t2 = /* @__PURE__ */ _jsx("div", {
297
+ "data-slot": "calendar",
298
+ ref: rootRef,
299
+ className: t1,
300
+ ...props
301
+ });
302
+ $[6] = props;
303
+ $[7] = rootRef;
304
+ $[8] = t1;
305
+ $[9] = t2;
306
+ } else {
307
+ t2 = $[9];
308
+ }
309
+ return t2;
310
+ }
311
+ /** Arc's chevrons for the month controls and the caption dropdowns. */
312
+ function CalendarChevron(t0) {
313
+ const $ = _c(19);
314
+ let className;
315
+ let orientation;
316
+ let props;
317
+ if ($[0] !== t0) {
318
+ ({className, orientation, ...props} = t0);
319
+ $[0] = t0;
320
+ $[1] = className;
321
+ $[2] = orientation;
322
+ $[3] = props;
323
+ } else {
324
+ className = $[1];
325
+ orientation = $[2];
326
+ props = $[3];
327
+ }
328
+ if (orientation === "left") {
329
+ let t1;
330
+ if ($[4] !== className) {
331
+ t1 = cn("size-4", className);
332
+ $[4] = className;
333
+ $[5] = t1;
334
+ } else {
335
+ t1 = $[5];
336
+ }
337
+ let t2;
338
+ if ($[6] !== props || $[7] !== t1) {
339
+ t2 = /* @__PURE__ */ _jsx(ChevronLeft, {
340
+ className: t1,
341
+ strokeWidth: 1.75,
342
+ ...props
343
+ });
344
+ $[6] = props;
345
+ $[7] = t1;
346
+ $[8] = t2;
347
+ } else {
348
+ t2 = $[8];
349
+ }
350
+ return t2;
351
+ }
352
+ if (orientation === "right") {
353
+ let t1;
354
+ if ($[9] !== className) {
355
+ t1 = cn("size-4", className);
356
+ $[9] = className;
357
+ $[10] = t1;
358
+ } else {
359
+ t1 = $[10];
360
+ }
361
+ let t2;
362
+ if ($[11] !== props || $[12] !== t1) {
363
+ t2 = /* @__PURE__ */ _jsx(ChevronRight, {
364
+ className: t1,
365
+ strokeWidth: 1.75,
366
+ ...props
367
+ });
368
+ $[11] = props;
369
+ $[12] = t1;
370
+ $[13] = t2;
371
+ } else {
372
+ t2 = $[13];
373
+ }
374
+ return t2;
375
+ }
376
+ let t1;
377
+ if ($[14] !== className) {
378
+ t1 = cn("size-4", className);
379
+ $[14] = className;
380
+ $[15] = t1;
381
+ } else {
382
+ t1 = $[15];
383
+ }
384
+ let t2;
385
+ if ($[16] !== props || $[17] !== t1) {
386
+ t2 = /* @__PURE__ */ _jsx(ChevronDown, {
387
+ className: t1,
199
388
  ...props
200
389
  });
201
- $[47] = T0;
202
- $[48] = captionLayout;
203
- $[49] = locale;
204
- $[50] = props;
205
- $[51] = showOutsideDays;
206
- $[52] = t33;
207
- $[53] = t35;
208
- $[54] = t5;
209
- $[55] = t7;
210
- $[56] = t36;
211
- } else {
212
- t36 = $[56];
213
- }
214
- return t36;
390
+ $[16] = props;
391
+ $[17] = t1;
392
+ $[18] = t2;
393
+ } else {
394
+ t2 = $[18];
395
+ }
396
+ return t2;
215
397
  }
216
- function _temp3(t0) {
217
- const { children, ...props_3 } = t0;
218
- return /* @__PURE__ */ _jsx("td", {
219
- ...props_3,
220
- children: /* @__PURE__ */ _jsx("div", {
398
+ /** The day button slot, which reads the calendar locale for `data-day`. */
399
+ function CalendarDayButtonSlot(props) {
400
+ const $ = _c(3);
401
+ const { dayPickerProps } = useDayPicker();
402
+ let t0;
403
+ if ($[0] !== dayPickerProps.locale || $[1] !== props) {
404
+ t0 = /* @__PURE__ */ _jsx(CalendarDayButton, {
405
+ locale: dayPickerProps.locale,
406
+ ...props
407
+ });
408
+ $[0] = dayPickerProps.locale;
409
+ $[1] = props;
410
+ $[2] = t0;
411
+ } else {
412
+ t0 = $[2];
413
+ }
414
+ return t0;
415
+ }
416
+ /** The month caption, carrying the Today label its reserved space is sized from. Used only with `showToday`. */
417
+ function CalendarMonthCaption(t0) {
418
+ const $ = _c(5);
419
+ let props;
420
+ if ($[0] !== t0) {
421
+ const { calendarMonth: _calendarMonth, displayIndex: _displayIndex, ...t1 } = t0;
422
+ props = t1;
423
+ $[0] = t0;
424
+ $[1] = props;
425
+ } else {
426
+ props = $[1];
427
+ }
428
+ const { todayLabel } = React.useContext(CalendarSettingsContext);
429
+ let t1;
430
+ if ($[2] !== props || $[3] !== todayLabel) {
431
+ t1 = /* @__PURE__ */ _jsx("div", {
432
+ "data-today-label": todayLabel,
433
+ ...props
434
+ });
435
+ $[2] = props;
436
+ $[3] = todayLabel;
437
+ $[4] = t1;
438
+ } else {
439
+ t1 = $[4];
440
+ }
441
+ return t1;
442
+ }
443
+ /** A week number cell sized like a day. */
444
+ function CalendarWeekNumber(t0) {
445
+ const $ = _c(8);
446
+ let children;
447
+ let props;
448
+ if ($[0] !== t0) {
449
+ ({children, ...props} = t0);
450
+ $[0] = t0;
451
+ $[1] = children;
452
+ $[2] = props;
453
+ } else {
454
+ children = $[1];
455
+ props = $[2];
456
+ }
457
+ let t1;
458
+ if ($[3] !== children) {
459
+ t1 = /* @__PURE__ */ _jsx("div", {
221
460
  className: "flex size-(--cell-size) items-center justify-center text-center",
222
461
  children
223
- })
224
- });
462
+ });
463
+ $[3] = children;
464
+ $[4] = t1;
465
+ } else {
466
+ t1 = $[4];
467
+ }
468
+ let t2;
469
+ if ($[5] !== props || $[6] !== t1) {
470
+ t2 = /* @__PURE__ */ _jsx("td", {
471
+ ...props,
472
+ children: t1
473
+ });
474
+ $[5] = props;
475
+ $[6] = t1;
476
+ $[7] = t2;
477
+ } else {
478
+ t2 = $[7];
479
+ }
480
+ return t2;
225
481
  }
226
- function _temp2(t0) {
227
- const { className: className_1, orientation, ...props_1 } = t0;
228
- if (orientation === "left") {
229
- return /* @__PURE__ */ _jsx(ChevronLeft, {
230
- className: cn("size-4", className_1),
231
- ...props_1
482
+ /**
483
+ * react-day-picker's month navigation with Arc's Today button in front of the arrows. Used only with `showToday`,
484
+ * so the default navigation stays untouched otherwise.
485
+ * @param props - Navigation handlers and the neighbouring months react-day-picker passes to its `Nav` slot.
486
+ * @returns The navigation landmark.
487
+ */
488
+ function CalendarNav(t0) {
489
+ const $ = _c(51);
490
+ let navProps;
491
+ let nextMonth;
492
+ let onNextClick;
493
+ let onPreviousClick;
494
+ let previousMonth;
495
+ if ($[0] !== t0) {
496
+ ({onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps} = t0);
497
+ $[0] = t0;
498
+ $[1] = navProps;
499
+ $[2] = nextMonth;
500
+ $[3] = onNextClick;
501
+ $[4] = onPreviousClick;
502
+ $[5] = previousMonth;
503
+ } else {
504
+ navProps = $[1];
505
+ nextMonth = $[2];
506
+ onNextClick = $[3];
507
+ onPreviousClick = $[4];
508
+ previousMonth = $[5];
509
+ }
510
+ const { components, classNames, styles, labels: t1 } = useDayPicker();
511
+ const { labelPrevious, labelNext } = t1;
512
+ let t2;
513
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
514
+ t2 = /* @__PURE__ */ _jsx(CalendarTodayButton, {});
515
+ $[6] = t2;
516
+ } else {
517
+ t2 = $[6];
518
+ }
519
+ const T0 = components.PreviousMonthButton;
520
+ const t3 = classNames[UI.PreviousMonthButton];
521
+ const t4 = styles?.[UI.PreviousMonthButton];
522
+ const t5 = previousMonth ? undefined : -1;
523
+ const t6 = previousMonth ? undefined : true;
524
+ let t7;
525
+ if ($[7] !== labelPrevious || $[8] !== previousMonth) {
526
+ t7 = labelPrevious(previousMonth);
527
+ $[7] = labelPrevious;
528
+ $[8] = previousMonth;
529
+ $[9] = t7;
530
+ } else {
531
+ t7 = $[9];
532
+ }
533
+ let t8;
534
+ if ($[10] !== onPreviousClick || $[11] !== previousMonth) {
535
+ t8 = (event) => {
536
+ if (previousMonth) {
537
+ onPreviousClick?.(event);
538
+ }
539
+ };
540
+ $[10] = onPreviousClick;
541
+ $[11] = previousMonth;
542
+ $[12] = t8;
543
+ } else {
544
+ t8 = $[12];
545
+ }
546
+ const t9 = previousMonth ? undefined : true;
547
+ const t10 = classNames[UI.Chevron];
548
+ const t11 = styles?.[UI.Chevron];
549
+ let t12;
550
+ if ($[13] !== components.Chevron || $[14] !== t10 || $[15] !== t11 || $[16] !== t9) {
551
+ t12 = /* @__PURE__ */ _jsx(components.Chevron, {
552
+ disabled: t9,
553
+ className: t10,
554
+ style: t11,
555
+ orientation: "left"
232
556
  });
557
+ $[13] = components.Chevron;
558
+ $[14] = t10;
559
+ $[15] = t11;
560
+ $[16] = t9;
561
+ $[17] = t12;
562
+ } else {
563
+ t12 = $[17];
233
564
  }
234
- if (orientation === "right") {
235
- return /* @__PURE__ */ _jsx(ChevronRight, {
236
- className: cn("size-4", className_1),
237
- ...props_1
565
+ let t13;
566
+ if ($[18] !== components.PreviousMonthButton || $[19] !== t12 || $[20] !== t3 || $[21] !== t4 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8) {
567
+ t13 = /* @__PURE__ */ _jsx(T0, {
568
+ type: "button",
569
+ className: t3,
570
+ style: t4,
571
+ tabIndex: t5,
572
+ "aria-disabled": t6,
573
+ "aria-label": t7,
574
+ onClick: t8,
575
+ children: t12
238
576
  });
577
+ $[18] = components.PreviousMonthButton;
578
+ $[19] = t12;
579
+ $[20] = t3;
580
+ $[21] = t4;
581
+ $[22] = t5;
582
+ $[23] = t6;
583
+ $[24] = t7;
584
+ $[25] = t8;
585
+ $[26] = t13;
586
+ } else {
587
+ t13 = $[26];
588
+ }
589
+ const T1 = components.NextMonthButton;
590
+ const t14 = classNames[UI.NextMonthButton];
591
+ const t15 = styles?.[UI.NextMonthButton];
592
+ const t16 = nextMonth ? undefined : -1;
593
+ const t17 = nextMonth ? undefined : true;
594
+ let t18;
595
+ if ($[27] !== labelNext || $[28] !== nextMonth) {
596
+ t18 = labelNext(nextMonth);
597
+ $[27] = labelNext;
598
+ $[28] = nextMonth;
599
+ $[29] = t18;
600
+ } else {
601
+ t18 = $[29];
602
+ }
603
+ let t19;
604
+ if ($[30] !== nextMonth || $[31] !== onNextClick) {
605
+ t19 = (event_0) => {
606
+ if (nextMonth) {
607
+ onNextClick?.(event_0);
608
+ }
609
+ };
610
+ $[30] = nextMonth;
611
+ $[31] = onNextClick;
612
+ $[32] = t19;
613
+ } else {
614
+ t19 = $[32];
239
615
  }
240
- return /* @__PURE__ */ _jsx(ChevronDown, {
241
- className: cn("size-4", className_1),
242
- ...props_1
243
- });
616
+ const t20 = nextMonth ? undefined : true;
617
+ const t21 = classNames[UI.Chevron];
618
+ const t22 = styles?.[UI.Chevron];
619
+ let t23;
620
+ if ($[33] !== components.Chevron || $[34] !== t20 || $[35] !== t21 || $[36] !== t22) {
621
+ t23 = /* @__PURE__ */ _jsx(components.Chevron, {
622
+ disabled: t20,
623
+ className: t21,
624
+ style: t22,
625
+ orientation: "right"
626
+ });
627
+ $[33] = components.Chevron;
628
+ $[34] = t20;
629
+ $[35] = t21;
630
+ $[36] = t22;
631
+ $[37] = t23;
632
+ } else {
633
+ t23 = $[37];
634
+ }
635
+ let t24;
636
+ if ($[38] !== components.NextMonthButton || $[39] !== t14 || $[40] !== t15 || $[41] !== t16 || $[42] !== t17 || $[43] !== t18 || $[44] !== t19 || $[45] !== t23) {
637
+ t24 = /* @__PURE__ */ _jsx(T1, {
638
+ type: "button",
639
+ className: t14,
640
+ style: t15,
641
+ tabIndex: t16,
642
+ "aria-disabled": t17,
643
+ "aria-label": t18,
644
+ onClick: t19,
645
+ children: t23
646
+ });
647
+ $[38] = components.NextMonthButton;
648
+ $[39] = t14;
649
+ $[40] = t15;
650
+ $[41] = t16;
651
+ $[42] = t17;
652
+ $[43] = t18;
653
+ $[44] = t19;
654
+ $[45] = t23;
655
+ $[46] = t24;
656
+ } else {
657
+ t24 = $[46];
658
+ }
659
+ let t25;
660
+ if ($[47] !== navProps || $[48] !== t13 || $[49] !== t24) {
661
+ t25 = /* @__PURE__ */ _jsxs("nav", {
662
+ ...navProps,
663
+ children: [
664
+ t2,
665
+ t13,
666
+ t24
667
+ ]
668
+ });
669
+ $[47] = navProps;
670
+ $[48] = t13;
671
+ $[49] = t24;
672
+ $[50] = t25;
673
+ } else {
674
+ t25 = $[50];
675
+ }
676
+ return t25;
677
+ }
678
+ /** Whether two dates fall in the same calendar month. */
679
+ function isSameMonth(firstDate, secondDate) {
680
+ return firstDate.getFullYear() === secondDate.getFullYear() && firstDate.getMonth() === secondDate.getMonth();
244
681
  }
245
- function _temp(t0) {
246
- const { className: className_0, rootRef, ...props_0 } = t0;
247
- return /* @__PURE__ */ _jsx("div", {
248
- "data-slot": "calendar",
249
- ref: rootRef,
250
- className: cn(className_0),
251
- ...props_0
252
- });
682
+ /** Months elapsed since year zero, so two dates can be compared by calendar month alone. */
683
+ function toMonthIndex(date) {
684
+ return date.getFullYear() * CALENDAR_MONTHS_PER_YEAR + date.getMonth();
685
+ }
686
+ /** Whether two dates fall on the same calendar day, read in the dates' own time zone. */
687
+ function isSameDate(firstDate, secondDate) {
688
+ return isSameMonth(firstDate, secondDate) && firstDate.getDate() === secondDate.getDate();
689
+ }
690
+ /**
691
+ * Finds the rendered day of a date inside the displayed months, so its modifiers can be read from DayPicker.
692
+ * @param months - Months DayPicker displays.
693
+ * @param date - Date to look for.
694
+ * @returns The day in its own month, or `undefined` when that month is not displayed.
695
+ */
696
+ function findDisplayedDay(months, date) {
697
+ return months.flatMap((month) => month.weeks.flatMap((week) => week.days)).find((day) => !day.outside && isSameDate(day.date, date));
253
698
  }
254
699
  /**
255
- * Renders one displayed month and slides it in from the side the user navigated from.
700
+ * Arc's Today button. Today is DayPicker's own (the `today` prop, or today in its `timeZone`), so the button always
701
+ * agrees with the day marked as today; it is only read once hydrated, so server markup never depends on the server
702
+ * clock, and until then the button rests dimmed.
703
+ * @returns A button that brings today into view and selects it in single mode when it is not disabled.
704
+ */
705
+ function CalendarTodayButton() {
706
+ const $ = _c(39);
707
+ const { months, goToMonth, getModifiers, select, isSelected, dayPickerProps } = useDayPicker();
708
+ const { todayLabel } = React.useContext(CalendarSettingsContext);
709
+ const isHydrated = useIsHydrated();
710
+ const today = isHydrated ? dayPickerProps.today : undefined;
711
+ let t0;
712
+ if ($[0] !== months || $[1] !== today) {
713
+ t0 = today && months.some((month) => isSameMonth(month.date, today));
714
+ $[0] = months;
715
+ $[1] = today;
716
+ $[2] = t0;
717
+ } else {
718
+ t0 = $[2];
719
+ }
720
+ const isTodayShown = Boolean(t0);
721
+ let t1;
722
+ if ($[3] !== months || $[4] !== today) {
723
+ t1 = today && findDisplayedDay(months, today);
724
+ $[3] = months;
725
+ $[4] = today;
726
+ $[5] = t1;
727
+ } else {
728
+ t1 = $[5];
729
+ }
730
+ const todayDay = t1;
731
+ let t2;
732
+ if ($[6] !== getModifiers || $[7] !== todayDay) {
733
+ t2 = todayDay ? getModifiers(todayDay) : undefined;
734
+ $[6] = getModifiers;
735
+ $[7] = todayDay;
736
+ $[8] = t2;
737
+ } else {
738
+ t2 = $[8];
739
+ }
740
+ const displayedTodayModifiers = t2;
741
+ let t3;
742
+ if ($[9] !== dayPickerProps || $[10] !== displayedTodayModifiers || $[11] !== today) {
743
+ t3 = displayedTodayModifiers ? displayedTodayModifiers.disabled || displayedTodayModifiers.hidden : Boolean(today && (dateMatchModifiers(today, dayPickerProps.disabled ?? []) || dateMatchModifiers(today, dayPickerProps.hidden ?? [])));
744
+ $[9] = dayPickerProps;
745
+ $[10] = displayedTodayModifiers;
746
+ $[11] = today;
747
+ $[12] = t3;
748
+ } else {
749
+ t3 = $[12];
750
+ }
751
+ const isTodayBlocked = t3;
752
+ const isTodaySelectable = Boolean(today && select && dayPickerProps.mode === "single" && !isTodayBlocked);
753
+ let t4;
754
+ if ($[13] !== isSelected || $[14] !== today) {
755
+ t4 = today && isSelected?.(today);
756
+ $[13] = isSelected;
757
+ $[14] = today;
758
+ $[15] = t4;
759
+ } else {
760
+ t4 = $[15];
761
+ }
762
+ const isTodaySelected = Boolean(t4);
763
+ const isTodayOutOfRange = Boolean(today && (dayPickerProps.startMonth && toMonthIndex(today) < toMonthIndex(dayPickerProps.startMonth) || dayPickerProps.endMonth && toMonthIndex(today) > toMonthIndex(dayPickerProps.endMonth)));
764
+ const isIdle = !today || !isTodayShown && isTodayOutOfRange || isTodayShown && (!isTodaySelectable || isTodaySelected);
765
+ let t5;
766
+ if ($[16] !== getModifiers || $[17] !== months || $[18] !== select) {
767
+ t5 = {
768
+ months,
769
+ getModifiers,
770
+ select
771
+ };
772
+ $[16] = getModifiers;
773
+ $[17] = months;
774
+ $[18] = select;
775
+ $[19] = t5;
776
+ } else {
777
+ t5 = $[19];
778
+ }
779
+ const latestDayPickerRef = React.useRef(t5);
780
+ let t6;
781
+ if ($[20] !== getModifiers || $[21] !== months || $[22] !== select) {
782
+ t6 = () => {
783
+ latestDayPickerRef.current = {
784
+ months,
785
+ getModifiers,
786
+ select
787
+ };
788
+ };
789
+ $[20] = getModifiers;
790
+ $[21] = months;
791
+ $[22] = select;
792
+ $[23] = t6;
793
+ } else {
794
+ t6 = $[23];
795
+ }
796
+ React.useLayoutEffect(t6);
797
+ let t7;
798
+ if ($[24] !== today) {
799
+ t7 = (event) => {
800
+ const latest = latestDayPickerRef.current;
801
+ const todayDay_0 = today && findDisplayedDay(latest.months, today);
802
+ if (!todayDay_0) {
803
+ return;
804
+ }
805
+ const modifiers = latest.getModifiers(todayDay_0);
806
+ if (modifiers.disabled || modifiers.hidden) {
807
+ return;
808
+ }
809
+ const selectSingle = latest.select;
810
+ selectSingle?.(todayDay_0.date, modifiers, event);
811
+ };
812
+ $[24] = today;
813
+ $[25] = t7;
814
+ } else {
815
+ t7 = $[25];
816
+ }
817
+ const selectDisplayedToday = t7;
818
+ let t8;
819
+ if ($[26] !== goToMonth || $[27] !== isIdle || $[28] !== isTodaySelectable || $[29] !== isTodaySelected || $[30] !== isTodayShown || $[31] !== selectDisplayedToday || $[32] !== today) {
820
+ t8 = (event_0) => {
821
+ if (isIdle || !today) {
822
+ return;
823
+ }
824
+ const shouldSelect = isTodaySelectable && !isTodaySelected;
825
+ if (!isTodayShown) {
826
+ flushSync(() => goToMonth(today));
827
+ }
828
+ if (shouldSelect) {
829
+ selectDisplayedToday(event_0);
830
+ }
831
+ };
832
+ $[26] = goToMonth;
833
+ $[27] = isIdle;
834
+ $[28] = isTodaySelectable;
835
+ $[29] = isTodaySelected;
836
+ $[30] = isTodayShown;
837
+ $[31] = selectDisplayedToday;
838
+ $[32] = today;
839
+ $[33] = t8;
840
+ } else {
841
+ t8 = $[33];
842
+ }
843
+ const handleClick = t8;
844
+ const t9 = isIdle || undefined;
845
+ let t10;
846
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
847
+ t10 = cn(calendarHeaderControlClassName, "inline-flex cursor-pointer items-center border-0 bg-transparent px-[11px] text-sm leading-none font-medium outline-none focus-visible:ring-3 focus-visible:ring-ring/50 [-webkit-tap-highlight-color:transparent]");
848
+ $[34] = t10;
849
+ } else {
850
+ t10 = $[34];
851
+ }
852
+ let t11;
853
+ if ($[35] !== handleClick || $[36] !== t9 || $[37] !== todayLabel) {
854
+ t11 = /* @__PURE__ */ _jsx("button", {
855
+ type: "button",
856
+ "data-slot": "calendar-today",
857
+ "aria-disabled": t9,
858
+ className: t10,
859
+ onClick: handleClick,
860
+ children: todayLabel
861
+ });
862
+ $[35] = handleClick;
863
+ $[36] = t9;
864
+ $[37] = todayLabel;
865
+ $[38] = t11;
866
+ } else {
867
+ t11 = $[38];
868
+ }
869
+ return t11;
870
+ }
871
+ /** Offset of a day button inside its month, from layout offsets, so press scales and the month slide never skew it. */
872
+ function measureDayOffset(day, month) {
873
+ let horizontalOffset = 0;
874
+ let verticalOffset = 0;
875
+ let node = day;
876
+ while (node && node !== month) {
877
+ horizontalOffset += node.offsetLeft;
878
+ verticalOffset += node.offsetTop;
879
+ node = node.offsetParent;
880
+ }
881
+ return {
882
+ x: horizontalOffset,
883
+ y: verticalOffset
884
+ };
885
+ }
886
+ /**
887
+ * Arc's selected disc for one month in single selection mode. It glides on a spring between two days of the same
888
+ * month, retargets mid-flight on a new pick, grows in when the selection enters the month and fades out when it leaves.
889
+ * While it paints the selection the month carries {@link CALENDAR_SELECTION_DISC_ATTRIBUTE}, so the selected day drops
890
+ * its own fill; before hydration, and in other modes, the day keeps that fill.
891
+ * @param monthRef - The month container the disc is positioned in.
892
+ * @param monthTime - The month being displayed, so a month change jumps the disc instead of gliding it.
893
+ * @param isEnabled - Whether the calendar is in single selection mode.
894
+ * @returns The ref for the disc element.
895
+ */
896
+ function useSelectionDisc(monthRef, monthTime, isEnabled) {
897
+ const $ = _c(12);
898
+ const discRef = React.useRef(null);
899
+ let t0;
900
+ if ($[0] !== monthTime) {
901
+ t0 = {
902
+ dayKey: null,
903
+ monthTime
904
+ };
905
+ $[0] = monthTime;
906
+ $[1] = t0;
907
+ } else {
908
+ t0 = $[1];
909
+ }
910
+ const placementRef = React.useRef(t0);
911
+ let t1;
912
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
913
+ t1 = [];
914
+ $[2] = t1;
915
+ } else {
916
+ t1 = $[2];
917
+ }
918
+ const animationsRef = React.useRef(t1);
919
+ const reduceMotion = usePrefersReducedMotion();
920
+ let t2;
921
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
922
+ t2 = () => {
923
+ animationsRef.current.forEach(_temp);
924
+ animationsRef.current = [];
925
+ };
926
+ $[3] = t2;
927
+ } else {
928
+ t2 = $[3];
929
+ }
930
+ const stopAnimations = t2;
931
+ let t3;
932
+ if ($[4] !== isEnabled || $[5] !== monthRef || $[6] !== monthTime || $[7] !== reduceMotion) {
933
+ t3 = () => {
934
+ const month = monthRef.current;
935
+ const disc = discRef.current;
936
+ if (!month || !disc) {
937
+ return;
938
+ }
939
+ const selectedDay = isEnabled ? month.querySelector(CALENDAR_SELECTED_DAY_SELECTOR) : null;
940
+ const dayKey = selectedDay?.getAttribute("data-day") ?? null;
941
+ const previous = placementRef.current;
942
+ if (previous.dayKey === dayKey && previous.monthTime === monthTime) {
943
+ return;
944
+ }
945
+ placementRef.current = {
946
+ dayKey,
947
+ monthTime
948
+ };
949
+ stopAnimations();
950
+ if (!selectedDay) {
951
+ month.removeAttribute(CALENDAR_SELECTION_DISC_ATTRIBUTE);
952
+ if (previous.dayKey === null) {
953
+ return;
954
+ }
955
+ const fade = reduceMotion ? { duration: 0 } : {
956
+ duration: CALENDAR_SELECTION_EXIT_DURATION_S,
957
+ ease: [...ARC_EASE.standard]
958
+ };
959
+ animationsRef.current = [animate(disc, {
960
+ opacity: 0,
961
+ scale: CALENDAR_SELECTION_ENTER_SCALE
962
+ }, fade)];
963
+ return;
964
+ }
965
+ const offset = measureDayOffset(selectedDay, month);
966
+ disc.style.width = `${selectedDay.offsetWidth}px`;
967
+ disc.style.height = `${selectedDay.offsetHeight}px`;
968
+ month.setAttribute(CALENDAR_SELECTION_DISC_ATTRIBUTE, "visible");
969
+ const isGlide = previous.dayKey !== null && previous.monthTime === monthTime && !reduceMotion;
970
+ if (isGlide) {
971
+ animationsRef.current = [animate(disc, {
972
+ x: offset.x,
973
+ y: offset.y
974
+ }, ARC_SPRING_MORPH)];
975
+ return;
976
+ }
977
+ const isEntering = previous.dayKey === null;
978
+ animationsRef.current = [animate(disc, {
979
+ x: offset.x,
980
+ y: offset.y
981
+ }, { duration: 0 })];
982
+ if (isEntering && !reduceMotion) {
983
+ animationsRef.current.push(animate(disc, { opacity: [0, 1] }, {
984
+ duration: ARC_DURATION.fast,
985
+ ease: [...ARC_EASE.enter]
986
+ }), animate(disc, { scale: [CALENDAR_SELECTION_ENTER_SCALE, 1] }, ARC_SPRING_SNAPPY));
987
+ } else {
988
+ animationsRef.current.push(animate(disc, {
989
+ opacity: 1,
990
+ scale: 1
991
+ }, { duration: 0 }));
992
+ }
993
+ };
994
+ $[4] = isEnabled;
995
+ $[5] = monthRef;
996
+ $[6] = monthTime;
997
+ $[7] = reduceMotion;
998
+ $[8] = t3;
999
+ } else {
1000
+ t3 = $[8];
1001
+ }
1002
+ React.useLayoutEffect(t3);
1003
+ let t4;
1004
+ let t5;
1005
+ if ($[9] !== monthRef) {
1006
+ t4 = () => {
1007
+ const month_0 = monthRef.current;
1008
+ const disc_0 = discRef.current;
1009
+ if (!month_0 || !disc_0 || typeof ResizeObserver === "undefined") {
1010
+ return;
1011
+ }
1012
+ const observer = new ResizeObserver(() => {
1013
+ const selectedDay_0 = month_0.querySelector(CALENDAR_SELECTED_DAY_SELECTOR);
1014
+ if (!selectedDay_0 || placementRef.current.dayKey === null) {
1015
+ return;
1016
+ }
1017
+ stopAnimations();
1018
+ const offset_0 = measureDayOffset(selectedDay_0, month_0);
1019
+ disc_0.style.width = `${selectedDay_0.offsetWidth}px`;
1020
+ disc_0.style.height = `${selectedDay_0.offsetHeight}px`;
1021
+ animationsRef.current = [animate(disc_0, {
1022
+ x: offset_0.x,
1023
+ y: offset_0.y,
1024
+ opacity: 1,
1025
+ scale: 1
1026
+ }, { duration: 0 })];
1027
+ });
1028
+ observer.observe(month_0);
1029
+ return () => {
1030
+ observer.disconnect();
1031
+ stopAnimations();
1032
+ };
1033
+ };
1034
+ t5 = [monthRef, stopAnimations];
1035
+ $[9] = monthRef;
1036
+ $[10] = t4;
1037
+ $[11] = t5;
1038
+ } else {
1039
+ t4 = $[10];
1040
+ t5 = $[11];
1041
+ }
1042
+ React.useEffect(t4, t5);
1043
+ return discRef;
1044
+ }
1045
+ function _temp(animation) {
1046
+ return animation.stop();
1047
+ }
1048
+ /**
1049
+ * Renders one displayed month and slides it in from the side the user navigated from, on Arc's month spring.
256
1050
  * DayPicker keys months by display position, so this instance survives navigation and can
257
1051
  * compare the new month with the previous one. The first render and reduced motion stay static.
258
1052
  * @param props - DayPicker month properties, including the month being displayed.
259
- * @returns The month container with its caption and grid.
1053
+ * @returns The month container with its caption, grid and selected disc.
260
1054
  */
261
1055
  function CalendarMonth(t0) {
262
- const $ = _c(13);
1056
+ const $ = _c(16);
263
1057
  let calendarMonth;
264
1058
  let children;
265
1059
  let displayIndex;
@@ -281,6 +1075,8 @@ function CalendarMonth(t0) {
281
1075
  const monthTime = calendarMonth.date.getTime();
282
1076
  const previousMonthTimeRef = React.useRef(monthTime);
283
1077
  const reduceMotion = usePrefersReducedMotion();
1078
+ const { dayPickerProps } = useDayPicker();
1079
+ const discRef = useSelectionDisc(monthRef, monthTime, dayPickerProps.mode === "single");
284
1080
  let t1;
285
1081
  let t2;
286
1082
  if ($[5] !== monthTime || $[6] !== reduceMotion) {
@@ -303,12 +1099,9 @@ function CalendarMonth(t0) {
303
1099
  element.style.transform = original.transform;
304
1100
  };
305
1101
  const animation = animate(element, {
306
- opacity: [0, 1],
1102
+ opacity: [CALENDAR_MONTH_ENTER_OPACITY, 1],
307
1103
  transform: [`translateX(${direction * MOTION_MONTH_DISTANCE}px)`, "translateX(0px)"]
308
- }, {
309
- duration: MOTION_TIMING.monthSwap,
310
- ease: [...MOTION_EASE]
311
- });
1104
+ }, CALENDAR_MONTH_SPRING);
312
1105
  let isActive = true;
313
1106
  animation.then(() => frame.postRender(() => {
314
1107
  if (isActive) {
@@ -332,23 +1125,43 @@ function CalendarMonth(t0) {
332
1125
  }
333
1126
  React.useLayoutEffect(t1, t2);
334
1127
  let t3;
335
- if ($[9] !== children || $[10] !== displayIndex || $[11] !== props) {
336
- t3 = /* @__PURE__ */ _jsx("div", {
1128
+ if ($[9] !== discRef) {
1129
+ t3 = /* @__PURE__ */ _jsx("span", {
1130
+ ref: discRef,
1131
+ "aria-hidden": "true",
1132
+ "data-slot": "calendar-selection",
1133
+ className: "pointer-events-none absolute top-0 left-0 z-0 rounded-full bg-accent opacity-0"
1134
+ });
1135
+ $[9] = discRef;
1136
+ $[10] = t3;
1137
+ } else {
1138
+ t3 = $[10];
1139
+ }
1140
+ let t4;
1141
+ if ($[11] !== children || $[12] !== displayIndex || $[13] !== props || $[14] !== t3) {
1142
+ t4 = /* @__PURE__ */ _jsxs("div", {
337
1143
  ref: monthRef,
338
1144
  "data-slot": "calendar-month",
339
1145
  "data-display-index": displayIndex,
340
1146
  ...props,
341
- children
1147
+ children: [t3, children]
342
1148
  });
343
- $[9] = children;
344
- $[10] = displayIndex;
345
- $[11] = props;
346
- $[12] = t3;
1149
+ $[11] = children;
1150
+ $[12] = displayIndex;
1151
+ $[13] = props;
1152
+ $[14] = t3;
1153
+ $[15] = t4;
347
1154
  } else {
348
- t3 = $[12];
1155
+ t4 = $[15];
349
1156
  }
350
- return t3;
1157
+ return t4;
351
1158
  }
1159
+ /**
1160
+ * One day of the grid: a round cell whose fill answers hover on fine pointers, presses in slightly and marks today
1161
+ * with a dot under its number that takes the number's colour.
1162
+ * @param props - react-day-picker day button properties plus the locale used for `data-day`.
1163
+ * @returns The day button.
1164
+ */
352
1165
  function CalendarDayButton(t0) {
353
1166
  const $ = _c(21);
354
1167
  let className;
@@ -390,49 +1203,48 @@ function CalendarDayButton(t0) {
390
1203
  t2 = $[8];
391
1204
  }
392
1205
  React.useEffect(t1, t2);
393
- const T0 = ControlButton;
394
- const t3 = "ghost";
395
- const t4 = "icon";
396
- let t5;
1206
+ const isSelectedSingle = Boolean(modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle);
1207
+ const t3 = "button";
1208
+ let t4;
397
1209
  if ($[9] !== day.date || $[10] !== locale?.code) {
398
- t5 = day.date.toLocaleDateString(locale?.code);
1210
+ t4 = day.date.toLocaleDateString(locale?.code);
399
1211
  $[9] = day.date;
400
1212
  $[10] = locale?.code;
401
- $[11] = t5;
1213
+ $[11] = t4;
402
1214
  } else {
403
- t5 = $[11];
1215
+ t4 = $[11];
404
1216
  }
405
- const t6 = modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle;
406
- const t7 = modifiers.range_start;
407
- const t8 = modifiers.range_end;
408
- const t9 = modifiers.range_middle;
409
- const t10 = cn("relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className);
410
- let t11;
411
- if ($[12] !== T0 || $[13] !== modifiers.range_end || $[14] !== modifiers.range_middle || $[15] !== modifiers.range_start || $[16] !== props || $[17] !== t10 || $[18] !== t5 || $[19] !== t6) {
412
- t11 = /* @__PURE__ */ _jsx(T0, {
1217
+ const t5 = modifiers.range_start;
1218
+ const t6 = modifiers.range_end;
1219
+ const t7 = modifiers.range_middle;
1220
+ const t8 = modifiers.today || undefined;
1221
+ const t9 = cn("relative isolate z-10 flex aspect-square w-full min-w-(--cell-size) cursor-pointer flex-col items-center justify-center gap-1 rounded-(--cell-radius) border-0 bg-transparent p-0 text-sm leading-none font-normal text-foreground tabular-nums outline-none select-none [-webkit-tap-highlight-color:transparent] [&>span]:text-xs [&>span]:opacity-70", "transition-[color,background-color,scale] duration-(--duration-fast) ease-(--ease-standard) motion-reduce:transition-none", "hover-fine:not-disabled:not-data-[selected-single=true]:not-data-[range-start=true]:not-data-[range-end=true]:bg-surface-muted active:not-disabled:scale-[.94] motion-reduce:active:scale-100", "focus-visible:ring-3 focus-visible:ring-ring/50 group-data-[focused=true]/day:ring-3 group-data-[focused=true]/day:ring-ring/50", modifiers.outside && "text-text-muted", modifiers.disabled && "cursor-default text-text-muted opacity-40", modifiers.today && "font-medium after:pointer-events-none after:absolute after:bottom-[18%] after:left-1/2 after:size-1 after:-translate-x-1/2 after:rounded-full after:bg-current", "data-[selected-single=true]:bg-accent data-[selected-single=true]:font-medium data-[selected-single=true]:text-accent-foreground group-data-[selection-disc=visible]/calendar-month:data-[selected-single=true]:bg-transparent", "data-[range-start=true]:bg-accent data-[range-start=true]:text-accent-foreground data-[range-end=true]:bg-accent data-[range-end=true]:text-accent-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-surface-muted data-[range-middle=true]:text-foreground", defaultClassNames.day, className);
1222
+ let t10;
1223
+ if ($[12] !== isSelectedSingle || $[13] !== modifiers.range_end || $[14] !== modifiers.range_middle || $[15] !== modifiers.range_start || $[16] !== props || $[17] !== t4 || $[18] !== t8 || $[19] !== t9) {
1224
+ t10 = /* @__PURE__ */ _jsx("button", {
413
1225
  ref,
414
- variant: t3,
415
- size: t4,
416
- "data-day": t5,
417
- "data-selected-single": t6,
418
- "data-range-start": t7,
419
- "data-range-end": t8,
420
- "data-range-middle": t9,
421
- className: t10,
1226
+ type: t3,
1227
+ "data-day": t4,
1228
+ "data-selected-single": isSelectedSingle,
1229
+ "data-range-start": t5,
1230
+ "data-range-end": t6,
1231
+ "data-range-middle": t7,
1232
+ "data-today": t8,
1233
+ className: t9,
422
1234
  ...props
423
1235
  });
424
- $[12] = T0;
1236
+ $[12] = isSelectedSingle;
425
1237
  $[13] = modifiers.range_end;
426
1238
  $[14] = modifiers.range_middle;
427
1239
  $[15] = modifiers.range_start;
428
1240
  $[16] = props;
429
- $[17] = t10;
430
- $[18] = t5;
431
- $[19] = t6;
432
- $[20] = t11;
1241
+ $[17] = t4;
1242
+ $[18] = t8;
1243
+ $[19] = t9;
1244
+ $[20] = t10;
433
1245
  } else {
434
- t11 = $[20];
1246
+ t10 = $[20];
435
1247
  }
436
- return t11;
1248
+ return t10;
437
1249
  }
438
1250
  export { Calendar, CalendarDayButton };