jenosize-ui 0.1.0
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/LICENSE +28 -0
- package/README.md +100 -0
- package/THIRD-PARTY-NOTICES.md +163 -0
- package/dist/Button-Bt7pzM4R.d.ts +82 -0
- package/dist/PaymentInput-CKPIPNWH.d.ts +141 -0
- package/dist/Select-CVbEQ2Ep.d.ts +118 -0
- package/dist/TagInput-CTJYOB4J.d.ts +90 -0
- package/dist/avatar.d.ts +161 -0
- package/dist/avatar.js +11 -0
- package/dist/badge.d.ts +109 -0
- package/dist/badge.js +10 -0
- package/dist/breadcrumb.d.ts +58 -0
- package/dist/breadcrumb.js +7 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +14 -0
- package/dist/calendar.d.ts +368 -0
- package/dist/calendar.js +21 -0
- package/dist/callout.d.ts +70 -0
- package/dist/callout.js +16 -0
- package/dist/card-nWicloNi.d.ts +80 -0
- package/dist/card.d.ts +2 -0
- package/dist/card.js +7 -0
- package/dist/checkbox.d.ts +133 -0
- package/dist/checkbox.js +11 -0
- package/dist/chunk-24TO7E32.js +42 -0
- package/dist/chunk-3Y5X7B5C.js +146 -0
- package/dist/chunk-4OLULPQG.js +202 -0
- package/dist/chunk-4P2NBLBW.js +103 -0
- package/dist/chunk-52IFGFTL.js +11 -0
- package/dist/chunk-5FATN5YD.js +115 -0
- package/dist/chunk-5NOBSXJN.js +297 -0
- package/dist/chunk-5RAPA22E.js +106 -0
- package/dist/chunk-7EUAMHMU.js +16 -0
- package/dist/chunk-7EWQKTNQ.js +1336 -0
- package/dist/chunk-7HOIZ3UO.js +110 -0
- package/dist/chunk-7IU5TMFL.js +452 -0
- package/dist/chunk-7JBNLEJ7.js +29 -0
- package/dist/chunk-7S2TBALK.js +23 -0
- package/dist/chunk-BJUZVYQC.js +188 -0
- package/dist/chunk-BVJWBYIG.js +66 -0
- package/dist/chunk-CME4DIML.js +65 -0
- package/dist/chunk-CYPPEUX5.js +73 -0
- package/dist/chunk-D5BTFSL7.js +71 -0
- package/dist/chunk-D6TPWNRK.js +387 -0
- package/dist/chunk-DJSXIAFH.js +66 -0
- package/dist/chunk-DRZCJCBO.js +46 -0
- package/dist/chunk-DWKILXHE.js +17 -0
- package/dist/chunk-E7ZSWBAK.js +70 -0
- package/dist/chunk-EDSK6FEH.js +8 -0
- package/dist/chunk-F2K7VJUV.js +114 -0
- package/dist/chunk-F6NLE6XJ.js +40 -0
- package/dist/chunk-FHHAPGCR.js +32 -0
- package/dist/chunk-FXIBGTS5.js +14 -0
- package/dist/chunk-GCVA3OIV.js +72 -0
- package/dist/chunk-GFOAJVW5.js +336 -0
- package/dist/chunk-GRLSUQQE.js +136 -0
- package/dist/chunk-GTHJWR3Q.js +77 -0
- package/dist/chunk-HMUZE6EK.js +67 -0
- package/dist/chunk-I7WU4GTY.js +503 -0
- package/dist/chunk-J2BCKBHC.js +151 -0
- package/dist/chunk-J36M3KRX.js +1315 -0
- package/dist/chunk-J7ZQQFPT.js +113 -0
- package/dist/chunk-JP26LPCY.js +234 -0
- package/dist/chunk-JTNFJLIY.js +1046 -0
- package/dist/chunk-JVJRHBTD.js +50 -0
- package/dist/chunk-JYGR44ZC.js +133 -0
- package/dist/chunk-KDLPXXD2.js +173 -0
- package/dist/chunk-KMSYEE23.js +224 -0
- package/dist/chunk-KNYKWUYX.js +52 -0
- package/dist/chunk-LME57Z6J.js +138 -0
- package/dist/chunk-MFJP5FA7.js +20 -0
- package/dist/chunk-MKC5HNA7.js +1692 -0
- package/dist/chunk-MQGD2OUF.js +39 -0
- package/dist/chunk-MUFHLP4S.js +566 -0
- package/dist/chunk-O2LG3PNI.js +74 -0
- package/dist/chunk-O4GRKO3I.js +66 -0
- package/dist/chunk-OHUFNYGN.js +791 -0
- package/dist/chunk-PWKWNDBS.js +243 -0
- package/dist/chunk-QA74ITR4.js +103 -0
- package/dist/chunk-R6RGJF4L.js +170 -0
- package/dist/chunk-S7NNXWIN.js +7 -0
- package/dist/chunk-SV56BSUQ.js +162 -0
- package/dist/chunk-T7FCG7XV.js +435 -0
- package/dist/chunk-THC2ISYP.js +57 -0
- package/dist/chunk-VWC72TR3.js +115 -0
- package/dist/chunk-W46K56XU.js +216 -0
- package/dist/chunk-W5GGOUUI.js +75 -0
- package/dist/chunk-WEUJYDCV.js +269 -0
- package/dist/chunk-WFY7DKQD.js +279 -0
- package/dist/chunk-WZQFC7ZN.js +448 -0
- package/dist/chunk-Z3ETJN5G.js +136 -0
- package/dist/chunk-ZOOX3TUB.js +192 -0
- package/dist/chunk-ZSNJ6UA3.js +42 -0
- package/dist/chunk-ZZA2LUTL.js +130 -0
- package/dist/chunk-ZZT2E5VT.js +24 -0
- package/dist/color-CtSxc1Rh.d.ts +6 -0
- package/dist/combobox.d.ts +184 -0
- package/dist/combobox.js +21 -0
- package/dist/date-input.d.ts +83 -0
- package/dist/date-input.js +16 -0
- package/dist/date-picker.d.ts +249 -0
- package/dist/date-picker.js +29 -0
- package/dist/date-utils-7hTFTXNK.d.ts +34 -0
- package/dist/date-vMJBKAFK.d.ts +22 -0
- package/dist/dialog.d.ts +86 -0
- package/dist/dialog.js +15 -0
- package/dist/drawer.d.ts +77 -0
- package/dist/drawer.js +14 -0
- package/dist/dropdown-menu.d.ts +218 -0
- package/dist/dropdown-menu.js +10 -0
- package/dist/file-trigger.d.ts +42 -0
- package/dist/file-trigger.js +3 -0
- package/dist/form.d.ts +487 -0
- package/dist/form.js +1179 -0
- package/dist/header-navigation.d.ts +74 -0
- package/dist/header-navigation.js +23 -0
- package/dist/icons/app.d.ts +48 -0
- package/dist/icons/app.js +282 -0
- package/dist/icons/flag.d.ts +817 -0
- package/dist/icons/flag.js +58336 -0
- package/dist/icons/integration.d.ts +36 -0
- package/dist/icons/integration.js +531 -0
- package/dist/icons/payment.d.ts +116 -0
- package/dist/icons/payment.js +2418 -0
- package/dist/icons.d.ts +2013 -0
- package/dist/icons.js +2012 -0
- package/dist/illustration.d.ts +48 -0
- package/dist/illustration.js +4 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +73 -0
- package/dist/indicator.d.ts +51 -0
- package/dist/indicator.js +7 -0
- package/dist/input.d.ts +66 -0
- package/dist/input.js +15 -0
- package/dist/multi-value-CJb_tnvi.d.ts +8 -0
- package/dist/nav-Bla0o_-1.d.ts +98 -0
- package/dist/number-input.d.ts +80 -0
- package/dist/number-input.js +15 -0
- package/dist/options-CPEIgjtd.d.ts +68 -0
- package/dist/overflow-Df0h42Oi.d.ts +29 -0
- package/dist/pagination.d.ts +77 -0
- package/dist/pagination.js +17 -0
- package/dist/payment-input.d.ts +7 -0
- package/dist/payment-input.js +15 -0
- package/dist/popover.d.ts +60 -0
- package/dist/popover.js +14 -0
- package/dist/progress.d.ts +87 -0
- package/dist/progress.js +5 -0
- package/dist/radio.d.ts +77 -0
- package/dist/radio.js +12 -0
- package/dist/select.d.ts +68 -0
- package/dist/select.js +24 -0
- package/dist/shared-BNXAdgh2.d.ts +9 -0
- package/dist/shared-BYXJPnsN.d.ts +11 -0
- package/dist/shared-Dc-GgA16.d.ts +42 -0
- package/dist/sidebar-navigation.d.ts +129 -0
- package/dist/sidebar-navigation.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/switch.d.ts +23 -0
- package/dist/switch.js +7 -0
- package/dist/table.d.ts +692 -0
- package/dist/table.js +44 -0
- package/dist/tabs.d.ts +111 -0
- package/dist/tabs.js +8 -0
- package/dist/tag-input.d.ts +12 -0
- package/dist/tag-input.js +19 -0
- package/dist/tag.d.ts +98 -0
- package/dist/tag.js +9 -0
- package/dist/textarea.d.ts +40 -0
- package/dist/textarea.js +12 -0
- package/dist/theme-script.d.ts +29 -0
- package/dist/theme-script.js +15 -0
- package/dist/theme.css +929 -0
- package/dist/theme.d.ts +71 -0
- package/dist/theme.js +15 -0
- package/dist/toast.d.ts +242 -0
- package/dist/toast.js +15 -0
- package/dist/tooltip.d.ts +70 -0
- package/dist/tooltip.js +6 -0
- package/dist/tree.d.ts +308 -0
- package/dist/tree.js +11 -0
- package/package.json +352 -0
|
@@ -0,0 +1,1046 @@
|
|
|
1
|
+
import { DEFAULT_WEEK_START, useControllable, DEFAULT_WEEK_START_INDEX, weekStartIndex, toWireDate } from './chunk-5RAPA22E.js';
|
|
2
|
+
import { Popover } from './chunk-3Y5X7B5C.js';
|
|
3
|
+
import { DateInput } from './chunk-5NOBSXJN.js';
|
|
4
|
+
import { DEFAULT_FORMAT, parseFormat, fromISO, BE_OFFSET } from './chunk-GFOAJVW5.js';
|
|
5
|
+
import { Button } from './chunk-W46K56XU.js';
|
|
6
|
+
import { INTRINSIC_CELL, INTRINSIC_STACK, IntrinsicWidth } from './chunk-7S2TBALK.js';
|
|
7
|
+
import { FieldShell } from './chunk-QA74ITR4.js';
|
|
8
|
+
import { useFieldValidity, FieldFrame, CONTROL_ICON } from './chunk-J2BCKBHC.js';
|
|
9
|
+
import { CalendarIcon, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon } from './chunk-24TO7E32.js';
|
|
10
|
+
import { warnPositiveInt, devWarn } from './chunk-GCVA3OIV.js';
|
|
11
|
+
import { cn } from './chunk-ZSNJ6UA3.js';
|
|
12
|
+
import { enUS } from 'date-fns/locale';
|
|
13
|
+
import * as React5 from 'react';
|
|
14
|
+
import { startOfDay, subDays, endOfWeek, startOfWeek, endOfMonth, startOfMonth, subMonths, endOfYear, startOfYear, subYears, isValid, addYears, format } from 'date-fns';
|
|
15
|
+
import { SelectionState, DayFlag, UI, DayPicker } from 'react-day-picker';
|
|
16
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
17
|
+
import { Field } from '@base-ui/react/field';
|
|
18
|
+
|
|
19
|
+
function toDateInputValue(d, hasTime) {
|
|
20
|
+
if (d == null || !isValid(d)) return null;
|
|
21
|
+
return format(d, hasTime ? "yyyy-MM-dd'T'HH:mm" : "yyyy-MM-dd");
|
|
22
|
+
}
|
|
23
|
+
function fromDateInputValue(iso) {
|
|
24
|
+
if (iso == null || iso === "") return null;
|
|
25
|
+
const parts = fromISO(iso);
|
|
26
|
+
if (parts.year == null || parts.month == null || parts.day == null) return null;
|
|
27
|
+
const d = new Date(parts.year, parts.month - 1, parts.day, parts.hour ?? 0, parts.minute ?? 0, parts.second ?? 0, 0);
|
|
28
|
+
return isValid(d) ? d : null;
|
|
29
|
+
}
|
|
30
|
+
function toDateInputBound(d) {
|
|
31
|
+
return d == null || !isValid(d) ? void 0 : toWireDate(d);
|
|
32
|
+
}
|
|
33
|
+
function toRdpRange(v) {
|
|
34
|
+
if (v == null || v.start == null) return void 0;
|
|
35
|
+
return { from: v.start, to: v.end ?? void 0 };
|
|
36
|
+
}
|
|
37
|
+
function fromRdpRange(r) {
|
|
38
|
+
if (r == null) return { start: null, end: null };
|
|
39
|
+
return { start: r.from ?? null, end: r.to ?? null };
|
|
40
|
+
}
|
|
41
|
+
function eraFormatters(era, locale) {
|
|
42
|
+
if (era === "ce") return void 0;
|
|
43
|
+
return {
|
|
44
|
+
formatCaption: (month) => `${format(month, "LLLL", { locale })} ${month.getFullYear() + BE_OFFSET}`,
|
|
45
|
+
// rdp v10 hands the year as a `Date`, not a number (v9 passed a number) — read it from the date.
|
|
46
|
+
formatYearDropdown: (year) => String(year.getFullYear() + BE_OFFSET)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function eraLabels(era, locale) {
|
|
50
|
+
if (era === "ce") return void 0;
|
|
51
|
+
return {
|
|
52
|
+
labelDayButton: (date) => `${format(date, "d LLLL", { locale })} ${date.getFullYear() + BE_OFFSET}`,
|
|
53
|
+
labelGrid: (date) => `${format(date, "LLLL", { locale })} ${date.getFullYear() + BE_OFFSET}`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function hasTimeSegments(dateInputFormat) {
|
|
57
|
+
return parseFormat(dateInputFormat).hasTime;
|
|
58
|
+
}
|
|
59
|
+
function defaultDisplayFormat(dateInputFormat) {
|
|
60
|
+
return hasTimeSegments(dateInputFormat) ? "MMM d, yyyy HH:mm" : "MMM d, yyyy";
|
|
61
|
+
}
|
|
62
|
+
var DISPLAY_TIME_TOKEN = /[HhKk]/;
|
|
63
|
+
function stripQuoted(pattern) {
|
|
64
|
+
return pattern.replaceAll(/'([^']*)'/g, "");
|
|
65
|
+
}
|
|
66
|
+
function displayFormatHasTime(format) {
|
|
67
|
+
return DISPLAY_TIME_TOKEN.test(stripQuoted(format));
|
|
68
|
+
}
|
|
69
|
+
function warnFormatMismatch(component, format, dateInputFormat) {
|
|
70
|
+
if (format == null) return;
|
|
71
|
+
const typed = hasTimeSegments(dateInputFormat);
|
|
72
|
+
const printed = displayFormatHasTime(format);
|
|
73
|
+
if (typed === printed) return;
|
|
74
|
+
devWarn(
|
|
75
|
+
printed ? `<${component}> \`format="${format}"\` prints a time, but \`dateInputFormat="${dateInputFormat}"\` has no time segment to type one \u2014 the trigger will show a time the popover cannot change. Add \`HH:mm\` to \`dateInputFormat\`, or drop it from \`format\`.` : `<${component}> \`dateInputFormat="${dateInputFormat}"\` types a time, but \`format="${format}"\` never prints one \u2014 the trigger will hide the value the user just typed. Add a time token to \`format\`, or drop it from \`dateInputFormat\`.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
var YEAR_RUN = /([yYRu])\1*/g;
|
|
79
|
+
function beYearPattern(pattern, ceYear) {
|
|
80
|
+
const beYear = ceYear + BE_OFFSET;
|
|
81
|
+
return pattern.split(/('[^']*')/).map(
|
|
82
|
+
(chunk, index) => (
|
|
83
|
+
// Odd chunks are the captured quoted literals — pass them through untouched.
|
|
84
|
+
index % 2 === 1 ? chunk : chunk.replaceAll(YEAR_RUN, (run) => run.length === 2 ? String(beYear).slice(-2) : String(beYear).padStart(run.length, "0"))
|
|
85
|
+
)
|
|
86
|
+
).join("");
|
|
87
|
+
}
|
|
88
|
+
function formatDateValue(d, pattern, locale, era) {
|
|
89
|
+
return format(d, era === "be" ? beYearPattern(pattern, d.getFullYear()) : pattern, { locale });
|
|
90
|
+
}
|
|
91
|
+
function toCalendarDate(d) {
|
|
92
|
+
if (d == null || !isValid(d)) return null;
|
|
93
|
+
return startOfDay(d);
|
|
94
|
+
}
|
|
95
|
+
function toFormValue(d, hasTime) {
|
|
96
|
+
if (d == null) return "";
|
|
97
|
+
return toDateInputValue(d, hasTime) ?? "";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/components/date-picker/shared.ts
|
|
101
|
+
var CELL_SIZE = {
|
|
102
|
+
sm: "size-8",
|
|
103
|
+
md: "size-10",
|
|
104
|
+
lg: "size-11"
|
|
105
|
+
};
|
|
106
|
+
var DAY_TEXT = { sm: "text-xs", md: "text-sm", lg: "text-sm" };
|
|
107
|
+
var CAPTION_TEXT = { sm: "text-sm", md: "text-sm", lg: "text-md" };
|
|
108
|
+
var MONTHS_GAP = { sm: "gap-4", md: "gap-6", lg: "gap-6" };
|
|
109
|
+
var FOCUS_RING = "outline-focus-ring focus-visible:outline-2 focus-visible:-outline-offset-2";
|
|
110
|
+
var DAY_RADIUS = "rounded-lg";
|
|
111
|
+
var SELECTED_FILL = cn(
|
|
112
|
+
"text-fg-white",
|
|
113
|
+
"[&>button]:bg-brand-solid [&>button]:font-medium [&>button]:text-fg-white [&>button]:hover:bg-brand-solid_hover",
|
|
114
|
+
"[&>button]:[--dot:var(--color-fg-white)]"
|
|
115
|
+
);
|
|
116
|
+
var NAV_BUTTON = cn(
|
|
117
|
+
"absolute top-0 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg",
|
|
118
|
+
"text-fg-quaternary transition-colors duration-100 ease-linear hover:bg-ghost-hover hover:text-secondary",
|
|
119
|
+
// See the header: rdp uses `aria-disabled`, never the attribute.
|
|
120
|
+
"aria-disabled:pointer-events-none aria-disabled:text-fg-disabled",
|
|
121
|
+
"[&>svg]:size-5 [&>svg]:shrink-0",
|
|
122
|
+
FOCUS_RING
|
|
123
|
+
);
|
|
124
|
+
function dayGridClasses(size, months, selection) {
|
|
125
|
+
return {
|
|
126
|
+
/* The root draws NO box — see the header. It sets the type family + base colour only, so a grid
|
|
127
|
+
dropped onto an unstyled surface still inherits the library's font.
|
|
128
|
+
|
|
129
|
+
The colour is `fg-secondary` (gray-700), not `fg` (gray-900), and it is set HERE rather than on
|
|
130
|
+
the day button so that the four per-day states can keep overriding it from the `<td>` by plain
|
|
131
|
+
inheritance — a `text-*` on `day_button` would out-specify every one of them. A calendar reads
|
|
132
|
+
as a field of values to choose between, not as body copy; gray-900 numerals made the whole grid
|
|
133
|
+
shout, and it is the one colour Untitled UI's grid and ours had genuinely different. */
|
|
134
|
+
root: "text-secondary",
|
|
135
|
+
/* Two months sit side by side and **wrap** when their parent is too narrow — plain `flex-wrap`,
|
|
136
|
+
deliberately NOT a container query.
|
|
137
|
+
|
|
138
|
+
Two reasons, both load-bearing. (1) A `@container` needs `container-type: inline-size`, which is
|
|
139
|
+
inline-size CONTAINMENT: the element's own width stops depending on its contents. The grid's host
|
|
140
|
+
inside a picker is a `w-max` (shrink-to-fit) popup, so a contained grid root would collapse the
|
|
141
|
+
popup it is meant to size. (2) A query threshold is a second truth about how wide two months are
|
|
142
|
+
— and `@md` (448px) was already wrong, because two `md` months are 584px, so the row engaged and
|
|
143
|
+
then overflowed. Wrapping needs no threshold at all: it reflows at exactly the width where the
|
|
144
|
+
months stop fitting, at every `size`. */
|
|
145
|
+
months: cn("flex flex-wrap", months === 2 && MONTHS_GAP[size]),
|
|
146
|
+
/* `relative`, because the two nav arrows are absolutely positioned into this month's caption row.
|
|
147
|
+
With `navLayout: "around"` rdp puts the PREVIOUS button in the first month and the NEXT button
|
|
148
|
+
in the last one, so at `months={2}` one pair of arrows spans both grids — which is the layout a
|
|
149
|
+
range picker wants — and at `months={1}` they flank that month's own caption.
|
|
150
|
+
|
|
151
|
+
`shrink-0` is what keeps the grid honest: a month is exactly 7 cells wide, and a shrinkable flex
|
|
152
|
+
item would be squeezed below that and spill its rows over the neighbouring month (which is
|
|
153
|
+
precisely what `min-w-0` here did). */
|
|
154
|
+
month: "relative flex shrink-0 flex-col gap-3",
|
|
155
|
+
/* `px-8` reserves both arrows' width, so a long month name in a locale like Thai can never slide
|
|
156
|
+
under a chevron — keep it equal to `NAV_BUTTON`'s box. */
|
|
157
|
+
month_caption: cn("flex h-8 items-center justify-center px-8", CAPTION_TEXT[size]),
|
|
158
|
+
/* Shared by the plain caption AND the dropdown's visible label (which appends its own chevron),
|
|
159
|
+
so it has to be a flex line rather than plain text. */
|
|
160
|
+
caption_label: "inline-flex items-center gap-1 font-semibold text-secondary",
|
|
161
|
+
button_previous: cn(NAV_BUTTON, "left-0"),
|
|
162
|
+
button_next: cn(NAV_BUTTON, "right-0"),
|
|
163
|
+
/* The dropdown caption — mounted only when the min/max span makes a year list useful (see
|
|
164
|
+
`day-picker.tsx`). rdp overlays a transparent native `<select>` on the label: the label carries
|
|
165
|
+
the visible chrome, the select carries the hit area and the keyboard. */
|
|
166
|
+
dropdowns: cn("flex items-center gap-1", CAPTION_TEXT[size]),
|
|
167
|
+
dropdown_root: "relative inline-flex cursor-pointer items-center rounded-lg px-1.5 hover:bg-ghost-hover has-[:focus-visible]:outline-2 has-[:focus-visible]:-outline-offset-2 has-[:focus-visible]:outline-focus-ring",
|
|
168
|
+
dropdown: "absolute inset-0 cursor-pointer appearance-none bg-transparent opacity-0",
|
|
169
|
+
/* `w-max`, not `w-full`: the rows are fixed-width flex lines (7 cells), so the table must size to
|
|
170
|
+
them rather than to a parent that may be narrower. */
|
|
171
|
+
month_grid: "w-max",
|
|
172
|
+
/* `weekdays` is a `<tr>` and `week` is a `<tr>`; `flex` on both is what makes the columns line up
|
|
173
|
+
with the fixed-size cells instead of with table auto-layout.
|
|
174
|
+
|
|
175
|
+
The `mb-1` on both is the grid's ROW RHYTHM: 4px of air under the weekday initials and between
|
|
176
|
+
every pair of week rows, so a range band reads as a run of separate weeks rather than one solid
|
|
177
|
+
block. It is a MARGIN, not a `gap`, precisely so the band stays gapless HORIZONTALLY. */
|
|
178
|
+
weekdays: "mb-1 flex",
|
|
179
|
+
weekday: cn(
|
|
180
|
+
"flex items-center justify-center font-medium text-secondary",
|
|
181
|
+
CELL_SIZE[size],
|
|
182
|
+
// Tracks the day type scale: the initials head their columns, so a smaller step made the header
|
|
183
|
+
// read as a caption floating above the grid rather than as part of it.
|
|
184
|
+
DAY_TEXT[size]
|
|
185
|
+
),
|
|
186
|
+
week: "flex last:mb-0 mb-1",
|
|
187
|
+
/* The CELL is the range band's paint surface — a continuous band needs a gapless, un-rounded box —
|
|
188
|
+
so the wash lives here and the button on top stays transparent. `p-0` because a `<td>` would
|
|
189
|
+
otherwise take table padding and break the band.
|
|
190
|
+
|
|
191
|
+
`first:`/`last:` round the band where a WEEK ends, not only where the selection does: a band
|
|
192
|
+
that runs into Saturday and resumes on Sunday is two runs on screen, and a square cut on each
|
|
193
|
+
would read as a band clipped by the grid rather than as one that wraps. Invisible on any day
|
|
194
|
+
that carries no fill. */
|
|
195
|
+
day: cn("relative p-0 first:rounded-l-lg last:rounded-r-lg", CELL_SIZE[size]),
|
|
196
|
+
day_button: cn(
|
|
197
|
+
"relative flex size-full cursor-pointer items-center justify-center font-normal tabular-nums transition-colors duration-100 ease-linear",
|
|
198
|
+
DAY_RADIUS,
|
|
199
|
+
DAY_TEXT[size],
|
|
200
|
+
// A ghost's hover wash: the one deliberately TRANSLUCENT surface role, because a day rests with
|
|
201
|
+
// no fill and must step off an unknown host (a card, a popover, a range band). See the header's
|
|
202
|
+
// ladder — this is the same 6% step today's pill and the band wear.
|
|
203
|
+
"hover:bg-ghost-hover hover:font-medium",
|
|
204
|
+
FOCUS_RING
|
|
205
|
+
),
|
|
206
|
+
/* Today: a brand dot under the numeral, plus the weight — and **no fill of its own**. Untitled UI
|
|
207
|
+
gives it a neutral pill as well; we deliberately do not, because the grid already spends its two
|
|
208
|
+
neutral washes on the hover and the range band, and a third static one made today read as a
|
|
209
|
+
permanently-hovered cell (identical value to the hover, by construction) and as a second kind of
|
|
210
|
+
"chosen" beside the brand chip. A dot is the whole marker: it is the only mark in the grid that
|
|
211
|
+
means "now" rather than "picked", so it should not borrow the vocabulary of either.
|
|
212
|
+
|
|
213
|
+
The dot is centred explicitly (`left-1/2` + `-translate-x-1/2`) rather than left to its static
|
|
214
|
+
position — the button is a flex line, so an absolute child with no inline offset lands after the
|
|
215
|
+
numeral, not under it.
|
|
216
|
+
|
|
217
|
+
**It travels on `--dot`,** published here on the `<td>` and republished on the `<button>` by
|
|
218
|
+
`SELECTED_FILL` — see its note for why an inherited-vs-own cascade beats a specificity contest.
|
|
219
|
+
`bg-current` used to do this job and can no longer: it followed the numeral, and the numeral is
|
|
220
|
+
now the grid's plain gray rather than brand. */
|
|
221
|
+
today: cn(
|
|
222
|
+
"[--dot:var(--color-text-brand-secondary)] [&>button]:font-medium",
|
|
223
|
+
"[&>button]:after:absolute [&>button]:after:bottom-1 [&>button]:after:left-1/2 [&>button]:after:size-1",
|
|
224
|
+
"[&>button]:after:-translate-x-1/2 [&>button]:after:rounded-full [&>button]:after:bg-(color:--dot)"
|
|
225
|
+
),
|
|
226
|
+
/* A day belonging to the flanking month — **the one value NOT taken from Untitled UI.** Theirs is
|
|
227
|
+
`opacity-50` over secondary text, which measures #99A0AA: **2.58:1** on white. An outside day is
|
|
228
|
+
not disabled — it is clickable, and selecting one jumps the grid a month — so it owes AA like any
|
|
229
|
+
other control's text. `fg-subtle` (gray-500) is the faintest stop in the ramp that clears it, at
|
|
230
|
+
4.98:1, and there is nothing between it and the failing one. (An `opacity-*` was never available
|
|
231
|
+
either — see the header: it would fade the focus ring with it.) */
|
|
232
|
+
outside: "text-quaternary",
|
|
233
|
+
/* No `opacity-*` — see the header. */
|
|
234
|
+
disabled: "pointer-events-none text-fg-disabled",
|
|
235
|
+
hidden: "invisible",
|
|
236
|
+
/* The brand fill. Yielded to the three range states ONLY once a range is complete enough for them
|
|
237
|
+
to be emitted — see the `selection` param's note. */
|
|
238
|
+
selected: selection === "range-complete" ? "" : SELECTED_FILL,
|
|
239
|
+
/* The range band. The wash is on the CELL, so it is gapless and continuous across the row; the two
|
|
240
|
+
ends put the solid brand fill on their BUTTON, which sits on top at the full cell size and covers
|
|
241
|
+
the wash under it. So a single-day range (`start === end`, which takes BOTH end classes) is a
|
|
242
|
+
plain rounded brand square, with no half-rounded seam to reconcile.
|
|
243
|
+
|
|
244
|
+
**The band is NEUTRAL, and the brand belongs to the two ends alone.** It was `bg-brand-soft`, and
|
|
245
|
+
a purple band next to purple endpoints left the ends — the only two days the user actually
|
|
246
|
+
chose — with nothing to stand out against. A gray run under two brand chips says "these two, and
|
|
247
|
+
everything between" in one read. The wash and its hover are the header's 6% / 10% ladder. */
|
|
248
|
+
range_start: cn("rounded-l-lg bg-ghost-hover", SELECTED_FILL),
|
|
249
|
+
range_end: cn("rounded-r-lg bg-ghost-hover", SELECTED_FILL),
|
|
250
|
+
range_middle: "bg-ghost-hover [&>button]:font-medium [&>button]:hover:bg-selected"
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function disabledMatchers(min, max, disabledDates) {
|
|
254
|
+
const matchers = [];
|
|
255
|
+
if (min) matchers.push({ before: min });
|
|
256
|
+
if (max) matchers.push({ after: max });
|
|
257
|
+
if (typeof disabledDates === "function") matchers.push(disabledDates);
|
|
258
|
+
else if (disabledDates) matchers.push([...disabledDates]);
|
|
259
|
+
return matchers.length > 0 ? matchers : void 0;
|
|
260
|
+
}
|
|
261
|
+
function Chevron({ orientation }) {
|
|
262
|
+
if (orientation === "left") return /* @__PURE__ */ jsx(ChevronLeftIcon, {});
|
|
263
|
+
if (orientation === "right") return /* @__PURE__ */ jsx(ChevronRightIcon, {});
|
|
264
|
+
return /* @__PURE__ */ jsx(ChevronDownIcon, {});
|
|
265
|
+
}
|
|
266
|
+
function NamedRoot({ rootRef, ...rest }) {
|
|
267
|
+
return /* @__PURE__ */ jsx("div", { ...rest, ref: rootRef, role: "group" });
|
|
268
|
+
}
|
|
269
|
+
function DayGrid(props) {
|
|
270
|
+
const {
|
|
271
|
+
mode,
|
|
272
|
+
selected,
|
|
273
|
+
onSelect,
|
|
274
|
+
months = 1,
|
|
275
|
+
min,
|
|
276
|
+
max,
|
|
277
|
+
disabledDates,
|
|
278
|
+
locale,
|
|
279
|
+
weekStartsOn,
|
|
280
|
+
era,
|
|
281
|
+
size,
|
|
282
|
+
defaultMonth,
|
|
283
|
+
month,
|
|
284
|
+
onMonthChange,
|
|
285
|
+
minNights,
|
|
286
|
+
maxNights,
|
|
287
|
+
ariaLabel,
|
|
288
|
+
className
|
|
289
|
+
} = props;
|
|
290
|
+
const component = mode === "range" ? "DateRangeCalendar / DateRangePicker" : "DateCalendar / DatePicker";
|
|
291
|
+
warnPositiveInt(component, "minNights", minNights);
|
|
292
|
+
warnPositiveInt(component, "maxNights", maxNights);
|
|
293
|
+
const range = mode === "range" ? selected : null;
|
|
294
|
+
const selection = mode === "single" ? "single" : range?.start != null && range.end != null ? "range-complete" : "range-open";
|
|
295
|
+
const classes = dayGridClasses(size, months, selection);
|
|
296
|
+
const classNames = React5.useMemo(
|
|
297
|
+
() => ({
|
|
298
|
+
[UI.Root]: cn(classes.root, className),
|
|
299
|
+
[UI.Months]: classes.months,
|
|
300
|
+
[UI.Month]: classes.month,
|
|
301
|
+
[UI.MonthCaption]: classes.month_caption,
|
|
302
|
+
[UI.CaptionLabel]: classes.caption_label,
|
|
303
|
+
[UI.PreviousMonthButton]: classes.button_previous,
|
|
304
|
+
[UI.NextMonthButton]: classes.button_next,
|
|
305
|
+
[UI.Dropdowns]: classes.dropdowns,
|
|
306
|
+
[UI.Dropdown]: classes.dropdown,
|
|
307
|
+
[UI.DropdownRoot]: classes.dropdown_root,
|
|
308
|
+
[UI.MonthGrid]: classes.month_grid,
|
|
309
|
+
[UI.Weekdays]: classes.weekdays,
|
|
310
|
+
[UI.Weekday]: classes.weekday,
|
|
311
|
+
[UI.Week]: classes.week,
|
|
312
|
+
[UI.Day]: classes.day,
|
|
313
|
+
[UI.DayButton]: classes.day_button,
|
|
314
|
+
[DayFlag.today]: classes.today,
|
|
315
|
+
[DayFlag.outside]: classes.outside,
|
|
316
|
+
[DayFlag.disabled]: classes.disabled,
|
|
317
|
+
[DayFlag.hidden]: classes.hidden,
|
|
318
|
+
[SelectionState.selected]: classes.selected,
|
|
319
|
+
[SelectionState.range_start]: classes.range_start,
|
|
320
|
+
[SelectionState.range_middle]: classes.range_middle,
|
|
321
|
+
[SelectionState.range_end]: classes.range_end
|
|
322
|
+
}),
|
|
323
|
+
[classes, className]
|
|
324
|
+
);
|
|
325
|
+
const spansYears = min != null && max != null && max.getTime() > addYears(min, 2).getTime();
|
|
326
|
+
const captionLayout = spansYears ? "dropdown" : "label";
|
|
327
|
+
const shared = {
|
|
328
|
+
numberOfMonths: months,
|
|
329
|
+
startMonth: min ? startOfMonth(min) : void 0,
|
|
330
|
+
endMonth: max ? startOfMonth(max) : void 0,
|
|
331
|
+
disabled: disabledMatchers(min, max, disabledDates),
|
|
332
|
+
locale,
|
|
333
|
+
// Explicit, and always set: rdp would otherwise read the week start off `locale`, which is the
|
|
334
|
+
// rule this prop replaced (`src/lib/date.ts`'s `WeekStart` records why).
|
|
335
|
+
weekStartsOn: weekStartIndex(weekStartsOn, locale),
|
|
336
|
+
formatters: eraFormatters(era, locale),
|
|
337
|
+
labels: eraLabels(era, locale),
|
|
338
|
+
classNames,
|
|
339
|
+
components: ariaLabel == null ? { Chevron } : { Chevron, Root: NamedRoot },
|
|
340
|
+
captionLayout,
|
|
341
|
+
// prev/next flanking the caption — the house pattern, and at `months={2}` rdp puts the two arrows
|
|
342
|
+
// in the FIRST and LAST month, so one pair spans both grids instead of repeating per month.
|
|
343
|
+
navLayout: "around",
|
|
344
|
+
// A six-row grid always, so opening a 5-row month next to a 6-row one does not jump the popover's
|
|
345
|
+
// height; the outside days are what fill it.
|
|
346
|
+
fixedWeeks: true,
|
|
347
|
+
showOutsideDays: true,
|
|
348
|
+
// Motion is ours (`overlay/motion.ts`). rdp's month slide would fight the popover's own
|
|
349
|
+
// enter/exit transform, and the two run on different timing curves.
|
|
350
|
+
animate: false,
|
|
351
|
+
defaultMonth,
|
|
352
|
+
month,
|
|
353
|
+
onMonthChange,
|
|
354
|
+
"aria-label": ariaLabel
|
|
355
|
+
};
|
|
356
|
+
if (mode === "range") {
|
|
357
|
+
const value2 = selected;
|
|
358
|
+
return /* @__PURE__ */ jsx(
|
|
359
|
+
DayPicker,
|
|
360
|
+
{
|
|
361
|
+
...shared,
|
|
362
|
+
mode: "range",
|
|
363
|
+
selected: toRdpRange(value2),
|
|
364
|
+
onSelect: (next) => onSelect(fromRdpRange(next)),
|
|
365
|
+
resetOnSelect: true,
|
|
366
|
+
min: minNights,
|
|
367
|
+
max: maxNights
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
const value = selected;
|
|
372
|
+
return /* @__PURE__ */ jsx(DayPicker, { ...shared, mode: "single", selected: value ?? void 0, onSelect: (next) => onSelect(next ?? null) });
|
|
373
|
+
}
|
|
374
|
+
function DateCalendar(props) {
|
|
375
|
+
const {
|
|
376
|
+
value,
|
|
377
|
+
defaultValue = null,
|
|
378
|
+
onValueChange,
|
|
379
|
+
min,
|
|
380
|
+
max,
|
|
381
|
+
disabledDates,
|
|
382
|
+
locale = enUS,
|
|
383
|
+
weekStartsOn = DEFAULT_WEEK_START,
|
|
384
|
+
era = "ce",
|
|
385
|
+
size = "md",
|
|
386
|
+
defaultMonth,
|
|
387
|
+
className
|
|
388
|
+
} = props;
|
|
389
|
+
const [selected, setSelected] = useControllable(value, defaultValue, onValueChange);
|
|
390
|
+
const normalized = React5.useMemo(() => toCalendarDate(selected), [selected]);
|
|
391
|
+
return /* @__PURE__ */ jsx(
|
|
392
|
+
DayGrid,
|
|
393
|
+
{
|
|
394
|
+
mode: "single",
|
|
395
|
+
selected: normalized,
|
|
396
|
+
onSelect: (next) => setSelected(next),
|
|
397
|
+
min,
|
|
398
|
+
max,
|
|
399
|
+
disabledDates,
|
|
400
|
+
locale,
|
|
401
|
+
weekStartsOn,
|
|
402
|
+
era,
|
|
403
|
+
size,
|
|
404
|
+
defaultMonth,
|
|
405
|
+
ariaLabel: props["aria-label"] ?? "Calendar",
|
|
406
|
+
className
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
DateCalendar.displayName = "DateCalendar";
|
|
411
|
+
var EMPTY_RANGE = { start: null, end: null };
|
|
412
|
+
function DateRangeCalendar(props) {
|
|
413
|
+
const {
|
|
414
|
+
value,
|
|
415
|
+
defaultValue = null,
|
|
416
|
+
onValueChange,
|
|
417
|
+
months = 2,
|
|
418
|
+
minNights,
|
|
419
|
+
maxNights,
|
|
420
|
+
min,
|
|
421
|
+
max,
|
|
422
|
+
disabledDates,
|
|
423
|
+
locale = enUS,
|
|
424
|
+
weekStartsOn = DEFAULT_WEEK_START,
|
|
425
|
+
era = "ce",
|
|
426
|
+
size = "md",
|
|
427
|
+
defaultMonth,
|
|
428
|
+
className
|
|
429
|
+
} = props;
|
|
430
|
+
const [selected, setSelected] = useControllable(value, defaultValue, (next) => onValueChange?.(next ?? EMPTY_RANGE));
|
|
431
|
+
const normalized = React5.useMemo(
|
|
432
|
+
() => ({ start: toCalendarDate(selected?.start), end: toCalendarDate(selected?.end) }),
|
|
433
|
+
[selected?.start, selected?.end]
|
|
434
|
+
);
|
|
435
|
+
return /* @__PURE__ */ jsx(
|
|
436
|
+
DayGrid,
|
|
437
|
+
{
|
|
438
|
+
mode: "range",
|
|
439
|
+
selected: normalized,
|
|
440
|
+
onSelect: (next) => setSelected(next),
|
|
441
|
+
months,
|
|
442
|
+
minNights,
|
|
443
|
+
maxNights,
|
|
444
|
+
min,
|
|
445
|
+
max,
|
|
446
|
+
disabledDates,
|
|
447
|
+
locale,
|
|
448
|
+
weekStartsOn,
|
|
449
|
+
era,
|
|
450
|
+
size,
|
|
451
|
+
defaultMonth,
|
|
452
|
+
ariaLabel: props["aria-label"] ?? "Date range calendar",
|
|
453
|
+
className
|
|
454
|
+
}
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
DateRangeCalendar.displayName = "DateRangeCalendar";
|
|
458
|
+
var HOUSE_WEEK = { weekStartsOn: DEFAULT_WEEK_START_INDEX };
|
|
459
|
+
function resolvePreset(preset) {
|
|
460
|
+
return typeof preset.range === "function" ? preset.range() : preset.range;
|
|
461
|
+
}
|
|
462
|
+
var DATE_PRESETS = [
|
|
463
|
+
{
|
|
464
|
+
label: "Today",
|
|
465
|
+
range: () => {
|
|
466
|
+
const today = startOfDay(/* @__PURE__ */ new Date());
|
|
467
|
+
return { start: today, end: today };
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
label: "Yesterday",
|
|
472
|
+
range: () => {
|
|
473
|
+
const yesterday = subDays(startOfDay(/* @__PURE__ */ new Date()), 1);
|
|
474
|
+
return { start: yesterday, end: yesterday };
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
label: "This week",
|
|
479
|
+
range: () => {
|
|
480
|
+
const now = /* @__PURE__ */ new Date();
|
|
481
|
+
return { start: startOfDay(startOfWeek(now, HOUSE_WEEK)), end: startOfDay(endOfWeek(now, HOUSE_WEEK)) };
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
label: "Last week",
|
|
486
|
+
range: () => {
|
|
487
|
+
const lastWeek = subDays(/* @__PURE__ */ new Date(), 7);
|
|
488
|
+
return { start: startOfDay(startOfWeek(lastWeek, HOUSE_WEEK)), end: startOfDay(endOfWeek(lastWeek, HOUSE_WEEK)) };
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
label: "This month",
|
|
493
|
+
range: () => {
|
|
494
|
+
const now = /* @__PURE__ */ new Date();
|
|
495
|
+
return { start: startOfDay(startOfMonth(now)), end: startOfDay(endOfMonth(now)) };
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
label: "Last month",
|
|
500
|
+
range: () => {
|
|
501
|
+
const lastMonth = subMonths(/* @__PURE__ */ new Date(), 1);
|
|
502
|
+
return { start: startOfDay(startOfMonth(lastMonth)), end: startOfDay(endOfMonth(lastMonth)) };
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
label: "This year",
|
|
507
|
+
range: () => {
|
|
508
|
+
const now = /* @__PURE__ */ new Date();
|
|
509
|
+
return { start: startOfDay(startOfYear(now)), end: startOfDay(endOfYear(now)) };
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
label: "Last year",
|
|
514
|
+
range: () => {
|
|
515
|
+
const lastYear = subYears(/* @__PURE__ */ new Date(), 1);
|
|
516
|
+
return { start: startOfDay(startOfYear(lastYear)), end: startOfDay(endOfYear(lastYear)) };
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
{ label: "All time", range: { start: null, end: null } }
|
|
520
|
+
];
|
|
521
|
+
var TRIGGER_CLASS = cn(
|
|
522
|
+
"flex min-w-0 flex-1 cursor-pointer items-center justify-between gap-2 self-stretch bg-transparent text-left outline-none",
|
|
523
|
+
"disabled:cursor-not-allowed"
|
|
524
|
+
);
|
|
525
|
+
function TriggerGlyph({ size }) {
|
|
526
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("inline-flex shrink-0 text-fg-quaternary", CONTROL_ICON[size]), children: /* @__PURE__ */ jsx(CalendarIcon, {}) });
|
|
527
|
+
}
|
|
528
|
+
function singleLabel(value, pattern, locale, era) {
|
|
529
|
+
return value == null ? null : formatDateValue(value, pattern, locale, era);
|
|
530
|
+
}
|
|
531
|
+
function rangeLabel(value, pattern, locale, era) {
|
|
532
|
+
const start = value?.start == null ? null : formatDateValue(value.start, pattern, locale, era);
|
|
533
|
+
const end = value?.end == null ? null : formatDateValue(value.end, pattern, locale, era);
|
|
534
|
+
if (start == null && end == null) return null;
|
|
535
|
+
if (start == null) return `\u2013 ${end}`;
|
|
536
|
+
if (end == null) return `${start} \u2013`;
|
|
537
|
+
if (sameDay(value?.start ?? null, value?.end ?? null) && start === end) return start;
|
|
538
|
+
return `${start} \u2013 ${end}`;
|
|
539
|
+
}
|
|
540
|
+
function sameDay(a, b) {
|
|
541
|
+
if (a == null || b == null) return a === b;
|
|
542
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
543
|
+
}
|
|
544
|
+
function clampToBounds(d, min, max, disabledDates) {
|
|
545
|
+
if (d == null) return null;
|
|
546
|
+
const day = startOfDay(d).getTime();
|
|
547
|
+
if (min && day < startOfDay(min).getTime()) return null;
|
|
548
|
+
if (max && day > startOfDay(max).getTime()) return null;
|
|
549
|
+
if (typeof disabledDates === "function") return disabledDates(d) ? null : d;
|
|
550
|
+
if (disabledDates?.some((x) => sameDay(x, d))) return null;
|
|
551
|
+
return d;
|
|
552
|
+
}
|
|
553
|
+
function normalizeValue(d, hasTime) {
|
|
554
|
+
if (d == null || Number.isNaN(d.getTime())) return null;
|
|
555
|
+
return hasTime ? d : startOfDay(d);
|
|
556
|
+
}
|
|
557
|
+
function withTimeOf(day, previous, hasTime) {
|
|
558
|
+
if (day == null || !hasTime || previous == null) return day;
|
|
559
|
+
const merged = new Date(day);
|
|
560
|
+
merged.setHours(previous.getHours(), previous.getMinutes(), previous.getSeconds(), 0);
|
|
561
|
+
return merged;
|
|
562
|
+
}
|
|
563
|
+
function TypedRow({ label, value, onValueChange, format, hasTime, era, size, min, max }) {
|
|
564
|
+
const field = /* @__PURE__ */ jsx(
|
|
565
|
+
DateInput,
|
|
566
|
+
{
|
|
567
|
+
size,
|
|
568
|
+
format,
|
|
569
|
+
era,
|
|
570
|
+
value: toDateInputValue(value, hasTime),
|
|
571
|
+
onValueChange: (iso) => onValueChange(fromDateInputValue(iso)),
|
|
572
|
+
min: toDateInputBound(min),
|
|
573
|
+
max: toDateInputBound(max),
|
|
574
|
+
fullWidth: true,
|
|
575
|
+
leading: /* @__PURE__ */ jsx(CalendarIcon, {})
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
return label == null ? field : /* @__PURE__ */ jsx("div", { role: "group", "aria-label": label, className: "min-w-0 flex-1", children: field });
|
|
579
|
+
}
|
|
580
|
+
function activePresetLabel(presets, value) {
|
|
581
|
+
for (const preset of presets) {
|
|
582
|
+
const resolved = resolvePreset(preset);
|
|
583
|
+
if (sameDay(resolved.start, value?.start ?? null) && sameDay(resolved.end, value?.end ?? null)) return preset.label;
|
|
584
|
+
}
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
function PresetRail({ presets, value, onPick }) {
|
|
588
|
+
const active = activePresetLabel(presets, value);
|
|
589
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex shrink-0 flex-col gap-0.5 border-secondary pr-3 sm:border-r"), children: presets.map((preset) => /* @__PURE__ */ jsx(
|
|
590
|
+
Button,
|
|
591
|
+
{
|
|
592
|
+
type: "button",
|
|
593
|
+
variant: preset.label === active ? "secondary" : "tertiary",
|
|
594
|
+
color: "neutral",
|
|
595
|
+
size: "sm",
|
|
596
|
+
className: "w-full shrink-0 justify-start whitespace-nowrap",
|
|
597
|
+
onClick: () => onPick(resolvePreset(preset)),
|
|
598
|
+
children: preset.label
|
|
599
|
+
},
|
|
600
|
+
preset.label
|
|
601
|
+
)) });
|
|
602
|
+
}
|
|
603
|
+
function usePickerDraft(committed, commit, setCommitted, onOpen) {
|
|
604
|
+
const [open, setOpen] = React5.useState(false);
|
|
605
|
+
const [draft, setDraftState] = React5.useState(committed);
|
|
606
|
+
const onOpenChange = (next) => {
|
|
607
|
+
if (next) {
|
|
608
|
+
setDraftState(committed);
|
|
609
|
+
onOpen?.(committed);
|
|
610
|
+
}
|
|
611
|
+
setOpen(next);
|
|
612
|
+
};
|
|
613
|
+
const setDraft = (next) => {
|
|
614
|
+
setDraftState(next);
|
|
615
|
+
if (commit === "instant") setCommitted(next);
|
|
616
|
+
};
|
|
617
|
+
return {
|
|
618
|
+
open,
|
|
619
|
+
draft,
|
|
620
|
+
setDraft,
|
|
621
|
+
onOpenChange,
|
|
622
|
+
apply: () => {
|
|
623
|
+
setCommitted(draft);
|
|
624
|
+
setOpen(false);
|
|
625
|
+
},
|
|
626
|
+
close: () => setOpen(false)
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function ApplyRow({ onCancel, onApply, disabled }) {
|
|
630
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
631
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", color: "neutral", size: "sm", onClick: onCancel, children: "Cancel" }),
|
|
632
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "primary", size: "sm", onClick: onApply, disabled, children: "Apply" })
|
|
633
|
+
] });
|
|
634
|
+
}
|
|
635
|
+
var BODY = "flex flex-col gap-3";
|
|
636
|
+
var BODY_ROW = "flex flex-wrap gap-3";
|
|
637
|
+
function DatePicker(props) {
|
|
638
|
+
const {
|
|
639
|
+
value,
|
|
640
|
+
defaultValue = null,
|
|
641
|
+
onValueChange,
|
|
642
|
+
format: formatProp,
|
|
643
|
+
dateInputFormat = DEFAULT_FORMAT,
|
|
644
|
+
commit = "instant",
|
|
645
|
+
placeholder = "Select date",
|
|
646
|
+
side = "bottom",
|
|
647
|
+
align = "start",
|
|
648
|
+
label,
|
|
649
|
+
tooltip,
|
|
650
|
+
tooltipDescription,
|
|
651
|
+
hint,
|
|
652
|
+
required = false,
|
|
653
|
+
hideRequiredIndicator = false,
|
|
654
|
+
invalid = false,
|
|
655
|
+
error,
|
|
656
|
+
disabled = false,
|
|
657
|
+
fullWidth = true,
|
|
658
|
+
leading,
|
|
659
|
+
trailing,
|
|
660
|
+
leadingAddon,
|
|
661
|
+
trailingAddon,
|
|
662
|
+
name,
|
|
663
|
+
id,
|
|
664
|
+
min,
|
|
665
|
+
max,
|
|
666
|
+
disabledDates,
|
|
667
|
+
locale = enUS,
|
|
668
|
+
weekStartsOn = DEFAULT_WEEK_START,
|
|
669
|
+
era = "ce",
|
|
670
|
+
size = "md",
|
|
671
|
+
defaultMonth,
|
|
672
|
+
className
|
|
673
|
+
} = props;
|
|
674
|
+
const hasTime = hasTimeSegments(dateInputFormat);
|
|
675
|
+
const displayFormat = formatProp ?? defaultDisplayFormat(dateInputFormat);
|
|
676
|
+
const [rawCommitted, setCommitted] = useControllable(value, defaultValue, onValueChange);
|
|
677
|
+
const committed = React5.useMemo(() => normalizeValue(rawCommitted, hasTime), [rawCommitted, hasTime]);
|
|
678
|
+
React5.useEffect(() => {
|
|
679
|
+
warnFormatMismatch("DatePicker", formatProp, dateInputFormat);
|
|
680
|
+
}, [formatProp, dateInputFormat]);
|
|
681
|
+
const { isInvalid, showError } = useFieldValidity(invalid, error);
|
|
682
|
+
const reactId = React5.useId();
|
|
683
|
+
const base = id ?? reactId;
|
|
684
|
+
const labelId = label == null ? void 0 : `${base}-label`;
|
|
685
|
+
const valueId = `${base}-value`;
|
|
686
|
+
const requiredId = `${base}-required`;
|
|
687
|
+
const hintId = `${base}-hint`;
|
|
688
|
+
const errorId = `${base}-error`;
|
|
689
|
+
const describedBy = showError ? errorId : hint != null && hint !== "" ? hintId : void 0;
|
|
690
|
+
const [month, setMonth] = React5.useState(committed ?? defaultMonth);
|
|
691
|
+
const picker = usePickerDraft(committed, commit, setCommitted, (seeded) => setMonth(seeded ?? defaultMonth));
|
|
692
|
+
function onGridSelect(next) {
|
|
693
|
+
const merged = withTimeOf(next, picker.draft, hasTime);
|
|
694
|
+
picker.setDraft(merged);
|
|
695
|
+
if (merged != null) setMonth(merged);
|
|
696
|
+
if (commit === "instant") picker.close();
|
|
697
|
+
}
|
|
698
|
+
function onTypedChange(next) {
|
|
699
|
+
if (next == null) return;
|
|
700
|
+
const allowed = clampToBounds(next, min, max, disabledDates);
|
|
701
|
+
if (allowed == null) return;
|
|
702
|
+
picker.setDraft(allowed);
|
|
703
|
+
setMonth(allowed);
|
|
704
|
+
}
|
|
705
|
+
const printed = singleLabel(committed, displayFormat, locale, era);
|
|
706
|
+
const sizingCandidates = React5.useMemo(() => {
|
|
707
|
+
if (fullWidth) return [];
|
|
708
|
+
const out = /* @__PURE__ */ new Set();
|
|
709
|
+
for (let month2 = 0; month2 < 12; month2++) {
|
|
710
|
+
for (let day = 21; day <= 27; day++) {
|
|
711
|
+
const label2 = singleLabel(new Date(2026, month2, day), displayFormat, locale, era);
|
|
712
|
+
if (label2 != null) out.add(label2);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
if (placeholder) out.add(placeholder);
|
|
716
|
+
return [...out];
|
|
717
|
+
}, [fullWidth, displayFormat, locale, era, placeholder]);
|
|
718
|
+
const valueNode = /* @__PURE__ */ jsx("span", { id: valueId, className: cn(sizingCandidates.length > 0 && INTRINSIC_CELL, "truncate", printed == null ? "text-quaternary" : "font-medium"), children: printed ?? placeholder });
|
|
719
|
+
const trigger = /* @__PURE__ */ jsxs(
|
|
720
|
+
"button",
|
|
721
|
+
{
|
|
722
|
+
type: "button",
|
|
723
|
+
disabled,
|
|
724
|
+
"aria-labelledby": labelId == null ? void 0 : [labelId, valueId, required && !hideRequiredIndicator ? requiredId : null].filter(Boolean).join(" "),
|
|
725
|
+
"aria-describedby": describedBy,
|
|
726
|
+
"aria-invalid": isInvalid || void 0,
|
|
727
|
+
className: TRIGGER_CLASS,
|
|
728
|
+
children: [
|
|
729
|
+
sizingCandidates.length > 0 ? /* @__PURE__ */ jsxs("span", { className: INTRINSIC_STACK, children: [
|
|
730
|
+
valueNode,
|
|
731
|
+
/* @__PURE__ */ jsx(IntrinsicWidth, { candidates: sizingCandidates, className: "font-medium" })
|
|
732
|
+
] }) : valueNode,
|
|
733
|
+
required && !hideRequiredIndicator ? /* @__PURE__ */ jsx("span", { id: requiredId, className: "sr-only", children: "required" }) : null,
|
|
734
|
+
/* @__PURE__ */ jsx(TriggerGlyph, { size })
|
|
735
|
+
]
|
|
736
|
+
}
|
|
737
|
+
);
|
|
738
|
+
return /* @__PURE__ */ jsx(
|
|
739
|
+
FieldFrame,
|
|
740
|
+
{
|
|
741
|
+
label,
|
|
742
|
+
labelId,
|
|
743
|
+
messageId: { hint: hintId, error: errorId },
|
|
744
|
+
tooltip,
|
|
745
|
+
tooltipDescription,
|
|
746
|
+
hint,
|
|
747
|
+
error,
|
|
748
|
+
isInvalid,
|
|
749
|
+
showError,
|
|
750
|
+
required,
|
|
751
|
+
hideRequiredIndicator,
|
|
752
|
+
size,
|
|
753
|
+
disabled,
|
|
754
|
+
fullWidth,
|
|
755
|
+
className,
|
|
756
|
+
children: /* @__PURE__ */ jsxs(
|
|
757
|
+
FieldShell,
|
|
758
|
+
{
|
|
759
|
+
size,
|
|
760
|
+
invalid: isInvalid,
|
|
761
|
+
disabled,
|
|
762
|
+
leading,
|
|
763
|
+
trailing,
|
|
764
|
+
leadingAddon,
|
|
765
|
+
trailingAddon,
|
|
766
|
+
className: cn(
|
|
767
|
+
// The open state lives on the TRIGGER (Base UI puts `data-popup-open` there), so the shell
|
|
768
|
+
// reads it with `has-*` rather than owning a variant it can never match. `focus-within`
|
|
769
|
+
// already covers plain focus; this keeps the ring lit while the popover is open.
|
|
770
|
+
"has-[[data-popup-open]]:outline-2 has-[[data-popup-open]]:-outline-offset-2",
|
|
771
|
+
isInvalid ? "has-[[data-popup-open]]:outline-focus-ring-error" : "has-[[data-popup-open]]:outline-focus-ring"
|
|
772
|
+
),
|
|
773
|
+
onMouseDown: (event) => {
|
|
774
|
+
if (event.target !== event.currentTarget) return;
|
|
775
|
+
event.preventDefault();
|
|
776
|
+
event.currentTarget.querySelector("button")?.click();
|
|
777
|
+
},
|
|
778
|
+
children: [
|
|
779
|
+
/* @__PURE__ */ jsx(
|
|
780
|
+
Popover,
|
|
781
|
+
{
|
|
782
|
+
open: picker.open,
|
|
783
|
+
onOpenChange: picker.onOpenChange,
|
|
784
|
+
trigger,
|
|
785
|
+
side,
|
|
786
|
+
align,
|
|
787
|
+
size: "lg",
|
|
788
|
+
className: "max-h-[var(--available-height)] max-w-none",
|
|
789
|
+
dividers: commit === "confirm",
|
|
790
|
+
"aria-label": label ?? "Choose a date",
|
|
791
|
+
footer: commit === "confirm" ? () => /* @__PURE__ */ jsx(ApplyRow, { onCancel: picker.close, onApply: picker.apply }) : void 0,
|
|
792
|
+
children: /* @__PURE__ */ jsxs("div", { className: BODY, children: [
|
|
793
|
+
/* @__PURE__ */ jsx(TypedRow, { value: picker.draft, onValueChange: onTypedChange, format: dateInputFormat, hasTime, era, size, min, max }),
|
|
794
|
+
/* @__PURE__ */ jsx(
|
|
795
|
+
DayGrid,
|
|
796
|
+
{
|
|
797
|
+
mode: "single",
|
|
798
|
+
selected: picker.draft,
|
|
799
|
+
onSelect: (next) => onGridSelect(next),
|
|
800
|
+
month,
|
|
801
|
+
onMonthChange: setMonth,
|
|
802
|
+
min,
|
|
803
|
+
max,
|
|
804
|
+
disabledDates,
|
|
805
|
+
locale,
|
|
806
|
+
weekStartsOn,
|
|
807
|
+
era,
|
|
808
|
+
size,
|
|
809
|
+
defaultMonth
|
|
810
|
+
}
|
|
811
|
+
)
|
|
812
|
+
] })
|
|
813
|
+
}
|
|
814
|
+
),
|
|
815
|
+
/* @__PURE__ */ jsx(Field.Control, { type: "hidden", name, required, value: toFormValue(committed, hasTime), readOnly: true })
|
|
816
|
+
]
|
|
817
|
+
}
|
|
818
|
+
)
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
DatePicker.displayName = "DatePicker";
|
|
823
|
+
var EMPTY_RANGE2 = { start: null, end: null };
|
|
824
|
+
function DateRangePicker(props) {
|
|
825
|
+
const {
|
|
826
|
+
value,
|
|
827
|
+
defaultValue = null,
|
|
828
|
+
onValueChange,
|
|
829
|
+
presets,
|
|
830
|
+
months = 2,
|
|
831
|
+
minNights,
|
|
832
|
+
maxNights,
|
|
833
|
+
format: formatProp,
|
|
834
|
+
dateInputFormat = DEFAULT_FORMAT,
|
|
835
|
+
commit = "instant",
|
|
836
|
+
placeholder = "Select dates",
|
|
837
|
+
side = "bottom",
|
|
838
|
+
align = "start",
|
|
839
|
+
label,
|
|
840
|
+
tooltip,
|
|
841
|
+
tooltipDescription,
|
|
842
|
+
hint,
|
|
843
|
+
required = false,
|
|
844
|
+
hideRequiredIndicator = false,
|
|
845
|
+
invalid = false,
|
|
846
|
+
error,
|
|
847
|
+
disabled = false,
|
|
848
|
+
fullWidth = true,
|
|
849
|
+
leading,
|
|
850
|
+
trailing,
|
|
851
|
+
leadingAddon,
|
|
852
|
+
trailingAddon,
|
|
853
|
+
name,
|
|
854
|
+
id,
|
|
855
|
+
min,
|
|
856
|
+
max,
|
|
857
|
+
disabledDates,
|
|
858
|
+
locale = enUS,
|
|
859
|
+
weekStartsOn = DEFAULT_WEEK_START,
|
|
860
|
+
era = "ce",
|
|
861
|
+
size = "md",
|
|
862
|
+
defaultMonth,
|
|
863
|
+
className
|
|
864
|
+
} = props;
|
|
865
|
+
const hasTime = hasTimeSegments(dateInputFormat);
|
|
866
|
+
const displayFormat = formatProp ?? defaultDisplayFormat(dateInputFormat);
|
|
867
|
+
const [rawCommitted, setCommitted] = useControllable(value, defaultValue, (next) => onValueChange?.(next ?? EMPTY_RANGE2));
|
|
868
|
+
const committed = React5.useMemo(
|
|
869
|
+
() => ({ start: normalizeValue(rawCommitted?.start, hasTime), end: normalizeValue(rawCommitted?.end, hasTime) }),
|
|
870
|
+
[rawCommitted?.start, rawCommitted?.end, hasTime]
|
|
871
|
+
);
|
|
872
|
+
React5.useEffect(() => {
|
|
873
|
+
warnFormatMismatch("DateRangePicker", formatProp, dateInputFormat);
|
|
874
|
+
}, [formatProp, dateInputFormat]);
|
|
875
|
+
const { isInvalid, showError } = useFieldValidity(invalid, error);
|
|
876
|
+
const reactId = React5.useId();
|
|
877
|
+
const base = id ?? reactId;
|
|
878
|
+
const labelId = label == null ? void 0 : `${base}-label`;
|
|
879
|
+
const valueId = `${base}-value`;
|
|
880
|
+
const requiredId = `${base}-required`;
|
|
881
|
+
const hintId = `${base}-hint`;
|
|
882
|
+
const errorId = `${base}-error`;
|
|
883
|
+
const describedBy = showError ? errorId : hint != null && hint !== "" ? hintId : void 0;
|
|
884
|
+
const [month, setMonth] = React5.useState(committed.start ?? defaultMonth);
|
|
885
|
+
const picker = usePickerDraft(committed, commit, setCommitted, (seeded) => setMonth(seeded.start ?? defaultMonth));
|
|
886
|
+
function onGridSelect(next) {
|
|
887
|
+
const merged = {
|
|
888
|
+
start: withTimeOf(next.start, picker.draft.start, hasTime),
|
|
889
|
+
end: withTimeOf(next.end, picker.draft.end ?? picker.draft.start, hasTime)
|
|
890
|
+
};
|
|
891
|
+
picker.setDraft(merged);
|
|
892
|
+
if (merged.start != null) setMonth(merged.start);
|
|
893
|
+
if (commit === "instant" && merged.start != null && merged.end != null) picker.close();
|
|
894
|
+
}
|
|
895
|
+
function onTypedChange(edge, next) {
|
|
896
|
+
if (next == null) return;
|
|
897
|
+
const allowed = clampToBounds(next, min, max, disabledDates);
|
|
898
|
+
if (allowed == null) return;
|
|
899
|
+
picker.setDraft({ ...picker.draft, [edge]: allowed });
|
|
900
|
+
setMonth(edge === "start" ? allowed : picker.draft.start ?? allowed);
|
|
901
|
+
}
|
|
902
|
+
function onPresetPick(range) {
|
|
903
|
+
picker.setDraft(range);
|
|
904
|
+
if (range.start != null) setMonth(range.start);
|
|
905
|
+
if (commit === "instant") picker.close();
|
|
906
|
+
}
|
|
907
|
+
const printed = rangeLabel(committed, displayFormat, locale, era);
|
|
908
|
+
const trigger = /* @__PURE__ */ jsxs(
|
|
909
|
+
"button",
|
|
910
|
+
{
|
|
911
|
+
type: "button",
|
|
912
|
+
disabled,
|
|
913
|
+
"aria-labelledby": labelId == null ? void 0 : [labelId, valueId, required && !hideRequiredIndicator ? requiredId : null].filter(Boolean).join(" "),
|
|
914
|
+
"aria-describedby": describedBy,
|
|
915
|
+
"aria-invalid": isInvalid || void 0,
|
|
916
|
+
className: TRIGGER_CLASS,
|
|
917
|
+
children: [
|
|
918
|
+
/* @__PURE__ */ jsx("span", { id: valueId, className: cn("truncate", printed == null ? "text-quaternary" : "font-medium"), children: printed ?? placeholder }),
|
|
919
|
+
required && !hideRequiredIndicator ? /* @__PURE__ */ jsx("span", { id: requiredId, className: "sr-only", children: "required" }) : null,
|
|
920
|
+
/* @__PURE__ */ jsx(TriggerGlyph, { size })
|
|
921
|
+
]
|
|
922
|
+
}
|
|
923
|
+
);
|
|
924
|
+
return /* @__PURE__ */ jsx(
|
|
925
|
+
FieldFrame,
|
|
926
|
+
{
|
|
927
|
+
label,
|
|
928
|
+
labelId,
|
|
929
|
+
messageId: { hint: hintId, error: errorId },
|
|
930
|
+
tooltip,
|
|
931
|
+
tooltipDescription,
|
|
932
|
+
hint,
|
|
933
|
+
error,
|
|
934
|
+
isInvalid,
|
|
935
|
+
showError,
|
|
936
|
+
required,
|
|
937
|
+
hideRequiredIndicator,
|
|
938
|
+
size,
|
|
939
|
+
disabled,
|
|
940
|
+
fullWidth,
|
|
941
|
+
className,
|
|
942
|
+
children: /* @__PURE__ */ jsxs(
|
|
943
|
+
FieldShell,
|
|
944
|
+
{
|
|
945
|
+
size,
|
|
946
|
+
invalid: isInvalid,
|
|
947
|
+
disabled,
|
|
948
|
+
leading,
|
|
949
|
+
trailing,
|
|
950
|
+
leadingAddon,
|
|
951
|
+
trailingAddon,
|
|
952
|
+
className: cn(
|
|
953
|
+
"has-[[data-popup-open]]:outline-2 has-[[data-popup-open]]:-outline-offset-2",
|
|
954
|
+
isInvalid ? "has-[[data-popup-open]]:outline-focus-ring-error" : "has-[[data-popup-open]]:outline-focus-ring"
|
|
955
|
+
),
|
|
956
|
+
onMouseDown: (event) => {
|
|
957
|
+
if (event.target !== event.currentTarget) return;
|
|
958
|
+
event.preventDefault();
|
|
959
|
+
event.currentTarget.querySelector("button")?.click();
|
|
960
|
+
},
|
|
961
|
+
children: [
|
|
962
|
+
/* @__PURE__ */ jsx(
|
|
963
|
+
Popover,
|
|
964
|
+
{
|
|
965
|
+
open: picker.open,
|
|
966
|
+
onOpenChange: picker.onOpenChange,
|
|
967
|
+
trigger,
|
|
968
|
+
side,
|
|
969
|
+
align,
|
|
970
|
+
size: "lg",
|
|
971
|
+
className: "max-h-[var(--available-height)] max-w-none",
|
|
972
|
+
dividers: commit === "confirm",
|
|
973
|
+
"aria-label": label ?? "Choose a date range",
|
|
974
|
+
footer: commit === "confirm" ? () => /* @__PURE__ */ jsx(ApplyRow, { onCancel: picker.close, onApply: picker.apply }) : void 0,
|
|
975
|
+
children: /* @__PURE__ */ jsxs("div", { className: BODY, children: [
|
|
976
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
977
|
+
/* @__PURE__ */ jsx(
|
|
978
|
+
TypedRow,
|
|
979
|
+
{
|
|
980
|
+
label: "Start date",
|
|
981
|
+
value: picker.draft.start,
|
|
982
|
+
onValueChange: (next) => onTypedChange("start", next),
|
|
983
|
+
format: dateInputFormat,
|
|
984
|
+
hasTime,
|
|
985
|
+
era,
|
|
986
|
+
size,
|
|
987
|
+
min,
|
|
988
|
+
max
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "shrink-0 text-fg-quaternary", children: "\u2013" }),
|
|
992
|
+
/* @__PURE__ */ jsx(
|
|
993
|
+
TypedRow,
|
|
994
|
+
{
|
|
995
|
+
label: "End date",
|
|
996
|
+
value: picker.draft.end,
|
|
997
|
+
onValueChange: (next) => onTypedChange("end", next),
|
|
998
|
+
format: dateInputFormat,
|
|
999
|
+
hasTime,
|
|
1000
|
+
era,
|
|
1001
|
+
size,
|
|
1002
|
+
min,
|
|
1003
|
+
max
|
|
1004
|
+
}
|
|
1005
|
+
)
|
|
1006
|
+
] }),
|
|
1007
|
+
/* @__PURE__ */ jsxs("div", { className: BODY_ROW, children: [
|
|
1008
|
+
presets != null && presets.length > 0 ? /* @__PURE__ */ jsx(PresetRail, { presets, value: picker.draft, onPick: onPresetPick }) : null,
|
|
1009
|
+
/* @__PURE__ */ jsx(
|
|
1010
|
+
DayGrid,
|
|
1011
|
+
{
|
|
1012
|
+
mode: "range",
|
|
1013
|
+
selected: picker.draft,
|
|
1014
|
+
onSelect: (next) => onGridSelect(next),
|
|
1015
|
+
months,
|
|
1016
|
+
minNights,
|
|
1017
|
+
maxNights,
|
|
1018
|
+
month,
|
|
1019
|
+
onMonthChange: setMonth,
|
|
1020
|
+
min,
|
|
1021
|
+
max,
|
|
1022
|
+
disabledDates,
|
|
1023
|
+
locale,
|
|
1024
|
+
weekStartsOn,
|
|
1025
|
+
era,
|
|
1026
|
+
size,
|
|
1027
|
+
defaultMonth
|
|
1028
|
+
}
|
|
1029
|
+
)
|
|
1030
|
+
] })
|
|
1031
|
+
] })
|
|
1032
|
+
}
|
|
1033
|
+
),
|
|
1034
|
+
/* @__PURE__ */ jsx(Field.Control, { type: "hidden", name, required, value: toFormValue(committed.start, hasTime), readOnly: true }),
|
|
1035
|
+
name == null ? null : /* @__PURE__ */ jsx("input", { type: "hidden", name: `${name}End`, value: toFormValue(committed.end, hasTime), readOnly: true })
|
|
1036
|
+
]
|
|
1037
|
+
}
|
|
1038
|
+
)
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
DateRangePicker.displayName = "DateRangePicker";
|
|
1043
|
+
|
|
1044
|
+
export { DATE_PRESETS, DateCalendar, DatePicker, DateRangeCalendar, DateRangePicker, resolvePreset };
|
|
1045
|
+
//# sourceMappingURL=chunk-JTNFJLIY.js.map
|
|
1046
|
+
//# sourceMappingURL=chunk-JTNFJLIY.js.map
|