@povio/ui 2.3.0-rc.3 → 2.3.0-rc.31
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/assets/icons/AlignCenter.js +26 -11
- package/dist/assets/icons/AlignLeft.js +26 -11
- package/dist/assets/icons/AlignLeftRight.js +26 -11
- package/dist/assets/icons/AlignRight.js +26 -11
- package/dist/assets/icons/ArrowDropDown.js +26 -11
- package/dist/assets/icons/ArrowDropUp.js +26 -11
- package/dist/assets/icons/ArrowLeft.js +26 -11
- package/dist/assets/icons/ArrowRight.js +26 -11
- package/dist/assets/icons/Bold.js +26 -11
- package/dist/assets/icons/BulletedList.js +26 -11
- package/dist/assets/icons/Calendar.js +28 -13
- package/dist/assets/icons/Check.js +28 -13
- package/dist/assets/icons/CheckCircle.js +26 -11
- package/dist/assets/icons/CheckboxCheckmark.js +29 -14
- package/dist/assets/icons/CheckboxIndeterminate.js +29 -14
- package/dist/assets/icons/ChevronDown.js +28 -13
- package/dist/assets/icons/ChevronLeft.js +28 -13
- package/dist/assets/icons/ChevronRight.js +28 -13
- package/dist/assets/icons/ChevronUp.js +28 -13
- package/dist/assets/icons/ChevronsLeft.js +28 -13
- package/dist/assets/icons/ChevronsRight.js +28 -13
- package/dist/assets/icons/Clock.js +26 -11
- package/dist/assets/icons/Close.js +26 -11
- package/dist/assets/icons/DateTime.js +35 -14
- package/dist/assets/icons/DragIndicator.js +26 -11
- package/dist/assets/icons/File.js +28 -13
- package/dist/assets/icons/Highlight.js +26 -11
- package/dist/assets/icons/HighlightOn.js +49 -15
- package/dist/assets/icons/Home.js +26 -11
- package/dist/assets/icons/Info.js +37 -16
- package/dist/assets/icons/Italic.js +26 -11
- package/dist/assets/icons/Link.js +26 -11
- package/dist/assets/icons/Menu.js +26 -11
- package/dist/assets/icons/NumberedList.js +26 -11
- package/dist/assets/icons/PointerHorizontal.js +26 -11
- package/dist/assets/icons/PointerVertical.js +26 -11
- package/dist/assets/icons/Search.js +26 -11
- package/dist/assets/icons/Send.js +28 -13
- package/dist/assets/icons/Strikethrough.js +26 -11
- package/dist/assets/icons/TextColor.js +48 -14
- package/dist/assets/icons/Today.js +26 -11
- package/dist/assets/icons/Underlined.js +28 -13
- package/dist/assets/icons/Upload.js +35 -14
- package/dist/assets/icons/Visibility.js +26 -11
- package/dist/assets/icons/VisibilityOff.js +26 -11
- package/dist/assets/icons/WarningFilled.js +28 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.js +207 -56
- package/dist/components/Menu/Menu.js +18 -2
- package/dist/components/Menu/MenuDesktop.js +41 -7
- package/dist/components/Menu/MenuItem.js +32 -9
- package/dist/components/Menu/MenuMobile.js +97 -38
- package/dist/components/Menu/MenuPopover.js +105 -29
- package/dist/components/buttons/IconButton/IconButton.js +40 -8
- package/dist/components/buttons/InlineIconButton/InlineIconButton.js +34 -9
- package/dist/components/buttons/PillButton/PillButton.js +55 -17
- package/dist/components/buttons/SplitButton/SplitButton.js +103 -18
- package/dist/components/buttons/TextButton/TextButton.js +30 -8
- package/dist/components/buttons/ToggleButton/ToggleButton.js +28 -8
- package/dist/components/buttons/shared/ButtonContent.js +80 -22
- package/dist/components/inputs/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/inputs/Checkbox/Checkbox.js +188 -34
- package/dist/components/inputs/Checkbox/CheckboxCheckmark.js +24 -10
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DatePicker/DatePicker.js +267 -87
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +347 -182
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +177 -69
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +530 -157
- package/dist/components/inputs/DateTime/shared/Calendar.js +333 -137
- package/dist/components/inputs/DateTime/shared/CalendarCell.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarCell.js +301 -102
- package/dist/components/inputs/DateTime/shared/CalendarGrid.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/CalendarGrid.js +146 -33
- package/dist/components/inputs/DateTime/shared/CalendarHeader.js +245 -90
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +295 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +6 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +375 -146
- package/dist/components/inputs/DateTime/shared/DateSegmentItem.js +94 -21
- package/dist/components/inputs/DateTime/shared/DateTimeDialog.js +81 -27
- package/dist/components/inputs/DateTime/shared/DateTimeDialogFooter.js +59 -10
- package/dist/components/inputs/DateTime/shared/MonthPicker.js +103 -58
- package/dist/components/inputs/DateTime/shared/RangeCalendar.js +193 -82
- package/dist/components/inputs/DateTime/shared/TimeField.js +27 -8
- package/dist/components/inputs/DateTime/shared/TimePickerForm.js +279 -110
- package/dist/components/inputs/DateTime/shared/TimePickerInput.d.ts +3 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +208 -70
- package/dist/components/inputs/DateTime/shared/YearPicker.js +119 -68
- package/dist/components/inputs/File/FileUpload.js +86 -44
- package/dist/components/inputs/File/FileUploadContainer.js +15 -7
- package/dist/components/inputs/File/InputUpload.js +317 -79
- package/dist/components/inputs/File/shared/FileCard.js +104 -41
- package/dist/components/inputs/File/shared/FileCardList.js +47 -12
- package/dist/components/inputs/File/shared/FileUploadContent.js +175 -44
- package/dist/components/inputs/File/shared/FileUploadContentEmpty.js +149 -46
- package/dist/components/inputs/File/shared/FileUploadContentError.js +234 -93
- package/dist/components/inputs/File/shared/FileUploadContentFilled.js +230 -97
- package/dist/components/inputs/File/shared/FileUploadContentLoading.js +199 -55
- package/dist/components/inputs/File/shared/InputUploadContent.js +148 -35
- package/dist/components/inputs/File/shared/InputUploadFilled.js +49 -8
- package/dist/components/inputs/File/shared/ProgressBar.js +48 -9
- package/dist/components/inputs/FormField/FormField.js +119 -37
- package/dist/components/inputs/FormField/FormFieldError.js +25 -5
- package/dist/components/inputs/FormField/FormFieldHeader.js +79 -22
- package/dist/components/inputs/FormField/FormFieldHeaderClose.js +31 -7
- package/dist/components/inputs/FormField/FormFieldHelper.js +26 -6
- package/dist/components/inputs/FormField/FormFieldLabel.js +40 -9
- package/dist/components/inputs/Input/NumberInput/NumberInput.js +392 -123
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeField.js +541 -116
- package/dist/components/inputs/Input/NumberRangeInput/NumberRangeInput.js +463 -146
- package/dist/components/inputs/Input/PasswordInput/PasswordInput.js +48 -9
- package/dist/components/inputs/Input/TextArea/TextArea.js +298 -89
- package/dist/components/inputs/Input/TextInput/TextInput.js +370 -121
- package/dist/components/inputs/Input/shared/InputContent.js +190 -58
- package/dist/components/inputs/Inputs/Form.js +40 -11
- package/dist/components/inputs/Inputs/InputItem.d.ts +0 -1
- package/dist/components/inputs/Inputs/InputItem.js +65 -16
- package/dist/components/inputs/Inputs/Inputs.js +37 -11
- package/dist/components/inputs/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/components/inputs/RadioGroup/RadioGroup.js +333 -107
- package/dist/components/inputs/Selection/Autocomplete/Autocomplete.js +145 -50
- package/dist/components/inputs/Selection/Autocomplete/QueryAutocomplete.js +3 -2
- package/dist/components/inputs/Selection/Select/QuerySelect.js +107 -27
- package/dist/components/inputs/Selection/Select/Select.js +139 -44
- package/dist/components/inputs/Selection/shared/SelectBase.js +69 -20
- package/dist/components/inputs/Selection/shared/SelectDesktop.js +390 -143
- package/dist/components/inputs/Selection/shared/SelectInput.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/SelectInput.js +326 -136
- package/dist/components/inputs/Selection/shared/SelectInputTags.js +99 -25
- package/dist/components/inputs/Selection/shared/SelectListBox.js +163 -51
- package/dist/components/inputs/Selection/shared/SelectListBoxItem.js +85 -35
- package/dist/components/inputs/Selection/shared/SelectListBoxItemSelectAll.js +69 -16
- package/dist/components/inputs/Selection/shared/SelectListBoxLoadingItem.js +70 -21
- package/dist/components/inputs/Selection/shared/SelectListBoxSelectionBar.js +58 -9
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.d.ts +9 -0
- package/dist/components/inputs/Selection/shared/StaticSelectTrailingContent.js +47 -0
- package/dist/components/inputs/Selection/shared/select.context.d.ts +2 -2
- package/dist/components/inputs/Selection/shared/select.context.js +44 -38
- package/dist/components/inputs/Selection/shared/selectInput.cva.d.ts +5 -0
- package/dist/components/inputs/Selection/shared/selectInput.cva.js +5 -0
- package/dist/components/inputs/Selection/shared/useSelectItems.js +109 -49
- package/dist/components/inputs/Skeleton/InputFrame.d.ts +2 -0
- package/dist/components/inputs/Skeleton/InputFrame.js +444 -124
- package/dist/components/inputs/Slider/Slider.js +247 -74
- package/dist/components/inputs/TextEditor/TextEditor.js +447 -103
- package/dist/components/inputs/TextEditor/Toolbar/ColorPicker.js +37 -11
- package/dist/components/inputs/TextEditor/Toolbar/ColorPickerDropdown.js +102 -30
- package/dist/components/inputs/TextEditor/Toolbar/HyperlinkAction.js +194 -45
- package/dist/components/inputs/TextEditor/Toolbar/TextAlignSelect.js +88 -28
- package/dist/components/inputs/TextEditor/Toolbar/TextColorSelect.js +48 -14
- package/dist/components/inputs/TextEditor/Toolbar/TextEditorToolbar.js +66 -19
- package/dist/components/inputs/TextEditor/Toolbar/TextHighlightSelect.js +49 -15
- package/dist/components/inputs/TextEditor/Toolbar/TextListActions.js +92 -32
- package/dist/components/inputs/TextEditor/Toolbar/TextMarksActions.js +126 -54
- package/dist/components/inputs/TextEditor/Toolbar/TextStyleSelect.js +141 -38
- package/dist/components/inputs/Toggle/Toggle.d.ts +1 -0
- package/dist/components/inputs/Toggle/Toggle.js +206 -41
- package/dist/components/inputs/shared/CheckContent.js +21 -10
- package/dist/components/inputs/shared/InputClear.js +78 -21
- package/dist/components/inputs/shared/TooltipWrapper.js +47 -12
- package/dist/components/inputs/shared/input.cva.js +13 -3
- package/dist/components/inputs/shared/useStaticInputHandoff.d.ts +1 -0
- package/dist/components/inputs/shared/useStaticInputHandoff.js +87 -34
- package/dist/components/navigation/Accordion/Accordion.js +69 -22
- package/dist/components/navigation/Accordion/AccordionItem.js +86 -41
- package/dist/components/navigation/Stepper/Stepper.js +67 -22
- package/dist/components/navigation/Stepper/StepperItem.js +104 -31
- package/dist/components/navigation/Stepper/StepperSeparator.js +23 -5
- package/dist/components/overlays/ActionModal/ActionModal.js +169 -35
- package/dist/components/overlays/BottomSheet/BottomSheet.js +96 -23
- package/dist/components/overlays/BottomSheet/BottomSheetHeader.js +48 -8
- package/dist/components/overlays/Drawer/Drawer.js +62 -20
- package/dist/components/overlays/ResponsivePopover/ResponsivePopover.js +83 -27
- package/dist/components/overlays/Tooltip/Tooltip.js +137 -28
- package/dist/components/overlays/Tooltip/TooltipEllipsis.js +37 -12
- package/dist/components/segment/Segment.js +218 -57
- package/dist/components/segment/SegmentItem.js +67 -10
- package/dist/components/shared/pagination/Pagination.js +108 -22
- package/dist/components/shared/pagination/PaginationList.js +167 -64
- package/dist/components/status/Alert/Alert.js +97 -30
- package/dist/components/status/Loader/Loader.js +77 -22
- package/dist/components/status/Toast/Toast.js +21 -13
- package/dist/components/status/Toast/useToast.js +62 -57
- package/dist/components/table/ColumnConfig.js +158 -54
- package/dist/components/table/InfiniteTable.js +67 -16
- package/dist/components/table/PaginatedTable.js +84 -18
- package/dist/components/table/Table.js +28 -27
- package/dist/components/text/Link/Link.js +19 -7
- package/dist/components/text/Typography/Typography.js +23 -8
- package/dist/config/confirmation.context.js +1 -1
- package/dist/config/link.context.js +23 -9
- package/dist/config/router.context.js +42 -16
- package/dist/config/theme.context.js +98 -45
- package/dist/config/uiConfig.context.d.ts +4 -4
- package/dist/config/uiConfig.context.js +50 -11
- package/dist/config/uiStyle.context.js +15 -5
- package/dist/helpers/dynamicInputs.d.ts +1 -1
- package/dist/hooks/useBreakpoint.js +16 -3
- package/dist/hooks/useDebounceCallback.js +51 -17
- package/dist/hooks/useFilters.js +125 -64
- package/dist/hooks/useForm.js +42 -8
- package/dist/hooks/useFormAutosave.js +101 -30
- package/dist/hooks/useIntersectionObserver.js +86 -32
- package/dist/hooks/useLocalStorage.js +43 -10
- package/dist/hooks/useLongPressRepeat.js +55 -20
- package/dist/hooks/usePagination.js +49 -19
- package/dist/hooks/useQueryAutocomplete.js +1 -0
- package/dist/hooks/useScrollableListBox.js +37 -16
- package/dist/hooks/useSorting.js +69 -28
- package/dist/hooks/useStateAndRef.js +21 -7
- package/dist/hooks/useTableColumnConfig.js +124 -31
- package/dist/hooks/useTranslationMemo.js +25 -5
- package/dist/index.js +2 -2
- package/dist/utils/date-time.utils.d.ts +2 -0
- package/dist/utils/date-time.utils.js +17 -13
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { InputFrame } from "../../Skeleton/InputFrame.js";
|
|
|
15
15
|
import { useStaticInputHandoff } from "../../shared/useStaticInputHandoff.js";
|
|
16
16
|
import { useDebounceCallback } from "../../../../hooks/useDebounceCallback.js";
|
|
17
17
|
import { RangeCalendar } from "../shared/RangeCalendar.js";
|
|
18
|
+
import { c } from "react/compiler-runtime";
|
|
18
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
20
|
import { clsx } from "clsx";
|
|
20
21
|
import { useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
@@ -22,15 +23,16 @@ import { Button } from "react-aria-components";
|
|
|
22
23
|
import { useDateRangePicker, useLocale as useLocale$1 } from "react-aria";
|
|
23
24
|
import { mergeRefs } from "@react-aria/utils";
|
|
24
25
|
import { useTranslation } from "react-i18next";
|
|
25
|
-
import { Controller
|
|
26
|
-
import { createCalendar, endOfMonth, endOfWeek, endOfYear,
|
|
26
|
+
import { Controller } from "react-hook-form";
|
|
27
|
+
import { createCalendar, endOfMonth, endOfWeek, endOfYear, startOfMonth, startOfWeek, startOfYear, toCalendarDate, today } from "@internationalized/date";
|
|
27
28
|
import { DateTime } from "luxon";
|
|
28
29
|
import { useDateRangePickerState, useRangeCalendarState } from "react-stately";
|
|
29
30
|
//#region src/components/inputs/DateTime/DateRangePicker/DateRangePicker.tsx
|
|
31
|
+
var DATE_PICKER_TIME_ZONE = "UTC";
|
|
30
32
|
var DateRangePickerBase = (props) => {
|
|
31
33
|
const ui = UIConfig.useConfig();
|
|
32
34
|
const { t } = useTranslation();
|
|
33
|
-
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, ...rest } = props;
|
|
35
|
+
const { ref, label, tooltipText, helperText, isRequired, rightContent, isDisabled, isDirty, headerClassName, errorClassName, isHeaderHidden, error, onChange, onBlur, value, disableDropdown, className, hideSidebar, placeholder, inputClassName, hideLabel: hideLabelProp, variant: variantProp, as: asProp, size: sizeProp, isClearable: isClearableProp, todayIcon: todayIconProp, todayIconButtonSize: todayIconButtonSizeProp, todayIconPlacement: todayIconPlacementProp, shouldForceLeadingZeros: shouldForceLeadingZerosProp, disableManualEntry: disableManualEntryProp, autoFixYear: autoFixYearProp, fireBlurOnChange: fireBlurOnChangeProp, ...rest } = props;
|
|
34
36
|
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
35
37
|
const variant = variantProp ?? ui.input.variant;
|
|
36
38
|
const as = asProp ?? ui.input.as;
|
|
@@ -42,26 +44,28 @@ var DateRangePickerBase = (props) => {
|
|
|
42
44
|
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
43
45
|
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
44
46
|
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
47
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
45
48
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
46
49
|
const datePickerInputRef = useRef(null);
|
|
47
50
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
48
51
|
return datePickerInputRef.current?.getContainer?.() || null;
|
|
49
52
|
} }), []);
|
|
53
|
+
const normalizedValue = value ?? null;
|
|
50
54
|
const dialogState = useDateRangePickerState({
|
|
51
55
|
...rest,
|
|
52
|
-
value,
|
|
56
|
+
value: normalizedValue,
|
|
53
57
|
shouldCloseOnSelect: false,
|
|
54
58
|
shouldForceLeadingZeros
|
|
55
59
|
});
|
|
56
60
|
const state = useDateRangePickerState({
|
|
57
61
|
...rest,
|
|
58
62
|
shouldForceLeadingZeros,
|
|
59
|
-
value,
|
|
63
|
+
value: normalizedValue,
|
|
60
64
|
onChange: (newValue) => {
|
|
61
65
|
if (isValidRange(newValue)) return;
|
|
62
66
|
onChange?.(newValue);
|
|
63
67
|
handleCalendarStatesChange(newValue);
|
|
64
|
-
debouncedBlur(newValue);
|
|
68
|
+
if (fireBlurOnChange) debouncedBlur(newValue);
|
|
65
69
|
},
|
|
66
70
|
shouldCloseOnSelect: false
|
|
67
71
|
});
|
|
@@ -76,11 +80,14 @@ var DateRangePickerBase = (props) => {
|
|
|
76
80
|
shouldForceLeadingZeros
|
|
77
81
|
}, dialogState, dateRangePickerRef);
|
|
78
82
|
const { locale } = useLocale$1();
|
|
79
|
-
useImperativeHandle(ref, () => ({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
useImperativeHandle(ref, () => ({
|
|
84
|
+
clear: () => {
|
|
85
|
+
datePickerInputRef.current?.clear();
|
|
86
|
+
},
|
|
87
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
88
|
+
}));
|
|
89
|
+
const handleBlur = (newValue_0) => {
|
|
90
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
84
91
|
};
|
|
85
92
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
86
93
|
const formFieldProps = {
|
|
@@ -111,7 +118,7 @@ var DateRangePickerBase = (props) => {
|
|
|
111
118
|
createCalendar,
|
|
112
119
|
pageBehavior: "single",
|
|
113
120
|
visibleDuration: { months: 1 },
|
|
114
|
-
defaultFocusedValue: today(
|
|
121
|
+
defaultFocusedValue: today(DATE_PICKER_TIME_ZONE).add({ months: 1 }),
|
|
115
122
|
minValue: void 0,
|
|
116
123
|
maxValue: void 0
|
|
117
124
|
});
|
|
@@ -133,10 +140,10 @@ var DateRangePickerBase = (props) => {
|
|
|
133
140
|
className: headerClassName,
|
|
134
141
|
labelProps
|
|
135
142
|
};
|
|
136
|
-
const isValidRange = useCallback((
|
|
137
|
-
if (
|
|
138
|
-
const startDate =
|
|
139
|
-
if (
|
|
143
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
144
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
145
|
+
const startDate = newValue_1.start;
|
|
146
|
+
if (newValue_1.end.compare(startDate) < 0) {
|
|
140
147
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
141
148
|
return true;
|
|
142
149
|
}
|
|
@@ -144,20 +151,20 @@ var DateRangePickerBase = (props) => {
|
|
|
144
151
|
} else setValidationRangeError(void 0);
|
|
145
152
|
return false;
|
|
146
153
|
}, [t]);
|
|
147
|
-
const handleCalendarStatesChange = (
|
|
148
|
-
if (
|
|
149
|
-
if (isValidRange(
|
|
150
|
-
dialogState.setValue(
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
leftCalendarState.setFocusedDate(
|
|
154
|
-
if (
|
|
155
|
-
else rightCalendarState.setFocusedDate(
|
|
156
|
-
leftCalendarState.setValue(
|
|
157
|
-
rightCalendarState.setValue(
|
|
154
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
155
|
+
if (newValue_2) {
|
|
156
|
+
if (isValidRange(newValue_2)) return;
|
|
157
|
+
dialogState.setValue(newValue_2);
|
|
158
|
+
const startDate_0 = newValue_2.start;
|
|
159
|
+
const endDate_0 = newValue_2.end;
|
|
160
|
+
leftCalendarState.setFocusedDate(startDate_0);
|
|
161
|
+
if (startDate_0.year === endDate_0.year && startDate_0.month === endDate_0.month) rightCalendarState.setFocusedDate(startDate_0.add({ months: 1 }));
|
|
162
|
+
else rightCalendarState.setFocusedDate(endDate_0);
|
|
163
|
+
leftCalendarState.setValue(newValue_2);
|
|
164
|
+
rightCalendarState.setValue(newValue_2);
|
|
158
165
|
setRangeSelection({
|
|
159
|
-
start:
|
|
160
|
-
end:
|
|
166
|
+
start: newValue_2.start,
|
|
167
|
+
end: newValue_2.end,
|
|
161
168
|
isSelecting: false
|
|
162
169
|
});
|
|
163
170
|
setHoverDate(null);
|
|
@@ -181,27 +188,27 @@ var DateRangePickerBase = (props) => {
|
|
|
181
188
|
setHoverDate(date);
|
|
182
189
|
});
|
|
183
190
|
}, []);
|
|
184
|
-
const handleDateHover = useCallback((
|
|
185
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
191
|
+
const handleDateHover = useCallback((date_0) => {
|
|
192
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
|
|
186
193
|
}, [
|
|
187
194
|
rangeSelection.isSelecting,
|
|
188
195
|
rangeSelection.start,
|
|
189
196
|
throttledSetHoverDate
|
|
190
197
|
]);
|
|
191
|
-
const handleDateSelection = useCallback((
|
|
198
|
+
const handleDateSelection = useCallback((date_1, calendarSide) => {
|
|
192
199
|
if (calendarSide) {
|
|
193
200
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
194
|
-
if (
|
|
195
|
-
leftCalendarState.setFocusedDate(
|
|
196
|
-
rightCalendarState.setFocusedDate(
|
|
201
|
+
if (date_1.month !== currentVisibleMonth.month || date_1.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
202
|
+
leftCalendarState.setFocusedDate(date_1);
|
|
203
|
+
rightCalendarState.setFocusedDate(date_1.add({ months: 1 }));
|
|
197
204
|
} else {
|
|
198
|
-
rightCalendarState.setFocusedDate(
|
|
199
|
-
leftCalendarState.setFocusedDate(
|
|
205
|
+
rightCalendarState.setFocusedDate(date_1);
|
|
206
|
+
leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
209
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
203
210
|
setRangeSelection({
|
|
204
|
-
start:
|
|
211
|
+
start: date_1,
|
|
205
212
|
end: null,
|
|
206
213
|
isSelecting: true
|
|
207
214
|
});
|
|
@@ -210,7 +217,7 @@ var DateRangePickerBase = (props) => {
|
|
|
210
217
|
rightCalendarState.setValue(null);
|
|
211
218
|
} else {
|
|
212
219
|
const { start } = rangeSelection;
|
|
213
|
-
const end =
|
|
220
|
+
const end = date_1;
|
|
214
221
|
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
215
222
|
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
216
223
|
const newRange = {
|
|
@@ -234,16 +241,16 @@ var DateRangePickerBase = (props) => {
|
|
|
234
241
|
rightCalendarState,
|
|
235
242
|
dialogState
|
|
236
243
|
]);
|
|
237
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
238
|
-
const
|
|
239
|
-
const otherState =
|
|
244
|
+
const handleKeyboardNavigation = useCallback((event, date_2, calendarSide_0) => {
|
|
245
|
+
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
246
|
+
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
240
247
|
let shouldPreventDefault = false;
|
|
241
248
|
switch (event.key) {
|
|
242
249
|
case "ArrowRight": {
|
|
243
|
-
const nextDate =
|
|
244
|
-
const
|
|
245
|
-
const
|
|
246
|
-
if (
|
|
250
|
+
const nextDate = date_2.add({ days: 1 });
|
|
251
|
+
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
252
|
+
const otherMonth_2 = otherState.visibleRange.start;
|
|
253
|
+
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
247
254
|
otherState.setFocusedDate(nextDate);
|
|
248
255
|
shouldPreventDefault = true;
|
|
249
256
|
} else {
|
|
@@ -253,10 +260,10 @@ var DateRangePickerBase = (props) => {
|
|
|
253
260
|
break;
|
|
254
261
|
}
|
|
255
262
|
case "ArrowLeft": {
|
|
256
|
-
const prevDate =
|
|
257
|
-
const
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
263
|
+
const prevDate = date_2.subtract({ days: 1 });
|
|
264
|
+
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
265
|
+
const otherMonth_1 = otherState.visibleRange.start;
|
|
266
|
+
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
260
267
|
otherState.setFocusedDate(prevDate);
|
|
261
268
|
shouldPreventDefault = true;
|
|
262
269
|
} else {
|
|
@@ -266,10 +273,10 @@ var DateRangePickerBase = (props) => {
|
|
|
266
273
|
break;
|
|
267
274
|
}
|
|
268
275
|
case "ArrowDown": {
|
|
269
|
-
const nextWeekDate =
|
|
270
|
-
const
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
276
|
+
const nextWeekDate = date_2.add({ weeks: 1 });
|
|
277
|
+
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
278
|
+
const otherMonth_0 = otherState.visibleRange.start;
|
|
279
|
+
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
273
280
|
otherState.setFocusedDate(nextWeekDate);
|
|
274
281
|
shouldPreventDefault = true;
|
|
275
282
|
} else {
|
|
@@ -279,10 +286,10 @@ var DateRangePickerBase = (props) => {
|
|
|
279
286
|
break;
|
|
280
287
|
}
|
|
281
288
|
case "ArrowUp": {
|
|
282
|
-
const prevWeekDate =
|
|
283
|
-
const currentMonth =
|
|
289
|
+
const prevWeekDate = date_2.subtract({ weeks: 1 });
|
|
290
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
284
291
|
const otherMonth = otherState.visibleRange.start;
|
|
285
|
-
if (
|
|
292
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
286
293
|
otherState.setFocusedDate(prevWeekDate);
|
|
287
294
|
shouldPreventDefault = true;
|
|
288
295
|
} else {
|
|
@@ -293,7 +300,7 @@ var DateRangePickerBase = (props) => {
|
|
|
293
300
|
}
|
|
294
301
|
case "Enter":
|
|
295
302
|
case " ":
|
|
296
|
-
handleDateSelection(
|
|
303
|
+
handleDateSelection(date_2);
|
|
297
304
|
shouldPreventDefault = true;
|
|
298
305
|
break;
|
|
299
306
|
case "Escape":
|
|
@@ -317,14 +324,14 @@ var DateRangePickerBase = (props) => {
|
|
|
317
324
|
rightCalendarState,
|
|
318
325
|
handleDateSelection
|
|
319
326
|
]);
|
|
320
|
-
const syncCalendarStates = useCallback((
|
|
321
|
-
if (isValidRange(
|
|
322
|
-
leftCalendarState.setValue(
|
|
323
|
-
rightCalendarState.setValue(
|
|
324
|
-
dialogState.setValue(
|
|
325
|
-
if (
|
|
326
|
-
start:
|
|
327
|
-
end:
|
|
327
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
328
|
+
if (isValidRange(newValue_3)) return;
|
|
329
|
+
leftCalendarState.setValue(newValue_3);
|
|
330
|
+
rightCalendarState.setValue(newValue_3);
|
|
331
|
+
dialogState.setValue(newValue_3);
|
|
332
|
+
if (newValue_3) setRangeSelection({
|
|
333
|
+
start: newValue_3.start,
|
|
334
|
+
end: newValue_3.end,
|
|
328
335
|
isSelecting: false
|
|
329
336
|
});
|
|
330
337
|
else setRangeSelection({
|
|
@@ -346,12 +353,12 @@ var DateRangePickerBase = (props) => {
|
|
|
346
353
|
} : dialogState.value;
|
|
347
354
|
if (valueToApply) {
|
|
348
355
|
state.setValue(valueToApply);
|
|
349
|
-
handleBlur(valueToApply);
|
|
356
|
+
if (fireBlurOnChange) handleBlur(valueToApply);
|
|
350
357
|
}
|
|
351
358
|
state.toggle();
|
|
352
359
|
};
|
|
353
360
|
const onTodayPress = () => {
|
|
354
|
-
const todayDate = today(
|
|
361
|
+
const todayDate = today(DATE_PICKER_TIME_ZONE);
|
|
355
362
|
leftCalendarState.setFocusedDate(todayDate);
|
|
356
363
|
rightCalendarState.setFocusedDate(todayDate.add({ months: 1 }));
|
|
357
364
|
syncCalendarStates({
|
|
@@ -359,6 +366,12 @@ var DateRangePickerBase = (props) => {
|
|
|
359
366
|
end: todayDate
|
|
360
367
|
});
|
|
361
368
|
};
|
|
369
|
+
const onInputClear = () => {
|
|
370
|
+
onChange?.(null);
|
|
371
|
+
state.setValue(null);
|
|
372
|
+
handleCalendarStatesChange(null);
|
|
373
|
+
if (fireBlurOnChange) handleBlur(null);
|
|
374
|
+
};
|
|
362
375
|
const onOpenChange = (isOpen) => {
|
|
363
376
|
state.toggle();
|
|
364
377
|
if (!isOpen) {
|
|
@@ -366,11 +379,11 @@ var DateRangePickerBase = (props) => {
|
|
|
366
379
|
dialogState.setValue(state.value);
|
|
367
380
|
leftCalendarState.setValue(state.value);
|
|
368
381
|
rightCalendarState.setValue(state.value);
|
|
369
|
-
const
|
|
370
|
-
const
|
|
371
|
-
leftCalendarState.setFocusedDate(
|
|
372
|
-
if (
|
|
373
|
-
else rightCalendarState.setFocusedDate(
|
|
382
|
+
const startDate_1 = state.value.start || today(DATE_PICKER_TIME_ZONE);
|
|
383
|
+
const endDate_1 = state.value.end || today(DATE_PICKER_TIME_ZONE).add({ months: 1 });
|
|
384
|
+
leftCalendarState.setFocusedDate(startDate_1);
|
|
385
|
+
if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
|
|
386
|
+
else rightCalendarState.setFocusedDate(endDate_1);
|
|
374
387
|
setRangeSelection({
|
|
375
388
|
start: state.value.start,
|
|
376
389
|
end: state.value.end,
|
|
@@ -379,87 +392,87 @@ var DateRangePickerBase = (props) => {
|
|
|
379
392
|
}
|
|
380
393
|
}
|
|
381
394
|
};
|
|
382
|
-
const
|
|
395
|
+
const todayDate_0 = today(DATE_PICKER_TIME_ZONE);
|
|
383
396
|
const getThisWeekRange = () => {
|
|
384
397
|
return {
|
|
385
|
-
start: startOfWeek(
|
|
386
|
-
end: endOfWeek(
|
|
398
|
+
start: startOfWeek(todayDate_0, locale),
|
|
399
|
+
end: endOfWeek(todayDate_0, locale)
|
|
387
400
|
};
|
|
388
401
|
};
|
|
389
402
|
const getLastWeekRange = () => {
|
|
390
|
-
const thisWeekStart = startOfWeek(
|
|
403
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
391
404
|
return {
|
|
392
405
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
393
406
|
end: thisWeekStart.subtract({ days: 1 })
|
|
394
407
|
};
|
|
395
408
|
};
|
|
396
409
|
const getThisAndLastWeekRange = () => {
|
|
397
|
-
const thisWeekEnd = endOfWeek(
|
|
410
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
398
411
|
return {
|
|
399
|
-
start: startOfWeek(
|
|
412
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
400
413
|
end: thisWeekEnd
|
|
401
414
|
};
|
|
402
415
|
};
|
|
403
416
|
const getThisMonthRange = () => {
|
|
404
417
|
return {
|
|
405
|
-
start: startOfMonth(
|
|
406
|
-
end: endOfMonth(
|
|
418
|
+
start: startOfMonth(todayDate_0),
|
|
419
|
+
end: endOfMonth(todayDate_0)
|
|
407
420
|
};
|
|
408
421
|
};
|
|
409
422
|
const getThisAndLastMonthRange = () => {
|
|
410
|
-
const thisMonthEnd = endOfMonth(
|
|
423
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
411
424
|
return {
|
|
412
|
-
start: startOfMonth(
|
|
425
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
413
426
|
end: thisMonthEnd
|
|
414
427
|
};
|
|
415
428
|
};
|
|
416
429
|
const presets = [
|
|
417
430
|
{
|
|
418
|
-
label: t(($) =>
|
|
431
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
419
432
|
getValue: getThisWeekRange
|
|
420
433
|
},
|
|
421
434
|
{
|
|
422
|
-
label: t(($) =>
|
|
435
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
423
436
|
getValue: getLastWeekRange
|
|
424
437
|
},
|
|
425
438
|
{
|
|
426
|
-
label: t(($) =>
|
|
439
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
427
440
|
getValue: getThisAndLastWeekRange
|
|
428
441
|
},
|
|
429
442
|
{
|
|
430
|
-
label: t(($) =>
|
|
443
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
431
444
|
getValue: getThisMonthRange
|
|
432
445
|
},
|
|
433
446
|
{
|
|
434
|
-
label: t(($) =>
|
|
447
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
435
448
|
getValue: getThisAndLastMonthRange
|
|
436
449
|
},
|
|
437
450
|
{
|
|
438
|
-
label: t(($) =>
|
|
451
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
439
452
|
getValue: () => ({
|
|
440
|
-
start: startOfYear(
|
|
441
|
-
end:
|
|
453
|
+
start: startOfYear(todayDate_0),
|
|
454
|
+
end: todayDate_0
|
|
442
455
|
})
|
|
443
456
|
},
|
|
444
457
|
{
|
|
445
|
-
label: t(($) =>
|
|
458
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
446
459
|
getValue: () => ({
|
|
447
|
-
start: startOfYear(
|
|
448
|
-
end: endOfYear(
|
|
460
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
461
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
449
462
|
})
|
|
450
463
|
},
|
|
451
464
|
{
|
|
452
|
-
label: t(($) =>
|
|
465
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
453
466
|
getValue: () => ({
|
|
454
|
-
start: startOfYear(
|
|
455
|
-
end:
|
|
467
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
468
|
+
end: todayDate_0
|
|
456
469
|
})
|
|
457
470
|
},
|
|
458
471
|
{
|
|
459
|
-
label: t(($) =>
|
|
472
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
460
473
|
getValue: () => ({
|
|
461
|
-
start: startOfYear(
|
|
462
|
-
end:
|
|
474
|
+
start: startOfYear(todayDate_0),
|
|
475
|
+
end: todayDate_0
|
|
463
476
|
})
|
|
464
477
|
}
|
|
465
478
|
];
|
|
@@ -467,12 +480,12 @@ var DateRangePickerBase = (props) => {
|
|
|
467
480
|
setActivePreset(preset.label);
|
|
468
481
|
const presetValue = preset.getValue();
|
|
469
482
|
syncCalendarStates(presetValue);
|
|
470
|
-
const
|
|
471
|
-
leftCalendarState.setFocusedDate(
|
|
472
|
-
const
|
|
473
|
-
if ((
|
|
483
|
+
const startDate_2 = presetValue.start;
|
|
484
|
+
leftCalendarState.setFocusedDate(startDate_2);
|
|
485
|
+
const endDate_2 = presetValue.end;
|
|
486
|
+
if ((endDate_2.year - startDate_2.year) * 12 + (endDate_2.month - startDate_2.month) > 2) rightCalendarState.setFocusedDate(endDate_2);
|
|
474
487
|
else {
|
|
475
|
-
const rightCalendarMonth =
|
|
488
|
+
const rightCalendarMonth = startDate_2.add({ months: 1 });
|
|
476
489
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
477
490
|
}
|
|
478
491
|
};
|
|
@@ -492,6 +505,9 @@ var DateRangePickerBase = (props) => {
|
|
|
492
505
|
groupProps,
|
|
493
506
|
fieldProps: startFieldProps,
|
|
494
507
|
endFieldProps,
|
|
508
|
+
fieldValue: normalizedValue?.start ?? null,
|
|
509
|
+
endFieldValue: normalizedValue?.end ?? null,
|
|
510
|
+
hasValue: normalizedValue?.start != null || normalizedValue?.end != null,
|
|
495
511
|
buttonProps,
|
|
496
512
|
isDisabled,
|
|
497
513
|
isInvalid: !!error,
|
|
@@ -508,22 +524,25 @@ var DateRangePickerBase = (props) => {
|
|
|
508
524
|
autoFixYear,
|
|
509
525
|
placeholder,
|
|
510
526
|
className: inputClassName,
|
|
511
|
-
onOpenDropdown: () => state.toggle()
|
|
527
|
+
onOpenDropdown: () => state.toggle(),
|
|
528
|
+
timeZone: DATE_PICKER_TIME_ZONE,
|
|
529
|
+
fireBlurOnChange,
|
|
530
|
+
onClear: onInputClear
|
|
512
531
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
513
532
|
hideSidebar,
|
|
514
533
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
515
534
|
className: "flex w-full flex-row overflow-auto border-elevation-outline-default-1 border-solid [-ms-overflow-style:none] [scrollbar-width:none] md:w-[156px] md:flex-col md:border-r [&::-webkit-scrollbar]:hidden",
|
|
516
|
-
children: presets.map((
|
|
517
|
-
onClick: () => selectPreset(
|
|
518
|
-
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !==
|
|
535
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
536
|
+
onClick: () => selectPreset(preset_0),
|
|
537
|
+
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !== preset_0.label && "text-interactive-text-secondary-idle hover:text-interactive-text-secondary-hover", activePreset === preset_0.label && "bg-interactive-contained-primary-idle text-interactive-text-secondary-idle-inverted"),
|
|
519
538
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
520
539
|
size: "label-2",
|
|
521
540
|
sizeMobile: "label-3",
|
|
522
541
|
as: "span",
|
|
523
542
|
className: "whitespace-nowrap",
|
|
524
|
-
children:
|
|
543
|
+
children: preset_0.label
|
|
525
544
|
})
|
|
526
|
-
},
|
|
545
|
+
}, preset_0.label))
|
|
527
546
|
}),
|
|
528
547
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
529
548
|
isDisabled,
|
|
@@ -558,7 +577,10 @@ var DateRangePickerBase = (props) => {
|
|
|
558
577
|
})
|
|
559
578
|
});
|
|
560
579
|
};
|
|
561
|
-
var
|
|
580
|
+
var DateRangePickerInner = (t0) => {
|
|
581
|
+
const $ = c(25);
|
|
582
|
+
const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
583
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
562
584
|
const ui = UIConfig.useConfig();
|
|
563
585
|
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
564
586
|
const { locale } = useLocale$1();
|
|
@@ -569,59 +591,90 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
569
591
|
inputRef,
|
|
570
592
|
renderInput,
|
|
571
593
|
setRenderInput,
|
|
572
|
-
getFocusTarget:
|
|
573
|
-
return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
|
|
574
|
-
}
|
|
594
|
+
getFocusTarget: _temp
|
|
575
595
|
});
|
|
576
|
-
const
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
596
|
+
const normalizedValue = props.value ?? null;
|
|
597
|
+
let t2;
|
|
598
|
+
if ($[0] !== fullIso) {
|
|
599
|
+
t2 = (range) => {
|
|
600
|
+
if (!range?.start || !range?.end) return null;
|
|
601
|
+
if (fullIso) return {
|
|
602
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
603
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
604
|
+
};
|
|
605
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
606
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
607
|
+
return {
|
|
608
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
609
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
610
|
+
};
|
|
588
611
|
};
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
612
|
+
$[0] = fullIso;
|
|
613
|
+
$[1] = t2;
|
|
614
|
+
} else t2 = $[1];
|
|
615
|
+
const formatDateRange = t2;
|
|
616
|
+
let t3;
|
|
617
|
+
if ($[2] !== fullIso) {
|
|
618
|
+
t3 = (formattedRange) => {
|
|
619
|
+
if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
|
|
620
|
+
if (fullIso) return {
|
|
621
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
622
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
623
|
+
};
|
|
624
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
625
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
626
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
627
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
628
|
+
return {
|
|
629
|
+
start: toCalendarDate(startZonedDateTime),
|
|
630
|
+
end: toCalendarDate(endZonedDateTime)
|
|
631
|
+
};
|
|
594
632
|
};
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
633
|
+
$[2] = fullIso;
|
|
634
|
+
$[3] = t3;
|
|
635
|
+
} else t3 = $[3];
|
|
636
|
+
const parseDateRange = t3;
|
|
637
|
+
let t4;
|
|
638
|
+
if ($[4] !== fullIso) {
|
|
639
|
+
t4 = (formattedDate) => {
|
|
640
|
+
if (formattedDate == null) return formattedDate;
|
|
641
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
642
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
643
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
601
644
|
};
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
645
|
+
$[4] = fullIso;
|
|
646
|
+
$[5] = t4;
|
|
647
|
+
} else t4 = $[5];
|
|
648
|
+
const parseCalendarDate = t4;
|
|
649
|
+
let t5;
|
|
650
|
+
if ($[6] !== minValue || $[7] !== parseCalendarDate) {
|
|
651
|
+
t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
652
|
+
$[6] = minValue;
|
|
653
|
+
$[7] = parseCalendarDate;
|
|
654
|
+
$[8] = t5;
|
|
655
|
+
} else t5 = $[8];
|
|
656
|
+
let t6;
|
|
657
|
+
if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
|
|
658
|
+
t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
659
|
+
$[9] = maxValue;
|
|
660
|
+
$[10] = parseCalendarDate;
|
|
661
|
+
$[11] = t6;
|
|
662
|
+
} else t6 = $[11];
|
|
663
|
+
let t7;
|
|
664
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
665
|
+
t7 = {
|
|
666
|
+
minValue: t5,
|
|
667
|
+
maxValue: t6
|
|
609
668
|
};
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
616
|
-
};
|
|
617
|
-
const dateLimits = {
|
|
618
|
-
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
619
|
-
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
620
|
-
};
|
|
669
|
+
$[12] = t5;
|
|
670
|
+
$[13] = t6;
|
|
671
|
+
$[14] = t7;
|
|
672
|
+
} else t7 = $[14];
|
|
673
|
+
const dateLimits = t7;
|
|
621
674
|
if (!renderInput) {
|
|
622
|
-
const startDateValue = parseCalendarDate(
|
|
623
|
-
const endDateValue = parseCalendarDate(
|
|
624
|
-
const hasProvidedRangeValue = !!(
|
|
675
|
+
const startDateValue = parseCalendarDate(normalizedValue?.start ?? null);
|
|
676
|
+
const endDateValue = parseCalendarDate(normalizedValue?.end ?? null);
|
|
677
|
+
const hasProvidedRangeValue = !!(normalizedValue?.start || normalizedValue?.end);
|
|
625
678
|
const as = props.as ?? ui.input.as;
|
|
626
679
|
const size = props.size ?? ui.input.size;
|
|
627
680
|
const isDisabled = isFormControlDisabled || !!props.isDisabled;
|
|
@@ -661,36 +714,148 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
661
714
|
onStaticInteract: renderRealInput,
|
|
662
715
|
actionContent: staticTodayIcon,
|
|
663
716
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
717
|
+
wrapContentAndTrailing: true,
|
|
718
|
+
contentAndTrailingClassName: "gap-2!",
|
|
664
719
|
trailingClassName: "py-0! pl-0!",
|
|
665
720
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
666
721
|
children: staticSegments
|
|
667
722
|
});
|
|
668
723
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
724
|
+
const T0 = DateRangePickerBase;
|
|
725
|
+
const t8 = mergeRefs(props.ref, inputRef);
|
|
726
|
+
const t9 = parseDateRange(normalizedValue);
|
|
727
|
+
let t10;
|
|
728
|
+
if ($[15] !== formatDateRange || $[16] !== props) {
|
|
729
|
+
t10 = (value) => props.onChange?.(formatDateRange(value));
|
|
730
|
+
$[15] = formatDateRange;
|
|
731
|
+
$[16] = props;
|
|
732
|
+
$[17] = t10;
|
|
733
|
+
} else t10 = $[17];
|
|
734
|
+
let t11;
|
|
735
|
+
if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
|
|
736
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
737
|
+
...props,
|
|
738
|
+
...dateLimits,
|
|
739
|
+
ref: t8,
|
|
740
|
+
value: t9,
|
|
741
|
+
onChange: t10
|
|
685
742
|
});
|
|
743
|
+
$[18] = T0;
|
|
744
|
+
$[19] = dateLimits;
|
|
745
|
+
$[20] = props;
|
|
746
|
+
$[21] = t10;
|
|
747
|
+
$[22] = t8;
|
|
748
|
+
$[23] = t9;
|
|
749
|
+
$[24] = t11;
|
|
750
|
+
} else t11 = $[24];
|
|
751
|
+
return t11;
|
|
752
|
+
};
|
|
753
|
+
var DateRangePicker = (t0) => {
|
|
754
|
+
const $ = c(30);
|
|
755
|
+
let maxValue;
|
|
756
|
+
let minValue;
|
|
757
|
+
let props;
|
|
758
|
+
let renderStaticInput;
|
|
759
|
+
let t1;
|
|
760
|
+
if ($[0] !== t0) {
|
|
761
|
+
({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
|
|
762
|
+
$[0] = t0;
|
|
763
|
+
$[1] = maxValue;
|
|
764
|
+
$[2] = minValue;
|
|
765
|
+
$[3] = props;
|
|
766
|
+
$[4] = renderStaticInput;
|
|
767
|
+
$[5] = t1;
|
|
768
|
+
} else {
|
|
769
|
+
maxValue = $[1];
|
|
770
|
+
minValue = $[2];
|
|
771
|
+
props = $[3];
|
|
772
|
+
renderStaticInput = $[4];
|
|
773
|
+
t1 = $[5];
|
|
686
774
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
775
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
776
|
+
if ("formControl" in props && props.formControl) {
|
|
777
|
+
let formControl;
|
|
778
|
+
let innerProps;
|
|
779
|
+
let ref;
|
|
780
|
+
if ($[6] !== props) {
|
|
781
|
+
({formControl, ref, ...innerProps} = props);
|
|
782
|
+
$[6] = props;
|
|
783
|
+
$[7] = formControl;
|
|
784
|
+
$[8] = innerProps;
|
|
785
|
+
$[9] = ref;
|
|
786
|
+
} else {
|
|
787
|
+
formControl = $[7];
|
|
788
|
+
innerProps = $[8];
|
|
789
|
+
ref = $[9];
|
|
790
|
+
}
|
|
791
|
+
const controlWithOptions = formControl.control;
|
|
792
|
+
let t2;
|
|
793
|
+
if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
|
|
794
|
+
t2 = (t3) => {
|
|
795
|
+
const { field, fieldState: t4 } = t3;
|
|
796
|
+
const { error, isDirty } = t4;
|
|
797
|
+
return /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
798
|
+
...innerProps,
|
|
799
|
+
ref: mergeRefs(ref, field.ref),
|
|
800
|
+
value: field.value,
|
|
801
|
+
onChange: field.onChange,
|
|
802
|
+
onBlur: field.onBlur,
|
|
803
|
+
isDirty,
|
|
804
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
805
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
806
|
+
error: props.error ?? error?.message,
|
|
807
|
+
fullIso,
|
|
808
|
+
minValue,
|
|
809
|
+
maxValue,
|
|
810
|
+
renderStaticInput
|
|
811
|
+
});
|
|
812
|
+
};
|
|
813
|
+
$[10] = controlWithOptions._options?.disabled;
|
|
814
|
+
$[11] = fullIso;
|
|
815
|
+
$[12] = innerProps;
|
|
816
|
+
$[13] = maxValue;
|
|
817
|
+
$[14] = minValue;
|
|
818
|
+
$[15] = props.error;
|
|
819
|
+
$[16] = props.isDisabled;
|
|
820
|
+
$[17] = ref;
|
|
821
|
+
$[18] = renderStaticInput;
|
|
822
|
+
$[19] = t2;
|
|
823
|
+
} else t2 = $[19];
|
|
824
|
+
let t3;
|
|
825
|
+
if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
|
|
826
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
827
|
+
control: formControl.control,
|
|
828
|
+
name: formControl.name,
|
|
829
|
+
render: t2
|
|
830
|
+
});
|
|
831
|
+
$[20] = formControl.control;
|
|
832
|
+
$[21] = formControl.name;
|
|
833
|
+
$[22] = t2;
|
|
834
|
+
$[23] = t3;
|
|
835
|
+
} else t3 = $[23];
|
|
836
|
+
return t3;
|
|
837
|
+
}
|
|
838
|
+
let t2;
|
|
839
|
+
if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
|
|
840
|
+
t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
841
|
+
...props,
|
|
842
|
+
fullIso,
|
|
843
|
+
minValue,
|
|
844
|
+
maxValue,
|
|
845
|
+
renderStaticInput
|
|
846
|
+
});
|
|
847
|
+
$[24] = fullIso;
|
|
848
|
+
$[25] = maxValue;
|
|
849
|
+
$[26] = minValue;
|
|
850
|
+
$[27] = props;
|
|
851
|
+
$[28] = renderStaticInput;
|
|
852
|
+
$[29] = t2;
|
|
853
|
+
} else t2 = $[29];
|
|
854
|
+
return t2;
|
|
694
855
|
};
|
|
856
|
+
function _temp(input) {
|
|
857
|
+
const container = input.getContainer?.() ?? input;
|
|
858
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
859
|
+
}
|
|
695
860
|
//#endregion
|
|
696
861
|
export { DateRangePicker };
|