@initbase/react-datetime-picker 1.0.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/dist/index.js ADDED
@@ -0,0 +1,1226 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.tsx
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ DatePicker: () => DatePicker,
24
+ DateRangePicker: () => DateRangePicker,
25
+ DateTimePicker: () => DateTimePicker,
26
+ DateTimeRangePicker: () => DateTimeRangePicker,
27
+ TimePicker: () => TimePicker,
28
+ TimeRangePicker: () => TimeRangePicker
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+
32
+ // src/components/datetime/DatePicker.tsx
33
+ var import_react5 = require("react");
34
+
35
+ // src/components/datetime/Popover.tsx
36
+ var import_react2 = require("react");
37
+
38
+ // src/components/datetime/hooks.ts
39
+ var import_react = require("react");
40
+ function useControlled(value, defaultValue, onChange) {
41
+ const isControlled = value !== void 0;
42
+ const [internalValue, setInternalValue] = (0, import_react.useState)(defaultValue ?? value);
43
+ (0, import_react.useEffect)(() => {
44
+ if (isControlled) {
45
+ setInternalValue(value);
46
+ }
47
+ }, [isControlled, value]);
48
+ const setValue = (0, import_react.useCallback)(
49
+ (newValue) => {
50
+ if (!isControlled) {
51
+ setInternalValue(newValue);
52
+ }
53
+ onChange?.(newValue);
54
+ },
55
+ [isControlled, onChange]
56
+ );
57
+ return [isControlled ? value : internalValue, setValue];
58
+ }
59
+ function useClickOutside(ref, handler, enabled = true) {
60
+ (0, import_react.useEffect)(() => {
61
+ if (!enabled) return;
62
+ function handleClick(event) {
63
+ if (ref.current && !ref.current.contains(event.target)) {
64
+ handler();
65
+ }
66
+ }
67
+ function handleKeyDown(event) {
68
+ if (event.key === "Escape") {
69
+ handler();
70
+ }
71
+ }
72
+ document.addEventListener("mousedown", handleClick);
73
+ document.addEventListener("keydown", handleKeyDown);
74
+ return () => {
75
+ document.removeEventListener("mousedown", handleClick);
76
+ document.removeEventListener("keydown", handleKeyDown);
77
+ };
78
+ }, [ref, handler, enabled]);
79
+ }
80
+
81
+ // src/components/datetime/Popover.tsx
82
+ var import_jsx_runtime = require("react/jsx-runtime");
83
+ function getPositionClass(pos) {
84
+ return `rdp-popover--${pos}`;
85
+ }
86
+ function Popover({
87
+ open,
88
+ onClose,
89
+ children,
90
+ className = "",
91
+ style,
92
+ position = "flexible"
93
+ }) {
94
+ const ref = (0, import_react2.useRef)(null);
95
+ const [resolvedPosition, setResolvedPosition] = (0, import_react2.useState)(position);
96
+ const [visible, setVisible] = (0, import_react2.useState)(false);
97
+ useClickOutside(ref, onClose, open);
98
+ (0, import_react2.useLayoutEffect)(() => {
99
+ if (!open) {
100
+ setVisible(false);
101
+ setResolvedPosition(position);
102
+ return;
103
+ }
104
+ if (position !== "flexible") {
105
+ setResolvedPosition(position);
106
+ setVisible(true);
107
+ return;
108
+ }
109
+ setVisible(false);
110
+ setResolvedPosition("bottom");
111
+ requestAnimationFrame(() => {
112
+ if (!ref.current) return;
113
+ const popoverRect = ref.current.getBoundingClientRect();
114
+ const wrapper = ref.current.parentElement;
115
+ if (!wrapper) {
116
+ setVisible(true);
117
+ return;
118
+ }
119
+ const wrapperRect = wrapper.getBoundingClientRect();
120
+ const viewportHeight = window.innerHeight;
121
+ const spaceBelow = viewportHeight - wrapperRect.bottom;
122
+ const spaceAbove = wrapperRect.top;
123
+ if (spaceBelow >= popoverRect.height || spaceBelow >= spaceAbove) {
124
+ setResolvedPosition("bottom");
125
+ } else if (spaceAbove >= popoverRect.height) {
126
+ setResolvedPosition("top");
127
+ }
128
+ setVisible(true);
129
+ });
130
+ }, [open, position]);
131
+ if (!open) return null;
132
+ const positionClass = getPositionClass(resolvedPosition);
133
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
134
+ "div",
135
+ {
136
+ ref,
137
+ className: `rdp-popover ${positionClass} ${className}`,
138
+ style: { ...style, visibility: visible ? "visible" : "hidden" },
139
+ role: "dialog",
140
+ children
141
+ }
142
+ );
143
+ }
144
+
145
+ // src/components/datetime/Calendar.tsx
146
+ var import_react3 = require("react");
147
+
148
+ // src/components/datetime/IconButton.tsx
149
+ var import_jsx_runtime2 = require("react/jsx-runtime");
150
+ function IconButton({
151
+ onClick,
152
+ disabled = false,
153
+ className = "",
154
+ children,
155
+ ariaLabel
156
+ }) {
157
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
158
+ "button",
159
+ {
160
+ type: "button",
161
+ onClick,
162
+ disabled,
163
+ className,
164
+ "aria-label": ariaLabel,
165
+ children
166
+ }
167
+ );
168
+ }
169
+
170
+ // src/components/datetime/utils.ts
171
+ function getDaysInMonth(year, month) {
172
+ return new Date(year, month + 1, 0).getDate();
173
+ }
174
+ function getFirstDayOfMonth(year, month) {
175
+ return new Date(year, month, 1).getDay();
176
+ }
177
+ function getCalendarWeeks(year, month) {
178
+ const weeks = [];
179
+ const firstDay = getFirstDayOfMonth(year, month);
180
+ const daysInMonth = getDaysInMonth(year, month);
181
+ const prevMonthDays = getDaysInMonth(year, month - 1);
182
+ let currentWeek = [];
183
+ for (let i = firstDay - 1; i >= 0; i--) {
184
+ currentWeek.push(new Date(year, month - 1, prevMonthDays - i));
185
+ }
186
+ for (let day = 1; day <= daysInMonth; day++) {
187
+ currentWeek.push(new Date(year, month, day));
188
+ if (currentWeek.length === 7) {
189
+ weeks.push(currentWeek);
190
+ currentWeek = [];
191
+ }
192
+ }
193
+ if (currentWeek.length > 0) {
194
+ const remaining = 7 - currentWeek.length;
195
+ for (let i = 1; i <= remaining; i++) {
196
+ currentWeek.push(new Date(year, month + 1, i));
197
+ }
198
+ weeks.push(currentWeek);
199
+ }
200
+ return weeks;
201
+ }
202
+ function isSameDay(a, b) {
203
+ if (!a || !b) return false;
204
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
205
+ }
206
+ function isInRange(day, range) {
207
+ const [start, end] = range;
208
+ if (!start || !end) return false;
209
+ const d = day.getTime();
210
+ return d >= start.getTime() && d <= end.getTime();
211
+ }
212
+ function clampDate(date, min, max) {
213
+ if (min && date.getTime() < min.getTime()) return new Date(min);
214
+ if (max && date.getTime() > max.getTime()) return new Date(max);
215
+ return date;
216
+ }
217
+ function isDateDisabled(date, min, max) {
218
+ if (min && date.getTime() < new Date(min.getFullYear(), min.getMonth(), min.getDate()).getTime())
219
+ return true;
220
+ if (max && date.getTime() > new Date(max.getFullYear(), max.getMonth(), max.getDate()).getTime())
221
+ return true;
222
+ return false;
223
+ }
224
+ function isSameMonth(a, b) {
225
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
226
+ }
227
+ function formatDateValue(date, locale = "en-US") {
228
+ return date.toLocaleDateString(locale, {
229
+ year: "numeric",
230
+ month: "short",
231
+ day: "numeric"
232
+ });
233
+ }
234
+ function formatTimeValue(date, locale = "en-US", showSeconds = false) {
235
+ return date.toLocaleTimeString(locale, {
236
+ hour: "2-digit",
237
+ minute: "2-digit",
238
+ second: showSeconds ? "2-digit" : void 0
239
+ });
240
+ }
241
+ function formatDateTimeValue(date, locale = "en-US", showSeconds = false) {
242
+ return `${formatDateValue(date, locale)} ${formatTimeValue(date, locale, showSeconds)}`;
243
+ }
244
+ var REFERENCE_SUNDAY = new Date(2023, 0, 1);
245
+ function getWeekdayLabels(locale = "en-US") {
246
+ const labels = [];
247
+ for (let i = 0; i < 7; i++) {
248
+ const d = new Date(REFERENCE_SUNDAY);
249
+ d.setDate(d.getDate() + i);
250
+ labels.push(d.toLocaleDateString(locale, { weekday: "short" }));
251
+ }
252
+ return labels;
253
+ }
254
+ function getMonthLabel(date, locale = "en-US") {
255
+ return date.toLocaleDateString(locale, { month: "long" });
256
+ }
257
+ function getAMPeriodLabels(locale = "en-US") {
258
+ const format = new Intl.DateTimeFormat(locale, {
259
+ hour: "numeric",
260
+ hour12: true
261
+ });
262
+ const amParts = format.formatToParts(new Date(2020, 0, 1, 9, 0, 0));
263
+ const pmParts = format.formatToParts(new Date(2020, 0, 1, 21, 0, 0));
264
+ const amLabel = amParts.find((p) => p.type === "dayPeriod")?.value ?? "AM";
265
+ const pmLabel = pmParts.find((p) => p.type === "dayPeriod")?.value ?? "PM";
266
+ return [amLabel, pmLabel];
267
+ }
268
+ function generateTimeItems(count, step = 1) {
269
+ const items = [];
270
+ for (let i = 0; i < count; i += step) {
271
+ items.push(String(i).padStart(2, "0"));
272
+ }
273
+ return items;
274
+ }
275
+
276
+ // src/components/datetime/Calendar.tsx
277
+ var import_jsx_runtime3 = require("react/jsx-runtime");
278
+ function Calendar({
279
+ value,
280
+ highlightRange,
281
+ onSelect,
282
+ month: controlledMonth,
283
+ defaultMonth,
284
+ onMonthChange,
285
+ min,
286
+ max,
287
+ className = "",
288
+ style,
289
+ locale = "en-US"
290
+ }) {
291
+ const [internalMonth, setInternalMonth] = (0, import_react3.useState)(
292
+ () => defaultMonth ?? value ?? /* @__PURE__ */ new Date()
293
+ );
294
+ const month = controlledMonth ?? internalMonth;
295
+ const setMonth = (d) => {
296
+ if (!controlledMonth) setInternalMonth(d);
297
+ onMonthChange?.(d);
298
+ };
299
+ const weeks = getCalendarWeeks(month.getFullYear(), month.getMonth());
300
+ const goToPrevMonth = () => {
301
+ setMonth(new Date(month.getFullYear(), month.getMonth() - 1, 1));
302
+ };
303
+ const goToNextMonth = () => {
304
+ setMonth(new Date(month.getFullYear(), month.getMonth() + 1, 1));
305
+ };
306
+ const prevDisabled = min != null && month.getFullYear() <= min.getFullYear() && month.getMonth() <= min.getMonth();
307
+ const nextDisabled = max != null && month.getFullYear() >= max.getFullYear() && month.getMonth() >= max.getMonth();
308
+ const rangeStart = highlightRange?.[0] ?? null;
309
+ const rangeEnd = highlightRange?.[1] ?? null;
310
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `rdp-calendar ${className}`, style, children: [
311
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rdp-calendar-header", children: [
312
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
313
+ IconButton,
314
+ {
315
+ onClick: goToPrevMonth,
316
+ disabled: prevDisabled,
317
+ className: "rdp-calendar-nav-btn",
318
+ ariaLabel: "Previous month",
319
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronLeft, {})
320
+ }
321
+ ),
322
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "rdp-calendar-month-year", children: [
323
+ getMonthLabel(month, locale),
324
+ " ",
325
+ month.getFullYear()
326
+ ] }),
327
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
328
+ IconButton,
329
+ {
330
+ onClick: goToNextMonth,
331
+ disabled: nextDisabled,
332
+ className: "rdp-calendar-nav-btn",
333
+ ariaLabel: "Next month",
334
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChevronRight, {})
335
+ }
336
+ )
337
+ ] }),
338
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rdp-calendar-grid", children: [
339
+ getWeekdayLabels(locale).map((label) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "rdp-calendar-weekday", children: label }, label)),
340
+ weeks.map(
341
+ (week, wi) => week.map((day, di) => {
342
+ const inCurrentMonth = isSameMonth(day, month);
343
+ const isSelected = isSameDay(day, value ?? null);
344
+ const isToday = isSameDay(day, /* @__PURE__ */ new Date());
345
+ const disabled = isDateDisabled(day, min, max);
346
+ const range = highlightRange ? [rangeStart, rangeEnd] : null;
347
+ const inRange = range && range[0] && range[1] ? isInRange(day, range) : false;
348
+ const isRangeStart = isSameDay(day, rangeStart);
349
+ const isRangeEnd = isSameDay(day, rangeEnd);
350
+ let cls = "rdp-calendar-day";
351
+ if (!inCurrentMonth) cls += " rdp-calendar-day--outside";
352
+ if (isSelected) cls += " rdp-calendar-day--selected";
353
+ if (isToday) cls += " rdp-calendar-day--today";
354
+ if (inRange && !isRangeStart && !isRangeEnd) cls += " rdp-calendar-day--in-range";
355
+ if (isRangeStart) cls += " rdp-calendar-day--range-start";
356
+ if (isRangeEnd) cls += " rdp-calendar-day--range-end";
357
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
358
+ "button",
359
+ {
360
+ type: "button",
361
+ className: cls,
362
+ disabled,
363
+ onClick: () => onSelect(day),
364
+ "aria-label": day.toLocaleDateString(locale),
365
+ children: day.getDate()
366
+ },
367
+ `${wi}-${di}`
368
+ );
369
+ })
370
+ )
371
+ ] })
372
+ ] });
373
+ }
374
+ function ChevronLeft() {
375
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "15 18 9 12 15 6" }) });
376
+ }
377
+ function ChevronRight() {
378
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "9 18 15 12 9 6" }) });
379
+ }
380
+
381
+ // src/components/datetime/InputTrigger.tsx
382
+ var import_react4 = require("react");
383
+ var import_jsx_runtime4 = require("react/jsx-runtime");
384
+ function InputTrigger({
385
+ value,
386
+ displayValue,
387
+ placeholder,
388
+ className = "",
389
+ style,
390
+ onClick,
391
+ open,
392
+ onClose,
393
+ children,
394
+ renderTrigger
395
+ }) {
396
+ const ref = (0, import_react4.useRef)(null);
397
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref, className: `rdp-wrapper ${className}`, style, children: [
398
+ renderTrigger ? renderTrigger({ value: value ?? null, displayValue, placeholder, onClick, open, onClose }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
399
+ "button",
400
+ {
401
+ type: "button",
402
+ className: "rdp-trigger",
403
+ onClick,
404
+ children: [
405
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { flex: 1, textAlign: "left", color: displayValue ? "inherit" : "var(--rdp-text-muted)" }, children: displayValue || placeholder || "Select..." }),
406
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CalendarIcon, {})
407
+ ]
408
+ }
409
+ ),
410
+ children
411
+ ] });
412
+ }
413
+ function RangeInputTrigger({
414
+ value,
415
+ displayValues,
416
+ placeholder,
417
+ className = "",
418
+ style,
419
+ onClick,
420
+ open,
421
+ onClose,
422
+ children,
423
+ renderTrigger
424
+ }) {
425
+ const ref = (0, import_react4.useRef)(null);
426
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { ref, className: `rdp-wrapper ${className}`, style, children: [
427
+ renderTrigger ? renderTrigger({ value: value ?? [null, null], displayValues, placeholder, onClick, open, onClose }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
428
+ "div",
429
+ {
430
+ className: "rdp-trigger rdp-trigger--range",
431
+ onClick,
432
+ role: "button",
433
+ tabIndex: 0,
434
+ onKeyDown: (e) => {
435
+ if (e.key === "Enter" || e.key === " ") {
436
+ e.preventDefault();
437
+ onClick();
438
+ }
439
+ },
440
+ children: [
441
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
442
+ "input",
443
+ {
444
+ type: "text",
445
+ readOnly: true,
446
+ value: displayValues[0],
447
+ placeholder: placeholder?.[0] ?? "Start"
448
+ }
449
+ ),
450
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "rdp-trigger-range-separator", children: "\u2013" }),
451
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
452
+ "input",
453
+ {
454
+ type: "text",
455
+ readOnly: true,
456
+ value: displayValues[1],
457
+ placeholder: placeholder?.[1] ?? "End"
458
+ }
459
+ ),
460
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CalendarIcon, {})
461
+ ]
462
+ }
463
+ ),
464
+ children
465
+ ] });
466
+ }
467
+ function CalendarIcon() {
468
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { className: "rdp-trigger-icon", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
469
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "1.5", y: "2.5", width: "13", height: "12", rx: "2" }),
470
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "1.5", y1: "6", x2: "14.5", y2: "6" }),
471
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "5", y1: "1", x2: "5", y2: "4" }),
472
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "11", y1: "1", x2: "11", y2: "4" })
473
+ ] });
474
+ }
475
+
476
+ // src/components/datetime/DatePicker.tsx
477
+ var import_jsx_runtime5 = require("react/jsx-runtime");
478
+ function DatePicker({
479
+ value: controlledValue,
480
+ onChange,
481
+ defaultValue,
482
+ locale = "en-US",
483
+ className = "",
484
+ style,
485
+ placeholder = "Select date",
486
+ position,
487
+ min,
488
+ max,
489
+ renderTrigger
490
+ }) {
491
+ const [value, setValue] = useControlled(controlledValue, defaultValue ?? null, onChange);
492
+ const [open, setOpen] = (0, import_react5.useState)(false);
493
+ const handleSelect = (date) => {
494
+ const clamped = clampDate(date, min, max);
495
+ setValue(clamped);
496
+ setOpen(false);
497
+ };
498
+ const displayValue = value ? formatDateValue(value, locale) : "";
499
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
500
+ InputTrigger,
501
+ {
502
+ value,
503
+ displayValue,
504
+ placeholder,
505
+ className,
506
+ style,
507
+ onClick: () => setOpen((o) => !o),
508
+ open,
509
+ onClose: () => setOpen(false),
510
+ renderTrigger,
511
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Popover, { open, onClose: () => setOpen(false), position, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
512
+ Calendar,
513
+ {
514
+ value,
515
+ onSelect: handleSelect,
516
+ min,
517
+ max,
518
+ locale,
519
+ defaultMonth: value ?? void 0
520
+ }
521
+ ) })
522
+ }
523
+ );
524
+ }
525
+
526
+ // src/components/datetime/TimePicker.tsx
527
+ var import_react7 = require("react");
528
+
529
+ // src/components/datetime/TimeColumn.tsx
530
+ var import_react6 = require("react");
531
+ var import_jsx_runtime6 = require("react/jsx-runtime");
532
+ function TimeColumn({
533
+ count,
534
+ step,
535
+ value,
536
+ onChange,
537
+ label,
538
+ formatValue
539
+ }) {
540
+ const containerRef = (0, import_react6.useRef)(null);
541
+ const items = generateTimeItems(count, step);
542
+ const selectedIndex = items.findIndex(
543
+ (item) => parseInt(item, 10) === value
544
+ );
545
+ (0, import_react6.useEffect)(() => {
546
+ if (containerRef.current && selectedIndex >= 0) {
547
+ const child = containerRef.current.children[selectedIndex + 1];
548
+ if (child) {
549
+ child.scrollIntoView({ block: "center", behavior: "smooth" });
550
+ }
551
+ }
552
+ }, [selectedIndex]);
553
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
554
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "rdp-time-label", children: label }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "rdp-time-column", ref: containerRef, children: items.map((item) => {
556
+ const num = parseInt(item, 10);
557
+ const isSelected = num === value;
558
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
559
+ "button",
560
+ {
561
+ type: "button",
562
+ className: `rdp-time-item ${isSelected ? "rdp-time-item--selected" : ""}`,
563
+ onClick: () => onChange(num),
564
+ children: formatValue ? formatValue(num) : item
565
+ },
566
+ item
567
+ );
568
+ }) })
569
+ ] });
570
+ }
571
+
572
+ // src/components/datetime/TimePicker.tsx
573
+ var import_jsx_runtime7 = require("react/jsx-runtime");
574
+ function TimePicker({
575
+ value: controlledValue,
576
+ onChange,
577
+ defaultValue,
578
+ locale = "en-US",
579
+ className = "",
580
+ style,
581
+ placeholder = "Select time",
582
+ position,
583
+ step = 1,
584
+ showSeconds = false,
585
+ timeFormat = "24h",
586
+ min,
587
+ max,
588
+ renderTrigger
589
+ }) {
590
+ const [value, setValue] = useControlled(controlledValue, defaultValue ?? null, onChange);
591
+ const [open, setOpen] = (0, import_react7.useState)(false);
592
+ const handleHourChange = (hour) => {
593
+ const newDate = value ? new Date(value) : /* @__PURE__ */ new Date();
594
+ newDate.setHours(hour);
595
+ const clamped = clampDate(newDate, min, max);
596
+ setValue(clamped);
597
+ };
598
+ const handleMinuteChange = (minute) => {
599
+ const newDate = value ? new Date(value) : /* @__PURE__ */ new Date();
600
+ newDate.setMinutes(minute);
601
+ const clamped = clampDate(newDate, min, max);
602
+ setValue(clamped);
603
+ };
604
+ const handleSecondChange = (second) => {
605
+ const newDate = value ? new Date(value) : /* @__PURE__ */ new Date();
606
+ newDate.setSeconds(second);
607
+ const clamped = clampDate(newDate, min, max);
608
+ setValue(clamped);
609
+ };
610
+ const displayValue = value ? formatTimeValue(value, locale, showSeconds) : "";
611
+ const current = value ?? /* @__PURE__ */ new Date();
612
+ const [amLabel, pmLabel] = (0, import_react7.useMemo)(() => getAMPeriodLabels(locale), [locale]);
613
+ const formatHour = (h) => {
614
+ if (timeFormat === "12h") {
615
+ const display = h === 0 ? 12 : h > 12 ? h - 12 : h;
616
+ return `${display} ${h < 12 ? amLabel : pmLabel}`;
617
+ }
618
+ return String(h).padStart(2, "0");
619
+ };
620
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
621
+ InputTrigger,
622
+ {
623
+ value,
624
+ displayValue,
625
+ placeholder,
626
+ className,
627
+ style,
628
+ onClick: () => setOpen((o) => !o),
629
+ open,
630
+ onClose: () => setOpen(false),
631
+ renderTrigger,
632
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Popover, { open, onClose: () => setOpen(false), position, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "rdp-time-picker", children: [
633
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
634
+ TimeColumn,
635
+ {
636
+ count: 24,
637
+ step: 1,
638
+ value: current.getHours(),
639
+ onChange: handleHourChange,
640
+ label: "Hour",
641
+ formatValue: formatHour
642
+ }
643
+ ),
644
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
645
+ TimeColumn,
646
+ {
647
+ count: 60,
648
+ step,
649
+ value: current.getMinutes(),
650
+ onChange: handleMinuteChange,
651
+ label: "Minute"
652
+ }
653
+ ),
654
+ showSeconds && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
655
+ TimeColumn,
656
+ {
657
+ count: 60,
658
+ step: 1,
659
+ value: current.getSeconds(),
660
+ onChange: handleSecondChange,
661
+ label: "Second"
662
+ }
663
+ )
664
+ ] }) })
665
+ }
666
+ );
667
+ }
668
+
669
+ // src/components/datetime/DateTimePicker.tsx
670
+ var import_react8 = require("react");
671
+ var import_jsx_runtime8 = require("react/jsx-runtime");
672
+ function DateTimePicker({
673
+ value: controlledValue,
674
+ onChange,
675
+ defaultValue,
676
+ locale = "en-US",
677
+ className = "",
678
+ style,
679
+ placeholder = "Select date & time",
680
+ position,
681
+ step = 1,
682
+ showSeconds = false,
683
+ timeFormat = "24h",
684
+ min,
685
+ max,
686
+ renderTrigger
687
+ }) {
688
+ const [value, setValue] = useControlled(controlledValue, defaultValue ?? null, onChange);
689
+ const [open, setOpen] = (0, import_react8.useState)(false);
690
+ const [showCalendar, setShowCalendar] = (0, import_react8.useState)(true);
691
+ const handleDateSelect = (date) => {
692
+ const current2 = value ? new Date(value) : /* @__PURE__ */ new Date();
693
+ const newDate = new Date(date);
694
+ newDate.setHours(current2.getHours(), current2.getMinutes(), current2.getSeconds());
695
+ setValue(clampDate(newDate, min, max));
696
+ };
697
+ const handleHourChange = (hour) => {
698
+ const current2 = value ? new Date(value) : /* @__PURE__ */ new Date();
699
+ current2.setHours(hour);
700
+ setValue(clampDate(current2, min, max));
701
+ };
702
+ const handleMinuteChange = (minute) => {
703
+ const current2 = value ? new Date(value) : /* @__PURE__ */ new Date();
704
+ current2.setMinutes(minute);
705
+ setValue(clampDate(current2, min, max));
706
+ };
707
+ const handleSecondChange = (second) => {
708
+ const current2 = value ? new Date(value) : /* @__PURE__ */ new Date();
709
+ current2.setSeconds(second);
710
+ setValue(clampDate(current2, min, max));
711
+ };
712
+ const handleClose = () => {
713
+ setOpen(false);
714
+ setShowCalendar(true);
715
+ };
716
+ const displayValue = value ? formatDateTimeValue(value, locale, showSeconds) : "";
717
+ const current = value ?? /* @__PURE__ */ new Date();
718
+ const [amLabel, pmLabel] = (0, import_react8.useMemo)(() => getAMPeriodLabels(locale), [locale]);
719
+ const formatHour = (h) => {
720
+ if (timeFormat === "12h") {
721
+ const display = h === 0 ? 12 : h > 12 ? h - 12 : h;
722
+ return `${display} ${h < 12 ? amLabel : pmLabel}`;
723
+ }
724
+ return String(h).padStart(2, "0");
725
+ };
726
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
727
+ InputTrigger,
728
+ {
729
+ value,
730
+ displayValue,
731
+ placeholder,
732
+ className,
733
+ style,
734
+ onClick: () => setOpen((o) => !o),
735
+ open,
736
+ onClose: handleClose,
737
+ renderTrigger,
738
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Popover, { open, onClose: handleClose, position, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rdp-datetime-layout", children: [
739
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
740
+ Calendar,
741
+ {
742
+ value,
743
+ onSelect: handleDateSelect,
744
+ min,
745
+ max,
746
+ locale,
747
+ defaultMonth: value ?? void 0
748
+ }
749
+ ),
750
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "rdp-time-picker", children: [
751
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
752
+ TimeColumn,
753
+ {
754
+ count: 24,
755
+ step: 1,
756
+ value: current.getHours(),
757
+ onChange: handleHourChange,
758
+ label: "Hour",
759
+ formatValue: formatHour
760
+ }
761
+ ),
762
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
763
+ TimeColumn,
764
+ {
765
+ count: 60,
766
+ step,
767
+ value: current.getMinutes(),
768
+ onChange: handleMinuteChange,
769
+ label: "Minute"
770
+ }
771
+ ),
772
+ showSeconds && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
773
+ TimeColumn,
774
+ {
775
+ count: 60,
776
+ step: 1,
777
+ value: current.getSeconds(),
778
+ onChange: handleSecondChange,
779
+ label: "Second"
780
+ }
781
+ )
782
+ ] })
783
+ ] }) })
784
+ }
785
+ );
786
+ }
787
+
788
+ // src/components/datetime/DateRangePicker.tsx
789
+ var import_react9 = require("react");
790
+ var import_jsx_runtime9 = require("react/jsx-runtime");
791
+ function DateRangePicker({
792
+ value: controlledValue,
793
+ onChange,
794
+ defaultValue,
795
+ locale = "en-US",
796
+ className = "",
797
+ style,
798
+ placeholder,
799
+ position,
800
+ min,
801
+ max,
802
+ renderTrigger
803
+ }) {
804
+ const [range, setRange] = (0, import_react9.useState)(
805
+ controlledValue ?? defaultValue ?? [null, null]
806
+ );
807
+ const [open, setOpen] = (0, import_react9.useState)(false);
808
+ const [pendingStart, setPendingStart] = (0, import_react9.useState)(null);
809
+ const isControlled = controlledValue !== void 0;
810
+ const currentRange = isControlled ? controlledValue : range;
811
+ const emit = (newRange) => {
812
+ if (!isControlled) setRange(newRange);
813
+ onChange?.(newRange);
814
+ };
815
+ const handleSelect = (0, import_react9.useCallback)(
816
+ (date) => {
817
+ const clamped = clampDate(date, min, max);
818
+ if (!pendingStart) {
819
+ setPendingStart(clamped);
820
+ emit([clamped, null]);
821
+ } else {
822
+ if (clamped.getTime() < pendingStart.getTime()) {
823
+ emit([clamped, pendingStart]);
824
+ } else {
825
+ emit([pendingStart, clamped]);
826
+ }
827
+ setPendingStart(null);
828
+ setOpen(false);
829
+ }
830
+ },
831
+ [pendingStart, min, max, emit]
832
+ );
833
+ const handleOpen = () => {
834
+ setPendingStart(null);
835
+ setOpen((o) => !o);
836
+ };
837
+ const handleClose = () => {
838
+ setOpen(false);
839
+ setPendingStart(null);
840
+ };
841
+ const displayValues = [
842
+ currentRange[0] ? formatDateValue(currentRange[0], locale) : "",
843
+ currentRange[1] ? formatDateValue(currentRange[1], locale) : ""
844
+ ];
845
+ const highlightRange = pendingStart ? [pendingStart, currentRange[1]] : [currentRange[0], currentRange[1]];
846
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
847
+ RangeInputTrigger,
848
+ {
849
+ value: currentRange,
850
+ displayValues,
851
+ placeholder: placeholder ?? ["Start date", "End date"],
852
+ className,
853
+ style,
854
+ onClick: handleOpen,
855
+ open,
856
+ onClose: handleClose,
857
+ renderTrigger,
858
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Popover, { open, onClose: handleClose, position, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
859
+ Calendar,
860
+ {
861
+ value: pendingStart ?? currentRange[0],
862
+ highlightRange,
863
+ onSelect: handleSelect,
864
+ min,
865
+ max,
866
+ locale,
867
+ defaultMonth: currentRange[0] ?? pendingStart ?? void 0
868
+ }
869
+ ) })
870
+ }
871
+ );
872
+ }
873
+
874
+ // src/components/datetime/TimeRangePicker.tsx
875
+ var import_react10 = require("react");
876
+ var import_jsx_runtime10 = require("react/jsx-runtime");
877
+ function TimeRangePicker({
878
+ value: controlledValue,
879
+ onChange,
880
+ defaultValue,
881
+ locale = "en-US",
882
+ className = "",
883
+ style,
884
+ placeholder,
885
+ position,
886
+ step = 1,
887
+ showSeconds = false,
888
+ timeFormat = "24h",
889
+ min,
890
+ max,
891
+ renderTrigger
892
+ }) {
893
+ const [range, setRange] = (0, import_react10.useState)(
894
+ controlledValue ?? defaultValue ?? [null, null]
895
+ );
896
+ const [open, setOpen] = (0, import_react10.useState)(false);
897
+ const isControlled = controlledValue !== void 0;
898
+ const currentRange = isControlled ? controlledValue : range;
899
+ const emit = (newRange) => {
900
+ if (!isControlled) setRange(newRange);
901
+ onChange?.(newRange);
902
+ };
903
+ const getStart = () => {
904
+ const d = currentRange[0] ? new Date(currentRange[0]) : /* @__PURE__ */ new Date();
905
+ d.setSeconds(0, 0);
906
+ return d;
907
+ };
908
+ const getEnd = () => {
909
+ const d = currentRange[1] ? new Date(currentRange[1]) : /* @__PURE__ */ new Date();
910
+ d.setHours(23, 0, 0, 0);
911
+ return d;
912
+ };
913
+ const updateStartTime = (hours, minutes, seconds = 0) => {
914
+ const start2 = getStart();
915
+ start2.setHours(hours, minutes, seconds);
916
+ emit([clampDate(start2, min, max), currentRange[1]]);
917
+ };
918
+ const updateEndTime = (hours, minutes, seconds = 0) => {
919
+ const end2 = getEnd();
920
+ end2.setHours(hours, minutes, seconds);
921
+ emit([currentRange[0], clampDate(end2, min, max)]);
922
+ };
923
+ const displayValues = [
924
+ currentRange[0] ? formatTimeValue(currentRange[0], locale, showSeconds) : "",
925
+ currentRange[1] ? formatTimeValue(currentRange[1], locale, showSeconds) : ""
926
+ ];
927
+ const start = getStart();
928
+ const end = getEnd();
929
+ const [amLabel, pmLabel] = (0, import_react10.useMemo)(() => getAMPeriodLabels(locale), [locale]);
930
+ const formatHour = (h) => {
931
+ if (timeFormat === "12h") {
932
+ const display = h === 0 ? 12 : h > 12 ? h - 12 : h;
933
+ return `${display} ${h < 12 ? amLabel : pmLabel}`;
934
+ }
935
+ return String(h).padStart(2, "0");
936
+ };
937
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
938
+ RangeInputTrigger,
939
+ {
940
+ value: currentRange,
941
+ displayValues,
942
+ placeholder: placeholder ?? ["Start time", "End time"],
943
+ className,
944
+ style,
945
+ onClick: () => setOpen((o) => !o),
946
+ open,
947
+ onClose: () => setOpen(false),
948
+ renderTrigger,
949
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Popover, { open, onClose: () => setOpen(false), position, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { style: { display: "flex", gap: 16 }, children: [
950
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "rdp-datetime-range-panel", children: [
951
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "rdp-datetime-range-label", children: "Start" }),
952
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "rdp-time-picker", children: [
953
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
954
+ TimeColumn,
955
+ {
956
+ count: 24,
957
+ step: 1,
958
+ value: start.getHours(),
959
+ onChange: (h) => updateStartTime(h, start.getMinutes(), start.getSeconds()),
960
+ label: "Hour",
961
+ formatValue: formatHour
962
+ }
963
+ ),
964
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
965
+ TimeColumn,
966
+ {
967
+ count: 60,
968
+ step,
969
+ value: start.getMinutes(),
970
+ onChange: (m) => updateStartTime(start.getHours(), m, start.getSeconds()),
971
+ label: "Minute"
972
+ }
973
+ ),
974
+ showSeconds && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
975
+ TimeColumn,
976
+ {
977
+ count: 60,
978
+ step: 1,
979
+ value: start.getSeconds(),
980
+ onChange: (s) => updateStartTime(start.getHours(), start.getMinutes(), s),
981
+ label: "Second"
982
+ }
983
+ )
984
+ ] })
985
+ ] }),
986
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "rdp-datetime-range-panel", children: [
987
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "rdp-datetime-range-label", children: "End" }),
988
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "rdp-time-picker", children: [
989
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
990
+ TimeColumn,
991
+ {
992
+ count: 24,
993
+ step: 1,
994
+ value: end.getHours(),
995
+ onChange: (h) => updateEndTime(h, end.getMinutes(), end.getSeconds()),
996
+ label: "Hour",
997
+ formatValue: formatHour
998
+ }
999
+ ),
1000
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1001
+ TimeColumn,
1002
+ {
1003
+ count: 60,
1004
+ step,
1005
+ value: end.getMinutes(),
1006
+ onChange: (m) => updateEndTime(end.getHours(), m, end.getSeconds()),
1007
+ label: "Minute"
1008
+ }
1009
+ ),
1010
+ showSeconds && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1011
+ TimeColumn,
1012
+ {
1013
+ count: 60,
1014
+ step: 1,
1015
+ value: end.getSeconds(),
1016
+ onChange: (s) => updateEndTime(end.getHours(), end.getMinutes(), s),
1017
+ label: "Second"
1018
+ }
1019
+ )
1020
+ ] })
1021
+ ] })
1022
+ ] }) })
1023
+ }
1024
+ );
1025
+ }
1026
+
1027
+ // src/components/datetime/DateTimeRangePicker.tsx
1028
+ var import_react11 = require("react");
1029
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1030
+ function DateTimeRangePicker({
1031
+ value: controlledValue,
1032
+ onChange,
1033
+ defaultValue,
1034
+ locale = "en-US",
1035
+ className = "",
1036
+ style,
1037
+ placeholder,
1038
+ position,
1039
+ step = 1,
1040
+ showSeconds = false,
1041
+ timeFormat = "24h",
1042
+ min,
1043
+ max,
1044
+ renderTrigger
1045
+ }) {
1046
+ const [range, setRange] = (0, import_react11.useState)(
1047
+ controlledValue ?? defaultValue ?? [null, null]
1048
+ );
1049
+ const [open, setOpen] = (0, import_react11.useState)(false);
1050
+ const [pendingStart, setPendingStart] = (0, import_react11.useState)(null);
1051
+ const [editingSide, setEditingSide] = (0, import_react11.useState)("date");
1052
+ const isControlled = controlledValue !== void 0;
1053
+ const currentRange = isControlled ? controlledValue : range;
1054
+ const emit = (newRange) => {
1055
+ if (!isControlled) setRange(newRange);
1056
+ onChange?.(newRange);
1057
+ };
1058
+ const handleDateSelect = (0, import_react11.useCallback)(
1059
+ (date) => {
1060
+ if (!pendingStart) {
1061
+ setPendingStart(date);
1062
+ emit([date, null]);
1063
+ } else {
1064
+ if (date.getTime() < pendingStart.getTime()) {
1065
+ emit([date, pendingStart]);
1066
+ } else {
1067
+ emit([pendingStart, date]);
1068
+ }
1069
+ setPendingStart(null);
1070
+ setEditingSide("start-time");
1071
+ }
1072
+ },
1073
+ [pendingStart, emit]
1074
+ );
1075
+ const getStart = () => {
1076
+ const d = currentRange[0] ? new Date(currentRange[0]) : /* @__PURE__ */ new Date();
1077
+ return d;
1078
+ };
1079
+ const getEnd = () => {
1080
+ const d = currentRange[1] ? new Date(currentRange[1]) : /* @__PURE__ */ new Date();
1081
+ d.setHours(23, 0, 0, 0);
1082
+ return d;
1083
+ };
1084
+ const updateStartTime = (hours, minutes, seconds = 0) => {
1085
+ const start2 = getStart();
1086
+ start2.setHours(hours, minutes, seconds);
1087
+ emit([clampDate(start2, min, max), currentRange[1]]);
1088
+ };
1089
+ const updateEndTime = (hours, minutes, seconds = 0) => {
1090
+ const end2 = getEnd();
1091
+ end2.setHours(hours, minutes, seconds);
1092
+ emit([currentRange[0], clampDate(end2, min, max)]);
1093
+ };
1094
+ const handleClose = () => {
1095
+ setOpen(false);
1096
+ setPendingStart(null);
1097
+ setEditingSide("date");
1098
+ };
1099
+ const displayValues = [
1100
+ currentRange[0] ? formatDateTimeValue(currentRange[0], locale, showSeconds) : "",
1101
+ currentRange[1] ? formatDateTimeValue(currentRange[1], locale, showSeconds) : ""
1102
+ ];
1103
+ const highlightRange = pendingStart ? [pendingStart, currentRange[1]] : [currentRange[0], currentRange[1]];
1104
+ const start = getStart();
1105
+ const end = getEnd();
1106
+ const [amLabel, pmLabel] = (0, import_react11.useMemo)(() => getAMPeriodLabels(locale), [locale]);
1107
+ const formatHour = (h) => {
1108
+ if (timeFormat === "12h") {
1109
+ const display = h === 0 ? 12 : h > 12 ? h - 12 : h;
1110
+ return `${display} ${h < 12 ? amLabel : pmLabel}`;
1111
+ }
1112
+ return String(h).padStart(2, "0");
1113
+ };
1114
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1115
+ RangeInputTrigger,
1116
+ {
1117
+ value: currentRange,
1118
+ displayValues,
1119
+ placeholder: placeholder ?? ["Start date & time", "End date & time"],
1120
+ className,
1121
+ style,
1122
+ onClick: () => setOpen((o) => !o),
1123
+ open,
1124
+ onClose: handleClose,
1125
+ renderTrigger,
1126
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Popover, { open, onClose: handleClose, position, style: { width: "max-content" }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: 16, flexWrap: "wrap" }, children: [
1127
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1128
+ Calendar,
1129
+ {
1130
+ value: pendingStart ?? currentRange[0],
1131
+ highlightRange,
1132
+ onSelect: handleDateSelect,
1133
+ min,
1134
+ max,
1135
+ locale,
1136
+ defaultMonth: currentRange[0] ?? pendingStart ?? void 0
1137
+ }
1138
+ ),
1139
+ !pendingStart && currentRange[0] && currentRange[1] && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { display: "flex", gap: 16 }, children: [
1140
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rdp-datetime-range-panel", children: [
1141
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rdp-datetime-range-label", children: "Start Time" }),
1142
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rdp-time-picker", children: [
1143
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1144
+ TimeColumn,
1145
+ {
1146
+ count: 24,
1147
+ step: 1,
1148
+ value: start.getHours(),
1149
+ onChange: (h) => updateStartTime(h, start.getMinutes(), start.getSeconds()),
1150
+ label: "Hour",
1151
+ formatValue: formatHour
1152
+ }
1153
+ ),
1154
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1155
+ TimeColumn,
1156
+ {
1157
+ count: 60,
1158
+ step,
1159
+ value: start.getMinutes(),
1160
+ onChange: (m) => updateStartTime(start.getHours(), m, start.getSeconds()),
1161
+ label: "Minute"
1162
+ }
1163
+ ),
1164
+ showSeconds && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1165
+ TimeColumn,
1166
+ {
1167
+ count: 60,
1168
+ step: 1,
1169
+ value: start.getSeconds(),
1170
+ onChange: (s) => updateStartTime(start.getHours(), start.getMinutes(), s),
1171
+ label: "Second"
1172
+ }
1173
+ )
1174
+ ] })
1175
+ ] }),
1176
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rdp-datetime-range-panel", children: [
1177
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "rdp-datetime-range-label", children: "End Time" }),
1178
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "rdp-time-picker", children: [
1179
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1180
+ TimeColumn,
1181
+ {
1182
+ count: 24,
1183
+ step: 1,
1184
+ value: end.getHours(),
1185
+ onChange: (h) => updateEndTime(h, end.getMinutes(), end.getSeconds()),
1186
+ label: "Hour",
1187
+ formatValue: formatHour
1188
+ }
1189
+ ),
1190
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1191
+ TimeColumn,
1192
+ {
1193
+ count: 60,
1194
+ step,
1195
+ value: end.getMinutes(),
1196
+ onChange: (m) => updateEndTime(end.getHours(), m, end.getSeconds()),
1197
+ label: "Minute"
1198
+ }
1199
+ ),
1200
+ showSeconds && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1201
+ TimeColumn,
1202
+ {
1203
+ count: 60,
1204
+ step: 1,
1205
+ value: end.getSeconds(),
1206
+ onChange: (s) => updateEndTime(end.getHours(), end.getMinutes(), s),
1207
+ label: "Second"
1208
+ }
1209
+ )
1210
+ ] })
1211
+ ] })
1212
+ ] })
1213
+ ] }) })
1214
+ }
1215
+ );
1216
+ }
1217
+ // Annotate the CommonJS export names for ESM import in node:
1218
+ 0 && (module.exports = {
1219
+ DatePicker,
1220
+ DateRangePicker,
1221
+ DateTimePicker,
1222
+ DateTimeRangePicker,
1223
+ TimePicker,
1224
+ TimeRangePicker
1225
+ });
1226
+ //# sourceMappingURL=index.js.map