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.
- package/CHANGELOG.md +63 -0
- package/THIRD_PARTY_NOTICES.md +1 -1
- package/dist/components/alert-dialog.d.ts +15 -4
- package/dist/components/alert-dialog.js +84 -44
- package/dist/components/alert.d.ts +30 -9
- package/dist/components/alert.js +360 -39
- package/dist/components/avatar.d.ts +33 -10
- package/dist/components/avatar.js +110 -30
- package/dist/components/badge.d.ts +39 -7
- package/dist/components/badge.js +348 -24
- package/dist/components/calendar.d.ts +29 -2
- package/dist/components/calendar.js +1035 -223
- package/dist/components/card.d.ts +17 -1
- package/dist/components/card.js +34 -8
- package/dist/components/carousel.d.ts +29 -2
- package/dist/components/carousel.js +471 -90
- package/dist/components/checkbox.d.ts +13 -2
- package/dist/components/checkbox.js +301 -41
- package/dist/components/dialog-surface.d.ts +27 -0
- package/dist/components/dialog-surface.js +137 -0
- package/dist/components/dialog.d.ts +21 -4
- package/dist/components/dialog.js +163 -96
- package/dist/components/dropdown-menu.d.ts +30 -16
- package/dist/components/dropdown-menu.js +139 -83
- package/dist/components/hover-card.d.ts +46 -3
- package/dist/components/hover-card.js +423 -60
- package/dist/components/pagination.d.ts +32 -14
- package/dist/components/pagination.js +136 -59
- package/dist/components/popover.d.ts +14 -5
- package/dist/components/popover.js +78 -36
- package/dist/components/radio-group.d.ts +19 -3
- package/dist/components/radio-group.js +400 -57
- package/dist/components/select.d.ts +17 -6
- package/dist/components/select.js +83 -71
- package/dist/components/sheet.js +37 -26
- package/dist/components/sidebar.js +11 -0
- package/dist/components/skeleton.d.ts +19 -5
- package/dist/components/skeleton.js +434 -14
- package/dist/components/switch.d.ts +14 -4
- package/dist/components/switch.js +424 -40
- package/dist/components/tabs.d.ts +38 -5
- package/dist/components/tabs.js +564 -97
- package/dist/components/themed-toaster.d.ts +6 -2
- package/dist/components/themed-toaster.js +80 -50
- package/dist/components/tooltip.d.ts +33 -2
- package/dist/components/tooltip.js +197 -69
- package/dist/constants/alert.d.ts +12 -0
- package/dist/constants/alert.js +9 -0
- package/dist/constants/avatar.d.ts +10 -0
- package/dist/constants/avatar.js +7 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/calendar.d.ts +24 -0
- package/dist/constants/calendar.js +22 -0
- package/dist/constants/carousel.d.ts +37 -0
- package/dist/constants/carousel.js +53 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +6 -0
- package/dist/constants/dialog.js +6 -0
- package/dist/constants/dropdown-menu.d.ts +5 -0
- package/dist/constants/dropdown-menu.js +5 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/pagination.d.ts +9 -0
- package/dist/constants/pagination.js +9 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +39 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +3 -0
- package/dist/constants/select.js +3 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/switch.d.ts +44 -0
- package/dist/constants/switch.js +49 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +167 -0
- package/dist/motion/glide-indicator.d.ts +6 -7
- package/dist/motion/glide-indicator.js +5 -3
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/styles.css +1 -1
- 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 {
|
|
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 {
|
|
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(
|
|
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
|
|
54
|
-
let
|
|
55
|
-
if ($[
|
|
56
|
-
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
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
|
-
|
|
97
|
+
t10 = $[15];
|
|
61
98
|
}
|
|
62
|
-
let
|
|
63
|
-
if ($[
|
|
64
|
-
|
|
65
|
-
formatMonthDropdown:
|
|
99
|
+
let t11;
|
|
100
|
+
if ($[16] !== formatters || $[17] !== t10) {
|
|
101
|
+
t11 = {
|
|
102
|
+
formatMonthDropdown: t10,
|
|
66
103
|
...formatters
|
|
67
104
|
};
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
} else {
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
const
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
let
|
|
100
|
-
if ($[
|
|
101
|
-
|
|
102
|
-
root:
|
|
103
|
-
months:
|
|
104
|
-
month:
|
|
105
|
-
nav:
|
|
106
|
-
button_previous:
|
|
107
|
-
button_next:
|
|
108
|
-
month_caption:
|
|
109
|
-
dropdowns:
|
|
110
|
-
dropdown_root:
|
|
111
|
-
dropdown:
|
|
112
|
-
caption_label:
|
|
113
|
-
month_grid:
|
|
114
|
-
weekdays:
|
|
115
|
-
weekday:
|
|
116
|
-
week:
|
|
117
|
-
week_number_header:
|
|
118
|
-
week_number:
|
|
119
|
-
day:
|
|
120
|
-
range_start:
|
|
121
|
-
range_middle:
|
|
122
|
-
range_end:
|
|
123
|
-
today:
|
|
124
|
-
outside:
|
|
125
|
-
disabled:
|
|
126
|
-
hidden:
|
|
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
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
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
|
-
|
|
194
|
+
t37 = $[45];
|
|
158
195
|
}
|
|
159
|
-
let
|
|
160
|
-
if ($[
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
205
|
+
t38 = $[47];
|
|
172
206
|
}
|
|
173
|
-
let
|
|
174
|
-
if ($[
|
|
175
|
-
|
|
176
|
-
Root:
|
|
177
|
-
Chevron:
|
|
178
|
-
DayButton:
|
|
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
|
-
|
|
214
|
+
...t38,
|
|
215
|
+
WeekNumber: CalendarWeekNumber,
|
|
181
216
|
...components
|
|
182
217
|
};
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
218
|
+
$[48] = components;
|
|
219
|
+
$[49] = t38;
|
|
220
|
+
$[50] = t39;
|
|
186
221
|
} else {
|
|
187
|
-
|
|
222
|
+
t39 = $[50];
|
|
188
223
|
}
|
|
189
|
-
let
|
|
190
|
-
if ($[
|
|
191
|
-
|
|
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:
|
|
228
|
+
className: t9,
|
|
194
229
|
captionLayout,
|
|
195
230
|
locale,
|
|
196
|
-
formatters:
|
|
197
|
-
classNames:
|
|
198
|
-
components:
|
|
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
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
|
|
205
|
-
$[
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
-
|
|
246
|
-
|
|
247
|
-
return
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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
|
-
*
|
|
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
|
|
1053
|
+
* @returns The month container with its caption, grid and selected disc.
|
|
260
1054
|
*/
|
|
261
1055
|
function CalendarMonth(t0) {
|
|
262
|
-
const $ = _c(
|
|
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: [
|
|
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] !==
|
|
336
|
-
t3 = /* @__PURE__ */ _jsx("
|
|
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
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
1149
|
+
$[11] = children;
|
|
1150
|
+
$[12] = displayIndex;
|
|
1151
|
+
$[13] = props;
|
|
1152
|
+
$[14] = t3;
|
|
1153
|
+
$[15] = t4;
|
|
347
1154
|
} else {
|
|
348
|
-
|
|
1155
|
+
t4 = $[15];
|
|
349
1156
|
}
|
|
350
|
-
return
|
|
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
|
|
394
|
-
const t3 = "
|
|
395
|
-
|
|
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
|
-
|
|
1210
|
+
t4 = day.date.toLocaleDateString(locale?.code);
|
|
399
1211
|
$[9] = day.date;
|
|
400
1212
|
$[10] = locale?.code;
|
|
401
|
-
$[11] =
|
|
1213
|
+
$[11] = t4;
|
|
402
1214
|
} else {
|
|
403
|
-
|
|
1215
|
+
t4 = $[11];
|
|
404
1216
|
}
|
|
405
|
-
const
|
|
406
|
-
const
|
|
407
|
-
const
|
|
408
|
-
const
|
|
409
|
-
const
|
|
410
|
-
let
|
|
411
|
-
if ($[12] !==
|
|
412
|
-
|
|
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
|
-
|
|
415
|
-
|
|
416
|
-
"data-
|
|
417
|
-
"data-
|
|
418
|
-
"data-range-
|
|
419
|
-
"data-range-
|
|
420
|
-
"data-
|
|
421
|
-
className:
|
|
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] =
|
|
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] =
|
|
430
|
-
$[18] =
|
|
431
|
-
$[19] =
|
|
432
|
-
$[20] =
|
|
1241
|
+
$[17] = t4;
|
|
1242
|
+
$[18] = t8;
|
|
1243
|
+
$[19] = t9;
|
|
1244
|
+
$[20] = t10;
|
|
433
1245
|
} else {
|
|
434
|
-
|
|
1246
|
+
t10 = $[20];
|
|
435
1247
|
}
|
|
436
|
-
return
|
|
1248
|
+
return t10;
|
|
437
1249
|
}
|
|
438
1250
|
export { Calendar, CalendarDayButton };
|