@povio/ui 2.3.0-rc.2 → 2.3.0-rc.21
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 +190 -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 +258 -76
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateRangePicker/DateRangePicker.js +342 -177
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/DateTimePicker/DateTimePicker.js +173 -63
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.d.ts +1 -0
- package/dist/components/inputs/DateTime/TimePicker/TimePicker.js +522 -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 +249 -93
- package/dist/components/inputs/DateTime/shared/CalendarSelectHeader.js +318 -137
- package/dist/components/inputs/DateTime/shared/DateField.js +296 -112
- package/dist/components/inputs/DateTime/shared/DatePickerInput.d.ts +2 -1
- package/dist/components/inputs/DateTime/shared/DatePickerInput.js +352 -145
- 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 +2 -1
- package/dist/components/inputs/DateTime/shared/TimePickerInput.js +206 -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 -122
- 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 +303 -90
- package/dist/components/inputs/Input/TextInput/TextInput.js +376 -122
- 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 +140 -45
- 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 +442 -116
- package/dist/components/inputs/Slider/Slider.js +250 -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 -40
- 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,28 @@ 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
|
|
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;
|
|
36
|
+
const hideLabel = hideLabelProp ?? ui.input.hideLabel;
|
|
37
|
+
const variant = variantProp ?? ui.input.variant;
|
|
38
|
+
const as = asProp ?? ui.input.as;
|
|
39
|
+
const size = sizeProp ?? ui.input.size;
|
|
40
|
+
const isClearable = isClearableProp ?? ui.input.isClearable;
|
|
41
|
+
const todayIcon = todayIconProp ?? ui.dateInput.todayIcon;
|
|
42
|
+
const todayIconButtonSize = todayIconButtonSizeProp ?? ui.dateInput.todayIconButtonSize;
|
|
43
|
+
const todayIconPlacement = todayIconPlacementProp ?? ui.dateInput.todayIconPlacement;
|
|
44
|
+
const shouldForceLeadingZeros = shouldForceLeadingZerosProp ?? ui.dateInput.shouldForceLeadingZeros;
|
|
45
|
+
const disableManualEntry = disableManualEntryProp ?? ui.dateInput.disableManualEntry;
|
|
46
|
+
const autoFixYear = autoFixYearProp ?? ui.dateInput.autoFixYear;
|
|
47
|
+
const fireBlurOnChange = fireBlurOnChangeProp ?? ui.dateInput.fireBlurOnChange;
|
|
34
48
|
const [validationRangeError, setValidationRangeError] = useState();
|
|
35
49
|
const datePickerInputRef = useRef(null);
|
|
36
50
|
const dateRangePickerRef = useMemo(() => ({ get current() {
|
|
@@ -50,7 +64,7 @@ var DateRangePickerBase = (props) => {
|
|
|
50
64
|
if (isValidRange(newValue)) return;
|
|
51
65
|
onChange?.(newValue);
|
|
52
66
|
handleCalendarStatesChange(newValue);
|
|
53
|
-
debouncedBlur(newValue);
|
|
67
|
+
if (fireBlurOnChange) debouncedBlur(newValue);
|
|
54
68
|
},
|
|
55
69
|
shouldCloseOnSelect: false
|
|
56
70
|
});
|
|
@@ -65,11 +79,14 @@ var DateRangePickerBase = (props) => {
|
|
|
65
79
|
shouldForceLeadingZeros
|
|
66
80
|
}, dialogState, dateRangePickerRef);
|
|
67
81
|
const { locale } = useLocale$1();
|
|
68
|
-
useImperativeHandle(ref, () => ({
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
useImperativeHandle(ref, () => ({
|
|
83
|
+
clear: () => {
|
|
84
|
+
datePickerInputRef.current?.clear();
|
|
85
|
+
},
|
|
86
|
+
getContainer: () => datePickerInputRef.current?.getContainer?.() ?? null
|
|
87
|
+
}));
|
|
88
|
+
const handleBlur = (newValue_0) => {
|
|
89
|
+
onBlur?.({ target: { value: newValue_0 } });
|
|
73
90
|
};
|
|
74
91
|
const { callback: debouncedBlur } = useDebounceCallback(handleBlur, { delay: 500 });
|
|
75
92
|
const formFieldProps = {
|
|
@@ -100,7 +117,7 @@ var DateRangePickerBase = (props) => {
|
|
|
100
117
|
createCalendar,
|
|
101
118
|
pageBehavior: "single",
|
|
102
119
|
visibleDuration: { months: 1 },
|
|
103
|
-
defaultFocusedValue: today(
|
|
120
|
+
defaultFocusedValue: today(DATE_PICKER_TIME_ZONE).add({ months: 1 }),
|
|
104
121
|
minValue: void 0,
|
|
105
122
|
maxValue: void 0
|
|
106
123
|
});
|
|
@@ -122,10 +139,10 @@ var DateRangePickerBase = (props) => {
|
|
|
122
139
|
className: headerClassName,
|
|
123
140
|
labelProps
|
|
124
141
|
};
|
|
125
|
-
const isValidRange = useCallback((
|
|
126
|
-
if (
|
|
127
|
-
const startDate =
|
|
128
|
-
if (
|
|
142
|
+
const isValidRange = useCallback((newValue_1) => {
|
|
143
|
+
if (newValue_1?.start && newValue_1?.end) {
|
|
144
|
+
const startDate = newValue_1.start;
|
|
145
|
+
if (newValue_1.end.compare(startDate) < 0) {
|
|
129
146
|
setValidationRangeError(t(($) => $.ui.datePicker.errors.endDateBeforeStart, { ns: "ui" }));
|
|
130
147
|
return true;
|
|
131
148
|
}
|
|
@@ -133,20 +150,20 @@ var DateRangePickerBase = (props) => {
|
|
|
133
150
|
} else setValidationRangeError(void 0);
|
|
134
151
|
return false;
|
|
135
152
|
}, [t]);
|
|
136
|
-
const handleCalendarStatesChange = (
|
|
137
|
-
if (
|
|
138
|
-
if (isValidRange(
|
|
139
|
-
dialogState.setValue(
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
leftCalendarState.setFocusedDate(
|
|
143
|
-
if (
|
|
144
|
-
else rightCalendarState.setFocusedDate(
|
|
145
|
-
leftCalendarState.setValue(
|
|
146
|
-
rightCalendarState.setValue(
|
|
153
|
+
const handleCalendarStatesChange = (newValue_2) => {
|
|
154
|
+
if (newValue_2) {
|
|
155
|
+
if (isValidRange(newValue_2)) return;
|
|
156
|
+
dialogState.setValue(newValue_2);
|
|
157
|
+
const startDate_0 = newValue_2.start;
|
|
158
|
+
const endDate_0 = newValue_2.end;
|
|
159
|
+
leftCalendarState.setFocusedDate(startDate_0);
|
|
160
|
+
if (startDate_0.year === endDate_0.year && startDate_0.month === endDate_0.month) rightCalendarState.setFocusedDate(startDate_0.add({ months: 1 }));
|
|
161
|
+
else rightCalendarState.setFocusedDate(endDate_0);
|
|
162
|
+
leftCalendarState.setValue(newValue_2);
|
|
163
|
+
rightCalendarState.setValue(newValue_2);
|
|
147
164
|
setRangeSelection({
|
|
148
|
-
start:
|
|
149
|
-
end:
|
|
165
|
+
start: newValue_2.start,
|
|
166
|
+
end: newValue_2.end,
|
|
150
167
|
isSelecting: false
|
|
151
168
|
});
|
|
152
169
|
setHoverDate(null);
|
|
@@ -170,27 +187,27 @@ var DateRangePickerBase = (props) => {
|
|
|
170
187
|
setHoverDate(date);
|
|
171
188
|
});
|
|
172
189
|
}, []);
|
|
173
|
-
const handleDateHover = useCallback((
|
|
174
|
-
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(
|
|
190
|
+
const handleDateHover = useCallback((date_0) => {
|
|
191
|
+
if (rangeSelection.isSelecting && rangeSelection.start) throttledSetHoverDate(date_0);
|
|
175
192
|
}, [
|
|
176
193
|
rangeSelection.isSelecting,
|
|
177
194
|
rangeSelection.start,
|
|
178
195
|
throttledSetHoverDate
|
|
179
196
|
]);
|
|
180
|
-
const handleDateSelection = useCallback((
|
|
197
|
+
const handleDateSelection = useCallback((date_1, calendarSide) => {
|
|
181
198
|
if (calendarSide) {
|
|
182
199
|
const currentVisibleMonth = (calendarSide === "left" ? leftCalendarState : rightCalendarState).visibleRange.start;
|
|
183
|
-
if (
|
|
184
|
-
leftCalendarState.setFocusedDate(
|
|
185
|
-
rightCalendarState.setFocusedDate(
|
|
200
|
+
if (date_1.month !== currentVisibleMonth.month || date_1.year !== currentVisibleMonth.year) if (calendarSide === "left") {
|
|
201
|
+
leftCalendarState.setFocusedDate(date_1);
|
|
202
|
+
rightCalendarState.setFocusedDate(date_1.add({ months: 1 }));
|
|
186
203
|
} else {
|
|
187
|
-
rightCalendarState.setFocusedDate(
|
|
188
|
-
leftCalendarState.setFocusedDate(
|
|
204
|
+
rightCalendarState.setFocusedDate(date_1);
|
|
205
|
+
leftCalendarState.setFocusedDate(date_1.subtract({ months: 1 }));
|
|
189
206
|
}
|
|
190
207
|
}
|
|
191
208
|
if (!rangeSelection.isSelecting || !rangeSelection.start) {
|
|
192
209
|
setRangeSelection({
|
|
193
|
-
start:
|
|
210
|
+
start: date_1,
|
|
194
211
|
end: null,
|
|
195
212
|
isSelecting: true
|
|
196
213
|
});
|
|
@@ -199,7 +216,7 @@ var DateRangePickerBase = (props) => {
|
|
|
199
216
|
rightCalendarState.setValue(null);
|
|
200
217
|
} else {
|
|
201
218
|
const { start } = rangeSelection;
|
|
202
|
-
const end =
|
|
219
|
+
const end = date_1;
|
|
203
220
|
const finalStart = start.compare(end) <= 0 ? start : end;
|
|
204
221
|
const finalEnd = start.compare(end) <= 0 ? end : start;
|
|
205
222
|
const newRange = {
|
|
@@ -223,16 +240,16 @@ var DateRangePickerBase = (props) => {
|
|
|
223
240
|
rightCalendarState,
|
|
224
241
|
dialogState
|
|
225
242
|
]);
|
|
226
|
-
const handleKeyboardNavigation = useCallback((event,
|
|
227
|
-
const
|
|
228
|
-
const otherState =
|
|
243
|
+
const handleKeyboardNavigation = useCallback((event, date_2, calendarSide_0) => {
|
|
244
|
+
const currentState_0 = calendarSide_0 === "left" ? leftCalendarState : rightCalendarState;
|
|
245
|
+
const otherState = calendarSide_0 === "left" ? rightCalendarState : leftCalendarState;
|
|
229
246
|
let shouldPreventDefault = false;
|
|
230
247
|
switch (event.key) {
|
|
231
248
|
case "ArrowRight": {
|
|
232
|
-
const nextDate =
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
249
|
+
const nextDate = date_2.add({ days: 1 });
|
|
250
|
+
const currentMonth_2 = currentState_0.visibleRange.start;
|
|
251
|
+
const otherMonth_2 = otherState.visibleRange.start;
|
|
252
|
+
if (calendarSide_0 === "left" && nextDate.month !== currentMonth_2.month) if (nextDate.year === otherMonth_2.year && nextDate.month === otherMonth_2.month) {
|
|
236
253
|
otherState.setFocusedDate(nextDate);
|
|
237
254
|
shouldPreventDefault = true;
|
|
238
255
|
} else {
|
|
@@ -242,10 +259,10 @@ var DateRangePickerBase = (props) => {
|
|
|
242
259
|
break;
|
|
243
260
|
}
|
|
244
261
|
case "ArrowLeft": {
|
|
245
|
-
const prevDate =
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
262
|
+
const prevDate = date_2.subtract({ days: 1 });
|
|
263
|
+
const currentMonth_1 = currentState_0.visibleRange.start;
|
|
264
|
+
const otherMonth_1 = otherState.visibleRange.start;
|
|
265
|
+
if (calendarSide_0 === "right" && prevDate.month !== currentMonth_1.month) if (prevDate.year === otherMonth_1.year && prevDate.month === otherMonth_1.month) {
|
|
249
266
|
otherState.setFocusedDate(prevDate);
|
|
250
267
|
shouldPreventDefault = true;
|
|
251
268
|
} else {
|
|
@@ -255,10 +272,10 @@ var DateRangePickerBase = (props) => {
|
|
|
255
272
|
break;
|
|
256
273
|
}
|
|
257
274
|
case "ArrowDown": {
|
|
258
|
-
const nextWeekDate =
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
275
|
+
const nextWeekDate = date_2.add({ weeks: 1 });
|
|
276
|
+
const currentMonth_0 = currentState_0.visibleRange.start;
|
|
277
|
+
const otherMonth_0 = otherState.visibleRange.start;
|
|
278
|
+
if (calendarSide_0 === "left" && nextWeekDate.month !== currentMonth_0.month) if (nextWeekDate.year === otherMonth_0.year && nextWeekDate.month === otherMonth_0.month) {
|
|
262
279
|
otherState.setFocusedDate(nextWeekDate);
|
|
263
280
|
shouldPreventDefault = true;
|
|
264
281
|
} else {
|
|
@@ -268,10 +285,10 @@ var DateRangePickerBase = (props) => {
|
|
|
268
285
|
break;
|
|
269
286
|
}
|
|
270
287
|
case "ArrowUp": {
|
|
271
|
-
const prevWeekDate =
|
|
272
|
-
const currentMonth =
|
|
288
|
+
const prevWeekDate = date_2.subtract({ weeks: 1 });
|
|
289
|
+
const currentMonth = currentState_0.visibleRange.start;
|
|
273
290
|
const otherMonth = otherState.visibleRange.start;
|
|
274
|
-
if (
|
|
291
|
+
if (calendarSide_0 === "right" && prevWeekDate.month !== currentMonth.month) if (prevWeekDate.year === otherMonth.year && prevWeekDate.month === otherMonth.month) {
|
|
275
292
|
otherState.setFocusedDate(prevWeekDate);
|
|
276
293
|
shouldPreventDefault = true;
|
|
277
294
|
} else {
|
|
@@ -282,7 +299,7 @@ var DateRangePickerBase = (props) => {
|
|
|
282
299
|
}
|
|
283
300
|
case "Enter":
|
|
284
301
|
case " ":
|
|
285
|
-
handleDateSelection(
|
|
302
|
+
handleDateSelection(date_2);
|
|
286
303
|
shouldPreventDefault = true;
|
|
287
304
|
break;
|
|
288
305
|
case "Escape":
|
|
@@ -306,14 +323,14 @@ var DateRangePickerBase = (props) => {
|
|
|
306
323
|
rightCalendarState,
|
|
307
324
|
handleDateSelection
|
|
308
325
|
]);
|
|
309
|
-
const syncCalendarStates = useCallback((
|
|
310
|
-
if (isValidRange(
|
|
311
|
-
leftCalendarState.setValue(
|
|
312
|
-
rightCalendarState.setValue(
|
|
313
|
-
dialogState.setValue(
|
|
314
|
-
if (
|
|
315
|
-
start:
|
|
316
|
-
end:
|
|
326
|
+
const syncCalendarStates = useCallback((newValue_3) => {
|
|
327
|
+
if (isValidRange(newValue_3)) return;
|
|
328
|
+
leftCalendarState.setValue(newValue_3);
|
|
329
|
+
rightCalendarState.setValue(newValue_3);
|
|
330
|
+
dialogState.setValue(newValue_3);
|
|
331
|
+
if (newValue_3) setRangeSelection({
|
|
332
|
+
start: newValue_3.start,
|
|
333
|
+
end: newValue_3.end,
|
|
317
334
|
isSelecting: false
|
|
318
335
|
});
|
|
319
336
|
else setRangeSelection({
|
|
@@ -335,12 +352,12 @@ var DateRangePickerBase = (props) => {
|
|
|
335
352
|
} : dialogState.value;
|
|
336
353
|
if (valueToApply) {
|
|
337
354
|
state.setValue(valueToApply);
|
|
338
|
-
handleBlur(valueToApply);
|
|
355
|
+
if (fireBlurOnChange) handleBlur(valueToApply);
|
|
339
356
|
}
|
|
340
357
|
state.toggle();
|
|
341
358
|
};
|
|
342
359
|
const onTodayPress = () => {
|
|
343
|
-
const todayDate = today(
|
|
360
|
+
const todayDate = today(DATE_PICKER_TIME_ZONE);
|
|
344
361
|
leftCalendarState.setFocusedDate(todayDate);
|
|
345
362
|
rightCalendarState.setFocusedDate(todayDate.add({ months: 1 }));
|
|
346
363
|
syncCalendarStates({
|
|
@@ -355,11 +372,11 @@ var DateRangePickerBase = (props) => {
|
|
|
355
372
|
dialogState.setValue(state.value);
|
|
356
373
|
leftCalendarState.setValue(state.value);
|
|
357
374
|
rightCalendarState.setValue(state.value);
|
|
358
|
-
const
|
|
359
|
-
const
|
|
360
|
-
leftCalendarState.setFocusedDate(
|
|
361
|
-
if (
|
|
362
|
-
else rightCalendarState.setFocusedDate(
|
|
375
|
+
const startDate_1 = state.value.start || today(DATE_PICKER_TIME_ZONE);
|
|
376
|
+
const endDate_1 = state.value.end || today(DATE_PICKER_TIME_ZONE).add({ months: 1 });
|
|
377
|
+
leftCalendarState.setFocusedDate(startDate_1);
|
|
378
|
+
if (startDate_1.year === endDate_1.year && startDate_1.month === endDate_1.month) rightCalendarState.setFocusedDate(startDate_1.add({ months: 1 }));
|
|
379
|
+
else rightCalendarState.setFocusedDate(endDate_1);
|
|
363
380
|
setRangeSelection({
|
|
364
381
|
start: state.value.start,
|
|
365
382
|
end: state.value.end,
|
|
@@ -368,87 +385,87 @@ var DateRangePickerBase = (props) => {
|
|
|
368
385
|
}
|
|
369
386
|
}
|
|
370
387
|
};
|
|
371
|
-
const
|
|
388
|
+
const todayDate_0 = today(DATE_PICKER_TIME_ZONE);
|
|
372
389
|
const getThisWeekRange = () => {
|
|
373
390
|
return {
|
|
374
|
-
start: startOfWeek(
|
|
375
|
-
end: endOfWeek(
|
|
391
|
+
start: startOfWeek(todayDate_0, locale),
|
|
392
|
+
end: endOfWeek(todayDate_0, locale)
|
|
376
393
|
};
|
|
377
394
|
};
|
|
378
395
|
const getLastWeekRange = () => {
|
|
379
|
-
const thisWeekStart = startOfWeek(
|
|
396
|
+
const thisWeekStart = startOfWeek(todayDate_0, locale);
|
|
380
397
|
return {
|
|
381
398
|
start: thisWeekStart.subtract({ weeks: 1 }),
|
|
382
399
|
end: thisWeekStart.subtract({ days: 1 })
|
|
383
400
|
};
|
|
384
401
|
};
|
|
385
402
|
const getThisAndLastWeekRange = () => {
|
|
386
|
-
const thisWeekEnd = endOfWeek(
|
|
403
|
+
const thisWeekEnd = endOfWeek(todayDate_0, locale);
|
|
387
404
|
return {
|
|
388
|
-
start: startOfWeek(
|
|
405
|
+
start: startOfWeek(todayDate_0, locale).subtract({ weeks: 1 }),
|
|
389
406
|
end: thisWeekEnd
|
|
390
407
|
};
|
|
391
408
|
};
|
|
392
409
|
const getThisMonthRange = () => {
|
|
393
410
|
return {
|
|
394
|
-
start: startOfMonth(
|
|
395
|
-
end: endOfMonth(
|
|
411
|
+
start: startOfMonth(todayDate_0),
|
|
412
|
+
end: endOfMonth(todayDate_0)
|
|
396
413
|
};
|
|
397
414
|
};
|
|
398
415
|
const getThisAndLastMonthRange = () => {
|
|
399
|
-
const thisMonthEnd = endOfMonth(
|
|
416
|
+
const thisMonthEnd = endOfMonth(todayDate_0);
|
|
400
417
|
return {
|
|
401
|
-
start: startOfMonth(
|
|
418
|
+
start: startOfMonth(todayDate_0).subtract({ months: 1 }),
|
|
402
419
|
end: thisMonthEnd
|
|
403
420
|
};
|
|
404
421
|
};
|
|
405
422
|
const presets = [
|
|
406
423
|
{
|
|
407
|
-
label: t(($) =>
|
|
424
|
+
label: t(($_0) => $_0.ui.datePicker.presets.thisWeek, { ns: "ui" }),
|
|
408
425
|
getValue: getThisWeekRange
|
|
409
426
|
},
|
|
410
427
|
{
|
|
411
|
-
label: t(($) =>
|
|
428
|
+
label: t(($_1) => $_1.ui.datePicker.presets.lastWeek, { ns: "ui" }),
|
|
412
429
|
getValue: getLastWeekRange
|
|
413
430
|
},
|
|
414
431
|
{
|
|
415
|
-
label: t(($) =>
|
|
432
|
+
label: t(($_2) => $_2.ui.datePicker.presets.thisAndLastWeek, { ns: "ui" }),
|
|
416
433
|
getValue: getThisAndLastWeekRange
|
|
417
434
|
},
|
|
418
435
|
{
|
|
419
|
-
label: t(($) =>
|
|
436
|
+
label: t(($_3) => $_3.ui.datePicker.presets.thisMonth, { ns: "ui" }),
|
|
420
437
|
getValue: getThisMonthRange
|
|
421
438
|
},
|
|
422
439
|
{
|
|
423
|
-
label: t(($) =>
|
|
440
|
+
label: t(($_4) => $_4.ui.datePicker.presets.thisAndLastMonth, { ns: "ui" }),
|
|
424
441
|
getValue: getThisAndLastMonthRange
|
|
425
442
|
},
|
|
426
443
|
{
|
|
427
|
-
label: t(($) =>
|
|
444
|
+
label: t(($_5) => $_5.ui.datePicker.presets.thisYear, { ns: "ui" }),
|
|
428
445
|
getValue: () => ({
|
|
429
|
-
start: startOfYear(
|
|
430
|
-
end:
|
|
446
|
+
start: startOfYear(todayDate_0),
|
|
447
|
+
end: todayDate_0
|
|
431
448
|
})
|
|
432
449
|
},
|
|
433
450
|
{
|
|
434
|
-
label: t(($) =>
|
|
451
|
+
label: t(($_6) => $_6.ui.datePicker.presets.lastYear, { ns: "ui" }),
|
|
435
452
|
getValue: () => ({
|
|
436
|
-
start: startOfYear(
|
|
437
|
-
end: endOfYear(
|
|
453
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
454
|
+
end: endOfYear(todayDate_0.subtract({ years: 1 }))
|
|
438
455
|
})
|
|
439
456
|
},
|
|
440
457
|
{
|
|
441
|
-
label: t(($) =>
|
|
458
|
+
label: t(($_7) => $_7.ui.datePicker.presets.thisAndLastYear, { ns: "ui" }),
|
|
442
459
|
getValue: () => ({
|
|
443
|
-
start: startOfYear(
|
|
444
|
-
end:
|
|
460
|
+
start: startOfYear(todayDate_0.subtract({ years: 1 })),
|
|
461
|
+
end: todayDate_0
|
|
445
462
|
})
|
|
446
463
|
},
|
|
447
464
|
{
|
|
448
|
-
label: t(($) =>
|
|
465
|
+
label: t(($_8) => $_8.ui.datePicker.presets.soFar, { ns: "ui" }),
|
|
449
466
|
getValue: () => ({
|
|
450
|
-
start: startOfYear(
|
|
451
|
-
end:
|
|
467
|
+
start: startOfYear(todayDate_0),
|
|
468
|
+
end: todayDate_0
|
|
452
469
|
})
|
|
453
470
|
}
|
|
454
471
|
];
|
|
@@ -456,12 +473,12 @@ var DateRangePickerBase = (props) => {
|
|
|
456
473
|
setActivePreset(preset.label);
|
|
457
474
|
const presetValue = preset.getValue();
|
|
458
475
|
syncCalendarStates(presetValue);
|
|
459
|
-
const
|
|
460
|
-
leftCalendarState.setFocusedDate(
|
|
461
|
-
const
|
|
462
|
-
if ((
|
|
476
|
+
const startDate_2 = presetValue.start;
|
|
477
|
+
leftCalendarState.setFocusedDate(startDate_2);
|
|
478
|
+
const endDate_2 = presetValue.end;
|
|
479
|
+
if ((endDate_2.year - startDate_2.year) * 12 + (endDate_2.month - startDate_2.month) > 2) rightCalendarState.setFocusedDate(endDate_2);
|
|
463
480
|
else {
|
|
464
|
-
const rightCalendarMonth =
|
|
481
|
+
const rightCalendarMonth = startDate_2.add({ months: 1 });
|
|
465
482
|
rightCalendarState.setFocusedDate(rightCalendarMonth);
|
|
466
483
|
}
|
|
467
484
|
};
|
|
@@ -497,22 +514,24 @@ var DateRangePickerBase = (props) => {
|
|
|
497
514
|
autoFixYear,
|
|
498
515
|
placeholder,
|
|
499
516
|
className: inputClassName,
|
|
500
|
-
onOpenDropdown: () => state.toggle()
|
|
517
|
+
onOpenDropdown: () => state.toggle(),
|
|
518
|
+
timeZone: DATE_PICKER_TIME_ZONE,
|
|
519
|
+
fireBlurOnChange
|
|
501
520
|
}), /* @__PURE__ */ jsx(DateTimeDialog, {
|
|
502
521
|
hideSidebar,
|
|
503
522
|
sidebar: /* @__PURE__ */ jsx("div", {
|
|
504
523
|
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",
|
|
505
|
-
children: presets.map((
|
|
506
|
-
onClick: () => selectPreset(
|
|
507
|
-
className: clsx("w-full px-2 py-1 text-left md:px-list-side-item-left md:py-list-height-item", activePreset !==
|
|
524
|
+
children: presets.map((preset_0) => /* @__PURE__ */ jsx(Button, {
|
|
525
|
+
onClick: () => selectPreset(preset_0),
|
|
526
|
+
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"),
|
|
508
527
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
509
528
|
size: "label-2",
|
|
510
529
|
sizeMobile: "label-3",
|
|
511
530
|
as: "span",
|
|
512
531
|
className: "whitespace-nowrap",
|
|
513
|
-
children:
|
|
532
|
+
children: preset_0.label
|
|
514
533
|
})
|
|
515
|
-
},
|
|
534
|
+
}, preset_0.label))
|
|
516
535
|
}),
|
|
517
536
|
footer: /* @__PURE__ */ jsx(DateTimeDialogFooter, {
|
|
518
537
|
isDisabled,
|
|
@@ -547,7 +566,10 @@ var DateRangePickerBase = (props) => {
|
|
|
547
566
|
})
|
|
548
567
|
});
|
|
549
568
|
};
|
|
550
|
-
var
|
|
569
|
+
var DateRangePickerInner = (t0) => {
|
|
570
|
+
const $ = c(25);
|
|
571
|
+
const { fullIso: t1, minValue, maxValue, renderStaticInput, isFormControlDisabled, ...props } = t0;
|
|
572
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
551
573
|
const ui = UIConfig.useConfig();
|
|
552
574
|
const datePickerInputContentRowCva = UIStyle.useCva("datePickerInput.contentRowCva", datePickerInputContentRow);
|
|
553
575
|
const { locale } = useLocale$1();
|
|
@@ -558,55 +580,86 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
558
580
|
inputRef,
|
|
559
581
|
renderInput,
|
|
560
582
|
setRenderInput,
|
|
561
|
-
getFocusTarget:
|
|
562
|
-
return (input.getContainer?.() ?? input).querySelector("input, button, [tabindex]:not([tabindex='-1'])");
|
|
563
|
-
}
|
|
583
|
+
getFocusTarget: _temp
|
|
564
584
|
});
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
585
|
+
const rawValue = props.value ?? null;
|
|
586
|
+
let t2;
|
|
587
|
+
if ($[0] !== fullIso) {
|
|
588
|
+
t2 = (range) => {
|
|
589
|
+
if (!range?.start || !range?.end) return null;
|
|
590
|
+
if (fullIso) return {
|
|
591
|
+
start: DateTimeUtils.fromCalendarDateToUTCISO(range.start),
|
|
592
|
+
end: DateTimeUtils.fromCalendarDateToUTCISO(range.end, { endOfDay: true })
|
|
593
|
+
};
|
|
594
|
+
const startDate = DateTimeUtils.fromDateValueToLocal(range.start, "UTC");
|
|
595
|
+
const endDate = DateTimeUtils.fromDateValueToLocal(range.end, "UTC");
|
|
596
|
+
return {
|
|
597
|
+
start: DateTime.fromJSDate(startDate, { zone: "UTC" }).toISODate(),
|
|
598
|
+
end: DateTime.fromJSDate(endDate, { zone: "UTC" }).toISODate()
|
|
599
|
+
};
|
|
577
600
|
};
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
601
|
+
$[0] = fullIso;
|
|
602
|
+
$[1] = t2;
|
|
603
|
+
} else t2 = $[1];
|
|
604
|
+
const formatDateRange = t2;
|
|
605
|
+
let t3;
|
|
606
|
+
if ($[2] !== fullIso) {
|
|
607
|
+
t3 = (formattedRange) => {
|
|
608
|
+
if (!formattedRange?.start || !formattedRange?.end) return formattedRange;
|
|
609
|
+
if (fullIso) return {
|
|
610
|
+
start: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.start),
|
|
611
|
+
end: DateTimeUtils.fromUTCISOToCalendarDate(formattedRange.end)
|
|
612
|
+
};
|
|
613
|
+
const startDate_0 = DateTime.fromISO(formattedRange.start, { zone: "UTC" }).toJSDate();
|
|
614
|
+
const endDate_0 = DateTime.fromISO(formattedRange.end, { zone: "UTC" }).toJSDate();
|
|
615
|
+
const startZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(startDate_0, "UTC");
|
|
616
|
+
const endZonedDateTime = DateTimeUtils.fromLocalToZonedDateTime(endDate_0, "UTC");
|
|
617
|
+
return {
|
|
618
|
+
start: toCalendarDate(startZonedDateTime),
|
|
619
|
+
end: toCalendarDate(endZonedDateTime)
|
|
620
|
+
};
|
|
583
621
|
};
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
622
|
+
$[2] = fullIso;
|
|
623
|
+
$[3] = t3;
|
|
624
|
+
} else t3 = $[3];
|
|
625
|
+
const parseDateRange = t3;
|
|
626
|
+
let t4;
|
|
627
|
+
if ($[4] !== fullIso) {
|
|
628
|
+
t4 = (formattedDate) => {
|
|
629
|
+
if (formattedDate == null) return formattedDate;
|
|
630
|
+
if (fullIso) return DateTimeUtils.fromUTCISOToCalendarDate(formattedDate);
|
|
631
|
+
const date = DateTime.fromISO(formattedDate, { zone: "UTC" }).toJSDate();
|
|
632
|
+
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date, "UTC"));
|
|
590
633
|
};
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
634
|
+
$[4] = fullIso;
|
|
635
|
+
$[5] = t4;
|
|
636
|
+
} else t4 = $[5];
|
|
637
|
+
const parseCalendarDate = t4;
|
|
638
|
+
let t5;
|
|
639
|
+
if ($[6] !== minValue || $[7] !== parseCalendarDate) {
|
|
640
|
+
t5 = typeof minValue === "string" ? parseCalendarDate(minValue) : minValue;
|
|
641
|
+
$[6] = minValue;
|
|
642
|
+
$[7] = parseCalendarDate;
|
|
643
|
+
$[8] = t5;
|
|
644
|
+
} else t5 = $[8];
|
|
645
|
+
let t6;
|
|
646
|
+
if ($[9] !== maxValue || $[10] !== parseCalendarDate) {
|
|
647
|
+
t6 = typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue;
|
|
648
|
+
$[9] = maxValue;
|
|
649
|
+
$[10] = parseCalendarDate;
|
|
650
|
+
$[11] = t6;
|
|
651
|
+
} else t6 = $[11];
|
|
652
|
+
let t7;
|
|
653
|
+
if ($[12] !== t5 || $[13] !== t6) {
|
|
654
|
+
t7 = {
|
|
655
|
+
minValue: t5,
|
|
656
|
+
maxValue: t6
|
|
598
657
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
return toCalendarDate(DateTimeUtils.fromLocalToZonedDateTime(date));
|
|
605
|
-
};
|
|
606
|
-
const dateLimits = {
|
|
607
|
-
minValue: typeof minValue === "string" ? parseCalendarDate(minValue) : minValue,
|
|
608
|
-
maxValue: typeof maxValue === "string" ? parseCalendarDate(maxValue) : maxValue
|
|
609
|
-
};
|
|
658
|
+
$[12] = t5;
|
|
659
|
+
$[13] = t6;
|
|
660
|
+
$[14] = t7;
|
|
661
|
+
} else t7 = $[14];
|
|
662
|
+
const dateLimits = t7;
|
|
610
663
|
if (!renderInput) {
|
|
611
664
|
const startDateValue = parseCalendarDate(rawValue?.start ?? null);
|
|
612
665
|
const endDateValue = parseCalendarDate(rawValue?.end ?? null);
|
|
@@ -650,36 +703,148 @@ var DateRangePicker = ({ fullIso = true, minValue, maxValue, renderStaticInput,
|
|
|
650
703
|
onStaticInteract: renderRealInput,
|
|
651
704
|
actionContent: staticTodayIcon,
|
|
652
705
|
actionContentPlacement: todayIconPlacement === "fieldLabel" ? "content-row" : "content-wrapper",
|
|
706
|
+
wrapContentAndTrailing: true,
|
|
707
|
+
contentAndTrailingClassName: "gap-2!",
|
|
653
708
|
trailingClassName: "py-0! pl-0!",
|
|
654
709
|
trailingContent: showDropdown ? ui.dateInput.calendarIcon : void 0,
|
|
655
710
|
children: staticSegments
|
|
656
711
|
});
|
|
657
712
|
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
713
|
+
const T0 = DateRangePickerBase;
|
|
714
|
+
const t8 = mergeRefs(props.ref, inputRef);
|
|
715
|
+
const t9 = parseDateRange(props.value);
|
|
716
|
+
let t10;
|
|
717
|
+
if ($[15] !== formatDateRange || $[16] !== props) {
|
|
718
|
+
t10 = (value) => props.onChange?.(formatDateRange(value));
|
|
719
|
+
$[15] = formatDateRange;
|
|
720
|
+
$[16] = props;
|
|
721
|
+
$[17] = t10;
|
|
722
|
+
} else t10 = $[17];
|
|
723
|
+
let t11;
|
|
724
|
+
if ($[18] !== T0 || $[19] !== dateLimits || $[20] !== props || $[21] !== t10 || $[22] !== t8 || $[23] !== t9) {
|
|
725
|
+
t11 = /* @__PURE__ */ jsx(T0, {
|
|
726
|
+
...props,
|
|
727
|
+
...dateLimits,
|
|
728
|
+
ref: t8,
|
|
729
|
+
value: t9,
|
|
730
|
+
onChange: t10
|
|
674
731
|
});
|
|
732
|
+
$[18] = T0;
|
|
733
|
+
$[19] = dateLimits;
|
|
734
|
+
$[20] = props;
|
|
735
|
+
$[21] = t10;
|
|
736
|
+
$[22] = t8;
|
|
737
|
+
$[23] = t9;
|
|
738
|
+
$[24] = t11;
|
|
739
|
+
} else t11 = $[24];
|
|
740
|
+
return t11;
|
|
741
|
+
};
|
|
742
|
+
var DateRangePicker = (t0) => {
|
|
743
|
+
const $ = c(30);
|
|
744
|
+
let maxValue;
|
|
745
|
+
let minValue;
|
|
746
|
+
let props;
|
|
747
|
+
let renderStaticInput;
|
|
748
|
+
let t1;
|
|
749
|
+
if ($[0] !== t0) {
|
|
750
|
+
({fullIso: t1, minValue, maxValue, renderStaticInput, ...props} = t0);
|
|
751
|
+
$[0] = t0;
|
|
752
|
+
$[1] = maxValue;
|
|
753
|
+
$[2] = minValue;
|
|
754
|
+
$[3] = props;
|
|
755
|
+
$[4] = renderStaticInput;
|
|
756
|
+
$[5] = t1;
|
|
757
|
+
} else {
|
|
758
|
+
maxValue = $[1];
|
|
759
|
+
minValue = $[2];
|
|
760
|
+
props = $[3];
|
|
761
|
+
renderStaticInput = $[4];
|
|
762
|
+
t1 = $[5];
|
|
675
763
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
764
|
+
const fullIso = t1 === void 0 ? true : t1;
|
|
765
|
+
if ("formControl" in props && props.formControl) {
|
|
766
|
+
let formControl;
|
|
767
|
+
let innerProps;
|
|
768
|
+
let ref;
|
|
769
|
+
if ($[6] !== props) {
|
|
770
|
+
({formControl, ref, ...innerProps} = props);
|
|
771
|
+
$[6] = props;
|
|
772
|
+
$[7] = formControl;
|
|
773
|
+
$[8] = innerProps;
|
|
774
|
+
$[9] = ref;
|
|
775
|
+
} else {
|
|
776
|
+
formControl = $[7];
|
|
777
|
+
innerProps = $[8];
|
|
778
|
+
ref = $[9];
|
|
779
|
+
}
|
|
780
|
+
const controlWithOptions = formControl.control;
|
|
781
|
+
let t2;
|
|
782
|
+
if ($[10] !== controlWithOptions._options?.disabled || $[11] !== fullIso || $[12] !== innerProps || $[13] !== maxValue || $[14] !== minValue || $[15] !== props.error || $[16] !== props.isDisabled || $[17] !== ref || $[18] !== renderStaticInput) {
|
|
783
|
+
t2 = (t3) => {
|
|
784
|
+
const { field, fieldState: t4 } = t3;
|
|
785
|
+
const { error, isDirty } = t4;
|
|
786
|
+
return /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
787
|
+
...innerProps,
|
|
788
|
+
ref: mergeRefs(ref, field.ref),
|
|
789
|
+
value: field.value,
|
|
790
|
+
onChange: field.onChange,
|
|
791
|
+
onBlur: field.onBlur,
|
|
792
|
+
isDirty,
|
|
793
|
+
isDisabled: field.disabled || props.isDisabled,
|
|
794
|
+
isFormControlDisabled: !!controlWithOptions._options?.disabled,
|
|
795
|
+
error: props.error ?? error?.message,
|
|
796
|
+
fullIso,
|
|
797
|
+
minValue,
|
|
798
|
+
maxValue,
|
|
799
|
+
renderStaticInput
|
|
800
|
+
});
|
|
801
|
+
};
|
|
802
|
+
$[10] = controlWithOptions._options?.disabled;
|
|
803
|
+
$[11] = fullIso;
|
|
804
|
+
$[12] = innerProps;
|
|
805
|
+
$[13] = maxValue;
|
|
806
|
+
$[14] = minValue;
|
|
807
|
+
$[15] = props.error;
|
|
808
|
+
$[16] = props.isDisabled;
|
|
809
|
+
$[17] = ref;
|
|
810
|
+
$[18] = renderStaticInput;
|
|
811
|
+
$[19] = t2;
|
|
812
|
+
} else t2 = $[19];
|
|
813
|
+
let t3;
|
|
814
|
+
if ($[20] !== formControl.control || $[21] !== formControl.name || $[22] !== t2) {
|
|
815
|
+
t3 = /* @__PURE__ */ jsx(Controller, {
|
|
816
|
+
control: formControl.control,
|
|
817
|
+
name: formControl.name,
|
|
818
|
+
render: t2
|
|
819
|
+
});
|
|
820
|
+
$[20] = formControl.control;
|
|
821
|
+
$[21] = formControl.name;
|
|
822
|
+
$[22] = t2;
|
|
823
|
+
$[23] = t3;
|
|
824
|
+
} else t3 = $[23];
|
|
825
|
+
return t3;
|
|
826
|
+
}
|
|
827
|
+
let t2;
|
|
828
|
+
if ($[24] !== fullIso || $[25] !== maxValue || $[26] !== minValue || $[27] !== props || $[28] !== renderStaticInput) {
|
|
829
|
+
t2 = /* @__PURE__ */ jsx(DateRangePickerInner, {
|
|
830
|
+
...props,
|
|
831
|
+
fullIso,
|
|
832
|
+
minValue,
|
|
833
|
+
maxValue,
|
|
834
|
+
renderStaticInput
|
|
835
|
+
});
|
|
836
|
+
$[24] = fullIso;
|
|
837
|
+
$[25] = maxValue;
|
|
838
|
+
$[26] = minValue;
|
|
839
|
+
$[27] = props;
|
|
840
|
+
$[28] = renderStaticInput;
|
|
841
|
+
$[29] = t2;
|
|
842
|
+
} else t2 = $[29];
|
|
843
|
+
return t2;
|
|
683
844
|
};
|
|
845
|
+
function _temp(input) {
|
|
846
|
+
const container = input.getContainer?.() ?? input;
|
|
847
|
+
return container instanceof HTMLElement ? container.querySelector("input, button, [tabindex]:not([tabindex='-1'])") : null;
|
|
848
|
+
}
|
|
684
849
|
//#endregion
|
|
685
850
|
export { DateRangePicker };
|