@povio/ui 6.0.0-rc.2 → 6.0.0-rc.4
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/{Autocomplete.bound-e5WbxlBm.js → Autocomplete.bound-DTKSW9Sb.js} +1 -1
- package/dist/{Calendar-ChmIflXX.js → Calendar-u-UcoZhB.js} +6 -156
- package/dist/Calendar.lazy-B9YqgHbn.js +131 -0
- package/dist/{DatePicker-Bc_E4UZ1.js → DatePicker-BaLQOOJJ.js} +7 -5
- package/dist/{DatePicker.bound-CtBL5w-8.js → DatePicker.bound-NquZAtFK.js} +1 -1
- package/dist/{DatePickerInput-TND0rEMc.js → DatePickerInput-B0e_huQt.js} +6 -250
- package/dist/{DateRangePicker-BNMTOQ2N.js → DateRangePicker-D4lU0oQF.js} +25 -287
- package/dist/{DateRangePicker.bound-GeRw9Iuj.js → DateRangePicker.bound-B_gZlQvv.js} +1 -1
- package/dist/{DateTimePicker-B3YjV4uj.js → DateTimePicker-CtU096IU.js} +7 -5
- package/dist/{DateTimePicker.bound-ByjHsAnf.js → DateTimePicker.bound-BJzw56_u.js} +1 -1
- package/dist/{Input.bound-CnqI-L-b.js → Input.bound-DCTT5J62.js} +1 -1
- package/dist/{NumberField.bound-DiDYEZM4.js → NumberField.bound-CQcKgZ--.js} +1 -1
- package/dist/{NumberRangeInput.bound-B0e7yUDI.js → NumberRangeInput.bound-D-Lj5_KL.js} +1 -1
- package/dist/{PasswordInput.bound-Bj3WO1zC.js → PasswordInput.bound-WJ_VYQpn.js} +1 -1
- package/dist/RangeCalendar-CjaTtdUQ.js +291 -0
- package/dist/{RichTextEditor-qoxzWBFP.js → RichTextEditor-DpIQS8gk.js} +3 -3
- package/dist/{Select-BAlYMh4h.js → Select-DOrH8Q5O.js} +36 -361
- package/dist/{Select.bound-CQPG2sWV.js → Select.bound-RxqOhlbq.js} +1 -1
- package/dist/SelectListBox-PITCjHi6.js +362 -0
- package/dist/{TimePicker-CmBGkxDC.js → TimePicker-BjWuzBv_.js} +4 -3
- package/dist/{TimePicker.bound-3i1DJgrU.js → TimePicker.bound-DBovZwLJ.js} +1 -1
- package/dist/{datePickerValue.utils-BxHR_BQZ.js → TimePickerForm-BReCXELG.js} +2 -5
- package/dist/components/autocomplete.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/number-field.js +1 -1
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/pagination.js +1 -1
- package/dist/components/password-input.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/style-definitions.js +3 -3
- package/dist/components/time-picker.js +1 -1
- package/dist/datePickerValue.utils-CkmPaD6I.js +4 -0
- package/dist/import-DflE4Gl2.js +251 -0
- package/dist/index.js +20 -20
- package/dist/rich-text-editor.js +1 -1
- package/dist/tanstack/autocomplete.js +1 -1
- package/dist/tanstack/date-picker.js +1 -1
- package/dist/tanstack/date-range-picker.js +1 -1
- package/dist/tanstack/date-time-picker.js +1 -1
- package/dist/tanstack/input.js +1 -1
- package/dist/tanstack/number-field.js +1 -1
- package/dist/tanstack/number-range-input.js +1 -1
- package/dist/tanstack/password-input.js +1 -1
- package/dist/tanstack/rich-text-editor.js +1 -1
- package/dist/tanstack/select.js +1 -1
- package/dist/tanstack/table.js +1 -1
- package/dist/tanstack/time-picker.js +1 -1
- package/dist/tanstack.js +20 -20
- package/dist/useScrollableListBox-BfCLMZgv.js +47 -0
- package/package.json +1 -1
- package/dist/{Autocomplete-DSwAc7jF.js → Autocomplete-DuCidYx5.js} +1 -1
- package/dist/{Input-BdCci6BF.js → Input-CPPDOg7b.js} +1 -1
- package/dist/{NumberField-BLAwsjns.js → NumberField-BbeePjH2.js} +1 -1
- package/dist/{NumberRangeInput-al32ZeSy.js → NumberRangeInput-Cpqrom84.js} +1 -1
- package/dist/{staticDateTimeSegments-CA_lwN-O.js → staticDateTimeSegments-FE-F61iH.js} +2 -2
- package/dist/{useTableColumnConfig-DoTYVxqG.js → useTableColumnConfig-CGtkUBG8.js} +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as $a8ea2faf2ebe4d2f$re_export$mergeRefs } from "./import-D_3dPATF.js";
|
|
2
2
|
import { t as FieldController } from "./form.binding-B-2id68q.js";
|
|
3
|
-
import { n as AutocompleteInner } from "./Autocomplete-
|
|
3
|
+
import { n as AutocompleteInner } from "./Autocomplete-DuCidYx5.js";
|
|
4
4
|
import { memo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/inputs/Selection/Autocomplete/Autocomplete.bound.tsx
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
|
|
2
2
|
import { n as ChevronUp, r as ChevronLeft } from "./Tooltip-CqbyoJhl.js";
|
|
3
3
|
import { t as ChevronRight } from "./chevron-right-3nKJR5Bb.js";
|
|
4
|
-
import { a as $f11fb0bcf1b2687a$export$61c6a8c84e605fb6, i as CalendarGrid, r as $1697a7ad3db7b79f$re_export$useDateFormatter } from "./DatePickerInput-TND0rEMc.js";
|
|
5
4
|
import { t as clsx } from "./clsx-CnD0nOiA.js";
|
|
6
5
|
import { t as IconSlot } from "./IconSlot-Cuvpj1gd.js";
|
|
7
6
|
import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "./Button-C1YB5dOw.js";
|
|
@@ -10,121 +9,15 @@ import { n as $bc25b811ec97a172$export$40258cc1d95ff477 } from "./ToggleButton-D
|
|
|
10
9
|
import { t as Typography } from "./Typography-Ba5l4rmj.js";
|
|
11
10
|
import { n as uiOutlineClass } from "./outline.clsx-DGGQQRkM.js";
|
|
12
11
|
import { BadgeButton } from "./components/badge-button.js";
|
|
13
|
-
import { t as useBreakpoint } from "./useBreakpoint-DOUmXVZ2.js";
|
|
14
|
-
import { t as $3e6197669829fe11$export$40bfa8c7b0832715 } from "./useControlledState-CuU1VIh1.js";
|
|
15
|
-
import { i as $fd2148440a13ec26$export$fc1a364ae1f3ff10 } from "./NumberFormatter-DYarfm5F.js";
|
|
16
|
-
import { f as $8b141f2f71e88f85$export$2440da353cedad43, g as $8b141f2f71e88f85$export$f18627323ab57ac0, h as $8b141f2f71e88f85$export$c5221a78ef73c5e9, p as $8b141f2f71e88f85$export$7e319ea407e63bc0 } from "./staticDateTimeSegments-CA_lwN-O.js";
|
|
17
12
|
import "./i18n-BjNKHh_D.js";
|
|
18
|
-
import {
|
|
13
|
+
import { t as TimePickerForm } from "./TimePickerForm-BReCXELG.js";
|
|
14
|
+
import { t as useScrollableListBox } from "./useScrollableListBox-BfCLMZgv.js";
|
|
15
|
+
import { n as CalendarGrid, t as $1697a7ad3db7b79f$re_export$useDateFormatter } from "./import-DflE4Gl2.js";
|
|
19
16
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
20
|
-
import { c } from "react/compiler-runtime";
|
|
21
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { CalendarDateTime,
|
|
23
|
-
import { useCalendar } from "@react-aria/calendar";
|
|
18
|
+
import { CalendarDateTime, Time, today } from "@internationalized/date";
|
|
24
19
|
import { useTranslation } from "react-i18next";
|
|
25
|
-
|
|
26
|
-
function $28aae683a942e141$export$87194bb378cc3ac2(props) {
|
|
27
|
-
let overlayState = $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props);
|
|
28
|
-
let [value, setValue] = $3e6197669829fe11$export$40bfa8c7b0832715(props.value, props.defaultValue || null, props.onChange);
|
|
29
|
-
let [initialValue] = useState(value);
|
|
30
|
-
let v = value || props.placeholderValue || null;
|
|
31
|
-
let [granularity, defaultTimeZone] = $8b141f2f71e88f85$export$2440da353cedad43(v, props.granularity);
|
|
32
|
-
let dateValue = value != null ? value.toDate(defaultTimeZone ?? "UTC") : null;
|
|
33
|
-
let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
|
|
34
|
-
let shouldCloseOnSelect = props.shouldCloseOnSelect ?? true;
|
|
35
|
-
let [selectedDate, setSelectedDate] = useState(null);
|
|
36
|
-
let [selectedTime, setSelectedTime] = useState(null);
|
|
37
|
-
if (value) {
|
|
38
|
-
selectedDate = value;
|
|
39
|
-
if ("hour" in value) selectedTime = value;
|
|
40
|
-
}
|
|
41
|
-
if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
|
42
|
-
let showEra = value?.calendar.identifier === "gregory" && value.era === "BC";
|
|
43
|
-
let formatOpts = useMemo(() => ({
|
|
44
|
-
granularity,
|
|
45
|
-
timeZone: defaultTimeZone,
|
|
46
|
-
hideTimeZone: props.hideTimeZone,
|
|
47
|
-
hourCycle: props.hourCycle,
|
|
48
|
-
shouldForceLeadingZeros: props.shouldForceLeadingZeros,
|
|
49
|
-
showEra
|
|
50
|
-
}), [
|
|
51
|
-
granularity,
|
|
52
|
-
props.hourCycle,
|
|
53
|
-
props.shouldForceLeadingZeros,
|
|
54
|
-
defaultTimeZone,
|
|
55
|
-
props.hideTimeZone,
|
|
56
|
-
showEra
|
|
57
|
-
]);
|
|
58
|
-
let { minValue, maxValue, isDateUnavailable } = props;
|
|
59
|
-
let builtinValidation = useMemo(() => $8b141f2f71e88f85$export$f18627323ab57ac0(value, minValue, maxValue, isDateUnavailable, formatOpts), [
|
|
60
|
-
value,
|
|
61
|
-
minValue,
|
|
62
|
-
maxValue,
|
|
63
|
-
isDateUnavailable,
|
|
64
|
-
formatOpts
|
|
65
|
-
]);
|
|
66
|
-
let validation = $fd2148440a13ec26$export$fc1a364ae1f3ff10({
|
|
67
|
-
...props,
|
|
68
|
-
value,
|
|
69
|
-
builtinValidation
|
|
70
|
-
});
|
|
71
|
-
let isValueInvalid = validation.displayValidation.isInvalid;
|
|
72
|
-
let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
|
|
73
|
-
let commitValue = (date, time) => {
|
|
74
|
-
setValue("timeZone" in time ? time.set(toCalendarDate(date)) : toCalendarDateTime(date, time));
|
|
75
|
-
setSelectedDate(null);
|
|
76
|
-
setSelectedTime(null);
|
|
77
|
-
validation.commitValidation();
|
|
78
|
-
};
|
|
79
|
-
let selectDate = (newValue) => {
|
|
80
|
-
let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
|
|
81
|
-
if (hasTime) {
|
|
82
|
-
if (selectedTime || shouldClose) commitValue(newValue, selectedTime || $8b141f2f71e88f85$export$c5221a78ef73c5e9(props.defaultValue || props.placeholderValue));
|
|
83
|
-
else setSelectedDate(newValue);
|
|
84
|
-
} else {
|
|
85
|
-
setValue(newValue);
|
|
86
|
-
validation.commitValidation();
|
|
87
|
-
}
|
|
88
|
-
if (shouldClose) overlayState.setOpen(false);
|
|
89
|
-
};
|
|
90
|
-
let selectTime = (newValue) => {
|
|
91
|
-
if (selectedDate && newValue) commitValue(selectedDate, newValue);
|
|
92
|
-
else setSelectedTime(newValue);
|
|
93
|
-
};
|
|
94
|
-
return {
|
|
95
|
-
...validation,
|
|
96
|
-
value,
|
|
97
|
-
defaultValue: props.defaultValue ?? initialValue,
|
|
98
|
-
setValue,
|
|
99
|
-
dateValue: selectedDate,
|
|
100
|
-
timeValue: selectedTime,
|
|
101
|
-
setDateValue: selectDate,
|
|
102
|
-
setTimeValue: selectTime,
|
|
103
|
-
granularity,
|
|
104
|
-
hasTime,
|
|
105
|
-
...overlayState,
|
|
106
|
-
setOpen(isOpen) {
|
|
107
|
-
if (!isOpen && !value && selectedDate && hasTime) commitValue(selectedDate, selectedTime || $8b141f2f71e88f85$export$c5221a78ef73c5e9(props.defaultValue || props.placeholderValue));
|
|
108
|
-
overlayState.setOpen(isOpen);
|
|
109
|
-
},
|
|
110
|
-
validationState,
|
|
111
|
-
isInvalid: isValueInvalid,
|
|
112
|
-
formatValue(locale, fieldOptions) {
|
|
113
|
-
if (!dateValue) return "";
|
|
114
|
-
let formatOptions = $8b141f2f71e88f85$export$7e319ea407e63bc0(fieldOptions, formatOpts);
|
|
115
|
-
return new DateFormatter(locale, formatOptions).format(dateValue);
|
|
116
|
-
},
|
|
117
|
-
getDateFormatter(locale, formatOptions) {
|
|
118
|
-
let newOptions = {
|
|
119
|
-
...formatOpts,
|
|
120
|
-
...formatOptions
|
|
121
|
-
};
|
|
122
|
-
let newFormatOptions = $8b141f2f71e88f85$export$7e319ea407e63bc0({}, newOptions);
|
|
123
|
-
return new DateFormatter(locale, newFormatOptions);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
20
|
+
import { useCalendar } from "@react-aria/calendar";
|
|
128
21
|
//#region src/components/inputs/DateTime/shared/CalendarHeader.tsx
|
|
129
22
|
const calendarNavButtonClassName = clsx("inline-flex size-8 shrink-0 items-center justify-center rounded-md p-0 transition-all select-none", "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50 disabled:pointer-events-none", uiOutlineClass);
|
|
130
23
|
const HourCycle = {
|
|
@@ -322,49 +215,6 @@ const MonthPicker = ({ state, onSelectionChange, onDateChange, onCommit, selecte
|
|
|
322
215
|
});
|
|
323
216
|
};
|
|
324
217
|
//#endregion
|
|
325
|
-
//#region src/hooks/useScrollableListBox.ts
|
|
326
|
-
function useScrollableListBox() {
|
|
327
|
-
const $ = c(4);
|
|
328
|
-
const ref = useRef(null);
|
|
329
|
-
const isDesktop = useBreakpoint("md");
|
|
330
|
-
let t0;
|
|
331
|
-
let t1;
|
|
332
|
-
if ($[0] !== isDesktop) {
|
|
333
|
-
t0 = () => {
|
|
334
|
-
const node = ref.current;
|
|
335
|
-
if (!node || isDesktop) return;
|
|
336
|
-
const onPointerDownCapture = _temp;
|
|
337
|
-
const onClickCapture = _temp2;
|
|
338
|
-
node.addEventListener("pointerdown", onPointerDownCapture);
|
|
339
|
-
node.addEventListener("click", onClickCapture);
|
|
340
|
-
return () => {
|
|
341
|
-
node.removeEventListener("pointerdown", onPointerDownCapture);
|
|
342
|
-
node.removeEventListener("click", onClickCapture);
|
|
343
|
-
};
|
|
344
|
-
};
|
|
345
|
-
t1 = [ref, isDesktop];
|
|
346
|
-
$[0] = isDesktop;
|
|
347
|
-
$[1] = t0;
|
|
348
|
-
$[2] = t1;
|
|
349
|
-
} else {
|
|
350
|
-
t0 = $[1];
|
|
351
|
-
t1 = $[2];
|
|
352
|
-
}
|
|
353
|
-
useEffect(t0, t1);
|
|
354
|
-
let t2;
|
|
355
|
-
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
356
|
-
t2 = { ref };
|
|
357
|
-
$[3] = t2;
|
|
358
|
-
} else t2 = $[3];
|
|
359
|
-
return t2;
|
|
360
|
-
}
|
|
361
|
-
function _temp2(e_0) {
|
|
362
|
-
if (e_0.currentTarget?.contains(e_0.target) && e_0.target !== e_0.currentTarget) e_0.target.click();
|
|
363
|
-
}
|
|
364
|
-
function _temp(e) {
|
|
365
|
-
e.stopPropagation();
|
|
366
|
-
}
|
|
367
|
-
//#endregion
|
|
368
218
|
//#region src/components/inputs/DateTime/shared/YearPicker.tsx
|
|
369
219
|
const YearPicker = ({ state, onSelectionChange, onDateChange, onCommit, selectedDate }) => {
|
|
370
220
|
const formatter = $1697a7ad3db7b79f$re_export$useDateFormatter({
|
|
@@ -628,4 +478,4 @@ const Calendar = ({ showWeekNumbers, className, includesTime, datePickerState, h
|
|
|
628
478
|
});
|
|
629
479
|
};
|
|
630
480
|
//#endregion
|
|
631
|
-
export {
|
|
481
|
+
export { Calendar };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { r as $f11fb0bcf1b2687a$export$61c6a8c84e605fb6 } from "./DatePickerInput-B0e_huQt.js";
|
|
2
|
+
import { t as Spinner } from "./Spinner-CFj5Iu77.js";
|
|
3
|
+
import { t as $3e6197669829fe11$export$40bfa8c7b0832715 } from "./useControlledState-CuU1VIh1.js";
|
|
4
|
+
import { i as $fd2148440a13ec26$export$fc1a364ae1f3ff10 } from "./NumberFormatter-DYarfm5F.js";
|
|
5
|
+
import { f as $8b141f2f71e88f85$export$2440da353cedad43, g as $8b141f2f71e88f85$export$f18627323ab57ac0, h as $8b141f2f71e88f85$export$c5221a78ef73c5e9, p as $8b141f2f71e88f85$export$7e319ea407e63bc0 } from "./staticDateTimeSegments-FE-F61iH.js";
|
|
6
|
+
import { Suspense, lazy, useMemo, useState } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import { DateFormatter, toCalendarDate, toCalendarDateTime } from "@internationalized/date";
|
|
9
|
+
//#region ../../node_modules/.bun/react-stately@3.51.0+83d5fd7b249dbeef/node_modules/react-stately/dist/private/datepicker/useDatePickerState.mjs
|
|
10
|
+
function $28aae683a942e141$export$87194bb378cc3ac2(props) {
|
|
11
|
+
let overlayState = $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props);
|
|
12
|
+
let [value, setValue] = $3e6197669829fe11$export$40bfa8c7b0832715(props.value, props.defaultValue || null, props.onChange);
|
|
13
|
+
let [initialValue] = useState(value);
|
|
14
|
+
let v = value || props.placeholderValue || null;
|
|
15
|
+
let [granularity, defaultTimeZone] = $8b141f2f71e88f85$export$2440da353cedad43(v, props.granularity);
|
|
16
|
+
let dateValue = value != null ? value.toDate(defaultTimeZone ?? "UTC") : null;
|
|
17
|
+
let hasTime = granularity === "hour" || granularity === "minute" || granularity === "second";
|
|
18
|
+
let shouldCloseOnSelect = props.shouldCloseOnSelect ?? true;
|
|
19
|
+
let [selectedDate, setSelectedDate] = useState(null);
|
|
20
|
+
let [selectedTime, setSelectedTime] = useState(null);
|
|
21
|
+
if (value) {
|
|
22
|
+
selectedDate = value;
|
|
23
|
+
if ("hour" in value) selectedTime = value;
|
|
24
|
+
}
|
|
25
|
+
if (v && !(granularity in v)) throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
|
26
|
+
let showEra = value?.calendar.identifier === "gregory" && value.era === "BC";
|
|
27
|
+
let formatOpts = useMemo(() => ({
|
|
28
|
+
granularity,
|
|
29
|
+
timeZone: defaultTimeZone,
|
|
30
|
+
hideTimeZone: props.hideTimeZone,
|
|
31
|
+
hourCycle: props.hourCycle,
|
|
32
|
+
shouldForceLeadingZeros: props.shouldForceLeadingZeros,
|
|
33
|
+
showEra
|
|
34
|
+
}), [
|
|
35
|
+
granularity,
|
|
36
|
+
props.hourCycle,
|
|
37
|
+
props.shouldForceLeadingZeros,
|
|
38
|
+
defaultTimeZone,
|
|
39
|
+
props.hideTimeZone,
|
|
40
|
+
showEra
|
|
41
|
+
]);
|
|
42
|
+
let { minValue, maxValue, isDateUnavailable } = props;
|
|
43
|
+
let builtinValidation = useMemo(() => $8b141f2f71e88f85$export$f18627323ab57ac0(value, minValue, maxValue, isDateUnavailable, formatOpts), [
|
|
44
|
+
value,
|
|
45
|
+
minValue,
|
|
46
|
+
maxValue,
|
|
47
|
+
isDateUnavailable,
|
|
48
|
+
formatOpts
|
|
49
|
+
]);
|
|
50
|
+
let validation = $fd2148440a13ec26$export$fc1a364ae1f3ff10({
|
|
51
|
+
...props,
|
|
52
|
+
value,
|
|
53
|
+
builtinValidation
|
|
54
|
+
});
|
|
55
|
+
let isValueInvalid = validation.displayValidation.isInvalid;
|
|
56
|
+
let validationState = props.validationState || (isValueInvalid ? "invalid" : null);
|
|
57
|
+
let commitValue = (date, time) => {
|
|
58
|
+
setValue("timeZone" in time ? time.set(toCalendarDate(date)) : toCalendarDateTime(date, time));
|
|
59
|
+
setSelectedDate(null);
|
|
60
|
+
setSelectedTime(null);
|
|
61
|
+
validation.commitValidation();
|
|
62
|
+
};
|
|
63
|
+
let selectDate = (newValue) => {
|
|
64
|
+
let shouldClose = typeof shouldCloseOnSelect === "function" ? shouldCloseOnSelect() : shouldCloseOnSelect;
|
|
65
|
+
if (hasTime) {
|
|
66
|
+
if (selectedTime || shouldClose) commitValue(newValue, selectedTime || $8b141f2f71e88f85$export$c5221a78ef73c5e9(props.defaultValue || props.placeholderValue));
|
|
67
|
+
else setSelectedDate(newValue);
|
|
68
|
+
} else {
|
|
69
|
+
setValue(newValue);
|
|
70
|
+
validation.commitValidation();
|
|
71
|
+
}
|
|
72
|
+
if (shouldClose) overlayState.setOpen(false);
|
|
73
|
+
};
|
|
74
|
+
let selectTime = (newValue) => {
|
|
75
|
+
if (selectedDate && newValue) commitValue(selectedDate, newValue);
|
|
76
|
+
else setSelectedTime(newValue);
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
...validation,
|
|
80
|
+
value,
|
|
81
|
+
defaultValue: props.defaultValue ?? initialValue,
|
|
82
|
+
setValue,
|
|
83
|
+
dateValue: selectedDate,
|
|
84
|
+
timeValue: selectedTime,
|
|
85
|
+
setDateValue: selectDate,
|
|
86
|
+
setTimeValue: selectTime,
|
|
87
|
+
granularity,
|
|
88
|
+
hasTime,
|
|
89
|
+
...overlayState,
|
|
90
|
+
setOpen(isOpen) {
|
|
91
|
+
if (!isOpen && !value && selectedDate && hasTime) commitValue(selectedDate, selectedTime || $8b141f2f71e88f85$export$c5221a78ef73c5e9(props.defaultValue || props.placeholderValue));
|
|
92
|
+
overlayState.setOpen(isOpen);
|
|
93
|
+
},
|
|
94
|
+
validationState,
|
|
95
|
+
isInvalid: isValueInvalid,
|
|
96
|
+
formatValue(locale, fieldOptions) {
|
|
97
|
+
if (!dateValue) return "";
|
|
98
|
+
let formatOptions = $8b141f2f71e88f85$export$7e319ea407e63bc0(fieldOptions, formatOpts);
|
|
99
|
+
return new DateFormatter(locale, formatOptions).format(dateValue);
|
|
100
|
+
},
|
|
101
|
+
getDateFormatter(locale, formatOptions) {
|
|
102
|
+
let newOptions = {
|
|
103
|
+
...formatOpts,
|
|
104
|
+
...formatOptions
|
|
105
|
+
};
|
|
106
|
+
let newFormatOptions = $8b141f2f71e88f85$export$7e319ea407e63bc0({}, newOptions);
|
|
107
|
+
return new DateFormatter(locale, newFormatOptions);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/components/inputs/DateTime/shared/Calendar.lazy.tsx
|
|
113
|
+
const loadCalendar = () => import("./Calendar-u-UcoZhB.js");
|
|
114
|
+
const CalendarRenderer = lazy(() => loadCalendar().then(({ Calendar }) => ({ default: Calendar })));
|
|
115
|
+
/** Fetches the calendar chunk ahead of the dialog opening (hover, focus). */
|
|
116
|
+
const preloadCalendar = () => {
|
|
117
|
+
loadCalendar();
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Calendar that only loads its grid, month/year pickers and time form when a picker dialog opens.
|
|
121
|
+
* The fallback reserves the grid's size so the popover does not jump once the chunk arrives.
|
|
122
|
+
*/
|
|
123
|
+
const Calendar = (props) => /* @__PURE__ */ jsx(Suspense, {
|
|
124
|
+
fallback: /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "flex h-72 w-full items-center justify-center md:w-80",
|
|
126
|
+
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
127
|
+
}),
|
|
128
|
+
children: /* @__PURE__ */ jsx(CalendarRenderer, { ...props })
|
|
129
|
+
});
|
|
130
|
+
//#endregion
|
|
131
|
+
export { preloadCalendar as n, $28aae683a942e141$export$87194bb378cc3ac2 as r, Calendar as t };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { t as UIConfig } from "./uiConfig.context-dxsO9puE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { i as $ea0ea6e62ae0d7ca$export$6d095e787d2b5e1f, n as renderDatePickerTodayIcon, t as DatePickerInput } from "./DatePickerInput-B0e_huQt.js";
|
|
3
3
|
import { t as clsx } from "./clsx-CnD0nOiA.js";
|
|
4
4
|
import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
|
|
5
5
|
import { r as $a8ea2faf2ebe4d2f$re_export$mergeRefs } from "./import-D_3dPATF.js";
|
|
6
6
|
import { t as useFieldAccessibility } from "./useFieldAccessibility-eZIMECmG.js";
|
|
7
7
|
import { t as FormField } from "./FormField-DyqEbqx3.js";
|
|
8
|
-
import { i as getStaticDateTimeFocusTarget, o as DateTimeDialogFooter, s as DateTimeDialog, t as getStaticCalendarDateSegments } from "./staticDateTimeSegments-
|
|
9
|
-
import { r as $28aae683a942e141$export$87194bb378cc3ac2, t as Calendar } from "./Calendar-
|
|
10
|
-
import { n as useStaticInputHandoff } from "./useStaticInputHandoff-DyYxfwv6.js";
|
|
11
|
-
import { t as normalizeDatePickerValue } from "./datePickerValue.utils-BxHR_BQZ.js";
|
|
8
|
+
import { i as getStaticDateTimeFocusTarget, o as DateTimeDialogFooter, s as DateTimeDialog, t as getStaticCalendarDateSegments } from "./staticDateTimeSegments-FE-F61iH.js";
|
|
9
|
+
import { n as preloadCalendar, r as $28aae683a942e141$export$87194bb378cc3ac2, t as Calendar } from "./Calendar.lazy-B9YqgHbn.js";
|
|
12
10
|
import { t as DateTimeUtils } from "./date-time.utils-0F9qduim.js";
|
|
13
11
|
import { t as datePickerInputContentRowDefinition } from "./datePickerInput.cva--gCeAsRx.js";
|
|
14
12
|
import { t as TooltipWrapper } from "./TooltipWrapper-BrftXInI.js";
|
|
13
|
+
import { t as normalizeDatePickerValue } from "./datePickerValue.utils-CkmPaD6I.js";
|
|
14
|
+
import { n as useStaticInputHandoff } from "./useStaticInputHandoff-DyYxfwv6.js";
|
|
15
15
|
import { InputFrame } from "./components/input-frame.js";
|
|
16
16
|
import { memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -211,6 +211,8 @@ const DatePickerBase = (props) => {
|
|
|
211
211
|
labelProps,
|
|
212
212
|
className: clsx("group relative flex w-full flex-col text-left", className),
|
|
213
213
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
214
|
+
onMouseEnter: preloadCalendar,
|
|
215
|
+
onFocusCapture: preloadCalendar,
|
|
214
216
|
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
215
217
|
ref: $a8ea2faf2ebe4d2f$re_export$mergeRefs(ref, datePickerInputRef),
|
|
216
218
|
as,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as $a8ea2faf2ebe4d2f$re_export$mergeRefs } from "./import-D_3dPATF.js";
|
|
2
2
|
import { t as FieldController } from "./form.binding-B-2id68q.js";
|
|
3
|
-
import { n as DatePickerInner } from "./DatePicker-
|
|
3
|
+
import { n as DatePickerInner } from "./DatePicker-BaLQOOJJ.js";
|
|
4
4
|
import { memo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/inputs/DateTime/DatePicker/DatePicker.bound.tsx
|
|
@@ -5,30 +5,19 @@ import { t as UIOverrides } from "./uiOverrides.context-BTCH9y5a.js";
|
|
|
5
5
|
import { n as $7705c033048f6da7$export$353f5b6fc5456de1 } from "./Button-C1YB5dOw.js";
|
|
6
6
|
import { t as Typography } from "./Typography-Ba5l4rmj.js";
|
|
7
7
|
import { IconButton } from "./components/icon-button.js";
|
|
8
|
-
import { n as $a8ea2faf2ebe4d2f$re_export$mergeProps } from "./import-D_3dPATF.js";
|
|
9
8
|
import { n as FormFieldLabel } from "./FormField-DyqEbqx3.js";
|
|
10
9
|
import { a as inputSizeDefinition, t as inputBaseDefinition } from "./input.cva-AHLI_M3K.js";
|
|
11
10
|
import { t as $3e6197669829fe11$export$40bfa8c7b0832715 } from "./useControlledState-CuU1VIh1.js";
|
|
12
|
-
import { c as useFirefoxDateSegmentSelectionGuard, d as $8e7461aabf74661f$export$60e84778edff6d26, l as DateSegmentItem } from "./staticDateTimeSegments-
|
|
13
|
-
import "./i18n-BjNKHh_D.js";
|
|
14
|
-
import { r as $32daac5f69beb98a$re_export$useFocusRing } from "./useStaticInputHandoff-DyYxfwv6.js";
|
|
11
|
+
import { c as useFirefoxDateSegmentSelectionGuard, d as $8e7461aabf74661f$export$60e84778edff6d26, l as DateSegmentItem } from "./staticDateTimeSegments-FE-F61iH.js";
|
|
15
12
|
import { t as DateTimeUtils } from "./date-time.utils-0F9qduim.js";
|
|
16
13
|
import { t as DateUtils } from "./date.utils-B8_QF9y6.js";
|
|
17
14
|
import { t as datePickerInputContentRowDefinition } from "./datePickerInput.cva--gCeAsRx.js";
|
|
15
|
+
import "./i18n-BjNKHh_D.js";
|
|
18
16
|
import { n as InputClear } from "./TooltipWrapper-BrftXInI.js";
|
|
19
17
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
20
18
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
-
import { CalendarDate, CalendarDateTime, DateFormatter, GregorianCalendar, createCalendar, endOfMonth, endOfWeek, getDayOfWeek, getLocalTimeZone, getWeeksInMonth, isEqualCalendar, isSameDay,
|
|
22
|
-
import "react-aria
|
|
23
|
-
import "react-aria/useNumberFormatter";
|
|
24
|
-
import "react-aria/useCollator";
|
|
25
|
-
import "react-aria/useLocalizedStringFormatter";
|
|
26
|
-
import "react-aria/useFilter";
|
|
27
|
-
import "react-aria/useListFormatter";
|
|
28
|
-
import { useDateField, useLocale as useLocale$1 } from "react-aria";
|
|
29
|
-
import { useCalendarCell, useCalendarGrid } from "@react-aria/calendar";
|
|
30
|
-
import { useTranslation } from "react-i18next";
|
|
31
|
-
import { useDateFormatter as $1697a7ad3db7b79f$re_export$useDateFormatter } from "react-aria/useDateFormatter";
|
|
19
|
+
import { CalendarDate, CalendarDateTime, DateFormatter, GregorianCalendar, createCalendar, endOfMonth, endOfWeek, getDayOfWeek, getLocalTimeZone, getWeeksInMonth, isEqualCalendar, isSameDay, maxDate, minDate, startOfMonth, startOfWeek, startOfYear, toCalendar, toCalendarDate, today } from "@internationalized/date";
|
|
20
|
+
import { useDateField, useLocale } from "react-aria";
|
|
32
21
|
import { useFocusVisible, useFocusWithin, useHover } from "@react-aria/interactions";
|
|
33
22
|
import i18next from "i18next";
|
|
34
23
|
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/type.mjs
|
|
@@ -394,243 +383,10 @@ function $f11fb0bcf1b2687a$export$61c6a8c84e605fb6(props) {
|
|
|
394
383
|
};
|
|
395
384
|
}
|
|
396
385
|
//#endregion
|
|
397
|
-
//#region src/components/inputs/DateTime/shared/calendarWeek.utils.ts
|
|
398
|
-
const gregorianCalendar = new GregorianCalendar();
|
|
399
|
-
/** ISO weeks start on Monday and belong to the year containing their Thursday. */
|
|
400
|
-
const getISOWeekNumber = (date) => {
|
|
401
|
-
const gregorianDate = toCalendar(date, gregorianCalendar);
|
|
402
|
-
const thursday = startOfWeek(gregorianDate, "en-GB", "mon").add({ days: 3 });
|
|
403
|
-
const yearStart = new CalendarDate(thursday.era, thursday.year, 1, 1);
|
|
404
|
-
return Math.floor((gregorianCalendar.toJulianDay(thursday) - gregorianCalendar.toJulianDay(yearStart)) / 7) + 1;
|
|
405
|
-
};
|
|
406
|
-
//#endregion
|
|
407
|
-
//#region src/components/inputs/DateTime/shared/CalendarCell.tsx
|
|
408
|
-
const isRange = (state) => {
|
|
409
|
-
return "highlightedRange" in state;
|
|
410
|
-
};
|
|
411
|
-
const CalendarCell = ({ state, onApply, onDoubleClickApply, shouldApplyOnDateSelection = true, shouldCloseOnSelect = true, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, ...props }) => {
|
|
412
|
-
const ref = useRef(null);
|
|
413
|
-
const { cellProps, buttonProps, formattedDate, isSelected, isDisabled, isOutsideVisibleRange } = useCalendarCell(props, state, ref);
|
|
414
|
-
const { focusProps } = $32daac5f69beb98a$re_export$useFocusRing();
|
|
415
|
-
const onClick = useCallback((event) => {
|
|
416
|
-
buttonProps.onClick?.(event);
|
|
417
|
-
if (onDateSelection) onDateSelection(props.date);
|
|
418
|
-
if (shouldCloseOnSelect && !isDisabled && (shouldApplyOnDateSelection || isSelected)) onApply?.(props.date);
|
|
419
|
-
}, [
|
|
420
|
-
buttonProps,
|
|
421
|
-
onDateSelection,
|
|
422
|
-
props.date,
|
|
423
|
-
isDisabled,
|
|
424
|
-
shouldApplyOnDateSelection,
|
|
425
|
-
isSelected,
|
|
426
|
-
shouldCloseOnSelect,
|
|
427
|
-
onApply
|
|
428
|
-
]);
|
|
429
|
-
const onDoubleClick = useCallback((event) => {
|
|
430
|
-
if (isDisabled) return;
|
|
431
|
-
event.preventDefault();
|
|
432
|
-
onDoubleClickApply?.(props.date);
|
|
433
|
-
}, [
|
|
434
|
-
isDisabled,
|
|
435
|
-
onDoubleClickApply,
|
|
436
|
-
props.date
|
|
437
|
-
]);
|
|
438
|
-
const selectionState = useMemo(() => {
|
|
439
|
-
let isSelectionStart = false;
|
|
440
|
-
let isSelectionEnd = false;
|
|
441
|
-
let isSelectedCell = false;
|
|
442
|
-
let isInRange = false;
|
|
443
|
-
let isHoverRange = false;
|
|
444
|
-
let isSelectingMode = false;
|
|
445
|
-
if (rangeSelection?.start) {
|
|
446
|
-
isSelectionStart = isSameDay(props.date, rangeSelection.start);
|
|
447
|
-
isSelectionEnd = rangeSelection.end ? isSameDay(props.date, rangeSelection.end) : false;
|
|
448
|
-
isSelectedCell = isSelectionStart || isSelectionEnd;
|
|
449
|
-
isSelectingMode = rangeSelection.isSelecting && !rangeSelection.end;
|
|
450
|
-
if (rangeSelection.start && rangeSelection.end) {
|
|
451
|
-
const dateValue = props.date;
|
|
452
|
-
const isAfterStart = dateValue.compare(rangeSelection.start) > 0;
|
|
453
|
-
const isBeforeEnd = dateValue.compare(rangeSelection.end) < 0;
|
|
454
|
-
isInRange = isAfterStart && isBeforeEnd;
|
|
455
|
-
}
|
|
456
|
-
if (rangeSelection.isSelecting && rangeSelection.start && hoverDate && !rangeSelection.end) {
|
|
457
|
-
const dateValue = props.date;
|
|
458
|
-
const { start } = rangeSelection;
|
|
459
|
-
const end = hoverDate;
|
|
460
|
-
const earlierDate = start.compare(end) <= 0 ? start : end;
|
|
461
|
-
const laterDate = start.compare(end) <= 0 ? end : start;
|
|
462
|
-
const isAfterStart = dateValue.compare(earlierDate) > 0;
|
|
463
|
-
const isBeforeEnd = dateValue.compare(laterDate) < 0;
|
|
464
|
-
isHoverRange = isAfterStart && isBeforeEnd;
|
|
465
|
-
}
|
|
466
|
-
} else {
|
|
467
|
-
isSelectionStart = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.start) : isSelected;
|
|
468
|
-
isSelectionEnd = isRange(state) && state.highlightedRange ? isSameDay(props.date, state.highlightedRange.end) : isSelected;
|
|
469
|
-
isSelectedCell = isSelectionStart || isSelectionEnd || !isRange(state) && isSelected;
|
|
470
|
-
isInRange = isRange(state) && isSelected && !isSelectionStart && !isSelectionEnd;
|
|
471
|
-
if (isRange(state) && state.highlightedRange && !isSelected) {
|
|
472
|
-
const dateValue = props.date;
|
|
473
|
-
const isAfterStart = dateValue.compare(state.highlightedRange.start) > 0;
|
|
474
|
-
const isBeforeEnd = dateValue.compare(state.highlightedRange.end) < 0;
|
|
475
|
-
isHoverRange = isAfterStart && isBeforeEnd;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
return {
|
|
479
|
-
isSelectionStart,
|
|
480
|
-
isSelectionEnd,
|
|
481
|
-
isSelectedCell,
|
|
482
|
-
isInRange,
|
|
483
|
-
isHoverRange,
|
|
484
|
-
isSelectingMode
|
|
485
|
-
};
|
|
486
|
-
}, [
|
|
487
|
-
props.date,
|
|
488
|
-
rangeSelection,
|
|
489
|
-
state,
|
|
490
|
-
isSelected,
|
|
491
|
-
hoverDate
|
|
492
|
-
]);
|
|
493
|
-
const handleEvent = (event, eventHandler) => {
|
|
494
|
-
if (isOutsideVisibleRange) {
|
|
495
|
-
state.selectDate(props.date);
|
|
496
|
-
state.setFocusedDate(props.date);
|
|
497
|
-
}
|
|
498
|
-
eventHandler?.(event);
|
|
499
|
-
if (isSelected && shouldCloseOnSelect) onApply?.(props.date);
|
|
500
|
-
};
|
|
501
|
-
const onMouseEnter = useCallback(() => {
|
|
502
|
-
if (onDateHover && selectionState.isSelectingMode) onDateHover(props.date);
|
|
503
|
-
}, [
|
|
504
|
-
onDateHover,
|
|
505
|
-
selectionState.isSelectingMode,
|
|
506
|
-
props.date
|
|
507
|
-
]);
|
|
508
|
-
const onMouseLeave = useCallback(() => {
|
|
509
|
-
if (onDateHover && selectionState.isSelectingMode) onDateHover(null);
|
|
510
|
-
}, [onDateHover, selectionState.isSelectingMode]);
|
|
511
|
-
const isTodayCell = isToday(props.date, getLocalTimeZone());
|
|
512
|
-
const cellClassName = useMemo(() => {
|
|
513
|
-
const { isSelectedCell, isInRange, isHoverRange, isSelectingMode, isSelectionStart, isSelectionEnd } = selectionState;
|
|
514
|
-
const isVisibleSelected = isSelectedCell && !isOutsideVisibleRange;
|
|
515
|
-
const isVisibleRangeMiddle = (isInRange || isHoverRange) && !isOutsideVisibleRange && !isVisibleSelected;
|
|
516
|
-
const isRangeStart = isVisibleSelected && !!rangeSelection && !rangeSelection.isSelecting && isSelectionStart && !isSelectionEnd;
|
|
517
|
-
const isRangeEnd = isVisibleSelected && !!rangeSelection && !rangeSelection.isSelecting && isSelectionEnd && !isSelectionStart;
|
|
518
|
-
const isRangeEdge = isRangeStart || isRangeEnd;
|
|
519
|
-
return clsx("mx-auto flex items-center justify-center p-0 text-sm font-normal transition-[color,box-shadow]", "outline-none focus-visible:relative focus-visible:z-10 focus-visible:ring-[3px] focus-visible:ring-ring/50", isVisibleRangeMiddle || isRangeEdge ? "h-8 w-full" : "size-8", isVisibleRangeMiddle && "rounded-none", isRangeStart && "rounded-l-md", isRangeEnd && "rounded-r-md", !isVisibleRangeMiddle && !isRangeEdge && "rounded-md", isOutsideVisibleRange && "text-muted-foreground opacity-50", isVisibleSelected && "bg-primary text-primary-foreground", isVisibleSelected && isDisabled && "opacity-50", isVisibleRangeMiddle && "bg-accent text-accent-foreground", !isOutsideVisibleRange && !isVisibleSelected && !isVisibleRangeMiddle && isDisabled && "text-muted-foreground opacity-50", !isOutsideVisibleRange && !isVisibleSelected && !isVisibleRangeMiddle && !isDisabled && isTodayCell && "bg-accent text-accent-foreground", !isOutsideVisibleRange && !isVisibleSelected && !isVisibleRangeMiddle && !isDisabled && !isTodayCell && "text-foreground [@media(pointer:fine)]:hover:bg-accent [@media(pointer:fine)]:hover:text-accent-foreground", isDisabled && !isOutsideVisibleRange && "cursor-default", isSelectingMode && !isVisibleSelected && !isVisibleRangeMiddle && !isDisabled && "duration-75");
|
|
520
|
-
}, [
|
|
521
|
-
selectionState,
|
|
522
|
-
isOutsideVisibleRange,
|
|
523
|
-
rangeSelection,
|
|
524
|
-
isDisabled,
|
|
525
|
-
isTodayCell
|
|
526
|
-
]);
|
|
527
|
-
return /* @__PURE__ */ jsx("td", {
|
|
528
|
-
...cellProps,
|
|
529
|
-
className: "p-0 py-0.5",
|
|
530
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
531
|
-
ref,
|
|
532
|
-
...$a8ea2faf2ebe4d2f$re_export$mergeProps(buttonProps, focusProps),
|
|
533
|
-
"aria-disabled": void 0,
|
|
534
|
-
onMouseEnter,
|
|
535
|
-
onMouseLeave,
|
|
536
|
-
className: cellClassName,
|
|
537
|
-
onClick: (e) => handleEvent(e, onClick),
|
|
538
|
-
onDoubleClick,
|
|
539
|
-
onKeyDown: (e) => handleEvent(e, () => onKeyboardNavigation?.(e, props.date)),
|
|
540
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
541
|
-
as: "span",
|
|
542
|
-
size: "body",
|
|
543
|
-
className: "block overflow-hidden text-ellipsis text-center",
|
|
544
|
-
children: formattedDate
|
|
545
|
-
})
|
|
546
|
-
})
|
|
547
|
-
});
|
|
548
|
-
};
|
|
549
|
-
//#endregion
|
|
550
|
-
//#region src/components/inputs/DateTime/shared/CalendarGrid.tsx
|
|
551
|
-
const WEEK_INDICES = [
|
|
552
|
-
0,
|
|
553
|
-
1,
|
|
554
|
-
2,
|
|
555
|
-
3,
|
|
556
|
-
4,
|
|
557
|
-
5
|
|
558
|
-
];
|
|
559
|
-
const NO_CALENDAR_OFFSET = {};
|
|
560
|
-
const CalendarGrid = ({ state, showWeekNumbers = false, onApply, onDoubleClickApply, shouldApplyOnDateSelection, shouldCloseOnSelect, offset = NO_CALENDAR_OFFSET, onDateSelection, onDateHover, rangeSelection, hoverDate, onKeyboardNavigation, className, calendarSide, isSelectionDisabled, ...props }) => {
|
|
561
|
-
const { t } = useTranslation();
|
|
562
|
-
const { gridProps, headerProps, weekDays } = useCalendarGrid({
|
|
563
|
-
...props,
|
|
564
|
-
weekdayStyle: "short",
|
|
565
|
-
firstDayOfWeek: showWeekNumbers ? "mon" : props.firstDayOfWeek
|
|
566
|
-
}, state);
|
|
567
|
-
const startDate = state.visibleRange.start.add(offset);
|
|
568
|
-
const handleDateSelection = (date) => {
|
|
569
|
-
onDateSelection?.(date, calendarSide);
|
|
570
|
-
};
|
|
571
|
-
return /* @__PURE__ */ jsx("div", {
|
|
572
|
-
className: clsx("h-72 w-full px-3 pb-3", showWeekNumbers ? "md:w-[352px]" : "md:w-80", className),
|
|
573
|
-
inert: isSelectionDisabled || void 0,
|
|
574
|
-
"aria-disabled": isSelectionDisabled || void 0,
|
|
575
|
-
children: /* @__PURE__ */ jsxs("table", {
|
|
576
|
-
...gridProps,
|
|
577
|
-
cellPadding: "0",
|
|
578
|
-
className: "w-full",
|
|
579
|
-
children: [/* @__PURE__ */ jsx("thead", {
|
|
580
|
-
...headerProps,
|
|
581
|
-
children: /* @__PURE__ */ jsxs("tr", { children: [showWeekNumbers && /* @__PURE__ */ jsx("th", {
|
|
582
|
-
scope: "col",
|
|
583
|
-
className: "w-8 border-r border-border font-normal",
|
|
584
|
-
"aria-label": t(($) => $.ui.datePicker.weekNumberLabel, { ns: "ui" }),
|
|
585
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
586
|
-
className: "block py-2 text-[0.8rem] font-normal text-muted-foreground",
|
|
587
|
-
children: t(($) => $.ui.datePicker.weekNumberHeading, { ns: "ui" })
|
|
588
|
-
})
|
|
589
|
-
}), weekDays.map((day) => /* @__PURE__ */ jsx("th", {
|
|
590
|
-
className: "font-normal",
|
|
591
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
592
|
-
className: "block py-2 text-[0.8rem] font-normal text-muted-foreground",
|
|
593
|
-
children: day.substring(0, 2)
|
|
594
|
-
})
|
|
595
|
-
}, day))] })
|
|
596
|
-
}), /* @__PURE__ */ jsx("tbody", { children: WEEK_INDICES.map((weekIndex) => {
|
|
597
|
-
const dates = state.getDatesInWeek(weekIndex, startDate);
|
|
598
|
-
const firstDate = dates.find((date) => date !== null);
|
|
599
|
-
const week = firstDate ? getISOWeekNumber(firstDate) : null;
|
|
600
|
-
return /* @__PURE__ */ jsxs("tr", { children: [showWeekNumbers && /* @__PURE__ */ jsx("th", {
|
|
601
|
-
scope: "row",
|
|
602
|
-
className: "w-8 border-r border-border font-normal",
|
|
603
|
-
"aria-label": week === null ? void 0 : t(($) => $.ui.datePicker.weekNumber, {
|
|
604
|
-
ns: "ui",
|
|
605
|
-
week
|
|
606
|
-
}),
|
|
607
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
608
|
-
size: "small",
|
|
609
|
-
className: "text-muted-foreground tabular-nums",
|
|
610
|
-
children: week
|
|
611
|
-
})
|
|
612
|
-
}), dates.map((date, i) => date ? /* @__PURE__ */ jsx(CalendarCell, {
|
|
613
|
-
state,
|
|
614
|
-
date,
|
|
615
|
-
onApply,
|
|
616
|
-
onDoubleClickApply,
|
|
617
|
-
shouldApplyOnDateSelection,
|
|
618
|
-
shouldCloseOnSelect,
|
|
619
|
-
onDateSelection: handleDateSelection,
|
|
620
|
-
onDateHover,
|
|
621
|
-
rangeSelection,
|
|
622
|
-
hoverDate,
|
|
623
|
-
onKeyboardNavigation
|
|
624
|
-
}, i) : /* @__PURE__ */ jsx("td", {}, i))] }, weekIndex);
|
|
625
|
-
}) })]
|
|
626
|
-
})
|
|
627
|
-
});
|
|
628
|
-
};
|
|
629
|
-
//#endregion
|
|
630
386
|
//#region src/components/inputs/DateTime/shared/DateField.tsx
|
|
631
387
|
const omitNullValue = ({ value: _value, ...props }) => props;
|
|
632
388
|
const DateField = ({ ref, onClearChange, hidePlaceholder, isDisabled, disableManualEntry, dateGranularity = "day", isTimeOptional = false, format, timeZone, segmentGroup, shouldAutoFixYear = false, preserveNullValue = false, ...props }) => {
|
|
633
|
-
const { locale } = useLocale
|
|
389
|
+
const { locale } = useLocale();
|
|
634
390
|
const previousValueRef = useRef(props.value);
|
|
635
391
|
const dateFieldProps = props.value == null && !preserveNullValue ? omitNullValue(props) : props;
|
|
636
392
|
const state = $8e7461aabf74661f$export$60e84778edff6d26({
|
|
@@ -998,4 +754,4 @@ const DatePickerInput = ({ ref, as, groupProps, fieldProps, endFieldProps, field
|
|
|
998
754
|
});
|
|
999
755
|
};
|
|
1000
756
|
//#endregion
|
|
1001
|
-
export { $
|
|
757
|
+
export { $dd602d3c757202f2$export$4f5203c0d889109e as a, $dd602d3c757202f2$export$f4a51ff076cc9a09 as c, $ea0ea6e62ae0d7ca$export$6d095e787d2b5e1f as i, renderDatePickerTodayIcon as n, $dd602d3c757202f2$export$a1d3911297b952d7 as o, $f11fb0bcf1b2687a$export$61c6a8c84e605fb6 as r, $dd602d3c757202f2$export$eac50920cf2fd59a as s, DatePickerInput as t };
|